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 /registro_videoconferencia/1 DELETE /registro_videoconferencia/1.json | def destroy
@registro_videoconferencium.destroy
respond_to do |format|
format.html { redirect_to registro_videoconferencia_url, notice: 'Registro videoconferencium was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @videoconferencium.destroy\n respond_to do |format|\n format.html { redirect_to videoconferencia_url, notice: 'Videoconferencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @demanda_videomonitoramento.destroy\n respond_to do |format|\n format.html { redirect_to demanda_videomonitoramentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participante_videoconferencium.destroy\n respond_to do |format|\n format.html { redirect_to participante_videoconferencia_url, notice: 'Participante videoconferencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cambio_comision_registro.destroy\n respond_to do |format|\n format.html { redirect_to cambio_comision_registros_url, notice: 'Cambio comision registro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capitulo.destroy\n respond_to do |format|\n format.html { redirect_to capitulos_url, notice: 'Capitulo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cambio_director_tesis_registro.destroy\n respond_to do |format|\n format.html { redirect_to cambio_director_tesis_registros_url, notice: 'Su petición para cambiar de director(es) de tesis fue eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to @competition, notice: 'Video eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doacao_captacao.destroy\n respond_to do |format|\n format.html { redirect_to doacao_captacaos_url, notice: 'Captação deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n render json: @video, :status => :ok\n end",
"def destroy\n arquivo = Arquivo.find(@pregoestitulosgrafico.arquivo_id)\n\n File.delete(arquivo.caminho)\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n \n @pregoestitulosgrafico.destroy\n respond_to do |format|\n format.html { redirect_to pregoestitulo, notice: 'Arquivo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @cambiar_tema.destroy\r\n respond_to do |format|\r\n format.html { redirect_to cambiar_temas_url, notice: 'Su petición para cambiar de tema de tesis fue eliminada.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @vendamesa.destroy\n respond_to do |format|\n format.html { redirect_to vendamesas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registro_bovino = RegistroBovino.find(params[:id])\n @registro_bovino.destroy\n\n respond_to do |format|\n format.html { redirect_to registro_bovinos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def deleteEntityVideo( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/video\",params)\n end",
"def destroy\n @rango_fecha.destroy\n respond_to do |format|\n format.html { redirect_to rango_fechas_url, notice: 'Rango fecha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kuaibovideo = Kuaibovideo.find(params[:id])\n @kuaibovideo.destroy\n\n respond_to do |format|\n format.html { redirect_to kuaibovideos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @comite_registro.destroy\r\n respond_to do |format|\r\n format.html { redirect_to comite_registros_url, notice: 'Su petición para registrar su comité tutorial fue eliminada.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to ({:action => \"index\", :palestrante_id => @palestrante.id}) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relatorio_plano_de_voo.destroy\n respond_to do |format|\n format.html { redirect_to relatorio_plano_de_voos_url, notice: 'Relatorio plano de voo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vrsta_inventara.destroy\n respond_to do |format|\n format.html { redirect_to vrsta_inventaras_url, notice: 'Vrsta inventara was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @caracteristica_tipo_vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to caracteristica_tipo_vehiculos_url, notice: 'Caracteristica tipo Vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coleccion_imagene.destroy\n respond_to do |format|\n format.html { redirect_to coleccion_imagenes_url, notice: 'Coleccion imagene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vodka = Vodka.find(params[:id])\n @vodka.destroy\n\n respond_to do |format|\n format.html { redirect_to vodkas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @videoo.destroy\n respond_to do |format|\n format.html { redirect_to videoos_url, notice: 'Videoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orcamento.destroy\n respond_to do |format|\n format.html { redirect_to orcamentos_url, notice: 'Orçamento apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recaudacion.destroy\n respond_to do |format|\n format.html { redirect_to recaudacions_url, notice: 'Recaudacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vo2maximo.destroy\n respond_to do |format|\n format.html { redirect_to vo2maximos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conta.destroy\n params[:id] = nil\n respond_to do |format|\n format.html { redirect_to contas_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vacina.destroy\n respond_to do |format|\n format.html { redirect_to vacinas_url, notice: 'Vacina excluida.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @electronica_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to electronica_consejeros_url, notice: 'El nombre del consejero de ingeniería electrónica se eliminó correctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ficha_recinto.destroy\n respond_to do |format|\n format.html { redirect_to ficha_recintos_url, notice: 'Ficha recinto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Vídeo deletado com sucesso' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regra_negocio.destroy\n respond_to do |format|\n format.html { redirect_to regra_negocios_url, notice: 'Regra negocio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venda.destroy\n respond_to do |format|\n format.html { redirect_to vendas_url, notice: t('.apagado') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movimimiento_ventum.destroy\n respond_to do |format|\n format.html { redirect_to movimimiento_venta_url, notice: 'Movimimiento ventum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plannegocio = Plannegocio.find(params[:id])\n @plannegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to plannegocios_url }\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 @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n @visitante_credenciado.destroy\n\n respond_to do |format|\n format.html { redirect_to visitante_credenciados_url }\n format.json { head :no_content }\n end\n \n end",
"def destroy\r\n @electrica_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to electrica_consejeros_url, notice: 'El nombre del consejero de eléctrica se eliminó corrctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congratulations_video.destroy\n respond_to do |format|\n format.html { redirect_to congratulations_videos_url, notice: 'Congratulations video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contador.destroy\n respond_to do |format|\n format.html { redirect_to contadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veterinario.destroy\n respond_to do |format|\n format.html { redirect_to veterinarios_url, notice: \"Veterinario was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recinto = Recinto.find(params[:id])\n @recinto.destroy\n\n respond_to do |format|\n format.html { redirect_to recintos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguro = Seguro.find(params[:id])\n @seguro.destroy\n\n respond_to do |format|\n format.html { redirect_to seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reparticao.destroy\n respond_to do |format|\n format.html { redirect_to reparticoes_url, notice: 'Reparticao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @representante.destroy\n respond_to do |format|\n format.html { redirect_to representantes_url, notice: 'Representante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @votacion.destroy\n respond_to do |format|\n format.html { redirect_to votacions_url, notice: 'Votacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veterinario.destroy\n respond_to do |format|\n format.html { redirect_to veterinarios_url, notice: 'Veterinario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registro_guardium.destroy\n respond_to do |format|\n format.html { redirect_to registro_guardia_url, notice: 'Registro guardium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruta.destroy\n respond_to do |format|\n format.html { redirect_to rutas_url, notice: 'Ruta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @camino.destroy\n respond_to do |format|\n format.html { redirect_to caminos_url, notice: 'Camino was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rescate.destroy\n respond_to do |format|\n format.html { redirect_to rescates_url, notice: 'Rescate fue eleminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_observacion.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_observaciones_url, notice: 'Anteproyecto observacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @campeonato.destroy\n respond_to do |format|\n format.html { redirect_to campeonatos_url, notice: 'Campeonato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @encuesta1.destroy\n respond_to do |format|\n format.html { redirect_to encuesta1s_url, notice: 'Encuesta1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reentrada.destroy\n respond_to do |format|\n format.html { redirect_to reentradas_url, notice: 'Reentrada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_carrito.destroy\n respond_to do |format|\n format.html { redirect_to detalle_carritos_url, notice: 'Detalle carrito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @viagem.destroy\n respond_to do |format|\n format.html { redirect_to viagens_url, notice: 'Viagem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventaganancium.destroy\n respond_to do |format|\n format.html { redirect_to ventaganancia_url, notice: 'Ventaganancium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recoleccion.destroy\n respond_to do |format|\n format.html { redirect_to recoleccions_url, notice: 'Recoleccion was successfully destroyed.' }\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 @cadavre = Cadavre.find(params[:id])\n @cadavre.destroy\n\n respond_to do |format|\n format.html { redirect_to cadavres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voluntario.destroy\n respond_to do |format|\n format.html { redirect_to voluntarios_url, notice: 'Voluntario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voluntario.destroy\n respond_to do |format|\n format.html { redirect_to voluntarios_url, notice: 'Voluntario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movimentacao.destroy\n respond_to do |format|\n format.html { redirect_to movimentacaos_url, notice: \"Movimentação Apagada com Sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registro.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end",
"def destroy\n @contenu_vente.destroy\n respond_to do |format|\n format.html { redirect_to contenu_ventes_url, notice: 'Contenu vente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @encuesta_preguntum.destroy\n respond_to do |format|\n format.html { redirect_to encuesta_pregunta_url, notice: 'Encuesta preguntum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contcelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.74522597",
"0.73999476",
"0.73672694",
"0.7292133",
"0.7283046",
"0.7253298",
"0.72135305",
"0.7207643",
"0.71855456",
"0.7164202",
"0.71505815",
"0.71499646",
"0.71347374",
"0.7123997",
"0.7123974",
"0.7123974",
"0.7082267",
"0.7080422",
"0.7071454",
"0.70684385",
"0.7066363",
"0.7060758",
"0.705948",
"0.7047647",
"0.7047257",
"0.70431906",
"0.7038464",
"0.7038202",
"0.7037449",
"0.7029953",
"0.7028293",
"0.70279217",
"0.70224285",
"0.7022236",
"0.70211226",
"0.7020331",
"0.7016747",
"0.70137167",
"0.70130926",
"0.70104015",
"0.70065844",
"0.7004046",
"0.70035017",
"0.7000542",
"0.6999763",
"0.6997901",
"0.69961643",
"0.6989565",
"0.69890684",
"0.69883466",
"0.6985516",
"0.6979742",
"0.6979627",
"0.6976306",
"0.6975695",
"0.6975218",
"0.6974745",
"0.69738525",
"0.6972696",
"0.6972138",
"0.69688797",
"0.6967529",
"0.6966208",
"0.69649947",
"0.69643044",
"0.69633406",
"0.6963294",
"0.69628817",
"0.69624084",
"0.6961842",
"0.6961324",
"0.6961174",
"0.69605654",
"0.69591105",
"0.69589573",
"0.695677",
"0.69567645",
"0.6955018",
"0.69539577",
"0.695134",
"0.6948684",
"0.6947927",
"0.69413614",
"0.6937501",
"0.6935866",
"0.69321424",
"0.69316113",
"0.6929807",
"0.6929738",
"0.69293964",
"0.69288796",
"0.6928867",
"0.6928867",
"0.692865",
"0.6927175",
"0.6926388",
"0.69263756",
"0.6926262",
"0.6921321",
"0.6916706"
] | 0.7736406 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_registro_videoconferencium
@registro_videoconferencium = RegistroVideoconferencium.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 registro_videoconferencium_params
params.require(:registro_videoconferencium).permit(:estado, :fecha, :hora, :descripcion, :videoconferencia)
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 |
Create a named behavior for a role using the standard library SimpleDelegator. | def wrap(name, &block)
require 'delegate'
wrapper_name = RoleBuilders.mod_name(name)
klass = private_const_set(wrapper_name, Class.new(SimpleDelegator, &block))
klass.send(:include, Surrounded)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_role(role_name)\n role_mapping = self.roles[role_name]\n role_module, obj = role_mapping.role_module, role_mapping.data_object\n obj.extend(role_module)\n obj.instance_variable_set(:@__brassbound_context, self)\n class << obj\n def context\n @__brassbound_context\n end\n end\n self.singleton_class.send(:define_method, role_name) do\n obj\n end\n end",
"def role(name, &block)\n name = name.to_s\n\n unless role = @roles.find{|r| r.name == name}\n role = Salticid::Role.new(name, :salticid => self)\n @roles << role\n end\n\n if block_given?\n role.instance_eval &block\n end\n\n role\n end",
"def associate_role(klass)\n role = self\n klass.class_eval do\n role_accessor_name = \"#{role.name}_role\"\n unless respond_to?(role_accessor_name)\n singleton_class.send(:define_method, role_accessor_name) do\n role\n end\n # else we can't create such a method without creating mayhem, so don't.\n end\n end\n end",
"def role(*args)\n case args.size\n when 2\n role_module = args[0]\n obj = args[1]\n role_name = Util.underscore(role_module.name).to_sym\n when 3\n role_name = args[0]\n role_module = args[1]\n obj = args[2]\n else\n raise ArgumentError\n end\n\n self.roles[role_name] = RoleMapping.new(role_module, obj)\n\n if ::Brassbound::Context.current.equal?(self)\n # If we are already in the execute method, apply the role mapping.\n apply_role(role_name)\n end\n end",
"def give_role(name)\n r = Role.new(:name => name, :user => self)\n self.roles << r\n save(false)\n end",
"def bind behavior\n actor_send :bind, behavior\n end",
"def role_for(name)\n role_name = name.to_s.gsub(/(?:^|_)([a-z])/) { $1.upcase }\n self.class.const_get(role_name)\n rescue NameError\n Module.new\n end",
"def role(role_name)\n context.send(role_name)\n end",
"def method_missing(method_name, *args, &block)\n #creator method will return nil if we can't create the method\n proc = create_role_interrogator!(method_name)\n return proc.call if proc.respond_to?(:call) \n\n proc = create_state_interrogator!(method_name)\n return proc.call if proc.respond_to?(:call) \n\n super\n end",
"def make_member!\n make_role!(MemberRole)\n end",
"def require_role_for(method_name)\n :anonymous\n end",
"def create_role(role_name, assume_role_policy_document, path = '/')\n request(\n 'Action' => 'CreateRole',\n 'RoleName' => role_name,\n 'AssumeRolePolicyDocument' => assume_role_policy_document,\n 'Path' => path,\n :parser => Fog::Parsers::AWS::IAM::SingleRole.new\n )\n end",
"def role(role_name, placement=nil)\n add_to_run_list(\"role[#{role_name}]\", placement)\n self.instance_eval(&@@role_implications[role_name]) if @@role_implications[role_name]\n end",
"def switch(role_name, &block)\n replication_mapping.switch(self, role_name, &block)\n end",
"def behavior name, &block\n yield get_behavior name if block\n get_behavior(name)\n end",
"def switch(role_name, &block)\n replication_mapping.switch(self, role_name, &block)\n end",
"def Role(input, &block) # rubocop:disable Naming/MethodName\n result = case input\n when Sipity::Role\n input\n when String, Symbol\n Sipity::Role.find_or_create_by(name: input)\n end\n\n handle_conversion(input, result, :to_sipity_role, &block)\n end",
"def register_role(name)\n Optopus::Models.ensure_exists('Optopus::Role', :name => name)\n end",
"def create(name, *traits_and_overrides, &block); end",
"def add_role\n person\n end",
"def method_missing(method_id, *args)\n if match = match_role?(method_id)\n self.type.downcase == match.captures.first\n else\n super\n end\n end",
"def role( symbol, *args )\n if args.empty?\n @roles[ symbol.to_sym ]\n else\n @roles[ symbol.to_sym ] += args.flatten.compact\n end\n end",
"def Actor( name )\n return Actor.new name\nend",
"def role_proxy(name)\n if role = roles.find { |r| r.name == name.to_s }\n @role_proxies[name.to_s] ||= RoleProxy.new(self, role)\n end\n end",
"def method_missing(method_sym, *arguments, &block)\n eigenclass = class << self; self; end\n role = Role.find_by(name: method_sym.to_s.tr('?', ''))\n if role\n eigenclass.class_eval do\n define_method(method_sym) do\n role_id == role.id\n end\n end\n else\n super\n end\n send(method_sym)\n end",
"def reuse_role_if_possible( name, &block )\n unless @roles.has_key?( name )\n @roles[ name ] = block.call()\n end\n @roles[ name ]\n end",
"def role(name, options = {}, &block)\n final_options = { name: name }.merge(options).merge(scoped_options: scoped_options)\n require_namespace!('role', final_options)\n\n definitions << Matsuri::DSL::Cluster::Role.new(final_options).tap do |role|\n if options[:resources].present? && options[:verbs].present?\n role.resources(options[:resources], names: options[:resource_names], verbs: options[:verbs], api_groups: options[:api_groups])\n end\n\n role.configure(&block)\n end\n end",
"def behavior(name)\n\n name = name.to_sym\n raise BehaviorError.new(\"undefined behavior '#{name}'\") if $__behavior_info__[name].nil?\n\n clazz = self.method(:behavior).receiver\n\n unless clazz.instance_methods(false).include?(:behaviors)\n class << clazz\n def behaviors\n @behaviors ||= []\n end\n end\n end\n\n clazz.behaviors << name\n\n if self.class == Module\n (class << self; self; end).class_eval do\n define_method(:included) do |base|\n base.class_eval do\n behavior(name)\n end\n end\n end\n end\n\n if self.class == Class\n unless self.respond_to?(:__new)\n class << clazz\n alias_method(:__new, :new)\n end\n end\n end\n\n if $ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION == true\n class << clazz\n def new(*args, &block)\n obj = __new(*args, &block)\n self.ancestors.each do |clazz|\n if clazz.respond_to?(:behaviors)\n clazz.behaviors.each do |behavior|\n valid = obj.behaves_as?(behavior, true)\n end\n end\n end\n return obj\n end\n end\n end\n end",
"def create(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Create, traits_and_overrides).run(&block)\n end",
"def delegate_class(name, class_name, &block)\n require 'delegate'\n wrapper_name = RoleBuilders.mod_name(name)\n klass = private_const_set(wrapper_name, DelegateClass(Object.const_get(class_name.to_s)))\n klass.class_eval(&block)\n klass.send(:include, Surrounded)\n end",
"def create_type_from_name\n raise \"roles require a name\" if self.name.nil?\n raise \"roles require a barclamp\" if self.barclamp_id.nil?\n namespace = \"Barclamp#{self.barclamp.name.camelize}\"\n # remove the redundant part of the name (if any)\n name = self.name.sub(\"#{self.barclamp.name}-\", '').camelize\n # these routines look for the namespace & class\n m = Module::const_get(namespace) rescue nil\n # barclamps can override specific roles\n test_specific = m.const_get(name).superclass == Role rescue false\n # barclamps can provide a generic fallback \"BarclampName::Role\"\n test_generic = m.const_get(\"Role\").superclass == Role rescue false\n # if they dont' find it we fall back to the core Role\n self.type = if test_specific\n \"#{namespace}::#{name}\"\n elsif test_generic\n \"#{namespace}::Role\"\n else\n Rails.logger.info \"Role #{self.name} created with fallback Model!\"\n \"Role\"\n end\n end",
"def add_role(name)\n name = \"role[#{name}]\" unless name =~ /^role\\[(.+?)\\]$/\n run_list << name\n end",
"def add_role(name)\n name = \"role[#{name}]\" unless name =~ /^role\\[(.+?)\\]$/\n run_list << name\n end",
"def interface(name, &block)\n interface_name = RoleBuilders.mod_name(name) + 'Interface'\n\n behavior = private_const_set(interface_name, Module.new(&block))\n\n require 'surrounded/context/negotiator'\n undef_method(name)\n define_method(name) do\n instance_variable_set(\"@#{name}\", Negotiator.new(role_map.assigned_player(name), behavior))\n end\n end",
"def role; end",
"def role; end",
"def add_role!(role)\n role_obj = Role.find_or_create_by_name(role)\n self.add_role(role_obj.name)\n end",
"def expect_role name, value\n expect_type name, value, \"Role\", lambda{ test_role value }\n end",
"def registerRoleByFullname\n if (@role.nil? or @role_level != 'admin') and !current_actor.superadmin\n json_response({ message: \"You don't have permission to create roles for this project\" }, :unauthorized)\n return\n end\n if params[\"fullname\"].nil?\n json_response({ message: \"No fullname provided\" }, :forbidden)\n return\n end\n actor = Actor.find_by fullname: params[\"fullname\"]\n if actor.nil?\n json_response({ message: \"No actor found with that fullname\" }, 404)\n return\n end\n @created_role = Role.create(project_id: @project.id, actor_id: actor.id, role_level_id: \"2\", clusters_permissions: true, services_permissions: true, subscriptions_permissions: true)\n json_response(@created_role, :created)\n end",
"def become behavior\n @actor.become behavior\n end",
"def create_role(name, perms=nil)\n perms ||= []\n role = {\n :name => name,\n :permissions => perms,\n }\n post(\"/roles\", role)\n end",
"def role(*args)\n cap_role(*args)\n puppet_role(*args)\n end",
"def assign_role(character)\n Role.new(self, character)\n end",
"def role(rolekey, &block)\n raise \"role name must be a symbol\" unless rolekey.is_a?(Symbol)\n create_role_from(rolekey, &block)\n define_reader_for_role(rolekey)\n define_mate_roleplayers_readers_after_newrole(rolekey)\n end",
"def role(role, options = {})\n append_role role, options\n @current_role = role\n yield\n ensure\n @current_role = nil\n end",
"def role(role, options = {})\n append_role role, options\n @current_role = role\n yield\n ensure\n @current_role = nil\n end",
"def create_role(person_id)\n Role.new(\n :role_type_id => 20,\n :person_id => person_id,\n :organisation_id => 1,\n :contactinfo_id => 300,\n :role_title => 'Test role for person '+person_id.to_s,\n :general_note => 'Test note for person '+person_id.to_s\n )\n end",
"def oo_default_role_name\n name.words.snakecase\n end",
"def bind(type, name, options = {}, &block)\n case type\n when :role then bind_role(name, options, &block)\n when :cluster_role then bind_cluster_role(name, options, &block)\n else\n fail ArgumentError, \"bind type must be :role or :cluster_role. Is: #{type}\"\n end\n end",
"def helper(name, &block)\n delegation_obj = subject.__getobj__\n subject.define_singleton_method(name.to_sym) do\n instance_exec(delegation_obj, &block)\n end\n end",
"def create_role_subclass_from(rolekey, &block)\n new_klass_name = rolekey.to_s.split(/\\_+/).map(&:capitalize).join('')\n const_set(new_klass_name, Class.new(::DCI::Role, &block))\n end",
"def add_role(user, role_name)\n role = Role.new(name: role_name, user: user)\n self.roles << role\n return role\n end",
"def authorize(required_role)\n self.send required_role.to_sym\n end",
"def take_role(name)\n r = self.roles.find_by_name(name)\n r.destroy unless r.nil?\n save(false)\n end",
"def add_role!(role_name)\n role = Role.find_by_name!(role_name.to_s)\n self.roles << role unless self.roles.include?(role)\n end",
"def accept_role role\n self.roles.push role\n end",
"def resource_name\n\t\t\"role\"\n\tend",
"def register_handler(name, opts = {}, &block)\n klass = opts.delete(:class_name) || \"::#{name.to_s.camelize}\"\n create_handler_predicate_method name\n handlers[name] = Runner.new(name, klass.to_s.constantize, self, opts, &block)\n end",
"def set_role\n self.role ||= 'standard'\n end",
"def create_role(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateRole'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :assume_role_policy_document\n\t\t\targs[:query]['AssumeRolePolicyDocument'] = optional[:assume_role_policy_document]\n\t\tend\n\t\tif optional.key? :description\n\t\t\targs[:query]['Description'] = optional[:description]\n\t\tend\n\t\tif optional.key? :role_name\n\t\t\targs[:query]['RoleName'] = optional[:role_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def add_role(name)\n role = Role.find_by_name(name)\n if role != nil\n # role exists\n self.roles << role unless self.roles.include?(role)\n end\n end",
"def create_abstract_instance_method(name); end",
"def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end",
"def with_role(role_name)\n self.role = Role.where(name: role_name).first_or_create\n self # returns the user\n end",
"def add_role (role_name)\n self.update_attribute(:role_id,Role.find_or_create_by(name: role_name).id)\n end",
"def add_role (role_name)\n self.update_attribute(:role_id,Role.find_or_create_by(name: role_name).id)\n end",
"def set_default_role\n if self.admin?\n self.admin!\n else\n self.writer!\n end\n end",
"def set_role\n @role = role\n end",
"def create_role(name, owner_key, access_type)\n name ||= random_string 'test_role'\n perms = [{\n :owner => {:key => owner_key},\n :access => access_type,\n }]\n role = @cp.create_role(name, perms)\n\n # Only append to the list of things to clean up if the @roles exists.\n # This is so the method can be used in before(:all) blocks.\n @roles << role if not @roles.nil?\n return role\n end",
"def add_role(role)\n return ServiceContract.error('Role must be a symbol') if role.class.name.to_sym != :Symbol\n\n return ServiceContract.error(\"Role type '#{role}' is not available.\") unless Role.valid_role?(role)\n\n target_role = Role.find_by_slug(role)\n roles << target_role unless roles.include?(target_role)\n ServiceContract.success(roles)\n end",
"def setup_role role_kind:, role:\n role_info = extract_role_attrs role: role\n role_name = role_info[:role_name]\n version = role_info[:version]\n created_at = role_info[:created_at]\n is_default = role_info[:is_default]\n is_composite = role_info[:is_composite]\n is_aggregable = role_info[:is_aggregable]\n aggregable_by = role_info[:aggregable_by]\n\n info \"-- Indexing [#{role_kind}] #{role_name}\"\n\n cache_aggregable_roles aggregable_by: aggregable_by, role_kind: role_kind, role_name: role_name\n\n namespace = role_kind == :Role ? role['metadata']['namespace'] : Krane::Rbac::Graph::Builder::ALL_NAMESPACES_PLACEHOLDER\n\n # caching role namespace scope\n @role_ns_lookup[role_name] = namespace if role_kind == :Role \n\n entry = {\n role_kind: role_kind,\n role_name: role_name\n }\n \n @defined_roles << entry # caching role as defined\n @default_roles << entry if is_default # cache default roles\n\n node :namespace, { name: namespace }\n node :role, { \n kind: role_kind, \n name: role_name, \n is_default: is_default, \n is_composite: is_composite,\n is_aggregable: is_aggregable, \n aggregable_by: aggregable_by.join(', '),\n version: version,\n created_at: created_at \n }\n edge :scope, { \n role_kind: role_kind, \n role_name: role_name, \n namespace: namespace \n }\n\n return if role_info[:rules].blank?\n\n # Iterating the Rules\n role_info[:rules].map {|rule| process_rule rule }.flatten.each do |rule|\n node :rule, { rule: rule }\n edge :grant, {\n role_kind: role_kind,\n role_name: role_name,\n rule: rule\n }\n edge :security, { rule: rule }\n end\n end",
"def create\n Statements::CreateRole.new(context: self)\n end",
"def addrole\n\t\tself.add_role :Guest\n\tend",
"def create_actor(options={}, type='actor')\n name = type.titleize.gsub('/', '::').gsub(' ', '')\n base = name.split('::').first.intern\n\n name.prepend(\"Gamework::\") if Gamework.constants.include? base\n name += \"::Base\" if name.constantize.constants.include? :Base\n\n klass = name.constantize\n add_actor klass.new(options)\n end",
"def create_action(name, &block)\n action = proc { actions << lambda { block.call(current_location) } }\n metaclass.send :define_method, name, &action\n end",
"def new\n @role = System::Role.new\n end",
"def initialize(name, behaviors = {}, &block)\n self.name = name\n extract_behaviors( behaviors )\n end",
"def method_missing(method_name, *args, &block)\n name = method_name.to_s\n if invocation = name.end_with?(\"!\")\n name.chop!\n end\n\n if invocation\n # namespace \"NorthPole\" do\n # santa! <-- mote_definition\n # end\n motives = self.motives.map(&:dup) + args\n mote_definition = self.mote_definition! name, *motives\n self.add_mote_definition mote_definition\n if block_given?\n # namespace \"NorthPole\" do\n # ice_cap! do\n # ...\n # end\n # end\n self.eval_mote_block mote_definition, &block\n end\n self.mote_definition_expression mote_definition\n else\n # parent_mote! do\n # namespace \"Foo\" do\n # constant \"Bar\" do\n # end\n # end\n #\n # namespace \"Blurgle\" do\n # my_mote! constant(\"Eek\")\n # end\n # end\n if self.motive_instance_resolvable? name\n self.motive_instance!(name, *args).tap do |motive_instance|\n if block_given?\n self.eval_motive_block motive_instance, &block\n end\n end\n else\n validate_mote_name! name\n self.mote_reference name, *args\n end\n end\n end",
"def node_role(kind:, name:, version: nil, created_at: nil, defined: true, \n is_default: false, is_composite: false, is_aggregable: false, aggregable_by: '')\n label = make_label kind, name\n\n # build a hash attributes for the node automatically\n attrs = (local_variables - [:label, :attrs]).each_with_object({}) do |p, hsh|\n hsh[p] = binding.local_variable_get(p)\n end\n\n add_node :Role, label, attrs\n end",
"def role?(role_name)\n role == role_name\n \n end",
"def set_role\n return if role?\n\n self.role = 'regular'\n end",
"def assign_role(role = :villager)\n klass = role.to_s.classify.constantize\n if klass.new.is_a?(Player)\n self.update_attribute(:type, role.to_s.classify)\n klass.find(self.id)\n else\n false\n end\n end",
"def set_default_role\n \tself.role ||= :normal\n end",
"def create_role(role_name, params = {})\n change_role_access(role_name, user_emails_to_ids(params), :post)\n end",
"def set_default_role\n self.add_role :merchant\n end",
"def to(params = {}, &block)\n if block_given?\n new_behavior = self.class.new({}, params, self)\n yield new_behavior if block_given?\n new_behavior\n else\n to_route(params).register\n end\n end",
"def create_method(name, &block)\n eigen = class << self; self; end\n eigen.send(:define_method, name, &block)\n end",
"def new_name(old_name)\n \"flexmock_original_behavior_for_#{old_name}\"\n end",
"def new_name(old_name)\n \"flexmock_original_behavior_for_#{old_name}\"\n end",
"def create_method( name, &block )\n self.class.send( :define_method, name, &block )\n end",
"def build_stubbed(name, *traits_and_overrides, &block); end",
"def role_name\n @role_name ||= object.meta[:role].try(:capitalize)\n end",
"def mixin_specific_behaviour\n raise \"Roles require a name\" if self.name.nil?\n Rails.logger.info(\"Seeing if #{self.name} has a mixin...\")\n begin\n mod = \"barclamp_#{barclamp.name}\".camelize.to_sym\n return self unless Module::const_defined?(mod)\n mod = Module::const_get(mod)\n [\"role\",\n self.name].map{|m|m.tr(\"-\",\"_\").camelize.to_sym}.each do |m|\n return self unless mod.const_defined?(m)\n mod = mod.const_get(m)\n return self unless mod.kind_of?(Module)\n end\n Rails.logger.info(\"Extending #{self.name} with #{mod}\")\n self.extend(mod)\n rescue\n # nothing for now, this code is going away\n end\n end",
"def attach_policy_to_role(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AttachPolicyToRole'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :policy_name\n\t\t\targs[:query]['PolicyName'] = optional[:policy_name]\n\t\tend\n\t\tif optional.key? :policy_type\n\t\t\targs[:query]['PolicyType'] = optional[:policy_type]\n\t\tend\n\t\tif optional.key? :role_name\n\t\t\targs[:query]['RoleName'] = optional[:role_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def get_role_name(role_type, role)\n method_symbol = ROLES[role_type]\n\n return nil if method_symbol.nil?\n\n role_object = role.send(method_symbol)\n\n return nil if role_object.name.empty?\n\n role_object.name\n end",
"def toggle_role\n do_toggle_role params[:role]\n end",
"def skill_roll (msg, skill_name, num=nil)\n # Set some defaults\n num &&= num.to_i\n num ||= 20\n\n # Get the player\n player = verify_player msg\n return unless player\n\n # Check that the skill exists\n skill = player.skill_exists? skill_name\n unless skill\n msg.reply \"I'm sorry, #{skill_name} is not a valid skill.\"\n return\n end\n\n # Finally we make a role\n msg.reply \"#{msg.user.nick} rolled #{skill.roll num}\"\n end",
"def create(role:, type:, permissions: [], pattern: nil)\n\t\t\t\t\tconnection.post(build_path('addRole'), nil, roleName: role, type: type,\n\t\t\t\t\t\tpermissionIds: (permissions || []).join(','), pattern: pattern, overwrite: false).\n\t\t\t\t\t\tcode == '200'\n\t\t\t\tend",
"def setup_role\n #get_statuses(@role)\n #set_default_status(@role)\n end",
"def role_name\n object.role_name\n end"
] | [
"0.6011108",
"0.5729127",
"0.5701763",
"0.5509641",
"0.54447526",
"0.5380843",
"0.5378879",
"0.5348573",
"0.53369236",
"0.53357744",
"0.53312635",
"0.53207797",
"0.5276843",
"0.5262182",
"0.52580714",
"0.5249163",
"0.5228657",
"0.5204873",
"0.517466",
"0.5136834",
"0.51265836",
"0.51083404",
"0.5086634",
"0.50814265",
"0.50595814",
"0.50587106",
"0.5047591",
"0.50370646",
"0.50351214",
"0.5009998",
"0.49995744",
"0.49802557",
"0.49741292",
"0.4973583",
"0.49707907",
"0.49707907",
"0.49328408",
"0.49259737",
"0.4918057",
"0.49061823",
"0.4898468",
"0.489531",
"0.4895124",
"0.4868203",
"0.48548117",
"0.48548117",
"0.4847531",
"0.48271644",
"0.48128176",
"0.48046255",
"0.47944775",
"0.47738332",
"0.4759159",
"0.4748082",
"0.47439006",
"0.47362703",
"0.47337818",
"0.47318298",
"0.47261178",
"0.47255883",
"0.47230816",
"0.47066078",
"0.47001305",
"0.4695517",
"0.46929303",
"0.46929303",
"0.46895057",
"0.46838334",
"0.4681832",
"0.46779388",
"0.4676807",
"0.46725857",
"0.4669106",
"0.46600312",
"0.4657298",
"0.4648949",
"0.46427837",
"0.4638133",
"0.46315128",
"0.46240902",
"0.4620632",
"0.46191958",
"0.4609802",
"0.4607916",
"0.4606556",
"0.46054542",
"0.4604844",
"0.45994404",
"0.45994404",
"0.4597572",
"0.4596487",
"0.45947626",
"0.4594513",
"0.4592251",
"0.45922062",
"0.45913327",
"0.45899177",
"0.4584273",
"0.4582134",
"0.4574761"
] | 0.57081705 | 2 |
Create a named behavior for a role using the standard library DelegateClass. This ties the implementation of the role to a specific class or module API. | def delegate_class(name, class_name, &block)
require 'delegate'
wrapper_name = RoleBuilders.mod_name(name)
klass = private_const_set(wrapper_name, DelegateClass(Object.const_get(class_name.to_s)))
klass.class_eval(&block)
klass.send(:include, Surrounded)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def associate_role(klass)\n role = self\n klass.class_eval do\n role_accessor_name = \"#{role.name}_role\"\n unless respond_to?(role_accessor_name)\n singleton_class.send(:define_method, role_accessor_name) do\n role\n end\n # else we can't create such a method without creating mayhem, so don't.\n end\n end\n end",
"def apply_role(role_name)\n role_mapping = self.roles[role_name]\n role_module, obj = role_mapping.role_module, role_mapping.data_object\n obj.extend(role_module)\n obj.instance_variable_set(:@__brassbound_context, self)\n class << obj\n def context\n @__brassbound_context\n end\n end\n self.singleton_class.send(:define_method, role_name) do\n obj\n end\n end",
"def behavior(name)\n\n name = name.to_sym\n raise BehaviorError.new(\"undefined behavior '#{name}'\") if $__behavior_info__[name].nil?\n\n clazz = self.method(:behavior).receiver\n\n unless clazz.instance_methods(false).include?(:behaviors)\n class << clazz\n def behaviors\n @behaviors ||= []\n end\n end\n end\n\n clazz.behaviors << name\n\n if self.class == Module\n (class << self; self; end).class_eval do\n define_method(:included) do |base|\n base.class_eval do\n behavior(name)\n end\n end\n end\n end\n\n if self.class == Class\n unless self.respond_to?(:__new)\n class << clazz\n alias_method(:__new, :new)\n end\n end\n end\n\n if $ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION == true\n class << clazz\n def new(*args, &block)\n obj = __new(*args, &block)\n self.ancestors.each do |clazz|\n if clazz.respond_to?(:behaviors)\n clazz.behaviors.each do |behavior|\n valid = obj.behaves_as?(behavior, true)\n end\n end\n end\n return obj\n end\n end\n end\n end",
"def wrap(name, &block)\n require 'delegate'\n wrapper_name = RoleBuilders.mod_name(name)\n klass = private_const_set(wrapper_name, Class.new(SimpleDelegator, &block))\n klass.send(:include, Surrounded)\n end",
"def create_role_subclass_from(rolekey, &block)\n new_klass_name = rolekey.to_s.split(/\\_+/).map(&:capitalize).join('')\n const_set(new_klass_name, Class.new(::DCI::Role, &block))\n end",
"def role(*args)\n case args.size\n when 2\n role_module = args[0]\n obj = args[1]\n role_name = Util.underscore(role_module.name).to_sym\n when 3\n role_name = args[0]\n role_module = args[1]\n obj = args[2]\n else\n raise ArgumentError\n end\n\n self.roles[role_name] = RoleMapping.new(role_module, obj)\n\n if ::Brassbound::Context.current.equal?(self)\n # If we are already in the execute method, apply the role mapping.\n apply_role(role_name)\n end\n end",
"def bind behavior\n actor_send :bind, behavior\n end",
"def create(name, *traits_and_overrides, &block); end",
"def delegate_to klass_or_object\n @delegators.each do |data|\n unless data.empty?\n name = data[:name]\n args = data[:params]\n klass_or_object.send(name, *args)\n end\n end\n end",
"def create(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Create, traits_and_overrides).run(&block)\n end",
"def create_abstract_instance_method(name); end",
"def role(name, &block)\n name = name.to_s\n\n unless role = @roles.find{|r| r.name == name}\n role = Salticid::Role.new(name, :salticid => self)\n @roles << role\n end\n\n if block_given?\n role.instance_eval &block\n end\n\n role\n end",
"def add_behaviour behaviour_class, options\n options[:character ]=self\n b = behaviour_class.new(options)\n @behaviours << b if b.kind_of? Behaviour\n end",
"def create_type_from_name\n raise \"roles require a name\" if self.name.nil?\n raise \"roles require a barclamp\" if self.barclamp_id.nil?\n namespace = \"Barclamp#{self.barclamp.name.camelize}\"\n # remove the redundant part of the name (if any)\n name = self.name.sub(\"#{self.barclamp.name}-\", '').camelize\n # these routines look for the namespace & class\n m = Module::const_get(namespace) rescue nil\n # barclamps can override specific roles\n test_specific = m.const_get(name).superclass == Role rescue false\n # barclamps can provide a generic fallback \"BarclampName::Role\"\n test_generic = m.const_get(\"Role\").superclass == Role rescue false\n # if they dont' find it we fall back to the core Role\n self.type = if test_specific\n \"#{namespace}::#{name}\"\n elsif test_generic\n \"#{namespace}::Role\"\n else\n Rails.logger.info \"Role #{self.name} created with fallback Model!\"\n \"Role\"\n end\n end",
"def define_active_record_attr_delegations(ar_name, ar_class)\n ar_class.extend Forwardable\n\n spira_attr_names = properties.keys - ar_class.attribute_names\n spira_name = self.name.underscore.to_sym\n ar_class.def_delegators spira_name, *spira_attr_names\n end",
"def method_missing(method_name, *args, &block)\n #creator method will return nil if we can't create the method\n proc = create_role_interrogator!(method_name)\n return proc.call if proc.respond_to?(:call) \n\n proc = create_state_interrogator!(method_name)\n return proc.call if proc.respond_to?(:call) \n\n super\n end",
"def role_for(name)\n role_name = name.to_s.gsub(/(?:^|_)([a-z])/) { $1.upcase }\n self.class.const_get(role_name)\n rescue NameError\n Module.new\n end",
"def define_delegator(method_name)\n target_name = @target_name\n @scope.send(:define_method, method_name) do |*args|\n send(target_name).public_send(method_name, *args)\n end\n end",
"def role(role_name, placement=nil)\n add_to_run_list(\"role[#{role_name}]\", placement)\n self.instance_eval(&@@role_implications[role_name]) if @@role_implications[role_name]\n end",
"def construct_advised_for mod, meth, kind\n advice = self\n\n advised = Advised.new(advice, mod, meth, kind)\n\n case @advised_extend\n when nil\n when Module\n advised.extend(@advised_extend)\n when Array\n @advised_extend.each { | m | advised.extend(m) }\n else\n raise TypeError, \"advised_extend: expected nil, Module or Array of Modules, given #{@advised_extend.class}\"\n end\n\n advised.register_advice_methods!\n\n advised.define_new_method!\n\n @advised << advised\n\n advised\n end",
"def create_actor(options={}, type='actor')\n name = type.titleize.gsub('/', '::').gsub(' ', '')\n base = name.split('::').first.intern\n\n name.prepend(\"Gamework::\") if Gamework.constants.include? base\n name += \"::Base\" if name.constantize.constants.include? :Base\n\n klass = name.constantize\n add_actor klass.new(options)\n end",
"def define(klass, **traits)\n @trait_library[klass] ||= {}\n\n if alternate_create_method = traits.delete(:create_using)\n @alternate_create_methods[klass] = [alternate_create_method, traits.delete(:create_using_kwargs) || {}]\n end\n\n (traits.keys & BLOCK_KEYS).each do |block_type|\n raise Traitor::Error.new(\"Callbacks are forbidden!\") if Traitor::Config.no_callbacks\n block = traits.delete block_type\n @block_library[klass] ||= {class: {}, traits: {}}\n @block_library[klass][:class][block_type] = block\n end\n\n traits.each do |trait, attributes|\n (attributes.keys & BLOCK_KEYS).each do |block_type|\n raise Traitor::Error.new(\"Callbacks are forbidden!\") if Traitor::Config.no_callbacks\n block = attributes.delete block_type\n @block_library[klass] ||= {class: {}, traits: {}}\n @block_library[klass][:traits][trait] ||= {}\n @block_library[klass][:traits][trait][block_type] = block\n end\n end\n\n @trait_library[klass].merge!(traits)\n end",
"def create_new_method(abstract_class); end",
"def create(klass, *args, &block)\n\t\t\t#puts caller\n\t\t\tc = klass\n\t\t\t#go through rules\n\t\t\t#ask each replace? klass\n\n\t\t\tif(@rules)\n\t\t\t\[email protected] { |r| \n\t\t\t\t\tx = r.replace?(klass)\n\t\t\t\t\tif x && r.test?(klass,*args,&block) then c = x end}\n\t\t\tend\n\n\t\t\tif(!c.is_a?(Class)) then\n\t\t\t\traise \"ClassConductor asked to init something which isn't a class: #{c}\"\n\t\t\tend\n\t\t\t\n\t\t\tobj = c.class_conductor_aliased_new(*args,&block)\n\t\t\t\n\t\t\tif(@rules)\n\t\t\t\[email protected] {|r| if r.wrap?(obj) then obj = r.dowrap(obj) end}\n\t\t\tend\n\t\t\tobj\n\t\tend",
"def create_class_override(method_name, &block)\n internal_create_override method_name, :class, &block \n end",
"def new_ar_class(name=\"\", &proc)\n new_named_class(ActiveRecord::Base, name, &proc)\n end",
"def role_proxy(name)\n if role = roles.find { |r| r.name == name.to_s }\n @role_proxies[name.to_s] ||= RoleProxy.new(self, role)\n end\n end",
"def mixin_specific_behaviour\n raise \"Roles require a name\" if self.name.nil?\n Rails.logger.info(\"Seeing if #{self.name} has a mixin...\")\n begin\n mod = \"barclamp_#{barclamp.name}\".camelize.to_sym\n return self unless Module::const_defined?(mod)\n mod = Module::const_get(mod)\n [\"role\",\n self.name].map{|m|m.tr(\"-\",\"_\").camelize.to_sym}.each do |m|\n return self unless mod.const_defined?(m)\n mod = mod.const_get(m)\n return self unless mod.kind_of?(Module)\n end\n Rails.logger.info(\"Extending #{self.name} with #{mod}\")\n self.extend(mod)\n rescue\n # nothing for now, this code is going away\n end\n end",
"def di_wire(name, clazz, *args, &block)\n init_proc = lambda{ clazz.new(*args) }\n di_define_method(name, init_proc, block)\n end",
"def interface(name, &block)\n interface_name = RoleBuilders.mod_name(name) + 'Interface'\n\n behavior = private_const_set(interface_name, Module.new(&block))\n\n require 'surrounded/context/negotiator'\n undef_method(name)\n define_method(name) do\n instance_variable_set(\"@#{name}\", Negotiator.new(role_map.assigned_player(name), behavior))\n end\n end",
"def create_behavior(attributes)\n BrickFTP::API::Behavior.create(attributes)\n end",
"def create_behavior(attributes)\n BrickFTP::API::Behavior.create(attributes)\n end",
"def register_handler(name, opts = {}, &block)\n klass = opts.delete(:class_name) || \"::#{name.to_s.camelize}\"\n create_handler_predicate_method name\n handlers[name] = Runner.new(name, klass.to_s.constantize, self, opts, &block)\n end",
"def create_using(klass, create_method, *traits, **attributes)\n old_create_method_kwargs = @alternate_create_methods[klass]\n @alternate_create_methods[klass] = [create_method, attributes.delete(:create_kwargs) || {}]\n create(klass, *traits, **attributes)\n ensure\n @alternate_create_methods[klass] = old_create_method_kwargs\n end",
"def helper(name, &block)\n delegation_obj = subject.__getobj__\n subject.define_singleton_method(name.to_sym) do\n instance_exec(delegation_obj, &block)\n end\n end",
"def create_class(name) \n AsmProxyClass.new(name)\n end",
"def decorator_for(context, klass)\n return unless klass.name\n\n \"#{context}/#{klass.name.underscore}_decorator\".classify.safe_constantize\n end",
"def add_module_irc_behavior(type)\n define_add_behaviour type\n define_del_behaviour type\n end",
"def method_missing(method_sym, *arguments, &block)\n eigenclass = class << self; self; end\n role = Role.find_by(name: method_sym.to_s.tr('?', ''))\n if role\n eigenclass.class_eval do\n define_method(method_sym) do\n role_id == role.id\n end\n end\n else\n super\n end\n send(method_sym)\n end",
"def create_action(name, &block)\n action = proc { actions << lambda { block.call(current_location) } }\n metaclass.send :define_method, name, &action\n end",
"def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end",
"def define_spira_attr_delegations(ar_name, ar_class)\n extend Forwardable\n\n ar_attr_names = ar_class.attribute_names - properties.keys\n def_delegators ar_name, *ar_attr_names\n end",
"def create_method(name, &block)\n eigen = class << self; self; end\n eigen.send(:define_method, name, &block)\n end",
"def add_std_behaviour behaviour_class, options\n options[:character ]=self\n b = behaviour_class.new(options)\n @std_behaviours << b if b.kind_of? Behaviour\n end",
"def give_role(name)\n r = Role.new(:name => name, :user => self)\n self.roles << r\n save(false)\n end",
"def add_role(role)\n return ServiceContract.error('Role must be a symbol') if role.class.name.to_sym != :Symbol\n\n return ServiceContract.error(\"Role type '#{role}' is not available.\") unless Role.valid_role?(role)\n\n target_role = Role.find_by_slug(role)\n roles << target_role unless roles.include?(target_role)\n ServiceContract.success(roles)\n end",
"def decorate(klass) #:nodoc:\n registered.each do |plugin|\n name = plugin.name.split(/::/).last.gsub(/([A-Z])/, '_\\1').downcase.\n sub(/^_/, '')\n ivar = \"@#{name}\"\n\n klass.send(:define_method, name) do\n instance = instance_variable_defined?(ivar) &&\n instance_variable_get(ivar)\n\n instance ||= instance_variable_set(ivar, plugin.new(self))\n end\n end\n end",
"def method_missing(method_id, *args)\n if match = match_role?(method_id)\n self.type.downcase == match.captures.first\n else\n super\n end\n end",
"def delegate_object; end",
"def assign_role(role = :villager)\n klass = role.to_s.classify.constantize\n if klass.new.is_a?(Player)\n self.update_attribute(:type, role.to_s.classify)\n klass.find(self.id)\n else\n false\n end\n end",
"def require_delegation\n require 'active_support/core_ext/module/delegation'\nend",
"def delegate *names, to:\n names.each do |name|\n def_delegator to, name\n end\n end",
"def add_role!(role)\n role_obj = Role.find_or_create_by_name(role)\n self.add_role(role_obj.name)\n end",
"def Role(input, &block) # rubocop:disable Naming/MethodName\n result = case input\n when Sipity::Role\n input\n when String, Symbol\n Sipity::Role.find_or_create_by(name: input)\n end\n\n handle_conversion(input, result, :to_sipity_role, &block)\n end",
"def register_role(name)\n Optopus::Models.ensure_exists('Optopus::Role', :name => name)\n end",
"def generate\n base_name = camel_case identifier.to_s\n decorate_klass_name base_name\n end",
"def create_role(role_name, assume_role_policy_document, path = '/')\n request(\n 'Action' => 'CreateRole',\n 'RoleName' => role_name,\n 'AssumeRolePolicyDocument' => assume_role_policy_document,\n 'Path' => path,\n :parser => Fog::Parsers::AWS::IAM::SingleRole.new\n )\n end",
"def define_action(name, opts = {}, &blk)\n actions << name\n\n create_method(name) do |*args, &block|\n hargs = blk ? blk.call(*args) : args\n method = opts[:delegate_to] || name\n with_handler.send(method, *hargs, &block)\n end\n\n alias_method opts[:alias], name if opts[:alias]\n end",
"def method_missing(method, *args, &block)\n send(target_method(method), method, *args, &block).tap do \n create_delegation_method!(method)\n end\n end",
"def base_class\n _safe_constantize(name.sub(\"Decorator\", \"\"))\n end",
"def unapply_role(role_name)\n role_mapping = self.roles[role_name]\n role_module, obj = role_mapping.role_module, role_mapping.data_object\n obj.instance_variable_set(:@__brassbound_context, nil)\n role_module.instance_methods.each do |m|\n obj.singleton_class.send(:undef_method, m)\n end\n obj.singleton_class.send(:undef_method, :context) if obj.respond_to?(:context)\n self.singleton_class.send(:undef_method, role_name)\n end",
"def dispatch(object, method_name, ...)\n if object.respond_to?(:cast)\n object.cast(method_name, context.role_implementing(object, method_name), ...)\n else\n Casting::Delegation.prepare(method_name, object).to(role_implementing(object, method_name)).with(...).call\n end\n end",
"def define_new_method!\n advised = self\n\n advised.mod_target.instance_eval do\n define_method advised.new_meth do | *args, &block |\n ar = ActivationRecord.new(advised, self, args, block)\n\n # Proc to invoke the old method with :before and :after advise hooks.\n body = Proc.new do\n self.__send__(advised.before_meth, ar)\n begin\n ar.result = self.__send__(advised.old_meth, *ar.args, &ar.block)\n rescue ::Object => err\n ar.error = err\n ensure\n self.__send__(advised.after_meth, ar)\n end\n ar.result\n end\n\n # Invoke the :around advice with the body Proc.\n self.__send__(advised.around_meth, ar, body)\n\n # Reraise Exception, if occured.\n raise ar.error if ar.error\n\n # Return the message result to caller.\n ar.result\n end # define_method\n end # instance_eval\n\n self\n end",
"def create_method( name, &block )\n self.class.send( :define_method, name, &block )\n end",
"def delegate_method; end",
"def Actor( name )\n return Actor.new name\nend",
"def require_role_for(method_name)\n :anonymous\n end",
"def role(role_name)\n context.send(role_name)\n end",
"def add_workflow_responsibilities(role, agents)\n Hyrax::Workflow::PermissionGenerator.call(roles: role,\n workflow: self,\n agents: agents)\n end",
"def create_role(name, owner_key, access_type)\n name ||= random_string 'test_role'\n perms = [{\n :owner => {:key => owner_key},\n :access => access_type,\n }]\n role = @cp.create_role(name, perms)\n\n # Only append to the list of things to clean up if the @roles exists.\n # This is so the method can be used in before(:all) blocks.\n @roles << role if not @roles.nil?\n return role\n end",
"def role(name, options = {}, &block)\n final_options = { name: name }.merge(options).merge(scoped_options: scoped_options)\n require_namespace!('role', final_options)\n\n definitions << Matsuri::DSL::Cluster::Role.new(final_options).tap do |role|\n if options[:resources].present? && options[:verbs].present?\n role.resources(options[:resources], names: options[:resource_names], verbs: options[:verbs], api_groups: options[:api_groups])\n end\n\n role.configure(&block)\n end\n end",
"def _active_add_facade! cls, new_target = nil\n @mutex.synchronize do\n target = new_target || \n (Proc === @target ? @target.call : @target.dup)\n @target_list << cls.new(target)\n end\n end",
"def add_class(name); end",
"def add_class(name); end",
"def build_stubbed(name, *traits_and_overrides, &block); end",
"def method_missing(method, *args, &block)\n send(target_method(method), method, *args, &block).tap do\n create_delegation_method!(method)\n end\n end",
"def define_delegate_readers\n # Create delegate methods for polymorphic attributes/methods\n all_polymorph_readers.each do |attr|\n class_eval <<-END_EVAL\n def #{attr.to_s}\n return polymorph.#{attr.to_s}\n end\n END_EVAL\n end\n end",
"def class_def( name, &blk )\n class_eval { define_method name, &blk }\n end",
"def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end",
"def add_method_to(klass)\n klass.class_eval do\n def greet; \"hi\"; end\n end\nend",
"def class_def( name, &blk )\r\n class_eval { define_method name, &blk }\r\n end",
"def method_missing(mthd, *args, &blk)\n super unless allowed?(mthd)\n library = library_handler[mthd.capitalize.to_sym]\n send(\"_#{mthd}_\", library, *args, &blk)\n end",
"def define(names)\n names.each do |name|\n define_delegator(name)\n end\n\n self\n end",
"def add_role(user, role_name)\n role = Role.new(name: role_name, user: user)\n self.roles << role\n return role\n end",
"def create_abstract_singleton_method(name); end",
"def assign_role(character)\n Role.new(self, character)\n end",
"def create_method(name, &block)\n\t\t\tself.class.send(:define_method, name, &block)\n\t\tend",
"def add_role!(role_name)\n role = Role.find_by_name!(role_name.to_s)\n self.roles << role unless self.roles.include?(role)\n end",
"def make_controller(klass)\n @controller = eval(\"#{klass.to_s.camelize}Controller\").new\n end",
"def bind(type, name, options = {}, &block)\n case type\n when :role then bind_role(name, options, &block)\n when :cluster_role then bind_cluster_role(name, options, &block)\n else\n fail ArgumentError, \"bind type must be :role or :cluster_role. Is: #{type}\"\n end\n end",
"def association_module_def(name, opts=OPTS, &block)\n association_module(opts).module_eval{define_method(name, &block)}\n end",
"def create(klass, *traits, **attributes)\n create_method, create_kwargs = @alternate_create_methods[klass] ||\n [Traitor::Config.create_method, Traitor::Config.create_kwargs || {}]\n\n raise Traitor::Error.new(\"Cannot call Traitor.create until you have configured Traitor.create_method .\") unless create_method\n\n record = build(klass, *traits, **attributes)\n\n if create_kwargs.any? # assignment intentional\n record.public_send(create_method, **create_kwargs)\n else\n record.public_send(create_method)\n end\n\n call_blocks(klass, :after_create, record, *traits)\n record\n end",
"def role_cls\n User\n end",
"def define(name, code=nil, &blk)\r\n\t\t\tif code and not blk then blk = proc{instance_eval(code)} end\r\n\t\t\tmetaclass.__send__(:define_method, name, &blk)\r\n\t\t\t@commands << name.to_s unless @commands.include?(name.to_s)\r\n\t\tend",
"def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end",
"def create_abstract_instance_method(name)\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{name}(*) # def name(*)\n raise NotImplementedError, \"\\#{self.class.inspect}##{name} is not implemented\" # raise NotImplementedError, \"\\#{self.class.inspect}#name is not implemented\"\n end # end\n RUBY\n end",
"def create(\n role,\n deadline: nil\n )\n req = V1::RoleCreateRequest.new()\n\n req.role = Plumbing::convert_role_to_plumbing(role)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"Roles.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = RoleCreateResponse.new()\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)\n resp\n end",
"def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end",
"def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end"
] | [
"0.6080697",
"0.6006857",
"0.57758373",
"0.5636941",
"0.5468796",
"0.5420977",
"0.5360667",
"0.52933496",
"0.5225137",
"0.512194",
"0.5072748",
"0.5064455",
"0.4983604",
"0.49808812",
"0.4973817",
"0.49591684",
"0.4944239",
"0.49412456",
"0.4900895",
"0.48820943",
"0.48644528",
"0.48546576",
"0.48349902",
"0.4821611",
"0.48176807",
"0.48121837",
"0.48109117",
"0.48090065",
"0.48004693",
"0.4788095",
"0.47854993",
"0.47854993",
"0.478156",
"0.47728875",
"0.4759882",
"0.4754594",
"0.4751409",
"0.47476304",
"0.47419813",
"0.47296312",
"0.47111693",
"0.47035557",
"0.46967784",
"0.46878073",
"0.46750018",
"0.46708804",
"0.46594498",
"0.46579397",
"0.46467322",
"0.46431714",
"0.4638881",
"0.46373087",
"0.46264312",
"0.46190912",
"0.46178257",
"0.46175352",
"0.4598975",
"0.45932722",
"0.45826903",
"0.458053",
"0.45778385",
"0.4575241",
"0.45699415",
"0.45615044",
"0.45599854",
"0.455905",
"0.45519042",
"0.4539923",
"0.45390105",
"0.4537974",
"0.45333126",
"0.45162988",
"0.45117292",
"0.45117292",
"0.45107985",
"0.44932795",
"0.44921273",
"0.4490762",
"0.4488008",
"0.4487466",
"0.44847634",
"0.44847",
"0.44828722",
"0.44761625",
"0.44725305",
"0.44716367",
"0.4463425",
"0.44629416",
"0.44586876",
"0.44579348",
"0.4450895",
"0.44482213",
"0.44481394",
"0.44449514",
"0.44446397",
"0.44377887",
"0.4435856",
"0.44340035",
"0.44340035",
"0.44223627"
] | 0.64988995 | 0 |
Create an object which will bind methods to the role player | def interface(name, &block)
interface_name = RoleBuilders.mod_name(name) + 'Interface'
behavior = private_const_set(interface_name, Module.new(&block))
require 'surrounded/context/negotiator'
undef_method(name)
define_method(name) do
instance_variable_set("@#{name}", Negotiator.new(role_map.assigned_player(name), behavior))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role(*args)\n case args.size\n when 2\n role_module = args[0]\n obj = args[1]\n role_name = Util.underscore(role_module.name).to_sym\n when 3\n role_name = args[0]\n role_module = args[1]\n obj = args[2]\n else\n raise ArgumentError\n end\n\n self.roles[role_name] = RoleMapping.new(role_module, obj)\n\n if ::Brassbound::Context.current.equal?(self)\n # If we are already in the execute method, apply the role mapping.\n apply_role(role_name)\n end\n end",
"def register_player!(params)\n self.player = Player.new(params)\n self.roles << :player\n self.save\n self.player.save\n self.player\n end",
"def spawn_player player; end",
"def create_new_player\n @player = Player.new(self, nil, ServerConfig.start_room, @new_name, [], \"a typical person\", \"This is a normal, everyday kind of person.\", \"person\", @sex)\n @player.word_wrap = nil\n\n # TODO remove following lines\n require 'aethyr/extensions/objects/clothing_items' #why not\n require 'aethyr/extensions/objects/sword'\n shirt = Shirt.new\n pants = Pants.new\n undies = Underwear.new\n sword = Sword.new\n\n $manager.add_object(shirt)\n $manager.add_object(undies)\n $manager.add_object(pants)\n $manager.add_object(sword)\n\n @player.inventory << shirt\n @player.inventory << pants\n @player.inventory << undies\n @player.inventory << sword\n\n @player.wear(undies)\n @player.wear(pants)\n @player.wear(shirt)\n\n if @player.name.downcase == ServerConfig.admin.downcase\n @player.instance_variable_set(:@admin, true)\n end\n\n $manager.add_player(@player, @new_password)\n\n File.open(\"logs/player.log\", \"a\") { |f| f.puts \"#{Time.now} - #{@player.name} logged in.\" }\n\n @state = nil\n\n output(\"Type HELP HELP for help.\")\n end",
"def assign_role(role = :villager)\n klass = role.to_s.classify.constantize\n if klass.new.is_a?(Player)\n self.update_attribute(:type, role.to_s.classify)\n klass.find(self.id)\n else\n false\n end\n end",
"def assign_role_to_player(rolekey, player)\n role_klass = roles[rolekey]\n role_instance = role_klass.new(:player => player, :context => self)\n instance_variable_set(:\"@#{rolekey}\", role_instance)\n end",
"def initialize_player\n\n Player.new\n\nend",
"def initialize(player)\n @player = player\n end",
"def make_player_character\n cast player_class, name: 'yourself', synonyms: 'self myself you me', proper_named: true\n end",
"def initialize(playerClass)\n @player = initialize_player playerClass\n end",
"def set_player\n\n end",
"def apply_role(role_name)\n role_mapping = self.roles[role_name]\n role_module, obj = role_mapping.role_module, role_mapping.data_object\n obj.extend(role_module)\n obj.instance_variable_set(:@__brassbound_context, self)\n class << obj\n def context\n @__brassbound_context\n end\n end\n self.singleton_class.send(:define_method, role_name) do\n obj\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 method_missing(method_name, *args, &block)\n return super unless respond_to?(method_name)\n\n players.send(method_name, *args, &block)\n end",
"def associate_role(klass)\n role = self\n klass.class_eval do\n role_accessor_name = \"#{role.name}_role\"\n unless respond_to?(role_accessor_name)\n singleton_class.send(:define_method, role_accessor_name) do\n role\n end\n # else we can't create such a method without creating mayhem, so don't.\n end\n end\n end",
"def set_player_role\n @player_role = PlayerRole.find(params[:id])\n end",
"def affichage_player\n\n\n end",
"def initialize\n greeting\n init_players\n end",
"def player(&block)\n Player.new(self, :player, DEFAULTS[:player], &block)\n end",
"def announce_role\n if @player == 'codebreaker'\n puts\n puts 'You are the CODEBREAKER!'\n elsif @player == 'codemaker'\n puts\n puts 'you are the CODEMAKER!'\n end\n Pattern.new(@computer, @player)\n end",
"def method_missing(m, *args)\n player.send(m, *args)\n end",
"def assign_role(character)\n Role.new(self, character)\n end",
"def initialize_players\n\n end",
"def method_missing(method_name, *args, &block)\n #creator method will return nil if we can't create the method\n proc = create_role_interrogator!(method_name)\n return proc.call if proc.respond_to?(:call) \n\n proc = create_state_interrogator!(method_name)\n return proc.call if proc.respond_to?(:call) \n\n super\n end",
"def method_missing(method_sym, *arguments, &block)\n eigenclass = class << self; self; end\n role = Role.find_by(name: method_sym.to_s.tr('?', ''))\n if role\n eigenclass.class_eval do\n define_method(method_sym) do\n role_id == role.id\n end\n end\n else\n super\n end\n send(method_sym)\n end",
"def create_player_o\n p = Player.new()\n p.title = \"application\"\n p.session_string = \"application\"\n \n return p \n end",
"def initialize(args={})\n check_all_roles_provided_in!(args)\n players, noplayers = args.partition {|key, *| roles.has_key?(key)}.map {|group| Hash[*group.flatten]}\n assign_roles_to_players(players)\n @settings = noplayers\n end",
"def role(rolekey, &block)\n raise \"role name must be a symbol\" unless rolekey.is_a?(Symbol)\n create_role_from(rolekey, &block)\n define_reader_for_role(rolekey)\n define_mate_roleplayers_readers_after_newrole(rolekey)\n end",
"def player\n player1 = Player.new('luke')\n player2 = Player.new('sam')\n game = Game.new(player1,player2)\n end",
"def make_member!\n make_role!(MemberRole)\n end",
"def player\n\t\t@player ||= Player.new(self)\n\tend",
"def bind_player(player)\r\n @alg_player = player\r\n @log.info(\"[#{@alg_player.type}] Autoplayer #{@alg_player.type} bound with #{player.name}. Ignore actions predifined.\")\r\n @action_queue = []\r\n end",
"def swap_role\n if role == \"player\"\n update! role: \"observer\"\n elsif role == \"observer\"\n update! role: \"player\"\n end\n end",
"def create_player_o\n\t\tp = Player.new()\n\t\tp.title = \"application\"\n\t\tp.session_string = \"application\"\n\t\t\n\t\treturn p\t\t\n\tend",
"def change_player\n\n end",
"def role; end",
"def role; end",
"def initialize player\n @player = player\n @question = Question.new()\n end",
"def add_role\n person\n end",
"def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end",
"def initialize(player_goid, *args)\n super(*args)\n @player = player_goid\n @equipment = {}\n end",
"def create_player()\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n @image = init_player_on_window(box_vertices)\n @body = CP::Body.new(1, CP::moment_for_poly(10.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n @body.p = CP::Vec2.new(@player_x, @player_y)\n shape = CP::Shape::Poly.new(@body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.0\n shape.collision_type = :player\n @body.a = (3*Math::PI/2.0) # angle in radians; faces towards top of screen\n @space.add_body(@body)\n @space.add_shape(shape) \n end",
"def initialize (name, life_points, weapon_level)\n @life_points = 100\n @weapon_level = weapon_level = 1\n super(name,life_points) #on récupère les attributs de la classe Player\n end",
"def create_player_x \n return current_user\n end",
"def player\n fail NotImplementedError\n end",
"def initialize(name_of_human_player)\n @name = name_of_human_player\n @life_points = 100\n @weapon_level = 1\n end",
"def role(name, &block)\n name = name.to_s\n\n unless role = @roles.find{|r| r.name == name}\n role = Salticid::Role.new(name, :salticid => self)\n @roles << role\n end\n\n if block_given?\n role.instance_eval &block\n end\n\n role\n end",
"def player_rdy(color, player2_color: :black, player_name: \"Player 1\", player2_name: \"Player 2\", ai_level: nil, role: 0)\n MenuControllerContracts.invariant(self)\n if ai_level == nil\n if role == 0\n @game_state_model::players.push(Models::RealPlayer.new(1, color, @game_state_model::name))\n @game_state_model::players.push(Models::RealPlayer.new(2, 'black', player2_name))\n elsif role == 1\n @game_state_model::players.push(Models::RealPlayer.new(1, 'green', player2_name))\n @game_state_model::players.push(Models::RealPlayer.new(2, color, @game_state_model::name))\n end\n else\n @game_state_model::players.push(Models::RealPlayer.new(1, color, player_name))\n if @game_state_model::game_type == :classic\n @game_state_model::players.push(Models::AIPlayer.new(2, 'black', GameLogic::ClassicAI.new(@game_state_model, ai_level), \"Roboto\"))\n else\n @game_state_model::players.push(Models::AIPlayer.new(2, 'black', GameLogic::OttoAI.new(@game_state_model, ai_level), \"Roboto\"))\n end\n end\n @window.start_game\n MenuControllerContracts.invariant(self)\n end",
"def new\n @role = System::Role.new\n end",
"def init_bots\r\n p1 = Player.new(\"José\")\r\n p2 = Player.new(\"Josiane\")\r\nend",
"def add_captain\n @player2 = Cruiser.new self, 0x9900ff00\n @player2.warp_to 400, 250\n \n @controls << Controls.new(self, @player2,\n Gosu::Button::KbH => :left,\n Gosu::Button::KbK => :right,\n Gosu::Button::KbU => :full_speed_ahead,\n Gosu::Button::KbJ => :reverse,\n Gosu::Button::Kb7 => :revive\n )\n \n @players << @player2\n \n register @player2\n end",
"def method_missing(name, *params)\n if player.respond_to? name\n player.send(name, *params)\n else\n super\n end\n end",
"def assign_role\n #self.role = Role.find_by name: '訪客' if self.role.nil?\n self.role = Role.find_by name: 'Guest' if self.role.nil?\n end",
"def assign_role(role)\n if role == 'cm'\n @player = 'codemaker'\n @computer = 'codebreaker'\n announce_role\n elsif role == 'cb'\n @player = 'codebreaker'\n @computer = 'codemaker'\n announce_role\n else\n puts \"Invalid Selection. Either choose 'cb' or 'cm'.\"\n choose_role\n end\n end",
"def initialize(player_name)\n\t\t@player = Person.new(player_name)\n\t\t@secret_number = SecretNumber.generate\n\tend",
"def initialize\n @player1 = Player.new(\"Player 1\")\n @player2 = Player.new(\"Player 2\")\n @player1_turn = true; # true -> player1's turn, false -> player2's turn\n end",
"def initialize(player)\n @en_passant = false\n super(player)\n end",
"def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end",
"def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end",
"def turn_player\n go_fish.turn_player\n end",
"def initialize(active_player)\n active_player ? @secret_code = create_secret_code : @secret_code = get_player_secret_code\n end",
"def create_player_x\t\t\n\t\treturn current_user\n\tend",
"def initialize(sim)\n super(sim)\n\n @sim.player.instance_variable_set(:@landslide, self)\n Player.send(\"attr_reader\", :landslide)\n\n PROCS_OFF_OF.each do |ability_name|\n @sim.player.send(ability_name).extend(ProcLandslide)\n end\n\n @sim.player.extend(AugmentPlayerAttackPower)\n end",
"def add_player\n add_remove_player :add\n end",
"def player_creation\n @players = []\n @available_roles_to_pick = ROLES.keys.shuffle\n @number_players = 0\n\n prompt_number_of_players\n\n @epidemic_cards_number = 0\n determine_epidemic_cards_number\n\n determine_deal_player_card_number\n create_players\n prompt_player_info\n end",
"def add_ai_player(type, user)\n @player = Player.new({:ai => type, :game_id => self.id, :user_id => user.id, :money => 100, :username => 'ai '+type.to_str, :location => self.get_empty_location(), :in_pot_hand => 0, :in_pot_current => 0})\n self.players << @player\n self.save\n end",
"def method_missing(sym, *args, &block)\n @warrior.send(sym, *args, &block)\n end",
"def initialize(role, &blk)\n @role, @policies, @scopes = role, {}, {}\n instance_eval(&blk) if block_given?\n end",
"def assign_roles_to_players(players={})\n roles.keys.each do |rolekey|\n assign_role_to_player(rolekey, players[rolekey])\n end\n end",
"def method_missing(sym, *args, &block)\n room.send(sym, *args, &block)\n end",
"def initialize(players)\n self.players = players\n end",
"def player\n @player ||= Player.new\n end",
"def give_role(name)\n r = Role.new(:name => name, :user => self)\n self.roles << r\n save(false)\n end",
"def create_player_controls(controller, player)\n\t\tsub_methods = submarine_callbacks(player.submarine)\n\t\thorn_methods = party_horn_callbacks(player.party_horn)\n\n\t\tcontroller_add_held_callbacks(controller, player.controls, sub_methods)\n\t\tcontroller_add_down_callbacks(controller, player.controls, horn_methods)\n\tend",
"def add_player(player, password)\n @storage.save_player(player, password)\n self.add_object(player)\n end",
"def initialize player\r\n @card_player=player\r\n @name = player.name\r\n end",
"def setup_players!(hunter_connection, hunter_name, prey_connection, prey_name)\n\t\t@hunter = Hunter.new(self, hunter_connection, hunter_name)\n\t\t@prey = Prey.new(self, prey_connection, prey_name)\n\tend",
"def assign_role\n self.add_role!(\"user\")\n end",
"def initialize\n register_script \"Leave messages for inactive users.\"\n\n register_event :PRIVMSG, :on_privmsg\n\n register_command \"tell\", :cmd_tell, 2, 0, nil, \"Have the bot tell the given user something the next time they speak. Parameters: nick message\"\nend",
"def new\n @player = Player.new\n end",
"def initialize\n @player1 = Player.new\n @player2 = Player.new\n\n @player1.opponent = @player2\n @player2.opponent = @player1\n end",
"def initialize(*args)\n super(nil, *args)\n\n @generic = \"room\"\n end",
"def add_ai_player\n @bots << setup_player(:bot => true)\n end",
"def roles\n\t\t\t\tProxy.new connection, 'role-strategy/strategy'\n\t\t\tend",
"def create_role(client:, **data)\n create_object(type: 'Role', root: url_for(client), data: data)\n end",
"def initialize(name_player)\n @life_points = 10\n @name = name_player\n end",
"def assign_role\n\t\tself.role = Role.find_by role_name: \"PIC Pengadaan\" if self.role.nil?\n\tend",
"def player \n \"player\" \n end",
"def setup(minefield)\n raise 'Expected a minefield' unless minefield.is_a? Minefield\n\n @minefield = minefield\n @minefield.player = self\n end",
"def initialize name,hashed_password\n @name = name.downcase\n @commands = []\n @hashed_password = hashed_password\n\n @pending_output = \"\"\n\n W.create_player(self)\n self.room = W.default_room\n @command_groups = []\n\n self.max_hp = 100\n self.max_mp = 100\n self.hp= max_hp\n self.mp= max_mp\n\n\n @off_balance_timer = {}\n end",
"def assign_role\n self.role = Role.find_by name: \"Aanvrager\" if self.role.nil?\n end",
"def initialize\n @human = Human.new #(:human) symbol here will be used internally by Player class above, not needed\n # because its a default in the initialize method of the Player class above\n @computer = Computer.new # remove the `(:computer)` right after new for Redesign 1 video\n end",
"def initialize(name, weapon)\n @name = name\n @weapon = weapon\nend",
"def assign_role\n self.role = Role.find_by name: \"Regular\" if self.role.nil?\n end"
] | [
"0.63176924",
"0.63159937",
"0.6247642",
"0.6199636",
"0.6174743",
"0.6153263",
"0.61007714",
"0.60529304",
"0.60100245",
"0.60069424",
"0.5943684",
"0.5939294",
"0.5937096",
"0.5937096",
"0.5937096",
"0.5937096",
"0.5937096",
"0.5937096",
"0.5937096",
"0.5908761",
"0.58259374",
"0.5823785",
"0.5821584",
"0.5785785",
"0.5753119",
"0.5726585",
"0.5725944",
"0.57209283",
"0.57181996",
"0.5707527",
"0.570675",
"0.56880754",
"0.56458104",
"0.56136906",
"0.55933607",
"0.5593167",
"0.55926174",
"0.5562037",
"0.5547007",
"0.55213076",
"0.5514153",
"0.54792917",
"0.54792917",
"0.54635066",
"0.54512644",
"0.5450184",
"0.54497355",
"0.54494035",
"0.5443768",
"0.54302925",
"0.5427809",
"0.5427583",
"0.5425699",
"0.54048103",
"0.53989565",
"0.53951204",
"0.5390685",
"0.5390208",
"0.5382272",
"0.5374382",
"0.53738534",
"0.536476",
"0.5362317",
"0.5359405",
"0.53581184",
"0.53535646",
"0.53471917",
"0.5335466",
"0.533432",
"0.53204966",
"0.5312643",
"0.53042185",
"0.5303587",
"0.529848",
"0.52930737",
"0.52793413",
"0.52743834",
"0.52686554",
"0.525662",
"0.524949",
"0.52492005",
"0.52483475",
"0.5239181",
"0.52367836",
"0.52319545",
"0.5218055",
"0.52134866",
"0.52100706",
"0.5209428",
"0.5206732",
"0.520194",
"0.5199705",
"0.5196611",
"0.5189119",
"0.5185193",
"0.51832354",
"0.5177345",
"0.5175686",
"0.51730627",
"0.51680315"
] | 0.5999383 | 10 |
Query Google for the coordinates of the given address. Returns array [lat,lon] if found, nil if not found or if network error. | def coordinates(address)
return nil if address.blank?
return nil unless doc = search(address, false)
# blindly use first result (assume it is most accurate)
place = doc['results'].first['geometry']['location']
['lat', 'lng'].map{ |i| place[i] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geo_coordinates_for address\n @log ||= Rails.logger\n return KNOWN_PLACES[address] if KNOWN_PLACES[address]\n \n google_data = get_geo_json address, :retries => 2\n location = google_data['results'].first['geometry']['location'] rescue {}\n \n log_empty(address, google_data['status']) if location.blank?\n [location['lat'], location['lng']]\n end",
"def get_lat_long_of_current(address)\n\n a = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => { :address => address,\n :sensor => \"false\"}\n )\n response = RestClient.get(a.to_s)\n\n response_json = JSON.parse(response)\n lat = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n long = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n [lat, long]\nend",
"def query_address2latlng(query_address)\n\t\tla_clave_esa = \"AIzaSyBtlkF4i2Mmv33\" + \"uVc4aVTA5JT94-eEnRTo\"\n\t\tgeocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+query_address+\"&key=\" + la_clave_esa\n\t\tgeocode_uri = URI.parse(geocode_url)\n\t\tgeocode_response = Net::HTTP.get_response(geocode_uri)\n\t\tgeocode_hash = JSON.parse geocode_response.body\n\t\t#pp geocode_hash\n\t\tlat = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\tlng = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\treturn lat.to_s + \",\" + lng.to_s\n\tend",
"def get_coords(address)\n coords = Geocoder.search(address)\n location = self.location\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def get_coords(address)\n file = open(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{URI.escape(address)}&key=AIzaSyARfm-3M5KppQjgGnHK1DIYt-GmG4eJqCI\")\n contents = file.read()\n hash = JSON.parse(contents)\n lat = hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_f\n lng = hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_f\n return [lat, lng]\nend",
"def get_coords(address)\n coords = Geocoder.search(address)\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def get_coords(address)\n\n # Initiate @retries to 0 unless running method recursively\n unless caller[0][/`.*'/][1..-2] == __method__.to_s\n @retries = 0\n end\n\n name = address.split(\",\")[0]\n puts \"Getting coords for #{address}...\"\n\n # Get json from API call for specified location\n uri = URI(\"https://maps.googleapis.com/maps/api/geocode/json?address=\" + CGI.escape(\"#{address}\"))\n json = Net::HTTP.get(uri)\n out = JSON.parse(json)\n\n sleep 0.3\n\n # Recursively call method again if error is returned\n if out[\"status\"] != \"OK\"\n # Exit with error after too many retries\n if @retries > 3\n @errors.push(\"Error getting coords for: #{address[0]}\")\n return [name, address, \"ERROR\", \"ERROR\"]\n end\n\n @retries += 1\n return get_coords(address)\n end\n\n # Grab lat/lng from API output\n lat = out[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n lng = out[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n return [name, address, lat, lng]\nend",
"def convert_location(address)\n loc_query = Addressable::URI.new(\n :scheme => \"http\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => {:address => \"#{address}\",\n :sensor => \"false\"}\n )\n\n geolocation_json = RestClient.get(loc_query.to_s)\n location = JSON.parse(geolocation_json)\n\n latitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n longitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n [latitude, longitude]\n end",
"def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n return ret\nend",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def query_location_lat_long\n loc = MultiGeocoder.geocode(location)\n [loc.lat, loc.lng]\n end",
"def tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end",
"def get_coordinates\n checked_google_response do\n return parsed_response if raw\n parsed_response[\"results\"].inject([]) do |memo, result|\n memo << { \n :lat => result[\"geometry\"][\"location\"][\"lat\"], \n :lng => result[\"geometry\"][\"location\"][\"lng\"],\n :matched_address => result[\"formatted_address\"],\n :bounds => result[\"geometry\"][\"bounds\"],\n :full_data => result\n }\n end\n end\n end",
"def coordinates(user_address)\n geocoding_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => user_address,\n :sensor => false}\n ).to_s\n\n response = JSON.parse(RestClient.get(geocoding_url))\n location = response[\"results\"][0][\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\nend",
"def geocode(address)\n result = Geocoder.search(address).first\n #result.latitude - float\n #result.longitude - float\n #result.coordinates - array of the above two\n #result.address - string\n #result.city - string\n #result.state - string\n #result.state_code - string\n #result.postal_code - string\n #result.country - string\n #result.country_code - string\n if result\n self.lat = result.latitude\n self.lng = result.longitude\n return true\n else\n return nil\n end\n end",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def call_google_api_for_location(address)\n url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{\n address}&key=#{ENV['GOOGLE_API_KEY']}\"\n response = HTTParty.get url\n response.body\n end",
"def address(latitude, longitude)\n return nil if latitude.blank? || longitude.blank?\n return nil unless doc = search(\"#{latitude},#{longitude}\", true)\n # blindly use first result (assume it is most accurate)\n doc['results'].first['formatted_address']\n end",
"def locate(address)\n get :geo, :q => address\n end",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def get_coords(address = '', token = '')\n # Change spaces to + to create a safe URLstring\n address = address.strip.gsub(/\\s/, '+')\n\n # API-URL for fetching the addresses geo-location\n url = \"https://api.tiles.mapbox.com/v4/geocode/mapbox.places/farmington,87401,#{address}.json?proximity=-108.20833683013916,36.73038906153143&access_token=#{token}\"\n\n # Output address of where the crime occurred\n puts \"Address: #{address}\"\n\n # get URL Response\n response = open(url).read\n\n # Process response at JSON rather than plain text\n results = JSON.parse(response)\n\n coords = []\n if !results['features'][0].nil?\n coords[0] = results['features'][0]['geometry']['coordinates'][0]\n coords[1] = results['features'][0]['geometry']['coordinates'][1]\n else\n coords = [0, 0]\n end\n\n coords\nend",
"def geocode(address)\r\n\t\r\n\t\turi = URI.encode(\"#{@@google_base_url}#{address}\")\r\n\t\turl = URI.parse(uri)\r\n\t\thttp = Net::HTTP.new(url.host, url.port)\r\n\t\trequest = Net::HTTP::Get.new(url.request_uri)\r\n\t\tresponse = http.request(request)\t\r\n\t\t# throws exception\r\n\t\traise \"Bad response, code #{response.code}\" if response.code != \"200\"\r\n\t\t\r\n\t\t# result returned from Google Geocoding API\r\n\t\tresult = response.body\r\n\t\tjson_parsed = JSON.parse(result)\r\n\t\t\r\n\t\treturn json_parsed\r\n\tend",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end",
"def get_coords(_ip_addr)\n g = GeoIP.new('GeoLiteCity.dat').city(_ip_addr)\n [g.latitude, g.longitude]\n end",
"def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def viewMapByAddress(address, callback)\n puts \"viewMapByAddress(address:#{address}, callback:#{callback}\"\n\n url = \"http://maps.google.com/maps/api/geocode/json?\" +\n \"address=#{address}&\" +\n \"sensor=true\"\n #puts url\n\n res = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res.inspect\n\n if res[\"status\"] == \"ok\" # && res[\"body\"][\"status\"] == \"OK\"\n #puts res[\"body\"].inspect\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n to_lat = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n to_lng = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n else\n to_lat = '34.4893270'\n to_lng = '133.3614320'\n end\n\n viewMap address, to_lat, to_lng, callback\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def coordinates_url latitude, longitude\n \"https://www.google.com/maps/search/?api=1&query=#{latitude}%2C#{longitude}\"\n end",
"def getGoogleGeoByAddress(street, csz)\r\n address_str = [street, csz].join(\" \")\r\n base_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{address_str}&key=#{GOOGLE_TOKEN}\"\r\n\r\n # Get the response\r\n uri = URI.parse(URI.escape(base_url))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n # ERROR CATCH\r\n return nil if json_result[\"status\"] == \"INVALID REQUEST\"\r\n\r\n place_results = json_result[\"results\"][0]\r\n\r\n # Define place id\r\n place_id = place_results[\"place_id\"]\r\n\r\n # Collect unit number (if applicable)\r\n address_components = json_result[\"results\"][0][\"address_components\"]\r\n address_components.each { |c| place_id += \"+#{c[\"long_name\"]}\" if c[\"types\"][0] == \"subpremise\" }\r\n\r\n geo_data = {:placeId => place_id,\r\n :lat => place_results[\"geometry\"][\"location\"][\"lat\"],\r\n :lon => place_results[\"geometry\"][\"location\"][\"lng\"],\r\n :format_add => place_results[\"formatted_address\"]}\r\n\r\n return geo_data\r\n end",
"def where_local(query)\n begin\n url = URI.parse GOOGLE_LOCAL_URI\n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(LOCAL_QUERY_STRING + CGI.escape(query))\n end\n\n results = JSON.parse(response.body)['responseData']['results']\n \n unless results.blank?\n results.map do |result|\n result['staticMapUrl'] =~ /zl=(\\d+)/\n {\n :name => result['titleNoFormatting'],\n :city => result['city'],\n :region => result['region'],\n :country => result['country'],\n :address => result['streetAddress'],\n :postal_code => result['postalCode'],\n :latitude => result['lat'].to_f,\n :longitude => result['lng'].to_f,\n :zoom => $1.to_i\n }\n end\n else\n []\n end\n rescue\n []\n end\n end",
"def geocode\n geo = Geokit::Geocoders::MultiGeocoder.geocode address.gsub(/\\n/, ', ')\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n errors.add(:address, 'Problem locating address')\n end\n end",
"def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end",
"def google_id(address)\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_SERVER_KEY'])\n place_info = @client.spots_by_query(address)[0]\n place_info.nil? ? \"not find\" : place_info.place_id\nend",
"def geocode(address)\n q = { address: URI::encode(address) }\n q[:key] = @config[:api_key] if @config.has_key?(:api_key)\n\n res = get('/json', q)\n JSON::parse(res.body)\n end",
"def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def get_address_coordinates(street, city)\n # puts \"got in get_location_coordinates\"\n # puts \"inside get_coordinates #{street}\"\n # puts \"inside get_coordinates #{city}\"\n\n coordinate_results = Geocoder.search(\"#{street}, #{city}\")\n\n # puts \"the results are #{coordinate_results}\"\n coordinate_results_lat = coordinate_results[0].data[\"geometry\"][\"location\"][\"lat\"]\n coordinate_results_lng = coordinate_results[0].data[\"geometry\"][\"location\"][\"lng\"]\n # puts \"final coordinates are #{coordinate_results_lat}, #{coordinate_results_lng}\"\n # return_result = \"\\\"#{coordinate_results_lat}, #{coordinate_results_lng}\\\"\"\n return coordinate_results_lat, coordinate_results_lng\n #binding.pry\nend",
"def geocode_address\n geo = Geokit::Geocoders::MultiGeocoder.geocode(self.address_string)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n puts geo.class\n errors.add(:address, \"Could not Geocode address\")\n end\n end",
"def geocode_address\n geo=Geokit::Geocoders::GoogleGeocoder.geocode(address)\n errors.add(:address, \"Could not Geocode address\") if !geo.success\n self.lat, self.lng = geo.lat,geo.lng if geo.success\n end",
"def addresses\n query(:address)\n end",
"def location\n if [latitude, longitude].all?(&:present?)\n [latitude, longitude]\n end\n end",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def geocode(location)\n sanitized_location = URI.escape(location)\n api_uri = URI.parse(\"http://nominatim.openstreetmap.org/search/#{sanitized_location}?format=json\")\n\n city_data = JSON.parse(Net::HTTP.get(api_uri)).first\n\n latitude = city_data['lat'].to_f\n longitude = city_data['lon'].to_f\n\n return [latitude, longitude]\n end",
"def locate(address)\n location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))\n # yahoo pukes on line breaks\n get :location => location.gsub(\"\\n\", ', ')\n end",
"def locate(address)\n location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))\n # yahoo pukes on line breaks\n get :location => location.gsub(\"\\n\", ', ')\n end",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def get_address\n welcome_message\n puts \"What is your location?\"\n user_location = Geocoder.search(gets.chomp)[0]\n if user_location != nil\n adr = user_location\n @city = adr.city\n @lat = adr.latitude\n @lon = adr.longitude\n else\n no_match\n end\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def map_addresses(logger,eventid,input_addresses)\n input_addresses.map do |a| \n addressid = logger.addresses(eventid,a)\n begin\n result = Geokit::Geocoders::GoogleGeocoder.geocode(a)\n rescue\n return \"GeoError: Either there is a problem reaching Google maps or the input is invalid #{a}\"\n end\n if ((result.lat).kind_of? Float ) && ((result.lng).kind_of? Float)\n logger.address_coordinates(addressid,[to_radians(result.lat),to_radians(result.lng)])\n [to_radians(result.lat), to_radians(result.lng)]\n else\n return \"Validation Error: #{a} is not a valid address input.\"\n end\n end\n end",
"def getLatLng(city, country, http)\n puts \"getLatLng(#{city}, #{country}, http)\"\n validLatLng = /-?\\d+\\.?\\d*/\n responseLoc = /.*\\\"lat\\\": (#{validLatLng}).*\\\"lng\\\": (#{validLatLng}).*/m\n lat = \"\"\n lng = \"\"\n \n cityAry = city.split(' ')\n subRequest = cityAry[0]\n (cityAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += cityAry[i+1]\n }\n \n subRequest += ','\n \n countryAry = country.split(' ')\n subRequest += countryAry[0]\n (countryAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += countryAry[i+1]\n }\n \n request = \"/maps/api/geocode/json?address=#{subRequest}&sensor=false\"\n # puts \"request: #{request}\"\n response = http.request_get(request)\n \n if response.body =~ responseLoc\n lat = $1\n lng = $2\n end\n\n sleep 0.5 #Sleep a second so that Google doesn't rate limit me\n \n if lat == \"\" or lng == \"\"\n puts \"TROUBLE! #{request}\"\n puts response.body\n LatLng.new(-200,-200)\n else\n LatLng.new(lat.to_f, lng.to_f)\n end\nend",
"def geocode_of_site(url)\n get_geo_info(url)['results'][0]['geometry']['location']\n end",
"def create_lat_long_coordinates(location)\n gmaps = GoogleMapsService::Client.new\n lat_long = gmaps.geocode(location)\n latitude = lat_long[0][:geometry][:location][:lat]\n longitude = lat_long[0][:geometry][:location][:lng]\n lat_long = [latitude, longitude]\n end",
"def extract_coordinates(parsed)\n parsed['results'].first['geometry']['location']\nend",
"def get_geoloc(ip)\n\t\trec = self.get_all ip\n\t\treturn [rec.longitude,rec.latitude]\n\tend",
"def find(query,options={})\n options.merge!(:q => query, :sll => @latlng) # Merge in the query and the lat/lng into the options\n fetch_locations(self.class.get(\"/local\", :query => options)) # Make the get request\n end",
"def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end",
"def find_neighborhood\n results = Geocoder.search(\"#{coordinates[1]},#{coordinates[0]}\")\n unless results.blank?\n n = 0\n m = 0\n has_neighborhood = false\n (0..(results.count-1)).each do |i|\n if results[i].types.include?(\"neighborhood\")\n has_neighborhood = true\n n = i\n break\n end\n end\n if has_neighborhood\n (0..(results[n].address_components.count-1)).each do |i|\n if results[n].address_components[i][\"types\"].include?(\"neighborhood\")\n m = i\n break\n end\n end\n results[n].address_components[m][\"long_name\"]\n else\n return nil\n end\n else\n return nil\n end\n \n end",
"def get_location(place)\n\t\tsleep(1.5)\n\t\tlocation = Geocoder.search(place)\n\t\t#puts location.inspect\n\t\tif !location.empty?\n\t\t\tlocation_geometry = location.first.geometry\n\t\t\tlocation_bounds = location_geometry['bounds']\n\t\t\tif !location_bounds.nil?\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['bounds']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['bounds']['northeast']['lng'])\n\t\t\telse\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['viewport']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['viewport']['northeast']['lng'])\n\t\t\tend\n\t\t\tif !location.nil?\n\t\t\t\t@user_location_lat = rand(lat_range).round(7)\n\t\t\t\t@user_location_long = rand(long_range).round(7)\n\t\t\telse\n\t\t\t\t@user_location_lat = \"here\"\n\t\t\t\t@user_location_long = \"here\"\n\t\t\tend\n\t\telse\n\t\t\t@user_location_lat = \"no data\"\n\t\t\t@user_location_long = \"no data\"\n\t\tend\n\tend",
"def geocode(addresses, options = {})\n if addresses.size < 1\n raise ArgumentError, 'You must provide at least one address to geocode.'\n elsif addresses.size == 1\n geocode_single(addresses.first, options)\n else\n geocode_batch(addresses, options)\n end\n end",
"def coords(location)\n location = append_country(location)\n request = Request.new(:query => location, :key => Geocode.gmaps_key, :sensor => false, :output => \"csv\")\n coords = { :response => request.execute! }\n coords[:http_status], coords[:accuracy], coords[:lat], coords[:lng] = coords[:response].split(\",\")\n coords\n end",
"def validate_address\n trip_address = params[:data]\n coordinate_array = nil\n\n # Call to the geocoder API returns nil if the address cannot be geocoded\n coordinate_array = GoogleAPIGeocoder.do_geocode(trip_address)\n\n if coordinate_array.nil?\n render json: {response: \"-1\"}\n else\n render json: {response: \"1\"}\n end\n\n end",
"def set_lat_lon_from_address(place)\n address_txt = URI.encode([place.street_number,\n place.route,\n place.city,\n place.state.to_s + ' ' + place.zipcode,\n place.country].join(', '))\n\n data = JSON.parse(open(\"http://maps.googleapis.com/maps/api/geocode/json?address=#{address_txt}&sensor=true\").read)\n if data['results'].count > 0\n result = data['results'].find { |r| r['geometry'].present? && r['geometry']['location'].present? }\n if result\n place.lonlat = \"POINT(#{result['geometry']['location']['lng']} #{result['geometry']['location']['lat']})\"\n true\n else\n false\n end\n else\n false\n end\n end",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end",
"def get_coordinates(point_name)\n print \"Scraping coordinates from http://www.bing.com/search?q=#{to_uri_format(point_name)}+coordinates\\n\"\n page = Nokogiri.HTML(open(\"http://www.bing.com/search?q=#{to_uri_format(point_name)}+coordinates\"))\n coordinates = [\"0\", \"0\"]\n \n page.css(\"ol#b_results div.b_focusTextMedium\").each do |text|\n print text\n coordinates = text.content.gsub(\" \", \"\").split(\",\")\n end\n \n print \"Coordinates for #{point_name}: #{coordinates}\\n\"\n \n return coordinates\n end",
"def query(latlng:, result_type: nil, location_type: nil, language: nil)\n # Check if latlng param is a place_id string.\n # 'place_id' strings do not contain commas; latlng strings do.\n if latlng.is_a?(String) && !latlng.include?(\",\")\n params = {'place_id' => latlng}\n else\n params = {'latlng' => Convert.to_latlng(latlng)}\n end\n\n if result_type\n params['result_type'] = Convert.join_array('|', result_type)\n end\n\n if location_type\n params['location_type'] = Convert.join_array('|', location_type)\n end\n\n if language\n params['language'] = language\n end\n\n case self.client.response_format\n when :xml\n self.client.request(url: '/maps/api/geocode/xml', params: params).xpath('//result')\n when :json\n self.client.request(url: '/maps/api/geocode/json', params: params)['results']\n else\n raise StandardError, 'Unsupported response format. Should be either :json or :xml.'\n end\n end",
"def locate(place)\n locations, = get :q => place\n return locations.first\n end",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def fetch_raw_response(query, reverse = false)\n return nil if query.blank?\n\n # name parameter based on forward/reverse geocoding\n param = reverse ? :latlng : :address\n\n # build URL\n params = { param => query, :sensor => \"false\" }\n url = \"http://maps.google.com/maps/api/geocode/json?\" + params.to_query\n\n # query geocoder and make sure it responds quickly\n begin\n resp = nil\n timeout(3) do\n Net::HTTP.get_response(URI.parse(url)).body\n end\n rescue SocketError, TimeoutError\n return nil\n end\n end",
"def find_poll_addr(message_addr)\n uri = URI.parse('https://www.googleapis.com/civicinfo/v2/voterinfo?address=' + \\\n message_addr + '&electionId=2000&key=' + ENV[\"GOOGLE_API_KEY\"])\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n res_hash = JSON.parse(response.body)\n address_hash = res_hash['pollingLocations'][0]['address']\n locationName = address_hash['locationName']\n line1 = address_hash['line1'] || \"\"\n line2 = address_hash['line2'] || \"\"\n line3 = address_hash['line3'] || \"\"\n return \"We found the closest polling location to you:\\n\" + locationName+line1+line2+line3 + \"\\n\"\n end",
"def set_address\n url = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{self.latitude},#{self.longitude}&sensor=true\")\n req = Net::HTTP::Get.new(url.to_s)\n req.use_ssl = true if url.scheme == 'https'\n res = Net::HTTP.start(url.host, url.port) { |http|\n http.request(req)\n }\n result = JSON.parse(res.body)\n self.address = result['results'][0]['formatted_address'] rescue \"Not Found\"\n end",
"def get_zip_coords_from_mapquest(zipcode)\n response = HTTParty.get(\n 'http://open.mapquestapi.com/geocoding/v1/address',\n query: {\n key: 'A4F1XOyCcaGmSpgy2bLfQVD5MdJezF0S',\n postalCode: zipcode,\n country: 'USA',\n thumbMaps: false\n }\n )\n\n # coords = response.deep_symbolize_keys&.dig(:results)&.first&.dig(:locations).first&.dig(:latLng)\n coords = response[\"results\"].first[\"locations\"].first[\"latLng\"]\n\nend",
"def query(q, options={}, async = true)\n request(\"/Locations\", {:query => {:key => @key, :addressLine => q}.merge(options)}, async)\n end",
"def origin\n coord, address = Map.locate_user(params[:address], locate_by_ip)\n #address may not be the same as params, if params.blank?\n return coord, address\n end",
"def getaddress(name)\n addresses = getaddresses(name)\n if addresses.empty?\n raise ResolvError.new(\"no address for #{name}\")\n else\n addresses.first\n end\n end",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def get_coordinates\n if self.country_status == 'closed'\n self.latitude = nil\n self.longitude = nil\n else\n q = self.city || ''\n q += ','+self.state if self.state\n q += ','+self.country\n begin\n self.latitude, self.longitude = Geocoder.coordinates(q)\n # We need to make sure that that no 2 projects have exactly the same\n # coordinates. If they do, they will overlap on the flash map and\n # you won't be able to click on one of them.\n while SpProject.where(['latitude = ? and longitude = ?', self.latitude, self.longitude]).first\n delta_longitude, delta_latitude = 0,0\n delta_longitude = rand(6) - 3 while delta_longitude.abs < 2\n delta_latitude = rand(6) - 3 while delta_latitude.abs < 2\n # move it over a little.\n self.longitude += delta_longitude.to_f/10\n self.latitude += delta_latitude.to_f/10\n end\n rescue => e\n Airbrake.notify_or_ignore(e, :parameters => attributes)\n end\n end\n true\n end",
"def getlocation\r\n @myip = remote_ip()\r\n # based off freegeoip.net is really terrible\r\n result = Geocoder.search(@myip)\r\n @mylat = result.latitude\r\n @mylong = result.longitude\r\n @mycity = result.address\r\n #51.243048, -0.588458\r\n end",
"def get(criteria={})\n\n geo_count = @geolocations.size\n i = 1\n\n begin\n\n geo = select\n raise Error.new(GEO_NOT_VALID, :values => {:country => criteria[:country], :protocol => criteria[:protocol]}) if (!criteria[:country].nil? and criteria[:country].downcase != geo.country.downcase) or\n (!criteria[:protocol].nil? and criteria[:protocol].downcase != geo.protocol.downcase)\n\n rescue Exception => e\n\n case e.code\n when NONE_GEOLOCATION\n @logger.an_event.error e.message\n raise e\n when GEO_NOT_VALID\n if i < geo_count\n i += 1\n @logger.an_event.warn e.message\n retry\n else\n @logger.an_event.error e.message\n raise Error.new(GEO_NONE_COMPLIANT)\n end\n end\n else\n #on sort de la boucle :\n # soit on a trouve une geo qui repond aux criteres passés si il y en a\n # soit parce que on les a passé tous les geo et il n'y a aucun geolocation qui satisfont les critères => exception\n @logger.an_event.info \"geolocation find : #{geo.to_s}\"\n return geo\n ensure\n\n end\n end",
"def locate(address)\n delay_before_locate\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def geocode(lat, lon, options = {})\n new(options.merge(lat: lat, lon: lon)).retrieve\n end",
"def geocode\n do_lookup(false) do |o,rs|\n if r = rs.first\n unless r.coordinates.nil?\n o.__send__ \"#{self.class.geocoder_options[:coordinates]}=\", r.coordinates.reverse\n end\n r.coordinates\n end\n end\n end",
"def set_coordinates\n addrs = [\n \"#{address_line_1}\",\n \"#{address_line_2}\",\n \"#{address_line_1}, #{address_line_2}\"\n ]\n catch(:geocoded) do\n addrs.each do |addr|\n begin\n loc = MultiGeocoder.geocode(\n \"#{addr}, #{city}, #{state} #{zip}\"\n )\n if loc.success\n self.lat = loc.lat\n self.lng = loc.lng\n throw :geocoded\n end\n\n rescue Exception => ex\n puts \" -> #{addr} did not resolve\"\n puts \" -> #{ex.message}\"\n end\n end\n puts \"did not match any combination of address1 and address2\"\n end\n end",
"def find_target_coordinates\n number = Phonelib.parse(@target_number)\n @country = number.country\n @target_cord = PhoneNumberGeolocation::Location.find_by_country_geo_name(\n @country, number.geo_name\n ).first.location\n end",
"def get_location(address, accuracy = 10)\n # prepare the request url\n url = sprintf(LOCATION_URL, @access_token, address, accuracy)\n\n # set get request\n response = send_get_request(url)\n\n return JSON.parse(response)\n end",
"def geocode\n geo = GeoKit::Geocoders::MultiGeocoder.geocode(geocode_address)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n return self\n else\n errors.add_to_base(\"Could not geocode address\")\n return nil\n end\n end",
"def search_with_coordinates(term, latitude, longitude, options={})\n search_businesses(term, options.merge(:ll=>\"#{latitude},#{longitude}\"))\n end",
"def locate(address)\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def locate(address)\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def locate(address)\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def google_place_geocode(poi)\n gs = GeocodingService.new\n\n location_with_address = poi.address.to_s + ' ' + poi.city.to_s + ', ' + poi.state.to_s + ' ' + poi.zip.to_s\n\n result = gs.google_place_search(poi.name.to_s)\n if result.body['status'] != 'ZERO_RESULTS'\n place_id = result.body['predictions'].first['place_id']\n poi.google_place_id = place_id\n poi.save\n return true\n else\n result = gs.google_place_search(location_with_address)\n if result.body['status'] != 'ZERO_RESULTS'\n place_id = result.body['predictions'].first['place_id']\n poi.google_place_id = place_id\n poi.save\n return true\n else\n return false\n end\n end\n end",
"def set_lat_lng\n return if do_not_connect_to_api\n return if latitude.present? && longitude.present?\n address_txt = URI.encode([street_number, route, city,\n state.to_s + ' ' + zipcode.to_s, country].compact.join(', '))\n\n data = JSON.parse(open(\"http://maps.googleapis.com/maps/api/geocode/json?address=#{address_txt}&sensor=true\").read)\n return unless data['results'].count > 0\n result = data['results'].find { |r| r['geometry'].present? && r['geometry']['location'].present? }\n return unless result\n self.lonlat = \"POINT(#{result['geometry']['location']['lng']} #{result['geometry']['location']['lat']})\"\n end",
"def geocode(options)\n response = client.get(GEOCODE_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_location_from(response.items.first)\n end",
"def average_location\n @lat_counter = 0\n @google_results.each do |bar|\n @lat_counter += bar[:coordinates][:latitude]\n end\n if @google_results.count > 0\n @avg_lat = @lat_counter / @google_results.count\n else\n @avg_lat = 0\n end\n end",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def geolookup(query)\n get_json(\"#{api_url}/geolookup/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def optimistic_geo_wrapper(query)\n geocoded = nil\n result = ::Geocoder.search(query)\n puts result.inspect\n geocoded = result[0].data if result[0]\n geocoded\n end",
"def geocode(location)\n # First, try World Kit\n latlong = tryWorldKit(location)\n if latlong\n puts \"Used worldkit\"\n puts latlong\n return latlong\n else\n puts \"Used google\"\n return tryGoogle(location)\n end\n end"
] | [
"0.80880225",
"0.70398694",
"0.69687486",
"0.69668967",
"0.6962731",
"0.6960704",
"0.68821484",
"0.68506145",
"0.6822225",
"0.6731522",
"0.67175484",
"0.6698383",
"0.66558284",
"0.6587856",
"0.65832466",
"0.6563839",
"0.64569175",
"0.6405859",
"0.6269609",
"0.6244365",
"0.62197804",
"0.618183",
"0.61798596",
"0.6133417",
"0.60352343",
"0.5904427",
"0.58794916",
"0.5877125",
"0.5870927",
"0.58554596",
"0.5850041",
"0.5839414",
"0.58169955",
"0.5807927",
"0.5791884",
"0.57862455",
"0.57807016",
"0.57721275",
"0.5769413",
"0.5755109",
"0.5749917",
"0.5723633",
"0.57155585",
"0.5715096",
"0.56931394",
"0.5654006",
"0.5654006",
"0.5648365",
"0.56376445",
"0.5632333",
"0.5620085",
"0.5611513",
"0.5598491",
"0.556448",
"0.55630314",
"0.55495024",
"0.55325294",
"0.55323386",
"0.55256206",
"0.5520699",
"0.55035794",
"0.5492572",
"0.549189",
"0.5490245",
"0.5489407",
"0.54756075",
"0.5418948",
"0.54136753",
"0.540862",
"0.5406456",
"0.5376538",
"0.53654045",
"0.5351384",
"0.5321301",
"0.53156257",
"0.5306877",
"0.53068686",
"0.529997",
"0.52961636",
"0.52947927",
"0.52869546",
"0.52856636",
"0.52768666",
"0.5272646",
"0.5267511",
"0.526241",
"0.5232474",
"0.52238786",
"0.52167124",
"0.5209019",
"0.5209019",
"0.5209019",
"0.51985645",
"0.51937467",
"0.51903814",
"0.5190186",
"0.51840836",
"0.5182524",
"0.5176743",
"0.51664823"
] | 0.7832044 | 1 |
Query Google for the address of the given coordinates. Returns string if found, nil if not found or if network error. | def address(latitude, longitude)
return nil if latitude.blank? || longitude.blank?
return nil unless doc = search("#{latitude},#{longitude}", true)
# blindly use first result (assume it is most accurate)
doc['results'].first['formatted_address']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n return ret\nend",
"def coordinates(user_address)\n geocoding_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => user_address,\n :sensor => false}\n ).to_s\n\n response = JSON.parse(RestClient.get(geocoding_url))\n location = response[\"results\"][0][\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\nend",
"def locate(address)\n get :geo, :q => address\n end",
"def coordinates_url latitude, longitude\n \"https://www.google.com/maps/search/?api=1&query=#{latitude}%2C#{longitude}\"\n end",
"def geo_coordinates_for address\n @log ||= Rails.logger\n return KNOWN_PLACES[address] if KNOWN_PLACES[address]\n \n google_data = get_geo_json address, :retries => 2\n location = google_data['results'].first['geometry']['location'] rescue {}\n \n log_empty(address, google_data['status']) if location.blank?\n [location['lat'], location['lng']]\n end",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def call_google_api_for_location(address)\n url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{\n address}&key=#{ENV['GOOGLE_API_KEY']}\"\n response = HTTParty.get url\n response.body\n end",
"def get_lat_long_of_current(address)\n\n a = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => { :address => address,\n :sensor => \"false\"}\n )\n response = RestClient.get(a.to_s)\n\n response_json = JSON.parse(response)\n lat = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n long = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n [lat, long]\nend",
"def google_id(address)\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_SERVER_KEY'])\n place_info = @client.spots_by_query(address)[0]\n place_info.nil? ? \"not find\" : place_info.place_id\nend",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def coordinates(address)\n return nil if address.blank?\n return nil unless doc = search(address, false)\n # blindly use first result (assume it is most accurate)\n place = doc['results'].first['geometry']['location']\n ['lat', 'lng'].map{ |i| place[i] }\n end",
"def convert_location(address)\n loc_query = Addressable::URI.new(\n :scheme => \"http\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => {:address => \"#{address}\",\n :sensor => \"false\"}\n )\n\n geolocation_json = RestClient.get(loc_query.to_s)\n location = JSON.parse(geolocation_json)\n\n latitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n longitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n [latitude, longitude]\n end",
"def get_address\n welcome_message\n puts \"What is your location?\"\n user_location = Geocoder.search(gets.chomp)[0]\n if user_location != nil\n adr = user_location\n @city = adr.city\n @lat = adr.latitude\n @lon = adr.longitude\n else\n no_match\n end\n end",
"def tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end",
"def query_address2latlng(query_address)\n\t\tla_clave_esa = \"AIzaSyBtlkF4i2Mmv33\" + \"uVc4aVTA5JT94-eEnRTo\"\n\t\tgeocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+query_address+\"&key=\" + la_clave_esa\n\t\tgeocode_uri = URI.parse(geocode_url)\n\t\tgeocode_response = Net::HTTP.get_response(geocode_uri)\n\t\tgeocode_hash = JSON.parse geocode_response.body\n\t\t#pp geocode_hash\n\t\tlat = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\tlng = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\treturn lat.to_s + \",\" + lng.to_s\n\tend",
"def get_coords(address)\n file = open(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{URI.escape(address)}&key=AIzaSyARfm-3M5KppQjgGnHK1DIYt-GmG4eJqCI\")\n contents = file.read()\n hash = JSON.parse(contents)\n lat = hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_f\n lng = hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_f\n return [lat, lng]\nend",
"def locate(address)\n location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))\n # yahoo pukes on line breaks\n get :location => location.gsub(\"\\n\", ', ')\n end",
"def locate(address)\n location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))\n # yahoo pukes on line breaks\n get :location => location.gsub(\"\\n\", ', ')\n end",
"def get_address_coordinates(street, city)\n # puts \"got in get_location_coordinates\"\n # puts \"inside get_coordinates #{street}\"\n # puts \"inside get_coordinates #{city}\"\n\n coordinate_results = Geocoder.search(\"#{street}, #{city}\")\n\n # puts \"the results are #{coordinate_results}\"\n coordinate_results_lat = coordinate_results[0].data[\"geometry\"][\"location\"][\"lat\"]\n coordinate_results_lng = coordinate_results[0].data[\"geometry\"][\"location\"][\"lng\"]\n # puts \"final coordinates are #{coordinate_results_lat}, #{coordinate_results_lng}\"\n # return_result = \"\\\"#{coordinate_results_lat}, #{coordinate_results_lng}\\\"\"\n return coordinate_results_lat, coordinate_results_lng\n #binding.pry\nend",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def getaddress(name)\n addresses = getaddresses(name)\n if addresses.empty?\n raise ResolvError.new(\"no address for #{name}\")\n else\n addresses.first\n end\n end",
"def locate(place)\n locations, = get :q => place\n return locations.first\n end",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def get_coordinates\n checked_google_response do\n return parsed_response if raw\n parsed_response[\"results\"].inject([]) do |memo, result|\n memo << { \n :lat => result[\"geometry\"][\"location\"][\"lat\"], \n :lng => result[\"geometry\"][\"location\"][\"lng\"],\n :matched_address => result[\"formatted_address\"],\n :bounds => result[\"geometry\"][\"bounds\"],\n :full_data => result\n }\n end\n end\n end",
"def find( coordinates )\n case coordinates\n when Numeric\n each() do |character_range, data|\n return data if character_range.member?(coordinates)\n end\n else\n nyi( \"support for #{coordinates.class.name} coordinates\", coordinates )\n end\n \n return nil\n end",
"def get_coords(address)\n\n # Initiate @retries to 0 unless running method recursively\n unless caller[0][/`.*'/][1..-2] == __method__.to_s\n @retries = 0\n end\n\n name = address.split(\",\")[0]\n puts \"Getting coords for #{address}...\"\n\n # Get json from API call for specified location\n uri = URI(\"https://maps.googleapis.com/maps/api/geocode/json?address=\" + CGI.escape(\"#{address}\"))\n json = Net::HTTP.get(uri)\n out = JSON.parse(json)\n\n sleep 0.3\n\n # Recursively call method again if error is returned\n if out[\"status\"] != \"OK\"\n # Exit with error after too many retries\n if @retries > 3\n @errors.push(\"Error getting coords for: #{address[0]}\")\n return [name, address, \"ERROR\", \"ERROR\"]\n end\n\n @retries += 1\n return get_coords(address)\n end\n\n # Grab lat/lng from API output\n lat = out[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n lng = out[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n return [name, address, lat, lng]\nend",
"def geocode(address)\n result = Geocoder.search(address).first\n #result.latitude - float\n #result.longitude - float\n #result.coordinates - array of the above two\n #result.address - string\n #result.city - string\n #result.state - string\n #result.state_code - string\n #result.postal_code - string\n #result.country - string\n #result.country_code - string\n if result\n self.lat = result.latitude\n self.lng = result.longitude\n return true\n else\n return nil\n end\n end",
"def get_coords(address)\n coords = Geocoder.search(address)\n location = self.location\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def find_poll_addr(message_addr)\n uri = URI.parse('https://www.googleapis.com/civicinfo/v2/voterinfo?address=' + \\\n message_addr + '&electionId=2000&key=' + ENV[\"GOOGLE_API_KEY\"])\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n res_hash = JSON.parse(response.body)\n address_hash = res_hash['pollingLocations'][0]['address']\n locationName = address_hash['locationName']\n line1 = address_hash['line1'] || \"\"\n line2 = address_hash['line2'] || \"\"\n line3 = address_hash['line3'] || \"\"\n return \"We found the closest polling location to you:\\n\" + locationName+line1+line2+line3 + \"\\n\"\n end",
"def get_coords(address)\n coords = Geocoder.search(address)\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def geocode(address)\r\n\t\r\n\t\turi = URI.encode(\"#{@@google_base_url}#{address}\")\r\n\t\turl = URI.parse(uri)\r\n\t\thttp = Net::HTTP.new(url.host, url.port)\r\n\t\trequest = Net::HTTP::Get.new(url.request_uri)\r\n\t\tresponse = http.request(request)\t\r\n\t\t# throws exception\r\n\t\traise \"Bad response, code #{response.code}\" if response.code != \"200\"\r\n\t\t\r\n\t\t# result returned from Google Geocoding API\r\n\t\tresult = response.body\r\n\t\tjson_parsed = JSON.parse(result)\r\n\t\t\r\n\t\treturn json_parsed\r\n\tend",
"def locate(address)\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def locate(address)\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def locate(address)\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def geolocate\n \"#{self.address}\"', '\"#{self.state}\"', '\"#{self.zipcode}\"\n end",
"def fetch_raw_response(query, reverse = false)\n return nil if query.blank?\n\n # name parameter based on forward/reverse geocoding\n param = reverse ? :latlng : :address\n\n # build URL\n params = { param => query, :sensor => \"false\" }\n url = \"http://maps.google.com/maps/api/geocode/json?\" + params.to_query\n\n # query geocoder and make sure it responds quickly\n begin\n resp = nil\n timeout(3) do\n Net::HTTP.get_response(URI.parse(url)).body\n end\n rescue SocketError, TimeoutError\n return nil\n end\n end",
"def locate(latitude,longitude)\n get escape(\"lat=#{latitude}&lon=#{longitude}\")\n end",
"def find_neighborhood\n results = Geocoder.search(\"#{coordinates[1]},#{coordinates[0]}\")\n unless results.blank?\n n = 0\n m = 0\n has_neighborhood = false\n (0..(results.count-1)).each do |i|\n if results[i].types.include?(\"neighborhood\")\n has_neighborhood = true\n n = i\n break\n end\n end\n if has_neighborhood\n (0..(results[n].address_components.count-1)).each do |i|\n if results[n].address_components[i][\"types\"].include?(\"neighborhood\")\n m = i\n break\n end\n end\n results[n].address_components[m][\"long_name\"]\n else\n return nil\n end\n else\n return nil\n end\n \n end",
"def where_local(query)\n begin\n url = URI.parse GOOGLE_LOCAL_URI\n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(LOCAL_QUERY_STRING + CGI.escape(query))\n end\n\n results = JSON.parse(response.body)['responseData']['results']\n \n unless results.blank?\n results.map do |result|\n result['staticMapUrl'] =~ /zl=(\\d+)/\n {\n :name => result['titleNoFormatting'],\n :city => result['city'],\n :region => result['region'],\n :country => result['country'],\n :address => result['streetAddress'],\n :postal_code => result['postalCode'],\n :latitude => result['lat'].to_f,\n :longitude => result['lng'].to_f,\n :zoom => $1.to_i\n }\n end\n else\n []\n end\n rescue\n []\n end\n end",
"def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end",
"def get_address(lat,lon)\n\n cached_location = nil\n\n unless DISABLE_REDIS\n begin\n uri = URI.parse(\"redis://teamfordiana:[email protected]:10078\")\n redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)\n # redis = Redis.new # err, should do this elsewhere?\n\n rescue Exception => e\n print \"redis-server is not running\\n\"\n # redis-server probabably isn't running\n end\n end\n\n coords = lat.to_s + \",\" + lon.to_s\n\n unless redis.nil?\n cached_result = redis.get(coords)\n unless cached_result.nil?\n begin\n cached_location = JSON.parse(cached_result)\n rescue\n # invalid json\n end\n end\n end\n\n if cached_location.nil?\n location = Geokit::Geocoders::GoogleGeocoder.reverse_geocode(coords).hash\n sleep(SLEEP_TIME)\n else\n location = cached_location\n end\n\n # If redis is initialized, cache google results\n unless redis.nil?\n redis.set(coords, location.to_json)\n end\n\n return location\n\nend",
"def query(q, options={}, async = true)\n request(\"/Locations\", {:query => {:key => @key, :addressLine => q}.merge(options)}, async)\n end",
"def getGoogleGeoByAddress(street, csz)\r\n address_str = [street, csz].join(\" \")\r\n base_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{address_str}&key=#{GOOGLE_TOKEN}\"\r\n\r\n # Get the response\r\n uri = URI.parse(URI.escape(base_url))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n # ERROR CATCH\r\n return nil if json_result[\"status\"] == \"INVALID REQUEST\"\r\n\r\n place_results = json_result[\"results\"][0]\r\n\r\n # Define place id\r\n place_id = place_results[\"place_id\"]\r\n\r\n # Collect unit number (if applicable)\r\n address_components = json_result[\"results\"][0][\"address_components\"]\r\n address_components.each { |c| place_id += \"+#{c[\"long_name\"]}\" if c[\"types\"][0] == \"subpremise\" }\r\n\r\n geo_data = {:placeId => place_id,\r\n :lat => place_results[\"geometry\"][\"location\"][\"lat\"],\r\n :lon => place_results[\"geometry\"][\"location\"][\"lng\"],\r\n :format_add => place_results[\"formatted_address\"]}\r\n\r\n return geo_data\r\n end",
"def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end",
"def getLatLng(city, country, http)\n puts \"getLatLng(#{city}, #{country}, http)\"\n validLatLng = /-?\\d+\\.?\\d*/\n responseLoc = /.*\\\"lat\\\": (#{validLatLng}).*\\\"lng\\\": (#{validLatLng}).*/m\n lat = \"\"\n lng = \"\"\n \n cityAry = city.split(' ')\n subRequest = cityAry[0]\n (cityAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += cityAry[i+1]\n }\n \n subRequest += ','\n \n countryAry = country.split(' ')\n subRequest += countryAry[0]\n (countryAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += countryAry[i+1]\n }\n \n request = \"/maps/api/geocode/json?address=#{subRequest}&sensor=false\"\n # puts \"request: #{request}\"\n response = http.request_get(request)\n \n if response.body =~ responseLoc\n lat = $1\n lng = $2\n end\n\n sleep 0.5 #Sleep a second so that Google doesn't rate limit me\n \n if lat == \"\" or lng == \"\"\n puts \"TROUBLE! #{request}\"\n puts response.body\n LatLng.new(-200,-200)\n else\n LatLng.new(lat.to_f, lng.to_f)\n end\nend",
"def geocode_address\n geo = Geokit::Geocoders::MultiGeocoder.geocode(self.address_string)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n puts geo.class\n errors.add(:address, \"Could not Geocode address\")\n end\n end",
"def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end",
"def locate(address)\n get :location => address\n end",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def geocode(location)\n # First, try World Kit\n latlong = tryWorldKit(location)\n if latlong\n puts \"Used worldkit\"\n puts latlong\n return latlong\n else\n puts \"Used google\"\n return tryGoogle(location)\n end\n end",
"def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end",
"def google_place_geocode(poi)\n gs = GeocodingService.new\n\n location_with_address = poi.address.to_s + ' ' + poi.city.to_s + ', ' + poi.state.to_s + ' ' + poi.zip.to_s\n\n result = gs.google_place_search(poi.name.to_s)\n if result.body['status'] != 'ZERO_RESULTS'\n place_id = result.body['predictions'].first['place_id']\n poi.google_place_id = place_id\n poi.save\n return true\n else\n result = gs.google_place_search(location_with_address)\n if result.body['status'] != 'ZERO_RESULTS'\n place_id = result.body['predictions'].first['place_id']\n poi.google_place_id = place_id\n poi.save\n return true\n else\n return false\n end\n end\n end",
"def query_location_lat_long\n loc = MultiGeocoder.geocode(location)\n [loc.lat, loc.lng]\n end",
"def locate(address)\n delay_before_locate\n get :q => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def viewMapByAddress(address, callback)\n puts \"viewMapByAddress(address:#{address}, callback:#{callback}\"\n\n url = \"http://maps.google.com/maps/api/geocode/json?\" +\n \"address=#{address}&\" +\n \"sensor=true\"\n #puts url\n\n res = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res.inspect\n\n if res[\"status\"] == \"ok\" # && res[\"body\"][\"status\"] == \"OK\"\n #puts res[\"body\"].inspect\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n to_lat = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n to_lng = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n else\n to_lat = '34.4893270'\n to_lng = '133.3614320'\n end\n\n viewMap address, to_lat, to_lng, callback\n end",
"def geolookup(query)\n get_json(\"#{api_url}/geolookup/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def set_address\n url = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{self.latitude},#{self.longitude}&sensor=true\")\n req = Net::HTTP::Get.new(url.to_s)\n req.use_ssl = true if url.scheme == 'https'\n res = Net::HTTP.start(url.host, url.port) { |http|\n http.request(req)\n }\n result = JSON.parse(res.body)\n self.address = result['results'][0]['formatted_address'] rescue \"Not Found\"\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def query(latlng:, result_type: nil, location_type: nil, language: nil)\n # Check if latlng param is a place_id string.\n # 'place_id' strings do not contain commas; latlng strings do.\n if latlng.is_a?(String) && !latlng.include?(\",\")\n params = {'place_id' => latlng}\n else\n params = {'latlng' => Convert.to_latlng(latlng)}\n end\n\n if result_type\n params['result_type'] = Convert.join_array('|', result_type)\n end\n\n if location_type\n params['location_type'] = Convert.join_array('|', location_type)\n end\n\n if language\n params['language'] = language\n end\n\n case self.client.response_format\n when :xml\n self.client.request(url: '/maps/api/geocode/xml', params: params).xpath('//result')\n when :json\n self.client.request(url: '/maps/api/geocode/json', params: params)['results']\n else\n raise StandardError, 'Unsupported response format. Should be either :json or :xml.'\n end\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def get_place(query)\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query=#{query}\")\n\n response_hash = access_api(url)\n if response_hash == nil || response_hash[\"Places\"] == nil || response_hash[\"Places\"][0] == nil\n return nil\n end\n response_hash[\"Places\"][0][\"PlaceId\"]\nend",
"def getGoogleURL(location)\n url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\"\n city = location[/^([\\w ]+), ([\\w ]+)+$/, 1]\n state = location[/^([\\w ]+), ([\\w ]+)+$/, 2]\n city = city.gsub(' ', '+')\n state_abbrev = STATE_ABBR[state]\n \n # State abbrev is either a US state, or a country (Madrid, Spain)\n state_abbrev ||= state\n state_abbrev = state_abbrev.gsub(' ', '+')\n \n url << city <<',' << state_abbrev << \"&sensor=false\"\n return url\n \n end",
"def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end",
"def get_location(place)\n\t\tsleep(1.5)\n\t\tlocation = Geocoder.search(place)\n\t\t#puts location.inspect\n\t\tif !location.empty?\n\t\t\tlocation_geometry = location.first.geometry\n\t\t\tlocation_bounds = location_geometry['bounds']\n\t\t\tif !location_bounds.nil?\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['bounds']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['bounds']['northeast']['lng'])\n\t\t\telse\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['viewport']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['viewport']['northeast']['lng'])\n\t\t\tend\n\t\t\tif !location.nil?\n\t\t\t\t@user_location_lat = rand(lat_range).round(7)\n\t\t\t\t@user_location_long = rand(long_range).round(7)\n\t\t\telse\n\t\t\t\t@user_location_lat = \"here\"\n\t\t\t\t@user_location_long = \"here\"\n\t\t\tend\n\t\telse\n\t\t\t@user_location_lat = \"no data\"\n\t\t\t@user_location_long = \"no data\"\n\t\tend\n\tend",
"def geocode_of_site(url)\n get_geo_info(url)['results'][0]['geometry']['location']\n end",
"def gmaps4rails_address\n \"#{address1}, #{address2}, #{city}, #{state}, #{zipcode}\"\n end",
"def geocode_address\n full_address or address\n end",
"def get_info(lat, lon)\n Net::HTTP.get(URI(\"https://api.3geonames.org/#{lat},#{lon}.json\"))\nend",
"def locate(address)\n get :address => address.is_a?(String) ? address : location_from_params(address).to_s\n end",
"def geocode\n do_lookup(false) do |o,rs|\n if r = rs.first\n unless r.coordinates.nil?\n o.__send__ \"#{self.class.geocoder_options[:coordinates]}=\", r.coordinates.reverse\n end\n r.coordinates\n end\n end\n end",
"def gmaps4rails_address\n \"#{latitude}, #{longitude}\"\n end",
"def get(criteria={})\n\n geo_count = @geolocations.size\n i = 1\n\n begin\n\n geo = select\n raise Error.new(GEO_NOT_VALID, :values => {:country => criteria[:country], :protocol => criteria[:protocol]}) if (!criteria[:country].nil? and criteria[:country].downcase != geo.country.downcase) or\n (!criteria[:protocol].nil? and criteria[:protocol].downcase != geo.protocol.downcase)\n\n rescue Exception => e\n\n case e.code\n when NONE_GEOLOCATION\n @logger.an_event.error e.message\n raise e\n when GEO_NOT_VALID\n if i < geo_count\n i += 1\n @logger.an_event.warn e.message\n retry\n else\n @logger.an_event.error e.message\n raise Error.new(GEO_NONE_COMPLIANT)\n end\n end\n else\n #on sort de la boucle :\n # soit on a trouve une geo qui repond aux criteres passés si il y en a\n # soit parce que on les a passé tous les geo et il n'y a aucun geolocation qui satisfont les critères => exception\n @logger.an_event.info \"geolocation find : #{geo.to_s}\"\n return geo\n ensure\n\n end\n end",
"def validate_address\n trip_address = params[:data]\n coordinate_array = nil\n\n # Call to the geocoder API returns nil if the address cannot be geocoded\n coordinate_array = GoogleAPIGeocoder.do_geocode(trip_address)\n\n if coordinate_array.nil?\n render json: {response: \"-1\"}\n else\n render json: {response: \"1\"}\n end\n\n end",
"def locate(address)\n location = address.is_a?(String) ? address : location_from_params(address)\n case location\n when String\n get :qs => location\n when Location\n get \"street\" => location.street, \n \"region\" => location.region, \n \"city\" => location.city, \n \"postalCode\" => location.postal_code, \n \"countryCode\" => location.country\n end\n end",
"def gmaps4rails_address\n addr = if state and state.name.present?\n \"#{address_1}, #{city}, #{state.name} #{zip_code}\"\n elsif (address_1)\n \"#{address_1}, #{raw_seed}\"\n else\n \"1856 Stevenson Ave, Clearwater, Florida 33755\"\n end\n puts \"gmap input:#{addr}\"\n addr\n end",
"def gmaps4rails_address\n \t\"#{address}, #{city}, #{state}\"\n end",
"def google_location\n \"#{(street.blank? ? '' : street + '<br>')}\n #{(street_no.blank? ? '' : street_no + '<br>')}\n #{(zip.blank? ? '' : zip + ' ')}#{(city.blank? ? '' : city + '<br>')}\n #{(state.blank? ? '' : state + '<br>')}\n #{(country_name.blank? ? '' : country_name)}\".html_safe\n end",
"def reverse_geocode(coordinates, options = {})\n if coordinates.size < 1\n raise ArgumentError, 'You must provide coordinates to reverse geocode.'\n elsif coordinates.size == 1\n reverse_geocode_single(coordinates.first, options)\n else\n reverse_geocode_batch(coordinates, options)\n end\n end",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def location\n if [latitude, longitude].all?(&:present?)\n [latitude, longitude]\n end\n end",
"def geocode\n geo = Geokit::Geocoders::MultiGeocoder.geocode address.gsub(/\\n/, ', ')\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n errors.add(:address, 'Problem locating address')\n end\n end",
"def search_with_coordinates(term, latitude, longitude, options={})\n search_businesses(term, options.merge(:ll=>\"#{latitude},#{longitude}\"))\n end",
"def address\n unless addresses.empty?\n addresses.first\n else\n nil\n end\n end",
"def address\n return poi.address unless poi.nil?\n return place.address unless place.nil?\n addr = get_address\n return addr.blank? ? raw_address : addr\n end",
"def find(query,options={})\n options.merge!(:q => query, :sll => @latlng) # Merge in the query and the lat/lng into the options\n fetch_locations(self.class.get(\"/local\", :query => options)) # Make the get request\n end",
"def get_address(addr)\n Address.get(@id, addr.to_s)\n end",
"def optimistic_geo_wrapper(query)\n geocoded = nil\n result = ::Geocoder.search(query)\n puts result.inspect\n geocoded = result[0].data if result[0]\n geocoded\n end",
"def gmaps4rails_address\n \"#{address}, #{city_state_zip}\"\n end",
"def geocode(address)\n q = { address: URI::encode(address) }\n q[:key] = @config[:api_key] if @config.has_key?(:api_key)\n\n res = get('/json', q)\n JSON::parse(res.body)\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def addresses\n query(:address)\n end",
"def spatial_query(bounds)\n sb = bounds_to_center_radius(bounds)\n if sb.present?\n \"{!spatial lat=#{sb[:center][:latitude]} long=#{sb[:center][:longitude]} radius=#{sb[:radius]} unit=km calc=arc threadCount=2}\"\n else\n \"\"\n end\n end",
"def geocode(addresses, options = {})\n if addresses.size < 1\n raise ArgumentError, 'You must provide at least one address to geocode.'\n elsif addresses.size == 1\n geocode_single(addresses.first, options)\n else\n geocode_batch(addresses, options)\n end\n end",
"def origin\n coord, address = Map.locate_user(params[:address], locate_by_ip)\n #address may not be the same as params, if params.blank?\n return coord, address\n end",
"def get_place_info(keyword)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_TEXTSEARCH)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n query: keyword,\n key: google_places_api_key\n })\n p uri.query\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end"
] | [
"0.6729448",
"0.6680642",
"0.6546521",
"0.6525455",
"0.64835143",
"0.63535297",
"0.6295257",
"0.62468207",
"0.6161132",
"0.6121456",
"0.6099901",
"0.60981727",
"0.6058294",
"0.59705615",
"0.59515345",
"0.59493357",
"0.5939193",
"0.5904536",
"0.5904536",
"0.5836619",
"0.58148235",
"0.5807486",
"0.5768319",
"0.57612336",
"0.57554007",
"0.5750898",
"0.57353365",
"0.5724277",
"0.57060474",
"0.56926847",
"0.56848276",
"0.56734204",
"0.5663631",
"0.5655168",
"0.5655168",
"0.5655168",
"0.5652092",
"0.5648637",
"0.5629464",
"0.56040347",
"0.5592689",
"0.5589972",
"0.55852747",
"0.5583415",
"0.5578099",
"0.5572128",
"0.5563743",
"0.55593723",
"0.555656",
"0.55306",
"0.55258304",
"0.55243045",
"0.5523348",
"0.55214846",
"0.5508288",
"0.55075",
"0.5490099",
"0.5462849",
"0.5460823",
"0.54592454",
"0.5448195",
"0.5440148",
"0.5435609",
"0.5427437",
"0.53940725",
"0.5381807",
"0.5371589",
"0.5365819",
"0.5364972",
"0.53501153",
"0.5342383",
"0.5334039",
"0.5331921",
"0.5322764",
"0.5305189",
"0.52976847",
"0.5292724",
"0.5284105",
"0.5280062",
"0.5275836",
"0.5258072",
"0.52430767",
"0.52370363",
"0.5236511",
"0.523163",
"0.52285886",
"0.52142",
"0.52138484",
"0.52135587",
"0.52119905",
"0.5186631",
"0.51773685",
"0.51742625",
"0.517266",
"0.51610607",
"0.5146352",
"0.5141624",
"0.51322025",
"0.5130164",
"0.51295114"
] | 0.67221576 | 1 |
Query Google for geographic information about the given phrase. Returns a hash representing a valid geocoder response. Returns nil if non200 HTTP response, timeout, or other error. | def search(query, reverse = false)
doc = fetch_parsed_response(query, reverse)
doc && doc['status'] == "OK" ? doc : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def fetch_raw_response(query, reverse = false)\n return nil if query.blank?\n\n # name parameter based on forward/reverse geocoding\n param = reverse ? :latlng : :address\n\n # build URL\n params = { param => query, :sensor => \"false\" }\n url = \"http://maps.google.com/maps/api/geocode/json?\" + params.to_query\n\n # query geocoder and make sure it responds quickly\n begin\n resp = nil\n timeout(3) do\n Net::HTTP.get_response(URI.parse(url)).body\n end\n rescue SocketError, TimeoutError\n return nil\n end\n end",
"def optimistic_geo_wrapper(query)\n geocoded = nil\n result = ::Geocoder.search(query)\n puts result.inspect\n geocoded = result[0].data if result[0]\n geocoded\n end",
"def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n return ret\nend",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def geocode(address)\r\n\t\r\n\t\turi = URI.encode(\"#{@@google_base_url}#{address}\")\r\n\t\turl = URI.parse(uri)\r\n\t\thttp = Net::HTTP.new(url.host, url.port)\r\n\t\trequest = Net::HTTP::Get.new(url.request_uri)\r\n\t\tresponse = http.request(request)\t\r\n\t\t# throws exception\r\n\t\traise \"Bad response, code #{response.code}\" if response.code != \"200\"\r\n\t\t\r\n\t\t# result returned from Google Geocoding API\r\n\t\tresult = response.body\r\n\t\tjson_parsed = JSON.parse(result)\r\n\t\t\r\n\t\treturn json_parsed\r\n\tend",
"def call_google_api_for_location(address)\n url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{\n address}&key=#{ENV['GOOGLE_API_KEY']}\"\n response = HTTParty.get url\n response.body\n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def geolookup(query)\n get_json(\"#{api_url}/geolookup/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def get_place_info(keyword)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_TEXTSEARCH)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n query: keyword,\n key: google_places_api_key\n })\n p uri.query\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def geographic_search\n @geographic_search ||= begin\n result = sw_geographic_search\n\n # TODO: this should go into stanford-mods ... but then we have to set that gem up with a Logger\n # print a message for any unrecognized encodings\n xvals = subject.geographicCode.translated_value\n codes = term_values([:subject, :geographicCode])\n if codes && codes.size > xvals.size\n subject.geographicCode.each { |n|\n next unless n.authority != 'marcgac' && n.authority != 'marccountry'\n\n sw_logger.info(\"#{druid} has subject geographicCode element with untranslated encoding (#{n.authority}): #{n.to_xml}\")\n }\n end\n\n # FIXME: stanford-mods should be returning [], not nil ...\n return nil if !result || result.empty?\n\n result\n end\n end",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def get_location(response, persist = true)\n user = response.user\n query = nil\n if response.matches[0].is_a?(Array) and !response.matches[0].empty?\n query = response.matches[0][0]\n end\n\n Lita.logger.debug \"Performing geolookup for '#{user.name}' for '#{query}'\"\n\n if query.nil? or query.empty?\n Lita.logger.debug \"No query specified, pulling from redis #{REDIS_KEY}, #{user.name}\"\n serialized_geocoded = redis.hget(REDIS_KEY, user.name)\n unless serialized_geocoded == 'null' or serialized_geocoded.nil?\n geocoded = JSON.parse(serialized_geocoded)\n end\n Lita.logger.debug \"Cached location: #{geocoded.inspect}\"\n end\n\n query = (query.nil?)? 'Portland, OR' : query\n Lita.logger.debug \"q & g #{query.inspect} #{geocoded.inspect}\"\n\n unless geocoded\n uri = \"https://atlas.p3k.io/api/geocode?input=#{URI.escape query}\"\n Lita.logger.debug \"Redis hget failed, performing lookup for #{query} on #{uri}\"\n # geocoded = optimistic_geo_wrapper query, config.geocoder_key\n geocoded = JSON.parse RestClient.get(uri)\n Lita.logger.debug \"Geolocation found. '#{geocoded.inspect}' failed, performing lookup\"\n if persist\n redis.hset(REDIS_KEY, user, geocoded.to_json)\n end\n end\n\n Lita.logger.debug \"geocoded: '#{geocoded}'\"\n loc = {\n name: geocoded['best_name'],\n lat: geocoded['latitude'],\n lng: geocoded['longitude']\n }\n\n Lita.logger.debug \"loc: '#{loc}'\"\n\n loc\n end",
"def geocode_of_site(url)\n get_geo_info(url)['results'][0]['geometry']['location']\n end",
"def tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end",
"def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end",
"def getLatLng(city, country, http)\n puts \"getLatLng(#{city}, #{country}, http)\"\n validLatLng = /-?\\d+\\.?\\d*/\n responseLoc = /.*\\\"lat\\\": (#{validLatLng}).*\\\"lng\\\": (#{validLatLng}).*/m\n lat = \"\"\n lng = \"\"\n \n cityAry = city.split(' ')\n subRequest = cityAry[0]\n (cityAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += cityAry[i+1]\n }\n \n subRequest += ','\n \n countryAry = country.split(' ')\n subRequest += countryAry[0]\n (countryAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += countryAry[i+1]\n }\n \n request = \"/maps/api/geocode/json?address=#{subRequest}&sensor=false\"\n # puts \"request: #{request}\"\n response = http.request_get(request)\n \n if response.body =~ responseLoc\n lat = $1\n lng = $2\n end\n\n sleep 0.5 #Sleep a second so that Google doesn't rate limit me\n \n if lat == \"\" or lng == \"\"\n puts \"TROUBLE! #{request}\"\n puts response.body\n LatLng.new(-200,-200)\n else\n LatLng.new(lat.to_f, lng.to_f)\n end\nend",
"def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend",
"def get_address\n welcome_message\n puts \"What is your location?\"\n user_location = Geocoder.search(gets.chomp)[0]\n if user_location != nil\n adr = user_location\n @city = adr.city\n @lat = adr.latitude\n @lon = adr.longitude\n else\n no_match\n end\n end",
"def optimistic_geo_wrapper(query)\n Lita.logger.debug 'Optimistically geo wrapping!'\n geocoded = nil\n result = ::Geocoder.search(query)\n Lita.logger.debug \"Geocoder result: '#{result.inspect}'\"\n if result[0]\n geocoded = result[0].data\n end\n geocoded\n end",
"def getGoogleGeoByAddress(street, csz)\r\n address_str = [street, csz].join(\" \")\r\n base_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{address_str}&key=#{GOOGLE_TOKEN}\"\r\n\r\n # Get the response\r\n uri = URI.parse(URI.escape(base_url))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n # ERROR CATCH\r\n return nil if json_result[\"status\"] == \"INVALID REQUEST\"\r\n\r\n place_results = json_result[\"results\"][0]\r\n\r\n # Define place id\r\n place_id = place_results[\"place_id\"]\r\n\r\n # Collect unit number (if applicable)\r\n address_components = json_result[\"results\"][0][\"address_components\"]\r\n address_components.each { |c| place_id += \"+#{c[\"long_name\"]}\" if c[\"types\"][0] == \"subpremise\" }\r\n\r\n geo_data = {:placeId => place_id,\r\n :lat => place_results[\"geometry\"][\"location\"][\"lat\"],\r\n :lon => place_results[\"geometry\"][\"location\"][\"lng\"],\r\n :format_add => place_results[\"formatted_address\"]}\r\n\r\n return geo_data\r\n end",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def google(m, query)\n m.reply(search(query))\n end",
"def get_place(query)\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query=#{query}\")\n\n response_hash = access_api(url)\n if response_hash == nil || response_hash[\"Places\"] == nil || response_hash[\"Places\"][0] == nil\n return nil\n end\n response_hash[\"Places\"][0][\"PlaceId\"]\nend",
"def call(params_hash)\n url = \"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{params_hash[:q]}&type=#{params_hash[:type]}&key=#{API_KEY}\"\n fetch(url)\n end",
"def geocoding\n @geocoding ||= Geocoding::Gateway.new(client)\n end",
"def query_address2latlng(query_address)\n\t\tla_clave_esa = \"AIzaSyBtlkF4i2Mmv33\" + \"uVc4aVTA5JT94-eEnRTo\"\n\t\tgeocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+query_address+\"&key=\" + la_clave_esa\n\t\tgeocode_uri = URI.parse(geocode_url)\n\t\tgeocode_response = Net::HTTP.get_response(geocode_uri)\n\t\tgeocode_hash = JSON.parse geocode_response.body\n\t\t#pp geocode_hash\n\t\tlat = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\tlng = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\treturn lat.to_s + \",\" + lng.to_s\n\tend",
"def geocode(location)\n # First, try World Kit\n latlong = tryWorldKit(location)\n if latlong\n puts \"Used worldkit\"\n puts latlong\n return latlong\n else\n puts \"Used google\"\n return tryGoogle(location)\n end\n end",
"def geocode!\n result = GeoKit::Geocoders::YahooGeocoder.geocode \"#{@street}, #{@city}, #{@state} #{@zip}\"\n if result.success?\n @street = result.street_address\n @city = result.city\n @state = result.state\n @zip = result.zip\n @country = result.country_code\n @lat = result.lat\n @lng = result.lng\n @status = STATUS_GEOCODED\n else\n @status = STATUS_GEOCODE_ERROR\n end\n end",
"def geocoder\n begin\n render(:json => open(\"#{GEOCODER_URL}&#{request.query_string}\"){|f| f.read})\n rescue SocketError\n render(:text => $!.to_s, :status => 500)\n end\n end",
"def get_live_response(address_info)\n raise \"API key not specified.\\nCall AddressStandardization::GoogleMaps.api_key = '...' before you call .standardize().\" unless GoogleMaps.api_key\n \n address_info = address_info.stringify_keys\n \n address_str = [\n address_info[\"street\"],\n address_info[\"city\"],\n (address_info[\"state\"] || address_info[\"province\"]),\n address_info[\"zip\"]\n ].compact.join(\" \")\n url = \"http://maps.google.com/maps/geo?q=#{address_str.url_escape}&output=xml&key=#{GoogleMaps.api_key}&oe=utf-8\"\n AddressStandardization.debug \"[GoogleMaps] Hitting URL: #{url}\"\n uri = URI.parse(url)\n res = Net::HTTP.get_response(uri)\n return unless res.is_a?(Net::HTTPSuccess)\n \n content = res.body\n AddressStandardization.debug \"[GoogleMaps] Response body:\"\n AddressStandardization.debug \"--------------------------------------------------\"\n AddressStandardization.debug content\n AddressStandardization.debug \"--------------------------------------------------\"\n xml = Nokogiri::XML(content)\n xml.remove_namespaces! # good or bad? I say good.\n return unless xml.at(\"/kml/Response/Status/code\").inner_text == \"200\"\n \n addr = {}\n \n addr[:street] = get_inner_text(xml, '//ThoroughfareName').to_s\n addr[:city] = get_inner_text(xml, '//LocalityName').to_s\n addr[:province] = addr[:state] = get_inner_text(xml, '//AdministrativeAreaName').to_s\n addr[:zip] = addr[:postalcode] = get_inner_text(xml, '//PostalCodeNumber').to_s\n addr[:country] = get_inner_text(xml, '//CountryName').to_s\n \n return if addr[:street] =~ /^\\s*$/ or addr[:city] =~ /^\\s*$/\n \n Address.new(addr)\n end",
"def where_local(query)\n begin\n url = URI.parse GOOGLE_LOCAL_URI\n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(LOCAL_QUERY_STRING + CGI.escape(query))\n end\n\n results = JSON.parse(response.body)['responseData']['results']\n \n unless results.blank?\n results.map do |result|\n result['staticMapUrl'] =~ /zl=(\\d+)/\n {\n :name => result['titleNoFormatting'],\n :city => result['city'],\n :region => result['region'],\n :country => result['country'],\n :address => result['streetAddress'],\n :postal_code => result['postalCode'],\n :latitude => result['lat'].to_f,\n :longitude => result['lng'].to_f,\n :zoom => $1.to_i\n }\n end\n else\n []\n end\n rescue\n []\n end\n end",
"def geocode(host = nil)\n # Data accuracy, as returned by google geocoder - think this relates to zoom level too for google maps\n # 0\t Unknown location. (Since 2.59)\n # 1\t Country level accuracy. (Since 2.59)\n # 2\t Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)\n # 3\t Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)\n # 4\t Town (city, village) level accuracy. (Since 2.59)\n # 5\t Post code (zip code) level accuracy. (Since 2.59)\n # 6\t Street level accuracy. (Since 2.59)\n # 7\t Intersection level accuracy. (Since 2.59)\n # 8\t Address level accuracy. (Since 2.59\n \n host ||= User.environment[\"HOST\"] rescue \"localhost\"\n if self.country && !self.mappable?\n geocode_string = [self.location, self.city, self.state, self.country].compact.join(',')\n # puts \"Geocoding '#{geocode_string}'\"\n results = Geocoding::get(geocode_string, :host => host)\n if results.status == Geocoding::GEO_UNKNOWN_ADDRESS\n # Try with just city and country\n geocode_new_string = [self.city, self.country].compact.join(',')\n if geocode_new_string != geocode_string\n logger.info \"Asset: Address for '#{geocode_string}' unknown, trying with '#{geocode_new_string}'\"\n results = Geocoding::get(geocode_new_string, :host => host)\n geocode_string = geocode_new_string\n end\n end\n \n if results.status == Geocoding::GEO_SUCCESS\n # logger.info \"Geocoded '#{geocode_string}' with accuracy #{results[0].accuracy}\"\n self.latitude = results[0].latitude\n self.longitude = results[0].longitude\n self.geocode_accuracy = results[0].accuracy\n self.geocode_method = GEO_GOOGLE\n else\n logger.info \"Asset: Could not geocode '#{self.name}' with '#{geocode_string}'. Result was #{results.status}\"\n end\n end\n true\n end",
"def test_geocoders(address, threshold)\n locations = multi_geocode_address(address)\n # Assume that Google gets it right!\n authoritative_location = locations['google']\n if !authoritative_location\n if $verbose then $stderr.puts \"Google couldn't geocode '#{address}'\" end\n end\n result = {}\n locations.each do |name, location|\n if !authoritative_location or !location\n distance = nil\n passed = false\n else\n distance = distance_from_lat_lon(location, authoritative_location)\n passed = (distance < threshold)\n end\n result[name] = { 'passed' => passed, 'distance' => distance, 'location' => location }\n end\n result\nend",
"def get_coords(address)\n file = open(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{URI.escape(address)}&key=AIzaSyARfm-3M5KppQjgGnHK1DIYt-GmG4eJqCI\")\n contents = file.read()\n hash = JSON.parse(contents)\n lat = hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_f\n lng = hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_f\n return [lat, lng]\nend",
"def geocode(address)\n result = Geocoder.search(address).first\n #result.latitude - float\n #result.longitude - float\n #result.coordinates - array of the above two\n #result.address - string\n #result.city - string\n #result.state - string\n #result.state_code - string\n #result.postal_code - string\n #result.country - string\n #result.country_code - string\n if result\n self.lat = result.latitude\n self.lng = result.longitude\n return true\n else\n return nil\n end\n end",
"def geocode(options)\n response = client.get(GEOCODE_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_location_from(response.items.first)\n end",
"def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end",
"def google_place_geocode(poi)\n gs = GeocodingService.new\n\n location_with_address = poi.address.to_s + ' ' + poi.city.to_s + ', ' + poi.state.to_s + ' ' + poi.zip.to_s\n\n result = gs.google_place_search(poi.name.to_s)\n if result.body['status'] != 'ZERO_RESULTS'\n place_id = result.body['predictions'].first['place_id']\n poi.google_place_id = place_id\n poi.save\n return true\n else\n result = gs.google_place_search(location_with_address)\n if result.body['status'] != 'ZERO_RESULTS'\n place_id = result.body['predictions'].first['place_id']\n poi.google_place_id = place_id\n poi.save\n return true\n else\n return false\n end\n end\n end",
"def geoCode(postal)\n\turl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + postal + \"&key=AIzaSyBZqs-MS-5WyI9s-eS2Bx3wEemC5gzlhqc\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tgeoInfo = JSON.parse(response)\n\treturn geoInfo\nend",
"def get_suggestion(query) \n oauth = OAuth.new(:consumer_key => self.consumer_key, \n :consumer_secret => self.consumer_secret) \n signed_url = oauth.sign build_query(query)\n\n response = http_client.get(signed_url)\n response_hash = MultiJson.decode(response.body)\n \n suggestion = get_suggestion_from_response(response_hash)\n\n return nil unless suggestion\n return nil if suggestion.downcase == query.downcase\n\n return suggestion\n rescue ::YBossSpell::Error, ::HTTPClient::TimeoutError, ::MultiJson::LoadError => e\n Rails.logger.error(\"YBossSpell: #{e.inspect}\") \n return false\n end",
"def google_id(address)\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_SERVER_KEY'])\n place_info = @client.spots_by_query(address)[0]\n place_info.nil? ? \"not find\" : place_info.place_id\nend",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def get_coordinates\n checked_google_response do\n return parsed_response if raw\n parsed_response[\"results\"].inject([]) do |memo, result|\n memo << { \n :lat => result[\"geometry\"][\"location\"][\"lat\"], \n :lng => result[\"geometry\"][\"location\"][\"lng\"],\n :matched_address => result[\"formatted_address\"],\n :bounds => result[\"geometry\"][\"bounds\"],\n :full_data => result\n }\n end\n end\n end",
"def geocode\n fail\n end",
"def test_get_geocode_city_state\n valid_geocode_request = @base_url+\"?\"+@geocode_city_state+\"&\"+@api_key\n server_response = http_request(:get, valid_geocode_request)\n\n response_body = server_response.body\n formatted_address = JSON.parse(response_body)[\"results\"][0][\"formatted_address\"]\n status = JSON.parse(response_body)[\"status\"]\n assert_requested(:get, valid_geocode_request, times: 1)\n assert_equal \"San Francisco, CA, USA\", formatted_address\n assert_equal \"OK\", status\n end",
"def geocode(address)\n q = { address: URI::encode(address) }\n q[:key] = @config[:api_key] if @config.has_key?(:api_key)\n\n res = get('/json', q)\n JSON::parse(res.body)\n end",
"def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end",
"def weather_city(response)\n return if Lita.config.handlers.weather.api_key.nil?\n\n resp = http.get('http://maps.googleapis.com/maps/api/geocode/json',\n address: response.matches[0][0],\n sensor: 'false')\n\n raise 'GoogleFail' unless resp.status == 200\n\n obj = MultiJson.load(resp.body)\n\n raise 'GoogleError' unless obj['status'].eql?('OK')\n\n location = obj['results'].first['geometry']['location']\n\n response.reply get_conditions(\"#{location['lat']},#{location['lng']}\")\n\n rescue\n response.reply 'Sorry, but there was a problem locating that city.'\n end",
"def search\n if params[:key] == AUTHORIZATION_TOKEN && params[:q] == \"discover\"\n @google_places = discover\n @places = PLACES.select do |place|\n (place[:coordinates][:latitude].between?(average_location - 0.01, average_location + 0.01))\n end\n elsif params[:key] == AUTHORIZATION_TOKEN && params[:q]\n params_hash = {\n q: params[:q],\n type: params[:type] || \"bar\"\n }\n @google_places = call(params_hash)\n @places = PLACES.select do |place|\n (place[:name].downcase.include? (params[:q].downcase)) || (place[:coordinates][:latitude].between?(average_location - 0.01, average_location + 0.01))\n end\n\n render_error(\"empty\") if @google_places.empty? && @places.empty?\n elsif params[:q]\n render_error\n else\n render_error(\"missing_params\")\n end\n end",
"def find(address)\n # Geocode the given address.\n geocode address\n\n ward = Data.new(data)\n ward.to_hash\n end",
"def get_lat_long_of_current(address)\n\n a = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => { :address => address,\n :sensor => \"false\"}\n )\n response = RestClient.get(a.to_s)\n\n response_json = JSON.parse(response)\n lat = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n long = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n [lat, long]\nend",
"def geocode(s)\n @geocoder.run(s)\n end",
"def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end",
"def run(s)\n # exec request\n data = @ctx.cache.get(URL, PARAMS.merge({\n address: s,\n }))\n\n # log data\n @ctx.log.debug('Geocoder#run') do\n 'data = %p' % [data]\n end\n\n # map matches and return result\n data['result']['addressMatches'].map { |row|\n ::WeatherSage::Census::Match.new(@ctx, row)\n }\n end",
"def validate_address\n trip_address = params[:data]\n coordinate_array = nil\n\n # Call to the geocoder API returns nil if the address cannot be geocoded\n coordinate_array = GoogleAPIGeocoder.do_geocode(trip_address)\n\n if coordinate_array.nil?\n render json: {response: \"-1\"}\n else\n render json: {response: \"1\"}\n end\n\n end",
"def query\n { \"page\" => page,\n \"page_size\" => page_size,\n \"phrase\" => phrase }\n end",
"def get_google_img(query)\n img_search_keywords = query.strip.gsub(/\\s+/,'+')\n \n if img_search_keywords != ''\n url = \"http://ajax.googleapis.com/ajax/services/search/images?rsz=large&start=1&v=1.0&q=#{img_search_keywords}\"\n \n json_results = open(url) {|f| f.read };\n results = JSON.parse(json_results)\n image_array = results['responseData']['results']\n image = image_array[0] if image_array\n image = image['tbUrl']\n \n if image\n return image\n else\n return 'no image found'\n end\n end\n end",
"def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end",
"def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend",
"def locate(address)\n get :geo, :q => address\n end",
"def geocode!(instance)\n result = coordinates(instance).first\n if result\n {\n lat: result.latitude,\n lon: result.longitude,\n region: result.state_code,\n locality: result.city,\n postalcode: result.postal_code,\n address: result.address\n }\n else\n {}\n end\n end",
"def geolocation\n response = HTTParty.post(\"https://www.googleapis.com/geolocation/v1/geolocate?key=#{ENV['GEO_API_KEY']}\")\n end",
"def geocoding_api_lookup\n location = self.address\n\n #result = Geocoder.search(location).first\n args = {postalcode: postcode, city: city, county: county, country: country, format: 'json'}\n result = nominatim_lookup(args)\n if result\n self.latitude = result[:lat]\n self.longitude = result[:lon]\n begin\n redis = Redis.new\n redis.set(location, [self.latitude, self.longitude].to_json)\n rescue Redis::RuntimeError => e\n raise e unless Rails.env.production?\n puts \"Redis error: #{e.message}\"\n end\n else\n self.update_column(:nominatim_count, self.nominatim_count + 1)\n end\n end",
"def getToolsGeocode( building_number, address1, address2, address3, district, town, county, province, postcode, country)\n params = Hash.new\n params['building_number'] = building_number\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['country'] = country\n return doCurl(\"get\",\"/tools/geocode\",params)\n end",
"def country_code\n Geocoder.search(hotel.city).first.country_code\n rescue Exception\n 'CZ'\n end",
"def geocode_address\n geo = Geokit::Geocoders::MultiGeocoder.geocode(self.address_string)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n puts geo.class\n errors.add(:address, \"Could not Geocode address\")\n end\n end",
"def getSearchString(searchString)\n return params[:search] if (params[:search].present?)\n \n @IP_ZipCode = request.location.postal_code\n return @IP_ZipCode if (@IP_ZipCode.present?)\n \n return \"63101\"\n end",
"def find_city(lat,lng)\n if Geocoder::Calculations.distance_between([lat,lng], [40.698390,-73.98843]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [40.76813,-73.96439]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76423,-122.47743]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76912,-122.42593]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.85887,2.30965]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.86068,2.36389]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [51.51,-0.13]) < 20\n \"london\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.57664,-46.69787]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.55838,-46.64362]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.64446,139.70695]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.70136,139.73991]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.06901,-118.35904]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.07499,-118.28763]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.02663,-118.45998]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [50.07832,14.41619]) < 20\n \"prague\"\n else\n \"unknown\"\n end\n end",
"def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end",
"def get(criteria={})\n\n geo_count = @geolocations.size\n i = 1\n\n begin\n\n geo = select\n raise Error.new(GEO_NOT_VALID, :values => {:country => criteria[:country], :protocol => criteria[:protocol]}) if (!criteria[:country].nil? and criteria[:country].downcase != geo.country.downcase) or\n (!criteria[:protocol].nil? and criteria[:protocol].downcase != geo.protocol.downcase)\n\n rescue Exception => e\n\n case e.code\n when NONE_GEOLOCATION\n @logger.an_event.error e.message\n raise e\n when GEO_NOT_VALID\n if i < geo_count\n i += 1\n @logger.an_event.warn e.message\n retry\n else\n @logger.an_event.error e.message\n raise Error.new(GEO_NONE_COMPLIANT)\n end\n end\n else\n #on sort de la boucle :\n # soit on a trouve une geo qui repond aux criteres passés si il y en a\n # soit parce que on les a passé tous les geo et il n'y a aucun geolocation qui satisfont les critères => exception\n @logger.an_event.info \"geolocation find : #{geo.to_s}\"\n return geo\n ensure\n\n end\n end",
"def geocode_address\n geo=Geokit::Geocoders::GoogleGeocoder.geocode(address)\n errors.add(:address, \"Could not Geocode address\") if !geo.success\n self.lat, self.lng = geo.lat,geo.lng if geo.success\n end",
"def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end",
"def convert_location(address)\n loc_query = Addressable::URI.new(\n :scheme => \"http\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => {:address => \"#{address}\",\n :sensor => \"false\"}\n )\n\n geolocation_json = RestClient.get(loc_query.to_s)\n location = JSON.parse(geolocation_json)\n\n latitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n longitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n [latitude, longitude]\n end",
"def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.com/customsearch/v1?cx=#{engine_id}&q=#{query}&key=#{key}\")\n\n # GET request\n request = Net::HTTP::Get.new(uri)\n\n # Receive response\n res = Net::HTTP.get_response(uri)\n\n # Parse JSON file and converts to hash\n json = JSON.parse(res.body)\n items = json['items']\n\n # Iterate through JSON/items array and print each index\n i = 0\n loop do\n puts (i+1).to_s + \" -- \" + items[i]['title']\n # puts items[i]['link'] # url\n # puts items[i]['snippet'] # snippet of article\n i += 1\n if i == items.length\n break\n end\n end\n end",
"def geo_search(options={})\n options[:query] = URI.escape(options[:query]) if options[:query]\n args = options.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get \"/geo/search.json?#{args}\"\n end",
"def find_poll_addr(message_addr)\n uri = URI.parse('https://www.googleapis.com/civicinfo/v2/voterinfo?address=' + \\\n message_addr + '&electionId=2000&key=' + ENV[\"GOOGLE_API_KEY\"])\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n res_hash = JSON.parse(response.body)\n address_hash = res_hash['pollingLocations'][0]['address']\n locationName = address_hash['locationName']\n line1 = address_hash['line1'] || \"\"\n line2 = address_hash['line2'] || \"\"\n line3 = address_hash['line3'] || \"\"\n return \"We found the closest polling location to you:\\n\" + locationName+line1+line2+line3 + \"\\n\"\n end",
"def get_location(place)\n\t\tsleep(1.5)\n\t\tlocation = Geocoder.search(place)\n\t\t#puts location.inspect\n\t\tif !location.empty?\n\t\t\tlocation_geometry = location.first.geometry\n\t\t\tlocation_bounds = location_geometry['bounds']\n\t\t\tif !location_bounds.nil?\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['bounds']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['bounds']['northeast']['lng'])\n\t\t\telse\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['viewport']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['viewport']['northeast']['lng'])\n\t\t\tend\n\t\t\tif !location.nil?\n\t\t\t\t@user_location_lat = rand(lat_range).round(7)\n\t\t\t\t@user_location_long = rand(long_range).round(7)\n\t\t\telse\n\t\t\t\t@user_location_lat = \"here\"\n\t\t\t\t@user_location_long = \"here\"\n\t\t\tend\n\t\telse\n\t\t\t@user_location_lat = \"no data\"\n\t\t\t@user_location_long = \"no data\"\n\t\tend\n\tend",
"def get_country(str)\n data = check_local_db(str)\n\n if data.nil? \n data = Geocoder.search(str)\n\n #has to parse through geocode data to find correct result\n data.first.address_components.each do |obj|\n data = obj[\"short_name\"] if obj[\"types\"][0] == \"country\"\n end\n\n save_to_db(str, data)\n end\n\n return data\n end",
"def search_with_geography(keywords, options = {})\n unless keywords.blank?\n # For backwards compatibility\n options[:count] ||= options[:rows] || 10\n \n parameters = {\n :start => options[:start] && options[:start].to_i || 0,\n :rows => options[:count] && options[:count].to_i > 0 && options[:count].to_i < 100 && options[:count].to_i || 10\n }\n \n parameters[:fq] = bounds_query(options[:bounds]) if options[:bounds].present?\n \n places = []\n facets = []\n \n results = PublicEarth::Db::Place.search_for keywords, parameters\n places = results.models\n \n # Tack on a possible map location, such as a city or country? Maybe the user was searching\n # to move the map, not look for places?\n where = nil\n unless options[:e]\n where = PublicEarth::Db::Where.am_i?(keywords, options[:bounds])\n where = nil if where.score.nil?\n end\n \n # A bold substitute for a rules engine! (There is a paper flowchart of this somewhere...)\n if options[:bounds]\n if places.blank?\n if where.present? \n [:reposition, where, nil, nil]\n else\n [:display, nil, nil, nil]\n end\n else\n if where.present?\n if where.score > 3.0\n [:prompt, where, results]\n else\n [:display, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n else\n if places.blank? && where.blank?\n [:display, nil, nil]\n else\n if where.present?\n if where.score > 0.4 && !options[:recursed]\n if where.score > 2.0\n k = keywords.downcase\n # Temporary stop terms...FIX!!!\n (\"in for from near by where around over under \" + where.name.downcase).split(/\\s+/).each do |word|\n k.gsub! /\\b#{word}\\b/, ''\n end\n options.merge!({ :bounds => where.bounds, :recursed => true })\n \n again = search_with_geography(k, options)\n if again[2].blank?\n [:reposition, where, nil, nil]\n else\n [:display, where, again.last]\n end\n else\n [:prompt, where, results]\n end\n else\n [:suggest, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n end\n else\n [:display, nil, nil, nil]\n end\n end",
"def viewMapByAddress(address, callback)\n puts \"viewMapByAddress(address:#{address}, callback:#{callback}\"\n\n url = \"http://maps.google.com/maps/api/geocode/json?\" +\n \"address=#{address}&\" +\n \"sensor=true\"\n #puts url\n\n res = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res.inspect\n\n if res[\"status\"] == \"ok\" # && res[\"body\"][\"status\"] == \"OK\"\n #puts res[\"body\"].inspect\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n to_lat = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n to_lng = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n else\n to_lat = '34.4893270'\n to_lng = '133.3614320'\n end\n\n viewMap address, to_lat, to_lng, callback\n end",
"def retrieve_location_from_cookie_or_service\n # return GeoLoc.new(YAML.load(cookies[:geo_location])) if cookies[:geo_location]\n return GeoLoc.new(JSON.parse(cookies[:geo_location])) if cookies[:geo_location]\n location = Geocoders::MultiGeocoder.geocode(get_ip_address)\n return location.success ? location : nil\n end",
"def geocode_address(address,\r\n country_code = nil,\r\n language_code = 'en',\r\n fuzzy_search = false)\r\n # Prepare query url.\r\n _path_url = '/geocode-address'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'output-case' => 'camel',\r\n 'address' => address,\r\n 'country-code' => country_code,\r\n 'language-code' => language_code,\r\n 'fuzzy-search' => fuzzy_search\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: _parameters\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n GeocodeAddressResponse.from_hash(decoded)\r\n end",
"def autocomplete(q:)\n return unless String(q).length > 1\n\n result = Geocoder.search(q, autocomplete: true)\n result&.data\n end",
"def geolocate(location)\n\t\tkey = \"f94d9fe40481b0a044edc8f729724335\"\n\t\tlocation = URI.escape(location, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n\t\t# location = CGI.escape(location)\n\t\t# location = URI.escape(location)\n\t\thost = \"ondemand.metacarta.com\"\n\t\tpath = \"/webservices/GeoTagger/JSON/basic?version=1.0.0\"\n\t\tpath = \"#{path}&doc=#{location}\"\n\t\tdata = {}\n\t\tbegin\n\t\t\treq = Net::HTTP::Get.new(path)\n\t\t\treq.basic_auth SITE_METACARTA_USERID, SITE_METACARTA_PASSWORD\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\t#if response.is_a?(Net::HTTPSuccess)\n\t\t\t\tresponse = http.request(req)\n\t\t\t\tdata = JSON.parse(response.body)\n\t\t\t#end\n\t\trescue Timeout::Error\n\t\t\t# DO SOMETHING WISER\n\t\t\treturn 0,0\n\t\trescue\n\t\t\treturn 0,0\n\t\tend\n\t\tbegin\n\t\t\tlat = data[\"Locations\"][0][\"Centroid\"][\"Latitude\"]\n\t\t\tlon = data[\"Locations\"][0][\"Centroid\"][\"Longitude\"]\n\t\t\treturn lat,lon\n\t\trescue\n\t\tend\n\t\treturn 0,0\n\tend",
"def getLookupLocation( string, language, country, latitude, longitude)\n params = Hash.new\n params['string'] = string\n params['language'] = language\n params['country'] = country\n params['latitude'] = latitude\n params['longitude'] = longitude\n return doCurl(\"get\",\"/lookup/location\",params)\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def search\n # The exercise says the HTML page has to show only if the address has coverage,\n # but I would show what type too\n\n address = Address.find_by_address(params[:address])\n\n if address.blank?\n status = :not_found\n ret = {\n status: :not_found,\n message: 'Address not found in the DB',\n has_coverage: nil\n }\n else\n status = :ok\n message = address.has_coverage? ? \"Coverage #{address.coverage_name}\" : 'No coverage'\n ret = {\n status: :ok,\n message: message,\n has_coverage: address.has_coverage?\n }\n end\n\n render json: ret, status: status\n end",
"def geo_code(params)\n if params\n geo_data = Geocoder.search(params[\"address\"]).first\n params[\"address\"] = geo_data.formatted_address\n params[\"lng\"] = geo_data.longitude\n params[\"lat\"] = geo_data.latitude\n params\n end\n end",
"def static_search(url, query)\n response = Faraday::Connection.new.get(url) do |request|\n request.headers = {\n user_agent: \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36\" }\n request.options.timeout = 5\n end\n\n status = response.status.to_i\n return nil unless status < 300\n\n formatted_content = ActionController::Base.helpers.strip_tags(response.body)\n formatted_content = formatted_content.squish.strip\n\n return formatted_content.scan(/.{#{InRailsWeBlog.settings.scrap_fragment_size}}\\b#{query}\\b.{#{InRailsWeBlog.settings.scrap_fragment_size}}/i)\n rescue StandardError\n return nil\n end",
"def search(q)\n url = Boundary.api_url(@auth)+'/search'\n results = Array.new\n results = Boundary.get(url+\"?q=#{q}\")\n return nil if results.empty? \n case results['header']['hits'].to_i\n when 0\n return nil\n else\n return results['entities']\n end\n end",
"def query(q, options={}, async = true)\n request(\"/Locations\", {:query => {:key => @key, :addressLine => q}.merge(options)}, async)\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def place_info(postcode)\n send_geo_request(postcode).data\n end",
"def get_text\n begin\n response = Weather.lookup_by_location(@city,@state)\n response.condition.text\n rescue\n return \"\"\n end\n end",
"def ice_cream_places(location, radius)\n places_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/place/nearbysearch/json\",\n :query_values => {:key => \"AIzaSyC3od3aEKzgeEb8H3_6b29HX3qHXWIB248\",\n :location => location,\n :radius => radius,\n :sensor => false,\n :keyword => \"ice cream\"}\n ).to_s\n\n response = JSON.parse(RestClient.get(places_url))[\"results\"]\n all_locations = {}\n response.each do |place|\n name = place[\"name\"]\n location = place[\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\n all_locations[name] = location_string\n end\n all_locations\nend"
] | [
"0.67880553",
"0.62291324",
"0.61813664",
"0.61546785",
"0.61384463",
"0.60846806",
"0.60348177",
"0.5982754",
"0.5905531",
"0.5866242",
"0.5860795",
"0.5851679",
"0.5843129",
"0.5811106",
"0.57623464",
"0.5759035",
"0.5704793",
"0.56904614",
"0.56820655",
"0.56671697",
"0.5637996",
"0.56358945",
"0.56252825",
"0.56178004",
"0.5614249",
"0.5575326",
"0.5540185",
"0.5535504",
"0.553168",
"0.5465731",
"0.5460909",
"0.5438541",
"0.54346865",
"0.54320306",
"0.54302907",
"0.54239386",
"0.54017615",
"0.54010445",
"0.53731155",
"0.5367156",
"0.5358649",
"0.5353347",
"0.5346182",
"0.5327114",
"0.5321451",
"0.53085464",
"0.5307161",
"0.5284256",
"0.52839094",
"0.52478945",
"0.5224699",
"0.52001655",
"0.51969",
"0.51866376",
"0.51840514",
"0.51797956",
"0.5179497",
"0.5139635",
"0.513842",
"0.512514",
"0.51185644",
"0.5116305",
"0.5100403",
"0.5099619",
"0.5093578",
"0.5093154",
"0.50786465",
"0.506759",
"0.5060655",
"0.5059549",
"0.50523925",
"0.50470674",
"0.50458163",
"0.50232345",
"0.500309",
"0.49822676",
"0.49819073",
"0.49716517",
"0.49643102",
"0.49572742",
"0.4950868",
"0.49500158",
"0.4928193",
"0.49268568",
"0.49258542",
"0.49258435",
"0.49214172",
"0.49187952",
"0.49090815",
"0.4898064",
"0.48931322",
"0.48846763",
"0.48820865",
"0.48813528",
"0.48700482",
"0.4867789",
"0.4863378",
"0.48519367",
"0.48516175",
"0.48498595",
"0.48457643"
] | 0.0 | -1 |
Returns a parsed Google geocoder search result (hash). This method is not intended for general use (prefer Geocoder.search). | def fetch_parsed_response(query, reverse = false)
if doc = fetch_raw_response(query, reverse)
ActiveSupport::JSON.decode(doc)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def optimistic_geo_wrapper(query)\n geocoded = nil\n result = ::Geocoder.search(query)\n puts result.inspect\n geocoded = result[0].data if result[0]\n geocoded\n end",
"def get_coords(address)\n file = open(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{URI.escape(address)}&key=AIzaSyARfm-3M5KppQjgGnHK1DIYt-GmG4eJqCI\")\n contents = file.read()\n hash = JSON.parse(contents)\n lat = hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_f\n lng = hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_f\n return [lat, lng]\nend",
"def search(search_string)\n GoogleAjax::Search.web(search_string)[:results]\n end",
"def find(address)\n # Geocode the given address.\n geocode address\n\n ward = Data.new(data)\n ward.to_hash\n end",
"def get_coordinates\n checked_google_response do\n return parsed_response if raw\n parsed_response[\"results\"].inject([]) do |memo, result|\n memo << { \n :lat => result[\"geometry\"][\"location\"][\"lat\"], \n :lng => result[\"geometry\"][\"location\"][\"lng\"],\n :matched_address => result[\"formatted_address\"],\n :bounds => result[\"geometry\"][\"bounds\"],\n :full_data => result\n }\n end\n end\n end",
"def fetch_raw_response(query, reverse = false)\n return nil if query.blank?\n\n # name parameter based on forward/reverse geocoding\n param = reverse ? :latlng : :address\n\n # build URL\n params = { param => query, :sensor => \"false\" }\n url = \"http://maps.google.com/maps/api/geocode/json?\" + params.to_query\n\n # query geocoder and make sure it responds quickly\n begin\n resp = nil\n timeout(3) do\n Net::HTTP.get_response(URI.parse(url)).body\n end\n rescue SocketError, TimeoutError\n return nil\n end\n end",
"def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend",
"def geocode(address)\r\n\t\r\n\t\turi = URI.encode(\"#{@@google_base_url}#{address}\")\r\n\t\turl = URI.parse(uri)\r\n\t\thttp = Net::HTTP.new(url.host, url.port)\r\n\t\trequest = Net::HTTP::Get.new(url.request_uri)\r\n\t\tresponse = http.request(request)\t\r\n\t\t# throws exception\r\n\t\traise \"Bad response, code #{response.code}\" if response.code != \"200\"\r\n\t\t\r\n\t\t# result returned from Google Geocoding API\r\n\t\tresult = response.body\r\n\t\tjson_parsed = JSON.parse(result)\r\n\t\t\r\n\t\treturn json_parsed\r\n\tend",
"def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def search_results\n GoogleSearchResults.instance\n end",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def results\n @results ||= perform_reverse_geocode\n end",
"def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end",
"def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n return ret\nend",
"def getGoogleGeoByAddress(street, csz)\r\n address_str = [street, csz].join(\" \")\r\n base_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{address_str}&key=#{GOOGLE_TOKEN}\"\r\n\r\n # Get the response\r\n uri = URI.parse(URI.escape(base_url))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n # ERROR CATCH\r\n return nil if json_result[\"status\"] == \"INVALID REQUEST\"\r\n\r\n place_results = json_result[\"results\"][0]\r\n\r\n # Define place id\r\n place_id = place_results[\"place_id\"]\r\n\r\n # Collect unit number (if applicable)\r\n address_components = json_result[\"results\"][0][\"address_components\"]\r\n address_components.each { |c| place_id += \"+#{c[\"long_name\"]}\" if c[\"types\"][0] == \"subpremise\" }\r\n\r\n geo_data = {:placeId => place_id,\r\n :lat => place_results[\"geometry\"][\"location\"][\"lat\"],\r\n :lon => place_results[\"geometry\"][\"location\"][\"lng\"],\r\n :format_add => place_results[\"formatted_address\"]}\r\n\r\n return geo_data\r\n end",
"def geographic_search\n @geographic_search ||= begin\n result = sw_geographic_search\n\n # TODO: this should go into stanford-mods ... but then we have to set that gem up with a Logger\n # print a message for any unrecognized encodings\n xvals = subject.geographicCode.translated_value\n codes = term_values([:subject, :geographicCode])\n if codes && codes.size > xvals.size\n subject.geographicCode.each { |n|\n next unless n.authority != 'marcgac' && n.authority != 'marccountry'\n\n sw_logger.info(\"#{druid} has subject geographicCode element with untranslated encoding (#{n.authority}): #{n.to_xml}\")\n }\n end\n\n # FIXME: stanford-mods should be returning [], not nil ...\n return nil if !result || result.empty?\n\n result\n end\n end",
"def hash\n address.hash\n end",
"def query_address2latlng(query_address)\n\t\tla_clave_esa = \"AIzaSyBtlkF4i2Mmv33\" + \"uVc4aVTA5JT94-eEnRTo\"\n\t\tgeocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+query_address+\"&key=\" + la_clave_esa\n\t\tgeocode_uri = URI.parse(geocode_url)\n\t\tgeocode_response = Net::HTTP.get_response(geocode_uri)\n\t\tgeocode_hash = JSON.parse geocode_response.body\n\t\t#pp geocode_hash\n\t\tlat = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\tlng = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\treturn lat.to_s + \",\" + lng.to_s\n\tend",
"def autocomplete(q:)\n return unless String(q).length > 1\n\n result = Geocoder.search(q, autocomplete: true)\n result&.data\n end",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def gromweb_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n res = @http.get(\"http://md5.gromweb.com/query/#{hash_to_find}\")\n if not res[0].nil? and res[0].strip.chomp != ''\n if verbose\n print_good(\"Match Found: md5.gromweb.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{res[0].strip.chomp}\".white\n end\n return res[0]\n else\n print_error(\"No Results from: md5.gromweb.com\") if verbose\n return nil\n end\n else\n print_error(\"#{@hash_type} not supported for: md5.gromweb.com\") if verbose\n return nil\n end\n end",
"def search_results search\n search = normalize search\n @searches[search.to_s]\n end",
"def parse_results(res)\n j = JSON.parse(res.body)\n\n if j['error']\n message = j['error']['errors'].first['message']\n reason = j['error']['errors'].first['reason']\n fail GoogleClientException, \"Google Search failed. #{message} (#{reason})\"\n end\n\n j\n end",
"def optimistic_geo_wrapper(query)\n Lita.logger.debug 'Optimistically geo wrapping!'\n geocoded = nil\n result = ::Geocoder.search(query)\n Lita.logger.debug \"Geocoder result: '#{result.inspect}'\"\n if result[0]\n geocoded = result[0].data\n end\n geocoded\n end",
"def parse_search; end",
"def get_address_coordinates(street, city)\n # puts \"got in get_location_coordinates\"\n # puts \"inside get_coordinates #{street}\"\n # puts \"inside get_coordinates #{city}\"\n\n coordinate_results = Geocoder.search(\"#{street}, #{city}\")\n\n # puts \"the results are #{coordinate_results}\"\n coordinate_results_lat = coordinate_results[0].data[\"geometry\"][\"location\"][\"lat\"]\n coordinate_results_lng = coordinate_results[0].data[\"geometry\"][\"location\"][\"lng\"]\n # puts \"final coordinates are #{coordinate_results_lat}, #{coordinate_results_lng}\"\n # return_result = \"\\\"#{coordinate_results_lat}, #{coordinate_results_lng}\\\"\"\n return coordinate_results_lat, coordinate_results_lng\n #binding.pry\nend",
"def parse_search(q)\n # TODO continue\n end",
"def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def search\n\n\t\t@search_loc = params[:search_loc] # address user searched for\n\t\t@search_lat = params[:search_lat] # the user's current location latitude. If the address searched for fails to give a new latitude, this is used instead\n\t\t@search_long = params[:search_long] # the user's current longitude - same use case as above\n\t\tif @search_loc != nil\n\t\t\taddress = @search_loc.gsub(/\\s/, \"+\")\n\t\t\turi = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?address=\" + address + \"&sensor=false\")\n\t\t\thttp = Net::HTTP.get_response(uri)\n\t\t\tresults = JSON.parse(http.body)\n\t\t\t# if address yielded results, override the user's current location coordinates with the searched-for-latitude/longitude\n\t\t\tif results[\"status\"] != \"ZERO_RESULTS\"\n\t\t\t\t@search_lat = results[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\t\t\t@search_long = results[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\t\tend\n\t\tend\n\n\t\t@search_item = \"\"\n\t\tif params[:search_item] then\n\t\t\t@search_item = params[:search_item]\n\t\tend\n\t\t@search_item.downcase\n\n\t\t# the default search distance (max circular radius of a restaurant from the searched for location) is 5 unless the user specified a search radius\n\t\t@search_distance = DEFAULT_SEARCH_DISTANCE\n\t\tif params[:search_distance] then\n\t\t\t@search_distance = params[:search_distance]\n\t\tend\n\n\t\t@max_results = DEFAULT_MAX_RESULTS\n\t\tif params[:results] then\n\t\t\t@max_results = params[:results].to_i\n\t\tend\n\n\t\t# Based on the Haversine Formula found on google maps API. The below is a Sql query to find all restaurants that has dishes with a dish name containing the search query or a dish description containing the search query,\n\t\t# (independent of case), or the restaurant name or description contains the search query, and the restaurant must be within the circular search\n\t\t# radius of the searched for location.\n\t\t@restaurants = Restaurant.find_by_sql([\"SELECT DISTINCT restaurants.* from foods, restaurants WHERE\n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id LIMIT ?\", @search_lat, @search_long, @search_lat, @search_distance, \"%#{@search_item}%\", \n\t\t\t\"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t# All of the dishes returned below are ordered by average rating from highest to lowest.\n\t\t# Similar to the above query, but returns the dishes that are within restaurants within the given distance radius that has a dish name or description\n\t\t# with the search query, or its restaurant name / description has the search query.\n\t\t@dishes = Food.find_by_sql([\"SELECT DISTINCT foods.* from foods, restaurants WHERE \n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id ORDER BY foods.rating DESC NULLS LAST OFFSET 2 LIMIT ?\", @search_lat, @search_long, @search_lat, \n\t\t\t@search_distance, \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t@num_items_per_row = DEFAULT_NUM_ITEMS_PER_ROW\n\t\t@num_rows_per_page = DEFAULT_NUM_ROWS_PER_PAGE\n\t\tif params[:itemspr] then\n\t\t\t@num_items_per_row = params[:itemspr].to_i\n\t\tend\n\t\tif params[:rowspp] then\n\t\t\t@num_rows_per_page = params[:rowspp].to_i\n\t\tend\n\n\t\t@render = 'default'\n\t\tif params[:render] then\n\t\t\t@render = params[:render]\n\t\tend\n\n\t\tif @render == 'json_only' then\n\t\t\trender :json => {:restaurants => @restaurants, :dishes => @dishes}\n\t\telsif @render == 'partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'partials_and_json_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => true, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'dish_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'dishes_only', :render_restaurants => false, :results => 'dishes',\n\t\t\t\t:dishes => @dishes, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'restaurant_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'restaurants_only', :results => 'restaurants',\n\t\t\t\t:restaurants => @restaurants, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\tend\n\t\t# else search.html.erb (the default) will be rendered\n\n\tend",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def geolookup(query)\n get_json(\"#{api_url}/geolookup/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def my_search(input, latitude, longitude)\r\n\tyelp = yelp_search(input, latitude, longitude)\r\n\t\r\n\treturn '\"error\"' if yelp.nil? || yelp['error']\r\n\t\r\n\tresults = yelp['businesses'].map do |business|\r\n\t\t{\r\n\t\t\tname: business['name'],\r\n\t\t\tid: business['id'],\r\n\t\t\turl: business['url'],\r\n\t\t\trating: business['rating'],\r\n\t\t\tprice: business['price'],\r\n\t\t\tdistance: business['distance'],\r\n\t\t\tlatitude: business['coordinates']['latitude'],\r\n\t\t\tlongitude: business['coordinates']['longitude']\r\n\t\t}\r\n\tend\r\n\t\r\n\tJSON.generate(results)\r\nend",
"def get_place_info(keyword)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_TEXTSEARCH)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n query: keyword,\n key: google_places_api_key\n })\n p uri.query\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end",
"def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end",
"def geocode!(instance)\n result = coordinates(instance).first\n if result\n {\n lat: result.latitude,\n lon: result.longitude,\n region: result.state_code,\n locality: result.city,\n postalcode: result.postal_code,\n address: result.address\n }\n else\n {}\n end\n end",
"def getSearchString(searchString)\n return params[:search] if (params[:search].present?)\n \n @IP_ZipCode = request.location.postal_code\n return @IP_ZipCode if (@IP_ZipCode.present?)\n \n return \"63101\"\n end",
"def google(m, query)\n m.reply(search(query))\n end",
"def geoCode(postal)\n\turl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + postal + \"&key=AIzaSyBZqs-MS-5WyI9s-eS2Bx3wEemC5gzlhqc\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tgeoInfo = JSON.parse(response)\n\treturn geoInfo\nend",
"def search\n\n \tparser = AddressParser.new\n \taddress_hash = {}\n \t\n \tunless params[:location].nil?\n\t \tif is_number?(params[:location]) then \n\t \t\t# zip code\n\t\t \taddress_hash = parser.zip.parse(params[:location])\n\t\telsif params[:location].length == 2 then\n\t\t\t# state only\n\t\t\tparams[:location] = params[:location].strip.upcase\n\t\t\taddress_hash = parser.state.parse(params[:location])\n\t\telse\n\t\t\t# city, state, zip\n\t\t\tbegin address_hash = parser.csz.parse(params[:location])\n\t\t\t\trescue\n\t\t\t\t# city\n\t\t\t \taddress_hash = parser.city1.parse(params[:location]) unless params[:location].nil?\n\t\t\tend \n\t\tend\n\tend\n\t\n\t# new hash for search keys\n\tskeys = {}\n\t\n\tif address_hash[:city] then \n\t\tskeys[\"CIT\"] = /#{address_hash[:city]}/i\n\t\tparams['city'] = address_hash[:city]\n\tend\n\tif address_hash[:city1] then \n\t\tskeys[\"CIT\"] = /#{address_hash[:city1]}/i\n\t\tparams['city'] = address_hash[:city]\n\tend\n \tif address_hash[:state] then \n \t\tskeys[\"STATE\"] = \"#{address_hash[:state]}\" \n \t\tparams['state'] = address_hash[:state]\n \tend\n \tif address_hash[:zip] then \n \t\tskeys[\"ZP\"] = address_hash[:zip].to_s \n \t\t#params['zip'] = CGI::escape(address_hash[:zip])\n \t\tparams['zip'] = address_hash[:zip]\n \tend\n \t\n \tif(params.has_key?('bathrooms') ) then\n \t\tskeys[\"BTH\"] = \"#{params[:bathrooms].to_f}\"\n \tend\n \t\n \tif(params.has_key?('bedrooms') ) then\n \t\tskeys[\"BR\"] = params[:bedrooms].to_i\n \tend\n\n \tif(params.has_key?('minyear') ) then\n \t\tskeys[\"BLT-MIN\"] = params[:minyear].to_i\n \tend\n \t\n \tif(params.has_key?('maxyear') ) then\n \t\tskeys[\"BLT-MAX\"] = params[:minyear].to_i\n \tend\n \t\n \tif(params.has_key?('price_low') ) then\n \t\tskeys[\"LP-MIN\"] = params[:price_low].to_i\n \tend\n \t\n \tif(params.has_key?('price_high') ) then\n \t\tskeys[\"LP-MAX\"] = params[:price_high].to_i\n \tend\n \t\n \tif(params.has_key?('zipcode') ) then\n \t\tskeys[\"ZP\"] = params[:zipcode]\n \tend\n\t\n\tquery = {}\n\n\tskeys.each do |key, value|\n\t\tcase key\n\t\t\t when 'BTH'\n\t\t\t query.merge!({ key.to_sym.gte => value.to_f })\n\t\t\t when 'BR'\n\t\t\t query.merge!({ key.to_sym.gte => value.to_i })\n\t\t\t when 'BLT-MIN'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'BLT'.to_sym.gte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'BLT-MAX'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'BLT'.to_sym.lte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'LP-MIN'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'LP'.to_sym.gte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'LP-MAX'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'LP'.to_sym.lte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'ZP'\n\t\t\t \tif value != \"\" then\n\t\t\t \t\tquery.merge!({ 'ZP'.to_sym => value })\n\t\t\t \tend\n\t\t\t when 'CIT', 'STATE', 'ZP'\n\t\t\t query.merge!({ key.to_sym => value })\n\t\t end\n\tend\n\t\t\n \t@listings = Listing.where( query ).paginate({\n\t\t :sort => :LP.desc,\n\t\t :per_page => 10, \n\t\t :page => params[:page],\n\t\t})\n \t\n \trender :template => 'find/search', :collection => @listings\n \t \t\n end",
"def search(search_options={})\n result = jambase_search(search_options)\n return convert(result.body) unless result.blank?\n end",
"def geocode(address)\n result = Geocoder.search(address).first\n #result.latitude - float\n #result.longitude - float\n #result.coordinates - array of the above two\n #result.address - string\n #result.city - string\n #result.state - string\n #result.state_code - string\n #result.postal_code - string\n #result.country - string\n #result.country_code - string\n if result\n self.lat = result.latitude\n self.lng = result.longitude\n return true\n else\n return nil\n end\n end",
"def get_address\n welcome_message\n puts \"What is your location?\"\n user_location = Geocoder.search(gets.chomp)[0]\n if user_location != nil\n adr = user_location\n @city = adr.city\n @lat = adr.latitude\n @lon = adr.longitude\n else\n no_match\n end\n end",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def geocode!\n result = GeoKit::Geocoders::YahooGeocoder.geocode \"#{@street}, #{@city}, #{@state} #{@zip}\"\n if result.success?\n @street = result.street_address\n @city = result.city\n @state = result.state\n @zip = result.zip\n @country = result.country_code\n @lat = result.lat\n @lng = result.lng\n @status = STATUS_GEOCODED\n else\n @status = STATUS_GEOCODE_ERROR\n end\n end",
"def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def search\n response = make_request\n begin\n response_hash = JSON.parse(response.body)\n rescue JSON::ParserError\n raise RequestException\n else\n response_hash\n end\n end",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end",
"def where_local(query)\n begin\n url = URI.parse GOOGLE_LOCAL_URI\n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(LOCAL_QUERY_STRING + CGI.escape(query))\n end\n\n results = JSON.parse(response.body)['responseData']['results']\n \n unless results.blank?\n results.map do |result|\n result['staticMapUrl'] =~ /zl=(\\d+)/\n {\n :name => result['titleNoFormatting'],\n :city => result['city'],\n :region => result['region'],\n :country => result['country'],\n :address => result['streetAddress'],\n :postal_code => result['postalCode'],\n :latitude => result['lat'].to_f,\n :longitude => result['lng'].to_f,\n :zoom => $1.to_i\n }\n end\n else\n []\n end\n rescue\n []\n end\n end",
"def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend",
"def hash\n return unless doc_value?\n result['doc']['hash']\n end",
"def result\n return @result if defined?(@result)\n @search.populate_hits\n @result\n end",
"def hash_for_search\n return addresses.each.inject([]) do |memo, a|\n memo.push({\n search_customer: \"#{last_name} #{first_name} #{primary_phone} #{a.format_for_search}\",\n label: \"#{last_name}, #{first_name} #{number_to_phone(primary_phone)} #{a.label}\",\n customer_id: id,\n address_id: a.id\n })\n end\n end",
"def search(options = {})\n search_options = {}\n search_options[:query] = options[:query] || ''\n search_options[:maxResults] = options[:per_page] || 500\n search_options[:fromDate] = Gnip.format_date(options[:date_from]) if options[:date_from]\n search_options[:toDate] = Gnip.format_date(options[:date_to]) if options[:date_to]\n search_options[:next] = options[:next_cursor] if options[:next_cursor]\n url = [search_url, search_options.to_query].join('?')\n begin\n gnip_call = self.class.get(url, basic_auth: @auth)\n response = gnip_call.response\n parsed_response = gnip_call.parsed_response\n parsed_response = (parsed_response || {}).with_indifferent_access\n raise response.message unless parsed_response.present?\n\n if parsed_response[:error].present?\n response = { results: [],\n next: nil,\n url: url,\n error: parsed_response[:error][:message],\n code: response.code.to_i }\n else\n response = { results: parsed_response[:results],\n url: url,\n next: parsed_response[:next],\n code: response.code.to_i }\n end\n rescue StandardError => e\n response = { results: [],\n url: url,\n next: nil,\n error: e.message,\n code: 500 }\n end\n response\n end",
"def get_lat_long_of_current(address)\n\n a = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => { :address => address,\n :sensor => \"false\"}\n )\n response = RestClient.get(a.to_s)\n\n response_json = JSON.parse(response)\n lat = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n long = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n [lat, long]\nend",
"def search_body\n process_input unless processed?\n Search::Pseuds::Query.new(attributes).to_hash\n end",
"def search(start_lat, start_long, end_lat, end_long, radius, term)\n latitude=start_lat\n longitude=start_long\n puts latitude\n puts end_lat\n # place = []\n # address= []\n places_hash={\n \n }\n while ((latitude-end_lat).abs>0.05) do \n puts \"------------------------------------------\"\n # latitude=((start_lat)..(end_lat)).step(0.001).to_a\n # longitude=((start_long)..(end_long)).step(0.001).to_a\n # s=start_long\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n\n params = {\n # categories: term,\n term: term,\n latitude: latitude,\n longitude: longitude,\n radius: radius\n \n # limit: SEARCH_LIMIT\n }\n\n response = HTTP.auth(bearer_token).get(url, params: params)\n\n \n puts result=response.parse\n if result[\"businesses\"]!=nil\n result[\"businesses\"].each do |place|\n #need to change each loop\n places_hash[place[\"name\"]]=place[\"location\"][\"address1\"]\n end\n end\n \n puts latitude\n puts end_lat\n latitude=(latitude+(end_lat-start_lat)/5.0)\n longitude=(longitude+(end_long-start_long)/5.0)\n end\n puts places_hash\n return places_hash\nend",
"def geo_search(options={})\n options[:query] = URI.escape(options[:query]) if options[:query]\n args = options.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get \"/geo/search.json?#{args}\"\n end",
"def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.com/customsearch/v1?cx=#{engine_id}&q=#{query}&key=#{key}\")\n\n # GET request\n request = Net::HTTP::Get.new(uri)\n\n # Receive response\n res = Net::HTTP.get_response(uri)\n\n # Parse JSON file and converts to hash\n json = JSON.parse(res.body)\n items = json['items']\n\n # Iterate through JSON/items array and print each index\n i = 0\n loop do\n puts (i+1).to_s + \" -- \" + items[i]['title']\n # puts items[i]['link'] # url\n # puts items[i]['snippet'] # snippet of article\n i += 1\n if i == items.length\n break\n end\n end\n end",
"def google_image_search(query)\n google_results = JSON.parse(open(\"http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=#{query}\").read)\n google_results['responseData']['results'][rand(8).floor]['unescapedUrl']\n end",
"def parse_response(result) #:nodoc:\n #return result\n addr = result[\"address\"]\n puts addr[\"postcode\"]\n Location.new(\n :postal_code => addr[\"postcode\"],\n :region => addr[\"state\"],\n :country => addr[\"country_code\"]\n )\n end",
"def search\n if params[:key] == AUTHORIZATION_TOKEN && params[:q] == \"discover\"\n @google_places = discover\n @places = PLACES.select do |place|\n (place[:coordinates][:latitude].between?(average_location - 0.01, average_location + 0.01))\n end\n elsif params[:key] == AUTHORIZATION_TOKEN && params[:q]\n params_hash = {\n q: params[:q],\n type: params[:type] || \"bar\"\n }\n @google_places = call(params_hash)\n @places = PLACES.select do |place|\n (place[:name].downcase.include? (params[:q].downcase)) || (place[:coordinates][:latitude].between?(average_location - 0.01, average_location + 0.01))\n end\n\n render_error(\"empty\") if @google_places.empty? && @places.empty?\n elsif params[:q]\n render_error\n else\n render_error(\"missing_params\")\n end\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def search_get_url(user_input)\n fetch_json_from_url(GOOGLE_API_SEARCH_URL + user_input.to_s)\n end",
"def search(q)\n url = Boundary.api_url(@auth)+'/search'\n results = Array.new\n results = Boundary.get(url+\"?q=#{q}\")\n return nil if results.empty? \n case results['header']['hits'].to_i\n when 0\n return nil\n else\n return results['entities']\n end\n end",
"def call(params_hash)\n url = \"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{params_hash[:q]}&type=#{params_hash[:type]}&key=#{API_KEY}\"\n fetch(url)\n end",
"def get_search_result(url)\n c = Curl::Easy.new(url)\n c.userpwd = BIBLE_KEY + ':X'\n c.perform\n return c.body_str\nend",
"def get_search_result(url)\n c = Curl::Easy.new(url)\n c.userpwd = BIBLE_KEY + ':X'\n c.perform\n return c.body_str\nend",
"def address_result\n params['AddressResult']\n end",
"def geocode_of_site(url)\n get_geo_info(url)['results'][0]['geometry']['location']\n end",
"def geographic_facet\n geographic_search.map { |val| val.sub(/[\\\\,;]$/, '').strip } if geographic_search\n end",
"def map_result(result)\n loc = result.dig('geometry', 'location') || {}\n geometry = Geoloco::Geometry.new(lat: loc['lat'], lng: loc['lng'])\n\n Geoloco::Location.new(\n geometry: geometry,\n full_address: result.dig('formatted_address'),\n street: get_component(result, 'route'),\n city: get_component(result, 'locality'),\n district: get_component(result, 'administrative_area_level_2'),\n municipality: get_component(result, 'administrative_area_level_3'),\n number: get_component(result, 'street_number'),\n state: get_component(result, 'administrative_area_level_1'),\n state_code: get_component(result, 'administrative_area_level_1', 'short_name'),\n zipcode: get_component(result, 'postal_code'),\n country: get_component(result, 'country'),\n country_code: get_component(result, 'country', 'short_name')\n )\n end",
"def test_geocoders(address, threshold)\n locations = multi_geocode_address(address)\n # Assume that Google gets it right!\n authoritative_location = locations['google']\n if !authoritative_location\n if $verbose then $stderr.puts \"Google couldn't geocode '#{address}'\" end\n end\n result = {}\n locations.each do |name, location|\n if !authoritative_location or !location\n distance = nil\n passed = false\n else\n distance = distance_from_lat_lon(location, authoritative_location)\n passed = (distance < threshold)\n end\n result[name] = { 'passed' => passed, 'distance' => distance, 'location' => location }\n end\n result\nend",
"def extract_coordinates(parsed)\n parsed['results'].first['geometry']['location']\nend",
"def search_query(query, field='all')\n json_result = cache(query) do\n api = API_URI\n api_call = Net::HTTP.new(api.host)\n \n params = \"?search_query=#{field}:#{query}&start=#{@start_results}\"\n params += \"&max_results=#{@num_results}\"\n\n response = api_call.get2(api.path + params, { 'Referer' => @referer })\n return nil if response.class.superclass == Net::HTTPServerError\n\n _generate_result(response.body)\n end\n JSON.parse(json_result)\n end",
"def geocoding\n @geocoding ||= Geocoding::Gateway.new(client)\n end",
"def address(latitude, longitude)\n return nil if latitude.blank? || longitude.blank?\n return nil unless doc = search(\"#{latitude},#{longitude}\", true)\n # blindly use first result (assume it is most accurate)\n doc['results'].first['formatted_address']\n end",
"def get_place(query)\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query=#{query}\")\n\n response_hash = access_api(url)\n if response_hash == nil || response_hash[\"Places\"] == nil || response_hash[\"Places\"][0] == nil\n return nil\n end\n response_hash[\"Places\"][0][\"PlaceId\"]\nend",
"def parse_response(result) #:nodoc:\n addr = result.addresses.first\n Location.new(\n :latitude => addr.latitude,\n :longitude => addr.longitude,\n :street => addr.street,\n :locality => addr.locality,\n :region => addr.region,\n :postal_code => addr.postal_code,\n :country => addr.country,\n :precision => addr.precision\n )\n end",
"def googleSearch(q, n = 5)\n\n\tsearch = Google::Search::Web.new do |search|\n\t search.query = q\n\t search.size = :small\n\tend\n\tbegin\n\t\turis = search.first(n).map(&:uri)\n\trescue\n\t\t\"uri fault\"\n\tend\n\n\treturn uris\nend",
"def convert_location(address)\n loc_query = Addressable::URI.new(\n :scheme => \"http\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => {:address => \"#{address}\",\n :sensor => \"false\"}\n )\n\n geolocation_json = RestClient.get(loc_query.to_s)\n location = JSON.parse(geolocation_json)\n\n latitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n longitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n [latitude, longitude]\n end",
"def hashtags\n result_hash['hashtag']\n end",
"def to_h\n address_hash\n end",
"def show\n search_url = \"https://seeiendom.kartverket.no/api/soekEtterEiendom?searchstring=#{CGI.escape(@address_search.search_string)}\"\n @search_result_json = HTTParty.get(search_url)\n end",
"def static_search(url, query)\n response = Faraday::Connection.new.get(url) do |request|\n request.headers = {\n user_agent: \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36\" }\n request.options.timeout = 5\n end\n\n status = response.status.to_i\n return nil unless status < 300\n\n formatted_content = ActionController::Base.helpers.strip_tags(response.body)\n formatted_content = formatted_content.squish.strip\n\n return formatted_content.scan(/.{#{InRailsWeBlog.settings.scrap_fragment_size}}\\b#{query}\\b.{#{InRailsWeBlog.settings.scrap_fragment_size}}/i)\n rescue StandardError\n return nil\n end",
"def check_for_results\n if @names[0] == \"You can also try results from Google...\"\n return {\n beer_1: {\n name: \"Sorry no results found on BA\",\n brewery: \"\",\n style: \"\",\n url: \"\"\n }\n }\n end\n create_result_hash\n end",
"def get_search_results(address,citystatezip)\n url_s=@@zillow_webservice_url+'GetSearchResults.htm?zws-id='+@zwsid+'&address='+address.to_s+'&citystatezip='+citystatezip.to_s\n fetch_result(url_s)\n end",
"def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end",
"def retrieve_bing_result_stats bing, query\n\t\tstats = (bing/\"span[@id='count']\").inner_text\n\t\ttotal = stats.split.fifth\n\t\t\"Search for #{query} returned #{total} results\"\n\tend",
"def initialize(url, options)\n @results = []\n @suggestions = []\n @synonyms = []\n @keymatches = []\n \n # ask the google mini for search results\n response = Search.get(url)\n puts response.inspect\n # results\n if response['GSP'].has_key?('RES')\n if response['GSP']['RES']['R'].kind_of?(Array)\n response['GSP']['RES']['R'].map{ |res| @results << Result.new(res) }\n else\n @results << Result.new(response['GSP']['RES']['R'])\n end\n end\n \n # suggestions\n if response['GSP'].has_key?('Spelling')\n if response['GSP']['Spelling'].kind_of?(Array)\n response['GSP']['Spelling'].map{ |sp| sp.map{ |k, v| @suggestions << v } }\n else\n response['GSP']['Spelling'].map{ |k,v| @suggestions << v }\n end\n end\n \n # synonyms\n if response['GSP'].has_key?('Synonyms')\n if response['GSP']['Synonyms']['OneSynonym'].kind_of?(Array)\n response['GSP']['Synonyms']['OneSynonym'].map{ |synonym| @synonyms << synonym }\n else\n response['GSP']['Synonyms'].map{ |k,v| @synonyms << v }\n end\n end\n \n # keymatches\n if response['GSP'].has_key?('GM')\n if response['GSP']['GM'].kind_of?(Array)\n response['GSP']['GM'].each do |gm|\n @keymatches << Keymatch.new(gm)\n end\n else\n @keymatches << Keymatch.new(response['GSP']['GM'])\n end\n end\n \n end",
"def get_address(street_number:, street:, city:, state:, zip:)\n response = RestClient.get \"https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=#{street_number}+#{street}%2C+#{city}%2C+#{state}+#{zip}&benchmark=9&format=json\"\n json = JSON.parse(response.body)\n end",
"def response\n @response ||= begin\n Hashie::Mash.new(search.execute!)\n end\n end"
] | [
"0.64095515",
"0.62508875",
"0.62498516",
"0.61635286",
"0.5937185",
"0.58503747",
"0.58041644",
"0.5785488",
"0.57651937",
"0.5725596",
"0.56638944",
"0.56345713",
"0.5628236",
"0.5591629",
"0.5556601",
"0.55394506",
"0.5532531",
"0.55156344",
"0.551281",
"0.5501",
"0.5485107",
"0.54792976",
"0.54636663",
"0.54256874",
"0.5414674",
"0.5406028",
"0.5391805",
"0.537346",
"0.53633523",
"0.5360845",
"0.53608364",
"0.5354996",
"0.53525764",
"0.5335605",
"0.5329971",
"0.532911",
"0.52966124",
"0.52911204",
"0.5267585",
"0.52560866",
"0.5244718",
"0.52374655",
"0.5230931",
"0.5225998",
"0.5213581",
"0.52125275",
"0.5208188",
"0.52013785",
"0.5191598",
"0.518581",
"0.5179663",
"0.5161684",
"0.51543754",
"0.514027",
"0.5136842",
"0.5132967",
"0.51139313",
"0.51033634",
"0.51022303",
"0.51015544",
"0.5101397",
"0.5097114",
"0.5091948",
"0.5090272",
"0.50888145",
"0.5085033",
"0.5084612",
"0.5083142",
"0.50782883",
"0.5069749",
"0.5066351",
"0.5051454",
"0.5046084",
"0.5043504",
"0.5040329",
"0.5026981",
"0.5026981",
"0.5025254",
"0.50156903",
"0.5009926",
"0.5004377",
"0.5002299",
"0.49987748",
"0.49950948",
"0.49920914",
"0.49813673",
"0.49789155",
"0.49751",
"0.4972659",
"0.4970976",
"0.4970528",
"0.49689665",
"0.49684417",
"0.49528617",
"0.49469858",
"0.49150008",
"0.4914162",
"0.49136135",
"0.49099463",
"0.48941076",
"0.48885685"
] | 0.0 | -1 |
Returns a raw Google geocoder search result (JSON). This method is not intended for general use (prefer Geocoder.search). | def fetch_raw_response(query, reverse = false)
return nil if query.blank?
# name parameter based on forward/reverse geocoding
param = reverse ? :latlng : :address
# build URL
params = { param => query, :sensor => "false" }
url = "http://maps.google.com/maps/api/geocode/json?" + params.to_query
# query geocoder and make sure it responds quickly
begin
resp = nil
timeout(3) do
Net::HTTP.get_response(URI.parse(url)).body
end
rescue SocketError, TimeoutError
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end",
"def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend",
"def optimistic_geo_wrapper(query)\n geocoded = nil\n result = ::Geocoder.search(query)\n puts result.inspect\n geocoded = result[0].data if result[0]\n geocoded\n end",
"def geo_search(options={})\n options[:query] = URI.escape(options[:query]) if options[:query]\n args = options.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get \"/geo/search.json?#{args}\"\n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def my_search(input, latitude, longitude)\r\n\tyelp = yelp_search(input, latitude, longitude)\r\n\t\r\n\treturn '\"error\"' if yelp.nil? || yelp['error']\r\n\t\r\n\tresults = yelp['businesses'].map do |business|\r\n\t\t{\r\n\t\t\tname: business['name'],\r\n\t\t\tid: business['id'],\r\n\t\t\turl: business['url'],\r\n\t\t\trating: business['rating'],\r\n\t\t\tprice: business['price'],\r\n\t\t\tdistance: business['distance'],\r\n\t\t\tlatitude: business['coordinates']['latitude'],\r\n\t\t\tlongitude: business['coordinates']['longitude']\r\n\t\t}\r\n\tend\r\n\t\r\n\tJSON.generate(results)\r\nend",
"def geocode(address)\r\n\t\r\n\t\turi = URI.encode(\"#{@@google_base_url}#{address}\")\r\n\t\turl = URI.parse(uri)\r\n\t\thttp = Net::HTTP.new(url.host, url.port)\r\n\t\trequest = Net::HTTP::Get.new(url.request_uri)\r\n\t\tresponse = http.request(request)\t\r\n\t\t# throws exception\r\n\t\traise \"Bad response, code #{response.code}\" if response.code != \"200\"\r\n\t\t\r\n\t\t# result returned from Google Geocoding API\r\n\t\tresult = response.body\r\n\t\tjson_parsed = JSON.parse(result)\r\n\t\t\r\n\t\treturn json_parsed\r\n\tend",
"def results\n @results ||= perform_reverse_geocode\n end",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def search(search_string)\n GoogleAjax::Search.web(search_string)[:results]\n end",
"def search(search_options={})\n result = jambase_search(search_options)\n return convert(result.body) unless result.blank?\n end",
"def autocomplete(q:)\n return unless String(q).length > 1\n\n result = Geocoder.search(q, autocomplete: true)\n result&.data\n end",
"def mapsearch\n @search = Geocoder.coordinates(params[:place])\n #respond_to do |format|\n # format.html { render :layout => false }\n # format.js { render :layout => false }\n #end\n render json: @search\n #return @search\nend",
"def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end",
"def search\n @places = FoursquarePlace.places_near_coordinates(@coordinates, query: params[:search_terms])\n render json: { data: @places }\n end",
"def search\n\n @search = Location.near(params[:search], 15, :order => :distance)\n \n @query = params[:search]\n @locations = @search\n \n @filtros = ajustaFiltros\n @precios = precios(@locations)\n @campos = self.campos\n @places = places(@locations,@filtros)\n @facets = facetas(@locations, @filtros)\n @json = @locations.to_gmaps4rails\n end",
"def geocoder\n begin\n render(:json => open(\"#{GEOCODER_URL}&#{request.query_string}\"){|f| f.read})\n rescue SocketError\n render(:text => $!.to_s, :status => 500)\n end\n end",
"def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end",
"def search_results\n GoogleSearchResults.instance\n end",
"def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end",
"def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.com/customsearch/v1?cx=#{engine_id}&q=#{query}&key=#{key}\")\n\n # GET request\n request = Net::HTTP::Get.new(uri)\n\n # Receive response\n res = Net::HTTP.get_response(uri)\n\n # Parse JSON file and converts to hash\n json = JSON.parse(res.body)\n items = json['items']\n\n # Iterate through JSON/items array and print each index\n i = 0\n loop do\n puts (i+1).to_s + \" -- \" + items[i]['title']\n # puts items[i]['link'] # url\n # puts items[i]['snippet'] # snippet of article\n i += 1\n if i == items.length\n break\n end\n end\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def results\n begin\n self.to_json[\"SearchResponse\"][\"Web\"][\"Results\"].map do |result_hash|\n LiveAPI::Search::Result.new(result_hash)\n end\n rescue\n self.to_json[\"SearchResponse\"]\n end\n end",
"def show\n search_url = \"https://seeiendom.kartverket.no/api/soekEtterEiendom?searchstring=#{CGI.escape(@address_search.search_string)}\"\n @search_result_json = HTTParty.get(search_url)\n end",
"def get_coordinates\n checked_google_response do\n return parsed_response if raw\n parsed_response[\"results\"].inject([]) do |memo, result|\n memo << { \n :lat => result[\"geometry\"][\"location\"][\"lat\"], \n :lng => result[\"geometry\"][\"location\"][\"lng\"],\n :matched_address => result[\"formatted_address\"],\n :bounds => result[\"geometry\"][\"bounds\"],\n :full_data => result\n }\n end\n end\n end",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end",
"def google(m, query)\n m.reply(search(query))\n end",
"def search\n # Invoke Searchkick's search method with our search constraints.\n @results ||= search_model.search(@query, search_constraints)\n\n # Wrap the information as a hash and pass it to PropertiesController.\n {\n results: @results,\n formatted_query: formatted_query,\n json_for_map: json_for_map,\n center_lng_lat: center_lng_lat\n }\n end",
"def search(options = {})\n search_options = {}\n search_options[:query] = options[:query] || ''\n search_options[:maxResults] = options[:per_page] || 500\n search_options[:fromDate] = Gnip.format_date(options[:date_from]) if options[:date_from]\n search_options[:toDate] = Gnip.format_date(options[:date_to]) if options[:date_to]\n search_options[:next] = options[:next_cursor] if options[:next_cursor]\n url = [search_url, search_options.to_query].join('?')\n begin\n gnip_call = self.class.get(url, basic_auth: @auth)\n response = gnip_call.response\n parsed_response = gnip_call.parsed_response\n parsed_response = (parsed_response || {}).with_indifferent_access\n raise response.message unless parsed_response.present?\n\n if parsed_response[:error].present?\n response = { results: [],\n next: nil,\n url: url,\n error: parsed_response[:error][:message],\n code: response.code.to_i }\n else\n response = { results: parsed_response[:results],\n url: url,\n next: parsed_response[:next],\n code: response.code.to_i }\n end\n rescue StandardError => e\n response = { results: [],\n url: url,\n next: nil,\n error: e.message,\n code: 500 }\n end\n response\n end",
"def results\n # lat, lng, and term from user.js AJAX get request\n p params\n @lat = params[:lat]\n @long = params[:lng]\n term = params[:term]\n yelp_params = { term: term, limit: 5, sort: 1}\n coordinates = { latitude: @lat, longitude: @long }\n new_search = Yelp.client.search_by_coordinates(coordinates, yelp_params)\n # TODO - refactor into a separate function\n p new_search\n new_search.businesses.each do |business|\n \t result_name = business.name\n result_distance = business.distance\n \t result_address = business.location.address\n \t result_lat = business.location.coordinate.latitude\n \t result_long = business.location.coordinate.longitude\n \t # result_review = business.review_count\n \t # result_rating = business.rating\n end \n render json: new_search\n end",
"def getGoogleGeoByAddress(street, csz)\r\n address_str = [street, csz].join(\" \")\r\n base_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{address_str}&key=#{GOOGLE_TOKEN}\"\r\n\r\n # Get the response\r\n uri = URI.parse(URI.escape(base_url))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n # ERROR CATCH\r\n return nil if json_result[\"status\"] == \"INVALID REQUEST\"\r\n\r\n place_results = json_result[\"results\"][0]\r\n\r\n # Define place id\r\n place_id = place_results[\"place_id\"]\r\n\r\n # Collect unit number (if applicable)\r\n address_components = json_result[\"results\"][0][\"address_components\"]\r\n address_components.each { |c| place_id += \"+#{c[\"long_name\"]}\" if c[\"types\"][0] == \"subpremise\" }\r\n\r\n geo_data = {:placeId => place_id,\r\n :lat => place_results[\"geometry\"][\"location\"][\"lat\"],\r\n :lon => place_results[\"geometry\"][\"location\"][\"lng\"],\r\n :format_add => place_results[\"formatted_address\"]}\r\n\r\n return geo_data\r\n end",
"def search\n\n\t\t@search_loc = params[:search_loc] # address user searched for\n\t\t@search_lat = params[:search_lat] # the user's current location latitude. If the address searched for fails to give a new latitude, this is used instead\n\t\t@search_long = params[:search_long] # the user's current longitude - same use case as above\n\t\tif @search_loc != nil\n\t\t\taddress = @search_loc.gsub(/\\s/, \"+\")\n\t\t\turi = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?address=\" + address + \"&sensor=false\")\n\t\t\thttp = Net::HTTP.get_response(uri)\n\t\t\tresults = JSON.parse(http.body)\n\t\t\t# if address yielded results, override the user's current location coordinates with the searched-for-latitude/longitude\n\t\t\tif results[\"status\"] != \"ZERO_RESULTS\"\n\t\t\t\t@search_lat = results[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\t\t\t@search_long = results[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\t\tend\n\t\tend\n\n\t\t@search_item = \"\"\n\t\tif params[:search_item] then\n\t\t\t@search_item = params[:search_item]\n\t\tend\n\t\t@search_item.downcase\n\n\t\t# the default search distance (max circular radius of a restaurant from the searched for location) is 5 unless the user specified a search radius\n\t\t@search_distance = DEFAULT_SEARCH_DISTANCE\n\t\tif params[:search_distance] then\n\t\t\t@search_distance = params[:search_distance]\n\t\tend\n\n\t\t@max_results = DEFAULT_MAX_RESULTS\n\t\tif params[:results] then\n\t\t\t@max_results = params[:results].to_i\n\t\tend\n\n\t\t# Based on the Haversine Formula found on google maps API. The below is a Sql query to find all restaurants that has dishes with a dish name containing the search query or a dish description containing the search query,\n\t\t# (independent of case), or the restaurant name or description contains the search query, and the restaurant must be within the circular search\n\t\t# radius of the searched for location.\n\t\t@restaurants = Restaurant.find_by_sql([\"SELECT DISTINCT restaurants.* from foods, restaurants WHERE\n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id LIMIT ?\", @search_lat, @search_long, @search_lat, @search_distance, \"%#{@search_item}%\", \n\t\t\t\"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t# All of the dishes returned below are ordered by average rating from highest to lowest.\n\t\t# Similar to the above query, but returns the dishes that are within restaurants within the given distance radius that has a dish name or description\n\t\t# with the search query, or its restaurant name / description has the search query.\n\t\t@dishes = Food.find_by_sql([\"SELECT DISTINCT foods.* from foods, restaurants WHERE \n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id ORDER BY foods.rating DESC NULLS LAST OFFSET 2 LIMIT ?\", @search_lat, @search_long, @search_lat, \n\t\t\t@search_distance, \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t@num_items_per_row = DEFAULT_NUM_ITEMS_PER_ROW\n\t\t@num_rows_per_page = DEFAULT_NUM_ROWS_PER_PAGE\n\t\tif params[:itemspr] then\n\t\t\t@num_items_per_row = params[:itemspr].to_i\n\t\tend\n\t\tif params[:rowspp] then\n\t\t\t@num_rows_per_page = params[:rowspp].to_i\n\t\tend\n\n\t\t@render = 'default'\n\t\tif params[:render] then\n\t\t\t@render = params[:render]\n\t\tend\n\n\t\tif @render == 'json_only' then\n\t\t\trender :json => {:restaurants => @restaurants, :dishes => @dishes}\n\t\telsif @render == 'partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'partials_and_json_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => true, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'dish_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'dishes_only', :render_restaurants => false, :results => 'dishes',\n\t\t\t\t:dishes => @dishes, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'restaurant_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'restaurants_only', :results => 'restaurants',\n\t\t\t\t:restaurants => @restaurants, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\tend\n\t\t# else search.html.erb (the default) will be rendered\n\n\tend",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend",
"def geolookup(query)\n get_json(\"#{api_url}/geolookup/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def optimistic_geo_wrapper(query)\n Lita.logger.debug 'Optimistically geo wrapping!'\n geocoded = nil\n result = ::Geocoder.search(query)\n Lita.logger.debug \"Geocoder result: '#{result.inspect}'\"\n if result[0]\n geocoded = result[0].data\n end\n geocoded\n end",
"def geocoding\n @geocoding ||= Geocoding::Gateway.new(client)\n end",
"def search\n if params[:key] == AUTHORIZATION_TOKEN && params[:q] == \"discover\"\n @google_places = discover\n @places = PLACES.select do |place|\n (place[:coordinates][:latitude].between?(average_location - 0.01, average_location + 0.01))\n end\n elsif params[:key] == AUTHORIZATION_TOKEN && params[:q]\n params_hash = {\n q: params[:q],\n type: params[:type] || \"bar\"\n }\n @google_places = call(params_hash)\n @places = PLACES.select do |place|\n (place[:name].downcase.include? (params[:q].downcase)) || (place[:coordinates][:latitude].between?(average_location - 0.01, average_location + 0.01))\n end\n\n render_error(\"empty\") if @google_places.empty? && @places.empty?\n elsif params[:q]\n render_error\n else\n render_error(\"missing_params\")\n end\n end",
"def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end",
"def geoCode(postal)\n\turl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + postal + \"&key=AIzaSyBZqs-MS-5WyI9s-eS2Bx3wEemC5gzlhqc\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tgeoInfo = JSON.parse(response)\n\treturn geoInfo\nend",
"def search\n # The exercise says the HTML page has to show only if the address has coverage,\n # but I would show what type too\n\n address = Address.find_by_address(params[:address])\n\n if address.blank?\n status = :not_found\n ret = {\n status: :not_found,\n message: 'Address not found in the DB',\n has_coverage: nil\n }\n else\n status = :ok\n message = address.has_coverage? ? \"Coverage #{address.coverage_name}\" : 'No coverage'\n ret = {\n status: :ok,\n message: message,\n has_coverage: address.has_coverage?\n }\n end\n\n render json: ret, status: status\n end",
"def search(query_string, page = 1)\n oauth_response = access_token.get(\"/api/v1/search.json\", :search => query_string, :page => page)\n JSON.parse(oauth_response)\n end",
"def make_request(search_term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\")\n final_response = JSON.parse(response)\nend",
"def search\n Api.search_all_apis params[:postcode]\n end",
"def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end",
"def new\n json_string = open(\"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{URI.escape(params[\"search\"])}&sensor=false&key=AIzaSyAuc-paMz_ShQYipaLv-7hp7Lp5RCjIalI\") { |f| f.read }\n @pin = Pin.new\n @results = JSON.parse(json_string)[\"results\"].map do |elem|\n {\n name: elem[\"formatted_address\"],\n latitude: elem[\"geometry\"][\"location\"][\"lat\"],\n longitude: elem[\"geometry\"][\"location\"][\"lng\"]\n }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end",
"def raw_results\n results\n end",
"def geographic_search\n @geographic_search ||= begin\n result = sw_geographic_search\n\n # TODO: this should go into stanford-mods ... but then we have to set that gem up with a Logger\n # print a message for any unrecognized encodings\n xvals = subject.geographicCode.translated_value\n codes = term_values([:subject, :geographicCode])\n if codes && codes.size > xvals.size\n subject.geographicCode.each { |n|\n next unless n.authority != 'marcgac' && n.authority != 'marccountry'\n\n sw_logger.info(\"#{druid} has subject geographicCode element with untranslated encoding (#{n.authority}): #{n.to_xml}\")\n }\n end\n\n # FIXME: stanford-mods should be returning [], not nil ...\n return nil if !result || result.empty?\n\n result\n end\n end",
"def search(q)\n url = Boundary.api_url(@auth)+'/search'\n results = Array.new\n results = Boundary.get(url+\"?q=#{q}\")\n return nil if results.empty? \n case results['header']['hits'].to_i\n when 0\n return nil\n else\n return results['entities']\n end\n end",
"def search_query(query, field='all')\n json_result = cache(query) do\n api = API_URI\n api_call = Net::HTTP.new(api.host)\n \n params = \"?search_query=#{field}:#{query}&start=#{@start_results}\"\n params += \"&max_results=#{@num_results}\"\n\n response = api_call.get2(api.path + params, { 'Referer' => @referer })\n return nil if response.class.superclass == Net::HTTPServerError\n\n _generate_result(response.body)\n end\n JSON.parse(json_result)\n end",
"def search\n response = make_request\n begin\n response_hash = JSON.parse(response.body)\n rescue JSON::ParserError\n raise RequestException\n else\n response_hash\n end\n end",
"def search(q)\n url = build_query_url q\n begin\n raw_response = json(url)\n rescue JSON::ParserError\n Rails.logger.info \"Could not parse response as JSON. Request url: #{url}\"\n return []\n end\n parse_authority_response(raw_response)\n end",
"def search_get_url(user_input)\n fetch_json_from_url(GOOGLE_API_SEARCH_URL + user_input.to_s)\n end",
"def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end",
"def ice_cream_places(location, radius)\n places_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/place/nearbysearch/json\",\n :query_values => {:key => \"AIzaSyC3od3aEKzgeEb8H3_6b29HX3qHXWIB248\",\n :location => location,\n :radius => radius,\n :sensor => false,\n :keyword => \"ice cream\"}\n ).to_s\n\n response = JSON.parse(RestClient.get(places_url))[\"results\"]\n all_locations = {}\n response.each do |place|\n name = place[\"name\"]\n location = place[\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\n all_locations[name] = location_string\n end\n all_locations\nend",
"def call(params_hash)\n url = \"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{params_hash[:q]}&type=#{params_hash[:type]}&key=#{API_KEY}\"\n fetch(url)\n end",
"def show\n values_container = params['search'] ? params['search'] : params\n @find, @near, @coordinates, @page = values_container.values_at('find', 'near', 'coordinates', 'page')\n\n if @near.present?\n if @near.include?('Current Location')\n values_container['near'] = @near = nil # Monkey patch\n elsif ! @near.match(/chicago/i)\n values_container['near'] = (@near.to_s << ' Chicago')\n end\n end\n\n @results = LocationFilter.new(@near).values\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @results }\n end\n end",
"def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n return ret\nend",
"def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end",
"def query_wayback(query)\n url = \"http://web.archive.org/cdx/search/cdx?url=*.#{query}&output=json&fl=original&collapse=urlkey\"\n\n begin\n response = http_get_body(url)\n json = JSON.parse(response) # if nothing is parsed it returns an empty array\n rescue JSON::ParserError\n _log_error 'Unable to parse JSON response.'\n end\n\n json\n\n end",
"def search\n dogpark = Dogpark.near(\n params[:postcode] + ', NSW Australia',\n params[:radius] || 10,\n units: :km\n )\n\n #if not radius not specified, params radius returns nil\n #||Because we have 5, if the radius is empty, it will default to the 5 because of the logic of the || \"or\" expression. \"or\" will always evaluate to the truthy thing.\n render json: dogpark.to_json\n end",
"def where_local(query)\n begin\n url = URI.parse GOOGLE_LOCAL_URI\n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(LOCAL_QUERY_STRING + CGI.escape(query))\n end\n\n results = JSON.parse(response.body)['responseData']['results']\n \n unless results.blank?\n results.map do |result|\n result['staticMapUrl'] =~ /zl=(\\d+)/\n {\n :name => result['titleNoFormatting'],\n :city => result['city'],\n :region => result['region'],\n :country => result['country'],\n :address => result['streetAddress'],\n :postal_code => result['postalCode'],\n :latitude => result['lat'].to_f,\n :longitude => result['lng'].to_f,\n :zoom => $1.to_i\n }\n end\n else\n []\n end\n rescue\n []\n end\n end",
"def get_search_cep\r\n self.class.get(\"/13040089/json/\") \r\n end",
"def index\n @search = OriginAddr.search(params[:search])\n @origins = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: OriginAddr.where(\"name like '%#{params[:q]}%'\").paginate(:page => params[:page], :per_page => params[:page_limit]).order('id DESC') }\n end\n end",
"def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:filters].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:filters]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end",
"def get_address_coordinates(street, city)\n # puts \"got in get_location_coordinates\"\n # puts \"inside get_coordinates #{street}\"\n # puts \"inside get_coordinates #{city}\"\n\n coordinate_results = Geocoder.search(\"#{street}, #{city}\")\n\n # puts \"the results are #{coordinate_results}\"\n coordinate_results_lat = coordinate_results[0].data[\"geometry\"][\"location\"][\"lat\"]\n coordinate_results_lng = coordinate_results[0].data[\"geometry\"][\"location\"][\"lng\"]\n # puts \"final coordinates are #{coordinate_results_lat}, #{coordinate_results_lng}\"\n # return_result = \"\\\"#{coordinate_results_lat}, #{coordinate_results_lng}\\\"\"\n return coordinate_results_lat, coordinate_results_lng\n #binding.pry\nend",
"def search\n @hits = []\n\n if params[:query]\n search = DesignMethod.solr_search do\n fulltext params[:query] do\n highlight\n minimum_match 0\n end\n end\n store_location\n @hits = search.hits\n @results = search.results\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end",
"def render_search_results_as_json\n @presenter = Blacklight::JsonPresenter.new(@response, blacklight_config)\n { response: { docs: @document_list, facets: @presenter.search_facets, pages: @presenter.pagination_info } }\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def get_search_with_http_info(q64, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SuggestApi.get_search ...\"\n end\n \n \n # verify the required parameter 'q64' is set\n fail ArgumentError, \"Missing the required parameter 'q64' when calling SuggestApi.get_search\" if q64.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'q64'] = q64\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n query_params[:'profile'] = opts[:'profile'] if opts[:'profile']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud 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 => 'JsonNodeSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SuggestApi#get_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ajax_geocode\n name = params[:name].to_s\n if params[:format]\n name = Location.reverse_name(name) if params[:format] == \"scientific\"\n else\n name = Location.reverse_name(name) if login_for_ajax.location_format == :scientific\n end\n render(:inline => Geocoder.new(name).ajax_response)\n end",
"def geocode\n name = params[:name].to_s\n if params[:format]\n name = Location.reverse_name(name) if params[:format] == \"scientific\"\n elsif @user = get_session_user!\n name = Location.reverse_name(name) if @user.location_format == :scientific\n end\n render(inline: Geocoder.new(name).ajax_response)\n end",
"def search(query)\n @client.get('/BikePoint/Search', { query: query })\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def results\n\t\t#get the location from what the user enters in the form\n\t\t@location = params[:location]\n\n\t\t#set the location to Latitude/Longitude using Geocoder\n\t\t@lat,@long = Geocoder.coordinates(@location)\n\n\tend",
"def tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end",
"def location_bar\n\tresult = Geocoder.search(\"#{params['latitude']},#{params['longitude']}\")\n\taddress = result.first.data[\"formatted_address\"]\n\trender html: address\nend",
"def photo_search\n user_id = username_to_userid(params[:username])\n plain_response = Flickr::Client.get('photos.search', {\n :text=>((params[:q].blank? and user_id.blank?) ? DEFAULT_TERM : params[:q]),\n :per_page=>20,\n :page => params[:page],\n :user_id => user_id,\n :privacy_filter => 1,\n #:has_geo => true,\n :sort => 'relevance'\n })\n # remove the callback method wrapper:\n hash_response = js_to_ruby plain_response\n raise hash_response.inspect unless hash_response['stat']=='ok'\n hash_response\n end",
"def search(query)\n # Check if we need a new Grooveshark session\n if session_expired?\n init_grooveshark\n end\n query.strip!\n\n songs = []\n begin\n songs = @grooveshark_client.search_songs(query)\n rescue Exception\n end\n\n unless songs.length == 0\n return songs.to_json\n else\n return nil\n end\n end",
"def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end",
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def search_by_zip_code\n zip_codes = []\n if not (term = params[:term].to_s.strip).blank? and term.to_i > 0\n zip_codes = ZipCode.find(:all, :conditions => [\"code = ?\", term])\n zip_codes.compact!\n end\n render :json => format_suggested_cities_by_zip_code(zip_codes).to_json\n end",
"def get_place_info(keyword)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_TEXTSEARCH)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n query: keyword,\n key: google_places_api_key\n })\n p uri.query\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def call_google_api_for_location(address)\n url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{\n address}&key=#{ENV['GOOGLE_API_KEY']}\"\n response = HTTParty.get url\n response.body\n end",
"def geocode(address)\n q = { address: URI::encode(address) }\n q[:key] = @config[:api_key] if @config.has_key?(:api_key)\n\n res = get('/json', q)\n JSON::parse(res.body)\n end",
"def search\n book = Book.new(params)\n render json: book.search\n end",
"def reverse(latitude:, longitude:, raw: false)\n result = Geocoder.search([latitude, longitude])\n raw ? result&.data : format_result(result)\n end",
"def whereAmI\n \n lat = params[:latitud]\n long = params[:longitud]\n \n @donde = Geocoder.search(lat + \",\" + long)[0]\n \n render :json => {:direccion => @donde.address }\n \n end",
"def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end",
"def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"def full_response\n puts JSON.pretty_generate(@google_object)\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def perform\n url = URI.parse [BASE_URI, self.source.to_s.capitalize].join\n query = @query.dup\n query[:Query] = query[:Query].join(' ')\n callbacks.each {|callback| callback.call(query) }\n query.each do |key, value|\n query[key] = %{'#{value}'} unless key[0] == '$' || ['Latitude', 'Longitude'].include?(key)\n end\n query_options = default_options.merge(query).to_query\n query_options.gsub! '%2B', '+'\n url.query = query_options\n\n\n\n response = connection.get(url)\n begin\n JSON.parse(response.body)\n rescue JSON::ParserError => e\n raise Error, response.body.strip\n end\n end"
] | [
"0.7515012",
"0.7311621",
"0.6537428",
"0.6524741",
"0.64524645",
"0.63665897",
"0.636332",
"0.63476115",
"0.6286834",
"0.6285323",
"0.62476194",
"0.6237739",
"0.62277484",
"0.61654186",
"0.6151388",
"0.614263",
"0.6138089",
"0.61275446",
"0.6120009",
"0.6112965",
"0.5974651",
"0.59448874",
"0.5941005",
"0.5932272",
"0.59097373",
"0.5898096",
"0.5859942",
"0.5859771",
"0.5855741",
"0.5852047",
"0.584035",
"0.58391404",
"0.58316",
"0.58094776",
"0.580241",
"0.5801274",
"0.5785395",
"0.5771175",
"0.5754288",
"0.5747191",
"0.5741408",
"0.5706973",
"0.5705994",
"0.5702806",
"0.57026416",
"0.56923157",
"0.56848115",
"0.568342",
"0.56802493",
"0.56749785",
"0.5671289",
"0.5667779",
"0.56496495",
"0.5639593",
"0.5617154",
"0.55995935",
"0.5599522",
"0.55972147",
"0.55942345",
"0.55890507",
"0.558551",
"0.5581953",
"0.5581851",
"0.5566439",
"0.55554754",
"0.5546637",
"0.554322",
"0.55423427",
"0.5540796",
"0.55326414",
"0.5527545",
"0.55266905",
"0.55249137",
"0.5516577",
"0.55152804",
"0.55118406",
"0.5509643",
"0.5509427",
"0.5505974",
"0.55042046",
"0.54853755",
"0.5484506",
"0.54803175",
"0.54698026",
"0.546506",
"0.5462462",
"0.5460857",
"0.5460274",
"0.54574955",
"0.54545164",
"0.54465854",
"0.54420763",
"0.54397106",
"0.5431448",
"0.54178554",
"0.5417273",
"0.54161775",
"0.54143625",
"0.54133147",
"0.5399488"
] | 0.6535571 | 3 |
Set the current location of driver | def set_location(lon, lat)
factory = Driver.rgeo_factory_for_column(:location)
# update(location: factory.point(lon,lat))
self.location = factory.point(lon,lat)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_location\n LocationHelper.browse_location(params['select_location'], current_user)\n end",
"def change_curr_location(new_location)\n @curr_location = new_location\n end",
"def get_current_loc\r\n\t\treturn driver.location\r\n\tend",
"def setLocation(location)\r\n\t\t\t\t\t@location = location\r\n\t\t\t\tend",
"def set_default_location\n self.location = Rails.application.config.classifeds_default_location;\n end",
"def location=(location)\n self.java_element.location = location\n end",
"def set_location\n @location = \"Minneapolis, MN\"\n end",
"def default_location(path)\n @default_location = File.expand_path(path)\n end",
"def set_current_path; end",
"def location(value)\n @ole.Location = value\n nil\n end",
"def set_current_location\n @current_location = CurrentLocation.find(params[:id])\n end",
"def set_gps_location!\n\n end",
"def path=(new_path)\n begin\n self.dev_path = Sys::Filesystem.mount_point new_path\n @dev_stat = nil\n rescue SystemCallError\n self.dev_path = nil\n end\n super\n end",
"def location=(new_location)\n @location = new_location\n end",
"def set_current_path(path)\n @current_path = path\nend",
"def location=(location)\n unless location.is_a?(::Appium::Location)\n raise TypeError, \"expected #{::Appium::Location}, got #{location.inspect}:#{location.class}\"\n end\n\n @bridge.set_location location.latitude, location.longitude, location.altitude\n end",
"def driver_path; end",
"def driver_path; end",
"def set_Location(value)\n set_input(\"Location\", value)\n end",
"def set_boot_location(opts)\n opts = check_params(opts,[:location])\n super(opts)\n end",
"def set_home\n end",
"def start_driver\n @driver.start_driver\n end",
"def set_location(latitude, longitude, altitude, speed: nil, satellites: nil)\n if speed.nil? && satellites.nil?\n self.location = ::Appium::Location.new(Float(latitude), Float(longitude), Float(altitude))\n else\n loc = ::Appium::Location.new(Float(latitude), Float(longitude), Float(altitude))\n\n speed = Float(speed) unless speed.nil?\n satellites = Integer(satellites) unless satellites.nil?\n\n @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: speed, satellites: satellites\n end\n end",
"def path=(new_path)\n location = self.class.new_location(conn_id, new_path, :default => :Root)\n if !location.path.empty?\n @location = location\n location_changed!\n end\n end",
"def boot_location\n super\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def setup_paths\n # This REPLACE_DEFAULT_PATH_WITH_DRIVER constant gets defined by bin/driver when we want\n # to run a command in the context of a driver instead of the main rails app.\n if defined?(REPLACE_DEFAULT_PATH_WITH_DRIVER)\n replace_rails_paths_with_driver(REPLACE_DEFAULT_PATH_WITH_DRIVER)\n else\n add_every_driver_to_rails_paths\n end\n end",
"def location=(name)\n opts = get_options\n opts['lib']=name\n save_file(opts)\n nil\n end",
"def set_location\n # byebug\n @location = Location.find(params[:id])\n end",
"def set_cursor_position locator, position\r\n command 'setCursorPosition', locator, position\r\n end",
"def setup_local(driver)\n if driver == 'chrome'\n @browser = Watir::Browser.new :chrome\n elsif driver == 'firefox'\n @browser = Watir::Browser.new :firefox, marionette: true\n end\nend",
"def set_backend_location\r\n @backend_location = Backend::Location.find(params[:id])\r\n end",
"def setup\n switch_dir\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def test_new_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Hillman', @new_driver.location('Hillman')\n\tend",
"def set_location\n @location = Spree::Location.find(params[:id])\n end",
"def set_driver\n id = params[:driver_id] || params[:id]\n @driver = Driver.find_by(id: id)\n end",
"def repository_browser_location=(repository_browser_location)\n @repository_browser_location = repository_browser_location\n @config_doc.elements[\"/project/scm/browser/location\"].text = repository_browser_location\n @config = @config_doc.to_s\n update\n end",
"def set_loc(x, y)\n @curr_x = x\n @curr_y = y\n end",
"def set_location\n @location = Location.find(params[:id])\n add_location_breadcrumb @location\n end",
"def test_driver_setLocation_cathedral\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 0 #hospital to cathedral\n\t\tassert_equal d.getLocation, 1\n\tend",
"def path\n driver.getPath\n end",
"def initialize(current_location)\n @location = current_location\n end",
"def setWindDir _obj, _args\n \"_obj setWindDir _args;\" \n end",
"def repository_browser_location=(repository_browser_location)\n @repository_browser_location = repository_browser_location\n @config_doc.elements[\"/project/scm/browser/location\"].text = repository_browser_location\n @config = @config_doc.to_s\n update\n end",
"def location=(location)\n @location = location.to_str.freeze\n sync\n end",
"def set_system(name)\n system_dir = File.join(base_systems_dir, name)\n unless File.directory?(system_dir)\n err \"CloudFoundry system path '#{system_dir.red}` does not exist\"\n end\n \n say \"CloudFoundry system set to #{system_dir.green}\"\n common_config.target_system = system_dir\n common_config.save\n end",
"def location=(value)\n @location = value\n end",
"def set_backend_coordinates( backend_coordinates )\n @master.use( Indices::REMOTE_MIRROR_SECTION_NAME )\n @master.set( Indices::REMOTE_MIRROR_PAGE_NAME, backend_coordinates )\n end",
"def store_location!; end",
"def current_url\n driver.current_url\n end",
"def test_driver_drive_change_place\n\t\tloc1 = Location::new(\"Location\", [\"Place\"])\n\t\tdriv = Driver::new(1, loc1)\n\t\trefute_equal loc1, driv.drive\n\tend",
"def set_path(path)\n path\n end",
"def url=(url)\n driver.navigate.to(url)\n end",
"def use_device\n @screwdriver.drive\n end",
"def location\n @location ||= TermuxRubyApi::SubSystems::Location.new(self)\n end",
"def setpoint\n @setpoint\n end",
"def driver=(driver)\n # TODO throw some exception as modyfing driver is not supported\n raise NotImplementedError, \"You cannot modify driver of already created storage!\"\n end",
"def setup\n # Capybara.current_driver = Capybara.javascript_driver # :selenium by default\n # Capybara.current_driver = :webkit\n Capybara.current_driver = :poltergeist\n end",
"def set_winddir\n @winddir = Winddir.find(params[:id])\n end",
"def getCurrentLocation\n nil\n end",
"def set_path\n self.path = File.join(self.store_dir, self.filename)\n end",
"def define_location\n config\n mtime = File.mtime(@msrun.rawfile)\n arr = [@msrun.group, @msrun.user, \"#{mtime.year}#{\"%02d\" % mtime.mon}#{\"%02d\" % mtime.day}\", @msrun.rawid]\n t = Time.now\n @location = File.join(arr.zip( [\"Unknown\", \"unknown\", \"#{t.year}#{\"%02d\" % t.mon}#{\"%02d\" % t.day}\", \"Never see this\"] ).map {|a| a.first.nil? ? a.last : a.first } )\n @msrun.archive_location = @location\n end",
"def set_ride_driver\n @ride_driver = RideDriver.find(params[:id])\n end",
"def driver_path\n File.absolute_path File.join(System.install_dir, file_name)\n end",
"def test_initialize_current_location\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.current_location.name, 'Enumerable Canyon'\n end",
"def set_path(path)\n @path = path\n end",
"def set_driver\n cities = City.find(params[:city_id])\n @drivers = cities.drivers.find(params[:id])\n end",
"def driver\n\t\t\t_load_driver unless @driver\n\t\t\t@driver\n\t\tend",
"def set_current_site\n Site.current = current_site\n end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end"
] | [
"0.64280885",
"0.6394768",
"0.613227",
"0.6085285",
"0.5959727",
"0.59058756",
"0.5859009",
"0.58474165",
"0.57946837",
"0.5766176",
"0.57469374",
"0.5715642",
"0.5698983",
"0.5697716",
"0.56884336",
"0.56584215",
"0.5620568",
"0.5620568",
"0.55974656",
"0.55875325",
"0.5576017",
"0.5521459",
"0.54899",
"0.5488967",
"0.54684967",
"0.54627556",
"0.5440314",
"0.5421707",
"0.54198647",
"0.5410979",
"0.5404213",
"0.53719634",
"0.5365251",
"0.5364239",
"0.5364239",
"0.5364239",
"0.5364239",
"0.53448063",
"0.53412414",
"0.53314173",
"0.5330801",
"0.53110534",
"0.53092265",
"0.53026587",
"0.5282213",
"0.5277458",
"0.52695775",
"0.5261931",
"0.5257949",
"0.52326375",
"0.5231726",
"0.51725894",
"0.516955",
"0.51671016",
"0.5161111",
"0.5159503",
"0.5156985",
"0.51542073",
"0.51353914",
"0.5133129",
"0.512385",
"0.51229006",
"0.5119228",
"0.51163703",
"0.51112676",
"0.51103604",
"0.50980043",
"0.509793",
"0.50965625",
"0.5092596",
"0.5088042",
"0.5070154",
"0.50681406",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804",
"0.50680804"
] | 0.54345006 | 27 |
def staffs staffs = [] self.subdepartments.each do |sub| sub.staffs.each do |staff| staffs << staff end end return staffs end | def staff_names
staff_names = []
self.subdepartments.each do |sub|
sub.staffs.each do |staff|
staff_names << staff.full_names
end
end
return staff_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def staff\n group.staff + group.group_type.courses.map(&:convenor)\n end",
"def fs_and_sc_list\n field_staffs + staffing_companies.collect{|sc| sc.staffs }.flatten\n end",
"def staff_ids\n return @staff_ids\n end",
"def all_departments\n @@all_managers.each do |manager|\n manager.department\n end\n end",
"def admin_subordinates\n mypost=Login.current_login.staff.position\n post_name=mypost.name\n if post_name==\"Timbalan Pengarah (Pengurusan)\"\n adm_sub=mypost.descendants.map(&:staff_id)\n else\n adm_sub=[]\n end\n adm_sub\n end",
"def fellow_staff\n User.any_staff_admin_for_agencies(agencies)\n end",
"def index\n @admin_staffs = Admin::Staff.all\n end",
"def my_department_members\n departments = employee&.departments&.ids || []\n Employee.where(id: Position.where.not(department_id: nil).where(department_id: departments).map(&:efective_id))\n end",
"def is_on_staff\n self.teams\n end",
"def employees\n employee_array = []\n locations.each do |location|\n location.employees.each do |employee|\n employee_array << employee\n end\n end\n employee_array\n end",
"def faculty_list()\n # If we have loaded the faculty list, use it\n # (usually the case for teams)...\n if item.faculty.count > 0\n return item.faculty\n end\n\n # ...otherwise build it from the list of people (array of OrgMemberItem)\n # This is needed because we don't store the entire faculty info\n # for organizations in Solr.\n ids = item.people.map {|person| person.vivo_id}.uniq\n list = Faculty.load_from_solr_many(ids)\n list\n end",
"def department_members\n Department.where(id: department.id)\n Employee.where(id: Position.where.not(department_id: nil).where(department_id: department&.id).map(&:efective_id))\n end",
"def man_staffs\n prepareBaseContext\n @members = ShelterStaff.where('staff_type = ?', 'MEMBER')\n @volunteers = ShelterStaff.where('staff_type = ?', 'VOLUNTEER')\n render 'petshelter/management/staffs'\n end",
"def primary_staff\n general_agency_staff_roles.present? ? general_agency_staff_roles.last : nil\n end",
"def staff\n staff = self.users.where(\"participants.role_id < 4\").all\n return staff\n end",
"def total_subsalary\n total_subsalary = 0\n self.employees.each do |employee|\n if employee.is_a?(Manager)\n total_subsalary += employee.salary + employee.total_subsalary\n else\n total_subsalary += employee.salary\n end\n end\n\n total_subsalary\n end",
"def faculty\n department.faculty\n end",
"def user_departments(user=current_user)\n if user.role? :superadmin\n @departments = Department.active\n else\n @departments = @department || user.department\n end\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 all_employees\n self.workplace.employees\n end",
"def department_names; end",
"def students\n self.boating_tests.collect{|test| test.student} \n end",
"def index\n @staffs = Staff.all\n end",
"def index\n @staffs = Staff.all\n end",
"def index\n @staffs = Staff.all\n end",
"def get_team_members\n team_members = []\n self.students.each do |student|\n team_members.append(student.user)\n end\n return team_members\n end",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def index\n @dtc_staffs = DtcStaff.all\n end",
"def departments\n @departments ||= begin\n # Replace \"And|and\" with an ampersand (&) and remove everything in parentheses\n departments = person.departments&.gsub(/ (a|A)nd /,' & ')&.gsub(/\\((.+?)\\)/, '')\n # Turn list of depratments into an array and remove leading \"KARMS/\"-like data\n departments = departments&.split(';').map { |d| d.split('/')&.last&.strip }\n # Append parent department if it's in the list\n departments&.push(person.parent_department) if APPEND_PARENT_DEPARTMENTS.include?(person.parent_department)\n # Remove dupes\n departments.uniq\n end\n end",
"def get_schedules\n ret=[]\n #puts \"==============teachings=#{self.teachings.to_a}\"\n self.teachings.to_a.each do |teaching|\n teaching.schedules.each do |schedule|\n ret << schedule\n end\n end\n ret\n end",
"def employees\n self.employee_examination_sessions.map(&:employee)\n end",
"def index\n @lec_staffs = LecStaff.all\n end",
"def staff_ids=(value)\n @staff_ids = value\n end",
"def index\n @authoriziedstaffs = Authorizedstaff.all\n end",
"def doctors\n self.appointments.map do |appointment|\n appointment.doctor\n end\n end",
"def staff_agency\n agencies.last\n end",
"def doctors \n self.appointments.collect do |a|\n a.doctor\n end\nend",
"def set_departments\n @dptos=Department.where(enterprise_id: current_emp.id)\n end",
"def all_teachers(student_user)\n counter = 0 \n while counter <= Teacher.all.count \n list = Teacher.all.map do |staff|\n staff.name\n end\n counter += 1\n end\n puts list\n end",
"def departments\n @departments ||= DepartmentProxy.new(self)\n end",
"def index\n @staff_departments = StaffDepartment.all\n @staff_department = StaffDepartment.new\n end",
"def departments\n\t\t\tdepartments = []\n\t\t\tcourses.each do |c|\n\t\t\t\tdept = Department.where(:id => c.department_id)\n\t\t\t\tif !departments.include? dept\n\t\t\t\t\tdepartments.push(dept)\n\t\t\t\tend\n\t\t\t\treturn departments\n\t\t\tend\n\t\t\treturn departments\n\t\tend",
"def verify_staff(test_data)\n staff = test_data[CoreUseOfCollectionsData::STAFF_GRP.name] || [CoreUseOfCollectionsData.empty_staff]\n staff.each_with_index do |staf, index|\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_NAME.name], element_value(staff_name_input index))\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_ROLE.name], element_value(staff_role_input index))\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_HOURS_SPENT.name], element_value(staff_hours_spent_input index))\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_NOTE.name], element_value(staff_note_input index))\n end\n end",
"def index\n @daw_staffs = DawStaff.all\n end",
"def verify_staff(test_data)\n staff = test_data[UseOfCollections::STAFF_GRP.name] || [UseOfCollections.empty_staff]\n staff.each_with_index do |staf, index|\n verify_values_match(staf[UseOfCollections::STAFF_NAME.name], element_value(staff_name_input index))\n verify_values_match(staf[UseOfCollections::STAFF_ROLE.name], element_value(staff_role_input index))\n verify_values_match(staf[UseOfCollections::STAFF_HOURS_SPENT.name], element_value(staff_hours_spent_input index))\n verify_values_match(staf[UseOfCollections::STAFF_NOTE.name], element_value(staff_note_input index))\n end\n end",
"def show_all_staff_members\n\t\tputs \"\\nAll Staff Members\\n\"\n\t\tStaffMember.all.each do |staff_member|\n\t\t\tputs \"#{staff_member.id} #{staff_member.name}\"\n\t\tend\nend",
"def get_staff_groups(ldap:, users_groups:)\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'group' ) & Net::LDAP::Filter.eq('cn', '*.staff.uos')\n treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n\n ldap.search( base: treebase, filter: filter, attributes: [ 'member' ] ) do |entry|\n # eg CN=SCIFAC.staff.uos,OU=uos,OU=Groups,DC=UoA,DC=auckland,DC=ac,DC=nz\n group = entry.dn.split(',')[0].split('=')[1].split('.')[0]\n entry.each do |attribute, values|\n next unless attribute =~ /^member/ # Getting empty member attributes, and new attribute: member;range=0-XXXX for SCIFAC and MEDFAC.\n\n values.each do |value|\n member = value.split('=')[1].split(',')[0]\n users_groups[member] ||= [] # If this is the users first group, then create an Array\n # Add this group to this users group Array, only if group not already in Array\n group_def = @academic_department_code_to_faculty[group]\n if (group_def != nil && (faculty = group_def['faculty'])) != nil && faculty != '' && users_groups[member].include?(faculty) == false\n users_groups[member] << faculty\n end\n end\n end\n end\nend",
"def index\n @staff_measurements = StaffMeasurement.all\n end",
"def supervisors\n (self.managers + self.trustees).uniq\n end",
"def index\n @sub_department = SubDepartment.new\n @sub_departments = SubDepartment.all\n end",
"def index\n @contacts = Contact.all\n @departments = ['All', Contact.all.map {|c| c.dept }].flatten.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 employees\n Employee.all.select {|employees| employees.manager_name == self.name} \n end",
"def faculty\n deanship.faculty\n end",
"def doctors\n appointments.map do |appointment| appointment.doctor end\n end",
"def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end",
"def employees\n Employee.select{|employees| employees.manager == self.name}\nend",
"def names_of_departments_with_employees_from_portsmouth(departments)\nend",
"def is_on_staff?(team)\n self.teams.include?(team)\n end",
"def doctors\n doctor_list = []\n appointments.select do |doctor|\n doctor_list << doctor.doctor\n end\ndoctor_list\nend",
"def team_members\n if has_team?\n self.supervised ||= Employee.where(id: team_positions.map(&:efective_id))\n else\n Employee.none\n end\n end",
"def index\n @staffevents = Staffevent.all\n end",
"def names_of_departments_with_one_employee(departments)\nend",
"def employees\n emps = []\n url = prefix + \"liste\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n emps << User.new(u[\"id\"], @authid, @subdomain)\n end\n return emps\n else #failed\n return users\n end\n end",
"def available_departments\n (active_departments + active_units.collect(&:parent)).uniq\n end",
"def stations\r\n return @stations\r\n end",
"def all_employees\n ServiceProvider.all(:conditions => [\"user_id IN (?)\", self.users.map(&:id)])\n end",
"def get_admins\n\t\t@sm = Member.where(society_id: self.id)\n\t\t@admins = []\n\t\[email protected] do |m|\n\t\t #if is an admin, add to array\n\t\t if m.admin then @admins << User.find_by_id(m.user_id) end\n\t\tend\n\t\treturn @admins\n end",
"def department\n self\n end",
"def set_staff_department\n @staff_department = StaffDepartment.find(params[:id])\n end",
"def index\n @employee_departments = EmployeeDepartment.all\n end",
"def index\n delegates_for_current_profile\n @delegate = Delegate.new\n @staff_list = current_staff_profile.staff_list_json\n end",
"def student_list\n\t\t@student_list ||=[]\nend",
"def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\n end",
"def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\n end",
"def is_not_on_staff\n #Team.find(:all) - self.teams\n Team.all - self.teams\n end",
"def employees\n Employee.all.select do |employee|\n employee.manager == self\n \n end\n end",
"def show\n @employees = @department.employees\n end",
"def tenants\n @tenants\n end",
"def accessible_staff\n return User.any_role if admin?\n return fellow_staff if staff?\n return User.none\n end",
"def index\n @departments = Department.all_active\n end",
"def get_employees\n @employees = User.find_user_not_admin_not_client(get_company_id)\n end",
"def patients\n self.appointments.collect do |a|\n a.patient\n end\n end",
"def get_departments_for_role\n department_ids = self.positions.map(&:id).inject([]) do |arr, pos_id|\n arr << FlowRelation.where('(role_name = \"department_hr\" or role_name = \"department_leader\" or role_name = \"county_leader\" \n or role_name = \"family_leader\") and position_ids like \"%- ?\\n%\"', pos_id.to_s).map(&:department_id)\n end.flatten.uniq\n department_ids = Department.get_self_and_childrens(department_ids) if department_ids.present?\n department_ids\n end",
"def appointments\n Appointment.all.collect do\n\t\t\t|appt| appt if appt.doctor == self\n\t\tend\n\tend",
"def get_class_schools\n ret=[]\n self.teachings.to_a.each do |teaching|\n ret<< teaching.teaching_class_school\n end\n #puts \"========================== teacher.get_class_schools: #{ret.count}\"\n ret\n end",
"def doctors\n appointments.map do |appt|\n appt.doctor\n end\n end",
"def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\nend",
"def appointments\r\n Appointment.all.collect do\r\n\t\t\t|appt| appt if appt.doctor == self\r\n\t\tend\r\n\tend",
"def schoolteams\n self.teams.where(\"school_id = ?\",self.school).all\n end",
"def total_fte\n staffing.present? ? staffing.total_fte : nil\n end",
"def get_list_defender_facilities\n unit_report = []\n unit_report << \"Auflistung der Anlagen: \"\n @defender_facilities.each do |instances|\n unit_report << instances.facility.name\n unit_report << instances.count\n end\n return unit_report\n end",
"def index\n @staff_codes = StaffCode.all\n end",
"def index\n @staff_codes = StaffCode.all\n end",
"def create_staff_for_education_organization(roles, required)\n members = []\n if !required.nil? and required.size > 0\n required[\"staff\"].each do |member|\n # skip this entry if its an Educator --> handled in 'create_teachers' method\n next if [\"Student\", \"Educator\"].include? member[:role]\n\n @num_staff_members += 1\n members << {\"id\" => member[:staff_id], \"role\" => member[:role], \"name\" => member[:name], \"begin\" => member[:begin], \"end\" => member[:end]}\n for index in (0..(roles.size - 1)) do\n if Roles.to_string(roles[index]) == member[:role]\n @log.info \"Removing role: #{member[:role]} from default roles --> specified by member in staff catalog.\"\n roles.delete_at(index)\n break\n end\n end\n end\n end\n if !roles.nil? and roles.size > 0\n for index in (0..(roles.size - 1)) do\n @num_staff_members += 1\n members << {\"id\" => @num_staff_members, \"role\" => roles[index]}\n end\n end\n members\n end",
"def students\n users.students\n end",
"def children\n # return students\n return offerings\n end",
"def set_staff_team\n @staff_team = StaffTeam.includes({ staff_team_members: { registration: [:user, :scramble_events, :registration_detail] }}).find(params[:id] || params[:staff_team_id])\n end",
"def services\n Service.where(agency: agencies)\n end"
] | [
"0.7230124",
"0.70683724",
"0.67663026",
"0.6514076",
"0.64435756",
"0.6402106",
"0.6320232",
"0.6286299",
"0.6241766",
"0.6237957",
"0.618811",
"0.61763144",
"0.61289096",
"0.60877115",
"0.6072385",
"0.604601",
"0.6008521",
"0.5999491",
"0.59976923",
"0.59917957",
"0.59765005",
"0.59646595",
"0.5961672",
"0.5961672",
"0.5961672",
"0.5957338",
"0.5930383",
"0.5930383",
"0.591968",
"0.5909106",
"0.5889192",
"0.58794665",
"0.58780545",
"0.58676785",
"0.58467627",
"0.5832349",
"0.58313525",
"0.58140117",
"0.581031",
"0.58015704",
"0.5791185",
"0.57724947",
"0.57572275",
"0.5748702",
"0.5732602",
"0.5729159",
"0.5725548",
"0.57143295",
"0.57028896",
"0.56881213",
"0.56804454",
"0.5665003",
"0.56600165",
"0.5641106",
"0.56409496",
"0.56302196",
"0.56265795",
"0.5623239",
"0.5621472",
"0.5618119",
"0.56130475",
"0.5609124",
"0.5594724",
"0.55870456",
"0.5586814",
"0.5583246",
"0.5579539",
"0.5578115",
"0.5574065",
"0.5573352",
"0.55591637",
"0.5557624",
"0.55472356",
"0.55397767",
"0.55369884",
"0.55369884",
"0.5535432",
"0.5528152",
"0.55208397",
"0.55177844",
"0.5517003",
"0.55161023",
"0.5508547",
"0.5505293",
"0.5505131",
"0.54993904",
"0.5498169",
"0.5497857",
"0.54978555",
"0.5489961",
"0.54891825",
"0.5481061",
"0.54777473",
"0.5476589",
"0.5476589",
"0.5476398",
"0.54749286",
"0.5472404",
"0.5469155",
"0.54671687"
] | 0.7851917 | 0 |
Toggle state of desktop icons. | def toggle
toggle_icon_display
restart_finder
icons_showing?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desktop?\n false # FIXME\n end",
"def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end",
"def toggle\n if on?\n off\n else\n on\n end\n end",
"def openToggle()\n @openToggle_duration = @w_openToggle.animationSpeed\n if (@w_openToggle.openness != 255)\n @w_openToggle.open()\n else\n @w_openToggle.close()\n end\n end",
"def desktop?\n !is_mobile_device? && !is_tablet_device?\n end",
"def toggle\n set_switch(!self.switch) if @switch\n end",
"def toggle_state\n puts \"******* toggle_state *******\"\n end",
"def desktop?\n true # Not nice, but if you're running desktopbrowser, assume running desktop\n end",
"def toggle\n\t\tstr = \"\"\n\t\t$togglelist_array.each{|a| str += a[1][2] + \",\"}\n\t\tstr.chop!\n\t\t$screen.write_message(str)\n\t\tc = Curses.getch\n\t\teval($togglelist[c][0])\n\t\t$screen.write_message($togglelist[c][1])\n\tend",
"def cmd_setdesktop(*args)\n\t\tif(args.length == 0)\n\t\t\tprint_line(\"Usage: setdesktop [workstation\\\\\\\\desktop]\")\n\t\t\treturn\n\t\tend\n\t\t\n\t\tprint_line(\"Changing to desktop #{args[0]}\")\n\t\tclient.ui.set_desktop(*args)\n\t\treturn true\n\tend",
"def toggle\n @toggle ||= toggle_class.new(self)\n end",
"def toggle_state\n state\n end",
"def toggle\n action(action: Actions::TOGGLE)\n self\n end",
"def toggle\n @css_class << 'click-to-toggle'\n return self\n end",
"def toggle_off\n set_state_to(:off)\n end",
"def cmd_setdesktop( *args )\n\t\t\n\t\tswitch = false\n\t\tdsession = -1\n\t\tdstation = 'WinSta0'\n\t\tdname = 'Default'\n\t\t\n\t\tsetdesktop_opts = Rex::Parser::Arguments.new(\n\t\t\t\"-h\" => [ false, \"Help Banner.\" ],\n\t\t\t#\"-s\" => [ true, \"The session (Default: '#{dsession}')\" ],\n\t\t\t\"-w\" => [ true, \"The window station (Default: '#{dstation}')\" ],\n\t\t\t\"-n\" => [ true, \"The desktop name (Default: '#{dname}')\" ],\n\t\t\t\"-i\" => [ true, \"Set this desktop as the interactive desktop (Default: '#{switch}')\" ]\n\t\t)\n\t\t\n\t\tsetdesktop_opts.parse( args ) { | opt, idx, val |\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint_line( \"Usage: setdesktop [options]\\n\" )\n\t\t\t\t\tprint_line( \"Change the meterpreters current desktop.\" )\n\t\t\t\t\tprint_line( setdesktop_opts.usage )\n\t\t\t\t\treturn\n\t\t\t\t#when \"-s\"\n\t\t\t\t# dsession = val.to_i\n\t\t\t\twhen \"-w\"\n\t\t\t\t\tdstation = val\n\t\t\t\twhen \"-n\"\n\t\t\t\t\tdname = val\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tswitch = true if ( val =~ /^(t|y|1)/i )\n\t\t\tend\n\t\t}\n\t\t\n\t\tif( client.ui.set_desktop( dsession, dstation, dname, switch ) )\n\t\t\tprint_line( \"#{ switch ? 'Switched' : 'Changed' } to desktop #{dstation}\\\\#{dname}\" )\n\t\telse\n\t\t\tprint_line( \"Failed to #{ switch ? 'switch' : 'change' } to desktop #{dstation}\\\\#{dname}\" )\n\t\tend\n\t\t\n\t\treturn true\n\tend",
"def toggle\n\t\t@toggle ||= Toggle.new(self)\n\tend",
"def toggle\n return enabled? ? disable : enable if index.nonzero?\n board.toggle(:all)\n end",
"def toggle\n social_network = SocialNetwork.find(params[:id])\n social_network.update!(is_visible: !social_network.is_visible?)\n redirect_to :settings\n end",
"def toggle\n\t\t@gridOn = !@gridOn\n\tend",
"def toggle\n cmd = \"{\\\"id\\\":7,\\\"method\\\":\\\"toggle\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def toggle\n wait\n $browser.find_element(:xpath, \"#{@locator}/div[@class='collapsibleHeader']/img\").click\n end",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def toggle_fullscreen\n self.fullscreen = !fullscreen?\n end",
"def toggleFullscreen\n @fullscreen = !@fullscreen\n end",
"def desktops\n @desktops ||= if available?\n Libatspi.get_desktop_count.times.map do |idx|\n Desktop.new(Libatspi.get_desktop(idx))\n end\n else\n []\n end\n end",
"def toggle_help\n @help_window.toggle_text\n end",
"def icons_visible=(value)\n @icons_visible = value\n end",
"def for_desktop?\n for_terminal == TerminalEnum.desktop\n end",
"def toggle\n if style![:display] == :none\n show\n else\n hide\n end\n end",
"def toggle_mark\n main.toggle_mark current_item\n end",
"def active=(active)\n @active = active\n @cIcon.active = active\n end",
"def toggle_is_pinned!\n self.is_pinned = (self.is_pinned ? false : true) # will change true to false and false to true\n end",
"def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end",
"def open_desktop\n Log.add_info(request, params.inspect)\n\n user = @login_user\n\n is_config_desktop = false\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n is_config_desktop = true\n end\n\n @toys = Toy.get_for_user(user)\n\n if is_config_desktop\n @toys.delete_if {|toy|\n ret = false\n if toy.xtype == Toy::XTYPE_FOLDER\n begin\n folder = Folder.find(toy.target_id)\n ret = folder.my_folder?\n rescue\n end\n elsif toy.xtype == Toy::XTYPE_POSTLABEL\n ret = true\n end\n ret == true\n }\n end\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n @ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n end\n\n @desktop = Desktop.get_for(user)\n\n render(:partial => 'ajax_get_desktop', :layout => false)\n end",
"def toggle_on(outlet = 1)\n toggle(outlet, true)\n end",
"def toggle!\n if self.active?\n self.stop!\n else\n self.start!\n end\n end",
"def toggle_class\n Toggles::Value\n end",
"def desktop_request?\n !mobile_request?\n end",
"def click_on_TW_ON_toggle\n\n find(TW_ON_TOGGLE).click\n\n end",
"def toggle_host_status\n if !self.host.listings.empty?\n self.host.update(host: true)\n else\n self.host.update(host: false)\n end\n end",
"def icon_change()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.TitleComponentState_icon_change(@handle.ptr)\n result\n end",
"def toggle\n style[:hidden] = !style[:hidden]\n update_visibility\n end",
"def toggle\n\t\tif is_favourited\n\t\t\tself.is_favourited = false\n\t\telse\n\t\t\tself.is_favourited = true\n\t\tend\n\t\tself.save\n\tend",
"def toggle_favorite_song(song_instance)\n if song_instance.favorite \n song_instance.favorite = false\n else\n song_instance.favorite = true\n end\n end",
"def material_icon\n @@material_icon.reset\n end",
"def visible=(visible)\n @visible = visible\n @cIcon.visible = visible\n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def state_icons\r\n icons = states.collect {|state| state.icon_index }\r\n icons.delete(0)\r\n icons\r\n end",
"def toggle_item\n return unless item.toggable?\n item.toggle\n RPG::SE.new(H87Options::TOGGLE_SOUND).play\n refresh\n activate\n end",
"def toggle_item\n return unless item.toggable?\n item.toggle\n RPG::SE.new(H87Options::TOGGLE_SOUND).play\n refresh\n activate\n end",
"def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end",
"def click_on_On_fb_toggle\n\n find(FB_ON_TOGGLE).click\n\n end",
"def toggle_off(outlet = 1)\n toggle(outlet, false)\n end",
"def toggle(sym)\n `c$Element.prototype.m$toggle_class.call(#{@element},sym)`\n return @element\n end",
"def desktop_path\n path.join(\"bowline-desktop\")\n end",
"def toggle_stock\n @item.toggle!(:stock)\n end",
"def icon\n 'unchecked'\n end",
"def toggleDecide(locationsToggleOld)\n #No if only 1 location and it is active\n if (locationsToggleOld.length === 1) && (findActive(locationsToggleOld).length === 1)\n return false\n end\n return true\n end",
"def toggle_state(state)\n @states.select { |s, _| s == state }.each do |s, v|\n v[1] = !v[1]\n classify_state v\n end\n end",
"def icon; Settings::PLAYTIME_WINDOW_ICON; end",
"def icon; Settings::LOCATION_WINDOW_ICON; end",
"def toggle_favorite\n\t toggle_favorite_for User.current_user\n\tend",
"def upDownToggle()\n @upDown_duration = 6\n @window.contents.clear_rect(Rect.new(0, 96, 100, 24))\n @sprite.bitmap.clear_rect(Rect.new(0, 96, 100, 24))\n @bitmap.clear_rect(Rect.new(0, 96, 100, 24))\n for uc in @uc_upDownsToggle\n if (uc.value == uc.max)\n @up = false\n elsif (uc.value == uc.min)\n @up = true\n end\n \n if (@up)\n uc.up()\n else\n uc.down()\n end\n \n uc.draw()\n end\n end",
"def on_toggle_help\n @help_window.toggle_text\n end",
"def on_toggle_help\n @help_window.toggle_text\n end",
"def toggle!\n self.featured = !self.featured\n save\n end",
"def setup_icon\n return unless PONY::ERRNO::check_sequence(current_act)\n @icon_key = @acts[1]\n @icon_key = @acts[2] if @acts[2] && flip\n end",
"def unlock_desktop(unlock=true)\n\t\trequest = Packet.create_request('stdapi_ui_unlock_desktop')\n\t\trequest.add_tlv(TLV_TYPE_BOOL, unlock)\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def smart_screen_enable_in_shell=(value)\n @smart_screen_enable_in_shell = value\n end",
"def toggle_grid\n if @show_grid\n self.show_grid = false\n else\n self.show_grid = true\n end\n end",
"def toggle(switch)\n switch == 1 ? 0 : 1\nend",
"def toggleRunAtStartup(sender)\n if sender.state == NSOnState\n NSApp.addToLoginItems\n else\n NSApp.removeFromLoginItems\n end\n end",
"def toggle_advanced(action)\n toggle_advanced_icon.click if toggle_advanced_icon.text.include?(\"Show Advanced\") == action\n end",
"def click_on_fb_toggle\n\n find(FB_OFF_TOGGLE).click\n sleep(1)\n\nend",
"def toggle_availability\n if @chef.availability == true\n @chef.availability = false\n else\n @chef.availability = true\n end\n end",
"def set_folder_icon(p_is_warn_state)\n\t\t\tmovie = (p_is_warn_state ? @warn_icon : @folder_icon)\n\t\t\[email protected](movie)\n\t\t\tmovie.start\n\t\tend",
"def toggle\n write((read==HIGH) ? LOW : HIGH)\n end",
"def set_desktop_background!\n command = <<-EOF \n /usr/bin/osascript -e 'tell application \"Finder\"\n set desktop picture to POSIX file \"#{File.expand_path(@desktop_image)}\"\n end tell'\n EOF\n `#{command}`\n end",
"def is_desktop_browser?\n !Handset.is_mobile? request.user_agent\n end",
"def toggle_element(element)\n update_page do |page|\n page[element].toggle\n end\n end",
"def toggle(instance)\n # do nothing\n end",
"def hide_windows\n end",
"def toggle\n fire\n end",
"def moveToggle()\n @moveToggle_duration = @w_moveToggle.animationSpeed\n if (@w_moveToggle.x != 300 && @w_moveToggle.y != 250)\n @w_moveToggle.moveTo(300, 250)\n else\n @w_moveToggle.moveTo(350, 300)\n end\n end",
"def on_click\n @status_window_tb.hide\n $game_map.clear_next_highlights\n reset_aoe_follows\n #@spriteset.remove_group(DISPLAY_TB) # @spriteset.dispose_highlights_tb\n remove_show_hls\n end",
"def toggle(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n if @lights[i][j] == 0\r\n \t@lights[i][j] = 1\t\t \r\n\t else\r\n\t @lights[i][j] = 0\r\n\t end\r\n end\r\n end",
"def toggle\n @raid.toggle\n redirect_to :back\n end",
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def toggle_featured!\n self.update_attribute(:featured, !self.featured?)\n self.featured?\n end",
"def toggle_default_address\n self.address.default_address = !self.default_address\n self.outlets[\"default_address_button\"].setBackgroundColor(UIColor.colorWithPatternImage(UIImage.imageNamed(\"images/checkbox#{accepts_terms ? \"-checked\" : \"\"}.png\")), forState: UIControlStateNormal) \n end",
"def toggle(switches)\n 1.upto(1000) do |step|\n switches.map do |switch_num, on_or_off|\n if switch_num % step == 0\n switches[switch_num] = !on_or_off\n end\n end\n end\nend",
"def smart_screen_enable_in_shell\n return @smart_screen_enable_in_shell\n end",
"def update_usability_enable\n 8.times.each {|i| refresh_icons if @old_usability[i] != @actor.usability[i]}\n end",
"def toggle\n set_switch(!self.switch) if @switch\n method(@method).call(self.switch) if @method\n end",
"def screen_is_on?\n dpms_screen_is_on?\n end",
"def upDownToggle()\n @upDown_duration = 6\n @window.contents.clear_rect(Rect.new(0, 0, 400, 120))\n @sprite.bitmap.clear_rect(Rect.new(0, 0, 400, 120))\n @bitmap.clear_rect(Rect.new(0, 0, 400, 120))\n for uc in @uc_graphsToggle\n for elem in uc.elements\n if (elem.value == uc.max_value)\n @up = false\n elsif (elem.value == uc.min_value)\n @up = true\n end\n \n if (@up)\n elem.value += 5\n else\n elem.value -= 5\n end\n\n end\n uc.draw()\n end\n end",
"def show_windows\n end",
"def icon\n @power_up.icon\n end",
"def toggle_mute\n muted? ? unmute : mute\n end"
] | [
"0.5737684",
"0.57260805",
"0.5722228",
"0.5668005",
"0.562962",
"0.55806327",
"0.55647373",
"0.54940456",
"0.5484741",
"0.54819816",
"0.5476582",
"0.54455376",
"0.54334587",
"0.542164",
"0.5417264",
"0.5410405",
"0.5383721",
"0.53760374",
"0.53467005",
"0.5332184",
"0.5310901",
"0.52861816",
"0.5274652",
"0.52398694",
"0.52159494",
"0.5206468",
"0.5197336",
"0.5195483",
"0.51947373",
"0.5136265",
"0.51321316",
"0.5129263",
"0.51243144",
"0.51039004",
"0.5084407",
"0.50680536",
"0.506349",
"0.504456",
"0.5043535",
"0.50391567",
"0.5021999",
"0.50151324",
"0.50114304",
"0.5006806",
"0.4982669",
"0.49368092",
"0.49306822",
"0.49289206",
"0.49279314",
"0.4913999",
"0.4913999",
"0.49137834",
"0.49094635",
"0.48993045",
"0.4885679",
"0.48616442",
"0.4857686",
"0.4851568",
"0.4832625",
"0.48308077",
"0.48266026",
"0.48255178",
"0.48150635",
"0.48134205",
"0.47979146",
"0.47979146",
"0.479236",
"0.47873336",
"0.47745025",
"0.47702318",
"0.47608873",
"0.47269368",
"0.47124806",
"0.46940887",
"0.46906796",
"0.46905047",
"0.46887532",
"0.4686513",
"0.46819383",
"0.46743387",
"0.466814",
"0.4665876",
"0.46627492",
"0.46608293",
"0.46599555",
"0.46498287",
"0.46321484",
"0.46307367",
"0.4620829",
"0.4607815",
"0.45673463",
"0.45621836",
"0.45548084",
"0.4552909",
"0.45526314",
"0.4547668",
"0.45394698",
"0.4539249",
"0.4536246",
"0.45349237"
] | 0.7112464 | 0 |
Uploads the file and sets public_url attribute to the url of the remote S3 object === Parameters [file_path (String)] full path of the file to upload | def store!(file)
file_path = file.is_a?(String) ? file : file.path
basename = file.is_a?(String) ? File.basename(file) : file.original_filename
# Upload the file
o = s3_bucket.objects["#{asset_path}#{basename}"]
o.write(Pathname.new(file_path), {
acl: :public_read,
content_type: MIME::Types.type_for(file_path).first.to_s
})
# Set the public_url attribute
remote_url = o.public_url.to_s
self.set(public_url: remote_url)
self.this.update(public_url: remote_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end",
"def store!\n # Upload the file\n prefix = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n fname = prefix+(@file.respond_to?(:original_filename) ? @file.original_filename : File.basename(@file))\n o = s3_bucket.objects[\"#{asset_path}#{fname}\"]\n o.write(Pathname.new(@file.path), {\n acl: :public_read,\n content_type: MIME::Types.type_for(@file.path).first.to_s\n })\n\n # Set the public_url attribute\n remote_url = o.public_url.to_s\n self.set(public_url: remote_url)\n self.this.update(public_url: remote_url)\n end",
"def upload(file)\n # Upload the given file\n AWS::S3::S3Object.store( file,\n open( file ),\n BUCKET,\n :access => :public_read )\n\n # display the URL of the file just uploaded\n puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]\nend",
"def upload(bucket, file); end",
"def upload_file\n upload_thumb if Rails.configuration.thumbnails_enabled\n file_s3_obj.write(@file.tempfile.open, content_type: @file.content_type)\n end",
"def upload(bucket, key)\n connect_to_s3\n AWS::S3::S3Object.store(key, File.open(temp_file_path, 'r'), bucket, :access => :public_read)\n AWS::S3::S3Object.url_for(key, bucket, :authenticated => false)\n end",
"def upload_file(file)\n key_name = @prefix.dup\n key_name << File.basename(file)\n @right_s3_interface.put(@bucket, key_name , File.read(file) ) \n end",
"def save_file_to_s3_bucket(bucket, file)\n\n image_path = \"./public/tmp/#{file}\"\n connect_to_s3()\n s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])\n obj = s3.bucket(bucket).object(file)\n\n if obj.exists?\n cleanup_tmp_file(file)\n puts \"File #{file} already exists in the bucket.\"\n url = generate_url(bucket, file)\n else\n obj.upload_file(image_path)\n cleanup_tmp_file(file)\n puts \"Uploaded file (#{file}) to bucket (#{bucket}).\"\n url = generate_url(bucket, file)\n end\n\nend",
"def s3_upload(item)\n filepath = item.zip_file_path\n s3_key = item.s3_path\n s3_path = \"s3://#{s3_bucket}/#{s3_key}\"\n message = \"Uploading: #{filepath} to #{s3_path}\".color(:green)\n message = \"NOOP: #{message}\" if @options[:noop]\n puts message\n return if @options[:noop]\n\n s3.put_object(\n body: IO.read(filepath),\n bucket: s3_bucket,\n key: s3_key,\n )\n end",
"def save(file_path, bucket_name, key=SecureRandom.uuid)\n bucket_name = env_bucket_name(bucket_name)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:#{bucket_name}##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path, :server_side_encryption => 'AES256')\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end",
"def save(file_path, bucket_name, key=SecureRandom.uuid)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:<#{bucket_name}>##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path)\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end",
"def upload(file_name: nil, file_handle: nil, file_path: nil, sync: true)\n if file_path\n key = key_from_filename(file_path)\n puts \"Uploading #{file_path} to s3 with key #{key}\"\n File.open(file_path, 'rb') do |file|\n s3_client.put_object(key: key, body: file, bucket: bucket )\n end\n else\n key = key_from_filename(file_name)\n s3_client.put_object(key: key, body: file_handle.read, bucket: bucket)\n end\n sync_down if sync\n end",
"def save_file(upload)\n return false if upload.blank?\n name = self.id.to_s + \".\" + upload.original_filename\n\n self.aws_connect()\n \n # store the file to Amazon S3\n AWS::S3::S3Object.store(name, upload, 'assetmngr', :access => :public_read)\n self.filename = name\n self.save\n end",
"def upload_zip_to_s3(file_path, filename, connection)\n\tif !filename.include? \".zip\"\n\t\tfilename += \".zip\"\n\tend\n\ts3_key = \"zipped_packages/\" + filename\n\treturn connection.upload(file_path + filename, s3_key, :public_read, content_type=nil, metadata=nil)\nend",
"def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end",
"def save_file_to_s3_bucket(file)\n\n bucket = \"prototype-jv\"\n temp_file = \"./public/swap/#{file}\"\n s3_file_path = \"imageuploader/#{file}\"\n\n connect_to_s3()\n s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])\n obj = s3.bucket(bucket).object(s3_file_path)\n\n if obj.exists? # file already exists in bucket\n cleanup_swap_dir(file) # being called by process_photo() in photo_upload, review for Upload to Cloud\n puts \"Image already in bucket!\"\n else\n obj.upload_file(temp_file) # put file in bucket\n cleanup_swap_dir(file) # being called by process_photo() in photo_upload, review for Upload to Cloud\n puts \"Image uploaded to bucket!\"\n end\n\nend",
"def update_file_on_s3(file, objects)\n file_path = s3_file_path(file)\n conn = RedmineS3::Connection.conn\n object = objects[file_path]\n\n # get the file modified time, which will stay nil if the file doesn't exist yet\n # we could check if the file exists, but this saves a head request\n s3_mtime = object.last_modified rescue nil \n\n # put it on s3 if the file has been updated or it doesn't exist on s3 yet\n if s3_mtime.nil? || s3_mtime < File.mtime(file)\n fileObj = File.open(file, 'r')\n RedmineS3::Connection.put(file_path, fileObj.read)\n fileObj.close\n\n puts \"Put file \" + File.basename(file)\n else\n puts File.basename(file) + ' is up-to-date on S3'\n end\n end",
"def upload local_file_path, storage_file_path, encryption_key: nil\n unless @bucket.file storage_file_path\n @bucket.create_file local_file_path, storage_file_path,\n encryption_key: encryption_key\n end\n end",
"def upload_video_at_s3(filename, filepath) \n\t\tbegin\n\t\t\ts3 = Aws::S3::Resource.new\n\t\t\tobj = s3.bucket(ENV['AWS_S3_BUCKET'] || 'tv-guide-s3-bucket').object(filename)\n\t\t\tif obj.upload_file(filepath)\n\t\t\t\tself.update(video_filename: filename) \n\n\t\t\t\tFile.delete(filepath) \n\t\t\tend\n\t\trescue StandardError => e\n\t \tRails.logger.info \"================================================upload_video_at_s3:69\"\n\t \tRails.logger.info e\n\t\tend\n\tend",
"def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o.file.path)\n s3o.md5 = Digest::MD5.file(s3o.file.path).hexdigest\n s3o.save!\n\n [:created, :xml, XmlAdapter.uploaded_object(\"#{@request.host}:#{@request.port}\", s3o)]\n end",
"def uploadS3(name, file, prefz)\n return [false, \"S3 misconfigured\"] if prefz[:user].empty? && prefz[:host].empty? && prefz[:path].empty? && prefz[:url].empty? && prefz[:pass].empty?\n s3 = AFAmazonS3Client.alloc.initWithAccessKeyID(prefz[:user].strip, secret: prefz[:pass].strip)\n puts \"#{prefz[:user].strip.inspect} #{prefz[:pass].strip.inspect}\"\n bucket, path = prefz[:path].gsub(/^\\//, '').split('/', 2)\n s3.bucket = bucket\n NSLog(\"S3 bucket #{bucket}\")\n url = path.nil? ? \"https://#{prefz[:host]}/#{bucket}/\" : \"https://#{prefz[:host]}/#{bucket}/#{path}/#{name}\"\n NSLog(\"S3 destinationPath #{url}\")\n params = { \"Content-Type\" => \"image/png\", \"acl\" => \"public-read\" }\n s3.postObjectWithFile(file, destinationPath: \"/\", parameters: params,\n progress: lambda do |bytesWritten, totalBytesWritten, totalBytesExpectedToWrite|\n stats = (totalBytesWritten / (totalBytesExpectedToWrite * 1.0) * 100)\n NSLog(\"S3: #{file} uploaded #{stats}\")\n end,\n success: lambda do |response|\n NSLog(\"S3: #{file} uploaded successfully.\")\n uploadSuccess(url + \"/#{name}\")\n end,\n failure: lambda do |error|\n NSLog(\"S3: #{file} upload error: #{error.localizedDescription}\")\n uploadFailure(\"S3 Error: #{error.localizedDescription}\")\n end\n )\n nil\n end",
"def aws_call\n s3_object = AMAZON_S3_CLIENT.bucket(bucket_name).object(renamed_filename)\n s3_object.upload_file(\n file,\n metadata: file_metadata,\n content_type: 'text/csv'\n )\n end",
"def store\n result = QcloudCos.upload(path, file.to_file)\n\n if result != nil\n self.url = result\n end\n end",
"def uploadFile(localFilePath, destFilePath, maxAge = 172800) # 2 Days = 1,72,800 seconds \n ext = File.extname(localFilePath).downcase\n msgContentType = \"\"\n cacheControl = \"max-age=#{maxAge}, must-revalidate\"\n if (ext == \"\")\n contentType = 'text/html'\n msgContentType = \"No file-ext: \"\n elsif (Fh5::Config.instance.contentTypes && Fh5::Config.instance.contentTypes.has_key?(ext))\n contentType = Fh5::Config.instance.contentTypes[ext]\n msgContentType = \"Override for '#{ext}':\"\n else \n contentType = MimeMagic.by_path(destFilePath).type\n end\n @log.info(@logPrefix) {\"Upload: '#{destFilePath}' (#{msgContentType}#{contentType}) (#{cacheControl})\"}\n begin\n File.open(localFilePath) do |f|\n content = f.read\n @bucketAdmin.defaultBucket.put(destFilePath, content, {}, 'public-read', \n {'Content-Type' => contentType, 'Cache-Control' => cacheControl})\n end\n rescue\n @log.errorException($!, @logPrefix) {\"Failed to upload to: '#{destFilePath}'\"}\n\n return nil\n end\n \n # comment out stuff related to public links which doesn't seem to work for website bucket.\n # publicLink = @bucketAdmin.endpointBucket.key(destFilePath).public_link\n # @log.debug(@logPrefix) {\"Public link: '#{publicLink}' for file: '#{destFilePath}'\"}\n # return publicLink \n end",
"def putAsset(filePath, metadata)\n\n # Calculate the sha256 hash, and use it to form the s3 path\n sha256Sum = Digest::SHA256.file(filePath).hexdigest\n s3Path = \"#{getEnv(\"S3_BINARIES_PREFIX\")}/#{sha256Sum[0,2]}/#{sha256Sum[2,2]}/#{sha256Sum}\"\n\n # If the S3 file is already present, don't re-upload it.\n obj = $s3Bucket.object(s3Path)\n if !obj.exists? || $forceMode\n #puts \"Uploading #{filePath} to S3.\"\n obj.put(body: File.new(filePath),\n metadata: metadata.merge({\n original_path: filePath.sub(%r{.*/([^/]+/[^/]+)$}, '\\1'), # retain only last directory plus filename\n mime_type: MimeMagic.by_magic(File.open(filePath)).to_s\n }))\n end\n\n return sha256Sum\nend",
"def putAsset(filePath, metadata)\n\n # Calculate the sha256 hash, and use it to form the s3 path\n md5sum = Digest::MD5.file(filePath).hexdigest\n sha256Sum = Digest::SHA256.file(filePath).hexdigest\n s3Path = \"#{$s3Config.prefix}/binaries/#{sha256Sum[0,2]}/#{sha256Sum[2,2]}/#{sha256Sum}\"\n\n # If the S3 file is already correct, don't re-upload it.\n obj = $s3Bucket.object(s3Path)\n if !obj.exists? || obj.etag != \"\\\"#{md5sum}\\\"\"\n #puts \"Uploading #{filePath} to S3.\"\n obj.put(body: File.new(filePath),\n metadata: metadata.merge({\n original_path: filePath.sub(%r{.*/([^/]+/[^/]+)$}, '\\1'), # retain only last directory plus filename\n mime_type: MimeMagic.by_magic(File.open(filePath)).to_s\n }))\n obj.etag == \"\\\"#{md5sum}\\\"\" or raise(\"S3 returned md5 #{resp.etag.inspect} but we expected #{md5sum.inspect}\")\n end\n\n return sha256Sum\nend",
"def upload(file_path)\n parts = []\n file = AwsFile.create_from_path(file_path)\n default_part_size = file.default_part_size\n aws_file_uuid = file.uuid\n uploads_count = file.uploads_count\n parts = compute_parts(file_path, default_part_size)\n Parallel.each(parts, in_threads: S3MediaServerApi::Config.upload_thread_count) do |part|\n signed_upload_url = AwsFile.get_signed_upload_url(aws_file_uuid, part[:part_number])\n\n raise PartUploadError.new(\"Part #{part[:part_number]} wasn't uploaded\") unless upload_part(signed_upload_url, part[:body].read)\n end\n\n AwsFile.complete_upload(aws_file_uuid)\n ensure\n close_all_parts(parts)\n end",
"def upload_file( id_object, file_to_upload, folder_on_s3 )\n \n file_name = id_object.to_s + \"-\" + file_to_upload.original_filename.to_s\n path_uploaded_files = Rails.root.join('public','uploaded-files')\n uploaded_file = path_uploaded_files.to_s + \"/\" + file_name\n\n unless Dir.exist?(path_uploaded_files)\n FileUtils.mkdir_p(path_uploaded_files)\n end\n\n File.open(uploaded_file, 'wb') do |file|\n file.write(file_to_upload.read)\n end \n\n file_on_s3 = folder_on_s3 + \"/\" + file_name\n upload_file_to_aws_s3(uploaded_file, file_on_s3)\n\n FileUtils.rm(uploaded_file.to_s)\n\n end",
"def set_path\n @file_path = @s3_local_object.body.path\n end",
"def tag_and_upload(file, date = Date.current, s3_resource, bucketname,\n storage_class: DEFAULT_STORAGE_CLASS)\n date_tags = Backup.aws_date_tags(date)\n prefix = Backup.s3_backup_bucket_full_prefix(date)\n obj = s3_resource.bucket(bucketname).object(prefix + File.basename(file))\n obj.upload_file(file.path, { tagging: date_tags, storage_class: storage_class })\n end",
"def upload(resource, filename)\n _validate_presence_of resource, filename\n\n response = Github::S3Uploader.new(resource, filename).send\n response.body\n end",
"def write(path, file)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end",
"def uploadFile(key = \"\")\n key = 0 < key.length ? key : self.dispatched.fileName\n self.bucket.put(key, self.string)\n self.clear\n end",
"def upload\n\t AWS.config(access_key_id: @access_key, secret_access_key: @access_secret)\n\t s3 = AWS::S3.new \n\t key = File.basename(@zipfile_name)\n\t s3.buckets[@bucket_name].objects[key].write(:file => @zipfile_name)\n\t puts \"Uploading file #{@zipfile_name} to bucket #{@bucket_name}.\"\n\t FileUtils.rm_rf @zipfile_name\n\t end",
"def upload_file(bucket, key, data)\n bucket.put(key, data)\nend",
"def generate_url(bucket, file)\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: file)\n\nend",
"def upload_file(f)\n # grabs the compiled asset from public_path\n full_file_path = File.join(File.dirname(@manifest.dir), f)\n one_year = 31557600\n mime = Rack::Mime.mime_type(File.extname(f)) \n file = {\n :key => f,\n :public => true,\n :content_type => mime,\n :cache_control => \"public, max-age=#{one_year}\",\n :expires => CGI.rfc1123_date(Time.now + one_year) \n }\n\n gzipped = \"#{full_file_path}.gz\" \n\n if File.exists?(gzipped)\n original_size = File.size(full_file_path)\n gzipped_size = File.size(gzipped)\n\n if gzipped_size < original_size\n file.merge!({\n :body => File.open(gzipped),\n :content_encoding => 'gzip'\n })\n log \"Uploading #{gzipped} in place of #{f}\"\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Gzip exists but has larger file size, uploading #{f}\"\n end\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Uploading #{f}\"\n end\n # put in reduced redundancy option here later if desired\n\n file = bucket.files.create( file )\n end",
"def s3_updatefile(filename, filedata)\n s3_deletefile filename\n #AWS::S3::S3Object.store filename, filedata, QBUCKET.to_s, :access => :public_read\n AWS::S3::S3Object.store filename, filedata, IMAGES_BUCKET.to_s, :access => :public_read\n end",
"def upload_file(s3client,plaintext_key,filename,bucket)\r\n begin\r\n filebody = File.new(filename)\r\n s3enc = Aws::S3::Encryption::Client.new(encryption_key: plaintext_key,\r\n client: s3client)\r\n res = s3enc.put_object(bucket: bucket,\r\n key: filename,\r\n body: filebody)\r\n rescue Aws::S3::Errors::ServiceError => e\r\n puts \"upload failed: #{e}\"\r\n end\r\nend",
"def upload_file(from_path, file_name, opts={})\n return false unless valid?\n pub = !!opts[:public]\n object(file_name).upload_file(from_path)\n make_public(file_name) if pub\n end",
"def upload_to_s3(info, file_name)\n bucket_name = 'techops-tests'\n\n to_json_file(info, file_name)\n\n s3 = Aws::S3::Resource.new(\n region: 'ap-southeast-2',\n access_key_id: $options[:s3_key],\n secret_access_key: $options[:s3_secret]\n )\n\n file = File.basename file_name\n obj = s3.bucket(bucket_name).object(file)\n\n if obj.upload_file(file)\n puts \"Uploaded #{file} to bucket #{bucket_name}\"\n File.delete(file_name)\n else\n puts \"Could not upload #{file} to bucket #{bucket_name}!\"\n end\nend",
"def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end",
"def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end",
"def upload_file_to_aws(file_to_upload, content_type)\n\tputs \"Uploading file: \" + file_to_upload + \" to aws\"\n\tresponse = request_put(file_to_upload, content_type)\n\tputs response\nend",
"def upload_to_s3(s3)\n # do some validity checks\n if uploaded?\n logger.warn \"email #{id} already uploaded\"\n return\n end\n email_file = temp_filename\n raise \"missing raw file (#{email_file}) for email #{id}\" unless File.exist?(email_file)\n\n key = gen_s3_key\n if s3.upload(email_file, key)\n update_attributes(:s3_key => key, :size => File.size(email_file))\n FileUtils.rm email_file # Delete file from disk\n end \n end",
"def generate_url(folder, file)\n\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{file}\"\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: s3_file_path)\n\nend",
"def put(path, file, options = {})\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n content_md5 = Digest::MD5.file(file).base64digest\n content_type = options[:content_type] || 'image/jpg'\n date = gmtdate\n url = path_to_url(path)\n auth_sign = sign('PUT', bucket_path, content_md5, content_type, date)\n headers = {\n 'Authorization' => auth_sign,\n 'Content-Md5' => content_md5,\n 'Content-Type' => content_type,\n 'Content-Length' => file.size,\n 'Date' => date,\n 'Host' => @aliyun_upload_host,\n 'Expect' => '100-Continue'\n }\n response = RestClient.put(url, file, headers)\n response.code == 200 ? path_to_url(path) : nil\n end",
"def upload(objectname, filepath)\n prefix = @config['s3']['prefix']\n unless prefix.nil?\n objectname = File.join(prefix, objectname)\n end\n\n filepath = dir(filepath)\n\n # Generate hash of file\n hash = filehash filepath\n @s3touchedobjects << objectname\n # Get hash of version already uploaded, if available.\n begin\n object = AWS::S3::S3Object.find objectname, @bucketname\n oldhash = object.metadata['hash']\n rescue AWS::S3::NoSuchKey\n # File not uploaded yet\n oldhash = nil\n end\n unless hash == oldhash\n # Don't reupload if file hasn't changed\n puts \"#{objectname}: Uploading\"\n AWS::S3::S3Object.store(objectname, open(filepath), @bucketname, access: :public_read, 'x-amz-meta-hash' => hash)\n else\n puts \"#{objectname}: Not uploading, hasn't changed since last time.\"\n end\n end",
"def upload_job_script(file_path, bucket_resource)\n File.open(file_path) do |file|\n bucket_resource.client.put_object({\n body: file,\n bucket: bucket_resource.name,\n key: file_path\n })\n end\n rescue Aws::S3::Errors::S3UploadFailedError => e\n @logger.error(\"S3 could not upload job script: \\n#{e.message}\")\n raise\n end",
"def user_file_bucket=(s3_path)\n\t\t\tupdate_metadata(:user_file_bucket => s3_path)\n\t\t\treturn nil\n\t\tend",
"def upload_file(bucket_key, file_location, file_name, access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\n end",
"def s3_upload( file_name, destination_name )\n #log(\"Uploading #{file_name} to S3 as #{destination_name} ...\")\n #load keys\n json = File.read(S3KEYS)\n ak = JSON.parse(json)\n aws_access_key_id = ak['aws_access_key_id'] \n aws_secret_access_key = ak['aws_secret_access_key']\n\n #establish S3 connection \n s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key, {:logger =>Logger.new( File.open( LOG_FILE, 'a' ) )})\n bucket = s3.bucket(IOS_BUILDS_BUCKET)\n #upload file \n file = File.open( file_name )\n bucket.put( destination_name, file ) \nend",
"def upload(&block)\n @source.files.each do |key, file|\n object = @target.files.create({\n :key => key,\n :body => file,\n :public => true,\n :cache_control => 'max-age=0' # Disable cache on S3 so that future sharts are visible if folks web browsers.\n })\n block.call file, object\n end\n end",
"def put_filebucket_file(path, body:, environment:)\n headers = add_puppet_headers({\n 'Accept' => 'application/octet-stream',\n 'Content-Type' => 'application/octet-stream'\n })\n\n response = @client.put(\n with_base_url(\"/file_bucket_file/#{path}\"),\n body,\n headers: headers,\n params: {\n environment: environment\n }\n )\n\n process_response(response)\n\n response\n end",
"def put_filebucket_file(path, body:, environment:)\n headers = add_puppet_headers({\n 'Accept' => 'application/octet-stream',\n 'Content-Type' => 'application/octet-stream'\n })\n\n response = @client.put(\n with_base_url(\"/file_bucket_file/#{path}\"),\n body,\n headers: headers,\n params: {\n environment: environment\n }\n )\n\n process_response(response)\n\n response\n end",
"def upload(bucket, key, path)\n Monsove.logger.info(\"Uploading archive to #{key}\")\n\n @con.put_object(\n bucket, key, File.open(\"#{path}.tar.bz2\", 'r'),\n {'x-amz-acl' => 'private', 'Content-Type' => 'application/x-tar'}\n )\n end",
"def upload_multipart(file, opts = {})\n @opts = opts\n\n create_object(*S3Client.s3_params).write(content_length: file.size) do |buffer, bytes|\n buffer.write(file.read(bytes))\n end\n end",
"def quick_s3_upload\n end",
"def upload(tempfile, filename)\n Rails.logger.debug \" Uploading filename...\"\n s3_path = File.join(self.full_path_prefix, filename)\n AWS::S3::S3Object.store(s3_path, tempfile.open, AWS_CONFIG['s3']['bucket_name'], :access => :public_read) # reopen the tempfile and write directly to S3\n Rails.logger.debug \" ** Uploaded image to S3: #{s3_path}\"\n ensure\n # tempfile.unlink\n end",
"def store_on_s3(options)\n # Deleting :url from options because we don't want it in the options that we pass to s3\n # and removing some characters that aren't allowed in urls\n url = options.delete(:url).gsub(/ /, '%20').gsub(/\\^/, '%5E')\n file = open(url)\n \n key = options.delete(:key)\n\n AWS::S3::S3Object.store(key, file, @bucket, options)\n\n # Return location on s3\n \"http://s3.amazonaws.com/\" + @bucket + \"/\" + key\n end",
"def s3(s3_bucket, artifact_path)\n @url = \"https://s3.amazonaws.com/#{s3_bucket}/#{artifact_path}\"\n parse_url\n self\n end",
"def save_to_s3(file_name, listing_id)\n connect_to_s3() if ! @s3\n obj = @s3.bucket(S3_BUCKET).object(file_name)\n obj.upload_file('tmp/tmp.jpg')\n end",
"def deliver(file, callback=:delivered)\n\t\t\toptions = {}\n\t\t\t(options[:access] = file[\"access\"].to_sym) if ALLOWED_ACCESS_MODES.include?(file[\"access\"])\n\t\t\t\n\t\t\tAWS::S3::S3Object.store(\n\t\t\t\tfile[\"filename\"],\t\t# key\n\t\t\t\topen(file[\"path\"]),\t# data\n\t\t\t\tfile[\"bucket\"],\t\t\t# bucket\n\t\t\t\toptions\n\t\t\t)\n\t\t\[email protected](callback, file)\n\t\trescue Exception => error\n\t\t\tS3Shuttle::Server.logger.error(error)\n\t\tend",
"def aws_put_file(bucket, key, content, **opt)\n meth = opt.delete(:meth) || calling_method\n client = opt.delete(:client)\n client ||= (bucket.client if bucket.is_a?(Aws::S3::Bucket))\n client ||= s3_client(**opt)\n params = { bucket: bucket, key: key }\n # @type [Types::CopyObjectOutput, Types::PutObjectOutput] response\n response =\n if content.is_a?(Aws::S3::Object)\n params[:copy_source] = \"#{content.bucket_name}/#{content.key}\"\n client.copy_object(params, opt)\n else\n # noinspection RubyMismatchedArgumentType\n params[:body] = content.is_a?(String) ? StringIO.new(content) : content\n client.put_object(params, opt)\n end\n Log.debug { \"#{meth}: AWS S3 response: #{response.inspect} \" }\n key\n rescue => error\n set_error(error)\n # noinspection RubyScope\n Log.warn { \"#{meth}: AWS S3 failure: #{error.class}: #{error.message}\" }\n end",
"def update\n @event = @account.events.find(params[:id])\n file = params[:event][:photo_url]\n public_url = nil\n if file != nil\n s3 = Aws::S3::Resource.new(region: 'us-east-1')\n bucket = 'fifo-cloud'\n # Get just the file name\n name = file.original_filename\n # Create the object to upload\n obj = s3.bucket(bucket).object(name)\n # Create the option\n options = {\n acl: \"public-read\",\n metadata: {\n collection: \"events\",\n title: params[:event][:title],\n source: @event.id.to_s\n }\n }\n obj.upload_file(file.tempfile, options)\n public_url = s3.bucket(bucket).object(name).public_url\n end\n respond_to do |format|\n if @event.update_attributes!(event_params(public_url))\n\n if public_url != nil\n @upload = Upload.new(\n url: public_url,\n name: name,\n event_id: @event.id,\n collection: 'events',\n account_id: @account.id\n ).save!\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end",
"def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end",
"def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\n end",
"def punch\n s3 = Aws::S3::Resource.new(region: ENV['S3_REGION'])\n obj = s3.bucket(ENV['S3_BUCKET']).object(@name)\n \n begin\n # Upload the file\n obj.upload_file(\n @file.path,\n content_type: MimeMagic.by_path(@file.path).type,\n acl:'public-read'\n )\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n return false\n end\n \n # Create an object for the upload\n return upload = {\n file_name: obj.key,\n file_url: obj.public_url,\n file_type: obj.content_type,\n file_size: obj.size\n }\n \n end",
"def set(key, tmp_file)\n begin\n retryable(:tries => 5) do\n Merb.logger.info \"Upload to S3\"\n S3VideoObject.store(key, File.open(tmp_file), :access => :public_read)\n sleep 3\n end\n rescue AWS::S3::S3Exception\n Merb.logger.error \"Error uploading #{key} to S3\"\n raise\n else\n true\n end\n end",
"def file_path\n public_filename =~ Issuu::S3 ? public_filename : \"#{RAILS_ROOT}/public#{public_filename}\"\n end",
"def writenc(path, file)\n bucket\n @@mutex.synchronize do\n path = find_available_name(path)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end\n path\n end",
"def upload_bucket\n ::AWS::S3.new( { :secure => false } ).buckets['s3.documentcloud.org']\n end",
"def save(file, path)\n file = File.open(file.path)\n\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n directory.files.create(self.options(path).merge(self.permissions.merge(:key => path, :body => file)))\n\n file.close\n end",
"def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)\n \n checksum64 = Base64.encode64([sandbox_file_checksum].pack(\"H*\")).strip\n timestamp = Time.now.utc.iso8601\n file_contents = File.read(sandbox_filename)\n # TODO - 5/28/2010, cw: make signing and sending the request streaming\n sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n :http_method => :put,\n :path => URI.parse(url).path,\n :body => file_contents,\n :timestamp => timestamp,\n :user_id => rest.client_name\n )\n headers = { \n 'content-type' => 'application/x-binary', \n 'content-md5' => checksum64, \n :accept => 'application/json'\n }\n headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))\n\n # Don't set inflated_response as S3 (for the Platform) doesn't return JSON.\n # Only Open Source does.\n self.inflated_response = nil\n self.exception = nil\n self.api_response = RestClient::Request.execute(\n :method => :put, \n :url => url, \n :headers => headers, \n :payload => file_contents\n )\nend",
"def store!(file)\n f = CarrierWave::Storage::SFTP::File.new(uploader, self, uploader.store_path)\n f.store(file)\n f\n end",
"def upload_file(file, destination)\n body = IO.open(file).read\n image_cache_dir.create(key: destination, body: body, public: true)\n end",
"def upload_file(bucket_name:, key:, file:, **opts)\n if opts[:acl] && opts[:acl]&.to_s == 'public-read'\n opts[:acl] = :public_read\n end\n\n result = get_bucket!(bucket_name).create_file file.path, key, **opts\n return {\n checksum: result.crc32c\n }\n end",
"def store_object_in_s3\n @logger.info(\"storing photo for student_id: ##{student.id} to s3...\")\n\n # s3 filenames are sorted by student / upload date / image.\n # Filename shape: {64-character hash} / {YYYY}-{MM}-{DD} / {64-character hash}.\n s3_filename = [\n Digest::SHA256.hexdigest(@local_id),\n @time_now.strftime('%Y-%m-%d'),\n image_file_digest\n ].join('/')\n\n response = @s3_client.put_object(\n bucket: ENV['AWS_S3_PHOTOS_BUCKET'],\n key: s3_filename,\n body: File.open(@path_to_file),\n server_side_encryption: 'AES256'\n )\n\n if response\n @logger.info(\" successfully stored to s3!\")\n @logger.info(\" encrypted with: #{response[:server_side_encryption]}\")\n s3_filename\n else\n @logger.error(\" error storing photo in s3.\")\n nil\n end\n end",
"def file_path\n public_filename =~ ScribdFu::S3 ? public_filename : \"#{RAILS_ROOT}/public#{public_filename}\"\n end",
"def upload(file_path, options = {})\n Upload.new(file_path, self, options).upload!\n end",
"def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end",
"def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend",
"def make_public(file_name)\n object(file_name).acl.put({acl: \"public-read\"})\n end",
"def call\n validate\n upload_to_s3\n renamed_filename\n end",
"def upload_file\n #TODO\n end",
"def upload(obj, file_path)\n begin\n res = scribd_user.upload(:file => escape(file_path), :access => access_level)\n obj.update_attributes({:ipaper_id => res.doc_id, :ipaper_access_key => res.access_key})\n rescue\n raise ScribdFuUploadError, \"Sorry, but #{obj.class} ##{obj.id} could not be uploaded to Scribd. \"\n end\n end",
"def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end",
"def commit_file\n if @upload.public? && @upload.file_type.public? && @upload.address.blank? && (@upload.creating? || @upload.failed?)\n BlockchainCommitJob.perform_later(@upload.id)\n end\n end",
"def upload_file(path, format, file)\n delete path\n append_from_file(path, format, file)\n end",
"def save_tmp_file(upload_hash)\n\n tmp_dir = \"./public/tmp\"\n image = File.binread(upload_hash[\"image\"][:tempfile]) # open image file\n\n f = File.new \"#{tmp_dir}/#{upload_hash[\"image\"][:filename]}\", \"wb\"\n f.write(image)\n f.close if f\n\n puts \"save_tmp_file() - uploaded file saved to temp directory!\"\n url = save_file_to_s3_bucket(\"prototype-jv\", \"#{upload_hash[\"image\"][:filename]}\")\n\nend",
"def delete_s3_file(file)\n\n bucket = \"prototype-jv\"\n s3_file_path = \"imageuploader/#{file}\"\n s3 = connect_to_s3()\n\n s3.delete_object({\n bucket: bucket,\n key: s3_file_path\n })\n\nend",
"def upload(bucket, local_dir, remote_subdir=nil)\n puts \"> AWS Upload: #{bucket}\".yellow\n puts \" SUBDIR: #{remote_subdir}\".yellow unless remote_subdir.nil?\n puts \" SOURCE: #{local_dir}\".yellow\n raise FileNotFound.new(local_dir) unless File.exists?(local_dir)\n\n s3 = Aws::S3::Resource.new(client: s3_client)\n bucket = s3.bucket(bucket)\n\n files = Dir.glob(File.join(local_dir, '**/*')).reject { |f| File.directory?(f) }\n dir_prefix = (local_dir.end_with?('/')) ? local_dir : \"#{local_dir}/\"\n puts \"> Uploading #{files.size} files\".yellow\n progressbar = ProgressBar.create(title: ' AWS::Put'.yellow, total: files.size)\n files.each do |file|\n rel_path = file.delete_prefix(dir_prefix)\n file_path = (remote_subdir.nil?) ? rel_path : File.join(remote_subdir, rel_path)\n bucket.object(file_path).upload_file(file) do |response|\n progressbar.increment\n end\n # s3.put_object(\n # body: file,\n # bucket: bucket,\n # key: File.join(remote_subdir, File.basename(file))\n # )\n end\n progressbar.finish unless progressbar.finished?\n end",
"def transfer_and_cleanup\n direct_upload_url_data = DIRECT_UPLOAD_URL_FORMAT.match(self.direct_upload_url)\n s3 = AWS::S3.new\n self.image = URI.parse(URI.escape(self.direct_upload_url))\n self.save\n s3.buckets[Rails.configuration.aws[:bucket]].objects[direct_upload_url_data[:path]].delete\n end",
"def set_public\n file = session[:user].x_files.get(params[:id])\n # first check if it exist and if it synchronized then => error\n raise RequestError.new(:bad_param, \"Can not set a synchronized file as public\") if file && file.user != session[:user]\n # second if it not exist take a look into the shared_to_me files\n file = session[:user].x_files_shared_to_me.get(params[:id]) unless file\n # thrid if it still does not exist => error\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n # fourth check for root folder OR not uploaded\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not set the root folder as public\") if file.id == session[:user].root_folder.id\n\n file.public = true if params[:public] == \"true\"\n file.public = false if params[:public] == \"false\"\n file.save\n @result = { file: file.description(session[:user]), success: true }\n end",
"def upload!()\n file_number = 0\n\n total_files = @files.length\n\n @files.each do |file|\n file_number += 1\n\n print \"\\rUploading... [#{file_number}/#{total_files}]\"\n\n next if File.directory? file\n\n # Get the path relative to containing directory\n path = file.gsub(/^#{@folder_path}\\//, '')\n\n options = { :acl => \"authenticated-read\" }\n\n if MIME::Types.type_for(file).count > 0\n options[:content_type] = MIME::Types.type_for(file).first.to_str\n end\n\n @s3_bucket.object(path).upload_file(file, options)\n end\n\n puts \"\\rUpload complete!\".ljust 80\n end",
"def direct_s3_presigned_url\n Stash::Aws::S3.presigned_download_url(s3_key: \"#{resource.s3_dir_name(type: 'supplemental')}/#{upload_file_name}\")\n end",
"def put_file(destination, file)\n href = self.class.get_href(destination)\n @rest_logger.info \"#{__method__.to_s.upcase}\\t#{href}\"\n response = @file_uploader.upload(href, file, @cookies)\n response\n end",
"def keep_trying_to_upload(file_to_upload,bucket)\n uploaded = false\n until uploaded == true\n begin\n retval = AWS::S3::S3Object.store(\n File.basename(file_to_upload),\n open(file_to_upload),\n bucket,\n :access => :public_read)\n rescue IOError => e\n puts \"IOError happened uploading '#{file_to_upload}' ('#{e.message}'): retrying.\\n\"\n else\n puts \"#{file_to_upload} uploaded.\\n\"\n uploaded = true\n end\n end\n end",
"def send_to_s3(img, name)\n s3_directory.files.create({\n key: \"#{name}.jpg\",\n body: img,\n public: true\n })\nend"
] | [
"0.8397492",
"0.7654236",
"0.7621614",
"0.70696557",
"0.7064327",
"0.7064021",
"0.7059148",
"0.68869674",
"0.6814998",
"0.6814421",
"0.6767916",
"0.6710564",
"0.6661792",
"0.66418314",
"0.66396815",
"0.6596707",
"0.65942234",
"0.65939456",
"0.6585862",
"0.65602803",
"0.6478759",
"0.6476652",
"0.6459653",
"0.64519703",
"0.64468914",
"0.6443758",
"0.6439368",
"0.6425839",
"0.6400577",
"0.63956064",
"0.6393494",
"0.63759214",
"0.6353324",
"0.6352453",
"0.6331987",
"0.63164073",
"0.6306263",
"0.628669",
"0.6271422",
"0.62635404",
"0.6230125",
"0.6225808",
"0.6225808",
"0.62137294",
"0.62132144",
"0.62048686",
"0.617213",
"0.6165652",
"0.61559147",
"0.611611",
"0.61151534",
"0.61025685",
"0.6097783",
"0.60553473",
"0.60553473",
"0.6044998",
"0.6044171",
"0.60432947",
"0.60413265",
"0.60342675",
"0.60318506",
"0.6030836",
"0.60030836",
"0.6002401",
"0.5994052",
"0.5985815",
"0.5985815",
"0.59853506",
"0.59815073",
"0.5972761",
"0.5950104",
"0.593114",
"0.5919498",
"0.5911866",
"0.5903124",
"0.5902507",
"0.5894385",
"0.5890497",
"0.5875638",
"0.58684367",
"0.5861127",
"0.5854153",
"0.5851609",
"0.5842736",
"0.583599",
"0.5831143",
"0.5827283",
"0.58099556",
"0.5807978",
"0.5807015",
"0.58046407",
"0.5793093",
"0.57921344",
"0.5775318",
"0.57710403",
"0.5766679",
"0.57579106",
"0.5756094",
"0.5741051",
"0.5725657"
] | 0.7955411 | 1 |
Removes the remote file | def remove!
basename = File.basename(public_url)
o = s3_bucket.objects["#{asset_path}#{basename}"]
o.delete
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end",
"def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end",
"def files_remote_remove(options = {})\n post('files.remote.remove', options)\n end",
"def destroy(remote_path)\n get_adapter.delete_file(remote_path)\n end",
"def remove!\n messages = []\n transferred_files do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.message messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end",
"def delete(remote_filepath)\n @request = Net::HTTP::Delete.new(::File.join(@uri.path, remote_filepath))\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.body.presence || @response.code.to_i\n end",
"def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end",
"def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end",
"def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end",
"def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end",
"def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end",
"def delete_file( path )\n # removes a file at path\n connection.delete( path )\n last_ftp_command_ok?\n end",
"def remove_remote(name)\n self.lib.remote_remove(name)\n end",
"def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end",
"def remove_file(sftp_session, remote_path, local_path)\n\n if local_path\n\n # remove the local file\n FilUtils.remove(local_path)\n elsif remote_path\n\n # remote the remote file, we need to block on this in case the\n # parent directory is removed next.\n sftp_session.remove!(remote_path)\n end\n end",
"def smb_file_rm(file)\n fd = smb_open(file, 'ro')\n fd.delete\nend",
"def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end",
"def ftp_remove path\n return ftp_action(true, path)\n end",
"def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end",
"def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end",
"def handle_remote_file(url, pid)\n local_path = download_remote_file(url, pid)\n return local_path unless zip_file?(local_path)\n\n extracted_local_zip = extract_local_zip(local_path, pid)\n FileUtils.rm_rf(local_path)\n extracted_local_zip\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def del\n File.delete(@file)\n end",
"def destroy\n file&.delete\n end",
"def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend",
"def remove!(package)\n remote_path = remote_path_for(package)\n\n messages = []\n transferred_files_for(package) do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.info messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def destroy_file\n File.delete full_file_path\n rescue\n end",
"def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end",
"def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end",
"def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def remove_file(file)\n begin\n @ftp.delete(file)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end",
"def remove(filename)\n send_request(FXP_REMOVE, :string, filename)\n end",
"def remove!(package)\n remote_path = remote_path_for(package)\n\n transferred_files_for(package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started removing '#{ local_file }' \" +\n \"from container '#{ container }'.\"\n connection.delete_object(container, File.join(remote_path, remote_file))\n end\n end",
"def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end",
"def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end",
"def rm(location)\n @client.file_delete(location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def remove(files)\n requests = batch(files) do |file, connection|\n yield(file) if block_given?\n connection.remove(join_with_path(file))\n end\n failures = requests.reject{|request| request.response.ok?}\n if not(failures.empty?)\n summary = failures.map{|request| request.response.to_s}.join('; ')\n raise Error::File::Remote::SFTP, \"SFTP removal failed: #{summary}\"\n end\n end",
"def remove!(package)\n remote_path = remote_path_for(package)\n\n messages = []\n transferred_files_for(package) do |local_file, remote_file|\n messages << \"#{storage_name} started removing \" +\n \"'#{ local_file }' from Dropbox.\"\n end\n Logger.info messages.join(\"\\n\")\n\n connection.file_delete(remote_path)\n end",
"def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend",
"def remove(filename); end",
"def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end",
"def delete\n ::File.unlink(@path)\n end",
"def unlink\n self.class.unlink(@path)\n end",
"def remove!(package)\n remote_path = remote_path_for(package)\n\n connection.sync_clock\n\n transferred_files_for(package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started removing \" +\n \"'#{ local_file }' from bucket '#{ bucket }'.\"\n\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n end\n end",
"def remove_from_server(files)\n files.each do |filename|\n Rails.logger.info 'Deleting: %s' % filename\n @sftp_client.delete(nil, filename)\n end\n end",
"def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"def remove_content\n File.unlink(filename) if File.exist?(filename)\n end",
"def smb_rm(filename, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end",
"def delete\n @file = nil\n # file.delete\n end",
"def destroy\n @file_version.destroy\n head :no_content\n end",
"def rm path\n end",
"def update_remotely_deleted(file, node)\n #\n if node != ancestor.file_node(file) && !overwrite?\n if UI.ask(\"local changed #{file} which remote deleted\\n\" +\n \"use (c)hanged version or (d)elete?\") == \"d\"\n then remove file\n else add file\n end\n else\n remove file\n end\n end",
"def del_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_rm_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} rm #{file_path}\"\n log.info(x) { \"[git] file remove command => #{git_rm_cmd}\" }\n %x[#{git_rm_cmd}];\n log.info(x) { \"[git] has removed #{file_path} from repo and working copy.\" }\n\n end",
"def unshare_file_in_db(file_id, user_id)\n $db.execute(\"DELETE FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id)\nend",
"def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end",
"def remove_storage_file\n FileUtils.rm(file_path)\n end",
"def remove_local_file(file, user)\n logger.debug(\"removing local file #{file.uid} by user #{user.dxuser}\")\n UserFile.transaction do\n # Use find_by(file.id) since file.reload may raise ActiveRecord::RecordNotFound\n file = UserFile.find_by(id: file.id)\n return unless file\n\n Event::FileDeleted.create_for(file, user)\n file.destroy!\n end\n end",
"def clean_remote!\n resp = @connection.get_bucket(\n @storage.bucket, prefix: File.dirname(@remote_path)\n )\n keys = resp.body['Contents'].map {|item| item['Key'] }\n\n @connection.delete_multiple_objects(@storage.bucket, keys) unless keys.empty?\n end",
"def rm\n FileUtils.rm path if File.exist?(path)\n end",
"def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end",
"def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end",
"def test_delete_file\n remote_file_name = 'TestDeleteFile.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFileRequest.new(path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.delete_file(request)\n end",
"def delete(id)\n Net::SFTP.start(@host, @user, @password) do |sftp|\n sftp.remove!(url(id))\n end\n end",
"def delete_file(filename)\n http.delete([204,404], luwak, escape(filename))\n true\n end",
"def delete_file(file)\n delete_attachment(file)\n end",
"def clean_remote\n to_delete = remote_assets - local_compiled_assets\n to_delete.each do |f|\n delete_remote_asset(bucket.files.get(f))\n end\n end",
"def unlink!( target = path )\n delete_file_and_folder! target if target\n end",
"def rm(path)\n run_via \"rm #{path}\"\n end",
"def remove_local_copy\n Dir.chdir(self.study.data_store_path)\n if File.exists?(self.download_location)\n File.delete(self.download_location)\n subdir = self.remote_location.blank? ? self.id : self.remote_location.split('/').first\n if Dir.exist?(subdir) && Dir.entries(subdir).delete_if {|e| e.start_with?('.')}.empty?\n Dir.rmdir(subdir)\n end\n end\n end",
"def clean_local_file\n File.delete(@file_path) if File.exist? @file_path\n end",
"def drop\n File.unlink @file if File.exist?(@file)\n self\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def remove_file(path)\n FileUtils.rm_f(path)\n end",
"def remove_file(path)\n FileUtils.rm_f(path)\n end",
"def delete\n delete_from_server single_url\n end",
"def remove_file(file)\n File.delete(file) if File.exist?(file)\nend",
"def remove_file(filename, options={})\n end",
"def destroy\n remove_files(@path + \"*\")\n end",
"def delete\n File.delete(file_name)\n rescue\n # ignore\n end",
"def delete(filename); end",
"def file_delete(file)\n\t\tputs \"Delete the local host repository entries from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\thosts=file_2_list(file)\n\t\tchanges=bulk_delete(hosts)\n\t\tputs \"Delete done.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def remove_file src\n src = src.src if src.respond_to? :src # if passed an OpenStruct e.g.\n trace { \"remove_file: removing file '#{src}' [nuget model: package]\" }\n @files = @files.reject { |f| f.src == src }\n end",
"def delete_file\n @file = []\n end",
"def remove_challenge(challenge)\n check_connection!\n @logger.debug(\"Removing challenge file at #{challenge} on server=#{self.name}\")\n retval = @ssh.exec!(\"test -f '#{challenge}' && rm -f '#{challenge}' && echo -n success\").chomp\n if retval != \"success\"\n return false\n end\n return true\n end",
"def delete_file(file_name)\n fail 'No Structure ID defined for structure. Can\\'t delete file' if @structure.id.nil?\n\n data = Hashie::Mash.new\n data.structure_id = @structure.id\n data.file_name = file_name\n\n push_file('api/remove_file', MultiJson.dump(data))\n end",
"def unlink_site\n FileUtils.rm_rf(self.absolute_path) if File.exists?(self.absolute_path)\n end",
"def delete_file\n\n #delete the file\n Chef::Log.debug \"DEBUG: Removing file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.delete(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\")\n\nend",
"def remove_file\n return unless file_exists?\n\n s3_object(false).delete\n rescue => e\n Rails.logger.error \"Unable to delete file #{self.filename}: #{e.message}\"\n end",
"def destroy\n @upload_file_to_server.destroy\n respond_to do |format|\n format.html { redirect_to upload_file_to_servers_url, notice: 'Upload file to server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def removed_cookbook_file(path)\n end",
"def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end",
"def delete_github_repo_file\n # commit\n commit_to_github(@repo, post_params)\n end",
"def remove(uploaded_file, context)\n uploaded_file.delete\n end",
"def delete_firmware_file(file)\n response = request(:delete, \"/devmgr/v2/firmware/upload/#{file}\")\n status(response, 204, 'Failed to delete firmware file')\n end"
] | [
"0.8950435",
"0.8494948",
"0.80176824",
"0.7825574",
"0.76300585",
"0.7509187",
"0.7505245",
"0.7477317",
"0.7477317",
"0.7431123",
"0.73337185",
"0.7191782",
"0.70872396",
"0.7061084",
"0.70378965",
"0.6989666",
"0.6987884",
"0.6973254",
"0.6924938",
"0.69206935",
"0.6912956",
"0.6912956",
"0.6889996",
"0.68331605",
"0.68136024",
"0.68040645",
"0.6798219",
"0.67910975",
"0.67842525",
"0.6762795",
"0.6751176",
"0.67507774",
"0.67431927",
"0.6724378",
"0.67210895",
"0.67154497",
"0.67154497",
"0.66717875",
"0.66536486",
"0.6629689",
"0.6612053",
"0.65979296",
"0.659511",
"0.6589535",
"0.6572972",
"0.6568737",
"0.65672106",
"0.65282923",
"0.6527411",
"0.6523223",
"0.65214175",
"0.65211564",
"0.64957327",
"0.64943546",
"0.64873964",
"0.6456666",
"0.6451384",
"0.64365155",
"0.6435505",
"0.6431311",
"0.64306355",
"0.642996",
"0.64269716",
"0.6413226",
"0.6396952",
"0.63879174",
"0.6382702",
"0.6359986",
"0.6356202",
"0.63390565",
"0.6327975",
"0.63121957",
"0.6287488",
"0.62853277",
"0.6279692",
"0.6259055",
"0.625792",
"0.6252547",
"0.6248487",
"0.6246155",
"0.6246155",
"0.62404364",
"0.6231249",
"0.6229469",
"0.6212546",
"0.6200986",
"0.6193751",
"0.6192807",
"0.6181925",
"0.61760646",
"0.61581695",
"0.6136576",
"0.6135544",
"0.61347896",
"0.6134194",
"0.6130828",
"0.61284953",
"0.61242914",
"0.6120379",
"0.6117642",
"0.60885864"
] | 0.0 | -1 |
Path to the file, relative to the storage system | def asset_path
"user/#{self.user_id}/assets/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_path\n storage.file_path(self.class, @id)\n end",
"def filepath\n base = storage_root_path\n if base\n File.join(base, storage_key)\n else\n raise StandardError.new(\"no filesystem path found for datafile: #{self.web_id}\")\n end\n end",
"def stored_file_path\n File.join(path, stored_name)\n end",
"def path\n @file.path\n end",
"def path\n ::File.join(@folder, @file)\n end",
"def path\n @file\n end",
"def file_path\n dir\n end",
"def path\n File.join(STORAGE_PATH, @resource.subject_uri.path)\n end",
"def get_file_path\n @path\n end",
"def path\n File.join(self.folder, self.filename)\n end",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def path\n @file\n end",
"def path\n @file.path\n end",
"def file_path; end",
"def path\n self.file.to_s\n end",
"def path\n file.url\n end",
"def storage_path\n File.join(\n SystemConfiguration.first.storage_path,\n url_part)\n end",
"def file_path\n File.join(dir,filename)\n end",
"def file_path\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def file_path\n FileUtils.mkdir_p @path unless Dir.exist? @path\n\n @path\n end",
"def file_path\n\t\tself.class.file_path\n\tend",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def path_of(path)\n File.join(self.path, path)\n end",
"def filepath\n\t\t\tFile.join(TsungWrapper.config_dir, 'data', @filename)\n\t\tend",
"def path\n File.join(@base, @name)\n end",
"def storage_path\n File.join(organization.storage_path, url_part)\n end",
"def path\n File.join(self.drive.path, self.relative_path)\n end",
"def path\n @filename\n end",
"def path\n File.join(@base, @name)\n end",
"def file\n File.join(root, FILENAME)\n end",
"def path\n (public_path + sitemaps_path + filename).expand_path.to_s\n end",
"def filePath()\n return File.join(@@publicDir, @@tracksDir, \"#{self.fileName}#{self.fileType}\").to_s\n end",
"def file\n File.join(directory, @file)\n end",
"def generate_storage_path\n update_column(:file, File.join(File.dirname(request.file),\n \"#{id}-response.xml\"))\n end",
"def path\n @path ||= File.join(folder.path, filename)\n end",
"def file_path\n dir_name + file_name\n end",
"def path\n return self.saved? ? @realfile.path : nil\n end",
"def file_path\n File.join(AssetMapper.assets_dir, filename)\n end",
"def storage_path\n File.join(department.institution.storage_path, url_part)\n end",
"def filepath\n File.join(Myreplicator.configs[@export_obj.source_schema][\"export_stg_dir\"], @export_obj.filename)\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def path()\n file = File.join(Eddy.config.tmp_dir, \"eddy_persistent_data.json\")\n # FileUtils.mkdir_p(File.dirname(file))\n return Pathname.new(file)\n end",
"def full_path\n File.join(@path, @name)\n end",
"def fullpath\n File.expand_path( @file )\n end",
"def full_file_path\n Rails.root.join('uploads', filepath).to_s\n end",
"def file_path_for(file)\n ActiveStorage::Blob.service.send(:path_for, file.key)\n end",
"def file_path\n File.join device.path, id.to_s(16)\n end",
"def file_path\n PATH_USER_DEFAULTS\n end",
"def file_path\n self.class.file_path\n end",
"def file_path\n self.class.file_path\n end",
"def file_path\n self.class.file_path\n end",
"def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end",
"def file_path(filename)\n File.join(path, filename)\n end",
"def local_path\n @io.local_path\n end",
"def path\n \"/#{UPLOAD_DIR}/#{filename}\"\n end",
"def path\n if [email protected]? && File.exists?(@path)\n @path\n end\n end",
"def local_file_path\n afilePath = building.local_path + SAVE_PATH + id.to_s\n\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix\n end\n\n afilePath \n end",
"def path\n return if @file.blank?\n if is_path?\n File.expand_path(@file)\n elsif @file.respond_to?(:path) && [email protected]?\n File.expand_path(@file.path)\n end\n end",
"def file_path(file_name)\n File.join(Rails.root, 'public', 'csv_data', file_name)\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def file\n @pathname.to_s\n end",
"def current_path\n file.try(:path)\n end",
"def storage_path(file_name, user_address)\n directory = File.absolute_path?(Rails.configuration.storagePath) ? Rails.configuration.storagePath\n : Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address)) # get the path to the directory for the host address\n\n # create a new directory if it doesn't exist\n unless File.directory?(directory)\n FileUtils.mkdir_p(directory)\n end\n\n # put the given file to this directory\n File.join(directory, File.basename(file_name))\n end",
"def path\n @reader.path\n end",
"def storage_path\n return nil unless db.running?\n db.storage_path\n end",
"def path\n data.path\n end",
"def path\n data.path\n end",
"def filepath\n File.join(RedmicaS3::Connection.import_folder.presence, self.filename.presence) if super\n end",
"def root_file_path; end",
"def storage_path\n File.join(\n SystemConfiguration.first.storage_path, 'users', email)\n end",
"def path\n @directory.path\n end",
"def path\n @path ||= Pathname.new(dir) + filename\n end",
"def path\n File.join(RH_CONFIG[\"location\"], self.parent.pid.gsub(/:/,\"_\"), \"data\", self.name.first) unless self.parent.nil? or self.name.empty?\n end",
"def path\n \"%s/%s\" % [dirname, filename]\n end",
"def full_filename\n File.join(path, self.disk_filename)\n end",
"def filepath\n @epub.manifest.path_from_id(@id)\n end",
"def ext_path\n \"/#{@file.bucket}/#{@file.name}\"\n end",
"def file_path(was=false)\n if was\n self.site.directory_path.join(name_was)\n else\n self.site.directory_path.join(name)\n end\n end",
"def current_file_path\n current_file.to_path\n end",
"def file_path\n public_filename =~ ScribdFu::S3 ? public_filename : \"#{RAILS_ROOT}/public#{public_filename}\"\n end",
"def path\n native.path\n end",
"def file_path(ext = nil)\n return nil unless file_name(ext)\n \"#{self.base_path}/#{file_name(ext)}\"\n end",
"def path\n if @file\n @file.name\n elsif @path\n @path.to_s\n elsif @stream.is_a?(File)\n @stream.path\n end\n end",
"def file_path_for(role_name:)\n Filesystem.nfs_store_path role_name, container, container_path(no_filename: true), file_name\n end",
"def path\n data.fetch(\"path\") { relative_path }\n end",
"def model_file_path\n model.file_path\n end",
"def current_file_path\n clurl = AssetSettings[:local_assets][@file_id].last\n clurl.sub(/\\A#{AssetSettings[:local_assets].assets_url_prefix}/,\n '') if clurl\n end",
"def file_path path\n File.join(output_path, manifest.lookup(path).split('/')[2..-1])\n end",
"def path\n io.path\n end",
"def file_on_disk\n ActiveStorage::Blob.service.send(:path_for, file.key)\n end",
"def iiif_bytestream_path\n case storage_root\n when \"draft\"\n File.join(IDB_CONFIG[:iiif][:draft_base], storage_key)\n when \"medusa\"\n File.join(IDB_CONFIG[:iiif][:medusa_base], storage_key)\n else\n raise StandardError.new(\"invalid storage_root found for datafile: #{self.web_id}\")\n end\n end",
"def full_path\n File.dirname(File.expand_path(serialized_filename))\n end",
"def file_path\n Merb::Config[:upload_dir] / self.hash[0..1] / (self.hash[2..-1] + '-' + self.size.to_s )\n end",
"def relative_path\n File.join(original_relative_dir, STORE_RESIZE_DIR, filename)\n end",
"def path\n tempfile.path\n end",
"def data_file_full_path\n File.join(@data_lib.dir_name,\"#{@data_set_name}\")\n end",
"def virtual_path\n\t\tself.class.local_file_path_from_hash( Pathname.new('/managed_file_resource_images/'), self.file_hash ).to_s\n end"
] | [
"0.8099268",
"0.8076895",
"0.7978352",
"0.7954434",
"0.7916503",
"0.785955",
"0.7818022",
"0.77858806",
"0.77848655",
"0.7749855",
"0.7729863",
"0.77112925",
"0.7707139",
"0.7631517",
"0.76220983",
"0.7617068",
"0.76135236",
"0.7602822",
"0.75878394",
"0.75737506",
"0.75737506",
"0.75737506",
"0.7548568",
"0.7520749",
"0.74933493",
"0.7492772",
"0.74870723",
"0.7456145",
"0.74494374",
"0.7444249",
"0.7418691",
"0.7412101",
"0.7382999",
"0.73680127",
"0.7358826",
"0.7357475",
"0.73527706",
"0.7343663",
"0.73162454",
"0.73110235",
"0.7307222",
"0.7288307",
"0.728329",
"0.72201777",
"0.7210794",
"0.7201633",
"0.7195587",
"0.7192452",
"0.7179179",
"0.7153902",
"0.7153156",
"0.7147971",
"0.7147971",
"0.7147971",
"0.7138026",
"0.7128177",
"0.7122195",
"0.7120268",
"0.71189207",
"0.71066016",
"0.70989215",
"0.70829844",
"0.70796794",
"0.70796794",
"0.7071913",
"0.7063749",
"0.70625234",
"0.7061512",
"0.7055148",
"0.705108",
"0.705108",
"0.70352155",
"0.70241153",
"0.7010258",
"0.69986576",
"0.6979759",
"0.69782424",
"0.69780886",
"0.6977204",
"0.69772017",
"0.6976732",
"0.69712514",
"0.69700676",
"0.6967478",
"0.69645196",
"0.69613117",
"0.69581366",
"0.695413",
"0.69508654",
"0.69486034",
"0.6947295",
"0.69463986",
"0.6942638",
"0.6939739",
"0.69313115",
"0.6909545",
"0.6907387",
"0.69059664",
"0.6901763",
"0.68956405",
"0.6891461"
] | 0.0 | -1 |
Runs the following callbacks: before_destroy destroy after_destroy only if destroy is successful | def destroy_with_callbacks
run_callbacks(:before_destroy)
result = destroy_without_callbacks
run_callbacks(:after_destroy) if result
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n return false if callback(:before_destroy) == false\n result = destroy_without_callbacks\n callback(:after_destroy)\n result\n end",
"def destroy\n return false if callback(:before_destroy) == false\n result = destroy_without_callbacks\n callback(:after_destroy)\n result\n end",
"def after_destroy\n super\n @destroyed = true\n end",
"def after_destroyed\n end",
"def after_destroy_hook\n execute_hooks_for(:after, :destroy)\n end",
"def after_destroy_callback\n puts('----------after_destroyをコール----------')\n end",
"def before_destroy_hook\n execute_hooks_for(:before, :destroy)\n end",
"def destroy\n\t\trun_callbacks(:destroy) { delete } \n\tend",
"def before_destroyed\n end",
"def _destroy(opts)\n called = false\n around_destroy do\n called = true\n before_destroy\n _destroy_delete\n after_destroy\n end\n raise_hook_failure(:around_destroy) unless called\n self\n end",
"def before_destroy\n # can_destroyed?\n end",
"def before_destroy\n # can_destroyed?\n end",
"def before_destroy\n # can_destroyed?\n end",
"def after_destroy(&block)\n @hooks ||= {}\n @hooks[\"after_destroy\".to_sym] = block\n end",
"def on_destroy(&block)\n store(:destroy, Rules::DestroyRule.new(block))\n end",
"def did_destroy\n @destroyed = true\n self.class.identity_map.delete self.id\n self.class.all.delete self\n\n trigger_events(:destroy)\n end",
"def destroy\n run_callbacks :destroy do\n self.deleted_at = DateTime.now\n end\n end",
"def destroy\n run_callbacks :destroy do\n self.deleted_at = DateTime.now\n end\n end",
"def before_destroy\n\n end",
"def after_destroy(resume) \n expire_cache_for(resume) \n end",
"def after_destroy\n #after the user has been deleted, check how many are left - if zero, raise an error\n #this will cause the transaction to roll back\n if User.count.zero?\n raise \"Can't delete the last user!\"\n end\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def after_destroy\n tag.destroy_without_callbacks if tag and tag.taggings.count == 0\n end",
"def destroy\n run_callbacks :destroy do\n #the insurance billing record status need to be revertd back so it appears in the claims outstanding box\n #dont know if it was submitted or printed, so use error as a revert\n self.insurance_billing.revert_to_previous_status if !self.insurance_billing_id.blank?\n self.update_column(:deleted, true)\n end\n end",
"def after_destroy_cleanup\n Cache::Album::Manager.shared.album_deleted(self)\n acl.remove_acl # remove the acl associated with us\n true\n end",
"def before_destroy_effective\n @before_destroy_effective_callable = Proc.new\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def destroy\n self.is_deleted = true\n self.save!\n run_callbacks :destroy do\n delete\n end\n end",
"def ensure_destroy\n ensure_stop\n destroy if exist?\n end",
"def destroy\n db.transaction do\n return save_failure(:destroy) if before_destroy == false\n delete\n after_destroy\n end\n self\n end",
"def destroy\n run_callbacks :destroy do\n self.update_column(:deleted, true)\n end\n end",
"def destroy\n run_callbacks :destroy do\n self.update_column(:deleted, true)\n end\n end",
"def _destroy(opts)\n sh = {:server=>this_server}\n uacr = use_after_commit_rollback\n if uacr.nil? ? (method(:after_destroy_rollback).owner != InstanceMethods) : uacr\n Sequel::Deprecation.deprecate(\"Model#after_destroy_rollback\", \"Instead, call db.after_rollback in Model#before_destroy\")\n db.after_rollback(sh){after_destroy_rollback}\n end\n called = false\n around_destroy do\n called = true\n if before_destroy == false\n Sequel::Deprecation.deprecate(\"Having before_destroy return false to cancel the destroy\", \"Instead, call cancel_action inside before_destroy\")\n raise_hook_failure(:before_destroy)\n end\n _destroy_delete\n after_destroy\n true\n end\n raise_hook_failure(:around_destroy) unless called\n if uacr.nil? ? (method(:after_destroy_commit).owner != InstanceMethods) : uacr\n Sequel::Deprecation.deprecate(\"Model#after_destroy_commit\", \"Instead, call db.after_commit in Model#after_destroy\")\n db.after_commit(sh){after_destroy_commit}\n end\n self\n end",
"def after_destroy\n ExhibitItem.destroy_all( [ \"exhibiting_id=? AND exhibiting_type=?\", self.id, self.class.name ] )\n ResourceListItem.destroy_all( [ \"resource_listing_id=? AND resource_listing_type=?\", self.id, self.class.name ] )\n PackageItem.destroy_all( [ \"packaging_id=? AND packaging_type=?\", self.id, self.class.name ] )\n end",
"def _destroy\n marked_for_destruction?\n end",
"def before_destroy\n\t\tsuper\n\t\tchrome_pdf_tasks.each { |t| t.destroy }\n\t\tdiff_stream.each { |c| c.destroy }\n\n\t\t# save photo list, so we can traverse it\n\t\tp = photos.collect { |x| x }\n\t\t# destroys the association\n\t\tremove_all_photos\n\t\t# remove orphan photos\n\t\tp.each do |photo|\n\t\t\t# destroy photos if we are the only book\n\t\t\tsuccess = true\n\t\t\tsuccess = photo.destroy if photo.books.count == 0\n\t\t\tPB.logger.error \"Could not destroy photo #{photo.id}\" unless success\n\t\tend\n\tend",
"def notify_users_before_destroy\n notify_users(:destroy)\n end",
"def remove_before_destroy?\n true\n end",
"def before_destroy\n tag.destroy_without_callbacks if Tagging.with(tag).count < 1\n end",
"def destroy\n run_callbacks :destroy do\n self.update(active: false)\n end\n end",
"def destroy! #TODO\n destroy || raise(ActiveRecord::RecordNotDestroyed)\n end",
"def destroy\n invoke_callbacks(:destroy, :before)\n if @object.update_attributes(:deleted_at => Time.now.utc)\n invoke_callbacks(:destroy, :after)\n flash[:notice] = flash_message_for(@object, :successfully_removed)\n respond_with(@object) do |format|\n format.html { redirect_to collection_url }\n format.js { render :partial => \"/admin/shared/destroy\" }\n end\n else\n invoke_callbacks(:destroy, :fails)\n respond_with(@object) do |format|\n format.html { redirect_to collection_url }\n end\n end\n end",
"def ensure_active\n run_callbacks(:destroy) do\n update_attribute(:deleted_at, nil)\n end\n end",
"def destroy_without_checking_permissions!\n Carto::Visualization.skip_callback(:destroy, :before, :check_destroy_permissions!)\n Carto::Overlay.skip_callback(:destroy, :before, :validate_user_not_viewer)\n Carto::UserTable.skip_callback(:destroy, :before, :ensure_not_viewer)\n destroy!\n ensure\n Carto::Visualization.set_callback(:destroy, :before, :check_destroy_permissions!)\n Carto::Overlay.set_callback(:destroy, :before, :validate_user_not_viewer)\n Carto::UserTable.set_callback(:destroy, :before, :ensure_not_viewer)\n end",
"def before_destroy\n items.each(&:destroy)\n permissions.each(&:destroy)\n comments.each(&:destroy)\n super\n end",
"def perform_some_actions\n # It is to be called while destroying a Child record\n # But must not be called while destroying the parent record\n unless self.parent.destroyed?\n\n end\n end",
"def destroy\n update_attribute(:is_active, false) if is_active?\n _run_destroy_callbacks\n end",
"def remove_before_destroy?\n false\n end",
"def before_destroy\n self.user.entry_states.where(entry_id: self.feed.entries).delete_all\n self.feed.refresh_feed_job_states.where(user_id: self.user.id).destroy_all\n self.feed.subscribe_job_states.where(user_id: self.user.id).destroy_all\n\n folder = self.feed.user_folder self.user\n folder.feeds.delete self.feed if folder.present?\n\n # If triggered by the destruction of user or feed, do not update timestamps, there's no need\n unless destroyed_by_association\n touch_subscriptions\n touch_user_data\n end\n end",
"def after_destroy\n super\n touch_associations\n end",
"def after_delete\n end",
"def after_destroy\n destroy_stored_manifest\n ensure_current_if_current\n super\n end",
"def before_destroy_user\n indestructible_demo_user\n\n self.opml_import_job_state.opml_import_failures.delete_all\n self.opml_import_job_state.delete\n self.opml_export_job_state.delete\n self.refresh_feed_job_states.delete_all\n self.subscribe_job_states.delete_all\n\n self.folders.delete_all\n self.entry_states.delete_all\n\n # feed subscriptions are deleted WITH callbacks, to take care of the possible deletion of feeds with no more\n # subscribed users\n self.feed_subscriptions.destroy_all\n end",
"def destroy!\n destroy || raise(ActiveRecord::RecordNotDestroyed)\n end",
"def validate_on_destroy\n true\n end",
"def destroy_with_after_commit_callback\n value = destroy_without_after_commit_callback\n callback(:after_commit) if value\n return value\n end",
"def define_after_destroy_callback(klass)\n # Clean up *all* leftover translations of this model, only once.\n b = self\n translation_classes = [class_name, *Mobility::Backends::Sequel::KeyValue::Translation.descendants].uniq\n klass.define_method :after_destroy do\n super()\n\n @mobility_after_destroy_translation_classes = [] unless defined?(@mobility_after_destroy_translation_classes)\n (translation_classes - @mobility_after_destroy_translation_classes).each do |translation_class|\n translation_class.where(:\"#{b.belongs_to}_id\" => id, :\"#{b.belongs_to}_type\" => self.class.name).destroy\n end\n @mobility_after_destroy_translation_classes += translation_classes\n end\n end",
"def after_destroy(following)\n decrement_counter(following)\n end",
"def destroy\n response = perform_destroy(nil)\n self.destroyed = response.status\n self\n end",
"def destroy?\n event == 'destroy'\n end",
"def before_destroy\n\t\tresult, message = self.delete_image\n\n\t\tif result != true\n\t\t\traise message\n\t\tend\n\n\t\treturn result\n\tend",
"def handle_destroy\n obj = model.with_pk(normalized_type, request, request.id)\n model.hook(:before_destroy, request, obj)\n model.destroy(obj)\n model.hook(:after_destroy, request, obj)\n request.set_flash_notice(\"Deleted #{model.class_name}\")\n redirect(:delete, obj)\n end",
"def after_destroy(event)\r\n expire_cache_for(event)\r\n end",
"def destroy\n return unless destroyable?\n super\n end",
"def destroy\n after_destroy if instance_variable_get(resource).destroy\n\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy!\n destroy || raise(RecordNotDestroyed)\n end",
"def destroy\n log_failure do\n handler.destroy\n end\n end",
"def after_destroy\n super\n self.class.call_es { _destroy_document }\n end",
"def destroy(_ = nil)\n OneProvisionLogger.info('(Destroy skipped)')\n end",
"def destroy_eventually\n block = block_given? ? Proc.new : nil\n _self = self\n Parse::Stack::Async.run do\n begin\n result = true\n _self.destroy\n rescue => e\n result = false\n puts \"[DestroyEventually] Failed for object #{_self.parse_class}##{_self.id}: #{e}\"\n ensure\n block.call(result) if block\n block = nil\n _self = nil\n end # begin\n end # do\n end",
"def destroy( opts={} )\n\t\topts = DEFAULT_DESTROY_OPTIONS.merge( opts )\n\n\t\tself.before_destroy or raise Treequel::BeforeHookFailed, :destroy\n\t\tself.delete\n\t\tself.after_destroy\n\n\t\treturn true\n\trescue Treequel::BeforeHookFailed => err\n\t\tself.log.info( err.message )\n\t\traise if opts[:raise_on_failure]\n\tend",
"def destroy_and_deactivate\n destroy\n deactivate\n end",
"def destroy\n DeferredCompletionManager.dispatch do\n begin\n DeferredCompletionManager.state[:the_album_being_deleted] = self\n super\n ensure\n DeferredCompletionManager.state[:the_album_being_deleted] = nil\n end\n end\n end",
"def destroy!; end",
"def destroy\n return super if deletable?\n\n puts_destroy_help\n\n false\n end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def will_be_destroyed?(association_name, attributes)\n allow_destroy?(association_name) && has_destroy_flag?(attributes)\n end",
"def destroy\n @before_and_after.destroy\n respond_to do |format|\n format.html { redirect_to before_and_afters_url, notice: 'Before and after was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_without_callbacks\n self.deleted_at = current_time_from_proper_timezone\n update_without_callbacks\n end",
"def destroy\n if @event.destroy\n msg = MSG[:destroy][:success]\n else\n @success = false\n msg = @event.errors.full_messages\n end\n common_response(msg)\n end",
"def before_destroy\n super\n self.remove_all_owners\n self.remove_all_members\n self.remove_all_account_configs\n self.delete_all_custom_services\n end",
"def after_destroy(object)\n expire_cache_for(object)\n end",
"def after_destroy(event)\n expire_cache_for(event)\n end",
"def after_destroy(event)\n expire_cache_for(event)\n end",
"def destroy!\n destroy || _raise_record_not_destroyed\n end",
"def autolog_destroyed\n autolog_event(:destroyed, orphan: true)\n end",
"def destroy\n run_callbacks :destroy do\n rpc_execute('unlink', [id], context)\n @destroyed = true\n freeze \n end\n end",
"def before_destroy\n if supplier_pos.count != 0\n return false\n else\n return true\n end\n end",
"def after_destroy(shape)\n expire_cache_for(shape)\n end"
] | [
"0.7942425",
"0.7942425",
"0.788467",
"0.7734169",
"0.7663466",
"0.7532305",
"0.7409953",
"0.73851407",
"0.73702747",
"0.73263586",
"0.71145856",
"0.71145856",
"0.71145856",
"0.7083888",
"0.6881957",
"0.6815957",
"0.6807547",
"0.6807547",
"0.6790049",
"0.67671937",
"0.67004436",
"0.66979563",
"0.6693277",
"0.6683852",
"0.6678681",
"0.6631481",
"0.661512",
"0.661512",
"0.661512",
"0.6597386",
"0.65913653",
"0.658027",
"0.6564156",
"0.6564156",
"0.6560668",
"0.65380114",
"0.65085506",
"0.64803416",
"0.64641845",
"0.6463972",
"0.6458334",
"0.6431193",
"0.6409013",
"0.64058656",
"0.6364345",
"0.6364091",
"0.636052",
"0.6358184",
"0.63496655",
"0.6331098",
"0.63194233",
"0.6279944",
"0.6257099",
"0.6235064",
"0.620967",
"0.62089634",
"0.62033343",
"0.61920625",
"0.6183085",
"0.617214",
"0.61702234",
"0.6164418",
"0.6153",
"0.6148234",
"0.6143831",
"0.614361",
"0.6127596",
"0.61254346",
"0.61147803",
"0.61011964",
"0.6089443",
"0.6089143",
"0.6087484",
"0.6080541",
"0.60704637",
"0.6062309",
"0.60543704",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.60476214",
"0.6046804",
"0.603554",
"0.6035065",
"0.60320395",
"0.60282713",
"0.60234916",
"0.60208935",
"0.60208935",
"0.6019505",
"0.6013596",
"0.60106504",
"0.6009491",
"0.6009185"
] | 0.8050903 | 0 |
Runs the following callbacks: before_find find_record after_find if a record was found | def find_record_with_callbacks
run_callbacks(:before_find)
result = find_record_without_callbacks
run_callbacks(:after_find) if result
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(*args)\n records = super\n @after.call(records) if @after\n records\n end",
"def after_find\n end",
"def after_find\n check_if_status_is_up_to_date\n end",
"def find_record\n if record\n self.new_session = false\n return record\n end\n \n find_with.each do |find_method|\n if send(\"valid_#{find_method}?\")\n self.new_session = false\n return record\n end\n end\n nil\n end",
"def after_find\n add_assosiations\n map_fields\n end",
"def after_find\n record.update(to => embed) if record.public_send(to).blank?\n end",
"def find_on_create\n write_inheritable_attribute :find_on_create, true\n end",
"def find_target\n records = super\n @after.call(records) if @after\n records\n end",
"def with_observer callback, model_class, attributes\n observer = LightningTest::Observer.new(callback, attributes)\n\n # check for find callback, and create the after_find explicitly\n # since active record won't call it otherwise\n if callback.to_s == 'find'\n model_class.send(:define_method, :after_find){}\n end\n\n model_class.add_observer(observer)\n yield\n model_class.delete_observer(observer)\n\n @last_observer = observer\n\n observer.passed?\n end",
"def prepare_find\n raise Error.new('Cannot find an event without an ID') if id.blank?\n self\n end",
"def find_existing_record\n @record = record_class.find(@locator)\n end",
"def find_existing_record\n @record = record_class.find(@locator)\n end",
"def _find_record(options)\n if options && options[:lock]\n self.class.preload(strict_loaded_associations).lock(options[:lock]).find_by!(hid: hid)\n else\n self.class.preload(strict_loaded_associations).find_by!(hid: hid)\n end\n end",
"def find_one(&block)\r\n copy_and_return(@records.find(&block))\r\n end",
"def find_with_proc?\n !metadata.find_with.nil? && metadata.find_with.respond_to?(:call)\n end",
"def process_entry( attrs )\n options[:before].call(attrs) if options[:before]\n \n record = finder ? finder.call(attrs) : nil\n\n process_record(attrs,record)\n options[:after].call(record) if options[:after]\n record\n end",
"def find; end",
"def find(*args)\n return super if block_given?\n find_with_ids(*args)\n end",
"def test_perfind_callbacks\r\n nodelist = @mymodel.node_list\r\n \r\n node1 = nodelist.add_node(1, 'node one', PERFIND);\r\n \r\n assert(node1.callbacks.size == 1)\r\n assert(node1.callbacks.include?('evidence_changed'))\r\n end",
"def load_record!(criteria, &block)\n record = find_or_initialize_by(criteria)\n record.status = STATUS_IMPORTED\n record.updated_at = Time.now\n yield(record)\n record.save!\n end",
"def find item\n\tend",
"def find_each(options = {})\n rows = retrieve_records(options) #private method\n\n rows.each do |row|\n init_object_from_row(row)\n end\n end",
"def find\n fail NotImplementedError\n end",
"def find_record_by(model)\n raise_must_override\n end",
"def find(id)\n finder_or_run(:find, id)\n end",
"def find_records(predicate)\n raise_must_override\n end",
"def find_record\n @record ||= model.find_by_id(params[:id])\n end",
"def find\n raise \"Method not implemented\"\n end",
"def process_find_and_replace(params)\n\t\tresponse = find_and_replace(params)\n\t\tresult = json_to_hash(response.body)\n\t\tkey = result[:id]\n\t\tfinished = false\n\t\twhile finished == false\n\t\t\tsleep 2\n\t\t\tresponse = find_and_replace_status(key)\n\t\t\tresult = json_to_hash(response.body)\n\t\t\tputs result[:status]\n\t\t\tfinished = result[:finished]\n\t\tend\n\t\tresponse\n\tend",
"def find_record(item, no_raise: false, meth: nil, **opt)\n # noinspection RubyMismatchedReturnType\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = nil\n\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n if id_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = opt[id_key] || opt[alt_id_key(opt)]\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n else\n error = \"#{id_key} value given\"\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: :id_key set to nil\"\n end\n\n if record\n record\n elsif !id\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end",
"def find_by()\n\n end",
"def find list, &block\n list.find &block\nend",
"def find(id)\n find_result\n end",
"def found\n logger.debug(\"PeopleController.found\")\n # TBD: add in a title of the form N people found?\n @people = search_q(Person)\n end",
"def find_each(&block)\n relation.find_each_with_order(&block) if has_data?\n end",
"def find_record(xero_id)\n raise_must_override\n end",
"def find list, &block\n list.find(&block)\nend",
"def find_record #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].find(params[:id])\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n @record = rec.send(@tables.last[1].pluralize).find(params[:id]) # record to edit\r\n end\r\nend",
"def find_record #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].find(params[:id])\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n @record = rec.send(@tables.last[1].pluralize).find(params[:id]) # record to edit\r\n end\r\nend",
"def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n not_found if @record.nil?\n end",
"def method_missing(method_id, *arguments, &block)\n if match = DynamicFinderMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exists?(attribute_names)\n if match.finder?\n finder = match.finder\n bang = match.bang?\n self.class_eval <<-EOS, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args)\n options = args.extract_options!\n attributes = construct_attributes_from_arguments(\n [:#{attribute_names.join(',:')}],\n args\n )\n finder_options = { :conditions => attributes }\n validate_find_options(options)\n\n #{'result = ' if bang}if options[:conditions]\n with_scope(:find => finder_options) do\n find(:#{finder}, options)\n end\n else\n find(:#{finder}, options.merge(finder_options))\n end\n #{'result || raise(RecordNotFound, \"Couldn\\'t find #{name} with #{attributes.to_a.collect {|pair| \"#{pair.first} = #{pair.second}\"}.join(\\', \\')}\")' if bang}\n end\n EOS\n send(method_id, *arguments)\n elsif match.instantiator?\n instantiator = match.instantiator\n self.class_eval <<-EOS, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args)\n attributes = [:#{attribute_names.join(',:')}]\n protected_attributes_for_create, unprotected_attributes_for_create = {}, {}\n args.each_with_index do |arg, i|\n if arg.is_a?(Hash)\n protected_attributes_for_create = args[i].with_indifferent_access\n else\n unprotected_attributes_for_create[attributes[i]] = args[i]\n end\n end\n\n find_attributes = (protected_attributes_for_create.merge(unprotected_attributes_for_create)).slice(*attributes)\n\n options = { :conditions => find_attributes }\n\n record = find(:first, options)\n\n if record.nil?\n record = self.new(unprotected_attributes_for_create)\n #{'record.save' if instantiator == :create}\n record\n else\n record\n end\n end\n EOS\n send(method_id, *arguments, &block)\n end\n else\n super\n end\n end",
"def lookup force_reprocess = false\n logger.info \"searching #{self.doc_id}\"\n\n raise \"not saved yet\" unless self.id\n\n # Check if the last image search was more than a day ago\n if (\n self.last_search.nil? ||\n self.last_search < (DateTime.current - LOOKUP_LIMIT) ||\n force_reprocess\n ) &&\n !self.locked\n\n self.last_search = DateTime.current\n\n if self.music?\n MusicBrainzWorker.perform_async self.id\n # fails over to LastFM\n\n elsif self.ht_id.present?\n # Check Hathi Trust 1st when available.\n # this will fail over to google if necessary\n HathiTrustWorker.perform_async self.id\n\n else\n SyndeticsWorker.perform_async self.id\n\n # if syndetics fails, it kicks off google\n # if google fails, it kicks off the OpenLibrary job\n end\n end\n\n # Used to stop the after_commit callback\n self.run_lookup = false\n save\n\n rescue StandardError => e\n self.status = 'error'\n self.response_data = e\n end",
"def find\n debugger\n self.lost = false\n debugger\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def found\n return @found\n end",
"def find(id)\n\nend",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def each\n find.each { |found| yield(found) }\n end",
"def find\n super.first\n end",
"def simple_find(*args, &blk)\n find(:__no_pretty_finder__, nil, *args, &blk)\n end",
"def find_record\n @record = reply_address.record\n end",
"def find id, params = {}, &block\n rel = relation params, &block\n rel.where!(config.document_unique_id_param => id) \n rel.load\n rel\n end",
"def find!\n @total_found = 0\n @results = nil\n return results\n end",
"def find_all\n finder_or_run(:find_all)\n end",
"def find(conditions)\n self.request.new(self.seed, conditions)\n end",
"def find_record(item, no_raise: false, meth: nil, **opt)\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = sid = nil\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n sid_key = opt.key?(:sid_key) ? opt[:sid_key] : sid_column\n if id_key || sid_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = id_key && (opt[id_key] || opt[alt_id_key(opt)])\n sid = sid_key && opt[sid_key]\n if valid_sid?(id)\n if sid && (id != sid)\n Log.warn { \"#{meth}: id: #{id.inspect}, but sid: #{sid.inspect}\" }\n end\n id, sid = [nil, id]\n elsif id && sid\n Log.debug do\n \"#{meth}: choosing id: #{id.inspect} over sid: #{sid.inspect}\"\n end\n end\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif sid\n record = record_class.find_by(sid_key => sid)\n error = \"for #{sid_key} #{sid.inspect}\" unless record\n else\n error = '%s value given' % [id_key, sid_key].compact.join(' or ')\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: both :id_key and :sid_key set to nil\"\n end\n if record\n record\n elsif !id && !sid\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end",
"def after_object_find! obj\n content_type = \n case obj\n when ContentType\n obj\n when ContentKey, ContentKey::Version, Content, Content::Version\n obj.content_type\n when \n nil\n end\n\n # $stderr.puts \" ### #{self.class} #{params[:action]}: after_object_find! content_type=#{content_type}\"\n\n content_type.plugin_instance.mix_into_object(self) if content_type\n\n self\n end",
"def _invoke_persistent_callbacks\n method(self.class.before_save_callback).call\n method(self.class.after_commit_callback).call\n end",
"def find_associated_records\n if team&.new_record?\n if team.name.blank? || (team.name == \"N/A\")\n self.team = nil\n else\n existing_team = Team.find_by_name_or_alias(team.name)\n self.team = existing_team if existing_team\n end\n end\n end",
"def find_each(options = {})\n return enum_for(:find_each, options) unless block_given?\n\n find_in_batches options do |batch|\n batch.each do |record|\n yield record\n end\n end\n end",
"def run_after_create_callbacks(record)\n @schema.after_create_callbacks.each do |callback|\n callback.call record\n end\n end",
"def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = zone_by_id @resource[:zoneid]\n if @zone.nil? then\n self.fail \"No zone with id: #{@resource[:zoneid]}\"\n end\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n @records = @zone.records\n @records.each do |record|\n if record.name == @resource[:record]\n return record\n end\n end\n return nil\n end",
"def find(object, parent = @base)\n raise NotImplementedError, \"Subclasses must implement public method find\"\n end",
"def find\n model_class.filterrific_find(self)\n end",
"def execute_find(raw = false)\n get_records\n cached = AridCache::CacheProxy::Result.new\n\n if !records.is_a?(Enumerable) || (!records.empty? && !records.first.is_a?(::ActiveRecord::Base))\n cached = records # some base type, cache it as itself\n else\n cached.ids = records.collect(&:id)\n cached.count = records.size\n if records.respond_to?(:proxy_reflection) # association proxy\n cached.klass = records.proxy_reflection.klass\n elsif !records.empty?\n cached.klass = records.first.class\n else\n cached.klass = object_base_class\n end\n end\n Rails.cache.write(cache_key, cached, opts_for_cache)\n self.cached = cached\n\n # Return the raw result?\n return self.cached if raw\n\n # An order has been specified. We have to go to the database\n # to order because we can't be sure that the current order is the same as the cache.\n if cached.is_a?(AridCache::CacheProxy::Result) && combined_options.include?(:order)\n self.klass = self.cached.klass # TODO used by fetch_from_cache needs refactor\n fetch_from_cache\n else\n process_result_in_memory(records)\n end\n end",
"def promise_find(id)\n sid = id.to_s\n record_in_progress = if _record_cache.has_key?(sid)\n _record_cache[sid]\n else\n self.new(id: id)\n end\n _promise_find(id, record_in_progress)\n end",
"def find(query); end",
"def find(query); end",
"def find_from!(collection, identifier, find_by = :id)\n if identifier.present?\n collection.detect { |instance| instance.send(find_by) == identifier.to_i } || (raise ActiveRecord::RecordNotFound)\n else\n raise ActiveRecord::RecordNotFound\n end\n end",
"def find(*args)\n ids = args.__find_args__\n raise_invalid if ids.any?(&:nil?)\n for_ids(ids).execute_or_raise(ids, args.multi_arged?)\n end",
"def find_or_create_documents!\n @find_or_create_documents ||= save!\n end",
"def find_or_create!()\n event_order = @last_event_order\n @source_dao.meeting_events.each_with_index do |event, index|\n add_to_log( \"\\r\\nProcessing event #{ event.get_full_name }...\" )\n event_type_id = if event.instance_of?( MeetingEvent )\n add_to_log( \"Previosly detected as event_type_id: #{ event.event_type_id }.\" )\n event.event_type_id\n elsif event.instance_of?( FinCalendarParseResultDAO::EventTypeDAO )\n event_type = create_new_event_type( event )\n add_to_log( \"Created new event_type: #{ event_type.inspect }.\" )\n event_type.id\n end\n # Prepare MeetingEvent requires:\n meeting_session_id = @meeting_session.id\n event_type_id = event_type_id\n event_order += index + 1 # (We'll set the event_order as cumulative among all sessions)\n\n # [Steve, 20170920] We cannot safely detect the begin time from the start time\n # of the session here. (We need the entries, at least.)\n #\n # So this has been removed permanently from the search below:...\n #\n # begin_time = @source_dao.start_time_iso_format\n #\n # ...Together with the check for a change in the begin time, which resulted in\n # continuous event updates:\n #\n # ( begin_time.present? &&\n # Format.a_time( meeting_event.begin_time ) != Format.a_time( begin_time ) )\n\n # --- SEARCH #1: find pre-existing event ---\n meeting = @meeting_session.meeting\n add_to_log( \"Searching meeting Event n.#{ event_order }: #{ event.get_full_name } (type: #{ event_type_id }) among existing events for meeting #{ meeting.id }...\" )\n meeting_event = meeting.meeting_events.where( event_type_id: event_type_id ).first\n # Match found?\n if meeting_event.instance_of?( MeetingEvent )\n add_to_log( \"Meeting Event found! => #{ meeting_event.inspect }\" )\n # --- UPDATE ---\n # Force update of the found instance with the correct values if there are\n # any differences (except user_id):\n # (If the found MeetingEvent belongs to a different session, it will be \"moved\"\n # to the one specified in the constructor)\n if ( meeting_event.heat_type_id.to_i < 1 ) ||\n ( meeting_event.meeting_session_id != meeting_session_id )\n meeting_event = update_existing( meeting_event, meeting_session_id, event_order, nil, event_type_id )\n end\n # --- CREATION ---\n else\n meeting_event = create_new( meeting_session_id, event_order, @source_dao.start_time_iso_format, event_type_id )\n end\n # Add the created/updated event row to the list:\n @result_meeting_events << meeting_event\n end\n\n @last_event_order = event_order\n @result_meeting_events\n end",
"def find\n\t\tif !defined?(@collection)\n\t\t\treturn false\n\t\telse\n\t\t\treturn @collection.find\n\t\tend\n end",
"def find(id); end",
"def find(id); end",
"def find_or_create(*args, &block)\n find_or_initialize_and_do :save, *args, &block\n end",
"def find(*args)\n select(*args)\n\n=begin\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.first\n when :all then find_every options\n when :first then find_initial options\n else find_from_ids args, options\n end\n\n=end\n\n end",
"def find(id)\n map_id = proc { |object| object.respond_to?(:id) ? object.send(:id) : object }\n\n result = find_by_id_or_ids(map_id, id)\n\n fail RecordNotFound.new(\n \"Couldn't find #{name} with '#{id_property_name}'=#{id.inspect}\",\n name, id_property_name, id) if result.blank?\n result.tap { |r| find_callbacks!(r) }\n end",
"def after_save(record)\n \n end",
"def check_record; end",
"def find(*args, &block)\n if args.first.is_a?(Hash)\n super(*args, &block)\n else\n super(id: args)\n end\n end",
"def calls_where\n self.class.where(person_to_look_up)\n end",
"def find_record(relation = nil)\n if locate_id.nil? || (locate_id.is_a?(::Numeric) && locate_id == 0) || (locate_id.to_s == '')\n return -1\n end\n\n dataset = load_records(relation, false)\n return -1 if dataset.blank?\n\n first_item = dataset.first\n klass = first_item.class\n\n id_field = klass.respond_to?('primary_key') ? klass.primary_key : nil\n id_field ||= first_item.respond_to?('id') ? 'id' : nil\n\n return -1 unless id_field\n if locate_id.is_a?(::Numeric)\n dataset.index{|item| item.send(id_field) == locate_id} || -1\n else\n loc_id = locate_id.to_s.downcase\n dataset.index{|item| item.send(id_field).to_s.downcase == loc_id} || -1\n end\n\n end",
"def find(loc, data)\n list.find(loc, data)\n end",
"def find_for_show(find_by_conditions:)\n search.find_by(find_by_conditions)\n end",
"def find(&block)\n return nil unless valid?\n @hops.find(&block)\n end",
"def find(command, options = {}, &block)\n case command\n when Fixnum\n record(command)\n when Array\n command.map {|i| record(i)}\n when :all\n find_all(options, &block)\n when :first\n find_first(options)\n end\n end",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n \tif candidate[:id] == id\n \t return candidate\n \tend\n end\n return nil\nend",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate_and_sanitize\n return r unless r.success?\n\n find_or_create_record\n\n end\n\n end",
"def find\n\t\tif defined?(@collection)\n\t\t\treturn @collection.find\n \tend\n\tend",
"def include?(record_or_id)\n id = record_or_id.respond_to?(:id) ? record_or_id.id : record_or_id\n\n if loaded? || find_with_proc?\n !!find(id)\n else\n foreign_key_in_proxy_owner_exists? id\n end\n rescue RecordNotFound\n false\n end",
"def test_perfind_callbacks\r\n nodelist = @mymodel.node_list\r\n \r\n node1 = nodelist.add_node(1, 'measure node', MEASUREMENT);\r\n\r\n assert(node1.callbacks.size == 1) \r\n assert(node1.callbacks.include?('measurement_changed'))\r\n end",
"def after_create_save(record); end",
"def find_existing_record_after_reassociating(klass, obj_hash)\n obj_hash_clone = update_association_fields(klass, obj_hash.clone)\n existing_record = find_record_by_unique_index(klass, obj_hash_clone)\n if existing_record\n # Since existing_record was found, update original obj_hash\n update_association_fields(klass, obj_hash)\n existing_record\n end\n end",
"def set_found_item\n @found_item = FoundItem.find(params[:id])\n end",
"def set_found_item\n @found_item = FoundItem.find(params[:id])\n end",
"def find(value)\n end",
"def find_or_create!()\n end",
"def find_record\n self.class.model_klass.find(params[:id])\n end",
"def after_find\n\t\t#require 'base64'\n\t\t#self.domains = Marshal.load(Base64.decode64(self.domains))\n\t\tself.domains = User.str2domain(self.domains)\n\tend"
] | [
"0.75302047",
"0.74342936",
"0.65217125",
"0.639116",
"0.63230455",
"0.6300618",
"0.6030712",
"0.60287315",
"0.5903821",
"0.58804",
"0.58588004",
"0.58588004",
"0.56920636",
"0.5677259",
"0.5664264",
"0.5651076",
"0.5640873",
"0.5627926",
"0.5600982",
"0.5595867",
"0.554882",
"0.55315346",
"0.55274385",
"0.55184287",
"0.5491989",
"0.5472146",
"0.5462459",
"0.5437392",
"0.5387503",
"0.5370642",
"0.53611034",
"0.5358875",
"0.53412133",
"0.53035015",
"0.52927035",
"0.5284968",
"0.52510023",
"0.52459705",
"0.52459705",
"0.5211989",
"0.5210484",
"0.52078265",
"0.5201937",
"0.52009034",
"0.5183009",
"0.51684386",
"0.5156498",
"0.51485115",
"0.51353776",
"0.5133933",
"0.5133102",
"0.5130595",
"0.51240706",
"0.512092",
"0.5120803",
"0.5109956",
"0.50989324",
"0.5097342",
"0.5092835",
"0.50907266",
"0.5089404",
"0.50751376",
"0.50749147",
"0.5071883",
"0.5063829",
"0.5062046",
"0.50610566",
"0.50610566",
"0.5060998",
"0.50580716",
"0.5049551",
"0.5047423",
"0.50442815",
"0.50439936",
"0.50439936",
"0.5034332",
"0.5025468",
"0.5024366",
"0.50230616",
"0.50202113",
"0.5017032",
"0.5012715",
"0.50112075",
"0.5007843",
"0.5003891",
"0.50028884",
"0.4989193",
"0.49849078",
"0.49848637",
"0.49773014",
"0.4970367",
"0.49669698",
"0.49616605",
"0.4961615",
"0.49462867",
"0.4946141",
"0.4943835",
"0.49391463",
"0.4928516",
"0.49263686"
] | 0.84691346 | 0 |
Runs the following callbacks: before_save before_create only if new_session? == true before_update only if new_session? == false save the following are only run is save is successful after_save before_update only if new_session? == false before_create only if new_session? == true | def save_with_callbacks(&block)
run_callbacks(:before_save)
if new_session?
run_callbacks(:before_create)
else
run_callbacks(:before_update)
end
result = save_without_callbacks(&block)
if result
run_callbacks(:after_save)
if new_session?
run_callbacks(:after_create)
else
run_callbacks(:after_update)
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n result = nil\n if valid?\n self.record = attempted_record\n\n run_callbacks :before_save\n run_callbacks(new_session? ? :before_create : :before_update)\n run_callbacks(new_session? ? :after_create : :after_update)\n run_callbacks :after_save\n\n save_record\n self.new_session = false\n result = true\n else\n result = false\n end\n\n yield result if block_given?\n result\n end",
"def save(&block)\n result = nil\n if valid?\n self.record = attempted_record\n\n before_save\n new_session? ? before_create : before_update\n new_session? ? after_create : after_update\n after_save\n\n save_record\n self.new_session = false\n result = true\n else\n result = false\n end\n\n yield result if block_given?\n result\n end",
"def before_save\n begin\n #\n # test-mode status is redundant here for the purpose reporting etc...\n #\n # ramonrails Thu Oct 14 05:14:06 IST 2010\n # lately, we have test_mode working as follows\n # * user is considered in test mode when user.test_mode == true\n # * when user goes into test mode\n # * membership of safety_care is opted\n # * caregivers are set away\n # user = User.find(user_id) # not required. user is already assigned here\n self.test_mode = user.test_mode? unless user.blank?\n #\n # ramonrails: Thu Oct 14 01:56:19 IST 2010\n # CHANGED: ** do not ** return a false\n # returning false will abort any further execution of calbacks, or this save\n # above code was un-intentionally returning false in some cases\n true # continue execution. returning false would not save the record\n rescue\n true # no matter what, execute critical_device_event_observer.after_save\n end\n end",
"def before_save_hook\n execute_hooks_for(:before, :save)\n end",
"def save\n run_callbacks :save do\n valid? && (create || update)\n end\n end",
"def save_without_callbacks\n Need.skip_callback(:create, :after, :record_create_revision)\n Need.skip_callback(:update, :after, :record_update_revision)\n\n save_status = save\n\n Need.set_callback(:create, :after, :record_create_revision)\n Need.set_callback(:update, :after, :record_update_revision)\n\n save_status\n end",
"def before_update_save(record)\n record.save if record && record.valid?\n end",
"def _invoke_persistent_callbacks\n method(self.class.before_save_callback).call\n method(self.class.after_commit_callback).call\n end",
"def before_create_save(record)\n do_save_logic(record)\n record.usr_id = session[:usr_id]\n end",
"def before_saving( &block )\n\t\tdefine_singleton_method( :call_before_saving, &block )\n\tend",
"def before_create_save(record); end",
"def persist\n @before_run = true\n super\n end",
"def before_update_save(record)\n do_save_logic(record)\n if (record.usr_id != session[:usr_id])\n # Force the call of a validation method.\n record.name = \"record_usr_id_ne_session_usr_id\"\n end\n end",
"def before_update_save(record); end",
"def save(&block)\n result = nil\n if valid?\n record.login_count = (record.login_count.blank? ? 1 : record.login_count + 1) if record.respond_to?(:login_count)\n \n if record.respond_to?(:current_login_at)\n record.last_login_at = record.current_login_at if record.respond_to?(:last_login_at)\n record.current_login_at = klass.default_timezone == :utc ? Time.now.utc : Time.now\n end\n \n if record.respond_to?(:current_login_ip)\n record.last_login_ip = record.current_login_ip if record.respond_to?(:last_login_ip)\n record.current_login_ip = controller.request.remote_ip\n end\n \n record.save_without_session_maintenance(false)\n \n self.new_session = false\n result = self\n else\n result = false\n end\n \n yield result if block_given?\n result\n end",
"def test\n puts \"(model): RUNNING before_save CALLBACK!!!##\"\n end",
"def save\n if persisted?\n update\n else\n create\n end\n true\n end",
"def save\n create_or_update\n return true\n end",
"def after_create\n true\n end",
"def before_save(*); end",
"def save\n if exists?\n update_attributes\n else\n if !create.nil?\n true\n else\n false\n end\n end\n end",
"def _save(opts)\n pk = nil\n called_save = false\n called_cu = false\n around_save do\n called_save = true\n before_save\n\n if new?\n around_create do\n called_cu = true\n before_create\n pk = _insert\n @this = nil\n @new = false\n @modified = false\n pk ? _save_refresh : changed_columns.clear\n after_create\n true\n end\n raise_hook_failure(:around_create) unless called_cu\n else\n around_update do\n called_cu = true\n before_update\n columns = opts[:columns]\n if columns.nil?\n columns_updated = if opts[:changed]\n @values.reject{|k,v| !changed_columns.include?(k)}\n else\n _save_update_all_columns_hash\n end\n changed_columns.clear\n else # update only the specified columns\n columns = Array(columns)\n columns_updated = @values.reject{|k, v| !columns.include?(k)}\n changed_columns.reject!{|c| columns.include?(c)}\n end\n _update_columns(columns_updated)\n @this = nil\n @modified = false\n after_update\n true\n end\n raise_hook_failure(:around_update) unless called_cu\n end\n after_save\n true\n end\n raise_hook_failure(:around_save) unless called_save\n self\n end",
"def prepare_save!\n run_callbacks(:save) { false }\n end",
"def check_can_save\n if saving_update\n self.saving_update = false\n return true\n end\n\n super\n end",
"def before_create_hook\n execute_hooks_for(:before, :create)\n end",
"def save\n begin\n create_or_update\n rescue ActiveRecord::RecordInvalid\n false\n end\n end",
"def after_create_save(record); end",
"def valid_callbacks\n [:after_create, :after_save, :after_update, :after_commit]\n end",
"def _save(opts)\n sh = {:server=>this_server}\n uacr = use_after_commit_rollback\n if uacr.nil? ? (method(:after_rollback).owner != InstanceMethods) : uacr\n Sequel::Deprecation.deprecate(\"Model#after_rollback\", \"Instead, call db.after_rollback in Model#before_save\")\n db.after_rollback(sh){after_rollback}\n end\n pk = nil\n called_save = false\n called_cu = false\n around_save do\n called_save = true\n if before_save == false\n Sequel::Deprecation.deprecate(\"Having before_save return false to cancel the save\", \"Instead, call cancel_action inside before_save\")\n raise_hook_failure(:before_save)\n end\n\n if new?\n around_create do\n called_cu = true\n if before_create == false\n Sequel::Deprecation.deprecate(\"Having before_create return false to cancel the create\", \"Instead, call cancel_action inside before_create\")\n raise_hook_failure(:before_create)\n end\n pk = _insert\n _after_create(pk) # SEQUEL5: Remove\n # SEQUEL5\n # @this = nil\n # @new = false\n # @modified = false\n # pk ? _save_refresh : changed_columns.clear\n after_create\n true\n end\n raise_hook_failure(:around_create) unless called_cu\n else\n around_update do\n called_cu = true\n if before_update == false\n Sequel::Deprecation.deprecate(\"Having before_update return false to cancel the update\", \"Instead, call cancel_action inside before_update\")\n raise_hook_failure(:before_update)\n end\n columns = opts[:columns]\n if columns.nil?\n columns_updated = if opts[:changed] # SEQUEL5: Use local variable instead of instance variable\n @values.reject{|k,v| !changed_columns.include?(k)}\n else\n _save_update_all_columns_hash\n end\n changed_columns.clear\n else # update only the specified columns\n columns = Array(columns)\n columns_updated = @values.reject{|k, v| !columns.include?(k)}\n changed_columns.reject!{|c| columns.include?(c)}\n end\n _update_columns(columns_updated)\n _after_update # SEQUEL5: Remove\n # SEQUEL5\n # @this = nil\n # @modified = false\n after_update\n true\n end\n raise_hook_failure(:around_update) unless called_cu\n end\n after_save\n true\n end\n raise_hook_failure(:around_save) unless called_save\n _after_save(pk) # SEQUEL5: Remove\n if uacr.nil? ? (method(:after_commit).owner != InstanceMethods) : uacr\n Sequel::Deprecation.deprecate(\"Model#after_commit\", \"Instead, call db.after_commit in Model#after_save\")\n db.after_commit(sh){after_commit}\n end\n self\n end",
"def before_save\n # boolean fields cannot be NULL at database level\n self.is_active = 0 if self.is_active.nil?\n end",
"def before_save\n\n touch\n end",
"def before_save\n\n touch\n end",
"def before_update; end",
"def save(options = {})\n options.assert_valid_keys\n if new_record? then create\n else update\n end\n @new_record = false\n true\n end",
"def before_validation_on_update\n before_validation_on_create\n end",
"def update_login_timestamps\n if current_enrollment && current_enrollment.last_seen # when an enrollment is created, it's last_seen value is set\n \n if current_enrollment.last_seen < 4.hour.ago # 4 hours is somewhat arbitrary\n current_enrollment.events.new_session.create\n end\n\n # note that there is activity (since this before filter happens for any activity)\n current_enrollment.update_attribute(:last_seen, Time.now)\n end\n end",
"def save_on_insert?\n false\n end",
"def save\n if persisted?\n update\n else\n create\n end\n end",
"def adjust_after_create\n # The record is in @record, do what you will, this precedes a save.\n end",
"def after_save_user\n if self.opml_import_job_state.blank?\n self.create_opml_import_job_state state: OpmlImportJobState::NONE\n Rails.logger.debug \"User #{self.email} has no OpmlImportJobState, creating one with state NONE\"\n end\n\n if self.opml_export_job_state.blank?\n self.create_opml_export_job_state state: OpmlExportJobState::NONE\n Rails.logger.debug \"User #{self.email} has no OpmlExportJobState, creating one with state NONE\"\n end\n\n if saved_change_to_quick_reading? || saved_change_to_open_all_entries? ||\n saved_change_to_show_main_tour? || saved_change_to_show_mobile_tour? ||\n saved_change_to_show_feed_tour? || saved_change_to_show_entry_tour? ||\n saved_change_to_show_kb_shortcuts_tour? || saved_change_to_kb_shortcuts_enabled?\n update_column :config_updated_at, Time.zone.now\n end\n end",
"def save\n self.new_record ? self.create : self.update\n end",
"def before_create_save(record)\n record.usr_id = session[:usr_id]\n end",
"def before_create_save(record)\n record.usr_id = session[:usr_id]\n end",
"def before_create_save(record)\n record.usr_id = session[:usr_id]\n end",
"def save\n #you're looking to see if theres been anything inserted or updated and\n #based on that you decide how to store the instance\n if persisted?\n update\n #if instance exists ... data inserted will need to 'update'\n else\n insert\n #if instance does not already exist data inserted will have be 'insert'\n end\n end",
"def save\n if new_record?\n create\n else\n update\n end\n end",
"def after_save_hook\n execute_hooks_for(:after, :save)\n end",
"def record_transaction\n if self.save\n return true\n else\n return false\n end \n end",
"def save_without_our_callbacks\n @save_without_our_callbacks = true\n save\n end",
"def save(*)\n create_or_update\n rescue RecordInvalid\n false\n end",
"def post_is_create?\n\t\ttrue\n\tend",
"def save\n valid? && create\n end",
"def after_create_hook\n execute_hooks_for(:after, :create)\n end",
"def post_process_insert\n self.new_record = false\n flag_descendants_persisted\n true\n end",
"def save\n run_callbacks :save do\n return false unless valid?\n remote_attributes = remote_save(attributes)\n return false unless remote_attributes\n self.attributes = remote_attributes\n remotely_saved\n true\n end\n end",
"def around_save_collection_association\n previously_new_record_before_save = (@new_record_before_save ||= false)\n @new_record_before_save = !previously_new_record_before_save && new_record?\n\n yield\n ensure\n @new_record_before_save = previously_new_record_before_save\n end",
"def save(options = {})\n callbacks = persisted? ? :update : :create\n\n run_callbacks callbacks do\n # Devise can throw a :validate key at us, which ES doesn't like.\n options.delete(:validate)\n\n result = super(options)\n\n # Prevent Devise after_* callbacks from sending out confirmation emails\n # when save failed. I'm not happy with the hackiness of this, but I can't\n # find a better way.\n @skip_confirmation_notification = true unless result\n\n result\n end\n end",
"def before_save\n # boolean fields cannot be NULL at database level\n self.is_active = 0 if self.is_active.nil?\n end",
"def save(*)\n call_hooks 'save' do\n # Existing object implies update in place\n action = 'add'\n set_auto_date_field 'created_at'\n if @new_record\n do_insert\n else\n do_update\n set_auto_date_field 'updated_at'\n action = 'update'\n end\n @new_record = false\n @dirty = false\n self.class.issue_notification(self, :action => action)\n end\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 before_save(sender); end",
"def save_only_when_valid\n if valid?\n save_without_ensure\n else\n false\n end\n end",
"def silent_save\n if self.class.find(self.id)\n update\n else\n insert\n end\n end",
"def validate_on_create; end",
"def save\n create_or_update\n end",
"def before_create()\n end",
"def save(*)\n if (status = super)\n changes_applied\n end\n\n status\n end",
"def do_before_save\n self.time_closed = Time.now if closed_changed? && closed\nend",
"def save\n valid? && create.success?\n end",
"def valid?\n errors.clear\n self.attempted_record = nil\n\n before_validation\n new_session? ? before_validation_on_create : before_validation_on_update\n validate\n ensure_authentication_attempted\n\n if errors.empty?\n new_session? ? after_validation_on_create : after_validation_on_update\n after_validation\n end\n\n save_record(attempted_record)\n errors.empty?\n end",
"def save\n run_callbacks :save do\n if valid?\n client = AccessKeyClient.new\n response = if new_record?\n client.send(create_operator(api_options), api_options)\n else\n client.send(update_operator(api_options), api_options)\n end\n assign_attributes(response['data'])\n changes_applied\n true\n else\n false\n end\n end\n end",
"def _after_create(pk)\n # SEQUEL5: Remove\n @this = nil\n @new = false\n @was_new = true\n end",
"def save(*)\n if status = super\n changes_applied\n end\n status\n end",
"def save\n create_or_update\n end",
"def save\n create_or_update\n end",
"def save\n create_or_update\n end",
"def save_without_validation_and_callbacks\n #disable callbacks\n @skip_callbacks = true\n save_with_validation(false)\n end",
"def create\n run_callbacks :create do\n true\n end\n end",
"def save(**options, &block)\n create_or_update(**options, &block)\n rescue ActiveRecord::RecordInvalid\n false\n end",
"def did_log_in\n self.last_logged_in_at = DateTime.now\n self.class.execute_without_timestamps { save }\n end",
"def save_old_profile\n @_old_profile_id = profile_id_change ? profile_id_change.first : false\n true\n end",
"def create\n @resource = find_authenticatable\n session = build_passwordless_session(@resource)\n\n if session.save\n if Passwordless.config.after_session_save.arity == 2\n Passwordless.config.after_session_save.call(session, request)\n else\n Passwordless.config.after_session_save.call(session)\n end\n end\n\n flash[:notice] = I18n.t(\"passwordless.sessions.create.email_sent_if_record_found\")\n redirect_back(fallback_location: root_path)\n end",
"def after_create; end",
"def before_update_save(record)\n record.puesto_id = nil\n record.origen_id = record.buzon_id\n record.carpeta_id = nil\n record.add_traza(current_user.id, 8, current_user.puesto.buzon_id)\n if record.documento.digital \n record.despachar\n else\n record.estado_id = 6\n end\n end",
"def after_update_save(record); end",
"def before_update_hook\n execute_hooks_for(:before, :update)\n end",
"def save_data\r\n fields = fields_on_form()\r\n return true if fields.size == 0\r\n#\r\n fields.each do |v|\r\n next if v['type'].nil?\r\n next if v['type'].match('embedded') # don't wipe embedded fields\r\n next if params[:edit_only] and params[:edit_only] != v['name'] # otherwise other fields would be wiped\r\n next unless @record.respond_to?(v['name']) # there can be temporary fields on the form\r\n next if v['readonly'] # fields with readonly option don't retain value and would be wiped\r\n# return value from form field definition\r\n value = DrgcmsFormFields.const_get(v['type'].camelize).get_data(params, v['name'])\r\n @record.send(\"#{v['name']}=\", value)\r\n end\r\n# \r\n operation = @record.new_record? ? :new : :update\r\n# controls callback method\r\n if (m = callback_method('before_save') )\r\n ret = call_callback_method(m)\r\n# dont's save if callback method returns false \r\n return false if ret.class == FalseClass\r\n end\r\n# maybe model has dc_before_save method defined. Call it. This was before callback\r\n @record.dc_before_save(self) if @record.respond_to?('dc_before_save')\r\n#\r\n changes = @record.changes\r\n update_standards() if changes.size > 0 # update only if there has been some changes\r\n if (saved = @record.save)\r\n save_journal(operation, changes)\r\n# callback methods\r\n if (m = callback_method('after_save') ) then call_callback_method(m) end\r\n# check if model has dc_after_save method\r\n @record.dc_after_save(self) if @record.respond_to?('dc_after_save')\r\n end\r\n saved\r\nend",
"def save\n\t\treturn false unless self.modified? || self.new?\n\t\tif self.new?\n\t\t\tself.insert\n\t\telse\n\t\t\tself.update\n\t\tend\n\tend",
"def save(validate: true)\n ActiveRecord::Base.transaction do\n main_model = _get_main_model\n\n valid = true\n if validate\n valid = self.valid?\n if valid\n before_save\n save = main_model.save\n after_save\n end\n else\n before_save\n save = main_model.save\n after_save\n end\n valid && save\n end\n end",
"def save\n if valid?\n persist!\n true\n else\n false\n end\n end",
"def save\n begin\n save!\n true\n rescue\n false\n end\n end",
"def save(perform_validation = true, &block)\n return false if perform_validation && block_given? && authenticate_with_openid? && !authenticate_with_openid\n \n return false if using_openid? && new_record? && !openid_complete?\n result = super\n yield(result) if block_given?\n result\n end",
"def save_valid\n if self.valid_save?\n self.save\n else\n false\n end\n end",
"def before_create_user\n logger.debug(\"on before creare user\")\n #Generate a unique key\n if facebook_user?\n self.active = 1 \n else\n activation_key_string = self.salt+self.email+self.hashed_password\n self.activation_key =Digest::SHA1.hexdigest(activation_key_string)\n self.active = 0\n end\n self.admin = 0 \n self.handle=generate_unique_handle\n \n end",
"def store_before_to_new_record_values\n values = {:id => id}\n values[:updated_at] = updated_at if respond_to?(:updated_at)\n values[:created_at] = created_at if respond_to?(:created_at)\n @_before_to_new_record_values = values\n end",
"def fill_up_user_create\n # if self.class.column_names.include? 'updated_by_id'\n # if UserInfo.current_user_id\n # # if updated_by_id && updated_by_id != UserInfo.current_user_id\n # # logger.info \"NOTICE create - self.updated_by_id is different: #{updated_by_id}/#{UserInfo.current_user_id}\"\n # # end\n # # self.updated_by_id = UserInfo.current_user_id\n # end\n # end\n\n # return true if !self.class.column_names.include? 'created_by_id'\n\n return true if !UserInfo.current_user_id\n\n # if created_by_id && created_by_id != UserInfo.current_user_id\n # logger.info \"NOTICE create - self.created_by_id is different: #{created_by_id}/#{UserInfo.current_user_id}\"\n # end\n # self.created_by_id = UserInfo.current_user_id\n true\n end",
"def after_create\n\t\tsuper\n\t\t# associate an enrollment queue\n\t\teq = EnrollmentQueue.create(user_id: self.id)\n\t\tself.enrollment_queue = eq\n\t\teq.user = self\n\t\t# associate a state table\n\t\tst = StateTable.create(user_id: self.id)\n\t\tself.state_table = st\n\t\tst.user = self\n\n\n if not ['app', 'android', 'ios'].include? self.platform\n\t\t self.state_table.update(subscribed?: false) unless ENV['RACK_ENV'] == 'test'\n # self.state_table.update(subscribed?: true)\n end\n\n\t\tif not ['fb', 'app', 'android', 'ios'].include? self.platform\n\t\t\tself.code = generate_code\n\t\tend\n\t\t# puts \"start code = #{self.code}\"\n\t\twhile !self.valid?\n\t\t\tself.code = (self.code.to_i + 1).to_s\n\t\t\t# puts \"new code = #{self.code}\"\n\t\tend\n\t\t# set default curriculum version\n\t\tENV[\"CURRICULUM_VERSION\"] ||= '0'\n\t\tself.update(curriculum_version: ENV[\"CURRICULUM_VERSION\"].to_i)\n\n\t\t# we would want to do\n\t\t# self.save_changes\n\t\t# self.state_table.save_changes\n\t\t# but this is already done for us with self.update and self.state_table.update\n\n\trescue => e\n\t\tp e.message + \" could not create and associate a state_table, enrollment_queue, or curriculum_version for this user\"\n\tend",
"def before_save #def self.before_save()\n @my_log.info(\"Creating user with name #{self.name}\")\n end",
"def save(*args)\n if persisted? && (changes.keys - %w(history_ended_at)).any?\n false\n else\n super\n end\n end"
] | [
"0.7341021",
"0.71566254",
"0.669895",
"0.6453453",
"0.63910234",
"0.6389693",
"0.6246433",
"0.6239173",
"0.6165097",
"0.6134382",
"0.61131334",
"0.6101822",
"0.6101306",
"0.6059083",
"0.6044832",
"0.60376674",
"0.60354257",
"0.6035111",
"0.60089576",
"0.59456617",
"0.5902756",
"0.589435",
"0.5876228",
"0.58727175",
"0.5867448",
"0.58257884",
"0.57471687",
"0.5746213",
"0.57448614",
"0.57062155",
"0.57005566",
"0.57005566",
"0.5699295",
"0.5680271",
"0.5674887",
"0.5669664",
"0.56616825",
"0.5656716",
"0.5654212",
"0.56324136",
"0.5591822",
"0.55859524",
"0.55859524",
"0.55859524",
"0.5570024",
"0.5550534",
"0.55342585",
"0.5529742",
"0.55267036",
"0.55255944",
"0.551481",
"0.55142134",
"0.55134237",
"0.55049",
"0.55000186",
"0.5486537",
"0.5484004",
"0.5474502",
"0.5471648",
"0.54716",
"0.5470346",
"0.54697263",
"0.54658794",
"0.5458573",
"0.5453944",
"0.5448749",
"0.5446051",
"0.54418546",
"0.54393446",
"0.54358953",
"0.54298115",
"0.54253757",
"0.5423712",
"0.5419707",
"0.5418849",
"0.5418849",
"0.5418849",
"0.5414041",
"0.5409714",
"0.54001755",
"0.53951055",
"0.5388514",
"0.53835964",
"0.5381481",
"0.5378632",
"0.537024",
"0.5368144",
"0.53589267",
"0.5354171",
"0.53533304",
"0.5350661",
"0.53492147",
"0.5346881",
"0.534447",
"0.5325455",
"0.5325109",
"0.532415",
"0.53185534",
"0.5317756",
"0.5315408"
] | 0.78939766 | 0 |
Runs the following callbacks: before_validation validate after_validation only if errors.empty? | def validate_with_callbacks
run_callbacks(:before_validation)
validate_without_callbacks
run_callbacks(:after_validation) if errors.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_validations!\n run_callbacks(:validation) do\n super\n end\n end",
"def validate\n # add errors if not validate\n end",
"def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end",
"def _before_validation\n end",
"def extra_validations\n success\n end",
"def after_validate\n end",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def pre_validation\n\n end",
"def validate\n self._errors = {}\n self.run_hook :validate\n not self.errors?\n end",
"def pre_validation\n\n\n end",
"def before_validation_callback\n end",
"def run_validations\n true\n end",
"def validates?\n reset\n @passed = catch :validation_done do\n validate\n pass\n end\n end",
"def add_validation_errors(value); end",
"def errors\n run_validation\n @errors\n end",
"def setting_validations\n if errors.empty?\n errors.add(:value, :blank) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, :inclusion) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, :invalid) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end\n end",
"def errors\n execute_lifecycle(:before, :validation) if self.respond_to? :execute_lifecycle\n errs = []\n self.class.validations.each do |validation|\n errs << (validation.is_a?(Proc) ? self.instance_exec(&validation) : self.send(validation))\n end\n # remove nils\n errs = errs.flatten.select { |x| !x.nil? }\n errs\n end",
"def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end",
"def validate\n errors.clear\n self.class.validator.invoke self\n end",
"def validate_before_update!(user)\n # Calling valid? will reset the error list :( so it has to be done first.\n user.valid?\n\n # NB: These uniqueness constraints have to be enforced by the database\n # also, or else there is a race condition. However, checking for them\n # separately allows us to give a better experience in the common\n # non-race failure conditions.\n unless (user.username.nil? || user.username.empty?) # these are covered by other validations\n existing_users_ids = execute_sql(:validate, :user) do\n table.select(:id).filter(:username => user.username).map {|u| u[:id]}\n end\n if existing_users_ids.any? {|id| id != user.id }\n user.username_not_unique!\n end\n end\n\n unless (user.email.nil? || user.email.empty?) # validated elsewhere\n existing_users_ids = execute_sql(:validate, :user) do\n table.select(:id).filter(:email => user.email).map {|u| u[:id]}\n end\n if existing_users_ids.any? {|id| id != user.id }\n user.email_not_unique!\n end\n end\n\n unless user.errors.empty?\n self.class.invalid_object!(user.errors.full_messages.join(\", \"))\n end\n\n true\n end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def valid?\n errors.clear\n\n run_callbacks(:validate)\n validate\n\n if new_record?\n run_callbacks(:validate_on_create)\n validate_on_create\n else\n run_callbacks(:validate_on_update)\n validate_on_update\n end\n\n errors.empty?\n end",
"def should_validate\n validation_trigger\n end",
"def validate\r\n validate! rescue false\r\n end",
"def valid?\n super\n errors.empty?\n end",
"def before_validation_on_update\n before_validation_on_create\n end",
"def run_validations(validation_rules)\n validation_errors = []\n validation_rules.order(:run_order).each do |vr|\n vr.refresh_errors_if_needed(self)\n validation_errors << vr.validation_errors_for_aru(self)\n end\n validation_errors.flatten\n end",
"def validate_on_save(fields)\n end",
"def errors\n self.class.validator.call self\n end",
"def validate\n [perform_validation].flatten.compact\n end",
"def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\"- Person must have at least one phonenumber\") if (self.phone_home.blank? && self.phone_cell.blank? && self.phone_work.blank?) \n end",
"def partition_validations\n @post_load_validations = @validations.select(&:deferred?)\n @pre_load_validations = @validations.reject(&:deferred?)\n end",
"def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n else\n [image_changes.created,\n image_changes.updated,\n unit_changes.created,\n unit_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end",
"def do_validation \n return true if self.ok\n set_ok\n self.ok\n end",
"def validation_errors(reset = false)\n self.errors = [] if reset\n self.errors\n end",
"def run_validations(context)\n __run_validations__(context)\n end",
"def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end",
"def perform_validation?\n self.skip_validation == true ? false : true\n end",
"def setting_validations\n errors.add(:value, I18n.t(:blank, :scope => 'activerecord.errors.messages')) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, I18n.t(:inclusion, :scope => 'activerecord.errors.messages')) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, I18n.t(:invalid, :scope => 'activerecord.errors.messages')) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end",
"def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end",
"def subclass_validations ; true ; end",
"def validate_all\n current_user.valid?(:save) && valid?(:create) && address_valid?(:save)\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend",
"def validate_before_create!(user)\n # Calling valid? will reset the error list :( so it has to be done first.\n user.valid?\n\n # NB: These uniqueness constraints have to be enforced by the database\n # also, or else there is a race condition. However, checking for them\n # separately allows us to give a better experience in the common\n # non-race failure conditions.\n unless (user.username.nil? || user.username.empty?)\n if execute_sql(:validate, :user) { table.select(:username).filter(:username => user.username).any? }\n user.username_not_unique!\n end\n end\n\n unless (user.email.nil? || user.email.empty?)\n if execute_sql(:validate, :user) { table.select(:email).filter(:email => user.email).any? }\n user.email_not_unique!\n end\n end\n\n unless user.errors.empty?\n self.class.invalid_object!(user.errors.full_messages.join(\", \"))\n end\n\n true\n end",
"def validate!\n validate_patches!\n validate_new_branch_name! if new_branch?\n validate_permissions!\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rails_error\n\t end\nend",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validation; end",
"def validation; end",
"def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end",
"def validate!\n # pass\n end",
"def sub_validate(sub_association, attributes)\n return unless @validate_others\n\n sub_association.validates_presence_of attributes\n propagate_errors_up(sub_association, true)\n end",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def _valid?(opts)\n return errors.empty? if frozen?\n errors.clear\n called = false\n skip_validate = opts[:validate] == false\n around_validation do\n called = true\n before_validation\n validate unless skip_validate\n after_validation\n end\n\n return true if skip_validate\n\n if called\n errors.empty?\n else\n raise_hook_failure(:around_validation)\n end\n end",
"def validate\n super \n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate\n @invalid=false\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:postal_address_type_code => self.postal_address_type_code},{:city => self.city},{:address1 => self.address1}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_postal_address\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate_on_create; end",
"def validate_on_update(fields)\n check_required_fields(fields, self.class.required_on_update)\n validate_on_save(fields)\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def errors\n validate_or_get_results :errors\n end",
"def validation(&validation_block)\n raise HullValidationMethods::NoValidationBlockGiven if !block_given?\n errors.clear\n begin\n yield validation_block\n rescue HullValidationMethods::ValidationError\n return false\n end\n self.errors.empty?\n end",
"def valid?\n run_validations unless validated?\n failed_validators.list.empty?\n end",
"def validate\r\n @invalid=false\r\n end",
"def validate(attributes, other_attributes = [])\n @association.validates_presence_of attributes unless attributes.empty?\n @association.validates_presence_of other_attributes if @validate_others\n @association.errors.none?\n end",
"def _valid?(opts)\n return errors.empty? if frozen?\n errors.clear\n called = false\n # skip_validate = opts[:validate] == false # SEQUEL5\n around_validation do\n called = true\n if before_validation == false\n Sequel::Deprecation.deprecate(\"Having before_validation return false to mark the object as invalid\", \"Instead, call cancel_action inside before_validation\")\n raise_hook_failure(:before_validation)\n else\n validate # unless skip_validate # SEQUEL5\n after_validation\n end\n end\n # return true if skip_validate # SEQUEL5\n if called\n errors.empty?\n else\n raise_hook_failure(:around_validation)\n end\n end",
"def valid?\n run_validation\n @errors.empty?\n end",
"def validate\n super\n end",
"def check_for_child_validation_errors\n result = true\n result &= check_for_child_validation_error(:current_user)\n result &= check_for_child_validation_error(:company)\n result &= check_for_child_validation_error(:account_type)\n result &= check_for_child_validation_error(:address)\n result\n end",
"def validate_on_create(fields)\n check_required_fields(fields, self.class.required_on_create)\n validate_on_save(fields)\n end",
"def validate\n\n end",
"def valid?\n errors.blank?\n end",
"def valid?\n validate\n errors.empty?\n end",
"def validate\n super\n errors.add(:name, \"can't be empty\") if name.blank?\n errors.add(:category_id, \"can't be empty\") if category_id.blank?\n errors.add(:price, \"can't be empty\") if price.blank?\n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def save_with_validation!()\n if valid?\n save_without_validation!()\n else\n raise RecordInvalid.new(self)\n end\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:temperature_device_type_code => self.temperature_device_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_temperature_device_type\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:unit_type_code => self.unit_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_unit_type\n\t end\nend",
"def validate\n validations = self.class.meta_eval { @validations }\n\n validations.each do |v|\n raise \"#{self.class}.#{v[:name]} #{v[:options][:message]}\" unless\n v[:proc].call(send(v[:name]))\n end\n\n self\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def valid?\r\n errors.empty?\r\n end",
"def valid?\r\n errors.empty?\r\n end",
"def validate\n begin\n validatable_rules.map{ |k, v| self.send(\"validate_\" + k.to_s) }\n rescue Errors::ValidationError => e\n raise decorate_error e\n end\n end",
"def valid?\n validate\n @errors.empty?\n end",
"def validate\n valid?\n end",
"def validate\n validate_root\n validate_associated\n valid?\n end",
"def save(options={})\n perform_validations(options) ? super : false\n end",
"def validate\n \n \n end",
"def set_callbacks\n validate :merge_media_errors\n before_save :remove_old_media\n end",
"def validate; end"
] | [
"0.7638646",
"0.7369778",
"0.7315629",
"0.7263786",
"0.7202742",
"0.7178205",
"0.7132834",
"0.7132462",
"0.7098271",
"0.7094484",
"0.70940614",
"0.70020056",
"0.67042446",
"0.66954356",
"0.65865505",
"0.6568375",
"0.65666157",
"0.6556527",
"0.65494287",
"0.65422493",
"0.65239024",
"0.6516914",
"0.6475522",
"0.6474776",
"0.6473007",
"0.64502513",
"0.64352566",
"0.6426799",
"0.64006215",
"0.6388067",
"0.637969",
"0.6376929",
"0.6352692",
"0.63508326",
"0.6344114",
"0.6325197",
"0.63102055",
"0.6294309",
"0.6274251",
"0.62691057",
"0.6252918",
"0.62042975",
"0.6196947",
"0.6187319",
"0.61868066",
"0.6184807",
"0.6181237",
"0.6181237",
"0.6181237",
"0.617816",
"0.617816",
"0.61779773",
"0.6177577",
"0.6174317",
"0.6163269",
"0.6130081",
"0.6120381",
"0.6118114",
"0.61176646",
"0.6117312",
"0.6108555",
"0.6072712",
"0.6062453",
"0.60599697",
"0.60537636",
"0.60428864",
"0.6039646",
"0.6036645",
"0.60323805",
"0.6031109",
"0.60157675",
"0.6010006",
"0.60077935",
"0.6004954",
"0.5997756",
"0.5995349",
"0.5994918",
"0.5990599",
"0.5988451",
"0.59852004",
"0.59852004",
"0.5977016",
"0.5977016",
"0.5977016",
"0.5974853",
"0.5965974",
"0.59594256",
"0.595827",
"0.595827",
"0.595827",
"0.59579086",
"0.59579086",
"0.59525746",
"0.59448457",
"0.5936622",
"0.5936132",
"0.5933463",
"0.59286404",
"0.59283483",
"0.59275544"
] | 0.8428882 | 0 |
> foo > foo | def extract_type1
if url = query_info.urls.first
if url = URI::Parser.new.extract(url).first
uri = URI(url)
if uri.path
if md = uri.path.match(%r{/users/history/(.*)|/users/(.*)})
s = md.captures.compact.first
ERB::Util.html_escape(s)
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def >(object, fd = 1)\n redirect!(object, fd, 'w')\n end",
"def dup; end",
"def dup; end",
"def dup; end",
"def dup; end",
"def >>(object, fd = 1)\n redirect!(object, fd, 'a')\n end",
"def dup() end",
"def write(output_to); end",
"def dup! ; self ; end",
"def test_can_pipe_output_to_another_fn\n result = interpret @lib + 'x=mkattr(foo:, 2); %x.foo | dup()'\n assert_eq result, 2\n end",
"def redirect\n orig_defout = $defout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = orig_defout\n end",
"def tempfile; end",
"def tempfile; end",
"def write(dest); end",
"def write(dest); end",
"def write(dest); end",
"def dest; end",
"def _dump\n end",
"def tempfile=(_arg0); end",
"def _dump(arg0)\n end",
"def _dump() end",
"def write_history; end",
"def dup(*) end",
"def map_error_output(filename)\r\n\tDir.mkdir(\"#{settings.root}/tmp\") unless File.exists?(\"#{settings.root}/tmp\")\r\n\tfile = File.new(\"#{settings.root}/tmp/#{filename}\", 'a+')\r\n\tfile.sync = true\r\n\t$stderr.reopen file\r\nend",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def >>(arg0)\n end",
"def >>(arg0)\n end",
"def foo\n p 'bar'\nend",
"def redirect_output!; end",
"def dumpme!(filename)\n File.unlink(filename) if File.exists?(filename)\n File.open(filename, \"w\") {|f| f << Marshal.dump(self)}\n end",
"def _dump(*args)\n raise \"not implemented yet\"\n end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def foo\n puts \"bar\"\n end",
"def dump() end",
"def dup\n end",
"def dup\n end",
"def write(output, indent = T.unsafe(nil)); end",
"def print(line)\n if $output_filename == '__to_stdout'\n printf(\"%s\",line)\n else\n f = File.open($output_filename,'a')\n f.write(line)\n f.close()\n end\nend",
"def writethis; end",
"def emitln(s, out: $output)\n emit(s, out: out)\n out.puts\nend",
"def emitln(s, out: $output)\n emit(s, out: out)\n out.puts\nend",
"def emitln(s, out: $output)\n emit(s, out: out)\n out.puts\nend",
"def <<(arg); end",
"def _cp(obj = Readline::HISTORY.entries[-2], *options)\n if obj.respond_to?(:join) && !options.include?(:a)\n if options.include?(:s)\n obj = obj.map { |element| \":#{element.to_s}\" }\n end\n out = obj.join(\", \")\n elsif obj.respond_to?(:inspect)\n out = obj.is_a?(String) ? obj : obj.inspect\n end\n \n if out\n IO.popen('pbcopy', 'w') { |io| io.write(out) } \n \"copied!\"\n end\nend",
"def puts(s)\n $output = s\nend",
"def format_redirect_stdout(cmd, target = NULL_OUTPUT_NAME)\n return cmd + \" 1>#{target}\"\n end",
"def write; end",
"def write; end",
"def copy(obj)\n obj.to_s.copy\nend",
"def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end",
"def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end",
"def my_backticks(cmd)\n rd, wr = IO.pipe\n\n pid = fork {\n rd.close\n\n $stdout.reopen(wr)\n exec(cmd)\n }\n\n wr.close\n Process.wait(pid)\n rd.read\nend",
"def write(output, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end",
"def write(output, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end",
"def cop; end",
"def cop; end",
"def format_redirect_both(cmd, target = NULL_OUTPUT_NAME)\n return cmd + \" 1>#{target} 2>&1\"\n end",
"def puts(msg = '', yaml_comment = true)\n msg = \"#{msg}\\n\"\n $stdout.write msg\n if yaml_comment && msg != \"\\n\"\n $outfile.write \"# #{msg}\"\n else\n $outfile.write msg\n end\nend",
"def stdouts; end",
"def without_stderr; end",
"def foo\n 'foo'\n end",
"def write(out, indent = T.unsafe(nil)); end",
"def write(out, indent = T.unsafe(nil)); end",
"def foo\n send_output(\"bar\")\n end",
"def stupid_program\n puts \"HI I AM A STUPID PROGRAM BECAUSE I WRITE TO STDOUT LOL\" # always writes to $stdout\nend",
"def foo; end",
"def foo; end",
"def foo; end",
"def out; end",
"def droby_dump(dest)\n\t DRoby.new(controlable?, happened?, Distributed.format(task, dest), symbol)\n\tend",
"def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend",
"def stdout_redirect(stdout = T.unsafe(nil), stderr = T.unsafe(nil), append = T.unsafe(nil)); end",
"def _dump(depth)\n \"\"\n end",
"def _dump(depth)\n \"\"\n end",
"def redirect\n $stdin.reopen '/dev/null'\n $stdout.reopen File.new(out, \"a\")\n $stderr.reopen File.new(err, \"a\")\n $stdout.sync = $stderr.sync = true\n end",
"def copy\n \n end",
"def silent_out\n stdout = $stdout\n $stdout = StringIO.new\n begin\n yield if block_given?\n ensure\n $stdout = stdout\n end\nend",
"def cop=(_); end",
"def cop=(_); end",
"def dump contents;\r\n # p contents\r\n @dumps = Array.new unless @dumps \r\n @dumps << contents \r\n end",
"def <<(string); end",
"def <<(string); end"
] | [
"0.56730825",
"0.5659433",
"0.5659433",
"0.5659433",
"0.5659433",
"0.54764163",
"0.5461758",
"0.545702",
"0.5423509",
"0.5367031",
"0.5334635",
"0.52974695",
"0.52974695",
"0.52933174",
"0.52933174",
"0.52933174",
"0.529284",
"0.52759063",
"0.5242513",
"0.51937556",
"0.51913863",
"0.5190107",
"0.5179091",
"0.51631016",
"0.51630837",
"0.51630837",
"0.51630837",
"0.51630837",
"0.51630837",
"0.51630837",
"0.51360744",
"0.51360744",
"0.5130954",
"0.5118289",
"0.5103081",
"0.50923586",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5076219",
"0.5074194",
"0.5054883",
"0.50470716",
"0.50470716",
"0.50454676",
"0.50284153",
"0.49936813",
"0.49899575",
"0.49899575",
"0.49899575",
"0.49682367",
"0.49660328",
"0.49616057",
"0.49612406",
"0.49521905",
"0.49521905",
"0.4946364",
"0.49415165",
"0.49415165",
"0.49300906",
"0.4928251",
"0.4928251",
"0.4926432",
"0.4926432",
"0.49209848",
"0.49123132",
"0.49019542",
"0.49001363",
"0.48913482",
"0.48900577",
"0.48900577",
"0.48855314",
"0.48826072",
"0.48742545",
"0.48742545",
"0.48742545",
"0.4870567",
"0.48619354",
"0.485331",
"0.4850968",
"0.483681",
"0.483681",
"0.48350134",
"0.48288178",
"0.48202446",
"0.48197773",
"0.48197773",
"0.48125952",
"0.4809247",
"0.4809247"
] | 0.0 | -1 |
What parameters are missing for a CreateStack call, where UsePreviousValue has no meaning. | def missing_for_create
# If we haven't set a value, and there is no default, we can't
# create the stack.
@hash.values.select { |v| !v.set? && !v.default? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack(*args); end",
"def stack(new_scope = T.unsafe(nil)); end",
"def stack; end",
"def stack; end",
"def stack\n @values.fetch('stack') { \n @values['stack'] = nil\n }\n end",
"def create_stack(stack_name, options = {})\n params = {\n 'StackName' => stack_name,\n }\n\n if options['DisableRollback']\n params['DisableRollback'] = options['DisableRollback']\n end\n\n if options['OnFailure']\n params['OnFailure'] = options['OnFailure']\n end\n\n if options['NotificationARNs']\n params.merge!(Fog::AWS.indexed_param(\"NotificationARNs.member\", [*options['NotificationARNs']]))\n end\n\n if options['Parameters']\n options['Parameters'].keys.each_with_index do |key, index|\n index += 1 # params are 1-indexed\n params.merge!({\n \"Parameters.member.#{index}.ParameterKey\" => key,\n \"Parameters.member.#{index}.ParameterValue\" => options['Parameters'][key]\n })\n end\n end\n\n num_tags = 0\n if options['Tags']\n options['Tags'].keys.each_with_index do |key, index|\n index += 1 # tags are 1-indexed\n num_tags += 1 # 10 tag max\n\n params.merge!({\n \"Tags.member.#{index}.Key\" => key,\n \"Tags.member.#{index}.Value\" => options['Tags'][key]\n })\n end\n end\n\n if num_tags > 10\n raise ArgumentError.new(\"a maximum of 10 tags can be specified <#{num_tags}>\")\n end\n\n if options['TemplateBody']\n params['TemplateBody'] = options['TemplateBody']\n elsif options['TemplateURL']\n params['TemplateURL'] = options['TemplateURL']\n end\n\n if options['StackPolicyBody']\n params['StackPolicyBody'] = options['StackPolicyBody']\n elsif options['StackPolicyURL']\n params['StackPolicyURL'] = options['StackPolicyURL']\n end\n\n if options['TimeoutInMinutes']\n params['TimeoutInMinutes'] = options['TimeoutInMinutes']\n end\n\n if options['Capabilities']\n params.merge!(Fog::AWS.indexed_param(\"Capabilities.member\", [*options['Capabilities']]))\n end\n\n request({\n 'Action' => 'CreateStack',\n :parser => Fog::Parsers::AWS::CloudFormation::CreateStack.new\n }.merge!(params))\n end",
"def to_stack; end",
"def parsed_stack\n @values.fetch('parsedStack') { \n @values['parsedStack'] = []\n }\n end",
"def callstack\n @callstack.dup\n end",
"def stack=(value)\n if value == @defaults['stack']\n @values.delete 'stack' if @values.key? 'stack'\n else\n @values['stack'] = value\n end\n end",
"def parsed_stack=(value)\n if value == @defaults['parsedStack']\n @values.delete 'parsedStack' if @values.key? 'parsedStack'\n else\n @values['parsedStack'] = value\n end\n end",
"def stack\n @stack\n end",
"def common_stack_params(stack)\n params = Smash.new(\"StackName\" => stack.name)\n if stack.dirty?(:parameters)\n initial_parameters = stack.data[:parameters] || {}\n else\n initial_parameters = {}\n end\n (stack.parameters || {}).each_with_index do |pair, idx|\n params[\"Parameters.member.#{idx + 1}.ParameterKey\"] = pair.first\n if initial_parameters[pair.first] == pair.last\n params[\"Parameters.member.#{idx + 1}.UsePreviousValue\"] = true\n else\n params[\"Parameters.member.#{idx + 1}.ParameterValue\"] = pair.last\n end\n end\n (stack.capabilities || []).each_with_index do |cap, idx|\n params[\"Capabilities.member.#{idx + 1}\"] = cap\n end\n (stack.notification_topics || []).each_with_index do |topic, idx|\n params[\"NotificationARNs.member.#{idx + 1}\"] = topic\n end\n (stack.tags || {}).each_with_index do |tag, idx|\n params[\"Tags.member.#{idx + 1}.Key\"] = tag.first\n params[\"Tags.member.#{idx + 1}.Value\"] = tag.last\n end\n if stack.template_url\n params[\"TemplateURL\"] = stack.template_url\n elsif !stack.dirty?(:template) && stack.persisted?\n params[\"UsePreviousTemplate\"] = true\n else\n params[\"TemplateBody\"] = MultiJson.dump(stack.template)\n end\n params\n end",
"def __stack\n @stack\n end",
"def cfn_create_stack(region, dependent_stack_name, template, stack_name, keys: [], extra_parameters: [])\n cfn = cfn_resource(cfn_client(region))\n stack = wait_stack(cfn, dependent_stack_name)\n extra_parameters_cleaned = extra_parameters.map do |x|\n if x.key? 'ParameterKey'\n {\n parameter_key: x['ParameterKey'],\n parameter_value: x['ParameterValue']\n }\n else\n x\n end\n end\n options = {\n stack_name: stack_name,\n template_body: template,\n parameters: generate_parameters(stack, keys) + extra_parameters_cleaned\n }\n cfn.create_stack(options)\n end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def create_stack(name, options = {})\n given = options.dup\n query = {'Action' => 'CreateStack', 'StackName' => name}\n\n if parameters = given.delete('Parameters')\n parameters.each_with_index do |(key, value), idx|\n query[\"Parameters.member.#{idx + 1}.ParameterKey\"] = key\n query[\"Parameters.member.#{idx + 1}.ParameterValue\"] = value\n end\n end\n\n if notifications = given.delete('NotificationARNs')\n notifications.each_with_index do |member, idx|\n query[\"NotificationARNs.member.#{idx + 1}\"] = member\n end\n end\n\n query.merge!(given)\n\n response = request(query).xpath('//aws:CreateStackResponse', NS)\n id = response.xpath('aws:CreateStackResult/aws:StackId', NS).text\n rid = response.xpath('aws:ResponseMetadata/aws:RequestId', NS).text\n return {:stack_id => id, :response_id => id}\n end",
"def stack_top\n self # okay maybe I'll implement this\n end",
"def add_stacks\n variable_stack.add_stack\n value_stack.add_stack\n end",
"def __stack\n @stack ||= []\n end",
"def push_stack\n bb = {:black => get_black,:white => get_white}\n @stack.push(Marshal.load(Marshal.dump(bb)))\n @stack.shift if @stack.size > @options[:stack_limit]\n end",
"def stack_size()\n #This is a stub, used for indexing\n end",
"def stackup_params\n params[:stackup]\n end",
"def StartStack\n\n end",
"def push_nil\n \"stack_push(Qnil);\"\n end",
"def create_stack(name, template, parameters)\n cfm = AWS::CloudFormation.new\n\n stack = cfm.stacks.detect { |s| s.name == name }\n\n # Helpful when spinning up and down the stack for testing.\n unless stack.nil?\n wait_statuses = %w{DELETE_IN_PROGRESS ROLLBACK_IN_PROGRESS}\n if stack.status == 'ROLLBACK_COMPLETE'\n stack.delete\n stack = nil\n elsif wait_statuses.include?(stack.status)\n puts 'Stack is being deleted or rolled back. Please wait.'\n sleep 2 while stack.exists? and wait_statuses.include?(stack.status)\n stack = nil\n end\n end\n\n if stack.nil? or !stack.exists?\n stack = cfm.stacks.create(name, template, parameters: parameters, capabilities: ['CAPABILITY_IAM'])\n else\n # Updating is somewhat problematic because a simple format change will raise an exception.\n stack.update(template: template, parameters: parameters) if template != stack.template\n end\n\n # Send back the stack progress along the way.\n while stack.status.include? 'PROGRESS'\n last_event = stack.events.first\n yield last_event if block_given?\n sleep 2\n end\n\n stack\n end",
"def get_method_stack(fqns, name, scope: T.unsafe(nil)); end",
"def parameters\n @stack.parameters\n end",
"def stack(which, name)\n @@stacks[which][name]\n end",
"def state_push(parameters = {}, invocation_options = {})\n exec(RubyTerraform::Commands::StatePush,\n parameters, invocation_options)\n end",
"def create_stack(stack_name, options = {})\n request({\n 'Action' => 'CreateStack',\n 'StackName' => stack_name,\n :parser => Fog::Parsers::AWS::CloudFormation::CreateStack.new\n }.merge!(options))\n end",
"def take_from_stack\n stack.pop\n end",
"def stack_params\n params.require(:stack).permit(:name, :public, :default, :description, :links, :supplement_ids, :user_id)\n end",
"def trace_up(stack = [])\n stack << self\n return previous_in_chain.trace_up(stack) if previous_in_chain.present?\n stack.reverse # Reversing because the top most one will be at the end.\n end",
"def initialize\n @stack = []\n end",
"def initialize\n @stack = []\n end",
"def push(stack, node)\n if stack.argument_definitions.last\n arg_type = stack.argument_definitions.last.type.unwrap\n if arg_type.kind.input_object?\n argument_defn = arg_type.arguments[node.name]\n else\n argument_defn = nil\n end\n elsif stack.directive_definitions.last\n argument_defn = stack.directive_definitions.last.arguments[node.name]\n elsif stack.field_definitions.last\n argument_defn = stack.field_definitions.last.arguments[node.name]\n else\n argument_defn = nil\n end\n stack.argument_definitions.push(argument_defn)\n stack.path.push(node.name)\n end",
"def return_stack\n return @state[:fiber][:return_stack]\n end",
"def shift_stacks\n if @stack_oldest.top.data == nil\n while @stack_newest.top.data != nil\n value = @stack_newest.pop.data\n @stack_oldest.push(value) if value != nil\n end\n end\n end",
"def lambda_stack; end",
"def lambda_stack; end",
"def lambda_stack; end",
"def stack(name)\n stacks = (Thread.current[:__moped_threaded_stacks__] ||= {})\n stacks[name] ||= []\n end",
"def push_true\n \"stack_push(Qtrue);\"\n end",
"def initialize\n @stacks = []\n end",
"def test_topOnEmptyStack\n assert_nil(@stack.top)\n end",
"def push_false\n \"stack_push(Qfalse);\"\n end",
"def dup_top\n <<-CODE\n t1 = stack_top();\n stack_push(t1);\n CODE\n end",
"def stack_top\n\n Lib.lua_gettop(@pointer)\n end",
"def create_params\n { stack_name: stack.name }.merge(template_param).merge(options)\n end",
"def create_params\n { stack_name: stack.name }.merge(template_param).merge(options)\n end",
"def push\n CGContextSaveGState(@ctx)\n @stacksize = @stacksize + 1\n end",
"def build_stack\n t = temp_var # alloc temp but the take it over with named one\n NamedTemporaryVariable.new(t.offset, '%stack').tap do |stack_var|\n add copy(stack_var, org.jruby.ir.operands.Array.new)\n end\n end",
"def meta_push_neg_1\n <<-CODE\n stack_push(I2N(-1));\n CODE\n end",
"def push(value)\n return \"Stack is full\" if is_full\n\n @stack.push(value)\n @current_size += 1\n end",
"def stack(values, axis: 0, name: \"stack\")\n _op(:stack, *values, axis: axis, name: name)\n end",
"def top=(val) @img_stack.top = val; end",
"def create_stack(response, resource, properties, parameters, message)\n stack = remote_api(properties[:location]).stacks.build(\n :name => generate_stack_name(resource),\n :template => properties.fetch(:stack, fetch_template(properties[:template_url])),\n :parameters => Hash[parameters.map{|k,v| [Bogo::Utility.camel(k), v] }]\n )\n stack.save\n until(stack.state.to_s.end_with?('complete'))\n message.touch!\n debug \"Waiting for created stack to reach completion...\"\n sleep 5\n stack.reload\n end\n if(stack.state.to_s.end_with?('complete') || stack.state.to_s.end_with?('failed'))\n stack.outputs.each do |output|\n response['Data'][\"Outputs.#{output.key}\"] = output.value\n end\n response['PhysicalResourceId'] = [\n properties[:location],\n stack.id\n ].join(LOCATION_JOINER)\n true\n else\n response['Status'] = 'FAILED'\n response['Reason'] = 'Stack creation failed!'\n stack.destroy\n false\n end\n end",
"def add(value)\n @stack.push(value)\n end",
"def instr_BUILD(instruction_stack)\n\t\targ = @stack.pop\n\t\[email protected][\"__state\"] = arg\n\tend",
"def create_stack_with_http_info(stack_definition, organization, name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StacksApi.create_stack ...\"\n end\n # verify the required parameter 'stack_definition' is set\n if @api_client.config.client_side_validation && stack_definition.nil?\n fail ArgumentError, \"Missing the required parameter 'stack_definition' when calling StacksApi.create_stack\"\n end\n # verify the required parameter 'organization' is set\n if @api_client.config.client_side_validation && organization.nil?\n fail ArgumentError, \"Missing the required parameter 'organization' when calling StacksApi.create_stack\"\n end\n if @api_client.config.client_side_validation && organization !~ Regexp.new(/[0-9a-z\\\\-]+/)\n fail ArgumentError, \"invalid value for 'organization' when calling StacksApi.create_stack, must conform to the pattern /[0-9a-z\\\\-]+/.\"\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling StacksApi.create_stack\"\n end\n if @api_client.config.client_side_validation && name !~ Regexp.new(/[a-z0-9\\\\-_]+/)\n fail ArgumentError, \"invalid value for 'name' when calling StacksApi.create_stack, must conform to the pattern /[a-z0-9\\\\-_]+/.\"\n end\n\n # resource path\n local_var_path = \"/stacks/{organization}/{name}\".sub('{' + 'organization' + '}', organization.to_s).sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'overwrite'] = opts[:'overwrite'] if !opts[:'overwrite'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(stack_definition)\n auth_names = ['ApiKeyAuth']\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 => 'Stack')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StacksApi#create_stack\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stack_current_size()\n if(@stack == nil)\n return 0\n end\n return @stack.length\n end",
"def initialize()\n @stack=[]\n @value=0\n end",
"def stack\n return (@stack&.stack || [])\n end",
"def create\n @stack = Stack.new(stack_params)\n\n respond_to do |format|\n if @stack.save\n format.html { redirect_to @stack, notice: 'Stack was successfully created.' }\n format.json { render :show, status: :created, location: @stack }\n else\n format.html { render :new }\n format.json { render json: @stack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newCall\n if params.has_key?([:callerName])\n callerName = params[:callerName]\n session[:value] = [params[:callerName]]\n end\n end",
"def meta_push_1\n <<-CODE\n stack_push(I2N(1));\n CODE\n end",
"def interrogate_stack(stack_name, client)\n def get_next_page(client, stack_name, current_items, next_token)\n puts(\"DEBUG: getting stack #{stack_name}\")\n result = client.list_stack_resources({:stack_name=>stack_name,:next_token=>next_token})\n updated_items = current_items.merge(result.stack_resource_summaries.map {|entry| [entry.logical_resource_id, entry.physical_resource_id]}.to_h)\n if result.next_token\n get_next_page(client, stack_name, updated_items, next_token)\n else\n updated_items\n end\n end\n\n get_next_page(client, stack_name, {}, nil)\nend",
"def stack_params\n params.require(:stack).permit(:name, :description, :owner_id)\n end",
"def build_stack_args(payload, directory)\n Smash.new(\n :base_directory => File.join(directory, 'cloudformation'),\n :parameters => load_stack_parameters(payload, directory),\n :ui => Bogo::Ui.new(\n :app_name => 'JackalStacks',\n :defaults => true,\n :output_to => StringIO.new('')\n ),\n :interactive_parameters => false,\n :nesting_bucket => config.get(:orchestration, :bucket_name),\n :apply_nesting => true,\n :processing => true,\n :options => {\n :disable_rollback => true,\n :capabilities => ['CAPABILITY_IAM']\n },\n :credentials => config.get(:orchestration, :api, :credentials),\n :file => payload.fetch(:data, :stacks, :template, config.get(:default_template_path)),\n :file_path_prompt => false,\n :poll => false\n )\n end",
"def stack_params\n params.require(:stack).permit(:api_id, :name, :slug, :popularity)\n end",
"def stack_trace=(_arg0); end",
"def push_value(definition)\n value_stack.push(definition) if definition && !value_stack.empty?\n end",
"def payload_stack_adjustment\n opts['Payload'] ? opts['Payload']['StackAdjustment'] : nil\n end",
"def meta_push_0\n <<-CODE\n stack_push(I2N(0));\n CODE\n end",
"def test_push_and_pop\n\tn = Stack.new()\n\tn.push(3)\n\tn.push(4)\n\tn.push(5)\n\tassert_equal(5, n.pop)\n\tassert_equal(4, n.pop)\n\tassert_equal(3, n.pop)\n\tassert_raise(RuntimeError) {n.pop}\n end",
"def create_or_update(op)\n upload_all_conditional()\n required_capabilities = get_stack_required_capabilities()\n tags = @mgr.tags.apitags()\n params = {\n stack_name: @mgr.stack_family + @stackname,\n tags: tags,\n capabilities: required_capabilities,\n disable_rollback: @disable_rollback,\n template_body: @raw,\n }\n parameters = get_stack_parameters()\n write_all()\n if @generate_only\n @mgr.log(:info, \"Exiting without action on user request\")\n return \"generate only\"\n end\n if parameters\n params[:parameters] = parameters\n end\n if op == :create\n stackout = @client.create_stack(params)\n @mgr.log(:info, \"Created stack #{@stackdef}:#{@stackname}: #{stackout.stack_id}\")\n else\n params.delete(:disable_rollback)\n stackout = @client.update_stack(params)\n @mgr.log(:info, \"Issued update for stack #{@stackdef}:#{@stackname}: #{stackout.stack_id}\")\n end\n return stackout\n end",
"def has_full_stack=(value)\n if value == @defaults['hasFullStack']\n @values.delete 'hasFullStack' if @values.key? 'hasFullStack'\n else\n @values['hasFullStack'] = value\n end\n end",
"def initialize\n @info = Array.new(STACK_SIZE)\n @index = 0\n end",
"def initialize(stack)\n @stack = stack\n super stack.api\n end",
"def meta_push_2\n <<-CODE\n stack_push(I2N(2));\n CODE\n end",
"def build_stack\n stack = Stack.new\n rand(1..10).times do |i| \n stack.push(i)\n end\n return stack\nend",
"def stack_depth\n @stack.size\n end",
"def top()\n is_empty ? \"Stack is empty.\" : @stack[-1]\n end",
"def pipeline_stack\n @pipeline_stack ||= []\n end",
"def push(*a) # utility\n @stack.push(*a); self\n end",
"def top()\n is_empty ? \"Stack is empty.\" : @head.value\n end",
"def make_stack(typ)\n # Create the signal array representing the stack.\n depth = @depth\n # puts \"make stack with @depth=#{@depth}\"\n stack_sig = nil\n name = @funcE.name\n HDLRuby::High.cur_system.open do\n stack_sig = typ[-depth].inner(\n HDLRuby.uniq_name(\"#{name}_stack\"))\n end\n # Add it to the list of stacks to handle.\n @stack_sigs << stack_sig\n\n # Returns the index of the newly created stack.\n return @stack_sigs.size-1\n end",
"def top\n @stack[-1]\n end",
"def top\n @stack.last\n end",
"def load_stack\n $LOAD_STACK\n end",
"def begin_create\n create_stack.push(true)\n end",
"def StopStack\n \n end",
"def stack_top\n if @sp.zero?\n nil\n else\n @stack[@sp - 1]\n end\n end",
"def create\n @stack = Stack.new(stack_params)\n\n if @stack.save\n render json: @stack, status: :created, location: @stack\n else\n render json: @stack.errors, status: :unprocessable_entity\n end\n end",
"def top()\n @stack[-1]\n end",
"def stacks(arg)\n ya_ta = tuc(\"x_ya\")\n ra_ta = tuc(\"x_ra\")\n la_ta = tuc(\"x_la\")\n wa_ta = tuc(\"x_wa\")\n\n ra_go = tuc(\"ra_x\")\n la_go = tuc(\"la\")\n sa_go = tuc(\"sa\")\n\n h = Hash.[](\n # subscript YA\n \"ky\"=>tuc(\"ka\")+ya_ta, \"khy\"=>tuc(\"kha\")+ya_ta, \"gy\"=>tuc(\"ga\")+ya_ta,\n \"py\"=>tuc(\"pa\")+ya_ta, \"phy\"=>tuc(\"pha\")+ya_ta, \"by\"=>tuc(\"ba\")+ya_ta, \"my\"=>tuc(\"ma\")+ya_ta,\n # subscript RA\n \"kr\"=>tuc(\"ka\")+ra_ta, \"khr\"=>tuc(\"kha\")+ra_ta, \"gr\"=>tuc(\"ga\")+ra_ta,\n \"tr\"=>tuc(\"ta\")+ra_ta, \"thr\"=>tuc(\"tha\")+ra_ta, \"dr\"=>tuc(\"da\")+ra_ta,\n \"pr\"=>tuc(\"pa\")+ra_ta, \"phr\"=>tuc(\"pha\")+ra_ta, \"br\"=>tuc(\"ba\")+ra_ta, \"mr\"=>tuc(\"ma\")+ra_ta,\n \"shr\"=>tuc(\"sha\")+ra_ta, \"sr\"=>tuc(\"sa\")+ra_ta, \"hr\"=>tuc(\"ha\")+ra_ta,\n # subscript LA\n \"kl\"=>tuc(\"ka\")+la_ta, \"gl\"=>tuc(\"ga\")+la_ta, \"bl\"=>tuc(\"ba\")+la_ta,\n \"zl\"=>tuc(\"za\")+la_ta, \"rl\"=>tuc(\"ra\")+la_ta, \"sl\"=>tuc(\"sa\")+la_ta,\n # subscript WA\n \"kw\"=>tuc(\"ka\")+wa_ta, \"khw\"=>tuc(\"kha\")+wa_ta, \"gw\"=>tuc(\"ga\")+wa_ta, \"grw\"=>tuc(\"ga\")+ra_ta+wa_ta,\n \"cw\"=>tuc(\"ca\")+wa_ta, \"nyw\"=>tuc(\"nya\")+wa_ta, \"tw\"=>tuc(\"ta\")+wa_ta,\n \"dw\"=>tuc(\"da\")+wa_ta, \"tsw\"=>tuc(\"tsa\")+wa_ta, \"tshw\"=>tuc(\"tsha\")+wa_ta,\n \"zhw\"=>tuc(\"zha\")+wa_ta, \"zw\"=>tuc(\"za\")+wa_ta, \"rw\"=>tuc(\"ra\")+wa_ta,\n \"lw\"=>tuc(\"la\")+wa_ta, \"shw\"=>tuc(\"sha\")+wa_ta, \"sw\"=>tuc(\"sa\")+wa_ta, \"hw\"=>tuc(\"ha\")+wa_ta,\n # subscript 'A\n \"t'\"=>tuc(\"ta\")+tuc(\"x_'a\"),\n # superscript RA\n \"rk\"=>ra_go+tuc(\"x_ka\"), \"rg\"=>ra_go+tuc(\"x_ga\"), \"rng\"=>ra_go+tuc(\"x_nga\"), \"rj\"=>ra_go+tuc(\"x_ja\"),\n \"rny\"=>ra_go+tuc(\"x_nya\"), \"rt\"=>ra_go+tuc(\"x_ta\"), \"rd\"=>ra_go+tuc(\"x_da\"), \"rn\"=>ra_go+tuc(\"x_na\"), \"rm\"=>ra_go+tuc(\"x_ma\"),\n \"rb\"=>ra_go+tuc(\"x_ba\"), \"rts\"=>ra_go+tuc(\"x_tsa\"), \"rdz\"=>ra_go+tuc(\"x_dza\"),\n # superscript LA\n \"lk\"=>la_go+tuc(\"x_ka\"), \"lg\"=>la_go+tuc(\"x_ga\"), \"lng\"=>la_go+tuc(\"x_nga\"), \"lc\"=>la_go+tuc(\"x_ca\"),\n \"lj\"=>la_go+tuc(\"x_ja\"), \"lt\"=>la_go+tuc(\"x_ta\"), \"ld\"=>la_go+tuc(\"x_da\"), \"lp\"=>la_go+tuc(\"x_pa\"),\n \"lb\"=>la_go+tuc(\"x_ba\"), \"lh\"=>la_go+tuc(\"x_ha\"),\n # superscript SA\n \"sk\"=>sa_go+tuc(\"x_ka\"), \"sg\"=>sa_go+tuc(\"x_ga\"), \"sng\"=>sa_go+tuc(\"x_nga\"), \"sny\"=>sa_go+tuc(\"x_nya\"),\n \"st\"=>sa_go+tuc(\"x_ta\"), \"sd\"=>sa_go+tuc(\"x_da\"), \"sn\"=>sa_go+tuc(\"x_na\"), \"sp\"=>sa_go+tuc(\"x_pa\"),\n \"sb\"=>sa_go+tuc(\"x_ba\"), \"sm\"=>sa_go+tuc(\"x_ma\"), \"sts\"=>sa_go+tuc(\"x_tsa\"))\n h[arg]\n end",
"def put\n\t\t\tputs STACK.last \n\t\tend"
] | [
"0.6286725",
"0.6212097",
"0.61968577",
"0.61968577",
"0.60174483",
"0.59197414",
"0.58819324",
"0.5743494",
"0.5728175",
"0.57154083",
"0.57132256",
"0.5667861",
"0.5610962",
"0.55951726",
"0.55892414",
"0.5559694",
"0.5559694",
"0.5559694",
"0.5552926",
"0.5518303",
"0.54852587",
"0.5439882",
"0.5431327",
"0.5421071",
"0.5403072",
"0.53929985",
"0.53504735",
"0.53405166",
"0.5337006",
"0.53087854",
"0.52836823",
"0.5262703",
"0.52126926",
"0.5184565",
"0.5179302",
"0.5171627",
"0.5171133",
"0.5171133",
"0.5154182",
"0.5153335",
"0.51511526",
"0.51426667",
"0.51426667",
"0.51426667",
"0.5139816",
"0.51304984",
"0.5126971",
"0.5116546",
"0.5115188",
"0.5098066",
"0.50858915",
"0.50832486",
"0.50832486",
"0.5079164",
"0.5069474",
"0.50523764",
"0.5051851",
"0.5051506",
"0.50402695",
"0.5037857",
"0.49979675",
"0.49886063",
"0.49699908",
"0.49516892",
"0.49487486",
"0.49410284",
"0.49387255",
"0.49363098",
"0.49361244",
"0.49318123",
"0.4931216",
"0.49298862",
"0.49286363",
"0.49265027",
"0.4922109",
"0.49120688",
"0.49048916",
"0.49040246",
"0.49027103",
"0.48973146",
"0.4896047",
"0.48824725",
"0.48653892",
"0.4864907",
"0.4861354",
"0.4849631",
"0.48346797",
"0.48342",
"0.4833023",
"0.48304686",
"0.4830423",
"0.4828037",
"0.48199746",
"0.48107043",
"0.4810023",
"0.48090577",
"0.4806209",
"0.48060203",
"0.48005453",
"0.48001093"
] | 0.54478467 | 21 |
Set the user settings for a user that has REPLICATION SLAVE privilidgess def replication_user=(replication_user_settings) | def replication_user
# TODO: only bail on getting a user if it is acutally used
#raise "You need to specify a replication user!" if @repl_user.nil?
@repl_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postgresql_replication_user\n replication_username = configuration[:postgresql][:replication_username] || \"#{database_environment[:username]}_replication\"\n raise \"Missing configuration[:postgresql][:replication_password], please add and try again\" unless configuration[:postgresql][:replication_password]\n\n psql \"CREATE USER #{replication_username} WITH SUPERUSER ENCRYPTED PASSWORD '#{configuration[:postgresql][:replication_password]}'\",\n :alias => \"postgresql_replication_user\",\n :unless => psql_query('\\\\\\\\du') + \"| grep #{replication_username}\",\n :require => service('postgresql')\n end",
"def set_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end",
"def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end",
"def user=(value)\n conf['dashboard']['user'] = value\n end",
"def set_admin_user(user, password)\n @user = user\n @password = password\n end",
"def set_user_settings\n @settings = Setting.includes(:features).find_or_create_by(provider: @user_domain)\n end",
"def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end",
"def replication_credentials\n {user: @config['mysql_repl_user'], pass: @config['mysql_repl_password']}\n end",
"def user=(the_user)\n authentication.user = the_user\n end",
"def init_usersettings\n UserSetting.create(:user => self)\n end",
"def set_user; end",
"def snmp_user_set(opts = {})\n group = [*opts[:roles]].first\n raise ArgumentError, 'at least one role is required' unless group\n version = opts[:version].to_s.sub('v2', 'v2c')\n cmd = user_cmd = \"snmp-server user #{opts[:name]} #{group} #{version}\"\n if opts[:password] && version == 'v3'\n privacy = opts[:privacy].to_s.scan(/aes|des/).first\n unless privacy\n raise ArgumentError,\n 'privacy is required when managing passwords'\n end\n cmd += \" auth #{opts[:auth] || 'sha'} #{opts[:password]} \"\\\n \"priv #{privacy} #{opts[:password]}\"\n end\n configure cmd\n hash = snmp_user_password_hash(running_config, user_cmd)\n { password: hash[:auth] }\n end",
"def set_subsuser\n @subsuser = Subsuser.find(params[:id])\n end",
"def replication_password\n find_password(\n @mysql_item, \"replication\", node_server[\"replication\"][\"password\"]\n )\n end",
"def replication_type\n settings[:replication_type]\n end",
"def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend",
"def set_user_setting\n @user_setting = UserSetting.find(params[:id])\n end",
"def user=(value)\n conf['api']['user'] = value\n end",
"def user=(new_user, opts={})\n warden.set_user(new_user, opts)\n end",
"def user=(user)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\"user=user=#{user}\"}\n\t\t@user=user\n\t#def_user(user)\n\tend",
"def user\n ActiveScaffold::Registry.user_settings[user_settings_key]\n end",
"def set_users\n\n end",
"def set(user_obj)\n # example code to set it\n # You could also set in DB i.e User.find(id).update_attributes(user_id: user_obj[:userId], settings: user_obj)\n @@user_storage[user_obj[:userId]] = user_obj\n end",
"def active_user=(u)\n @active_user = u\n end",
"def set_user_connection\n @user_connection = UserConnection.find(params[:id])\n end",
"def set_user_connection\n @user_connection = UserConnection.find(params[:id])\n end",
"def user=(user)\n @connection = nil\n @user = user\n end",
"def user_sid=(value)\n @user_sid = value\n end",
"def apply_user_config(user_id)\r\n user_id = user_id.to_i\r\n exec(\r\n 'require_once(\"auth.inc\");',\r\n \"$user_entry = $config[\\\"system\\\"][\\\"user\\\"][#{user_id}];\",\r\n '$user_groups = array();',\r\n 'foreach ($config[\"system\"][\"group\"] as $gidx => $group) {',\r\n ' if (is_array($group[\"member\"])) {',\r\n \" if (in_array(#{user_id}, $group[\\\"member\\\"])) { $user_groups[] = $group[\\\"name\\\"]; }\",\r\n ' }',\r\n '}',\r\n # Intentionally run set_groups before and after to ensure group membership gets fully applied.\r\n 'local_user_set_groups($user_entry, $user_groups);',\r\n 'local_user_set($user_entry);',\r\n 'local_user_set_groups($user_entry, $user_groups);'\r\n )\r\n end",
"def set_sys_user\n @sys_user = Sys::User.find(params[:id])\n end",
"def set_sub_per_user\n @sub_per_user = SubPerUser.find(params[:id])\n end",
"def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend",
"def set_subscription_user\n @subscription_user = SubscriptionUser.find(params[:id])\n end",
"def set_user\n @epsadmin_user = User.find(params[:id])\n end",
"def replication_credentials\n user = false\n pass = false\n if master || slaves.count > 0\n target = (@master ? self : @slaves[0])\n results = target.ssh_cmd(\"cat #{mysql_directory}/master.info | head -6 | tail -2\").split\n if results.count == 2 && results[0] != 'test'\n user, pass = results\n end\n end\n user && pass ? {user: user, pass: pass} : Jetpants.replication_credentials\n end",
"def users=(people)\n set_user_with_role(:responsible, people)\n end",
"def site_user=(value)\n @site_user = value\n end",
"def settings\n @user = User.find(params[:id])\n end",
"def user=(new_user)\n @user = new_user[0..100]\n end",
"def cmd_twitt_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the DM target user to #{args[0]}\")\n\t\t\t\t\t@user = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"def user=(new_user)\n warden.set_user(new_user)\n end",
"def set_user\n @user = @current_user.admin ? User.find(params['id']) : @current_user\n end",
"def user_role_settings(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/roleSettings\", params)\n end",
"def current_user=(user)\n master.current_user = user\n end",
"def user=(user)\n check_user(user)\n set_user(user)\n # returns user\n end",
"def set_user(user)\n @user = user\n end",
"def set_user(user)\n @user = user\n end",
"def user=(user)\n # HKLU hive file\n @file = \"#{@profiles}/#{user}/NTUSER.DAT\"\n\n raise \"Invalid profile: #{@file}\" unless File.exists? @file\n end",
"def user=(value)\n @user = value\n end",
"def user=(value)\n @user = value\n end",
"def set_config_user\n @config_user = ConfigUser.find(params[:id])\n end",
"def create_rconfig_user(user, _password)\r\n vprint_status 'STEP 1 : Adding a temporary admin user...'\r\n fake_id = Rex::Text.rand_text_numeric(3)\r\n fake_pass = Rex::Text.rand_text_alpha(10)\r\n fake_pass_md5 = '21232f297a57a5a743894a0e4a801fc3' # hash of 'admin'\r\n fake_userid_md5 = '6c97424dc92f14ae78f8cc13cd08308d'\r\n userleveladmin = 9 # Administrator\r\n user_sqli = \"command ; INSERT INTO `users` (`id`,`username`,`password`,`userid`,`userlevel`,`email`,`timestamp`,`status`) VALUES (#{fake_id},'#{user}','#{fake_pass_md5}','#{fake_userid_md5}',#{userleveladmin}, '#{user}@domain.com', 1346920339, 1);--\"\r\n sqli_res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, '/commands.inc.php'),\r\n 'method' => 'GET',\r\n 'vars_get' => {\r\n 'search' => 'search',\r\n 'searchOption' => 'contains',\r\n 'searchField' => 'vuln',\r\n 'searchColumn' => user_sqli\r\n }\r\n )\r\n unless sqli_res\r\n print_warning('Failed to create user: Connection failed.')\r\n return\r\n end\r\n print_good \"New temporary user #{user} created\"\r\n end",
"def requestor_settings=(value)\n @requestor_settings = value\n end",
"def set_as_admin\n self.role = USER_ROLES[:admin]\n end",
"def set_sys_user\n @sys_user = Sys::User.find(params[:id])\n end",
"def automatic_user_consent_settings=(value)\n @automatic_user_consent_settings = value\n end",
"def set_user(user)\n agent&.set_user(user)\n end",
"def user(user)\n @options[:user] = user\n end",
"def set_user\n @user = User.find(params[:id])\n redirect_to admin_users_path, alert: 'You are Unauthorized to access that page' if @user.super_admin?\n end",
"def set_user(v)\n set_userinfo(v, @password)\n v\n end",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def set_user\n @user = User.find(params[:uuid])\n end",
"def initialize(bot:, user:)\n super\n @settings = user.student_settings\n end",
"def user_setting(username,\n settings = Hash.new)\n if settings[:add_user]\n page = page_usermanage\n else\n page = page_usermanage(\"Username\" => username)\n end\n form = page.form_with(:name => \"userform\")\n\n if settings[:add_user]\n form.field_with(:name => \"Username\").value = username\n end\n\n if ! settings[:comment].nil?\n form.field_with(:name => \"Comment\").value = settings[:comment]\n end\n\n if ! settings[:password].nil?\n form.field_with(:name => \"Password1\").value = settings[:password]\n form.field_with(:name => \"Password2\").value = settings[:password]\n end\n\n if ! settings[:use_mail].nil?\n if settings[:use_mail]\n form.checkbox_with(:name => \"Mail\").check\n else\n form.checkbox_with(:name => \"Mail\").uncheck\n end\n end\n\n if ! settings[:use_ftp].nil?\n if settings[:use_ftp]\n form.checkbox_with(:name => \"Web\").check\n else\n form.checkbox_with(:name => \"Web\").uncheck\n end\n end\n\n if ! settings[:use_file_sharing].nil?\n if settings[:use_file_sharing]\n form.checkbox_with(:name => \"WebDAV\").check\n else\n form.checkbox_with(:name => \"WebDAV\").uncheck\n end\n end\n\n if settings[:use_mail] == true && settings[:mail_quota].nil?\n settings[:mail_quota] = form.field_with(:name => \"MailQuota\").value\n if settings[:mail_quota].nil? || settings[:mail_quota].empty?\n settings[:mail_quota] = \"200\"\n end\n end\n\n if ! settings[:mail_quota].nil?\n if ! settings[:mail_quota].empty?\n form.field_with(:name => \"MailQuota\").value = settings[:mail_quota]\n end\n end\n\n if ! settings[:virus_check].nil?\n if settings[:virus_check]\n form.radiobuttons_with(:name => \"VirusScan\")[1].check\n else\n form.radiobuttons_with(:name => \"VirusScan\")[0].check\n end\n end\n\n if ! settings[:spam_filter].nil?\n if settings[:spam_filter]\n form.radiobuttons_with(:name => \"SpamFilter\")[1].check\n else\n form.radiobuttons_with(:name => \"SpamFilter\")[0].check\n end\n end\n\n result_page = @agent.submit(form, form.button_with(:name => \"Submit_usermanage\"))\n\n if result_page.uri == URL_PANEL_TOP + \"user\"\n username\n else\n false\n return result_page\n end\n end",
"def update_user_tenant_id(user)\n # set user tenant based on team roles\n begin\n user.reload\n tenant_ids = user.team_roles.map(&:obj).map(&:tenant_id).uniq\n\n tenant = LandLord.default_tenant if tenant_ids.size != 1\n tenant = LandLord.new(tenant_ids[0]).tenant if tenant_ids.size == 1\n\n user.tenant = tenant\n user.configurable_set_parent(tenant)\n user.save\n rescue\n #giveashit\n # (this is untested, in a rush, and I definitely don't want to break things! TS)\n end\n end",
"def alter_user_level(user_level)\n \tself.user_level = user_level\n \tself.save\n end",
"def set_admin_user\n @user = User.find(params[:id])\n end",
"def set_admin_user\n @user = User.find(params[:id])\n end",
"def set_user\n params.delete :matched_desc\n params.delete :host_prep\n params.delete :would_ret\n @user = User.where(user_id: params[:userId])\n end",
"def set_admin_user\n\t@admin_user = current_admin_user\n\tend",
"def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end",
"def set_user\n @user = TaskAdmin.find(params[:id])\n end",
"def user=(usr)\n raise 'You must pass a User class' unless usr.is_a?(User)\n @user = usr\n end",
"def user=(user)\n Thread.current[\"current_user\"] = user\n end",
"def username=(user) #method name is username= and it takes on the user parameter and sets it equals to the username variable \n @username = user\n end",
"def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end",
"def session_auth=(user)\n execute \"SET SESSION AUTHORIZATION #{user}\"\n end",
"def synchronization_job_settings=(value)\n @synchronization_job_settings = value\n end",
"def cmd_notify_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the Slack handle to #{args[0]}\")\n\t\t\t\t\t@user_name = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"def remove_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end",
"def set_user\n @user = @application.users.find(params[:id])\n end",
"def set_user\n @user = @current_user\n end",
"def current_user=(user) #This is the \"current_user=\" method which takes \"user\" as it's argument - See Listing 8.2.3 - special syntax for defining such an assignment function\n @current_user = user\n end",
"def set_user\n @blog = Blog.find_by(subdomain: request.subdomain)\n if @blog\n @user = @blog.user\n else\n @user = current_user\n end\n end",
"def set_user\n @blog = Blog.find_by(subdomain: request.subdomain)\n if @blog\n @user = @blog.user\n else\n @user = current_user\n end\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def user_settings\n\n prompt.select (\"Choose an option\") do |menu|\n menu.choice \"Delete account\", -> {\n answer = prompt.yes? (\"Are you sure?\")\n if answer \n User.find(user_id).delete_account \n user_id = nil \n welcome\n else\n puts \"Glad you're staying\" \n user_settings\n end\n }\n\n menu.choice \"Change Password\\n\", -> {\n\n password = prompt.mask(\"Enter your current password:\")\n while User.find(user_id).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your current password:\")\n end\n\n password = prompt.mask(\"Choose a new password over 5 characters.\")\n while password.length < 5\n puts \"Password too short - must be over 5 characters long\"\n password = prompt.mask(\"Choose a new password over 5 characters.\")\n end\n\n User.find(user_id).change_password(password)\n user_settings\n }\n\n menu.choice \"Return to threads\", -> {show_threads}\n end \n\n end",
"def set_user\n\t\tif(session[:role]=='administrator')\n \t\t@user = User.find(params[:id])\n\t\telse\n\t\t\t@user = @current_user\n\t\tend\n end",
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end",
"def set_user_admin\n @user_admin = UserAdmin.find(params[:id])\n end",
"def set_usuario\n \n end",
"def user_roles=(value)\n roles[:user_roles]=value\n end",
"def set_setting\n @setting = Setting.for_user(current_user).find(params[:id])\n end",
"def current_user=(user) # assignment to current_user, method current_user= with arg as (user) \n\t@current_user = user \n end",
"def status=(new_status)\n payload = {\n 'user' => {\n 'content' => {\n 'status' => new_status.to_s.upcase,\n 'userRoles' => @json['user']['content']['userRoles']\n },\n 'links' => {\n 'self' => uri\n }\n }\n }\n\n @json = client.post(\"/gdc/projects/#{project_id}/users\", payload)\n end",
"def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end",
"def set_user_template(opts)\n opts = check_params(opts,[:templates])\n super(opts)\n end",
"def set_version_user(version, user)\n unless @versions.key?(OcflTools::Utils.version_int_to_string(version))\n raise OcflTools::Errors::RequestedKeyNotFound, \"Version #{version} does not yet exist!\"\n end\n\n @versions[OcflTools::Utils.version_int_to_string(version)]['user'] = user\n end",
"def user=(_user)\n self.user_id = _user.id\n\n _user\n end",
"def set_userconfig\n @userconfig = Userconfig.find(params[:id])\n end"
] | [
"0.63998413",
"0.62272996",
"0.6082902",
"0.60521394",
"0.58521193",
"0.5829461",
"0.5779877",
"0.5747542",
"0.56285447",
"0.55564",
"0.55329454",
"0.54941034",
"0.54841346",
"0.5476899",
"0.5464212",
"0.54454464",
"0.54448277",
"0.54380196",
"0.5424635",
"0.5409752",
"0.5406493",
"0.5402027",
"0.5395642",
"0.535983",
"0.5311136",
"0.52870566",
"0.52816445",
"0.5223021",
"0.52085984",
"0.51945055",
"0.5194216",
"0.51870704",
"0.5185266",
"0.5167733",
"0.5128432",
"0.5117466",
"0.5108471",
"0.51002663",
"0.50990963",
"0.5097527",
"0.50922966",
"0.5085304",
"0.5083931",
"0.5075302",
"0.505965",
"0.50543594",
"0.50543594",
"0.50538266",
"0.5051988",
"0.5051988",
"0.504612",
"0.50385284",
"0.5036544",
"0.503519",
"0.50330395",
"0.5009203",
"0.5002311",
"0.49959683",
"0.4993098",
"0.49878323",
"0.4986394",
"0.498535",
"0.49691796",
"0.49682102",
"0.4965563",
"0.49629188",
"0.4961524",
"0.4961524",
"0.49593353",
"0.49537826",
"0.49507958",
"0.49349102",
"0.4932239",
"0.49217427",
"0.4917668",
"0.49173686",
"0.4915493",
"0.4911862",
"0.49082094",
"0.4908071",
"0.49066165",
"0.49041536",
"0.49039185",
"0.49038234",
"0.49038234",
"0.49005324",
"0.4897888",
"0.48961556",
"0.48943946",
"0.48921984",
"0.48807383",
"0.4872041",
"0.48657656",
"0.4863474",
"0.48596737",
"0.4858606",
"0.48543388",
"0.48536202",
"0.4844915",
"0.4843522"
] | 0.6789249 | 0 |
Set the user settings for a user that has SELECT privilidgess def ro_user=(ro_user_settings) | def ro_user
#raise "You need to specify a SELECT user!" if @ro_user.nil?
@ro_user || {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end",
"def set_user_settings\n @settings = Setting.includes(:features).find_or_create_by(provider: @user_domain)\n end",
"def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend",
"def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end",
"def set_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end",
"def settings\n @user = User.find(params[:id])\n end",
"def init_usersettings\n UserSetting.create(:user => self)\n end",
"def user_settings\n\n prompt.select (\"Choose an option\") do |menu|\n menu.choice \"Delete account\", -> {\n answer = prompt.yes? (\"Are you sure?\")\n if answer \n User.find(user_id).delete_account \n user_id = nil \n welcome\n else\n puts \"Glad you're staying\" \n user_settings\n end\n }\n\n menu.choice \"Change Password\\n\", -> {\n\n password = prompt.mask(\"Enter your current password:\")\n while User.find(user_id).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your current password:\")\n end\n\n password = prompt.mask(\"Choose a new password over 5 characters.\")\n while password.length < 5\n puts \"Password too short - must be over 5 characters long\"\n password = prompt.mask(\"Choose a new password over 5 characters.\")\n end\n\n User.find(user_id).change_password(password)\n user_settings\n }\n\n menu.choice \"Return to threads\", -> {show_threads}\n end \n\n end",
"def set_user; end",
"def set_sys_user\n @sys_user = Sys::User.find(params[:id])\n end",
"def reseller_settings\n @page_title = _('Settings')\n @page_icon = 'cog.png'\n\n @countries = Direction.find(:all, :order => \"name ASC\")\n if Confline.get_value(\"User_Wholesale_Enabled\").to_i == 0\n cond = \" AND purpose = 'user' \"\n else\n cond = \" AND (purpose = 'user' OR purpose = 'user_wholesale') \"\n end\n @tariffs = Tariff.find(:all, :conditions => \"owner_id = '#{session[:user_id]}' #{cond} \", :order => \"purpose ASC, name ASC\")\n\n @currencies =Currency.get_active\n @user_id = session[:user_id]\n @user = current_user\n User.exists_resellers_confline_settings(session[:user_id])\n @agreement = Confline.get(\"Registration_Agreement\", session[:user_id])\n\n end",
"def options_for_user(user_or_id)\n user_id = (user_or_id.is_a?(User) ? user_or_id.id : user_or_id)\n RolesUser.find_by_user_id_and_role_id(user_id, self.id).roles_users_option\n end",
"def set_user_setting\n @user_setting = UserSetting.find(params[:id])\n end",
"def find_user_setting\n\t\t# find the user setting\n\t\t@user = current_user.profile_setting\n\tend",
"def set_sys_user\n @sys_user = Sys::User.find(params[:id])\n end",
"def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend",
"def set_user_option\n @all_user = User.all.select(:id,:name).order(:name)\n end",
"def set_user\n params.delete :matched_desc\n params.delete :host_prep\n params.delete :would_ret\n @user = User.where(user_id: params[:userId])\n end",
"def set_user\n @user = @current_user.admin ? User.find(params['id']) : @current_user\n end",
"def user_setting(username,\n settings = Hash.new)\n if settings[:add_user]\n page = page_usermanage\n else\n page = page_usermanage(\"Username\" => username)\n end\n form = page.form_with(:name => \"userform\")\n\n if settings[:add_user]\n form.field_with(:name => \"Username\").value = username\n end\n\n if ! settings[:comment].nil?\n form.field_with(:name => \"Comment\").value = settings[:comment]\n end\n\n if ! settings[:password].nil?\n form.field_with(:name => \"Password1\").value = settings[:password]\n form.field_with(:name => \"Password2\").value = settings[:password]\n end\n\n if ! settings[:use_mail].nil?\n if settings[:use_mail]\n form.checkbox_with(:name => \"Mail\").check\n else\n form.checkbox_with(:name => \"Mail\").uncheck\n end\n end\n\n if ! settings[:use_ftp].nil?\n if settings[:use_ftp]\n form.checkbox_with(:name => \"Web\").check\n else\n form.checkbox_with(:name => \"Web\").uncheck\n end\n end\n\n if ! settings[:use_file_sharing].nil?\n if settings[:use_file_sharing]\n form.checkbox_with(:name => \"WebDAV\").check\n else\n form.checkbox_with(:name => \"WebDAV\").uncheck\n end\n end\n\n if settings[:use_mail] == true && settings[:mail_quota].nil?\n settings[:mail_quota] = form.field_with(:name => \"MailQuota\").value\n if settings[:mail_quota].nil? || settings[:mail_quota].empty?\n settings[:mail_quota] = \"200\"\n end\n end\n\n if ! settings[:mail_quota].nil?\n if ! settings[:mail_quota].empty?\n form.field_with(:name => \"MailQuota\").value = settings[:mail_quota]\n end\n end\n\n if ! settings[:virus_check].nil?\n if settings[:virus_check]\n form.radiobuttons_with(:name => \"VirusScan\")[1].check\n else\n form.radiobuttons_with(:name => \"VirusScan\")[0].check\n end\n end\n\n if ! settings[:spam_filter].nil?\n if settings[:spam_filter]\n form.radiobuttons_with(:name => \"SpamFilter\")[1].check\n else\n form.radiobuttons_with(:name => \"SpamFilter\")[0].check\n end\n end\n\n result_page = @agent.submit(form, form.button_with(:name => \"Submit_usermanage\"))\n\n if result_page.uri == URL_PANEL_TOP + \"user\"\n username\n else\n false\n return result_page\n end\n end",
"def find_user_setting\n\t\t# find the user setting\n\t\t@user = devise_current_user.profile_setting\n\tend",
"def alter_user_level(user_level)\n \tself.user_level = user_level\n \tself.save\n end",
"def allowed_to_read_other_users=(value)\n @allowed_to_read_other_users = value\n end",
"def set_user\n @epsadmin_user = User.find(params[:id])\n end",
"def user=(value)\n conf['dashboard']['user'] = value\n end",
"def user=(the_user)\n authentication.user = the_user\n end",
"def user\n ActiveScaffold::Registry.user_settings[user_settings_key]\n end",
"def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end",
"def set_user\n @user = User.find(params[:id])\n\n return if unauthorized_local_access(@user.uo_id)\n end",
"def set_userauth\n @userauth = Userauth.find(params[:id])\n end",
"def user_role_settings(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/roleSettings\", params)\n end",
"def requestor_settings=(value)\n @requestor_settings = value\n end",
"def set(user_obj)\n # example code to set it\n # You could also set in DB i.e User.find(id).update_attributes(user_id: user_obj[:userId], settings: user_obj)\n @@user_storage[user_obj[:userId]] = user_obj\n end",
"def set_urole\n begin\n #@client.sobject_module = Salesforce #Using Salesforce Name, to avoid collision with my 'Order' Object in MongoDB.\n if self.user_role.nil?\n #self.user_role = UserRole.where(name: \"regular\").first\n self.user_role_id = Urole.where(name: \"regular\").first.id\n logger.info \"Setting this user '#{self.email}' to use 'regular' role @ #{Time.now}.\"\n else\n logger.info \"User '#{self.email}' is using '#{self.user_role.name}' role @ #{Time.now}.\"\n end\n rescue Exception => e\n logger.info 'Your DB has not been seeded. Please seed it first. ' + e.message\n end\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n if @user.banned\n require_admin\n end\n end",
"def set_setting\n if current_user.id != params[:id].try(:to_i)\n return redirect_to settings_path(current_user.id)\n end\n @setting = Setting.find_by_user_id(params[:id])\n @user = @setting.user\n return \n end",
"def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end",
"def set_supported_user\n @supported_user = User.find(params[:id])\n end",
"def user(user)\n @options[:user] = user\n end",
"def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end",
"def set_config_user\n @config_user = ConfigUser.find(params[:id])\n end",
"def set_sub_per_user\n @sub_per_user = SubPerUser.find(params[:id])\n end",
"def set_orcid_user\n @orcid_user = OrcidUser.find(params[:id])\n end",
"def set_setting\n @setting = Setting.for_user(current_user).find(params[:id])\n end",
"def update\n privs = []\n privs << \"r\" if params[:r] == \"1\"\n privs << \"w\" if params[:w] == \"1\"\n privs << \"a\" if params[:a] == \"1\"\n @priv = privs.join(\"\")\n @project_user.priv = @priv\n @project = @project_user.project\n respond_to do |format|\n if @project_user.save\n format.html { redirect_to project_project_users_path(@project), notice: 'User setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_user }\n else\n format.html { render :edit }\n format.json { render json: @project_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user=(user)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\"user=user=#{user}\"}\n\t\t@user=user\n\t#def_user(user)\n\tend",
"def set_general_user\n @general_user = GeneralUser.find(params[:id])\n end",
"def change_user_id_overriding_readonly( user_id )\n\t\tself.user_id = user_id\n\t\tself.class.connection.update( self.class.send( :sanitize_sql_array, [\"UPDATE #{self.class.table_name} SET user_id = ? WHERE id = ?\",self.user_id,self.id] ) )\n\t\tself\n\tend",
"def set_admin_user\n @user = User.find(params[:id])\n end",
"def set_admin_user\n @user = User.find(params[:id])\n end",
"def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end",
"def user_settings\n \n if user_id.nil? or not self.user.can_post\n errors.add(:burn_after_date, \n \"Your user account cannot create content.\")\n end\n \n end",
"def user_params\n params[:user_settings]\n params.require(:user_settings).permit(:purchased_dudu, :receive_morning_emails, :view_large_plans)\n\n end",
"def remove_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end",
"def edit\n\t\tRails.logger.warn(\"Rendering account settings page.\")\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n @user = User.find(params[:id])\n redirect_to admin_users_path, alert: 'You are Unauthorized to access that page' if @user.super_admin?\n end",
"def set_admin_user(user, password)\n @user = user\n @password = password\n end",
"def set_user\n if params[:data][:user_id].nil?\n @selected_user_id = current_user.id\n @selected_user = current_user\n else\n @selected_user_id = params[:data][:user_id].to_i\n @selected_user = User.find(@selected_user_id)\n end\n\n end",
"def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end",
"def set_user\n @user = User.find(params[:id]) || User.find(params[:user_id])\n end",
"def set_user\n if self.current_user and self.current_user.name == 'admin'\n @user = User.find(params[:id])\n else\n @user = User.find(current_user.id)\n end\n end",
"def set_user\n @user = params[:id].nil? ? current_user : User.readable(current_user).find(params[:id])\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def set_gruop\n @user = User.find(params[:user_id])\n @gruop = @user.gruops.find(params[:id])\n end",
"def set_user\n @user = User.select(\"*\").where(userId: params[:id])\n end",
"def set_users_profile\n @user = User.find(current_user)\n end",
"def set_user_field\n @user_field = UserField.find(params[:id])\n end",
"def set_user_field\n @user_field = UserField.find(params[:id])\n end",
"def set_user\n @user = User.find(params[:id]) or not_found\n end",
"def set_users\n\n end",
"def mode_settings\n authorize!(@user)\n end",
"def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end",
"def user=(value)\n @user = value\n end",
"def user=(value)\n @user = value\n end",
"def set_user_page_setting\n @user_page_setting = UserPageSetting.find(params[:id])\n end",
"def set_user_level\n @user_level = UserLevel.find(params[:id])\n end",
"def site_user=(value)\n @site_user = value\n end",
"def select_user_for_admin_set(user, role = 'Depositor')\n first('a.select2-choice').click\n find('.select2-input').set(user.user_key)\n first('div.select2-result-label').click\n within('form.add-users') do\n select(role)\n click_button('Add')\n end\n end",
"def set_user_connection\n @user_connection = UserConnection.find(params[:id])\n end",
"def set_admin_user\n @user = User.find(params[:id])\n end",
"def set_user\n @user ||= User.find(params[:user_id])\n end",
"def edit\n @user = User.all.deep.find(current_user.id)\n authorize! :edit, @user\n\n render 'users/settings'\n end",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(users_path) unless current_user.organization == @user.organization\n\t\tend",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def apply_user_config(user_id)\r\n user_id = user_id.to_i\r\n exec(\r\n 'require_once(\"auth.inc\");',\r\n \"$user_entry = $config[\\\"system\\\"][\\\"user\\\"][#{user_id}];\",\r\n '$user_groups = array();',\r\n 'foreach ($config[\"system\"][\"group\"] as $gidx => $group) {',\r\n ' if (is_array($group[\"member\"])) {',\r\n \" if (in_array(#{user_id}, $group[\\\"member\\\"])) { $user_groups[] = $group[\\\"name\\\"]; }\",\r\n ' }',\r\n '}',\r\n # Intentionally run set_groups before and after to ensure group membership gets fully applied.\r\n 'local_user_set_groups($user_entry, $user_groups);',\r\n 'local_user_set($user_entry);',\r\n 'local_user_set_groups($user_entry, $user_groups);'\r\n )\r\n end",
"def set_ruts_user\n @ruts_user = RutsUser.find(params[:id])\n end",
"def set_user\n\t\t \t@user =(params[:user_id] ? User.find(params[:user_id]) : current_user)\n\t\t end",
"def setPermissionEdit( other_user )\n return setPermission( other_user, Dfile::PP_MAYEDIT )\n end",
"def active_user=(u)\n @active_user = u\n end",
"def init_settings\n merge_in_user_settings(copy_hash(DEFAULT_SETTINGS))\n end",
"def set_user_connection\n @user_connection = UserConnection.find(params[:id])\n end",
"def set_user\n\n if params[:id] == current_user.object_key\n @user = User.find_by(:object_key => params[:id])\n elsif FILTERS_IGNORED\n @user = User.unscoped.find_by(:object_key => params[:id])\n\n if @user.nil?\n redirect_to '/404'\n end\n else\n @user = User.unscoped.find_by(:object_key => params[:id], :organization_id => @organization_list)\n\n if @user.nil?\n if User.find_by(:object_key => params[:id], :organization_id => current_user.user_organization_filters.system_filters.first.get_organizations.map{|x| x.id}).nil?\n redirect_to '/404'\n else\n notify_user(:warning, 'This record is outside your filter. Change your filter if you want to access it.')\n redirect_to users_path\n end\n end\n\n end\n\n return\n end",
"def set_proyectos_user\n @proyectos_user = ProyectosUser.find(params[:id])\n end",
"def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end",
"def set_user\n @field = Field.find(params[:id])\n end",
"def set_user\n @user = User.find(params[:id])\n # automatically add user right when we see the user\n # /!\\ it add to every and single user visited!\n if [email protected]_user?\n @user.roles << Role.where(name: 'user').first_or_create\n end\n end",
"def set_ums_user\n @ums_user = Ums::User.find(params[:id])\n end",
"def set_system_user\n @system_user = SystemUser.find(params[:id])\n end",
"def set_user\n\t\tif(session[:role]=='administrator')\n \t\t@user = User.find(params[:id])\n\t\telse\n\t\t\t@user = @current_user\n\t\tend\n end"
] | [
"0.6854271",
"0.6615801",
"0.66062444",
"0.63687074",
"0.62820935",
"0.614782",
"0.6093599",
"0.60480756",
"0.6022576",
"0.6014716",
"0.5938661",
"0.59343344",
"0.5923405",
"0.58870554",
"0.58782417",
"0.58370805",
"0.5817791",
"0.58002967",
"0.57972735",
"0.5767697",
"0.5740877",
"0.5730678",
"0.5715262",
"0.5708734",
"0.5675175",
"0.5657826",
"0.5656987",
"0.56529856",
"0.5638245",
"0.5632881",
"0.5629759",
"0.56098044",
"0.56066275",
"0.56055623",
"0.55976516",
"0.55689883",
"0.5567189",
"0.5561791",
"0.55571496",
"0.55549574",
"0.554884",
"0.5541714",
"0.5519164",
"0.55178773",
"0.5515894",
"0.5514329",
"0.550605",
"0.5501201",
"0.5499861",
"0.5499861",
"0.5491533",
"0.5485713",
"0.54785657",
"0.5477453",
"0.54725903",
"0.54701686",
"0.54655594",
"0.54571235",
"0.54483116",
"0.5441788",
"0.54417557",
"0.5439844",
"0.54370886",
"0.5428793",
"0.5427914",
"0.5425958",
"0.5418769",
"0.5418769",
"0.54169667",
"0.54157424",
"0.5415573",
"0.54135513",
"0.5413484",
"0.5413484",
"0.54127073",
"0.5410391",
"0.54084074",
"0.54012614",
"0.5397361",
"0.5387384",
"0.5386011",
"0.53854233",
"0.5379201",
"0.5377409",
"0.5377409",
"0.5368354",
"0.53647524",
"0.5364682",
"0.5358734",
"0.5357723",
"0.5356604",
"0.53489965",
"0.5348509",
"0.5348198",
"0.53452265",
"0.53442913",
"0.5340084",
"0.5337718",
"0.5336066",
"0.5333478"
] | 0.6824782 | 1 |
Set the user settings for a user that has reads/writes heartbeats def heartbeat_user=(heartbeat_user_settings) | def heartbeat_user
#raise "You need to specify a heartbeat user!" if @heartbeat_user.nil?
@heartbeat_user || {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user=(value)\n conf['dashboard']['user'] = value\n end",
"def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end",
"def set(user_obj)\n # example code to set it\n # You could also set in DB i.e User.find(id).update_attributes(user_id: user_obj[:userId], settings: user_obj)\n @@user_storage[user_obj[:userId]] = user_obj\n end",
"def user=(value)\n conf['api']['user'] = value\n end",
"def set_user_setting\n @user_setting = UserSetting.find(params[:id])\n end",
"def set_user_settings\n @settings = Setting.includes(:features).find_or_create_by(provider: @user_domain)\n end",
"def set_user(user)\n agent&.set_user(user)\n end",
"def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend",
"def set_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end",
"def init_usersettings\n UserSetting.create(:user => self)\n end",
"def set_user; end",
"def user=(user)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\"user=user=#{user}\"}\n\t\t@user=user\n\t#def_user(user)\n\tend",
"def cmd_notify_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the Slack handle to #{args[0]}\")\n\t\t\t\t\t@user_name = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"def user=(the_user)\n authentication.user = the_user\n end",
"def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend",
"def set_user(user)\n @user = user\n end",
"def set_user(user)\n @user = user\n end",
"def user=(user)\n @connection = nil\n @user = user\n end",
"def user_settings\n \n if user_id.nil? or not self.user.can_post\n errors.add(:burn_after_date, \n \"Your user account cannot create content.\")\n end\n \n end",
"def user_params\n params[:user_settings]\n params.require(:user_settings).permit(:purchased_dudu, :receive_morning_emails, :view_large_plans)\n\n end",
"def config_user\n atts = {}\n u = @device.user\n unless params[:name].blank?\n return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name\n return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name]\n atts[:name] = params[:name]\n end\n unless params[:email].blank?\n unless u.email.eql?(params[:email])\n return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email]\n end\n atts[:email] = params[:email]\n end \n unless params[:pass].blank?\n return render json: {:status=>14, :message=>'密码已经设置'} if u.password\n atts[:password] = params[:pass] \n end\n\n atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank?\n atts[:tee] = params[:default_tee] unless params[:default_tee].blank?\n \n u.update_attributes(atts) \n \n ret = {:status=>0}\n unless params[:password].blank?\n @device.update_token\n ret[:token] = @device.token\n end\n render json: ret\n end",
"def set_config\n @me = current_user\n @profile = Profile.find_by user_id: current_user.id\n @preference = Preference.find_by user_id: current_user.id\n end",
"def set_user_preference\n @user_preference = UserPreference.find(params[:id])\n end",
"def set_user_alarm\n @user_alarm = UserAlarm.find(params[:id])\n end",
"def settings\n @user = User.find(params[:id])\n end",
"def user=(user)\n # HKLU hive file\n @file = \"#{@profiles}/#{user}/NTUSER.DAT\"\n\n raise \"Invalid profile: #{@file}\" unless File.exists? @file\n end",
"def user=(user)\n Thread.current[\"current_user\"] = user\n end",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def set_userconfig\n @userconfig = Userconfig.find(params[:id])\n end",
"def user_setting(username,\n settings = Hash.new)\n if settings[:add_user]\n page = page_usermanage\n else\n page = page_usermanage(\"Username\" => username)\n end\n form = page.form_with(:name => \"userform\")\n\n if settings[:add_user]\n form.field_with(:name => \"Username\").value = username\n end\n\n if ! settings[:comment].nil?\n form.field_with(:name => \"Comment\").value = settings[:comment]\n end\n\n if ! settings[:password].nil?\n form.field_with(:name => \"Password1\").value = settings[:password]\n form.field_with(:name => \"Password2\").value = settings[:password]\n end\n\n if ! settings[:use_mail].nil?\n if settings[:use_mail]\n form.checkbox_with(:name => \"Mail\").check\n else\n form.checkbox_with(:name => \"Mail\").uncheck\n end\n end\n\n if ! settings[:use_ftp].nil?\n if settings[:use_ftp]\n form.checkbox_with(:name => \"Web\").check\n else\n form.checkbox_with(:name => \"Web\").uncheck\n end\n end\n\n if ! settings[:use_file_sharing].nil?\n if settings[:use_file_sharing]\n form.checkbox_with(:name => \"WebDAV\").check\n else\n form.checkbox_with(:name => \"WebDAV\").uncheck\n end\n end\n\n if settings[:use_mail] == true && settings[:mail_quota].nil?\n settings[:mail_quota] = form.field_with(:name => \"MailQuota\").value\n if settings[:mail_quota].nil? || settings[:mail_quota].empty?\n settings[:mail_quota] = \"200\"\n end\n end\n\n if ! settings[:mail_quota].nil?\n if ! settings[:mail_quota].empty?\n form.field_with(:name => \"MailQuota\").value = settings[:mail_quota]\n end\n end\n\n if ! settings[:virus_check].nil?\n if settings[:virus_check]\n form.radiobuttons_with(:name => \"VirusScan\")[1].check\n else\n form.radiobuttons_with(:name => \"VirusScan\")[0].check\n end\n end\n\n if ! settings[:spam_filter].nil?\n if settings[:spam_filter]\n form.radiobuttons_with(:name => \"SpamFilter\")[1].check\n else\n form.radiobuttons_with(:name => \"SpamFilter\")[0].check\n end\n end\n\n result_page = @agent.submit(form, form.button_with(:name => \"Submit_usermanage\"))\n\n if result_page.uri == URL_PANEL_TOP + \"user\"\n username\n else\n false\n return result_page\n end\n end",
"def user\n ActiveScaffold::Registry.user_settings[user_settings_key]\n end",
"def user(user)\n @options[:user] = user\n end",
"def set_connected_user(email)\n session[:sos_note_email] = email\n end",
"def user=(value)\n @user = value\n end",
"def user=(value)\n @user = value\n end",
"def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end",
"def update\n coop = @user.coop_id\n\n # If they requested a co-op switch, send a request to their MemCo\n # Else, update their settings\n if @user.update_attributes(user_params)\n user_switched?(coop) ?\n request_switch(coop) :\n flash[:success] = \"Settings updated\"\n redirect_to @user\n else\n render \"edit\"\n end\n end",
"def initialize(bot:, user:)\n super\n @settings = user.student_settings\n end",
"def set_setting\n @setting = Setting.for_user(current_user).find(params[:id])\n end",
"def set_user_badge\n @user_badge = UserBadge.find(params[:user_badge_id])\n end",
"def set_up_user\n # user's details\n @user = current_user\n @notification = Notification.where(user_id: @user.id, read: 0)\n end",
"def before_save_user\n self.encrypted_password.encode! 'utf-8'\n\n # If demo is enabled, demo user cannot change email or password nor be locked\n if Feedbunch::Application.config.demo_enabled\n demo_email = Feedbunch::Application.config.demo_email\n if email_changed? && self.email_was == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user email. Blocking the attempt.'\n self.errors.add :email, 'Cannot change demo user email'\n self.email = demo_email\n end\n\n demo_password = Feedbunch::Application.config.demo_password\n if encrypted_password_changed? && self.email == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user password. Blocking the attempt.'\n self.errors.add :password, 'Cannot change demo user password'\n self.password = demo_password\n end\n\n if locked_at_changed? && self.email == demo_email\n Rails.logger.info 'Keeping demo user from being locked because of too many authentication failures'\n self.locked_at = nil\n end\n\n if unlock_token_changed? && self.email == demo_email\n Rails.logger.info 'Removing unlock token for demo user, demo user cannot be locked out'\n self.unlock_token = nil\n end\n end\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def set_user_data(opts = {})\n uri = \"/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}\"\n api_post(uri, opts['bot_data'])\n end",
"def set_user_preferences\n @user_preferences = UserPreferences.find_or_create_by!(:user => current_user)\n end",
"def active_user=(u)\n @active_user = u\n end",
"def set_user_blocking\n @user_blocking = UserBlocking.find(params[:id])\n end",
"def set_config_user\n @config_user = ConfigUser.find(params[:id])\n end",
"def user=(user)\n check_user(user)\n set_user(user)\n # returns user\n end",
"def set_admin_user(user, password)\n @user = user\n @password = password\n end",
"def user=(user)\n @user = user\n @twitter_user = nil\n load_words\n end",
"def set_userstamp_properties\n return unless Object.const_defined?(:User)\n self.class.properties.values_at(*USERSTAMP_PROPERTIES.keys).compact.each do |property|\n USERSTAMP_PROPERTIES[property.name][self]\n end\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n if @user.banned\n require_admin\n end\n end",
"def set_connected_user_info(info)\n session[:sos_note_usr_info] = info\n end",
"def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end",
"def set_users\n\n end",
"def user_id=(user_id); @message_impl.setUserId user_id; end",
"def capture_user_data\n\n # add a user config row entry\n user_data = Userconfig.new(username: session[:userinfo].blank? ? \"\" : session[:userinfo]['info']['name'],\n date: DateTime.now,\n company: session[:company],\n okta: session[:okta] == \"on\" ? true : false,\n logo_url: session[:logo],\n home_url: session[:background],\n vault: true,\n resources: session[:resources] == \"on\" ? true : false,\n onboarding_tasks: session[:onboarding] == \"on\" ? true : false,\n medical_credentialing: session[:medical_credentialing] == \"on\" ? true : false,\n loan_origination: session[:loan_docs] == \"on\" ? true : false,\n upload_sign: session[:upload_sign] == \"on\" ? true : false,\n tax_return: session[:tax_return] == \"on\" ? true : false,\n submit_claim: session[:create_claim] == \"on\" ? true : false,\n eventstream: session[:eventstream] == \"on\" ? true : false)\n user_data.save\n end",
"def hubssolib_current_user=(new_user)\n hubssolib_set_user_data(new_user)\n end",
"def automatic_user_consent_settings=(value)\n @automatic_user_consent_settings = value\n end",
"def alter_user_level(user_level)\n \tself.user_level = user_level\n \tself.save\n end",
"def user_mail_setting(username,\n settings = Hash.new)\n page = page_usermail(username)\n form = page.form_with(:name => \"usermail\")\n\n if ! settings[:forward_only].nil?\n if settings[:forward_only] == true\n form.radiobuttons_with(:name => \"MailBox\")[0].check\n else\n form.radiobuttons_with(:name => \"MailBox\")[1].check\n end\n end\n\n if ! settings[:forward_addrs].nil?\n if ! settings[:forward_addrs].empty?\n form.field_with(:name => \"Transfer\").value = settings[:forward_addrs]\n end\n end\n\n if ! settings[:virus_check].nil?\n if settings[:virus_check] == true\n form.radiobuttons_with(:name => \"VirusScan\")[1].check\n else\n form.radiobuttons_with(:name => \"VirusScan\")[0].check\n end\n end\n\n if ! settings[:spam_filter].nil?\n if settings[:spam_filter] == true\n form.radiobuttons_with(:name => \"SpamFilter\")[1].check\n else\n form.radiobuttons_with(:name => \"SpamFilter\")[0].check\n end\n end\n\n result_page = @agent.submit(form, form.button_with(:name => \"Submit_usermail\"))\n\n if result_page.uri == URL_PANEL_TOP + \"usermail\"\n username\n else\n false\n end\n end",
"def create\n if @current_user.update_attributes(params[:user])\n flash[:notice] = \"Settings update\"\n else\n logger.info @current_user.errors.inspect\n flash[:error] = \"We could not update the settings right now, try again!\"\n end\n redirect_to settings_path and return\n end",
"def set_user_balance\n @user_balance = UserBalance.find(params[:id])\n end",
"def set_user_balance\n @user_balance = UserBalance.find(params[:id])\n end",
"def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end",
"def fireeagle_user\n\t\t@fireeagle_user||=client.user\n\tend",
"def update_notifications\n user = current_user\n user.notify_on_private = params[:notify_on_private]\n user.notify_on_public = params[:notify_on_public]\n user.notify_on_reply = params[:notify_on_reply]\n user.save!\n redirect_to admin_settings_path\n end",
"def set_setting\n if current_user.id != params[:id].try(:to_i)\n return redirect_to settings_path(current_user.id)\n end\n @setting = Setting.find_by_user_id(params[:id])\n @user = @setting.user\n return \n end",
"def risky_users=(value)\n @risky_users = value\n end",
"def first_time_user=(value)\n @first_time_user = !!value\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def update\n result = current_user.user_settings.find(params[:id])\n\n result.update_attributes(get_params_user_setting())\n\n respond_with result\n\n end",
"def username=(user) #method name is username= and it takes on the user parameter and sets it equals to the username variable \n @username = user\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def execute(current_user, settings_params)\n settings = AdminSetting.new(settings_params)\n\n raise ActiveRecord::RecordInvalid, settings unless settings.save\n\n message =\n \"Setting was updated with params: \\\"#{settings_params}\\\" \" \\\n \"by \\\"#{current_user.username}\\\" (#{current_user.email})\"\n\n settings.tap { log_info(message) }\n end",
"def set_user_page_setting\n @user_page_setting = UserPageSetting.find(params[:id])\n end",
"def set_user_tasking_mode_on\r\n if @current_user.facebook_user?\r\n @current_user.is_tasking = true\r\n @current_user.save(false)\r\n else\r\n @current_user.update_attribute(:is_tasking, true)\r\n end\r\n end",
"def cmd_twitt_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the DM target user to #{args[0]}\")\n\t\t\t\t\t@user = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def set_users\n if is_event_creator\n @user_1 = event_creator\n @user_2 = participant\n else\n @user_1 = participant\n @user_2 = event_creator\n end\n end",
"def user=(new_user)\n @user = new_user[0..100]\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def set_user(user, pass)\n set :user, user\n set :password, pass\n close_sessions\nend",
"def create\n @user = User.new(params[:user])\n @random_password = params[:user][:password]\n \n if @user.save\n @user.update_column(:fullname,\"#{params[:user][:firstname]} #{params[:user][:lastname]}\")\n UserVerification.welcome_email(@user,@random_password).deliver \n if params[:page_name] == \"admin\" \n\n redirect_to admin_user_path ,:flash => {:notice => \"User successfully created and temporary password sent to user.\"}\n elsif params[:page_name] == \"user\"\n\n # Set default settings\n # Amol May 2014\n @setting = Setting.new(\n :company_name => @user.companyname, \n :description => 'Enter description about your company', \n :website_address => 'www.mycompanywebsite.com',\n :user_id => @user.id)\n core_values = @setting.core_values.build(\n :title => 'Excellence',\n :description => 'Strive for excellence at every juncture and deliver excellent results to our customers')\n core_values = @setting.core_values.build(\n :title => 'Respect',\n :description => 'Treat each other with respect and conduct ourselves with utmost integrity')\n core_values = @setting.core_values.build(\n :title => 'Innovation',\n :description => 'Be open to new ideas and push each other to find new solutions to age-old problems')\n core_values = @setting.core_values.build(\n :title => 'Passion',\n :description => 'Do what we love and love what we do')\n if @setting.save\n # do nothing, all good\n else\n logger.info @setting.errors.full_message\n end\n\n @todaysdate = Date.today\n @VoteSetting = VoteSetting.new(\n :award_frequency_type => 'Monthly', \n :award_program_name => 'Employee of the month',\n :start_cycle => @todaysdate,\n :end_cycle => (@todaysdate >> 1) - 1, \n :intro_text => \"Who's rocking it? Who's the one person that stands head and shoulders above everyone else? Who's gone that extra mile? Who deserves to be the Employee of the Month?\", \n :user_id => @user.id,\n :email_sender_name => @user.firstname + ' ' + @user.lastname,\n :email_sender_email => @user.email,\n :email_sender_subject1 => \"It's time to vote\",\n :email_sender_body1 => 'Hello dear colleague. Take a minute and vote for employee of the month. Click here to login with your email address: http://www.imeritize.com',\n :email_sender_subject2 => 'We need you',\n :email_sender_body2 => 'Yes, we really do! Or more like your colleagues do. They want to know who you think did the best this past month. Take a minute and vote for the employee of the month. Click here and login with your email address: http://www.imeritize.com',\n :email_sender_subject3 => 'Remember when you voted?',\n :email_sender_body3 => \"I don't either! Take a minute and vote for the employee of the month. Click here and login with your email address: http://www.imeritize.com\",\n :is_autopick_winner => 'f',\n :is_admin_reminder => 't', \n :is_allow_vote => 't', # Disallow voters to vote for last time's winner\n :reminder1_days => 5,\n :reminder2_days=> 10,\n :reminder3_days => 20)\n if @VoteSetting.save\n # do nothing, all good\n else\n logger.info @VoteSetting.errors.full_message\n end\n\n @PropsSetting = Prop.new(\n :enable => 't', \n :assign_points => 't', \n :start_point => 1,\n :step_point => 1, \n :end_point => 3, \n :reset_point => 1, # never let points expire \n :start_cycle => @todaysdate, \n :end_cycle => (@todaysdate >> 1) - 1, \n :intro => \"Ah, team work. It's so good to know someone has your back. Someone who can answer that tough question for you or pick up a sandwich for you while you power through lunch. Or simply hear you out while you vent. Send them some props. It will bring a smile to their face.\", \n :name => @user.firstname + ' ' + @user.lastname, \n :email => @user.email, \n :body => \"It feels great to get props. And it feels even better when you give them out. We'd appreciate it if you could spread them around. Click here and login with your email address: www.imeritize.com\", \n :body2 => \"Hey. Sorry to bug you again. But we noticed you haven't given props in a while. You know how the world works - what goes around comes around. So give some props today. Click here and login with your email address: www.imeritize.com\", \n :body3 => \"Now hear ye, hear ye. We know you know that you like to be appreciated. It's not about the money. Well, it is. So let me rephrase. It's not all about the money. Think, my friend, think. Who are you thankful for? Click here and login with your email address: www.imeritize.com\", \n :subject => \"Props, praise, kudos and high-fives\", \n :subject2 => \"The sweet smell of props\", \n :subject3 => \"No excuses\", \n :reminder1_days => 5,\n :reminder2_days => 10,\n :reminder3_days => 20,\n :user_id => @user.id)\n if @PropsSetting.save\n # do nothing, all good\n else\n logger.info @PropsSetting.errors.full_message\n end\n\n # Even if settings weren't saved, send user to confirmation message screen because the user was created\n redirect_to account_creation_path, :flash => {:notice => \"Hello, #{@user.firstname}. Your brand new Meritize account is ready.\n We have sent your instructions for getting started to your email address.\n Contact us at [email protected] if you have any questions.\"}\n else\n redirect_to admin_user_path ,:flash => {:notice => \"User successfully created and temporary password sent to user.\"}\n end\n \n else\n\n @random = (0..6).map{ ('a'..'z').to_a[rand(26)] }.join\n\n @title = \"Sign Up\"\n render 'new'\n end\n end",
"def current_user=(user)\n master.current_user = user\n end",
"def set_user\n @user = current_user \n end",
"def set_event_user_status\n @event_user_status = EventUserStatus.find(params[:id])\n end",
"def set_notifications\n @notifications = current_user.my_notifications\n end",
"def setUserFileAccess(adminSettingPerms, userName, filePath, grantAccess)\n\n #filePath = GlobalSettings.changeFilePathToMatchSystem(filePath)\n fAccess = filePath.concat \".access\"\n access = Hash.new {}\n if !File.exist?(fAccess)\n if grantAccess\n access[\"users\"] = \";#{userName};\"\n else\n access[\"users\"] = \"\"\n end\n access[\"groups\"] = \"\"\n if(adminSettingPerms == \"root\")\n access[\"adminUsers\"] = \";root(rwp);\"\n else\n access[\"adminUsers\"] = \";root(rwp);\"+adminSettingPerms+\"(rw);\"\n end\n access[\"adminGroups\"] = \"\"\n else\n access = YAML.load_file(fAccess)\n users = access[\"users\"]\n if users.index(userName) == nil && grantAccess\n users.concat( userName+\";\")\n elsif users.index(userName) != nil && !grantAccess\n\n beginning = users[0..users.index(userName)]\n gend = users[users.index(\";\", users.index(userName)+userName.size)]\n users = beginning.concat gend\n end\n access[\"users\"] = users\n end\n File.write(fAccess, access.to_yaml)\n\n end",
"def set_user\n @user = UserProfile.find(params[:id])\n end",
"def set_user\n @user = User.find(params[:uuid])\n end"
] | [
"0.649751",
"0.61443394",
"0.6020464",
"0.6010618",
"0.588153",
"0.5778598",
"0.5764999",
"0.5747253",
"0.5739527",
"0.5663453",
"0.5557444",
"0.5520484",
"0.55058897",
"0.54613143",
"0.5453085",
"0.5413977",
"0.5413977",
"0.54072905",
"0.5382513",
"0.5376694",
"0.5375021",
"0.53718436",
"0.5363203",
"0.535188",
"0.53478444",
"0.5316385",
"0.53103316",
"0.5300182",
"0.5298821",
"0.52961063",
"0.5291242",
"0.5282496",
"0.5276587",
"0.5274628",
"0.5274628",
"0.5265287",
"0.52463585",
"0.52431",
"0.5241112",
"0.52398676",
"0.5224178",
"0.5219106",
"0.5208996",
"0.5202079",
"0.5201672",
"0.51854926",
"0.5185367",
"0.51843727",
"0.51823545",
"0.51643014",
"0.5159701",
"0.5147795",
"0.514065",
"0.51390684",
"0.5129536",
"0.5128006",
"0.51088345",
"0.51073897",
"0.5102767",
"0.5097056",
"0.5095224",
"0.50901026",
"0.508565",
"0.50853",
"0.50853",
"0.50798166",
"0.50790364",
"0.5077556",
"0.50758725",
"0.5073306",
"0.5071112",
"0.5069202",
"0.5068431",
"0.5068431",
"0.5068431",
"0.5068431",
"0.5068431",
"0.5068431",
"0.5068431",
"0.50594556",
"0.50590676",
"0.5055888",
"0.5055888",
"0.50533754",
"0.50492036",
"0.5046427",
"0.5046089",
"0.5033362",
"0.5031246",
"0.50303715",
"0.5029693",
"0.5024338",
"0.5017516",
"0.50157857",
"0.50054985",
"0.500411",
"0.49997902",
"0.49921656",
"0.49873725",
"0.49814522"
] | 0.68399316 | 0 |
def self.subdomain2id(subdomain) MACHINELIFE_IDS[subdomain] end | def machinelife_images
temp = JSON.parse(imgs.presence || "[]").to_a
temp.unshift top_img if top_img.present?
temp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ensembl_subdomain\n @ensembl_subdomain = EnsemblSubdomain.find(params[:id])\n end",
"def generate_subdomain\n slug = self.name.gsub(/\\W/, \"-\").gsub(/\\-{2,}/, \"-\").sub(/^\\-/, \"\").sub(/\\-$/, \"\").downcase\n count = self.class.where(domain: slug).count\n\n while count > 0\n slug = \"#{slug}-#{count + 1}\"\n count = self.class.where(domain: slug).count\n end\n\n self.domain = slug\n end",
"def current_subdomain\n if request.subdomains.first\n Client.find_by_webname(request.subdomains.first).id if Client.find_by_webname(request.subdomains.first)\n end\n end",
"def subdomain\n self.name.gsub('_', '.')\n end",
"def get_subdomain_name_by_subdomain_id(subdomain_id)\n Subdomain.find(subdomain_id).subdomain_name\n end",
"def subdomain\n host.split(\".\").first\n end",
"def primary_sub_domain_base\n @attributes[:primary_sub_domain_base]\n end",
"def key(spec)\n return \"site-#{self.subdomain.to_s}-#{spec.to_s}\"\n end",
"def subdomain\n get()[\"app\"][\"subdomain\"]\n end",
"def subdomain\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"def subdomain_for(params)\n \n organization = params[:organization]\n email = params[:email]\n \n organization = Organization.find_by_email(email) if email\n \n if organization && organization.association then\n organization.association.subdomain \n else\n ''\n end\n end",
"def current_subdomain_symbol\n if current_subdomain\n current_subdomain.send(self.subdomain_column).to_sym\n else\n nil\n end\n end",
"def current_subdomain_symbol\n if current_subdomain\n current_subdomain.send(self.subdomain_column).to_sym\n else\n nil\n end\n end",
"def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend",
"def domain_name(subdomain: T.unsafe(nil), domain: T.unsafe(nil)); end",
"def extract_subdomain(host, tld_length); end",
"def set_subdomain\n self.subdomain = self.name\n self.save!\n end",
"def account_subdomain\n @account_subdomain ||= get_account_subdomain(request.host, AppConfig.host(request.host))\n end",
"def subdomain\n #for debug at localhost\n return self.class.system_top_domain if self.class.system_top_domain == 'localhost'\n short_name + '.' + self.class.system_top_domain\n end",
"def subdomain\n ENV['DESK_SUBDOMAIN']\n end",
"def current_subdomain\n self.subdomain_klass.current\n end",
"def to_id(obj)\n current_server.to_id(obj)\n end",
"def find_subdomain_resource(subdomain)\n resource = self.basecamper[:subdomain_class].to_s.camelize.constantize\n subdomain_field = self.basecamper[:subdomain_field]\n\n return resource.to_adapter.find_first(subdomain_field => subdomain)\n end",
"def id\n basename.gsub('.', '-')\n end",
"def id\n begin\n if self.class == Piwik::Site\n self.idsite\n else\n attributes.send(:\"id#{self.class.to_s.gsub('Piwik::','')}\")\n end\n rescue Exception => e\n $stderr.puts e\n end\n end",
"def subdomain(host)\n subdomains(host).first\n end",
"def random_subdomain()\n \n randomsubdomain = \"\"\n \n # Create a string of between 3 and 8 characters \n domain = ('a'..'z').to_a.shuffle[0..7].join\n\n # Create an array of some domains and randomly pick one \n suffix = ('a'..'z').to_a.shuffle[0..1].join\n\n # Concatenate and return the string \n randomsubdomain = domain + \".\" + suffix \n\n end",
"def domain\n Domain.find_by_id(domain_id)\n end",
"def email_as_id\n\t\tself.email.gsub(/[@\\.]/, '-')\n\tend",
"def base_id\n \"#{firstname} #{lastname}\"\n end",
"def i18n_id\n name.split(\"::\").map{|c| c.underscore}.join(\".\")\n end",
"def subdomain(tld_length = T.unsafe(nil)); end",
"def subdomain=(val)\n write_attribute(:subdomain, val.downcase.split(\" \").join)\n end",
"def get_id\n default_id = self.class.to_s.split('::').last\n default_id[0] = default_id[0].downcase\n return default_id\n end",
"def domain\n @domain ||= PublicSuffix.parse(@fqdn).domain\n end",
"def id\n name.gsub /-/, '_'\n end",
"def id\n FFI::Libvirt.virDomainGetID(self)\n end",
"def id\n FFI::Libvirt.virDomainGetID(self)\n end",
"def current_subdomain\n @current_subdomain ||= request.subdomain if request.subdomain\n end",
"def current_subdomain\n @current_subdomain ||= request.subdomain if request.subdomain\n end",
"def id\n name.gsub(':', '-')\n end",
"def id\n super.to_s.tr('.', '_')\n end",
"def request_subdomain\n request.host.split(/\\./).first\n end",
"def server_id\n @host.id\n end",
"def superdomain; end",
"def random_subdomain\n ('a'..'z').to_a.shuffle[0..7].join\n end",
"def local_id; end",
"def subdomain\n ([self.short_name] + self.class.admin_site.domain.split('.')[1..-1]).join('.')\n end",
"def external_id; end",
"def generate_machine_id()\n \n end",
"def host_id\n\t\t\t\"#{host}:#{port}\"\n\t\tend",
"def subdomain_is_unique\n if subdomain.present? && (League.all.count > 0)\n unless League.find_by_subdomain(subdomain).nil?\n errors.add(:subdomain, \"is already taken\")\n end\n if Apartment::Elevators::Subdomain.excluded_subdomains.include?(subdomain)\n errors.add(:subdomain, \"is not available\")\n end\n end\n end",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def pid_to_s\n \"#{Setting.organization_icao}#{pid}\"\n end",
"def subdomains(tld_length = 1) \n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end",
"def set_subdomain(subdomain)\n result = put :set_subdomain!, {:subdomain => subdomain}\n if Bushido::Command.last_command_successful?\n ENV[\"BUSHIDO_SUBDOMAIN\"] = subdomain\n ENV[\"PUBLIC_URL\"] = \"http://#{subdomain}.#{ENV['APP_TLD']}/\"\n return result\n end\n\n result\n end",
"def get_subdomain_to_load(last_rr)\n return \"\" if (!last_rr)\n subdomain = last_rr.name\n subdomain = lose_n_labels(subdomain, @soa.name.labels.length)\n subdomain = subdomain.labels()[subdomain.labels.length() - 1]\n return subdomain\n end",
"def domain_id(package_name, rule_name, inputs, params)\n \"%s-%s_%s\" % [package_name, rule_name, task_id(inputs, params)]\n end",
"def eye_domain\n 'i.' + base_domain\n end",
"def get_domain\n @domain\n end",
"def str2id(s)\n s.id.delete('/hostedzone/')\nend",
"def domain_name\n return @domain_name\n end",
"def domain_name\n return @domain_name\n end",
"def _sub_domain\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_domain_ref)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_domain_literal)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_sub_domain unless _tmp\n return _tmp\n end",
"def current_website\n subdomain ||= request.subdomain\n end",
"def set_subdomain\n @subdomain = current_domain\n end",
"def default_account_subdomain\n\t\t'www'\n\tend",
"def extract_locale_from_subdomain\n\t\t parsed_locale = request.subdomains.first || I18n.default_locale\n\t\t I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n\t\tend",
"def ip_address_id(env)\n ip_address_record(env)[:id]\n end",
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\nend",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def domain; end",
"def domain; end",
"def domain; end",
"def domain; end",
"def generate_domain\n \"random#{Time.now.hash % 1000000}.com\"\nend",
"def domain_info\n @domain = normalized_email.split('@').last\n domain\n end",
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n \n end",
"def random_subdomain\n ('a'..'z').to_a.shuffle[1..8].join\nend",
"def domain\n @domain\n end",
"def domain\n @domain\n end",
"def site_id\n return @site_id\n end",
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def generate_identifier\n self.identifier = Digest::MD5.hexdigest(\"PersonRecordIdentifier#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end",
"def get_account_subdomain(request_host, app_host)\n if request_host =~ /(.*?)\\.?#{app_host}$/ && !($1.empty? || $1 == 'www')\n $1\n elsif APP_CONFIG[:restricted_names].include?(request_host.split('.').last)\n request_host\n else\n nil\n end\n end",
"def server_to_id(server)\r\n if server.kind_of? String\r\n puts \"forward lookup\"\r\n id = @server_alias_to_id[server]\r\n else\r\n puts \"reverse lookup\"\r\n id = @cinch_bot_to_id[server] #If it's not a string, assume it's a bot object, reverse lookup id\r\n end\r\n id\r\n end",
"def external_identifier \n elements = []\n elements << ipaddress || 'UNKNOWNIP'\n elements << custid || 'anon'\n #OT.ld \"sess identifier input: #{elements.inspect}\"\n @external_identifier ||= elements.gibbler.base(36)\n @external_identifier\n end",
"def url_identifier\n case Roomer.url_routing_strategy\n when :domain\n return request.host\n when :path\n return params[:tenant_identifier]\n end\n end",
"def downcase_subdomain\n self.subdomain.downcase! if attribute_present?('subdomain')\n end",
"def domain\n @domain = Domain.find( \n params[:id], \n :user => current_user\n )\n end",
"def random_subdomain\n ('a'..'z').to_a.shuffle[0..7].join\nend",
"def count_subdomain_visits(subdomains)\n vist_counts = Hash.new(0)\n subdomains.each do |sd|\n count = sd.split(' ').first.to_i\n sds = break_subdomains(sd.split(' ').last)\n sds.each do |d|\n vist_counts[d] += count\n end\n end\n vist_counts\nend",
"def subid\n unsubscribe[:subid]\n end",
"def secure_id\n @secure_id_without_dashes ||= super&.gsub(\"-\", \"\")\n end",
"def subid\n subscription_node[:subid]\n end",
"def server_id\n @server_id ||= Gititback::Support.hostname\n end",
"def globally_unique_identifier\n super\n end",
"def dom_id; end",
"def dom_id; end",
"def dom_id; end"
] | [
"0.6928194",
"0.667414",
"0.66403085",
"0.66198283",
"0.6580453",
"0.65290606",
"0.63811827",
"0.6373786",
"0.6304466",
"0.62270546",
"0.6219581",
"0.6215681",
"0.6215681",
"0.6206988",
"0.62008536",
"0.6195254",
"0.61649126",
"0.6159363",
"0.6141327",
"0.6053258",
"0.6053163",
"0.6042909",
"0.6037132",
"0.6032761",
"0.60207254",
"0.6017591",
"0.60045654",
"0.5996762",
"0.5972814",
"0.59662056",
"0.59627014",
"0.59297234",
"0.5918644",
"0.5896174",
"0.5890765",
"0.5865371",
"0.5858186",
"0.5858186",
"0.58481234",
"0.58481234",
"0.5843709",
"0.5823309",
"0.5814155",
"0.5808399",
"0.57993644",
"0.57949203",
"0.5785457",
"0.5771639",
"0.57574576",
"0.57550573",
"0.57493526",
"0.5740517",
"0.57360566",
"0.573516",
"0.5730852",
"0.5725079",
"0.57181406",
"0.5711786",
"0.57007796",
"0.5699279",
"0.569817",
"0.5694278",
"0.5694278",
"0.56815046",
"0.56747913",
"0.56576854",
"0.56466407",
"0.56420815",
"0.56410664",
"0.5639056",
"0.5628417",
"0.5628417",
"0.5623235",
"0.5623235",
"0.5623235",
"0.5623235",
"0.56184894",
"0.5612837",
"0.561111",
"0.56043905",
"0.5599755",
"0.5599755",
"0.55988026",
"0.55922705",
"0.5589411",
"0.55805635",
"0.5577687",
"0.55760026",
"0.55741686",
"0.5565599",
"0.5558753",
"0.5558455",
"0.5552561",
"0.5551382",
"0.5550615",
"0.5543646",
"0.55368364",
"0.5535059",
"0.55321795",
"0.55321795",
"0.55321795"
] | 0.0 | -1 |
finds and opens view | def get_view(filename)
full_file = File.join(options.views, filename)
if File.exists?(full_file)
view_file = full_file
else
view_directory = File.join(File.dirname(__FILE__),'views')
view_file = File.join(view_directory,filename)
end
open(view_file,'r') { |file| file.read }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_to_view\n unless ( name = path_matcher.controller_name )\n return\n end\n # figure out what the name of def we are in is\n action = find_function_under_cursor\n view = File.join(project_root, \"/app/views/#{name}/#{action}\")\n\n # open the according view (most likely non existant)\n if !File.exists?(view)\n %w(erb html.erb haml html.haml js.erb xml.erb).each do |try|\n if File.exists?(\"#{view}.#{try}\")\n view += \".#{try}\"\n break\n end\n end\n end\n\n open_file view\n end",
"def show()\n view.show\n end",
"def show()\n @view__.show\n self\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def view()\n @view\n end",
"def loc_view\n \n end",
"def set_view\n @view = View.find(params[:id])\n end",
"def show_view\n\t\tvue_borne.window.show_all\n\tend",
"def start_view(view)\n\treturn true if File.directory?(view_dir(view))\n\tKernel.system(\"cleartool startview #{view} > nul 2>&1\")\n\treturn $? == 0\nend",
"def set_yourview\n @yourview = Yourview.find(params[:id])\n end",
"def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end",
"def view\n end",
"def show\n setup_download_list\n render partial: \"browse_#{view_type}\"\n end",
"def view\n @_view\n end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def goto\n navigate_application_to \"Report=>Custom Views\"\n end",
"def view(name, locator)\n define_method(name) do\n platform.click_view(locator)\n end\n end",
"def define_view\n \t#puts \"#{controller_name}.define_view:begin view=#{@myparams[:view_id]}\"\n \t# views: liste des vues possibles est utilisee dans la view ruby show\n\t\t@views = View.all\n\t\t# view_id: id de la vue selectionnee est utilisee dans la view ruby show\n\t\t#@myparams[:view_id] = @views.first.id if @myparams[:view_id].nil?\n\t\tif @myparams[:view_id].nil?\n\t\t\tif logged_in?\n\t\t\t@myparams[:view_id] = current_user.get_default_view.id\n\t\t\tend\n\t\tend\n\t\t#puts \"#{controller_name}.define_view:end view=#{@myparams[:view_id]}\"\n\tend",
"def view\n\n @view_only = true\n\n wid = params[:id]\n\n return error_wi_not_found \\\n unless OpenWFE::Extras::Workitem.exists?(wid)\n\n load_workitem wid\n\n render :template => \"workitem/edit\"\n end",
"def view(name, parameters = {})\n\t\t\tClient.get view_url(name, parameters)\n\t\tend",
"def view(ddoc,view,*opts)\n q = \"#{database}/_design/#{ddoc}/_view/#{view}\"\n q << build_query_string(opts.first,\"view\") if opts && opts.any? && opts.first.is_a?(Hash)\n\n @conn.query({url_path: q, method: :get})\n end",
"def master_view\n\t\toption = @view.initial_view\n\t\tselect(option)\n\tend",
"def open\n annotation = Annotation.find(params[\"id\"])\n redirect_to :controller => :viewer,\n :annotation => annotation.name,\n :username => annotation.user.username\n end",
"def show\n @ole.Show\n end",
"def open_in_viewer\n fork { exec \"#{Seee::Config.application_paths[:pdf_viewer]} \\\"#{current_path}\\\"\" }\n end",
"def _view; end",
"def view\n self.raise\n click_on_perc(@id, 70, 2.5)\n return View.new\n end",
"def show\n @view = View.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @view }\n end\n end",
"def show\n @view = View.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @view }\n end\n end",
"def add_view_code\n return '' if (data = @record.send(@yaml['name'])).blank?\n\n table, form_name = @yaml['view'].split(/\\ |\\,/).delete_if { |e| e.blank? }\n url = @parent.url_for(controller: 'cmsedit', id: data, action: :edit, table: table, form_name: form_name, readonly: true, window_close: 1 )\n icon = @parent.mi_icon('eye-o md-18')\n %(<span class=\"dc-window-open\" data-url=\"#{url}\"> #{icon}</span>)\nend",
"def view; end",
"def view(model_name, *args)\n orange[model_name].view(self, *args)\n end",
"def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend",
"def show\n name = params[:name]\n action = params[:id] ? \"show\" : \"index\"\n action = params[:view] if params[:view].present?\n\n @page = (\"Workflows::#{name.to_s.capitalize}::#{action.capitalize}\").constantize.new(params, { user: current_user, cookies: cookies })\n\n render(html: @page.item.display) and return if params[:view].present?\n\n render :template => \"#{name}/#{action}\"\n end",
"def view_to_url(view, parent = nil)\n association = view_to_association(view, parent)\n if association.nil?\n controller, action = db_to_controller(view.db)\n if controller == \"ems_cloud\" && action == \"show\"\n return ems_clouds_path\n end\n if controller == \"ems_infra\" && action == \"show\"\n return ems_infras_path\n end\n if controller == \"ems_physical_infra\" && action == \"show\"\n return ems_physical_infras_path\n end\n if controller == \"ems_container\" && action == \"show\"\n return ems_containers_path\n end\n if controller == \"ems_network\" && action == \"show\"\n return ems_networks_path\n end\n if controller == \"ems_storage\" && action == \"show\"\n return ems_storages_path\n end\n\n if request[:controller] == 'service' && view.db == 'GenericObject'\n action = 'show'\n return url_for_only_path(:action => action, :id => params[:id]) + \"?display=generic_objects&generic_object_id=\"\n end\n if @explorer\n # showing a list view of another CI inside vmx\n if %w[SecurityGroup\n SecurityPolicy\n SecurityPolicyRule\n FloatingIp\n NetworkRouter\n NetwokrService\n NetworkPort\n CloudNetwork\n CloudSubnet\n LoadBalancer\n CloudVolume].include?(view.db)\n return url_for_only_path(:controller => controller, :action => \"show\") + \"/\"\n elsif [\"Vm\"].include?(view.db) && parent && request.parameters[:controller] != \"vm\"\n # this is to handle link to a vm in vm explorer from service explorer\n return url_for_only_path(:controller => \"vm_or_template\", :action => \"show\") + \"/\"\n elsif %w[MiqWidget\n ConfigurationScript\n MiqReportResult].include?(view.db) &&\n %w[report].include?(request.parameters[:controller])\n suffix = ''\n if params[:tab_id] == \"saved_reports\" || params[:pressed] == \"miq_report_run\" || params[:action] == \"reload\"\n suffix = x_node\n end\n return \"/\" + request.parameters[:controller] + \"/tree_select?id=\" + suffix\n elsif %w[User MiqGroup MiqUserRole Tenant].include?(view.db) &&\n %w[ops].include?(request.parameters[:controller])\n if @tagging\n return false # when tagging Users, Groups, Roles and Tenants, the table is non-clickable\n else\n return \"/\" + request.parameters[:controller] + \"/tree_select/?id=\" + x_node.split(\"-\")[1]\n end\n elsif view.db == \"MiqServer\" &&\n %w[ops report].include?(request.parameters[:controller])\n return \"/\" + request.parameters[:controller] + \"/tree_select/?id=\" + TREE_WITH_TAB[active_tab]\n elsif %w[ScanItemSet\n MiqSchedule\n PxeServer\n PxeImageType\n Storage\n CustomizationTemplate].include?(view.db) &&\n %w[ops pxe report].include?(params[:controller])\n return \"/#{params[:controller]}/tree_select/?id=#{TreeBuilder.get_prefix_for_model(view.db)}\"\n else\n return url_for_only_path(:action => action) + \"/\" # In explorer, don't jump to other controllers\n end\n else\n controller = case controller\n when 'template_cloud'\n 'vm_cloud'\n when 'template_infra'\n 'vm_infra'\n when 'miq_ae_domain'\n 'miq_ae_class'\n else\n controller\n end\n\n return url_for_only_path(:controller => 'restful_redirect', :model => 'ExtManagementSystem') if controller == 'ext_management_system'\n\n return url_for_only_path(:controller => controller, :action => action, :id => nil) + \"/\"\n end\n else\n # need to add a check for @explorer while setting controller incase building a link for details screen to show items\n # i.e users list view screen inside explorer needs to point to vm_or_template controller\n return url_for_only_path(:controller => parent.kind_of?(VmOrTemplate) && !@explorer ? parent.class.base_model.to_s.underscore : request.parameters[\"controller\"],\n :action => association,\n :id => parent.id) + \"?#{@explorer ? \"x_show\" : \"show\"}=\"\n end\n end",
"def view_modal\n handle_view\n end",
"def navigate(view)\n @view = view\n window.scrollTo(0, 0)\n end",
"def view(name, opts = {})\n design_doc.create_view(name, opts)\n end",
"def do_query_view(view_name, view_options)\n database.view \"#{self.name.underscore}/#{view_name}\", view_options\n end",
"def view_path\n File.join path, 'views'\n end",
"def find_view(action_name, wish)\n aliased = find_aliased_view(action_name, wish)\n return aliased if aliased\n\n to_view(action_name, wish)\n end",
"def path_to_view view\n paths_to_view(view).first\n end",
"def switchto_listview()\n\t\[email protected](:class, \"btn icon-list-view\").click\n\tend",
"def ListView_GetView(hwnd) send_listview_message(hwnd, :GETVIEW) end",
"def show\n \t\n end",
"def show\n \t\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def selected_view\n return @data[self.index].view\n end",
"def selected_view\n return @data[self.index].view\n end",
"def show\n unless current_user.viewed(@survey)\n add_viewer(user_id=current_user.id, project_id=0, idea_id=0, [email protected], call_for_idea_id=0, actuality_id=0)\n end\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def view(check = nil, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @views.insert(0, ViewHandler.new(check, block))\n end",
"def show\n render :view\n end",
"def show\n # TODO\n end",
"def show\n # TODO\n end",
"def get_view(viewname, params = nil)\n raise \"get_view not implemented\"\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end",
"def show\r\n end"
] | [
"0.7309089",
"0.69221425",
"0.6723794",
"0.66920435",
"0.6585333",
"0.65265733",
"0.6468835",
"0.6405922",
"0.63665605",
"0.63620305",
"0.63103384",
"0.6292088",
"0.62773335",
"0.62608874",
"0.62604916",
"0.6218306",
"0.62137234",
"0.6173676",
"0.61674136",
"0.6145497",
"0.6144834",
"0.6138636",
"0.6028905",
"0.5981849",
"0.5976284",
"0.5948514",
"0.5945206",
"0.5941057",
"0.5941057",
"0.5921257",
"0.59188443",
"0.5909254",
"0.5887305",
"0.58662516",
"0.58652824",
"0.5850864",
"0.58320993",
"0.5816807",
"0.580699",
"0.58049774",
"0.57898086",
"0.578894",
"0.57851297",
"0.577729",
"0.5776454",
"0.5776454",
"0.5773919",
"0.5773919",
"0.5773919",
"0.5769655",
"0.5769655",
"0.5763346",
"0.5756498",
"0.5756498",
"0.5756498",
"0.5756498",
"0.5741649",
"0.5719948",
"0.57036567",
"0.57036567",
"0.5700195",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575",
"0.56954575"
] | 0.5947697 | 27 |
Create a method that takes two integers as arguments. The first argument s a count, and the second is the first number of a sequence that your method will create. The method should return an Array that contains the same number of elements as the count argument, while the values of each element will be multiples of the starting number. You may assume that the count argument will always have a value of 0 or greater, while the starting number can be any integer value. If the count is 0, an empty list should be returned. input count integer number output: a new Array rules: outputs count number of numbers starting from this integer first integer 1, first integer 2, first integer3,etc algo: 1. get a count, and an integer 2. initialize an empty Array 3. initialize variable times as a factor count 4. iterate thru by times 5. in each iteration, put the integer times into the new array 6. in each iteration, increment times by 1 7. return the new array | def sequence(count, integer)
new_arr = []
times = 1
count.times do
new_arr << integer * times
times += 1
end
p new_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence(count, starting_num)\n result_arr = []\n 1.upto(count) { |num| result_arr << starting_num * num }\n result_arr\nend",
"def sequence(count, start_number)\n array = []\n count.times { |i| array << (start_number * (i + 1)) }\n array\nend",
"def sequence(count, number)\n sequence_arr = []\n 1.upto(count) do |n|\n sequence_arr << number * n\n end\n sequence_arr\nend",
"def sequence(count, num)\n arr = []\n count.times{ |i| arr << (i+1) * num }\n arr\nend",
"def sequence(count, num)\n seq_arr = []\n 1.upto(count) { |n| seq_arr << num * n }\n seq_arr\nend",
"def sequence(count, startnum)\n sequence_array = []\n multiple = 1\n \n until count == 0\n sequence_array << startnum * multiple\n count -= 1\n multiple += 1\n end\n \n sequence_array\nend",
"def sequence(count, num)\n result = 0\n Array.new(count).map {|_| result += num }\nend",
"def sequence(count, start_num)\n output_arr = [start_num] * count # populate with count, then just multiply\n output_arr.map.with_index do |num, idx|\n num * (idx + 1)\n end\nend",
"def sequence(count, first_nb)\n result = []\n count.times { |loop| result << (first_nb * (loop + 1)) }\n result\nend",
"def sequence(count, num)\n multiples = []\n count.times { |i| multiples.push(num * (i + 1)) }\n multiples\n # (1..count).map { |idx| idx * num }\nend",
"def sequence(count, first_num)\n multiples = []\n count.times {|index| multiples[index] = first_num * (index +1) }\n multiples\nend",
"def sequence(count, start)\n return [] if count == 0 \n sequence_array = []\n iterator = 1\n count.times do\n sequence_array << start * iterator \n iterator += 1 \n end \n sequence_array\nend",
"def sequence(count, start)\n final_arr = []\n 1.upto(count) do |num|\n final_arr << num * start\n end\n final_arr\nend",
"def sequence(num)\n new_arr = []\n if num <= 0\n count = num\n else\n count = 1\n end\n \n num.abs.times do\n new_arr << count\n count += 1\n end\n \n p new_arr\nend",
"def sequence(count, first_num)\n result = []\n multiple = 1\n\n count.times do \n result << first_num * multiple\n multiple += 1\n end\n result\nend",
"def sequence(count, start)\n seq = []\n count.times { |i| seq << start * (i + 1) }\n seq\nend",
"def sequence(count, start_num)\n (1..count).map { |idx| start_num * idx }\nend",
"def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend",
"def sequence(num)\n arr = []\n count = 1\n while count <= num\n arr << count\n count += 1\n end\n arr\nend",
"def sequence2(count, num)\n (1..count).to_a.map { |c| c * num }\nend",
"def sequence(count, first)\n sequence = []\n number = first\n\n count.times do\n sequence << number\n number += first\n end\n sequence\nend",
"def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend",
"def series_up(n) # Got help again. My first code couldn't adapt at all. This one has a reset limit, meaning it loops the amount of times it needs to for each interger. Still not perfect, but almost there. \n list = [1]\n i = 1\n length = n*(n+1)/2\n reset = 3\n list.push i\n i += 1\n if i == reset\n reset += 1\n end\n return list\nend",
"def sequence(count, start)\n (1..count).map { |count| count * start }\nend",
"def sequence(count, start)\n sequence = []\n current = start\n\n count.times do\n sequence << current\n current += start\n end\n\n sequence\nend",
"def sequence(count,num)\narr = []\ntotal = 0\ncount.times {arr << total += num}\np arr\nend",
"def count_to (n)\n array = []\n count = 0\n while count <= n\n count += 1\n array.push(count.round)\n end\nend",
"def sequence(multiple, starting_num)\n return [] if multiple == 0\n counter = 1\n array = []\n loop do\n array << counter * starting_num\n counter += 1\n break if counter > multiple\n end\n array\nend",
"def number_counting_seq(n)\r\n\r\nend",
"def series_up(n)\n new_list=[] # to push into a new list\n (n + 1).times do |index| #You need the nested loop index.times to run at least once. Since Index starts at 0, you need to add 1 so that it runs at least once\n index.times do |value| # this runs the loop each time until it reaches the number needed\n new_list.push(value + 1) #Same as the loop above. Since the value starts at 0, you need to start at 1 bc that's what the challenge wants you to do. the .push pushes it into the new list \n end \n end \n return new_list # this makes the function print the newly created list\nend",
"def series_up(x)\nbignum = 1\ncount = 1 #made it one beacsue when it was 0 it only printed the number - 1\nlist = [] # changed it to list so i dont get confused\n x.times do #loop in a loop \n count = 1 #It resets it to one so it follows the pattern\n while count <= bignum #while count is less than or equal too this loop will keep on going\n list.push(count) #pushes count into the list\n count = count + 1 #making count equal to count + 1. So if count is 2, it will come out as 3\n end\n bignum = bignum + 1 #setting big number so the loop keeps on going\n end\n return list #when the loop is over it takes the list and prints it\nend",
"def series_up(num)\n series = 0\n list = [] #starts as empty\n #puts \"running code\"\n num.times do |pattern|\n n = 0#original num\n num.times do |num|\n list[n + series] = n + 1\n n += 1\n end \n series += pattern + 1 \n #makes it grow exponentially\n end\n return list \nend",
"def sequence(num)\n sequence_arr = []\n 1.upto(num) { |n| sequence_arr << n }\n sequence_arr\nend",
"def multiples_of(number, upTo)\n result = Array.new\n (0..upTo).step(number) do |n|\n result << n\n end\n puts result.inspect\n result\nend",
"def count_by(x, n)\n a=[]\n y=0\n n.times {y+=x; a<<y}\n a\nend",
"def seriesup(n)\n list = [] \n (n+1).times do |b| # added the +1 because this code needs to run 1 more time than the input\n b.times do |a|\n list.push(a+1) #changed the variable from b to a because it doesn't need to use the first variable, you have to use the second one to make it repeat from 1. Also, I had a space between the list.push and the (), so the push didnt even work with this space.\n end\n end\n return list\nend",
"def sequence(num)\n Array.new(num) { |i| i+1 }\nend",
"def sequence(num)\r\n new_arr = []\r\n (1..num).step(1) { |n| new_arr << n }\r\n new_arr\r\nend",
"def sequence(num)\n result = []\n num.times{|i| result << i + 1}\n result\nend",
"def sequence(count, start)\n (1..count).map { |i| i * start }\nend",
"def sequence3(number)\n array = []\n 1.upto(number) { |num| array << num }\n array\nend",
"def count(n,ar)\r\n result = Array.new(100){|x| x = 0}\r\n ar.each { |x| result[x] = result[x]+1 }\r\n return result\r\nend",
"def sequence(n)\n results = []\n 1.upto(n) {|num| results << num}\n results\nend",
"def series_up(nums) \r\n series = 0 # start the list at the right \r\n list = [] # the list is empty at the start \r\n nums.times do |seq| \r\n n = 0 \r\n nums.times do |nums| # run a loop for the sequence \r\n list[n + series] = n + 1 \r\n n += 1 \r\n end \r\n series += seq + 1 # exponential growth \r\nend \r\n return list \r\nend",
"def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend",
"def sequence(number)\n array_of_numbers = []\n \n 1.upto(number) do |num|\n array_of_numbers << num\n end\n \n array_of_numbers\n \nend",
"def count_by(x, n)\n (1..n).map{|i| i*x}\nend",
"def series_up(nums)# did not have time to do this function\n series = 0 # start the list at the right value\n list = [] # the list is empty at the start \n nums.times do |seq| # Run a loop for the sequence\n n = 0# set it equal to orignal num\n nums.times do |nums|\n list[n+ series] = n + 1\n n += 1\n end\n\n series += seq + 1 # exponetial growth \n end\n return list\n\nend",
"def sequence(int)\n array = []\n 1.upto(int) do |num|\n array << num\n end\n array\nend",
"def counting(limit) # this method receives an integer argument and returns an array\n numbers = []\n if limit.is_a?(Integer)\n count = 0\n while count < limit\n numbers << count\n count += 1\n end\n end \n numbers\nend",
"def sequence(count, first)\n (1..count).map { |idx| idx * first }\nend",
"def factorialize(n)\n return 0 if n.zero?\n\n number_array = []\n\n n.times do |number|\n number_array << number + 1\n end\n\n number_array.reduce(:*)\nend",
"def sequence(num)\n\n results = []\n\n 1.upto(num) { |num| results << num }\n\n results\n\nend",
"def sequence(n1, n2)\n\n arr = []\n counter = 1\n \n while n1 >0\n loop do \n arr << n2 * counter\n counter +=1\n break if counter > n1\n end\n break\n end\narr\nend",
"def sequence(num)\n arr = []\n 1.upto(num) { |n| arr << n }\n arr\nend",
"def sequence(int, int1)\n arr = []\n int.times {|i| arr << int1 + (int1 * i) }\n arr\nend",
"def series_up(n)\n #nlist is the list that will be the output of the code\n nlist = []\n #i changed from an if statement to a loop.\n (n*(n+1)/2+1).times do |i|\n i.times do |x|\n nlist.push(x+1)\n end\n end\n #I use three dots to only get the information i need from the code\n return nlist[0...(n*(n+1)/2)].to_a\nend",
"def sequence(count, first)\n (1..count).map { |value| value * first }\nend",
"def sequence(count, skip)\n result = []\n return result if count.zero?\n count.times do |x|\n result << skip * (x + 1)\n end\n result\nend",
"def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend",
"def fibonacci count\n raise \"Wrong type of argument\" if !count.is_a? Integer\n # n1 = 0\n # n2 = 1\n # sequence = []\n # while count > 2\n # n3 = n1 + n2\n # sequence << n3\n # n1 = n2\n # n2 = n3\n # count = count - 1\n # end\n # sequence\n\n # Version 2\n # sequence = []\n # (0..count).each do |number|\n # sequence << number if number <= 1\n # sequence << sequence[-1] + sequence[-2] if sequence.length > 1\n # end\n # sequence\n\n # Version 3 using recursively\n count <= 1 ? count : fibonacci(count-1) + fibonacci(count-2)\nend",
"def monkey_count(n)\n [*1..n]\nend",
"def sequencer(num)\n array = []\n array << num\n until array.last == 1\n if num%2 == 0 \n num = num/2\n array << num \n else \n num = num*3 + 1\n array << num \n end \n end\n return array.length\nend",
"def monkey_count(n)\n Array.new(n) {|x| x + 1 }#your code here\nend",
"def countup(num)\n (1..num).to_a\nend",
"def sequence(number_of_multiples, multiplier)\n result = []\n (1..number_of_multiples).each { |number| result << number * multiplier }\n result\nend",
"def repeatedly(count, initial = nil)\n return [] if (count = count.to_i) == 0\n return count.times.collect{ nil } unless block_given?\n return count.times.collect do\n initial = yield(initial)\n end\n end",
"def sequence(number)\n result = []\n 1.upto(number) do |num|\n result << num\n end\n \n result\nend",
"def numbers_to_calculate_factorial(number)\n factorials = [number]\n number.times do\n if number > 1 # <-- ensures 0 is not pushed into the factorials array\n factorials << number - 1\n number -= 1\n end\n end\n factorials\nend",
"def count_up(number)\n (1..number).to_a\nend",
"def sequence(quantity, number)\n sequence = []\n counter = 1\n quantity.times do \n sequence << number * counter\n counter += 1\n end\n sequence\nend",
"def sequence(num)\n sequence = []\n for nums in 1..num\n sequence << nums\n end\n sequence\nend",
"def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend",
"def magic_numbers(count)\n num = 1\n result = []\n while result.length < count\n result << num if is_magic_number?(num)\n num += 1\n end\n result\nend",
"def sequence(num)\n result = [1]\n times_number = num > 0 ? num - 1 : -(num) + 1\n times_number.times{num > 0 ? result << result.last + 1 : result << result.last - 1}\n result\nend",
"def sequence(number_of_multiples, multiplier)\n return [] if number_of_multiples == 0\n result = []\n current_number = 1\n loop do\n result << current_number * multiplier\n current_number += 1\n break if current_number > number_of_multiples\n end\n result\nend",
"def get_fibonacci_sequence(count)\n $i = 0\n # make sure we were passed in a number by converting it to an integer and then comparing the string value of the resulting\n # object to the original as to_i will output 0 if it can't convert to an integer\n # if it's not a number we'll raise an ArgumentError\n i_count = count.to_i\n if i_count.to_s != count || i_count < 0\n raise(ArgumentError, 'The requested number of items from the sequence must be a positive number.')\n end\n\n # create a new array to hold the calculated values and seed it with the first 2 numbers of the sequence to use in the calculations\n fib_sequence = Array.new\n fib_sequence.push 0\n fib_sequence.push 1\n $i+=2\n\n while $i <= i_count\n fib_sequence.push fib_sequence[-2] + fib_sequence[-1]\n $i+=1\n end\n # because we seed the array with the first 2 values of the sequence, we use slice to make sure we don't return too many items\n # in the case where they request 0 or 1 items\n fib_sequence.slice(0, i_count)\n end",
"def sequence2(num)\n arr = []\n \n 1.upto(num) do |n|\n arr << n\n end\n arr\nend",
"def sequence(num)\n arr = []\n \n 1.upto(num) do |i|\n arr << i\n end\n\n arr\nend",
"def sequence(number)\n result = []\n 1.upto(number) {|e| result << e}\n result\nend",
"def fn(num)\n array = []\n product = 1\n until num == 0\n array << num\n\tnum -= 1\n end\n array.each do |num|\n\tproduct = num * product\n end\nreturn product\nend",
"def Fib(n)\r\n array = [0, 1]\r\n n = User_number - 2\r\n a = 0\r\n b = 1\r\nn.times do\r\n temp = a\r\n a = b\r\n b = temp + b\r\n array << b\r\n end\r\n\r\nreturn array \r\nend",
"def sequence(num)\n (1..num).map { |n| n }\nend",
"def counts(n)\n divisors = Array.new\n (1..n).each do |n|\n single_divisors = count n\n divisors.push(single_divisors)\n end\n divisors\n end",
"def pyramid(numbers)\n array_of_arrays = []\n if numbers == 0 \n array_of_arrays\n end \n n = 1\n numbers.times do\n array_of_arrays << Array.new(n){1}\n n += 1\n end \n array_of_arrays\nend",
"def multisum(num)\n counter = 1\n arr = []\n while counter <= num\n if counter % 3 == 0 || counter % 5 == 0\n arr << counter\n end\n counter += 1\n end\n arr.sum\nend",
"def multisum(num)\n count = 0\n (1..num).each { |idx| count += idx if (idx % 3).zero? || (idx % 5).zero? }\n count\nend",
"def fib(n) #n indicates # of elements we want in array\r\n a = 0\r\n b = 1\r\n fib_arr = []\r\n #loop starts iff n >= 1, but x starts from 0 (when n=1, x=0; n=2, x=0,1)\r\n n.times do |x| \r\n if x == 0\r\n fib_arr << a\r\n elsif x == 1\r\n fib_arr << b\r\n else\r\n c = a+b #c is the new fib # we are generating\r\n fib_arr << c\r\n a = b\r\n b = c\r\n end\r\n end\r\n return fib_arr\r\nend",
"def sequence(number)\n (1..number).to_a\nend",
"def sequence(number)\n (1..number).to_a\nend",
"def simber_count(n)\n lower_range = 10**(n - 1)\n upper_range = (10**n) - 1\n count = 0\n (lower_range..upper_range).each do |i|\n count += 1 if simber_check(i)\n end\n count\nend",
"def sequence(length, step)\n Array.new(length) { |idx| (idx + 1) * step }\nend",
"def count_to(n)\n arr = []\n if n>=0\n n = n.floor\n 0.upto(n) do |x|\n arr << x\n end\n else\n n = -(-n).floor\n 0.downto(n) do |x|\n arr << x\n end\n end\n arr\n end",
"def sequence(number_of_multiples, multiplier)\n result = []\n current_number = 1\n loop do\n break if current_number > number_of_multiples # catches edge case\n result << current_number * multiplier\n current_number += 1\n end\n result\nend",
"def num_repeater(array = [])\n raise 'incorrect array' unless array.is_a? Array\n\n array_with_repeated_num = []\n array.each do |e|\n unless e.is_a? Integer\n array_with_repeated_num << e\n next\n end\n (1..e).each { array_with_repeated_num << e }\n end\n array_with_repeated_num\nend",
"def sequence(integer1, integer2)\n sequence_array = []\n current_value = integer2\n integer1.times do\n sequence_array << current_value\n current_value += integer2\n end\n sequence_array\nend",
"def zero_in_factorial(n)\n arr = Array.new(n) {|index| index + 1}\n print \"number of 0s in factorial #{n} is: #{rec(arr)}\\n\"\nend",
"def element_times_index(numbers)\n \n i = 0 # i represents to the index current index always\n \n new_array = []\n \n while i < numbers.length # We cant do less than or equal to here\n \n new_array << numbers[i] * i # You can shovel directly into a new array\n i += 1\n end\n return new_array\nend",
"def sequence(num)\n\tarr = []\n\t1.upto(num) {|num| arr << num }\n\tarr\nend",
"def magic_numbers(count)\nend"
] | [
"0.81486416",
"0.8035389",
"0.7976485",
"0.7910869",
"0.78672826",
"0.7774187",
"0.76455706",
"0.76172286",
"0.7576997",
"0.7573405",
"0.755418",
"0.75534344",
"0.75427073",
"0.75026715",
"0.74828",
"0.73792785",
"0.73405284",
"0.72876716",
"0.7257774",
"0.72237325",
"0.7211867",
"0.7188822",
"0.71873105",
"0.71621644",
"0.71563154",
"0.71237904",
"0.7122127",
"0.7103864",
"0.70673543",
"0.70510435",
"0.7046233",
"0.70403504",
"0.701692",
"0.7008269",
"0.6985667",
"0.6975124",
"0.69594675",
"0.69555366",
"0.69064313",
"0.6894691",
"0.6887088",
"0.68488514",
"0.6844074",
"0.6826086",
"0.6823166",
"0.6809686",
"0.68032986",
"0.67975557",
"0.67863435",
"0.6783937",
"0.67764306",
"0.6776227",
"0.6770708",
"0.6762385",
"0.6755451",
"0.673086",
"0.6690387",
"0.66858137",
"0.66530097",
"0.66232723",
"0.6611501",
"0.6596265",
"0.65922666",
"0.6589402",
"0.6584984",
"0.657243",
"0.65591866",
"0.6549608",
"0.6546909",
"0.65468806",
"0.65381247",
"0.6535822",
"0.6520817",
"0.65082055",
"0.64977145",
"0.6495698",
"0.6492439",
"0.64798784",
"0.64607847",
"0.64561826",
"0.64461815",
"0.6438558",
"0.6438347",
"0.64123017",
"0.64103955",
"0.64020854",
"0.6399528",
"0.63944155",
"0.63764066",
"0.63764066",
"0.6367218",
"0.63623154",
"0.63546723",
"0.635455",
"0.63538486",
"0.6346649",
"0.6332748",
"0.6332228",
"0.63033473",
"0.6281123"
] | 0.75081325 | 13 |
gives access to all helpers defined within `application_helper`. Deliver an invitation email | def sharing_invitation_instructions(record, raw_token, opts={})
@notification_token = opts[:notification_token] if opts[:notification_token]
@recipient = record
@sender = record.invited_by
# opts[:from] = "Ignatz from RecipePower <[email protected]>"
# optional arguments introduced in Devise 2.2.0, remove check once support for < 2.2.0 is dropped.
@invitation_event = InvitationSentEvent.post @sender, @recipient, @recipient.shared
# Add an attachment for the shared entity's image, if available
if (imgdata = @recipient.shared && @recipient.shared.imgdata).present?
attachments['collectible_image'] = Base64.decode64(imgdata.sub(/^data:image\/[^;]*;base64,/,''))
end
if Gem::Version.new(Devise::VERSION.dup) < Gem::Version.new('2.2.0')
devise_mail(record, :sharing_invitation_instructions)
else
devise_mail(record, :sharing_invitation_instructions, opts)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitation\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def invitation\n InvitationMailer.send_invitation(self).deliver\n end",
"def all_application_helpers; end",
"def helpers\n ActionController::Base.helpers\n end",
"def helpers\n ApplicationController.helpers\n end",
"def helpers\n ApplicationController.helpers\n end",
"def invitation_instructions(record)\n setup_mail(record, :invitation_instructions)\n end",
"def invitation_instructions(record)\n setup_mail(record, :invitation_instructions)\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def helpers\n ActionController::Base.helpers\n end",
"def helpers\n ActionController::Base.helpers\n end",
"def helper\n @helper ||= ApplicationController.helpers\n end",
"def invite(invitation, www_host)\n @invitation = invitation\n @www_host = www_host\n \n mail :to => invitation.email_address\n end",
"def helpers\n ActionController::Base.helpers\nend",
"def invite(invitation)\n @invitable = invitation.invitable\n @user = invitation.user\n # TODO: UPDATE the registration URL\n @registration_url = root_url\n\n view = 'invite'\n # invite_project or invite_board if available\n view += ('_%s' % invitation.invitable_type.parameterize) if @invitable\n\n title = @invitable.nil? ? Doers::Config.app_name : @invitable.title\n subject = _('%s invites you to work on %s.') % [invitation.user.name, title]\n\n mail(:to => invitation.email, :subject => subject, :template_name => view)\n end",
"def invitation(invitation)\n @recipient = invitation.recipient_mail\n @sender_name = invitation.sender.name\n @sender_mail = invitation.sender.email\n mail(:to => @recipient, :subject => t(\"mailers.invitation_mail.subject\", :sender_name =>@sender_name) ) \n end",
"def deliver_invitation_with options={}\n if model = options[:model]\n # self.override_devise_notification = \"invitation_instructions_with_#{model.class.model_name.to_s.underscore}\"\n self.override_devise_notification = \"invitation_instructions_with_member\"\n self.override_devise_model = model\n end\n if message = options[:personal_message]\n self.invitation_message = message\n end\n deliver_invitation\n end",
"def define_action_helpers; end",
"def helpers\n ActionController::Base.helpers # you can also try @template.helpers OR self.class.helpers OR include ActionView::Helpers\n end",
"def invitation(user)\n @user = user\n mail to: user.email\n end",
"def invite_user(invitation,subject,message)\n @subject = subject\n @sign_up_url = new_user_registration_url(:token => invitation.token)\n @invitation = invitation\n @message = message\n mail( :from => invitation.user.email,\n :to => invitation.email,\n :subject => subject )\n end",
"def helper\n @helper\n end",
"def helper\n @helper\n end",
"def application_help\n UserMailer.application_help\n end",
"def helpers\n Helper.instance\n end",
"def invitation_coloc\n ColocMailer.invitation_coloc\n end",
"def invite(invitation)\n @invitation = invitation\n mail(to: invitation.email, subject: \"#{invitation.user.name} invite you to join GURUPU\")\n end",
"def app_helpers\n @app_helpers ||= Class.new do\n include Rails.application.routes.url_helpers\n include ::ApplicationHelper\n end.new\n end",
"def event_invitation_notice(invitation)\n @user = invitation.user\n @invitation = invitation\n @event = invitation.event\n email = invitation.email || @user.try(:email)\n mail(:to => email, :subject => \"#{invitation.invitor.name} invited you to '#{invitation.event.title}' on SocialStreet\") unless email.blank?\n end",
"def invite(invitation)\n @invite = invitation\n mail :to => invitation.email,\n :subject => \"Welcome to the Panda\"\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def define_action_helpers?; end",
"def helpers\r\n Helper.instance\r\n end",
"def sign_up_invitation invitation\n @invitation = invitation\n mail(from: invitation.from, to: @invitation.to, subject: @invitation.subject )\n end",
"def mailer; end",
"def helpers(&block)\n Helpers.class_eval(&block)\n end",
"def invitation(invitation, signup_url)\n @invitation = invitation\n # @random_password = random_password\n mail to: invitation.recipient_email,\n subject: 'Invite',\n signup_url: 'signup_url'\n invitation.update_attribute(:sent_at, Time.now) \n end",
"def get_helpers\n @helpers\n end",
"def invitation_mail(email, sender)\n @email = email\n @sender = sender\n mail to: @email, subject: \"Invitation maill from Git-Api\"\n end",
"def email_confirm\n end",
"def helpers\n Blush.helpers\n end",
"def invited_app_user(user)\n @user = user\n @subject = \"Invitation to Bunch\"\n @body = \"Bunch is a simple web dashboard that integrates with your teams’ calendars.\" \n mail(to: @user.email, subject: @subject)\n end",
"def invitation_email(user, pot)\n @user = user\n @pot = pot\n mail(subject: \"You're invited to contribute!\", to: user.email)\n end",
"def define_helpers; end",
"def helpers(*extensions, &block)\n self.class.helpers(*extensions, &block)\n end",
"def helper(*helpers)\r\n helper_object.extend *helpers\r\n end",
"def invite_friend(user, invitation)\n @user = user\n @invitation = invitation\n\n mail to: @invitation.email, subject: \"Invitation to connect@ustksa\"\n end",
"def invite_user invitation, link\n\n @invitation = invitation\n @link = link\n\n mail :to => invitation.email, :subject => t('invitation_mailer.invite_user.subject')\n end",
"def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end",
"def helper(_method)\n ActionController::Base.helpers.method(_method)\n end",
"def accepted_application_moderator(vacancy, user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def deliver_confirmation_email_instructions!\n # TODO\n end",
"def example_mailer\n ExamplerailsMailer.example_mailer\n end",
"def devise_mail(record, action, opts = T.unsafe(nil), &block); end",
"def helper( *modules )\n machine.helper *modules\n end",
"def invitation_email(invitation)\n @invitation = invitation\n recipients = [\"[email protected]\"]\n recipients << \"[email protected]\" if Rails.env.production?\n\n mail to: recipients,\n reply_to: \"[email protected]\",\n subject: \"New access request from #{invitation.first_name} #{invitation.last_name}\"\n end",
"def invitation_used user, invitation\n if invitation\n @user = user\n @invitation = invitation\n mail( to: invitation.from,\n subject: \"Your invitation to #{invitation.to} was just used\"\n )\n end\n end",
"def collaboration_notification(attributes={})\n invited_by = attributes[:invited_by]\n\t\t@sender_name = invited_by.try(:full_name)\n\t\t@invitee_name = attributes[:invitee].full_name\n\t\tcollaboration_object_type = attributes[:invitation_type].class.to_s.downcase\n\t\t@collaboration_link = \"#{ENV['DOMAIN']}/#/app/#{collaboration_object_type.pluralize}/#{attributes[:invitation_type].id}/accept_invitation\"\n\t\t@reject_link = \"#{ENV['DOMAIN']}/#/app/#{attributes[:invitation_type].class.name.downcase.pluralize}/#{attributes[:invitation_type].id}/reject_invitation\"\n\t\t@message = attributes[:invitation_message].to_s\n\t\t@subject = \"Your help has been requested for a new #{collaboration_object_type} in Grapple.\"\n\t\tp \"-----------------------------------------------------------------------------\"\n\t\tp \"Existing User - Sending CollabInvitation to #{@invitee_name} - #{attributes[:email]}\"\n\t\tp \"-----------------------------------------------------------------------------\"\n\t\tif collaboration_object_type == \"project\"\n\t\t\t@project_title = attributes[:invitation_type].title\n\t\t\tmail(\"existing_user_project_collaboration_invitation\",email: attributes[:email])\n\t\telsif collaboration_object_type == \"document\"\n\t\t\t@document_title = attributes[:invitation_type].title\n\t\t\t@project_title = attributes[:invitation_type].project.title\n\t\t\tmail(\"existing_user_document_collaboration_invitation\",email: attributes[:email])\n\t\tend\n\tend",
"def bookkeeper_invitation_url(access)\n \"#{::AppConfig.mail.host}/access/#{access}\"\n end",
"def mail_box; end",
"def install_helpers # :nodoc:\n mod = @module\n ActionView::Base.class_eval do\n include mod\n end\n end",
"def mailer\n @_controller\n end",
"def mailer\n @_controller\n end",
"def accept_invitation\n \n end",
"def helpers_paths; end",
"def helpers_paths; end",
"def helpers_paths; end",
"def helpers_paths; end",
"def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end",
"def employeer_notification\n NotificationMailer.employeer_notification\n end",
"def product_email\n UserMailer.product_email\n end",
"def helper_method(*meths)\n meths.flatten!\n self._helper_methods += meths\n\n meths.each do |meth|\n _helpers.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1\n def #{meth}(*args, &blk) # def current_user(*args, &blk)\n controller.send(%(#{meth}), *args, &blk) # controller.send(:current_user, *args, &blk)\n end # end\n ruby_eval\n end\n end",
"def reminder\n UsersMailer.reminder\n end",
"def show_notfication\n UserMailer.show_notfication\n end",
"def helpers &blk\n @helpers = blk\n end",
"def get_activate_email\n end",
"def helper\n @helper ||= Helpers.new\n end",
"def regular_reminder_email\n @retailers = Spree::Retailer.active\n \n respond_to do |format|\n format.html { render :template => \"spree/order_mailer/regular_reminder_email.html.erb\", :layout => false }\n end\n end",
"def invitation(guest)\n\n @parent = guest.parent\n mail(to: @parent.email, subject: \"Invitation événement\")\n end",
"def invitation(users)\n # making sure we only send in bulks of 1000 emails by the Sendgrid Api limits\n users = users[0..998]\n sendgrid_recipients users.collect {|user| user.email}\n sendgrid_substitute \"|name|\", users.collect {|user| user.name}\n mail :to => \"[email protected]\", :subject => \"Invitation to a demo app\"\n end",
"def invitation_instructions(record, token, opts={})\n\t #headers[\"Custom-header\"] = \"Bar\"\n\t opts[:subject] = \"You are invitated to make union join forms!\"\n\t opts[:from] = \"#{record.invited_by.display_name} <#{record.invited_by.email}>\"\n\t opts[:reply_to] = opts[:from] # else replies to sender\n\t headers[:bcc]= record.invited_by.email\n\t super\n\tend",
"def regular_reminder_email\n @retailers = Spree::Retailer.active\n\n respond_to do |format|\n format.html { render :template => \"spree/order_mailer/regular_reminder_email.html.erb\", :layout => false }\n end\n end",
"def user_welcome_reminder(user,subject,message)\n @from = \"REIMatcher <[email protected]>\"\n @recipients = user.email\n @subject = \"#{subject}\"\n @sent_on = Time.now\n user_activation_link = \"#{REIMATCHER_URL}user_activate/#{user.activation_code}\"\n unless message.blank?\n @body = message.to_s.gsub(\"[User Email]\",user.email.to_s).gsub(\"[User First Name]\",user.first_name.to_s).gsub(\"[User Last Name]\",user.last_name.to_s).gsub(\"[User Login]\",\"<a href='#{user.login.to_s}'>#{user.login.to_s}</a>\").gsub(\"[User Full Name]\",user.first_name.to_s + \" \" + user.last_name.to_s).gsub(\"[User Activation Link]\",\"<a href='#{user_activation_link}'>#{user_activation_link}</a>\")\n else\n @body = \"\"\n end\n @content_type = \"text/html\"\n reminder_welcome_email_header = {:category => EMAIL_CATEGORIES[:ar]}\n @headers[\"X-SMTPAPI\"] = reminder_welcome_email_header.to_json unless reminder_welcome_email_header.blank?\n# @headers[\"X-SMTPAPI\"] = header\n end",
"def invite_resource\n ## skip sending emails on invite\n # super do |u|\n # u.skip_invitation = true\n # end\n end",
"def mailer\n ExamplerailsMailer.mailer\n end",
"def get_mail\n \n end",
"def bonus_session_notification\n TutorMailer.bonus_session_notification\n end",
"def reminder\n RequestMailer.reminder\n end",
"def invitation(invitation, signup_url)\n puts \"signup_url\"\n puts signup_url\n puts \"invitation\"\n puts invitation.to_s\n @signup_url = signup_url\n subject 'Invitation to www.iCoddle.com'\n recipients invitation.recipient_email\n from '[email protected]'\n body :invitation => invitation, :signup_url => signup_url\n invitation.update_attribute(:sent_at, Time.now)\n end",
"def helpers\n @_helper_proxy ||= view_context\n end",
"def new_feedback\n UserMailer.new_feedback\n end",
"def format_invitation(invitation, options = {}) \n expose_external_invitation_email = options.delete(:expose_external_invitation_email) || false\n link_to_invitation = options.delete(:link_to_invitation) || false\n \n if invitation.is_a? SurveyInvitation || NetworkInvitation then\n if link_to_invitation then\n link_to_organization(invitation.invitee)\n else\n invitation.invitee.name_and_location\n end\n else\n if expose_external_invitation_email then\n invitation.organization_name_and_email\n else\n invitation.organization_name\n end\n end\n end",
"def invite_for_booking_process\n UserMailer.invite_for_booking_process(Booking.last)\n end",
"def abstract\n NotificationsMailer.abstract\n end",
"def helper_method(*methods)\n methods.flatten.each do |method|\n master_helper_module.module_eval <<-end_eval\n def #{method}(*args, &block) # def current_user(*args, &block)\n controller.send(%(#{method}), *args, &block) # controller.send(%(current_user), *args, &block)\n end # end\n end_eval\n end\n end",
"def invitation_service\n @invitation_service ||= Course::UserInvitationService.new(current_user, current_course)\n end",
"def invitation_service\n @invitation_service ||= Course::UserInvitationService.new(current_user, current_course)\n end",
"def form_helpers\n ::RPH::FormAssistant::FORM_HELPERS\n end"
] | [
"0.6264212",
"0.6202036",
"0.6163642",
"0.61503625",
"0.6131173",
"0.6131173",
"0.6110015",
"0.6110015",
"0.60819566",
"0.60819566",
"0.60819566",
"0.60718036",
"0.60718036",
"0.6069679",
"0.600578",
"0.59995174",
"0.59971124",
"0.5994744",
"0.5983484",
"0.59687537",
"0.5941739",
"0.5899578",
"0.58808994",
"0.5851367",
"0.5851367",
"0.5843006",
"0.5829056",
"0.58239037",
"0.58083683",
"0.5804778",
"0.5799786",
"0.57963115",
"0.5788871",
"0.5753627",
"0.57095706",
"0.570848",
"0.5700473",
"0.56928545",
"0.5654907",
"0.56513584",
"0.56474555",
"0.5646348",
"0.5633716",
"0.5627402",
"0.56247073",
"0.5623939",
"0.5585329",
"0.55721056",
"0.55715954",
"0.5551516",
"0.5534622",
"0.5533479",
"0.5530822",
"0.553072",
"0.55270034",
"0.5523965",
"0.55101526",
"0.55099916",
"0.5509401",
"0.54896355",
"0.5484885",
"0.5470016",
"0.54695535",
"0.5468655",
"0.5468655",
"0.5465791",
"0.5463066",
"0.5463066",
"0.5463066",
"0.5463066",
"0.54621243",
"0.5459932",
"0.545479",
"0.5452765",
"0.54511446",
"0.5433819",
"0.54209834",
"0.54184484",
"0.5413802",
"0.54107267",
"0.5409782",
"0.53991205",
"0.53920215",
"0.5383402",
"0.5378975",
"0.5378603",
"0.53652084",
"0.53639424",
"0.53623646",
"0.5359293",
"0.53583753",
"0.53569007",
"0.5356431",
"0.5355631",
"0.5355467",
"0.5353374",
"0.53460336",
"0.5343626",
"0.5343626",
"0.53393316"
] | 0.5496474 | 59 |
GET /rec_event_follows GET /rec_event_follows.json | def index
@rec_event_follows = RecEventFollow.all
authorize! :index, RecEventFollow.new, :message => 'Not authorized as an administrator.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rec_event_follow\n @rec_event_follow = RecEventFollow.find(params[:id])\n end",
"def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_events=Array.new\n @eventos_nous=Array.new\n @followed.each do |f|\n @followed_events = Evento.all.where(:id_creator => f.company_id)\n @followed_events.each do |e|\n @eventos_nous << e.formatted_data.as_json()\n end\n end\n render json: @eventos_nous\n end",
"def following_event\n @user = User.find(params[:id])\n @events = @user.following_event.paginate(page: params[:page])\n render 'client_pages/following'\n \tend",
"def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end",
"def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend",
"def set_event_follower\n @event_follower = EventFollower.find(params[:id])\n end",
"def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end",
"def follows\n @follows ||= refresh_follows\n end",
"def follow_list(options)\n session.options = adapt_to_dev_env(options)\n session.get('/follows')\n end",
"def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end",
"def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end",
"def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end",
"def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number of followees'\r\n assert follows[0]['id'] == 7\r\n assert follows[0]['follower_id'] == 9\r\n assert follows[1]['id'] == 8\r\n assert follows[1]['follower_id'] == 10\r\n assert follows[2]['id'] == 9\r\n assert follows[2]['follower_id'] == 11\r\n end",
"def my_follows\n follows = paginate Follow.where(follower_id: params[:user_id])\n\n render json: follows.to_json(:include => :following)\n end",
"def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end",
"def follow(response)\n user_name = response.user.andand.name\n routing_key = response.match_data[1]\n validate_follow_routing_key(routing_key)\n subscribe(nil, user_name, routing_key)\n response.reply \"#{response.user.name}, following '#{routing_key}'\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e} (routing_key: '#{routing_key}')\"\n end",
"def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end",
"def next_follow\n end",
"def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend",
"def followed\n Following.where(:follower_id => self).includes(:followed).map(&:followed)\n end",
"def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\"/statuses/followers.json?#{args}\")\n end",
"def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end",
"def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end",
"def follow\n # if params[:followage] && (['User','Cube', 'Post'].include?(params[:followage][:followed_type]))\n # @parent = Object.const_get(params[:followage][:followed_type]).find(params[:followage][:followed_id])\n # current_user.follow!(@parent, :record => true)\n # end\n\n current_user.follow!(@parent, :record => true)\n\n ## IMPORTANT! Km analytics are on 'record_follow' method of the User class, as we need to prevent recording multiple-follows\n Analytics.km_follow(current_user, @parent)\n \n respond_to do |format|\n format.html { redirect_to @parent }\n format.js { render :layout => false }\n end \n end",
"def list_follow(response)\n user_name = response.user.andand.name\n response.reply \"#{response.user.name}, list for '#{user_name}': #{list_spam(nil, user_name)}\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e}\"\n end",
"def show_followers\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.followed_by\n end",
"def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end",
"def follows\n group = Group.find_by(id: params[:id])\n\n render json: group, status: :ok, serializer: GroupFollowsSerializer\n end",
"def fetch_user_and_followings\n @user = User.find(params[:followee_id])\n @follow = Follow.find_by(follower_id: current_user.id, followee_id: params[:followee_id])\n end",
"def followers(action=nil)\n my.followers(action)\n end",
"def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def prev_follow\n end",
"def show_followers\n\t@user = User.find(params[:id])\n\t\n\trender json: @user.followed_by\n\tend",
"def followed_objects\n get_followed_objects_of_kind\n end",
"def followers\n\t Friendship.findFriends(self,\"follow\",\"from\")\n end",
"def followed(artist)\n follows.where(artist_id: artist.id).first\n end",
"def following_record(user)\n followings_as_follower.find_by(user: user)\n end",
"def follow\r\n \r\n @followu = FollowUser.where(user_id: @u_id)\r\n @followt = FollowThread.where(user_id: @u_id)\r\n end",
"def following\n\t\tauthenticate_current_user\n\t\t# grab all the current user's following\n\t\tfollowing = UserFollower.where(user_follower_id: current_user.id)\n\t\t# create an empty array\n\t\tfollowing_group = []\n\t\t# rotate through each following returned, and grab the user object\n\t\tfollowing.each do |x|\n\t\t\t# push each following user object into array\n\t\t\tfollowing_group.push(User.find(x.user_id))\n\t\tend\n\t\t# respond with the array of following user objects\n\t\trespond_with following_group\n\n\tend",
"def follow\n\n end",
"def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\[email protected] << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend",
"def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"def following\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"edge_follow\"][\"count\"]\n end",
"def Listfollowers\n follower= Following.where(\"followingid =:followingId\",{followingId:getUserId[0]['userId']}).count\n render json: {follower:follower}, status: :ok\n end",
"def show\n authorize! :show, @rec_event_follow, :message => 'Not authorized as an administrator.'\n end",
"def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def followers\n begin\n @followers = current_user.twitter.get(\"/statuses/followers?page=#{params[:page] || 1}\")\n rescue TwitterAuth::Dispatcher::Error\n @followers = []\n end\n\n status = @followers.empty? ? 404 : 200\n\n respond_to do |format|\n format.html { render(:action => 'followers', :status => status) }\n format.json { render(:json => @followers.to_json, :status => status) }\n end\n end",
"def get_followees\n HTTParty.post(\"#{@api_path}/users/followees/#{@handle}/#{@password}\")\n end",
"def follow_params\n\t\tparams[:follows]\n\tend",
"def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @usersList = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def follow\n requested_profile.follow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile, :format => params[:format]\n end",
"def following\n Follow.where(\"follower_id = ?\", self.id)\n end",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def index\n @user = User.find(params[:user_id])\n @followers = @user.followers.all\n render json: @followers if stale?(etag: @followers.all, last_modified: @followers.maximum(:updated_at))\n end",
"def follow(user)\n client.search(\"#bonjour_monde\", result_type: \"recent\").take(20).collect.each {|name| client.follow(name.user.screen_name)}\nend",
"def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def show\n @user=User.find(params[:user_id])\n @[email protected](params[:id])\n render json: User.find(@follower.id) if stale?(User.find(@follower.id))\n end",
"def followers\n Follow.where(\"following_id = ?\", self.id)\n end",
"def get_follow( followed )\n\t\t\t\tFollow.active.for_follower( self ).for_followed( followed ).first\n\t\t\tend",
"def follows_given(user_id)\n follows = Follow.where(user_id: user_id)\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @usersList = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end",
"def show\n @followup = Followup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup }\n end\n end",
"def index\n @follows = Follow.all\n end",
"def index\n @follows = Follow.all\n end",
"def followings\n @followees = @user.followees.order(created_at: :desc) # order the followings(the people that current_user follows) according to when they were followed by current_user, with the most recent following at the top.\n end",
"def following\n\t@title = \"Following\"\n\t@user = User.find(params[:id])\n\t@users = @user.following.paginate(page: params[:page])\n\trender 'show_follow'\n end",
"def index\n timeline = Tweet.where(user_id: User.find(@current_user_id).follows).or(Tweet.where(user_id: @current_user_id))\n render json: {timeline: timeline}\n end",
"def followers(options={})\n perform_get(\"statuses/followers.#{Twitter.format}\", options)\n end",
"def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end",
"def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end",
"def followers\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"edge_followed_by\"][\"count\"]\n end",
"def update_follower_event(last_follower, follower_event)\n last_follower_event = follower_event\n while last_follower_event&.follower\n last_follower_event.set_follower(nil) unless last_follower_event.follower.is_a?(Game_Event)\n last_follower_event = last_follower_event.follower\n end\n last_follower.set_follower(follower_event) if last_follower.follower != follower_event\n end",
"def rec_event_follow_params\n params.require(:rec_event_follow).permit(:recurring_event_id, :user_id, :send_email, :send_sms)\n end",
"def follow(user)\n self.following << user\n ActionLog.log_other(self.id, \"follow\", user) \n end",
"def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end",
"def followers(page=1)\n return get(\"/statuses/followers.json?page=#{page}\") if page == 1\n ids = []\n cursor = \"-1\"\n page.times do \n return [] if cursor == 0 \n json = get(\"/statuses/followers.json?cursor=#{cursor}\")\n cursor = json[\"next_cursor\"]\n ids = json[\"ids\"]\n end\n ids\n end",
"def follow( follow_nick, follow_address )\n return if data['plans'][me]['following'].count { |e| e['address'] == follow_address } != 0\n data['plans'][me]['following'] << { 'nick' => follow_nick, 'address' => follow_address }\n end",
"def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\n end",
"def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Song.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"def followerss\n followers = relationships.find_by_followed_id(self.id)\n return followers\n end",
"def followers(action=nil)\n if @followers\n case action\n when :update\n @followers = @client.my(:followers)\n when nil\n @followers\n else\n raise ArgumentError, \"#{action} is not a valid argument for @followers.\"\n end\n else\n @followers = @client.my(:followers)\n end\n end",
"def find_relationship followed_id\n \tfollowing_relationships.find_by followed_id: followed_id \n end",
"def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end",
"def followers\n @title = 'Followers'\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end",
"def index\n @meeting_follow_ups = MeetingFollowUp.all\n end",
"def follows\n @follower ||= FollowConfig.new\n @follower\n end",
"def follow\n \t\n \t@follow = Follow.new\n \[email protected] = session[:id]\n \[email protected] = params[:aid]\n \tif @follow.save\n\t \t#@follow.update_attribute(:follower, session[:id])\n\t \t#@follow.update_attribute(:followee, params[:aid])\n\t \t@fol_name = Account.find(params[:aid])\n\t \tflash[:success] = \"You are now following\" + @fol_name.first_name + \" \" + @fol_name.last_name + \".\"\n\t \t\n\t \t\n\t \t#if request.xhr?\n\t \t\trender 'accounts/follow'\n \t\t#else\n\t \t#\tredirect_to :controller => :main, :action => :searching\n \t\t#end\n \tend\n \t\n end",
"def update\n respond_to do |format|\n authorize! :update, @rec_event_follow, :message => 'Not authorized as an administrator.'\n if @rec_event_follow.update(rec_event_follow_params)\n format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def following\n @title = 'Following'\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end",
"def followers\n @followers = @user.followers\n\n respond_to do |format|\n format.html\n format.json { render :json => { :followers => @followers.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end",
"def followings\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followings = @interviewee.followings\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end"
] | [
"0.68207645",
"0.6772752",
"0.6617579",
"0.6541694",
"0.6511154",
"0.6477968",
"0.6472577",
"0.6430263",
"0.6392835",
"0.63390857",
"0.6335644",
"0.6265119",
"0.62443507",
"0.62344414",
"0.6231666",
"0.61889374",
"0.6163822",
"0.61520886",
"0.6128537",
"0.6125582",
"0.6119675",
"0.6103599",
"0.6085127",
"0.60822237",
"0.60333717",
"0.60206926",
"0.60158956",
"0.6000265",
"0.5990794",
"0.5989022",
"0.5981143",
"0.5958659",
"0.59577477",
"0.5947038",
"0.59412867",
"0.5939925",
"0.59382653",
"0.5935071",
"0.5917257",
"0.59139967",
"0.5902105",
"0.58981764",
"0.5896263",
"0.58885473",
"0.5884877",
"0.5873248",
"0.58677727",
"0.58677727",
"0.58643997",
"0.58577776",
"0.5856185",
"0.5842227",
"0.5836249",
"0.58319",
"0.58318627",
"0.58302623",
"0.582508",
"0.5822684",
"0.58207554",
"0.5817859",
"0.57984686",
"0.579497",
"0.57771057",
"0.5773239",
"0.5772855",
"0.5772855",
"0.5772855",
"0.57690704",
"0.57683307",
"0.57631934",
"0.57631934",
"0.5761199",
"0.5756313",
"0.57496357",
"0.5747425",
"0.57438546",
"0.57438546",
"0.57418567",
"0.57408834",
"0.5736753",
"0.57320577",
"0.5731643",
"0.572489",
"0.57230806",
"0.57191086",
"0.5713222",
"0.57051617",
"0.57040966",
"0.5691016",
"0.5688926",
"0.5686937",
"0.5686314",
"0.56827587",
"0.5679347",
"0.5679329",
"0.56664735",
"0.566644",
"0.56643516",
"0.56601626",
"0.56594527"
] | 0.61339056 | 18 |
GET /rec_event_follows/1 GET /rec_event_follows/1.json | def show
authorize! :show, @rec_event_follow, :message => 'Not authorized as an administrator.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rec_event_follow\n @rec_event_follow = RecEventFollow.find(params[:id])\n end",
"def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end",
"def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_events=Array.new\n @eventos_nous=Array.new\n @followed.each do |f|\n @followed_events = Evento.all.where(:id_creator => f.company_id)\n @followed_events.each do |e|\n @eventos_nous << e.formatted_data.as_json()\n end\n end\n render json: @eventos_nous\n end",
"def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end",
"def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend",
"def following_event\n @user = User.find(params[:id])\n @events = @user.following_event.paginate(page: params[:page])\n render 'client_pages/following'\n \tend",
"def set_event_follower\n @event_follower = EventFollower.find(params[:id])\n end",
"def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end",
"def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end",
"def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end",
"def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number of followees'\r\n assert follows[0]['id'] == 7\r\n assert follows[0]['follower_id'] == 9\r\n assert follows[1]['id'] == 8\r\n assert follows[1]['follower_id'] == 10\r\n assert follows[2]['id'] == 9\r\n assert follows[2]['follower_id'] == 11\r\n end",
"def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end",
"def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end",
"def follows\n @follows ||= refresh_follows\n end",
"def my_follows\n follows = paginate Follow.where(follower_id: params[:user_id])\n\n render json: follows.to_json(:include => :following)\n end",
"def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end",
"def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend",
"def next_follow\n end",
"def show_followers\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.followed_by\n end",
"def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end",
"def follow(response)\n user_name = response.user.andand.name\n routing_key = response.match_data[1]\n validate_follow_routing_key(routing_key)\n subscribe(nil, user_name, routing_key)\n response.reply \"#{response.user.name}, following '#{routing_key}'\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e} (routing_key: '#{routing_key}')\"\n end",
"def follow_list(options)\n session.options = adapt_to_dev_env(options)\n session.get('/follows')\n end",
"def index\n @rec_event_follows = RecEventFollow.all\n authorize! :index, RecEventFollow.new, :message => 'Not authorized as an administrator.'\n end",
"def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end",
"def show\n @followup = Followup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup }\n end\n end",
"def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end",
"def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end",
"def show\n @user=User.find(params[:user_id])\n @[email protected](params[:id])\n render json: User.find(@follower.id) if stale?(User.find(@follower.id))\n end",
"def show_followers\n\t@user = User.find(params[:id])\n\t\n\trender json: @user.followed_by\n\tend",
"def following\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"edge_follow\"][\"count\"]\n end",
"def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end",
"def follow\n # if params[:followage] && (['User','Cube', 'Post'].include?(params[:followage][:followed_type]))\n # @parent = Object.const_get(params[:followage][:followed_type]).find(params[:followage][:followed_id])\n # current_user.follow!(@parent, :record => true)\n # end\n\n current_user.follow!(@parent, :record => true)\n\n ## IMPORTANT! Km analytics are on 'record_follow' method of the User class, as we need to prevent recording multiple-follows\n Analytics.km_follow(current_user, @parent)\n \n respond_to do |format|\n format.html { redirect_to @parent }\n format.js { render :layout => false }\n end \n end",
"def followed\n Following.where(:follower_id => self).includes(:followed).map(&:followed)\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def prev_follow\n end",
"def Listfollowers\n follower= Following.where(\"followingid =:followingId\",{followingId:getUserId[0]['userId']}).count\n render json: {follower:follower}, status: :ok\n end",
"def follows\n group = Group.find_by(id: params[:id])\n\n render json: group, status: :ok, serializer: GroupFollowsSerializer\n end",
"def show\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follower }\n end\n end",
"def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def followed(artist)\n follows.where(artist_id: artist.id).first\n end",
"def following_record(user)\n followings_as_follower.find_by(user: user)\n end",
"def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end",
"def fetch_user_and_followings\n @user = User.find(params[:followee_id])\n @follow = Follow.find_by(follower_id: current_user.id, followee_id: params[:followee_id])\n end",
"def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def get_follow( followed )\n\t\t\t\tFollow.active.for_follower( self ).for_followed( followed ).first\n\t\t\tend",
"def index\n @user = User.find(params[:user_id])\n @followers = @user.followers.all\n render json: @followers if stale?(etag: @followers.all, last_modified: @followers.maximum(:updated_at))\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def following\n Follow.where(\"follower_id = ?\", self.id)\n end",
"def create\n follow_exists = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:user_id]).first\n\n if follow_exists.nil?\n # Follower doesn't exists\n @api_v1_follower = Api::V1::Follower.new(api_v1_follower_params)\n @api_v1_follower.follower_id = @current_user.id\n @api_v1_follower.user_id = params[:user_id]\n\n if @api_v1_follower.save\n\n # create new notification\n notification = Api::V1::Notification.new\n notification.user_id = @api_v1_follower.user_id\n notification.event_type = Api::V1::Notification::TYPE_NEW_FOLLOWER\n notification.content = { :event_user_id => @current_user.id, :event_user_name => @current_user.first_name + ' ' + @current_user.last_name, :event_user_avatar => @current_user.formated_avatar }.to_json\n notification.event_object_id = @api_v1_follower.user_id\n notification.save\n\n render json: @api_v1_follower, status: :created, location: @api_v1_follower\n else\n render json: @api_v1_follower.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'already following' }, status: 401\n end\n end",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def list_follow(response)\n user_name = response.user.andand.name\n response.reply \"#{response.user.name}, list for '#{user_name}': #{list_spam(nil, user_name)}\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e}\"\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def show\n @artist = Artist.find(params[:id])\n @user = current_user\n @timeline = Timeline.artist(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @artist }\n format.js do \n @follow = current_user.follow .where(:artist_id => params[:id]).first\n end\n end\n end",
"def update\n respond_to do |format|\n authorize! :update, @rec_event_follow, :message => 'Not authorized as an administrator.'\n if @rec_event_follow.update(rec_event_follow_params)\n format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @usersList = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\"/statuses/followers.json?#{args}\")\n end",
"def follow(user)\n client.search(\"#bonjour_monde\", result_type: \"recent\").take(20).collect.each {|name| client.follow(name.user.screen_name)}\nend",
"def following\n\t\tauthenticate_current_user\n\t\t# grab all the current user's following\n\t\tfollowing = UserFollower.where(user_follower_id: current_user.id)\n\t\t# create an empty array\n\t\tfollowing_group = []\n\t\t# rotate through each following returned, and grab the user object\n\t\tfollowing.each do |x|\n\t\t\t# push each following user object into array\n\t\t\tfollowing_group.push(User.find(x.user_id))\n\t\tend\n\t\t# respond with the array of following user objects\n\t\trespond_with following_group\n\n\tend",
"def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"def follow\n requested_profile.follow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile, :format => params[:format]\n end",
"def find_relationship followed_id\n \tfollowing_relationships.find_by followed_id: followed_id \n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\[email protected] << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend",
"def get_followees\n HTTParty.post(\"#{@api_path}/users/followees/#{@handle}/#{@password}\")\n end",
"def index\n timeline = Tweet.where(user_id: User.find(@current_user_id).follows).or(Tweet.where(user_id: @current_user_id))\n render json: {timeline: timeline}\n end",
"def show\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_user }\n end\n end",
"def follow\n\n end",
"def index\n @followings = Following.active.all(\n :conditions => {:follower_id => self.current_user.id})\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end",
"def index\n @follows = Follow.all\n end",
"def index\n @follows = Follow.all\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end",
"def followed_objects\n get_followed_objects_of_kind\n end",
"def following_info\n following = []\n self.following.each do |follower|\n following << follower.attributes.merge(avatar: follower.avatar.url)\n end\n response = {\n message: \"Successfully fetch #{ self.username } following\",\n relations: following\n }\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def set_follow\n @follow = Follow.find(params[:id])\n end",
"def follow\r\n \r\n @followu = FollowUser.where(user_id: @u_id)\r\n @followt = FollowThread.where(user_id: @u_id)\r\n end",
"def rec_event_follow_params\n params.require(:rec_event_follow).permit(:recurring_event_id, :user_id, :send_email, :send_sms)\n end",
"def follow_params\n\t\tparams[:follows]\n\tend",
"def following\n\t@title = \"Following\"\n\t@user = User.find(params[:id])\n\t@users = @user.following.paginate(page: params[:page])\n\trender 'show_follow'\n end",
"def followers\n begin\n @followers = current_user.twitter.get(\"/statuses/followers?page=#{params[:page] || 1}\")\n rescue TwitterAuth::Dispatcher::Error\n @followers = []\n end\n\n status = @followers.empty? ? 404 : 200\n\n respond_to do |format|\n format.html { render(:action => 'followers', :status => status) }\n format.json { render(:json => @followers.to_json, :status => status) }\n end\n end",
"def get_random_follow\n if !session[:user_follows]\n session[:user_follows] = client.friend_ids(current_user.get_uid_int).attrs[:ids]\n end\n\n follow_id = session[:user_follows].sample\n follow = client.user(follow_id)\n end",
"def create\n entry_time = DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n follows = Follow.where(\"user_id = ? and game_id = ? and follow_user_id = ?\", params[:follow][:user_id], params[:follow][:game_id], params[:follow][:follow_user_id])\n \n if follows[0].blank? then\n @follow = Follow.new(create_follow_params)\n @follow.created_at = entry_time\n @follow.updated_at = entry_time\n \n @follower = Follower.new\n @follower.user_id = @follow.follow_user_id\n @follower.game_id = @follow.game_id\n @follower.follower_user_id = @follow.user_id\n @follower.created_at = entry_time\n @follower.updated_at = entry_time\n\n else\n @follow = follows[0]\n @follow.updated_at = entry_time\n @follow.delete_flag = false\n\n followers = Follower.where(\"user_id = ? and game_id = ? and follower_user_id = ?\", params[:follow][:follow_user_id], params[:follow][:game_id], params[:follow][:user_id])\n @follower = followers[0]\n @follower.updated_at = entry_time\n @follower.delete_flag = false\n\n end\n\n respond_to do |format|\n if @follow.save\n @follower.save\n \n follow_user = User.find(@follow.follow_user_id)\n @ret = {\n :ret => 1,\n :user => follow_user\n }\n\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n #format.json { render :show, status: :created, location: @follow }\n format.json { render :show, location: @ret }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_follow\n\t\t@follow = Follow.find(params[:id])\n\tend",
"def follow\n current_user.follow_topic(@topic)\n render json: {ok: 1}\n end",
"def followers\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"edge_followed_by\"][\"count\"]\n end",
"def index\n @follows = Follow.all\n end",
"def index\n @follows = Follow.where(user_id:current_user)\n end",
"def followers(action=nil)\n my.followers(action)\n end",
"def followers\n Follow.where(\"following_id = ?\", self.id)\n end",
"def follow_notification\n Notifications.follow_notification\n end"
] | [
"0.7048061",
"0.6680448",
"0.6662466",
"0.6628479",
"0.6618326",
"0.6577661",
"0.6555493",
"0.6496516",
"0.6384339",
"0.63671744",
"0.6363592",
"0.6332563",
"0.62791",
"0.6253611",
"0.62394613",
"0.61823446",
"0.61449075",
"0.6138084",
"0.61049414",
"0.61037695",
"0.6099935",
"0.6090549",
"0.60836345",
"0.60776544",
"0.60712206",
"0.606319",
"0.606319",
"0.6038697",
"0.60163695",
"0.6015698",
"0.6013384",
"0.60132825",
"0.60043216",
"0.5994366",
"0.5994366",
"0.5979924",
"0.59623337",
"0.5951146",
"0.5944418",
"0.5942824",
"0.5937897",
"0.5922513",
"0.59206593",
"0.5904893",
"0.59032273",
"0.5899455",
"0.58839214",
"0.58795565",
"0.5860417",
"0.58563495",
"0.58530474",
"0.58465683",
"0.5843699",
"0.58260727",
"0.58222556",
"0.5819851",
"0.58016324",
"0.5800215",
"0.579201",
"0.5785805",
"0.57817215",
"0.5775918",
"0.577527",
"0.5769559",
"0.5769559",
"0.57689875",
"0.5761672",
"0.57615936",
"0.57549906",
"0.5753716",
"0.5750811",
"0.5748",
"0.5748",
"0.5745216",
"0.57445425",
"0.57445425",
"0.57445425",
"0.57318413",
"0.5731029",
"0.57289845",
"0.57289845",
"0.57289845",
"0.57289845",
"0.57289845",
"0.57289845",
"0.57227194",
"0.571866",
"0.57130945",
"0.5701245",
"0.5700395",
"0.56899506",
"0.56888133",
"0.5679757",
"0.5677455",
"0.5672744",
"0.5671085",
"0.5666622",
"0.5665128",
"0.56647867",
"0.56591916"
] | 0.59743893 | 36 |
POST /rec_event_follows POST /rec_event_follows.json | def create
@rec_event_follow = RecEventFollow.new(rec_event_follow_params)
authorize! :create, @rec_event_follow, :message => 'Not authorized as an administrator.'
respond_to do |format|
if @rec_event_follow.save
format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully created.' }
format.json { render action: 'show', status: :created, location: @rec_event_follow }
else
format.html { render action: 'new' }
format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end",
"def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end",
"def set_rec_event_follow\n @rec_event_follow = RecEventFollow.find(params[:id])\n end",
"def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\[email protected] << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend",
"def set_event_follower\n @event_follower = EventFollower.find(params[:id])\n end",
"def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end",
"def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_events=Array.new\n @eventos_nous=Array.new\n @followed.each do |f|\n @followed_events = Evento.all.where(:id_creator => f.company_id)\n @followed_events.each do |e|\n @eventos_nous << e.formatted_data.as_json()\n end\n end\n render json: @eventos_nous\n end",
"def follow(user)\n\tout_followings.create(to_id: user.id)\nend",
"def create\n follow_exists = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:user_id]).first\n\n if follow_exists.nil?\n # Follower doesn't exists\n @api_v1_follower = Api::V1::Follower.new(api_v1_follower_params)\n @api_v1_follower.follower_id = @current_user.id\n @api_v1_follower.user_id = params[:user_id]\n\n if @api_v1_follower.save\n\n # create new notification\n notification = Api::V1::Notification.new\n notification.user_id = @api_v1_follower.user_id\n notification.event_type = Api::V1::Notification::TYPE_NEW_FOLLOWER\n notification.content = { :event_user_id => @current_user.id, :event_user_name => @current_user.first_name + ' ' + @current_user.last_name, :event_user_avatar => @current_user.formated_avatar }.to_json\n notification.event_object_id = @api_v1_follower.user_id\n notification.save\n\n render json: @api_v1_follower, status: :created, location: @api_v1_follower\n else\n render json: @api_v1_follower.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'already following' }, status: 401\n end\n end",
"def rec_event_follow_params\n params.require(:rec_event_follow).permit(:recurring_event_id, :user_id, :send_email, :send_sms)\n end",
"def follow\n # if params[:followage] && (['User','Cube', 'Post'].include?(params[:followage][:followed_type]))\n # @parent = Object.const_get(params[:followage][:followed_type]).find(params[:followage][:followed_id])\n # current_user.follow!(@parent, :record => true)\n # end\n\n current_user.follow!(@parent, :record => true)\n\n ## IMPORTANT! Km analytics are on 'record_follow' method of the User class, as we need to prevent recording multiple-follows\n Analytics.km_follow(current_user, @parent)\n \n respond_to do |format|\n format.html { redirect_to @parent }\n format.js { render :layout => false }\n end \n end",
"def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end",
"def follow(user)\n active_follows.create(followed_id: user.id)\n \n end",
"def create\n entry_time = DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n follows = Follow.where(\"user_id = ? and game_id = ? and follow_user_id = ?\", params[:follow][:user_id], params[:follow][:game_id], params[:follow][:follow_user_id])\n \n if follows[0].blank? then\n @follow = Follow.new(create_follow_params)\n @follow.created_at = entry_time\n @follow.updated_at = entry_time\n \n @follower = Follower.new\n @follower.user_id = @follow.follow_user_id\n @follower.game_id = @follow.game_id\n @follower.follower_user_id = @follow.user_id\n @follower.created_at = entry_time\n @follower.updated_at = entry_time\n\n else\n @follow = follows[0]\n @follow.updated_at = entry_time\n @follow.delete_flag = false\n\n followers = Follower.where(\"user_id = ? and game_id = ? and follower_user_id = ?\", params[:follow][:follow_user_id], params[:follow][:game_id], params[:follow][:user_id])\n @follower = followers[0]\n @follower.updated_at = entry_time\n @follower.delete_flag = false\n\n end\n\n respond_to do |format|\n if @follow.save\n @follower.save\n \n follow_user = User.find(@follow.follow_user_id)\n @ret = {\n :ret => 1,\n :user => follow_user\n }\n\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n #format.json { render :show, status: :created, location: @follow }\n format.json { render :show, location: @ret }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow(response)\n user_name = response.user.andand.name\n routing_key = response.match_data[1]\n validate_follow_routing_key(routing_key)\n subscribe(nil, user_name, routing_key)\n response.reply \"#{response.user.name}, following '#{routing_key}'\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e} (routing_key: '#{routing_key}')\"\n end",
"def create\n\t\t@owner = Prover.find(params[:owner])\n\t\[email protected](Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def follow!(followed)\n relationships.create!(:followed_id => followed.id)\n end",
"def event_follower_params\n params.require(:event_follower).permit(:event_id).\n merge!({\"user_id\" => current_user.id, \"created_by\" => current_user.id, \"updated_by\" => current_user.id})\n end",
"def follow!(followed)\n self.relationships.create!(:followed_id => followed.id)\n end",
"def follow(user_id)\n followee_relationships.create(followee_id: user_id)\n end",
"def create\n @follow = current_user.follows.new(follow_params)\n @user = User.where(\"id = ?\", @follow.following )\n respond_to do |format|\n if @follow.save\n format.html { redirect_back fallback_location: root_path, notice: 'You are now following this user!' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\n end",
"def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end",
"def follow\n requested_profile.follow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile, :format => params[:format]\n end",
"def create\n @followup = Followup.new(params[:followup])\n\n respond_to do |format|\n if @followup.save\n format.html { redirect_to @followup, notice: 'Followup was successfully created.' }\n format.json { render json: @followup, status: :created, location: @followup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end",
"def update_follower_event(last_follower, follower_event)\n last_follower_event = follower_event\n while last_follower_event&.follower\n last_follower_event.set_follower(nil) unless last_follower_event.follower.is_a?(Game_Event)\n last_follower_event = last_follower_event.follower\n end\n last_follower.set_follower(follower_event) if last_follower.follower != follower_event\n end",
"def follow!(user)\n relationships.create!(:followed_id => user.id)\n end",
"def create\n @event = Event.new(params[:event])\n @event.organization = current_user\n\n respond_to do |format|\n if @event.save\n\n @event.organization.follows.each do | follow | \n Pony.mail :to => \"\\\"#{follow.volunteer.name}\\\" <#{follow.volunteer.email}>\",\n :from => \"FundIt <[email protected]>\",\n :subject => \"#{@event.organization.name} created a new FundIt event #{@event.name}.\",\n :body => \"Check it out at http://fundit.herokuapp.com/organizations/#{@event.organization.id}/events/#{@event.id}.\"\n end\n\n format.html { redirect_to organization_event_url(@event.organization, @event), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_follow_params\n params.require(:follow).permit(:user_id, :game_id, :follow_user_id, :delete_flag, :created_at, :updated_at)\n end",
"def create\n current_account.follow(@account)\n # TODO: Set up a mailer for notifying accounts of new followers\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n\n end",
"def follow! followee\n return if following? followee\n following << followee\n save\n followee.followers << self\n followee.save\n end",
"def follow(user_id, follow_status)\n following_relationships.create(following_id: user_id, follow_status: follow_status)\n end",
"def follow(user_id, follow_status)\n following_relationships.create(following_id: user_id, follow_status: follow_status)\n end",
"def follow_params\n params.require(:follow).permit(:user_id, :following)\n end",
"def create\n @user=User.find(params[:user_id])\n @follower = @user.followers.create(follower_params)\n if @follower.save\n render json: @follower, status: :created\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end",
"def follow(followee_handle)\n HTTParty.post(\"#{@api_path}/users/follow/#{@handle}/#{@password}/#{followee_handle}\")\n end",
"def follow! followee\n following << followee\n save\n followee.followers << self\n followee.save\n end",
"def follow( follow_nick, follow_address )\n return if data['plans'][me]['following'].count { |e| e['address'] == follow_address } != 0\n data['plans'][me]['following'] << { 'nick' => follow_nick, 'address' => follow_address }\n end",
"def follow(user_or_params)\n args = [user_or_params]\n post path_from_args('notifications/follow', args), params_from_args(args).merge({:post => {}})\n end",
"def follow(user_id)\n follower.create(followed_id: user_id)\n end",
"def follow(user)\n active_relationships.create(followed_id: user.id)\n end",
"def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend",
"def create\n head 404\n # @api_v1_following = Api::V1::Following.new(api_v1_following_params)\n # @api_v1_follower.following_id = @current_user.id\n\n # if @api_v1_following.save\n # render json: @api_v1_following, status: :created, location: @api_v1_following\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end",
"def follow_params\n params.require(:follow).permit(:following_id, :follower_id)\n end",
"def follow(user)\n self.following << user\n ActionLog.log_other(self.id, \"follow\", user) \n end",
"def create\n @follow = Follow.new(follow_params)\n\n respond_to do |format|\n if @follow.save\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_follow\n @follow = Follow.create(follow_params)\n redirect_to story_path(@follow.story_id)\n end",
"def follow( followed )\n\t\t\t\tfollow = get_follow( followed )\n\t\t\t\tif follow.blank? && self != followed\n\t\t\t\t\tFollow.create( :followed => followed, :follower => self )\n\t\t\t\tend\n\t\t\tend",
"def create\n @user = User.find(params[:followed_id])\n current_user.follow(@user)\n respond_to do |f|\n f.html { redirect_to @user}\n f.js\n end\n end",
"def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def create\n\t\t@user = User.find(params[:followed_id])\n\t\tcurrent_user.follow(@user)\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @user }\n\t\t\tformat.js\n\t\tend\n\tend",
"def submit\n self.oaw_follow(params[:follow])\n self.oaw_unfollow(params[:unfollow])\n end",
"def follow_params\n params.require(:follow).permit(:follower_type, :follower_id, :followable_type, :followable_id)\n end",
"def create\n @follow = Follow.new()\n @follow.luser_id = current_user.luser.id\n fluser = Luser.find(:first, :conditions => {:name => params[:username]})\n @follow.following_luser_id = fluser.id\n \n current = Follow.find(:first, :conditions => {:luser_id => current_user.luser.id, \n :following_luser_id => fluser.id })\n \n respond_to do |format|\n if current != nil\n current.destroy\n format.json { head :no_content }\n elsif @follow.save\n recieving_user = Luser.find(@follow.following_luser_id)\n Notification.add(@follow, nil,\"follow\", recieving_user, current_user.luser)\n LuserMailer.new_follower(User.find(fluser.user_id), current_user.luser).deliver\n format.html { redirect_to @follow, notice: 'You are now following ' + fluser.name }\n format.json { render json: @follow, status: :created, location: @follow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:following_id])\n current_user.follow(@user)\n respond_to do |format|\n format.html {}\n format.js \n end\n end",
"def follow\n\n end",
"def follow!(user)\n\t\tfollowed << user\n\tend",
"def follow!(user)\n\t\tfollowed << user \n\tend",
"def create\n @follow = Follow.new(params[:follow])\n\n respond_to do |format|\n if @follow.save\n @followee = User.find(@follow.followee_id)\n format.js { render :action => '../follows/ajax/follow'}\n else\n format.html { render action: \"new\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow(timeline)\n follow = timeline.follows.find_by_user_id(current_user.id)\n unless follow\n timeline.follows.create(:user_id => current_user.id)\n increase_follow_count(timeline)\n end\n end",
"def CreateFollowing\n myFollowId = params['followingId']\n myFollowRecord = UsersRecord.find_by(\"userid =:userId\",{userId:myFollowId})\n if myFollowRecord\n if Following.where(\"userid= :userId and followingid= :followingId\",{userId:getUserId[0]['userId'],followingId:myFollowId })\n .first_or_create(\n followingid:myFollowId,\n userid:getUserId[0]['userId'],\n users_record_id:getUserId[0]['rec_id']\n )\n following= Following.where(\"userid =:userId\",{userId:getUserId[0]['userId']}).count\n render json: {following:following, message:\"Following\"}, status: :ok\n else\n render json: {status:\"error\", code:422, message:\"Failed to Follow\"}, status: :unprocessable_entity\n end\n else\n render json: {status:\"error\", code:422, message:\"Failed to Follow\"}, status: :unprocessable_entity\n end\n end",
"def follow\n \t\n \t@follow = Follow.new\n \[email protected] = session[:id]\n \[email protected] = params[:aid]\n \tif @follow.save\n\t \t#@follow.update_attribute(:follower, session[:id])\n\t \t#@follow.update_attribute(:followee, params[:aid])\n\t \t@fol_name = Account.find(params[:aid])\n\t \tflash[:success] = \"You are now following\" + @fol_name.first_name + \" \" + @fol_name.last_name + \".\"\n\t \t\n\t \t\n\t \t#if request.xhr?\n\t \t\trender 'accounts/follow'\n \t\t#else\n\t \t#\tredirect_to :controller => :main, :action => :searching\n \t\t#end\n \tend\n \t\n end",
"def follow(user)\n\t self[:following].push(user.id)\n\t\tself.save\n end",
"def follow_params\n params.require(:follow).permit(:user_id, :espace_id)\n end",
"def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end",
"def create\n @follow = Follow.create(follow_params)\n if @follow.save\n flash[:notice] = 'You started following'\n else\n flash[:alert] = 'Error to follow'\n end\n redirect_to users_path\n end",
"def add_to_timeline_new_follower\n Tweet.recent(50, self.following).each do |t|\n Timeline.create(user: user, tweet: t)\n end\n end",
"def create\n @artist = params[:artist_id]\n @artist_name = artist_name(@artist)\n @follower = Follow.create(artist_id: @artist, artist_name: @artist_name, user_id: params[:user_id])\n\n if @follower.save\n flash[:notice] = \"You're now following #{@artist_name}\"\n redirect_to user_path(current_user)\n else\n flash[:error] = \"Failed to follow, please try again.\"\n redirect_to user_path(current_user)\n end\n end",
"def next_follow\n end",
"def follow(other_user)\n active_follows.create(followed_id: other_user.id)\n end",
"def create\n @follower = Follower.new(params[:follower])\n\n respond_to do |format|\n if @follower.save\n format.html { redirect_to @follower, notice: 'Follower was successfully created.' }\n format.json { render json: @follower, status: :created, location: @follower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @follower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag_follow(tag)\n tag_follows.create(tag_id: tag.id)\n end",
"def follow_params\n\t\tparams[:follows]\n\tend",
"def remote_follow(uri)\n perform_request_with_object(:post, '/api/v1/follows', { uri: uri },\n Mastodon::Account)\n end",
"def follow(followed, public: true)\n if followed.is_a? Array\n ids = followed.map(&:id).join(',')\n type = followed.first.type\n else\n ids = followed.id\n type = followed.type\n end\n\n if type == 'playlist'\n request_body = { public: public }\n url = \"users/#{followed.owner.id}/playlists/#{followed.id}/followers\"\n else\n request_body = {}\n url = \"me/following?type=#{type}&ids=#{ids}\"\n end\n\n User.oauth_put(@id, url, request_body.to_json)\n followed\n end",
"def follow_params\n params.require(:follow).permit(:follow_user_id)\n end",
"def user_follow_params\n params.require(:user_follow).permit(:follower_id, :user_followed_id)\n end",
"def follow\r\n \r\n @followu = FollowUser.where(user_id: @u_id)\r\n @followt = FollowThread.where(user_id: @u_id)\r\n end",
"def follow(foo_user)\n active_relationships.create(followed_id: foo_user.id)\n end",
"def follow_params\n params.permit(:requestor, :following)\n end",
"def following_event\n @user = User.find(params[:id])\n @events = @user.following_event.paginate(page: params[:page])\n render 'client_pages/following'\n \tend",
"def update \n # @follow.new(follow_params)\n @user = User.find(session[:user_id])\n @user.follows.build(follower_id: @user.id, followee_id: params[:id])\n redirect_to followees_path\n # needs validation \n end",
"def follow\n id_s = params[:format]\n id = id_s.to_i\n current_user.followed_things_will_change!\n if current_user.followed_things.nil? \n current_user.update_attribute(:followed_things, [id])\n current_user.create_activity :thing_followed, owner: current_user\n else\n unless current_user.followed_things.include? id_s\n current_user.update_attributes(followed_things: current_user.followed_things.push(id))\n #set target type to the object being followed\n current_user.create_activity action: 'thing_followed', owner: current_user, relevant_obj_id: id\n end\n end\n current_user.save\n redirect_to things_path \n end",
"def add_follower(user)\n followers << user\n end",
"def follow_user\n\t\tauthenticate_current_user\n\t\t# add the current user to the user they followed list of followers\n\t\tUser.find(params.user_id).followers.push(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend",
"def follow(user)\n user.add_follower(self)\n self\n end",
"def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end",
"def add_follow(id, opts = {})\n data, status_code, headers = add_follow_with_http_info(id, opts)\n return data\n end",
"def add_follow(id, opts = {})\n data, status_code, headers = add_follow_with_http_info(id, opts)\n return data\n end",
"def add_follow(id, opts = {})\n data, status_code, headers = add_follow_with_http_info(id, opts)\n return data\n end",
"def add_follow(id, opts = {})\n data, status_code, headers = add_follow_with_http_info(id, opts)\n return data\n end",
"def add_follow(id, opts = {})\n data, status_code, headers = add_follow_with_http_info(id, opts)\n return data\n end",
"def add_follow(id, opts = {})\n data, status_code, headers = add_follow_with_http_info(id, opts)\n return data\n end",
"def create\n #debugger\n @resto = Restaurant.find(params[:relationship][:restaurant_id])\n current_user.follow!(@resto)\n #debugger\n #respond_with @resto\n redirect_to @resto\n end"
] | [
"0.7034674",
"0.6816628",
"0.68094337",
"0.67214954",
"0.6706344",
"0.6692911",
"0.6665344",
"0.6626101",
"0.6598047",
"0.6595729",
"0.6555569",
"0.65327495",
"0.65180385",
"0.64423",
"0.6429685",
"0.64273745",
"0.6421967",
"0.64184344",
"0.6400108",
"0.63597816",
"0.6357918",
"0.6351518",
"0.6350048",
"0.63449705",
"0.6336969",
"0.6332232",
"0.6319625",
"0.63071156",
"0.63051033",
"0.6304852",
"0.628257",
"0.6251004",
"0.6245505",
"0.62453586",
"0.62411964",
"0.6239565",
"0.62228537",
"0.62228024",
"0.621026",
"0.6204574",
"0.6200658",
"0.6198199",
"0.6196821",
"0.61930037",
"0.6186185",
"0.61834955",
"0.617866",
"0.6176297",
"0.617261",
"0.617168",
"0.61421084",
"0.61383075",
"0.6136268",
"0.6136246",
"0.6133316",
"0.6133316",
"0.611237",
"0.61095536",
"0.6107691",
"0.60975176",
"0.60855514",
"0.6071991",
"0.60577714",
"0.6049443",
"0.60410523",
"0.6023348",
"0.6019111",
"0.6017982",
"0.60165626",
"0.60139364",
"0.60100067",
"0.60049236",
"0.60044855",
"0.59910154",
"0.59889346",
"0.5984938",
"0.5978138",
"0.5959958",
"0.5946896",
"0.5939225",
"0.59345776",
"0.5922547",
"0.59153557",
"0.59090835",
"0.59088546",
"0.59009635",
"0.5897206",
"0.5887487",
"0.58836293",
"0.58829254",
"0.58752376",
"0.5873292",
"0.5872324",
"0.58723164",
"0.58723164",
"0.58723164",
"0.58723164",
"0.58723164",
"0.58723164",
"0.58713096"
] | 0.6566461 | 10 |
PATCH/PUT /rec_event_follows/1 PATCH/PUT /rec_event_follows/1.json | def update
respond_to do |format|
authorize! :update, @rec_event_follow, :message => 'Not authorized as an administrator.'
if @rec_event_follow.update(rec_event_follow_params)
format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end",
"def set_rec_event_follow\n @rec_event_follow = RecEventFollow.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @follow.update(follow_params)\n format.html { redirect_back fallback_location: root_path, notice: 'Follow was successfully updated.' }\n format.json { render :show, status: :ok, location: @follow }\n else\n format.html { render :edit }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end",
"def update\n respond_to do |format|\n if @follow.update(follow_params)\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { render :show, status: :ok, location: @follow }\n else\n format.html { render :edit }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @follow.update(follow_params)\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { render :show, status: :ok, location: @follow }\n else\n format.html { render :edit }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n if @follow.update_attributes(params[:follow])\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n if @follow.update_attributes(params[:follow])\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @followup = Followup.find(params[:id])\n\n respond_to do |format|\n if @followup.update_attributes(params[:followup])\n format.html { redirect_to @followup, notice: 'Followup was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @followup.update(followup_params)\n format.html { redirect_to @job, notice: 'Follow Up was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting_follow_up.update(meeting_follow_up_params)\n format.html { redirect_to @meeting_follow_up, notice: 'Meeting follow up was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting_follow_up }\n else\n format.html { render :edit }\n format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @follower.update(follower_params)\n head :no_content\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @incidentfollowup.update(incidentfollowup_params)\n format.html { redirect_to @incidentfollowup, notice: 'Incidentfollowup was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentfollowup }\n else\n format.html { render :edit }\n format.json { render json: @incidentfollowup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n if @follower.update_attributes(params[:follower])\n format.html { redirect_to @follower, notice: 'Follower was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @follower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head 404\n # @api_v1_following = Api::V1::Following.find(params[:id])\n\n # if @api_v1_following.update(api_v1_following_params)\n # head :no_content\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end",
"def update\n respond_to do |format|\n if @album_follow.update(album_follow_params)\n format.html { redirect_to @album_follow, notice: 'Album follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album_follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end",
"def update\n @user_follow = UserFollow.find(params[:id])\n\n respond_to do |format|\n if @user_follow.update_attributes(params[:user_follow])\n format.html { redirect_to(@user_follow, :notice => 'User follow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_follow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_event_follower\n @event_follower = EventFollower.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @follow_up_type.update(follow_up_type_params)\n format.html { redirect_to @follow_up_type, notice: 'Follow up type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @follow_up_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lovedone = Lovedone.find(params[:lovedone_id]) \n @follower = @lovedone.followers.find(params[:id]) \n respond_to do |format|\n if @follower.update(follower_params)\n #format.html { redirect_to @follower, notice: 'Follower was successfully updated.' }\n #format.html { redirect_to([@follower.lovedone,@follower]), notice: 'Follower was successfully updated.' }\n #format.html { redirect_to lovedone_followers_url, notice: 'Follower was successfully updated.' }\n #format.html { redirect_to lovedone_followers_url(@lovedone), notice: 'Follower was successfully updated.' }\n format.html { redirect_to lovedone_followers_path(@lovedone), notice: 'Follower has been successfully updated.' }\n \n format.json { render :show, status: :ok, location: @follower }\n else\n format.html { render :edit }\n format.json { render json: @follower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n if @follower.update_attributes(params[:follower])\n format.html { redirect_to(@follower, :notice => 'Follower was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @follower.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n params['facebook'] = {\n :name => params[:event][:name],\n :start_time => get_date_string_from_params(params[:event]['start_time(1i)'],params[:event]['start_time(2i)'],params[:event]['start_time(3i)'],params[:event]['start_time(4i)'],params[:event]['start_time(5i)']),\n :end_time => get_date_string_from_params(params[:event]['end_time(1i)'],params[:event]['end_time(2i)'],params[:event]['end_time(3i)'],params[:event]['end_time(4i)'],params[:event]['end_time(5i)']),\n :description => params[:event][:description],\n :location => params[:event][:location],\n :privacy_type => params[:event][:privacy_type]\n \n \n }\n \t\n @event = Event.find(params[:id])\n\[email protected]_attributes(params[:event])\n\t\n respond_to do |format|\n if @event.valid?\n faceresponse = @graph.put_object(@event.facebookID,'', params['facebook'] )\n if faceresponse == true\n @event.update_attributes(params[:event])\n \n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", notice: 'Error on facebook occure.' }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_follow_tag = UserFollowTag.find(params[:id])\n\n respond_to do |format|\n if @user_follow_tag.update_attributes(params[:user_follow_tag])\n format.html { redirect_to @user_follow_tag, notice: 'User follow tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_follow_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_follower_event(last_follower, follower_event)\n last_follower_event = follower_event\n while last_follower_event&.follower\n last_follower_event.set_follower(nil) unless last_follower_event.follower.is_a?(Game_Event)\n last_follower_event = last_follower_event.follower\n end\n last_follower.set_follower(follower_event) if last_follower.follower != follower_event\n end",
"def update\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n if @user_follow_user.update_attributes(params[:user_follow_user])\n format.html { redirect_to @user_follow_user, notice: 'User follow user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_follow_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @followup_event_input = args[:followup_event_input] if args.key?(:followup_event_input)\n @fulfillment_messages = args[:fulfillment_messages] if args.key?(:fulfillment_messages)\n @fulfillment_text = args[:fulfillment_text] if args.key?(:fulfillment_text)\n @output_contexts = args[:output_contexts] if args.key?(:output_contexts)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n respond_to do |format|\n if @followuptype.update(followuptype_params)\n format.html { redirect_to @followuptype, notice: 'Followuptype was successfully updated.' }\n format.json { render :show, status: :ok, location: @followuptype }\n else\n format.html { render :edit }\n format.json { render json: @followuptype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def rec_event_follow_params\n params.require(:rec_event_follow).permit(:recurring_event_id, :user_id, :send_email, :send_sms)\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n # @follow.new(follow_params)\n @user = User.find(session[:user_id])\n @user.follows.build(follower_id: @user.id, followee_id: params[:id])\n redirect_to followees_path\n # needs validation \n end",
"def update\n @followup_interview = FollowupInterview.find(params[:id])\n @interview = Interview.find(@followup_interview.interview_id)\n\n respond_to do |format|\n if @followup_interview.update_attributes(params[:followup_interview]) && @interview.update_attributes(params[:interview])\n format.html { redirect_to @followup_interview, notice: 'Followup interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @followup_interview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_follower_params\n params.require(:event_follower).permit(:event_id).\n merge!({\"user_id\" => current_user.id, \"created_by\" => current_user.id, \"updated_by\" => current_user.id})\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def update\n @hack_tag_follow = HackTagFollow.find(params[:id])\n\n respond_to do |format|\n if @hack_tag_follow.update_attributes(params[:hack_tag_follow])\n format.html { redirect_to(@hack_tag_follow, :notice => 'Hack tag follow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hack_tag_follow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @followup_intent_name = args[:followup_intent_name] if args.key?(:followup_intent_name)\n @parent_followup_intent_name = args[:parent_followup_intent_name] if args.key?(:parent_followup_intent_name)\n end",
"def update!(**args)\n @followup_intent_name = args[:followup_intent_name] if args.key?(:followup_intent_name)\n @parent_followup_intent_name = args[:parent_followup_intent_name] if args.key?(:parent_followup_intent_name)\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end",
"def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update_follow_up_flag\n redirect_to(root_url) && return unless current_user.can_edit_patient_monitoring_info?\n\n patient = current_user.get_patient(params.permit(:id)[:id])\n redirect_to(root_url) && return if patient.nil?\n\n update_follow_up_flag_fields(patient, params)\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @listen_event.update(listen_event_params)\n format.html { redirect_to recording_listen_event_path(@recording, @listen_event), notice: 'Listen event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listen_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update Fenix::Store::Converter::Flattener.event params[:event]\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updatestatus\n\n # other user\n @relationship = Relationship.find(params[:id])\n status = params[:relationship][:status]\n \n # create relationship\n if current_user.id == @relationship.follower_id \n\n @relationship.status = status\n @relationship.save\n @user = User.find(@relationship.followed_id)\n if status == \"FOLLOWING\" || status == \"REQUEST\"\n @user.update_attributes!(:notify => \"YES\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :tender, :invitation_token, :notify, :privateprofile], :methods => [:photo_url],\n :include => { \n :drinks => { :only => [:id, :name] },\n :workvenues => { :only => [:id, :fs_venue_id, :name] }\n }\n ) \n } }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Goal activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @raffle.update(raffle_params)\n for follower in @raffle.user.followers\n notification = Notification.new()\n notification.content = \"#{@raffle.user.name} just edited the raffle #{@raffle.name}\"\n notification.user_id = follower.id\n notification.raffle_id = @raffle.id\n notification.save\n end\n format.html { redirect_to @raffle, notice: 'Raffle was successfully updated.' }\n format.json { render :show, status: :ok, location: @raffle }\n else\n format.html { render :edit }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @followuptype = Followuptype.find(params[:id])\n respond_to do |format|\n if @followuptype.update(followuptype_params)\n format.html { redirect_to followuptypes_path }\n format.json\n format.js\n else\n format.js\n format.html { render :edit }\n format.json \n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(event_owner_params)\n format.html { redirect_to @event, notice: 'Event successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end",
"def follow\n id_s = params[:format]\n id = id_s.to_i\n current_user.followed_things_will_change!\n if current_user.followed_things.nil? \n current_user.update_attribute(:followed_things, [id])\n current_user.create_activity :thing_followed, owner: current_user\n else\n unless current_user.followed_things.include? id_s\n current_user.update_attributes(followed_things: current_user.followed_things.push(id))\n #set target type to the object being followed\n current_user.create_activity action: 'thing_followed', owner: current_user, relevant_obj_id: id\n end\n end\n current_user.save\n redirect_to things_path \n end",
"def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end",
"def update\n# @event.update_eventbrite_event(event_params)\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event.update(event_params) \n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.mobile { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.mobile { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reader_event.update(reader_event_params)\n format.html { redirect_to @reader_event, notice: 'Reader event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reader_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\r\n @event.update(event_params)\r\n end",
"def update\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n if @myevent.update_attributes(params[:myevent])\n format.html { redirect_to @myevent, notice: 'Myevent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @end_interaction = args[:end_interaction] if args.key?(:end_interaction)\n @followup_event_input = args[:followup_event_input] if args.key?(:followup_event_input)\n @fulfillment_messages = args[:fulfillment_messages] if args.key?(:fulfillment_messages)\n @fulfillment_text = args[:fulfillment_text] if args.key?(:fulfillment_text)\n @output_contexts = args[:output_contexts] if args.key?(:output_contexts)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n if current_user.id == @event.orgn.user.id\n respond_to do |format|\n\n if @event.update(event_params)\n track_activity @event\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to :back, :alert => \"demande invalide\"\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_follow_up_flag_fields(patient, params)\n clear_flag = params.permit(:clear_flag)[:clear_flag]\n history_data = {}\n if clear_flag\n clear_flag_reason = params.permit(:clear_flag_reason)[:clear_flag_reason]\n clear_follow_up_flag(patient, patient.id, clear_flag_reason)\n else\n follow_up_reason = params.permit(:follow_up_reason)[:follow_up_reason]\n follow_up_note = params.permit(:follow_up_note)[:follow_up_note]\n\n # Handle creating history items based on the updates\n history_data = {\n created_by: current_user.email,\n patient: patient,\n initiator_id: patient.id,\n follow_up_reason: follow_up_reason,\n follow_up_note: follow_up_note,\n follow_up_reason_before: patient.follow_up_reason,\n follow_up_note_before: patient.follow_up_note\n }\n\n # Handle success or failure of updating a follow-up flag\n ActiveRecord::Base.transaction do\n # Apply and save updates to the db\n patient.update!(follow_up_reason: follow_up_reason, follow_up_note: follow_up_note)\n # Create history item on successful update\n History.follow_up_flag_edit(history_data)\n end\n end\n\n # Grab the patient IDs of houshold members to also update\n apply_to_household_ids = find_household_ids(patient, params)\n # If not applying to household, return\n return if apply_to_household_ids.empty?\n\n # Update selected group members if applying to household and ids are supplied\n if clear_flag\n apply_to_household_ids.each do |id|\n member = current_user.get_patient(id)\n next if member.nil?\n\n clear_flag_reason = params.permit(:clear_flag_reason)[:clear_flag_reason]\n clear_follow_up_flag(member, patient.id, clear_flag_reason)\n end\n else\n apply_to_household_ids.each do |id|\n member = current_user.get_patient(id)\n next if member.nil?\n\n history_data[:patient] = member\n history_data[:follow_up_reason_before] = member.follow_up_reason\n history_data[:follow_up_note_before] = member.follow_up_note\n\n # Handle success or failure of updating a follow-up flag\n ActiveRecord::Base.transaction do\n # Apply and save updates to the db\n member.update!(follow_up_reason: follow_up_reason, follow_up_note: follow_up_note)\n # Create history item on successful update\n History.follow_up_flag_edit(history_data)\n end\n end\n end\n end",
"def set_meeting_follow_up\n @meeting_follow_up = MeetingFollowUp.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_follow_playlist.update(user_follow_playlist_params)\n format.html { redirect_to @user_follow_playlist, notice: 'User follow playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_follow_playlist }\n else\n format.html { render :edit }\n format.json { render json: @user_follow_playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n follow_exists = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:user_id]).first\n\n if follow_exists.nil?\n # Follower doesn't exists\n @api_v1_follower = Api::V1::Follower.new(api_v1_follower_params)\n @api_v1_follower.follower_id = @current_user.id\n @api_v1_follower.user_id = params[:user_id]\n\n if @api_v1_follower.save\n\n # create new notification\n notification = Api::V1::Notification.new\n notification.user_id = @api_v1_follower.user_id\n notification.event_type = Api::V1::Notification::TYPE_NEW_FOLLOWER\n notification.content = { :event_user_id => @current_user.id, :event_user_name => @current_user.first_name + ' ' + @current_user.last_name, :event_user_avatar => @current_user.formated_avatar }.to_json\n notification.event_object_id = @api_v1_follower.user_id\n notification.save\n\n render json: @api_v1_follower, status: :created, location: @api_v1_follower\n else\n render json: @api_v1_follower.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'already following' }, status: 401\n end\n end",
"def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n $lovedone = nil\n @family_member = User.find(params[:id])\n params = family_member_params\n profile_params = params[:profile_attributes]\n\n profile = Profile.find(@family_member.profile.id)\n params[:profile_attributes][:user_type] = '1'\n\n respond_to do |format|\n if profile.update(profile_params)\n\n # check if lovedone_id is changed now...\n if request.params[:prev_lovedone_id]!=family_member_params_for_lovedone[:lovedones]\n follower = Follower.find_by(user_id: @family_member.id,\n lovedone_id: request.params[:prev_lovedone_id])\n follower.destroy unless follower.nil?\n\n unless family_member_params_for_lovedone[:lovedones].blank?\n follower = Follower.new user_id: @family_member.id, request_status: \"invited\", \n lovedone_id: family_member_params_for_lovedone[:lovedones]\n follower.save\n end\n end\n\n if params.include?(:email)\n @family_member.skip_confirmation!\n @family_member.skip_confirmation_notification!\n @family_member.confirm!\n @family_member.update_attribute(:email, params[:email])\n @family_member.save\n end\n\n\n\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_member }\n else\n format.html { render :edit }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html {redirect_to @event, notice: 'Event was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n manage_player_event(@event)\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @followership = Followership.find(params[:id])\n\n respond_to do |format|\n if @followership.update_attributes(params[:followership])\n flash[:notice] = 'Followership was successfully updated.'\n format.html { redirect_to(@followership) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @followership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { redirect_to @event }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event.update(event_params)\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: \"l'évenement a bien été modifié.\" }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\nend",
"def set_incidentfollowup\n @incidentfollowup = Incidentfollowup.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @whitelist_follower.update(whitelist_follower_params)\n format.html { redirect_to @whitelist_follower, notice: 'Whitelist follower was successfully updated.' }\n format.json { render :show, status: :ok, location: @whitelist_follower }\n else\n format.html { render :edit }\n format.json { render json: @whitelist_follower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def update\n @event_request = EventRequest.find(params[:id])\n\n respond_to do |format|\n if @event_request.update_attributes(params[:event_request])\n format.html { redirect_to @event_request, notice: 'Event request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7493949",
"0.6801311",
"0.6654434",
"0.6632716",
"0.66159564",
"0.66159564",
"0.65949607",
"0.65949607",
"0.6561313",
"0.652599",
"0.6499532",
"0.6421165",
"0.64151657",
"0.6351396",
"0.6244038",
"0.6212301",
"0.61789477",
"0.6178631",
"0.6168319",
"0.61624527",
"0.61277413",
"0.6125469",
"0.6123674",
"0.61193347",
"0.6118144",
"0.611403",
"0.60894686",
"0.6069337",
"0.6069033",
"0.6056656",
"0.6041525",
"0.60380685",
"0.6019558",
"0.601889",
"0.59933156",
"0.59886205",
"0.5978031",
"0.59765136",
"0.5974744",
"0.59736025",
"0.5953697",
"0.5952266",
"0.5932286",
"0.5927969",
"0.59235823",
"0.5922688",
"0.5910393",
"0.5906903",
"0.5906903",
"0.5903234",
"0.5902076",
"0.58730876",
"0.58718616",
"0.58704317",
"0.58699375",
"0.58504593",
"0.5846723",
"0.58223784",
"0.58124256",
"0.5810753",
"0.5809847",
"0.57853884",
"0.57613206",
"0.57504344",
"0.5749825",
"0.5744808",
"0.57423174",
"0.57360303",
"0.57350093",
"0.5730585",
"0.57295614",
"0.5728991",
"0.572775",
"0.5726224",
"0.5725615",
"0.57243896",
"0.5721412",
"0.5721094",
"0.57078904",
"0.57060623",
"0.57025194",
"0.57005894",
"0.5697274",
"0.5694782",
"0.5688337",
"0.5687082",
"0.5677554",
"0.5671605",
"0.5671222",
"0.5668392",
"0.56632453",
"0.5661951",
"0.56595683",
"0.56484056",
"0.5647309",
"0.56466347",
"0.56466347",
"0.564555",
"0.5644061",
"0.5644061"
] | 0.7499513 | 0 |
DELETE /rec_event_follows/1 DELETE /rec_event_follows/1.json | def destroy
authorize! :destroy, @rec_event_follow, :message => 'Not authorized as an administrator.'
@rec_event_follow.destroy
respond_to do |format|
format.html { redirect_to rec_event_follows_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows.delete(@followed)\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def test_stop_following_a_user\r\n # delete \"/follows/destroy.json\", :api_key => 'testapikey',\r\n # :followee_id => 3\r\n # assert_response :success\r\n end",
"def delete_follows\n\n\t@follower = User.find(params[:id])\n\t@followed = User.find(params[:follows_id])\n\n\[email protected](@followed)\n\t\thead :no_content\n\t\t\n\tend",
"def destroy\n @follow = Follow.find(params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to follows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @followup = Followup.find(params[:id])\n @followup.destroy\n\n respond_to do |format|\n format.html { redirect_to followups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n# @event_indicator_relationship = EventIndicatorRelationship.find(params[:id])\n# @event_indicator_relationship.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_custom_view'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_indicator_relationships_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @incidentfollowup.destroy\n respond_to do |format|\n format.html { redirect_to incidentfollowups_url, notice: 'Incidentfollowup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_follower = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:id]).first\n if @api_v1_follower.destroy\n head :no_content\n else \n render json: { error: 'not allowed' }, status: 401\n end\n end",
"def destroy\n @follow.destroy\n respond_to do |format|\n format.html { redirect_to follows_url, notice: 'Follow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follow.destroy\n respond_to do |format|\n format.html { redirect_to follows_url, notice: 'Follow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unfollow\r\n @relationship = Relationship.where(follower_id: current_user.id, followed_id: params[:followed_id]).first\r\n @relationship.create_activity key: 'relationship.unfollow', owner: current_user, recipient: User.find(params[:followed_id]) \r\n @relationship.destroy\r\n render json: { message: \"Relationship destroyed successfully\" }\r\n end",
"def destroy\n @followup.destroy\n respond_to do |format|\n format.html { redirect_to @job, notice: 'Follow Up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n head 404\n # @api_v1_following = Api::V1::Follower.where('following_id =? and user_id =?', @current_user.id, params[:id]).first\n # if @api_v1_following.destroy\n # head :no_content\n # else \n # render json: { error: 'not allowed' }, status: 401\n # end\n end",
"def destroy\n @followup_interview = FollowupInterview.find(params[:id])\n @followup_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to followup_interviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @album_follow.destroy\n respond_to do |format|\n format.html { redirect_to album_follows_url }\n format.json { head :no_content }\n end\n end",
"def unfollow_artist\n relationship_to_delete = Relationship.where(follower_id: params[:follower_id], followed_id: params[:followed_id])\n relationship_to_delete[0].destroy\n relationships = Relationship.where(followed_id: params[:followed_id])\n render json: relationships\n end",
"def destroy\n @follow.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'You have unfollowed this user!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_follow_up.destroy\n respond_to do |format|\n format.html { redirect_to meeting_follow_ups_url, notice: 'Meeting follow up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_follow = UserFollow.find(params[:id])\n @user_follow.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_follows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attend_event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Request successfully rescinded.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n faceresponse = @graph.delete_object(@event.facebookID)\n \n if faceresponse == true\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follower = Follower.find(params[:id])\n @follower.destroy\n\n respond_to do |format|\n format.html { redirect_to followers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follow = Follow.where(:follower_id => session[:user_id], :followee_id => params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are now longer following #{User.find_by_id(params[:id]).username}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_follow_user = UserFollowUser.find(params[:id])\n @user_follow_user.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hack_tag_follow = HackTagFollow.find(params[:id])\n @hack_tag_follow.destroy\n\n respond_to do |format|\n format.html { redirect_to(hack_tag_follows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @follow_up_type.destroy\n respond_to do |format|\n format.html { redirect_to follow_up_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recording_event = RecordingEvent.find(params[:id])\n @recording_event.destroy\n\n respond_to do |format|\n format.html { redirect_to recording_events_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @user_follow_tag = UserFollowTag.find(params[:id])\n @user_follow_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follow = Follow.where(follower_id: current_user.id, followed_id: params[:id]).first\n @follow.destroy\n redirect_to users_path, notice: 'You successfully unfollowed'\n end",
"def destroy\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to event_url(@event) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follow.destroy\n\n\n respond_to do |format|\n #format.html { redirect_to tales_url }\n # format.html { redirect_to profiles_index_path(current_user.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @followuptype.destroy\n respond_to do |format|\n format.html { redirect_to followuptypes_url, notice: 'Followuptype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def del_follow\n current_user.del_follow(@user)\n\n respond_to do |format|\n format.html { redirect_to wall_user_path(@user) }\n format.json { render :json => { user: @user.as_json(:json => 'wall') }}\n end\n end",
"def destroy\n @event = EventPost.find(params[:id])\n @event.destroy\n track_activity @event\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end",
"def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end",
"def destroy\n @photo_event.destroy\n respond_to do |format|\n format.html { redirect_to :back , notice: 'Photo event was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listen_event.destroy\n respond_to do |format|\n format.html { redirect_to recording_listen_events_url(@recording)}\n format.json { head :no_content }\n end\n end",
"def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end",
"def delete_saved_event\n # Get user\n user = AuthorizeApiRequest.call(params).result\n #See if event is saved event for that user, if so remove it \n if (user.saved_events.include?(params[:event]) )\n user.update!(saved_events: user.saved_events-[params[:event].to_s])\n render json: { status: 'success' }, status: :ok\n else\n render json: {\n error: e.to_s\n }, status: :unprocessable_entity\n end\n end",
"def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @follower = @user.follower.find(params[:id])\n @follower.destroy\n head :no_content\n end",
"def destroy\n @user_event = UserEvent.where(event_id: @event.id)\n @event.destroy\n @user_event.destroy\n render json: { head: :no_content }\n end",
"def destroy\n @reader_event.destroy\n respond_to do |format|\n format.html { redirect_to reader_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_account.unfollow(@account)\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_attacment.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Инфформация обновлена' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_follow_location = UserFollowLocation.find(params[:id])\n @user_follow_location.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @talk.destroy\n respond_to do |format|\n format.html { redirect_to event_talks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_log_entry = EventLogEntry.find(params[:id])\n @event_log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to event_log_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.users.clear\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adverse_event.destroy\n respond_to do |format|\n format.html { redirect_to adverse_events_url, notice: 'Evento adverso eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to(:back, notice: 'Wohohh.') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end",
"def delete\n if params[:social_event_type_id]\n socialEventType = SocialEventType.where(id: params[:social_event_type_id]).first\n if socialEventType.delete \n render json: { message: \"deleted successfully.\" } , status: 200\n else \n render json: socialEventType.errors , status: 422\n end\n else\n render json: { message: \"send social event type id.\" } , status: 422 \n end \n end",
"def destroy\n @follower = Follower.find(params[:id])\n @follower.destroy\n\n respond_to do |format|\n format.html { redirect_to(followers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_event = ClientEvent.find(params[:id])\n @client_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @users_event = UsersEvent.find(params[:id])\n @users_event.destroy\n\n respond_to do |format|\n format.html { redirect_to users_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hive_event = HiveEvent.find(params[:id])\n @hive_event.destroy\n\n respond_to do |format|\n format.html { redirect_to hive_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def delete\n # @group_event.destroy\n @group_event = GroupEvent.find params[:id]\n\n @group_event.deleted = true\n @group_event.save!\n\n respond_to do |format|\n format.html { redirect_to group_events_url, notice: 'Group event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usersevent = Usersevent.find(params[:id])\n @usersevent.destroy\n\n respond_to do |format|\n format.html { redirect_to usersevents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html {\n redirect_to :back and return unless request.referrer == events_path(@event)\n redirect_to events_url\n }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @attendance_entry.destroy\n respond_to do |format|\n format.html { redirect_to event_attendance_entries_path(@attendance_entry.event) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follow = Follow.find(params[:id])\n @follow.destroy\n\n respond_to do |format|\n @followee = User.find(@follow.followee_id)\n format.js { render :action => '../follows/ajax/unfollow'}\n end\n end",
"def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @followership = Followership.find(params[:id])\n @followership.destroy\n\n respond_to do |format|\n format.html { redirect_to(followerships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n attendances = Attendance.where(:event_id => @event.id).map { |a| a }\n messages = @event.messages\n logger.info \"Deleting event #{@event.id} and #{attendances.length} attendance records\"\n @event.destroy\n attendances.each { |a| a.destroy }\n messages.each { |m| m.destroy }\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.6938171",
"0.69183445",
"0.6876606",
"0.68600255",
"0.6775278",
"0.67212653",
"0.67173415",
"0.67129",
"0.66898817",
"0.66898817",
"0.6636427",
"0.6579135",
"0.6571831",
"0.6550049",
"0.6535593",
"0.65300465",
"0.6524555",
"0.6487886",
"0.6483768",
"0.6482289",
"0.647621",
"0.6475095",
"0.64653313",
"0.64555985",
"0.6437098",
"0.6435355",
"0.6420042",
"0.6417986",
"0.6416411",
"0.64078623",
"0.63945216",
"0.639182",
"0.6391598",
"0.6391511",
"0.63908714",
"0.6388518",
"0.63795525",
"0.63795525",
"0.63795525",
"0.63733906",
"0.63725966",
"0.6371737",
"0.6369767",
"0.6350846",
"0.6347429",
"0.63426536",
"0.6342389",
"0.6342254",
"0.63257295",
"0.63026536",
"0.6291912",
"0.62840664",
"0.62746024",
"0.6272124",
"0.6262108",
"0.62591964",
"0.62555325",
"0.62545",
"0.62534857",
"0.6252344",
"0.6244928",
"0.6243997",
"0.62412405",
"0.62408394",
"0.62395215",
"0.62302464",
"0.6228906",
"0.6228805",
"0.62266815",
"0.6222736",
"0.62134534",
"0.6211564",
"0.62108773",
"0.62031144",
"0.62021095",
"0.62021095",
"0.6201836",
"0.6201163",
"0.61972374",
"0.6191829",
"0.6186608",
"0.61839384",
"0.6182876",
"0.61793905",
"0.6175534",
"0.6171029",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61701804",
"0.61673903",
"0.6163182",
"0.6160966"
] | 0.75690764 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_rec_event_follow
@rec_event_follow = RecEventFollow.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def 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 revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def 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 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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\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",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def _handle_action_missing(*args); end"
] | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865",
"0.53135896",
"0.52999926",
"0.5297309",
"0.5296569",
"0.5261449",
"0.5247048",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52323204",
"0.52310973",
"0.523081",
"0.5225785",
"0.5219039",
"0.52136266",
"0.5208033",
"0.520763",
"0.5177365",
"0.5175224",
"0.5173357",
"0.5166104",
"0.5162502",
"0.51573396",
"0.5154547",
"0.5153531",
"0.51502854",
"0.51436496",
"0.5142863",
"0.51330835",
"0.5115634",
"0.5115634",
"0.511527",
"0.5109693",
"0.51076853",
"0.5093146",
"0.5090683",
"0.50829846",
"0.50819314",
"0.50670373",
"0.5055505",
"0.5053398",
"0.50504035",
"0.50504035",
"0.5037765",
"0.5027292",
"0.5024484",
"0.50150335",
"0.5014069",
"0.50022113",
"0.5001542",
"0.49981874",
"0.49915564",
"0.49915564",
"0.49880967",
"0.4982312",
"0.49787375",
"0.49786067",
"0.49687737",
"0.49676532",
"0.49602765",
"0.49565676",
"0.49550772",
"0.495342",
"0.49522525",
"0.49463704",
"0.49447197",
"0.49362713",
"0.49328062",
"0.49280638",
"0.49272856",
"0.4927058",
"0.49221697",
"0.4919526",
"0.49185994",
"0.49184805",
"0.49170163",
"0.49168405",
"0.49167764"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def rec_event_follow_params
params.require(:rec_event_follow).permit(:recurring_event_id, :user_id, :send_email, :send_sms)
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 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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 url_params\n params[:url].permit(:full)\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 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.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894",
"0.6289475",
"0.62831545",
"0.6242381",
"0.6240358",
"0.6217451",
"0.6214354",
"0.62098235",
"0.61918235",
"0.6177287",
"0.61755854",
"0.61712915",
"0.61620486",
"0.6151379",
"0.61510575",
"0.6145169",
"0.61207956",
"0.6115647",
"0.6107701",
"0.61030304",
"0.60909295",
"0.60797",
"0.60701567",
"0.6062068",
"0.60203075",
"0.60167485",
"0.60125494",
"0.6009718",
"0.6007027",
"0.6007027",
"0.6000283",
"0.59990394",
"0.5996995",
"0.59915864",
"0.59914654",
"0.59912056",
"0.5979621",
"0.596686",
"0.5959418",
"0.59585625",
"0.59583765",
"0.5958032",
"0.5952298",
"0.5951678",
"0.5941885",
"0.59378815",
"0.59376645",
"0.59376645",
"0.5933908",
"0.59302104",
"0.5924862",
"0.5923981",
"0.59165645",
"0.5909916",
"0.590986",
"0.5908378",
"0.5904956",
"0.5897421",
"0.58970135",
"0.5894611",
"0.5893914",
"0.58927566",
"0.5891277",
"0.5885355",
"0.58825094",
"0.58783555",
"0.58728755",
"0.58686864",
"0.5867015",
"0.58660764",
"0.58659357",
"0.5864526",
"0.58634263",
"0.5861585",
"0.5861255",
"0.5858771",
"0.58579147",
"0.5854071",
"0.5853147",
"0.58498794",
"0.58492327"
] | 0.0 | -1 |
How long since a host said it was alive | def initialize(my_name, shared_path)
@my_name = my_name
@shared_path = shared_path
FileUtils.mkdir_p(@shared_path) unless File.directory?(@shared_path)
@my_file = "#{@shared_path}/#{@my_name}.txt"
@nominated_hosts = []
@active_hosts = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_alive_time; end",
"def alive?\n expires_on > Time.now\n end",
"def idle_time\n return 0 unless alive?\n return Time.now - ts\n end",
"def uptime\n Time.now - live_since\n end",
"def keep_alive_time=(_arg0); end",
"def getAge(host, refTime = nil)\n if refTime == nil then\n refTime = Time.now\n end\n return ((refTime - self.query(host)['created_on'])/ (60*60*24)).round\n end",
"def keep_alive\n alive? && update(expires_on: TTL.from_now)\n end",
"def alive?; @keepalive; end",
"def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return false\n end",
"def age\n Time.now - @received\n end",
"def keepalive_timeout?\n @keepalive_count ||= 0\n @keepalive_count += 1\n @keepalive_count > 10\n end",
"def keepalive_timeout?\n @keepalive_count ||= 0\n @keepalive_count += 1\n @keepalive_count > 10\n end",
"def heartbeat_timeout\n data.heartbeat_timeout\n end",
"def uptime\n\t\treturn Time.now - self.start_time\n\tend",
"def get_session_age\n return Time.now.to_i - session.last_checkin.to_i\n end",
"def outdated?\n Time.now - @last_used > MAX_CONN_AGE\n end",
"def age\n Time.now - startup_time\n end",
"def uptime\n @started ? (Time.now - @started).to_i : 0\n end",
"def lease_time\n return (0.667 * @ttl).to_i\n end",
"def alive?() end",
"def uptime\n Time.now - @start_time\n end",
"def ping\n\t\tresult = `ping -c 1 #{ip_address}`\n\t\t# Now extract the time that it took for the ping to come back\n\t\tresult = result.split(\"time=\").last.split(\" \").first\n\t\treturn result\n\tend",
"def get_response_time(uri)\n t0 = Time.now\n res = Net::HTTP.get_response(uri)\n\n Time.now - t0\nend",
"def alive?; @alive end",
"def ttl_duration\n 900\n end",
"def is_stale?\n remaining() > @lifetime\n end",
"def ttl; Qpid::Messaging::Duration.new @message_impl.getTtl.getMilliseconds; end",
"def alive?\n return true if ws && ts\n return false\n end",
"def alive_longer_than(sec)\n filter {|process| process.seconds_alive > sec}\n end",
"def is_alive\n @state == ALIVE\n end",
"def heartbeat_timeout; Float::INFINITY; end",
"def uptime\n Sys::Uptime.uptime\n end",
"def time_remaining\n end",
"def keep_alive; end",
"def keep_alive; end",
"def keep_alive\n @agent.keep_alive\n end",
"def ping_time\n Time.zone.at(@packet.created_at.to_i + @device.interval_in_seconds.to_i)\n end",
"def last_alive\n MiGA::Daemon.last_alive project\n end",
"def ping\n exit unless status[1].to_i > 4*60 # only display if more than 5 minutes have passed\n exit if File.exists?(Path + \"/noremind\")\n\n fmt = format_status\n today = daily_tot_current_cat\n\n growl(fmt, today) if fmt.size > 0 && status[1] >> 4\nend",
"def ping\n @ping = Time.now\n end",
"def uptime\n @uptime ||= down? ? nil : Time.now - started_at\n end",
"def remaining\n (Time.now - @last_scrape).to_i \n end",
"def seconds_since_seen\n Time.now - (last_seen || Time.at(0))\n end",
"def time_remaining\n\n end",
"def seconds_idle # :nodoc:\n return 0 if in_use?\n Concurrent.monotonic_time - @idle_since\n end",
"def alive?\n\t\tconnection.alive?\n\tend",
"def alive?\n\t\tconnection.alive?\n\tend",
"def idletime\n @executor.getKeepAliveTime(java.util.concurrent.TimeUnit::SECONDS)\n end",
"def ttl\n max_age - age if max_age\n end",
"def alive?\n\t\ttrue\n\tend",
"def alive?\n\t\ttrue\n\tend",
"def alive?\n @alive\n end",
"def is_alive\n @health > 0\n end",
"def is_alive\n @health > 0\n end",
"def message_end_of_life\n @created + @ttl + @grace\n end",
"def ping\n t = Time.now\n @response = Net::HTTP.get_response(uri)\n rescue Errno::ECONNREFUSED\n rescue Exception => e\n STDERR.puts \"Error fetching #{@url}: #{e}\"\n ensure\n @time = Time.now-t\n @response\n end",
"def ping\n self.last_ping = Time.now\n end",
"def alive?(ip)\n\n ping = \"ping -q -c 1 -w 4\"\n result = `#{ping} #{ip}`\n return $?.exitstatus == 0\n\n end",
"def time_left\n @lifetime - @elapsed_time\n end",
"def getServerTime()\r\n\t\t# get the time now\r\n\t\ttime = Time.now.to_i\r\n\t\ttime\r\n\tend",
"def keep_alive?; end",
"def keep_alive?; end",
"def expired?\n age > ttl\n end",
"def expired?\n age > ttl\n end",
"def ping ip\n ping_result = `ping -c 1 #{ip}`\n if ping_result =~ /( | 0.)0% packet loss/\n ping_result.match(/time=([\\.\\d]*) ms/)[1].to_f.round(1)\n end\n end",
"def server_timing; end",
"def is_alive(opts = {})\n data, _status_code, _headers = is_alive_with_http_info(opts)\n data\n end",
"def is_alive(opts = {})\n data, _status_code, _headers = is_alive_with_http_info(opts)\n data\n end",
"def seconds_idle # :nodoc:\n return 0 if in_use?\n Process.clock_gettime(Process::CLOCK_MONOTONIC) - @idle_since\n end",
"def ifHostUp(host)\n Net::Ping::TCP.econnrefused = true\n Net::Ping::TCP.new(host).ping?\n end",
"def is_alive;\t@alive \t\tend",
"def lifetime\n if running?\n Time.now - start_time\n elsif finished?\n end_time - start_time\n end\n end",
"def lifetime\n if running?\n Time.now - start_time\n elsif finished?\n end_time - start_time\n end\n end",
"def expired?\n Time.now - @created_time > @ttl\n end",
"def alive?\n cur_health > 0\n end",
"def uptime\n return (Time.now.to_i.to_f - booted_at.to_f) rescue 0.0\n end",
"def ping()\n Timer.renew(@name, @timeout)\n end",
"def is_alive?\n\t\treturn @alive\n\tend",
"def tunnel_timeout?\n Time.now - @last_packet_time > client.tunnel_timeout\n end",
"def uptime\n rpc(:uptime, _access: :seconds, _coerce: Hash)\n end",
"def heartbeat\n not_found if be_attacking?\n \n @host.ip = request.remote_ip\n @host.updated_at = Time.now.to_time\n\n @ret = (@host.token == params[:token] && @host.save) ? @host.ip : 'false'\n end",
"def event_timer\n if @connection.comm.connected? and Time.now - @var[:last_ping] >= 60\n begin\n _server_control(\"keepalive\")\n rescue\n _notice(\"The connection to the server has been lost\", :global)\n @connection.disconnect\n end\n end\nend",
"def lifetime\n\t\t\t\tClock.runtime() - @start\n\t\t\tend",
"def response_time\n @response_time\n end",
"def persistent_timeout(seconds); end",
"def uptime\n LOG_STAT()\n id = id_gen()\n LOG_CALL(id, true, __method__)\n defer { LOG_CALL(id, false, 'uptime') }\n return fmt_time(Time.now.to_i - STARTUP_TIME)\n end",
"def duration_since_received\n last_received_at && ((Time.now.to_f - last_received_at) * 1000)\n end",
"def nsec\n 0\n end",
"def reachable?\n !@unreachable_since\n end",
"def fresh?\n ttl && ttl > 0\n end",
"def seconds_since_last\n last.blank? ? 0 : (timestamp_server - last.timestamp_server)\n end",
"def time_remaining( address )\n address = encode( address )\n get(\"/timeremaining/#{address}\")\n end",
"def stat\n @protocol ? @protocol.statistics_command : 'MySQL server has gone away'\n end",
"def http_timeout; end",
"def keep_alive?\n @keep_alive\n end",
"def uptime\n @root.attributes[\"c\"].to_i\n end",
"def server_ready_timeout\n Zartan::Config.new['server_ready_timeout'].to_i\n end",
"def timeout\n datastore['TIMEOUT']\n end",
"def age\n ((Time.now - self.started_at)/(3600*24)).to_i\n end",
"def alive?\n @lives != 0\n end",
"def alive?\n @hp > 0\n end"
] | [
"0.74838763",
"0.69762605",
"0.6906107",
"0.69060796",
"0.6855067",
"0.65225625",
"0.6509905",
"0.64930403",
"0.64682066",
"0.6387569",
"0.62504506",
"0.62404644",
"0.6237468",
"0.61483544",
"0.6145397",
"0.6136309",
"0.6107158",
"0.6095115",
"0.60814804",
"0.6032994",
"0.6025861",
"0.6023569",
"0.6001012",
"0.5978456",
"0.5965742",
"0.59570026",
"0.5955306",
"0.5952343",
"0.59478796",
"0.59435743",
"0.5938309",
"0.59281325",
"0.5908597",
"0.59023154",
"0.59023154",
"0.5898545",
"0.5898399",
"0.58923435",
"0.58801615",
"0.58753556",
"0.5874506",
"0.58704853",
"0.5869651",
"0.58473796",
"0.5840457",
"0.5836883",
"0.5836883",
"0.5832079",
"0.5831448",
"0.58202994",
"0.58202994",
"0.579797",
"0.5791248",
"0.5791248",
"0.5786126",
"0.5766873",
"0.57629406",
"0.5761594",
"0.57495904",
"0.57342553",
"0.57327133",
"0.57327133",
"0.5728385",
"0.5728385",
"0.57234544",
"0.571653",
"0.5715915",
"0.5715915",
"0.571195",
"0.57086164",
"0.5704013",
"0.5683168",
"0.5683168",
"0.56788063",
"0.5658426",
"0.5655282",
"0.5653316",
"0.56508607",
"0.5649585",
"0.5649113",
"0.5648156",
"0.56440383",
"0.56440043",
"0.5636423",
"0.5631647",
"0.5630256",
"0.5624239",
"0.56211114",
"0.5614718",
"0.56135553",
"0.5606604",
"0.5606226",
"0.5603857",
"0.5602086",
"0.5598536",
"0.55910474",
"0.5589564",
"0.5587113",
"0.5584391",
"0.5582673",
"0.55774575"
] | 0.0 | -1 |
GET /contact_requests/1 GET /contact_requests/1.json | def show
@contact_request = ContactRequest.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @contact_request }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end",
"def show\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @requests\n end",
"def new\n @contact_request = ContactRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def create\n @contact = current_user.contacts.find(params[:contact_id])\n @request = Request.new(params[:request])\n @request.contact = @contact\n @request.user = current_user\n\n respond_with @request do |format|\n if @request.save\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.created')) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end",
"def contact\n response[\"contact\"]\n end",
"def lookup\n respond_to do |format|\n format.json { render json: Crm::ContactLookup.new(view_context) }\n end\n end",
"def update\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @request do |format|\n if @request.update_attributes(params[:request])\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.updated')) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n render json: @contact\n end",
"def show\n render json: @contact\n end",
"def show\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n render json: @contact.address\n end",
"def _index_list\n\t\t\tper = 12\n\n\t\t\tparams[:page] ||= 1\n\t\t\tparams[:page] = params[:page].to_i\n\n\t\t\tcontacts = ContactRequest.need_contact\n\n\t\t\tcount = contacts.count\n\n\t\t\treturn render json: { status: 1 } if count == 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'contact_requests/index_list', locals: { contacts: contacts.page(params[:page], per) }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\n\t\t\t\t}\n\t\t\t}\n\t\tend",
"def new\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.build\n @request.deadline = Date.today\n\n respond_with @request\n end",
"def show\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def show\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def show\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request_call }\n end\n end",
"def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def show\n render json: @referral_contact\n end",
"def index\n @contacts = Contact.all\n render json: @contacts\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n end\n end",
"def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end",
"def index\n @phone_requests = PhoneRequest.all\n end",
"def show\n @projectcontact = Projectcontact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectcontact }\n end\n end",
"def index\n @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end",
"def show\n contact_shard = Facebase::Contact.shard_for(params[:id])\n @contact = contact_shard.where(\"profile_id = ? \", params[:id]).includes(:profile, :events, :emails).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def contact(contact, options = {})\n get(\"contacts/#{contact}\", options).pop\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def destroy\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n @request.destroy\n @requests = @contact.requests.last_requests\n\n respond_with @request do |format|\n format.html { redirect_to(contact_requests_path) }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end",
"def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end",
"def show\n @site_contact = SiteContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_contact }\n end\n end",
"def show\n @contactaction = Contactaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_sync_hash }\n format.xml { render :xml => @client_contact_sync_hash }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n render :json => { :success => true, :message => \"Show Contacts\", :contact => @contact }\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @contact }\n # end\n end",
"def show\n @contact_action = ContactAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_action }\n end\n end",
"def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end",
"def show\n @breadcrumb = 'read'\n @corp_contact = CorpContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contactable = find_contactable\n @contacto = @contactable.contactos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @contacto }\n end\n end",
"def show\n @traded_contact = TradedContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traded_contact }\n end\n end",
"def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end",
"def friend_requests\n get(\"users/requests\").requests\n end",
"def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @request_calls = RequestCall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_calls }\n end\n end",
"def show\n @request = Request.find(params[:id])\n\n render json: @request\n end",
"def get_contact\r\n @contact = @customer.contact_people.find_by_name params[:id]\r\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end",
"def contacts\n\t #begin\n\t autopilot_contact = params[\"contact\"]\n\t autopilot_event = params[\"event\"]\n\t if autopilot_contact.has_key?(\"Company\") && autopilot_contact[\"Company\"] != \"\"\n company_id = get_freshdesk_company_id(autopilot_contact[\"Company\"])\n #Rails.logger.debug \"comp id==>#{company_id}\"\n autopilot_contact[\"Company\"] = company_id \n end\n @freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n @freshdesk_data[\"company_id\"] = autopilot_contact[\"Company\"] unless autopilot_contact[\"Company\"] == \"\"\n\n\t #@freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n\t get_custom_fields(autopilot_contact)\n\t if autopilot_event == \"contact_added\"\n\t \t response = contact_added(@freshdesk_data)\n\t elsif autopilot_event == \"contact_updated\"\n\t\t #Rails.logger.info \"Update response from autopilotttttttttttttttttt\"\n\t response = contact_updated(@freshdesk_data, @freshdesk_contact_id)\n\t\t #Rails.logger.debug \"#{response}\"\t\t\n\t end \n\t response.parsed_response.has_key?(\"errors\") ? failure_response(response) : success_response\n\t #rescue Exception => e\n\t #\tputs e.message\n\t #end\n\tend",
"def index\n @user_contacts = UserContact.all\n render :json => user_contact_data(@user_contacts)\n end",
"def show\n @contact_log = ContactLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_log }\n end\n end",
"def new\n @contactinfo = Contactinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def request_contacts\n\t\tname = params[:name]\t\t\t\t\t\t\t\n\t\temail = params[:email]\n\t\ttelephone = params[:telephone]\n\t\tmessage = params[:message]\n\t\tif email.blank?\n\t\tflash[:alert] = I18n.t('request_contacts.no_email')\n\t\telse\n\t\t\tContactMailer.contact_email(email, name, telephone, message).deliver_now\n\t\t# Send an email\n\t\tflash[:notice] = I18n.t('request_contacts.email_sent')\n\t\tend\n\t\tredirect_to root_path\n\n\n\tend",
"def destroy\n @contact_request = ContactRequest.find(params[:id])\n @contact_request.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_requests_url }\n format.json { head :ok }\n end\n end",
"def index\n @referral_contacts = @user.referralContact.page(params[:page]).per(params[:per])\n\n render json: @referral_contacts\n end",
"def new\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def create\n @contact_request = ContactRequest.new(params[:contact_request])\n\n respond_to do |format|\n if @contact_request.save\n ContactRequestMailer.contact_request_submitted(@contact_request).deliver\n format.html { redirect_to new_contact_request_path, notice: 'Contact request was successfully submitted.' }\n format.json { render json: @contact_request, status: :created, location: @contact_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @registration_requests = RegistrationRequest.all\n\n render json: @registration_requests\n end",
"def get_contact(contact_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ContactName'] = contact_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/contacts/[ContactName]'\n\t\targs[:query]['Action'] = 'GetContact'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def fetch id=nil\n id ||= self.id\n resp = @nimble.get \"contact/#{id}\"\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end",
"def new\n @contact = current_user.contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end",
"def show\n @contact_partner = ContactPartner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_partner }\n end\n end",
"def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end",
"def update\n @contact_request = ContactRequest.find(params[:id])\n\n respond_to do |format|\n if @contact_request.update_attributes(params[:contact_request])\n format.html { redirect_to @contact_request, notice: 'Contact request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @contact_group\n end",
"def contact\n @text_messages = TextMessage.find_all_by_contact(params[:contact]).order(@order).paginate(@page)\n @contact = params[:contact]\n\n respond_to do |format|\n format.html # contact.html.erb\n format.json { render json: @text_messages, callback: params[:callback] }\n format.xml { render xml: @text_messages }\n end\n end",
"def new\n @crm_contact = CrmContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact }\n end\n end",
"def index\n requests = Request.where(status: 0)\n if requests\n render json: requests, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n }\n },\n status: :ok\n else\n render status: :unprocessable_entity\n end\n end",
"def new\n @contact = Contact.new\n @contact.user = current_user\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n \n \n end\n end",
"def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def _requests_manage_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\trequests = ContactRequest.project_contact.need_contact\r\n\r\n\t\t\tpage = params[:page] || 1\r\n\t\t\tper = 20\r\n\t\t\tcount = requests.count\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'requests_manage_list', locals: { requests: requests.page(page, per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: page })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend",
"def show\n @contact = Contact.find(params[:id])\n \n respond_to do |format|\n format.html { render :layout => 'semi_static_dashboards' }\n format.json { render :json => @contact }\n end\n end",
"def new\n @crm_contact_info = CrmContactInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def show\n render json: @contact if stale? @contact\n end",
"def search_contacts_with_http_info(contact, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.search_contacts ...'\n end\n # verify the required parameter 'contact' is set\n if @api_client.config.client_side_validation && contact.nil?\n fail ArgumentError, \"Missing the required parameter 'contact' when calling ContactsApi.search_contacts\"\n end\n allowable_values = [\"email\", \"cellphone\", \"phone\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/contacts/search'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'contact'] = contact\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SearchContacts200Response'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.search_contacts\",\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: ContactsApi#search_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n # Hubspot::Contact.create!(\"[email protected]\", {firstname: \"Test\", lastname: \"Contact\"})\n lists = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts \"HHHHHHHHHHH\"\n listp = lists.first.last.select { |list| list[\"name\"] == \"New Test List\"}\n listp = listp.first\n puts listp[\"name\"]\n puts \"FFFFFFFFFFFFFFF\"\n contact_list = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists/#{listp['listId'].to_i}/contacts/all?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts contact_list[\"contacts\"].first[\"properties\"][\"firstname\"][\"value\"]\n puts \"LLLLLLLLLLLLLL\"\n puts listp\n @enquiries = Enquiry.all\n end",
"def index\n respond_with Contact.all\n end",
"def show\n contact = {}\n contact[:id] = @contact.id\n contact[:name] = @contact.name\n contact[:phone_number] = @contact.phone_number\n contact[:group_id] = @contact.group_id\n contact[:in_a_group] = [email protected]_id.nil?\n contact[:contact_type] = @contact.contact_type\n contact[:estate_name] = ([email protected]_id.nil?? Estate.find(@contact.estate_id).estate_name : nil)\n contact[:estate_number] = @contact.estate_number\n contact[:photo] = \"#{ENV['ROOT_URL']}#{@contact.photo.url}\"\n contact[:member_since] = \"#{@contact.created_at.strftime(\"%d/%m/%Y\")} #{@contact.created_at.strftime(\"%I:%M%p\")}\"\n\n render json: contact\n end",
"def new\n @projectcontact = Projectcontact.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectcontact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def index\n @client_contacts = ClientContact.paginate(:page => params[:offset], :per_page => 20)\n\n client_contacts_hash()\n respond_to do |format|\n format.html\n format.json { render :json => @client_contacts_hash }\n format.xml { render :xml => @client_contacts_hash }\n end\n end",
"def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def index\n @requests = Request.authorize_requests_for current_user.id\n respond_to do |format|\n format.html { }\n format.json { render :json => @requests}\n format.xml { render :xml => @requests.to_xml}\n end\n end",
"def new\n @contactaction = Contactaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend",
"def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(params)\n parse_contacts response_body(response)\n end",
"def index\n @contacts = @client.contacts\n end",
"def show\n render json: Group.find(params[:id]).contacts\n end"
] | [
"0.74935263",
"0.7283026",
"0.686412",
"0.67566",
"0.6415807",
"0.63845825",
"0.62854654",
"0.6244459",
"0.6193241",
"0.6193241",
"0.6193241",
"0.6145869",
"0.6145869",
"0.61389667",
"0.6122961",
"0.60988915",
"0.6089211",
"0.60832804",
"0.6076538",
"0.60753036",
"0.6069796",
"0.6057012",
"0.6033746",
"0.6021746",
"0.6021743",
"0.5999079",
"0.59929067",
"0.59906083",
"0.5985356",
"0.59827334",
"0.59806156",
"0.5941969",
"0.5938708",
"0.59377354",
"0.59356886",
"0.589455",
"0.58832633",
"0.58781123",
"0.58723336",
"0.58723336",
"0.58618087",
"0.5860869",
"0.58440346",
"0.5840216",
"0.5836291",
"0.5836291",
"0.5836291",
"0.583211",
"0.5825826",
"0.5822352",
"0.58212507",
"0.5817188",
"0.5808628",
"0.57998353",
"0.57993084",
"0.5792754",
"0.5779145",
"0.5764581",
"0.5750891",
"0.57502395",
"0.57442087",
"0.57412475",
"0.57286215",
"0.57262594",
"0.57259774",
"0.5722243",
"0.5714333",
"0.5710426",
"0.57083577",
"0.57069457",
"0.56988996",
"0.56983656",
"0.567887",
"0.56755495",
"0.5672141",
"0.56712914",
"0.56609744",
"0.56493145",
"0.56467944",
"0.56459093",
"0.56420344",
"0.5638847",
"0.56382436",
"0.563803",
"0.56324434",
"0.5632257",
"0.56246746",
"0.56218004",
"0.56203616",
"0.56154853",
"0.56111395",
"0.56111395",
"0.56111395",
"0.56111395",
"0.56103015",
"0.56079406",
"0.56037855",
"0.5603344",
"0.5593947",
"0.559379"
] | 0.7409002 | 1 |
GET /contact_requests/new GET /contact_requests/new.json | def new
@contact_request = ContactRequest.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contact_request }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @contact = current_user.contacts.find(params[:contact_id])\n @request = Request.new(params[:request])\n @request.contact = @contact\n @request.user = current_user\n\n respond_with @request do |format|\n if @request.save\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.created')) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.build\n @request.deadline = Date.today\n\n respond_with @request\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @request = @skill.requests.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @contactinfo = Contactinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def new\n @contact = current_user.contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @projectcontact = Projectcontact.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectcontact }\n end\n end",
"def new\n @contact_message = ContactMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_message }\n end\n end",
"def new\n @crm_contact_info = CrmContactInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def new\n @crm_contact = CrmContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact }\n end\n end",
"def new\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def new\n @contactaction = Contactaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def new\n @site_contact = SiteContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_contact }\n end\n end",
"def new\n @contact = Contact.new(:client => @firm, :current_date => Time.now, :next_date => 7.days.from_now.to_date)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def create\n @contact_request = ContactRequest.new(params[:contact_request])\n\n respond_to do |format|\n if @contact_request.save\n ContactRequestMailer.contact_request_submitted(@contact_request).deliver\n format.html { redirect_to new_contact_request_path, notice: 'Contact request was successfully submitted.' }\n format.json { render json: @contact_request, status: :created, location: @contact_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @contact_action = ContactAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_action }\n end\n end",
"def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n fresh_when(@contact)\n render json: @contact, status: :created, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def new\n @contact = contacts.new\n end",
"def new\n @request_call = RequestCall.new\n\n respond_to do |format|\n format.html { render :layout => false }# new.html.erb\n format.json { render json: @request_call }\n end\n end",
"def new\n @traded_contact = TradedContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traded_contact }\n end\n end",
"def new\n #@contact = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n format.js\n end\n end",
"def new\n @contact = Contact.new(:state_id => 5, :country_id => 226)\n @contact.numbers.build\n @contact.occasions.build\n @contact.presences.build\n @contact.build_support_state\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end",
"def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end",
"def new\n @contact_partner = ContactPartner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_partner }\n end\n end",
"def new\r\n @contact_rule = ContactRule.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end",
"def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end",
"def new\n @contact = Contact.new\n @contact.user = current_user\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n \n \n end\n end",
"def new\n @friendrequest = Friendrequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendrequest }\n end\n end",
"def new\n @request_status = RequestStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_status }\n end\n end",
"def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end",
"def new\n @group_request = GroupRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group_request }\n end\n end",
"def new\n @contact = Contact.new\n end",
"def new\n @contact = Contact.new\n end",
"def create\n @contact = Contact.new(contact_params)\n @contact.sender = current_user.pseudo\n @contact.state = \"new\"\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to session[:previous_request_url], notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @contact_number = ContactNumber.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact_number }\n end\n end",
"def new\n @prayer_request = PrayerRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prayer_request }\n end\n end",
"def new\n @prayer_request = PrayerRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prayer_request }\n end\n end",
"def new_contact\n @contact=Contact.new()\n end",
"def new\n if params[:member].present? && params[:member].respond_to?(:to_i) # prefill new form with member's data\n if @member = Member.find(params[:member])\n @contact = Contact.new( company: @member.company,\n country: @member.country,\n address: @member.address,\n city: @member.city,\n postal_code: @member.postal_code,\n is_ceres_member: true,\n )\n tag_list = @member.activity_list + @member.brand_list\n tag_list << \"member\"\n @contact.tag_list = tag_list.join(',')\n end\n end\n @contact ||= Contact.new\n @contact.emails.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n format.js { render template: 'contacts/new' }\n end\n # { render partial: \"new\" }\n end",
"def new\n @request = Request.new\n @states = State.all()\n @request.requestor = Requestor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @request }\n end\n end",
"def new\n @breadcrumb = 'create'\n @corp_contact = CorpContact.new\n $attachment = Attachment.new\n destroy_attachment\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corp_contact }\n end\n end",
"def new\n @mailing = Mailing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailing }\n end\n end",
"def new\n @ucontact = Ucontact.new\n \n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @ucontact }\n format.json { render :json => @ucontact }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n params[:ur_contact].delete(:id)\n newContact = current_user.ur_contacts.new(contact_params)\n\n if newContact.save then\n render json: newContact\n else\n Rails.logger.info \"Error when creating contacts #{newContact.errors.messages}\"\n head :internal_server_error\n return\n end\n end",
"def new\n @requesttomentor = Requesttomentor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requesttomentor }\n end\n end",
"def new\n @ad_contact = AdContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ad_contact }\n end\n end",
"def new\n @subscription_request = SubscriptionRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscription_request }\n end\n end",
"def new\n @contact = Contact.new\n if not params[:client].nil?\n @client = Client.new JSON.parse(params[:client])\n @contact.clientId = @client._id\n @contact.name = @client.nome\n @contact.email = @client.email\n @contact.phone = @client.telefone\n @contact.address = @client.endereco\n @contact.client_type = @client.client_type\n @contact.institution = @client.instituicao\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @create_request_skill = CreateRequestSkill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_request_skill }\n end\n end",
"def new\n @email_submission = EmailSubmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_submission }\n end\n end",
"def new\n @my_prayer_request = PrayerRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_prayer_request }\n end\n end",
"def new\n @contact = Contact.new\n if params[:registration].present?\n @registration = true\n @reason = params[:reason]\n else\n @tag, @seo = Seo.contact(params[:tag_id], I18n.locale.to_s)\n end\n @contact.agreements << Agreement.where(:display => true).locale(I18n.locale.to_s)\n \n respond_to do |format|\n if @registration\n format.html { render 'registration' }\n format.json { render :json => @contact }\n else\n format.html # new.html.erb\n format.json { render :json => @contact }\n end\n end\n end",
"def new\n @course_request = CourseRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_request }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @call }\n end\n end",
"def new\n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @call }\n end\n end",
"def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n render json: @contact, status: :created, location: @contact\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def new\r\n @project_request = ProjectRequest.new\r\n @skills = Skill.all\r\n @current_date = DateTime.now\r\n \r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @project_request }\r\n end\r\n end",
"def new\n @contact = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phone }\n end\n end",
"def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phone }\n end\n end",
"def new\n @library_contact = @library_location.library_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library_contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to new_contact_path, notice: 'We got your info! We\\'ve sent you a copy and we\\'ll get back to you soon.' }\n format.json { render :new, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.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 new\n @person_contact = PersonContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person_contact }\n end\n end",
"def new\n @request = Request.new\n 1.times do\n request_photo = @request.request_photos.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n render_contact_partials\n\n @location = Location.new\n @location.contacts = [{:phone => [{}]}]\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @location }\n end\n end",
"def new\n @request_meeting = RequestMeeting.new params[:request_meeting]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_meeting }\n end\n end",
"def new\n @contacts = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacts }\n end\n end",
"def new\n @addresstype = Addresstype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addresstype }\n end\n end",
"def new\n @contacto = Contacto.new\n \n respond_to do |format|\n format.html { render :layout => 'special_form'}# new.html.erb\n #format.json { render json: @contacto }\n end\n end"
] | [
"0.73663086",
"0.73390824",
"0.73390824",
"0.73390824",
"0.7323062",
"0.7275984",
"0.7275984",
"0.7275984",
"0.7275984",
"0.7275984",
"0.7254225",
"0.7246353",
"0.7231858",
"0.7171804",
"0.7116707",
"0.7081889",
"0.70368844",
"0.69848824",
"0.6976765",
"0.69732654",
"0.69335717",
"0.69302434",
"0.69131285",
"0.6913097",
"0.6900331",
"0.6884617",
"0.68546057",
"0.68434876",
"0.6808244",
"0.67980844",
"0.6787157",
"0.67705154",
"0.67442375",
"0.67442375",
"0.6737127",
"0.6705859",
"0.6704503",
"0.6695377",
"0.66724384",
"0.66660476",
"0.6657373",
"0.66400164",
"0.6612774",
"0.6612774",
"0.6607232",
"0.66067296",
"0.6602673",
"0.6601908",
"0.6586906",
"0.65825117",
"0.65634835",
"0.65441215",
"0.65352035",
"0.65350556",
"0.65303934",
"0.65303934",
"0.65303934",
"0.65303934",
"0.65301967",
"0.6522865",
"0.65215683",
"0.651839",
"0.65160364",
"0.6515235",
"0.650889",
"0.65072995",
"0.6482724",
"0.6469466",
"0.64579505",
"0.64579505",
"0.64579505",
"0.6457572",
"0.6457572",
"0.64449906",
"0.64422756",
"0.6439818",
"0.6439818",
"0.6429497",
"0.6428402",
"0.6426064",
"0.6426064",
"0.6425968",
"0.64211565",
"0.64211565",
"0.64211565",
"0.64203036",
"0.64178264",
"0.64098877",
"0.64086294",
"0.64019036",
"0.6397705",
"0.6397705",
"0.6397705",
"0.6385368",
"0.63763523",
"0.6374393",
"0.63742155",
"0.6373021",
"0.63589853",
"0.63581616"
] | 0.8205658 | 0 |
POST /contact_requests POST /contact_requests.json | def create
@contact_request = ContactRequest.new(params[:contact_request])
respond_to do |format|
if @contact_request.save
ContactRequestMailer.contact_request_submitted(@contact_request).deliver
format.html { redirect_to new_contact_request_path, notice: 'Contact request was successfully submitted.' }
format.json { render json: @contact_request, status: :created, location: @contact_request }
else
format.html { render action: "new" }
format.json { render json: @contact_request.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @contact = current_user.contacts.find(params[:contact_id])\n @request = Request.new(params[:request])\n @request.contact = @contact\n @request.user = current_user\n\n respond_with @request do |format|\n if @request.save\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.created')) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def new\n @contact_request = ContactRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end",
"def new\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.build\n @request.deadline = Date.today\n\n respond_with @request\n end",
"def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n render json: @contact, status: :created, location: @contact\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end",
"def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end",
"def create\n contact = Contact.create(contact_params)\n\n if contact.new_record?\n render json: { errors: contact.errors.messages }, status: 422\n else\n render json: contact, status: 201\n end\n end",
"def create\n @contact_submission = ContactSubmission.new(contact_submission_params)\n respond_to do |format|\n if @contact_submission.save\n format.html { redirect_to contact_submissions_message_thank_you_path }\n format.json { render :show, status: :created, location: @contact_submission }\n else\n format.html { render :new }\n format.json { render json: @contact_submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n fresh_when(@contact)\n render json: @contact, status: :created, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def create\n @request = @skill.requests.new(params[:request])\n @request.sender = current_user\n \n respond_to do |format|\n if @request.save\n\n # UserMailer.request_received(@request.receiver).deliver\n \n format.html { redirect_to myrequests_path, notice: 'Your Application has been sent! The Helper will contact you by email if they are interested in helping your Startup :)' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @contact = Contact.new(contact_params)\n @contact.sender = current_user.pseudo\n @contact.state = \"new\"\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to session[:previous_request_url], notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:request][:issue_ids] ||= []\n params[:request][:email] ||= current_user.email\n params[:request][:name] ||= current_user.name\n @request = Request.new(request_params)\n @request.created_by_user = current_user.id\n\n respond_to do |format|\n\n if @request.save\n add_issues_to_request\n @request.newrequest!\n @request.approver!\n\n\n if !params[:request][:comment].empty?\n comment = @request.comments.create\n comment.comment = params[:request][:comment]\n comment.user_id = current_user.id\n comment.save\n end\n\n RequestMailer.notification_email(@request).deliver_later\n\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n\n else\n \n @comments = @request.comments.recent.limit(10).all\n @issues = Issue.all\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_contact(params={})\n @obj.post('create-contact', @auth.merge(params))\n end",
"def contact_params\n params\n .require(:contact)\n .permit(:contact, :client_id, :contact_type_id)\n end",
"def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new({\n first_name: contact_info[:first_name],\n last_name: contact_info[:last_name],\n phone: contact_info[:phone]\n })\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'contact.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new, {\n contact: contact,\n user: self\n })\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/contacts/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n @response.status == 201\n end",
"def add_recipient_request(data)\n @sendgrid.client.contactdb.recipients.post(request_body: [data])\n end",
"def create\n @case_request = CaseRequest.new(case_request_params)\n\n respond_to do |format|\n if @case_request.save\n format.html { redirect_to @case_request, notice: 'Case request was successfully created.' }\n format.json { render :show, status: :created, location: @case_request }\n else\n format.html { render :new }\n format.json { render json: @case_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_contact = CustomerContact.new(customer_contact_params)\n\n respond_to do |format|\n if @customer_contact.save\n format.html { redirect_to @customer_contact, notice: 'Customer contact was successfully created.' }\n format.json { render :show, status: :created, location: @customer_contact }\n else\n format.html { render :new }\n format.json { render json: @customer_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_contact(email, kyc_data = {})\n custom_params = {\n \"email\" => email,\n \"first_name\" => kyc_data[:first_name] || 'aman',\n \"last_name\" => kyc_data[:last_name] || 'barbaria',\n \"birthdate\" => kyc_data[:birthdate] || '23/07/1991',\n \"street_address\" => kyc_data[:street_address] || 'magarpatta city',\n \"city\" => kyc_data[:city] || 'pune',\n \"state\" => kyc_data[:state] || 'maharashtra',\n \"country\" => kyc_data[:country] || 'INDIA',\n \"postal_code\" => kyc_data[:postal_code] || '411028',\n \"ethereum_address\" => kyc_data[:ethereum_address] || '0x2755a475Ff253Ae5BBE6C1c140f975e5e85534bD',\n \"document_id_number\" => kyc_data[:document_id_number] || \"#{Time.now.to_i}\",\n \"nationality\" => kyc_data[:nationality] || 'INDIAN',\n \"document_id_file_path\" => kyc_data[:document_id_file_path] || '2/i/687eb50ecbe60c37400746a59200c75b',\n \"selfie_file_path\" => kyc_data[:selfie_file_path] || '2/i/24d828f00557817e846ebed6109c0ac8',\n \"residence_proof_file_path\" => kyc_data[:residence_proof_file_path] || '3/i/d3817395b85581eab3068cb43f9c0f63',\n \"investor_proof_files_path\" => kyc_data[:investor_proof_files_path] ||\n ['3/i/d3817395b85581eab3068cb43f9c0f63', '3/i/d3817395b85581eab3068cb43f9c0f63'],\n \"user_ip_address\" => kyc_data[:user_ip_address]\n }\n endpoint = \"/api/#{@version}/kyc/add-kyc/\"\n params = request_parameters(endpoint, custom_params)\n post(params)\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if @point_of_contact.save\n render json: @point_of_contact, status: :created, location: @point_of_contact\n else\n render json: @point_of_contact.errors, status: :unprocessable_entity\n end\n end",
"def create\n # @request = current_user.sent_requests.build(request_params)\n\n # respond_to do |format|\n # if @request.save\n # format.html { redirect_to posts_url, notice: 'Friend request sent!' }\n # format.json { render :show, status: :created, location: @request }\n # else\n # format.html { redirect_to posts_url, notice: 'Failed to send a friend request!' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n # end\n @request = current_user.sent_requests.build(request_params)\n if @request.save\n flash[:success] = 'Friend request sent!'\n redirect_to '/posts', notice: \"Friend request sent!\"\n else\n redirect_to '/posts', notice: \"Friend request couldn't be sent\"\n end\n end",
"def create\n @request_call = RequestCall.new(params[:request_call])\n\n respond_to do |format|\n if @request_call.save\n format.html { redirect_to thanks_quick_orders_path, notice: 'Request call was successfully created.' }\n OrderMailer.new_call_mail(@request_call).deliver\n # OrderMailer.dev_call_mail(@request_call).deliver\n format.json { render json: @request_call, status: :created, location: @request_call }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team_request = TeamRequest.for_email(request_params['email'], @team.id, current_user.id)\n\n respond_to do |format|\n if @team_request.save\n format.html { redirect_to @team, notice: 'Request to join the team was sent!' }\n format.json { render :show, status: :sent, location: @team }\n else\n render_errors format, @team_request.errors, :new\n end\n end\n end",
"def create\n @contact = @business.contacts.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: business_contact_path(@business,@contact) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_contacts\n\t\tname = params[:name]\t\t\t\t\t\t\t\n\t\temail = params[:email]\n\t\ttelephone = params[:telephone]\n\t\tmessage = params[:message]\n\t\tif email.blank?\n\t\tflash[:alert] = I18n.t('request_contacts.no_email')\n\t\telse\n\t\t\tContactMailer.contact_email(email, name, telephone, message).deliver_now\n\t\t# Send an email\n\t\tflash[:notice] = I18n.t('request_contacts.email_sent')\n\t\tend\n\t\tredirect_to root_path\n\n\n\tend",
"def create\n request = Request.new({title: params[:title], reqtype: params[:reqtype], description: params[:description],\n lat: params[:lat], lng: params[:lng], address: params[:address], status: params[:status], user_id: @current_user.id})\n if request.save\n render json: {\n status: 'success',\n message: 'Request added successfully',\n data: request\n },\n status: :created\n else \n render json: {\n status: 'error',\n message: 'Request not saved',\n data: request.errors\n },\n status: :unprocessable_entity\n end\n end",
"def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n params[:ur_contact].delete(:id)\n newContact = current_user.ur_contacts.new(contact_params)\n\n if newContact.save then\n render json: newContact\n else\n Rails.logger.info \"Error when creating contacts #{newContact.errors.messages}\"\n head :internal_server_error\n return\n end\n end",
"def create_contact\n @contact = Spree::Address.new(contact_params)\n # Currently for demo, I will leave the country id to be 1, later update will be noticed!\n hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.save\n @seller.spree_addresses << @contact\n format.html { redirect_to contacts_admin_seller_path, notice: \"Contacts #{@contact.firstname} #{@contact.lastname} is successfully created!\" }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :new_contact }\n format.json { render :new_contact, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to edit_contact_path(@contact), notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @contact = Contact.new(params[:contact])\n \n if @contact.save\n render :json => { :success => true, :message => \"Created new contact #{@contact.id}\", :contact => @contact }\n else\n render :json => { :success => false, :message => \"Failed to create contact\"}\n end\n \n # @contact = Contact.new(params[:contact])\n # \n # respond_to do |format|\n # if @contact.save\n # format.html { redirect_to(@contact, :notice => 'Contact was successfully created.') }\n # format.xml { render :xml => @contact, :status => :created, :location => @contact }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def client_contact_params\n params.require(:client_contact).permit(\n :date,\n :contact_type,\n :notes\n )\n end",
"def create\n @contact_method = ContactMethod.new(contact_method_params)\n\n respond_to do |format|\n if @contact_method.save\n format.html { redirect_to @contact_method, notice: 'Contact method was successfully created.' }\n format.json { render :show, status: :created, location: @contact_method }\n else\n format.html { render :new }\n format.json { render json: @contact_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to thank_you_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend",
"def create\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id if current_user\n @contact.request = request.headers.env.reject { |content|\n content.inspect.include?('rack') ||\n content.inspect.include?('action_dispatch') ||\n content.inspect.include?('warden') ||\n content.inspect.include?('SERVER') ||\n content.inspect.include?('COOKIE') ||\n content.inspect.include?('cookie') ||\n content.inspect.include?('session') ||\n content.inspect.include?('instance')\n }.inspect\n\n if @contact.save\n flash[:notice] = t('views.message.create.success')\n else\n flash[:alert] = ContactDecorator.flash(@contact, flash)\n end\n redirect_to :back\n end",
"def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @traded_contact = TradedContact.new(params[:traded_contact])\n\n respond_to do |format|\n if @traded_contact.save\n format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully created.' }\n format.json { render json: @traded_contact, status: :created, location: @traded_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @traded_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request = Request.new(request_params)\n @request.user_id = current_user.id\n @request.assign_json_attributes(params) if @request.resume?\n\n respond_to do |format|\n if @request.save\n @request.set_folio\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_params\n params.require(:request).permit(:name, :email, :phone, :other_phone, :description, :subject, :status, :assigned_to_user)\n end",
"def create\n Rails.logger.info \"Completed in #{contact_params}\"\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:subject, :name, :email, :tel, :message, :data, :read, :contactable_id, :contactable_type)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :phone, :description, \n addresses: %i[line1 line2 city state zip]\n )\n end",
"def contact_params\n params.require('/contact').permit(:object, :email, :content)\n end",
"def add_new_contact_with_http_info(contact_email, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.add_new_contact ...\"\n end\n # verify the required parameter 'contact_email' is set\n if @api_client.config.client_side_validation && contact_email.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_email' when calling ContactsApi.add_new_contact\"\n end\n # resource path\n local_var_path = \"/contacts/\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"contactEmail\"] = contact_email\n form_params[\"contactInfo\"] = opts[:'contact_info'] if !opts[:'contact_info'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\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: ContactsApi#add_new_contact\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projectcontact = Projectcontact.new(params[:projectcontact])\n #@project = params[:project]\n #@contacts = params[:contact_ids]\n\n #@contacts.each do |c| \n # Projectcontact.create!(:contact_id=>5, :project_id=>params[:project])\n #end\n #redirect_to edit_project_path(@project)\n\n\n respond_to do |format|\n if @projectcontact.save\n format.html { redirect_to project_path(@projectcontact.project_id), notice: 'Contacttype was successfully created.' }\n format.json { render json: @projectcontact, status: :created, location: @projectcontact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projectcontact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = @user.contacts.build(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to root_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n set_user_on_nested_fields @request\n @request = Request.new(params[:request]) \n @request.user = current_user \n\n respond_to do |format|\n if @request.save \n format.html { redirect_to request_path(@request), :notice => 'Запрос был успешно создан, мы уведомим вас посредством SMS об ответе менеджера.' }\n format.mobile { redirect_to request_path(@request), :notice => 'Запрос был успешно создан, мы уведомим вас посредством SMS об ответе менеджера.' }\n format.json { render :json => @request, :status => :created, :location => @request }\n else\n format.html { render :action => \"new\" }\n format.mobile { render :action => \"new\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, addresses_attributes: [ :city, :street, :street_number ])\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :middle_name, :last_name, :address, :city, :state, :ssn, :married, :employed, :parent, :prefix,\n :country, :phone_number, :fax_number, :email, :gender, :age, :type, :case_id, :salary, :website,\n :user_id, :contact_user_id, :corporation, :note, :firm, :attorney_type, :zip_code, :date_of_birth, :minor, \n :deceased, :date_of_death, :major_date, :mobile, :company_id,\n :firms_attributes => [:name, :address, :zip])\n end",
"def post_contact\n\t\tcontact = Contact.new\n\t\tcontact.first_name = params[:first_name]\n\t\tcontact.last_name = params[:last_name]\n\t\tcontact.phone_number = params[:phone_number]\n\t\tcontact.email = params[:email]\n\t\tcontact.save\n\t\tcurrent_agendify_user.contacts.push(contact)\n\t\tcurrent_agendify_user.save\n\t\tredirect_to root_path\n\tend",
"def contact_params\n params.require(:contact).permit(:name, :email_id, :facebook_id, :skype_id, :twitter_id, :tag_list, :phones_attributes => [:id, :phone_no, :_destroy])\n end",
"def post_contacts_with_http_info(contacts, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.post_contacts ...'\n end\n # verify the required parameter 'contacts' is set\n if @api_client.config.client_side_validation && contacts.nil?\n fail ArgumentError, \"Missing the required parameter 'contacts' when calling ContactsApi.post_contacts\"\n end\n # resource path\n local_var_path = '/contacts'\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(contacts) \n\n # return_type\n return_type = opts[:return_type] || 'Contact' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#post_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to new_contact_path, notice: 'We got your info! We\\'ve sent you a copy and we\\'ll get back to you soon.' }\n format.json { render :new, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.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 update\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @request do |format|\n if @request.update_attributes(params[:request])\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.updated')) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone, :reason, :email)\n end",
"def create\n @request = Request.new(params[:request])\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to user_requests_path, notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Kontakten skapades, success.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_contact\n name = params[:name] # The value of the name field.\n email = params[:email] # The value of the email field.\n telephone = params[:telephone] # The value of the telephone field.\n message = params[:message] # The value of the message field.\n\n if email.blank? # Checks whether an email address has been submitted.\n flash[:alert] = I18n.t('home.request_contact.no_email') # Shows an alert if the email field is empty.\n else\n ContactMailer.contact_email(email, name, telephone, message).deliver_now # Sends an email.\n flash[:notice] = I18n.t('home.request_contact.email_sent') # Shows an notice if email has been sent successfully.\n end\n\n redirect_to root_path # Re-display the root path.\n end",
"def contact_params\n params.require(:contact).permit(:status, :name, :email, :phone, :subject, :message)\n end",
"def contact_params\n params.require(:contact).permit(:firstname, :lastname, :email, :address1,:address2, :city, :country_id, :pincode, :phone_number, :vendor, :buisinessname, :notes, :brand_id, :contact_id, :reference_contact_id, :tag_list, referred_contacts_attributes: [])\n end",
"def contact_params\n params.require(:contact).permit(:id, :status, :first_name, :middle_name, :last_name, :confirmed, :email_address, :prefix_name, :job_title, :addresses, :company_name, :home_phone, :work_phone, :cell_phone, :fax, :custom_fields, :lists, :source_details, :notes, :source)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :message, :phone)\n end",
"def create\n # contact_params[:phone_number] = contact_params[:phone_number].phony_formatted(:normalize => \"KE\", :format => :international).gsub(/\\D/, '')\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: { id: @contact.id.to_i, status: \"success\" } }\n else\n format.html { render :new }\n format.json { render json: { id: @contact.id.to_i, status: \"failure\" } }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :phone, :web, :notes, :job_id)\n end",
"def create\n @contact = Contact.new\n @contact.first_name=params[:first_name]\n @contact.last_name=params[:last_name]\n @contact.email=params[:email]\n @contact.org=params[:org]\n @contact.events=params[:events]\n @contact.interests=params[:interests]\n @contact.save\n\n contacts_list\n end",
"def create\n @user_contact = UserContact.new(user_contact_params)\n\n respond_to do |format|\n if @user_contact.save\n format.html { redirect_to @user_contact, notice: 'User contact was successfully created.' }\n format.json { render :show, status: :created, location: @user_contact }\n else\n format.html { render :new }\n format.json { render json: @user_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone_number, :id_number, :group_id, :contact_type, :verified, :verification_code, :estate_id, :estate_number)\n end",
"def customer_params\n params.require(:customer).permit(:user_id, :company_name, requests_attributes: [:id, :customer_id, :contact_firstname, :contact_lastname, :title, :email, :phone, :street_address, :city, :date, :zip_code])\n end",
"def contact_params\n params.require(:contact).permit(:title, \n :body,\n :name,\n :phone,\n :email,\n :status,\n :id,\n :created_at,\n :updated_at)\n end",
"def create\n @crm_contact = CrmContact.new(params[:crm_contact])\n\n respond_to do |format|\n if @crm_contact.save\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully created.' }\n format.json { render json: @crm_contact, status: :created, location: @crm_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:prefix, :mobile, :contact_lists, { contact_ids: [] },\n { contact_profile_attributes: current_user.metadata.to_a },\n { contact_group_attributes: [:_id] })\n end",
"def contact_params\n params.fetch(:contact, {}).permit(:reason, :surname, :message, :email, :telephone, :name, :locale, :agreement_ids,\n :strategy, :squeeze_id, :title, :company, :address, :position, :country, :employee_count, :branch, :agreement_ids => [])\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def create\n @employee_contact = EmployeeContact.new(employee_contact_params)\n\n respond_to do |format|\n if @employee_contact.save\n format.html { redirect_to @employee_contact, notice: 'Employee contact was successfully created.' }\n format.json { render :show, status: :created, location: @employee_contact }\n else\n format.html { render :new }\n format.json { render json: @employee_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone, :email, :catgegory, :message)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def create\n @contact_phone = @contact.phones.new(contact_phone_params)\n\n respond_to do |format|\n if @contact_phone.save\n format.html { redirect_to contact_phone_path(@contact, @contact_phone), notice: 'Phone was successfully created.' }\n format.json { render :show, status: :created, location: contact_phone_path(@contact, @contact_phone) }\n else\n format.html { render :new }\n format.json { render json: @contact_phone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :title, :tel, :content)\n end",
"def create\n @request_email = RequestEmail.new(request_email_params)\n\n respond_to do |format|\n if @request_email.save\n format.html { redirect_to @request_email, notice: \"Request email was successfully created.\" }\n format.json { render :show, status: :created, location: @request_email }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @request_email.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contactinfo = Contactinfo.new(params[:contactinfo])\n\n respond_to do |format|\n if @contactinfo.save\n format.html { redirect_to @contactinfo, 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 @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n ContactMailer.send_contact_form(@contact).deliver_now\n format.html { redirect_to new_contact_path, notice: 'Mensaje enviado exitosamente.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :birthdate, :kind_id, phones_attributes: [:id, :number, :_destroy])\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :phone, :message)\n end",
"def create\n @contact = Contact.new(contact_params)\n p @address = Address.create(address_params)\n @job = Job.find_by(id: job_param[:job_id])\n p @contact.address_id = @address.id\n\n respond_to do |format|\n if @contact.save\n if @job\n @job.contact_id = @contact.id\n if @job.save\n\n @contact.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].count\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @contact.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n redirect_to job_path(@job), notice: 'Contact was successfully created.'\n return\n else\n render :new\n return\n end\n else\n\n @contact.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].count\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @contact.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n\n redirect_to contact_path(@contact), notice: 'Contact was successfully created.'\n return\n\n end\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.70818156",
"0.6308896",
"0.6275255",
"0.62182724",
"0.61216146",
"0.6053918",
"0.5998568",
"0.59393895",
"0.5923282",
"0.5918005",
"0.5900771",
"0.5885958",
"0.5875787",
"0.5867483",
"0.5828618",
"0.5823433",
"0.5808172",
"0.58075505",
"0.5793487",
"0.5791441",
"0.5790665",
"0.5790078",
"0.575527",
"0.5755251",
"0.5746618",
"0.5713368",
"0.5712819",
"0.57115114",
"0.5697295",
"0.56922764",
"0.56903476",
"0.5689539",
"0.56846344",
"0.5674103",
"0.56673414",
"0.5655465",
"0.56514245",
"0.56514245",
"0.56514245",
"0.56514245",
"0.56514245",
"0.56514245",
"0.5648206",
"0.56466335",
"0.56461537",
"0.56452805",
"0.5640627",
"0.5638821",
"0.563477",
"0.5633616",
"0.5626177",
"0.562592",
"0.5622926",
"0.56223065",
"0.5619168",
"0.5619128",
"0.56178397",
"0.561751",
"0.5610773",
"0.56095016",
"0.5608084",
"0.56007665",
"0.55944985",
"0.559242",
"0.55890155",
"0.55877966",
"0.5584464",
"0.55814236",
"0.55796",
"0.55749357",
"0.55712605",
"0.5566391",
"0.5562912",
"0.55603784",
"0.5554966",
"0.55497456",
"0.55448174",
"0.55411035",
"0.5539771",
"0.5538967",
"0.553811",
"0.5537086",
"0.55333346",
"0.5531536",
"0.552928",
"0.55231893",
"0.55198455",
"0.5510513",
"0.5506665",
"0.55046463",
"0.5504213",
"0.5504213",
"0.55031836",
"0.55025333",
"0.54977244",
"0.54971355",
"0.5495643",
"0.5493228",
"0.549284",
"0.54927"
] | 0.705282 | 1 |
PUT /contact_requests/1 PUT /contact_requests/1.json | def update
@contact_request = ContactRequest.find(params[:id])
respond_to do |format|
if @contact_request.update_attributes(params[:contact_request])
format.html { redirect_to @contact_request, notice: 'Contact request was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @contact_request.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @request do |format|\n if @request.update_attributes(params[:request])\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.updated')) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end",
"def update\n if @contact.update(contact_params)\n fresh_when(@contact)\n render json: @contact, status: :ok, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def update\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def create\n @contact = current_user.contacts.find(params[:contact_id])\n @request = Request.new(params[:request])\n @request.contact = @contact\n @request.user = current_user\n\n respond_with @request do |format|\n if @request.save\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.created')) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n # respond_to do |format|\n if @contact.update_attributes(params[:contact])\n # format.html { redirect_to(@contact, :notice => 'Contact was successfully updated.') }\n # format.xml { head :ok }\n render :json => { :success => true, :message => \"Created new client #{@contact.id}\", :contact => @contact }\n else\n render :json => { :success => false, :message => \"Failed to create contact\"}\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n # end\n end",
"def update\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n return\n end\n\n #really update the contacts\n contact = UrContact.find(params[:id])\n\n #can't dlete contact you don't own\n if contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to update contact you don't own\"\n head :internal_server_error\n return\n end\n\n if contact.update_attributes(contact_params) then\n render json: contact\n else\n head :internal_server_error\n end\n end",
"def update\n\n params[:client][:contact_ids] ||= []\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n contact = Contact.find(params[:id])\n\n if contact.user_id == current_user.id\n contact.update_attributes(params[:contact])\n render json: contact\n else\n render text: \"That's not your contact!\"\n end\n end",
"def update\n\t\t@request = Request.unscoped.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @request.update_attributes( update_request_params )\n\t\t\t\tformat.json { render json: @request, status: :created }\t\t\t\t\n\t\t\telse\n\t\t\t\tformat.json { render json: @request.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end",
"def update_contact(contact_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ContactName'] = contact_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/contacts/[ContactName]'\n\t\targs[:query]['Action'] = 'UpdateContact'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :contact\n\t\t\targs[:body]['Contact'] = optional[:contact]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n respond_to do |format|\n @job = Job.find_by(id: job_param[:job_id])\n if @address = Address.find_by(id: @contact.address_id)\n if @address.update(address_params)\n end\n else\n @address = Address.new(address_params)\n @address.save\n @contact.address_id = @address.id\n end\n if @contact.update(contact_params)\n @contact.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].count\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @contact.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render :edit, notice: 'Contact was successfully updated.' }\n format.json { render :edit, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n if @request_call.update_attributes(params[:request_call])\n format.html { redirect_to @request_call, notice: 'Request call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n if @contact.update_attributes(params[:contact])\n response_message = {:message => \"Contact updated successfully.\", :contact => @contact}\n else\n response_message = {:message => \"Contact updation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_contact_params=contact_params\n new_contact_params[:name]=params[:name]\n new_contact_params[:phone]=params[:phone]\n new_contact_params[:reason]=params[:reason]\n new_contact_params[:email]=params[:email]\n\n contact_params=new_contact_params\n end\n\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contact_url @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: (contact_url @contact) }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @point_of_contact.update(params[:point_of_contact])\n head :no_content\n else\n render json: @point_of_contact.errors, status: :unprocessable_entity\n end\n end",
"def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end",
"def update\n respond_to do |format|\n @contact.contact_type_id = 12\n\n if @contact.update(contact_params)\n format.html { redirect_to team_path(@contact), notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact_in_salesforce\n \tsf = Salesforce::API.connect_to_salesforce\n \tcontact_id = self.sf_contact_id\n \tsf.update(\n \"Contact\",\n Id: \"#{contact_id}\",\n Name: \"#{self.first_name}\",\n Email: \"#{self.email}\",\n )\n end",
"def update\n @contact = @business.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(contact_params || {})\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # contact_params[:photo] = File.open(contact_params[:photo])\n # if contact_params[:phone_number]\n # contact_params[:phone_number] = @contact.phone_number\n # end\n if params[:photo]\n @contact.photo = File.open(params[:photo].tempfile)\n @contact.save!\n end\n if params[:contact][:estate_name] && contact_params[:estate_number]\n estate_id = Estate.find_or_create_by!(estate_name: params[:contact][:estate_name]).id\n @contact.estate_id = estate_id\n @contact.estate_number = params[:estate_number]\n @contact.save!\n end\n if @contact.update(contact_params.except(:phone_number).except(:photo))\n contact = {}\n contact[:id] = @contact.id\n contact[:name] = @contact.name\n contact[:phone_number] = @contact.phone_number\n contact[:group_id] = @contact.group_id\n contact[:contact_type] = @contact.contact_type\n contact[:member_since] = \"#{@contact.created_at.strftime(\"%d/%m/%Y\")} #{@contact.created_at.strftime(\"%I:%M%p\")}\"\n\n render json: contact\n else\n render json: { status: \"FAIL\"}\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request = Request.find_by_id(params[:id])\n if request\n request.status = 1\n if request.save\n render json: {\n status: 'success',\n message: 'Request marked as fulfilled',\n },\n status: :ok\n else\n render json: {\n status: 'error',\n message: 'Request failed',\n data: request.errors,\n },\n status: :unprocessable_entity\n end\n else\n render status: :unauthorized\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, :notice => 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_contact(companyId, id, model) path = \"/api/v2/companies/#{companyId}/contacts/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to edit_contact_path(@contact), notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact\n @contact = Contact.find(params[:id])\n @contact.update(params[:contact])\n redirect \"/contacts/#{@contact.id}\"\nend",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crm_contact = CrmContact.find(params[:id])\n\n respond_to do |format|\n if @crm_contact.update_attributes(params[:crm_contact])\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact(contact)\n raise \"contact_id or contact_number is required for updating contacts\" if contact.contact_id.nil? and contact.contact_number.nil?\n \n request_xml = contact.to_xml\n response_xml = http_post(\"#{@xero_url}/contact\", request_xml, {})\n\n parse_response(response_xml, :request_xml => request_xml)\n end",
"def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer_contact.update(customer_contact_params)\n format.html { redirect_to @customer_contact, notice: 'Customer contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_contact }\n else\n format.html { render :edit }\n format.json { render json: @customer_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to thank_you_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n if @crm_contact_info.update_attributes(params[:crm_contact_info])\n format.html { redirect_to @crm_contact_info, notice: 'Crm contact info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to root_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html{redirect_to([@scenario, @contact], notice: 'Contact was successfully updated.')}\n format.json{render :show, status: :ok, location: @contact}\n else\n format.html{redirect_to :back, flash: {error: \"Error saving contact\"}}\n format.json{render json: @contact.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact_method.update(contact_method_params)\n format.html { redirect_to @contact_method, notice: 'Contact method was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact_method }\n else\n format.html { render :edit }\n format.json { render json: @contact_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend",
"def update\n if @contact.update(contact_params)\n flash[:notice] = \"Updated Contact\"\n # Set browser URL to /contacts/1\n headers['X-IC-SetLocation'] = contact_path(@contact)\n render action: :show, :layout => params['ic-request'].blank?\n else\n flash[:error] = \"Could not update Contact\"\n render action: :edit, :layout => params['ic-request'].blank?\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n @contact.person_id = nil if params[:contact][:person_name].present?\n respond_to do |format|\n if @contact.update_attributes(params[:contact].merge(:updated_by => current_user.id))\n format.html { redirect_to client_contacts_path(@firm), :notice => \"#{ Contact.model_name.human } успешно изменен.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n update_custom_field_values\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end",
"def update\n @organization_contact = OrganizationContact.find(params[:id])\n org_id = Organization.find_by_company_name(params[:organization_contact][:organization_id]).id\n respond_to do |format|\n params[:organization_contact][:organization_id] = org_id\n if @organization_contact.update_attributes(params[:organization_contact])\n format.html { redirect_to organization_contacts_path(:org_id => org_id), notice: 'Organization contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n @request.destroy\n @requests = @contact.requests.last_requests\n\n respond_with @request do |format|\n format.html { redirect_to(contact_requests_path) }\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 put_update(options = {})\n options[:id] ||= @phone.id\n options[:phone] ||= @attributes\n\n # options[:email][@email.id.to_s] = @attributes\n put :update,options\n end",
"def update\n @contact_action = ContactAction.find(params[:id])\n\n respond_to do |format|\n if @contact_action.update_attributes(params[:contact_action])\n format.html { redirect_to @contact_action, notice: 'Contact action was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contactaction = Contactaction.find(params[:id])\n\n respond_to do |format|\n if @contactaction.update_attributes(params[:contactaction])\n format.html { redirect_to @contactaction, :notice => 'Contactaction was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contactaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update fields\n self.contact = @nimble.put \"contact/#{self.id}\", { fields: fields }\n return nil unless self.contact\n self\n end",
"def update\n respond_to do |format|\n if @case_contact.update(case_contact_params)\n format.html { redirect_to @case_contact, notice: 'Case contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_contact }\n else\n format.html { render :edit }\n format.json { render json: @case_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sa_request.update(sa_request_params)\n format.html { redirect_to @sa_request, notice: 'Sa request was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request }\n else\n format.html { render :edit }\n format.json { render json: @sa_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case_request.update(case_request_params)\n Case.create(case_title: @case_request.title, case_content: @case_request.content)\n \n @case_request.user.messages.create(content: \"The \" + @case_request.title + \" case is now available at Cases Section.\", is_lea_response: true)\n \n @case_request.destroy\n format.html { redirect_to @case_request, notice: 'Case request was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_request }\n else\n format.html { render :edit }\n format.json { render json: @case_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contact\n if params[:action] == \"update\"\n @contact = Contact.find(params[:format]) \n else\n @contact = Contact.find(params[:id])\n end\n end",
"def update\n @request = Request.find(params[:id])\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(contacts_url, :notice => t('contacts.was_updated.')) }\n format.json { head :ok }\n format.js { render 'success' }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n format.js { render 'failure' }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n pars = contact_params\n pars[:uid] = current_user.id\n\n group_ids = []\n unless pars[:contact_group_attributes].nil?\n pars[:contact_group_attributes].each do |group|\n group_ids << BSON::ObjectId.from_string(group[:_id])\n end\n end\n pars.delete(:contact_group_attributes)\n\n if group_ids.blank?\n @contact.unset(:contact_group_ids)\n else\n @contact.set(contact_group_ids: group_ids)\n end\n\n respond_to do |format|\n begin\n if @contact.update(pars)\n expire_fragment contact_url(@contact)\n if pars[:contact_profile_attributes][:last_name] != @contact.contact_profile[:last_name] or\n pars[:contact_profile_attributes][:first_name] != @contact.contact_profile[:first_name]\n Cashier.expire \"contacts-filter-#{current_user.id}\"\n end\n\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n create_profile\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n rescue Mongo::Error::OperationFailure => exception\n create_profile\n contact = duplicate_contact\n error = (t 'mongoid.errors.contact.duplicate_val')\n .gsub('%phone%', \"#{contact_params[:prefix]} #{contact_params[:mobile]}\")\n @contact.errors[t 'mongoid.errors.contact.duplicate_key'] =\n \"#{error} <a href=\\\"#{contact_path contact}\\\">#{t 'view_contact'}</a>\"\n\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact\n # hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.update_attributes(contact_params)\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact has successfully been updated!' }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact failed to be saved!' }\n format.json { render :contacts, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'edit' , notice: 'Kontakten uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_contacts(contacts)\n b = Builder::XmlMarkup.new\n request_xml = b.Contacts {\n contacts.each do | contact |\n contact.to_xml(b)\n end\n }\n\n response_xml = http_post(@client, \"#{@xero_url}/Contacts\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'POST/contacts'})\n response.contacts.each_with_index do | response_contact, index |\n contacts[index].contact_id = response_contact.contact_id if response_contact && response_contact.contact_id\n end\n response\n end",
"def update\n @contact = Contact.find(params[:id])\n \n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(@resource, :notice => 'Contact was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def destroy\n @contact_request = ContactRequest.find(params[:id])\n @contact_request.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_requests_url }\n format.json { head :ok }\n end\n end",
"def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end",
"def contact_params\n params\n .require(:contact)\n .permit(:contact, :client_id, :contact_type_id)\n end",
"def update\n respond_to do |format|\n if @subcontractor_contact.update(subcontractor_contact_params)\n format.html { redirect_to @subcontractor_contact, notice: 'Subcontractor contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @subcontractor_contact }\n else\n format.html { render :edit }\n format.json { render json: @subcontractor_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact_request = ContactRequest.new(params[:contact_request])\n\n respond_to do |format|\n if @contact_request.save\n ContactRequestMailer.contact_request_submitted(@contact_request).deliver\n format.html { redirect_to new_contact_request_path, notice: 'Contact request was successfully submitted.' }\n format.json { render json: @contact_request, status: :created, location: @contact_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact(id, params)\n put(\"contacts/#{id}\", contact: params)\n end",
"def update\n @person_contact = PersonContact.find(params[:id])\n\n respond_to do |format|\n if @person_contact.update_attributes(params[:person_contact])\n format.html { redirect_to(@person_contact, :notice => 'Person contact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person_contact.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7133398",
"0.65594596",
"0.64663845",
"0.6374402",
"0.6358661",
"0.63550556",
"0.63187456",
"0.61847866",
"0.6103021",
"0.609151",
"0.60833126",
"0.60771185",
"0.60715234",
"0.60702467",
"0.60547704",
"0.6020336",
"0.5993733",
"0.59850705",
"0.59779274",
"0.59770083",
"0.5966554",
"0.5962296",
"0.59579736",
"0.59556943",
"0.59533703",
"0.59484327",
"0.5942906",
"0.5941959",
"0.5941959",
"0.5941959",
"0.5935486",
"0.5934898",
"0.59348166",
"0.59302557",
"0.5927583",
"0.59054935",
"0.5904025",
"0.5904025",
"0.5904025",
"0.5904025",
"0.5904025",
"0.5904025",
"0.5904025",
"0.5904025",
"0.5904025",
"0.59035975",
"0.59032625",
"0.5900853",
"0.589272",
"0.58908564",
"0.5871992",
"0.587064",
"0.5870545",
"0.5870545",
"0.5870413",
"0.58688074",
"0.5866977",
"0.5866977",
"0.58626586",
"0.58598644",
"0.58583826",
"0.5858218",
"0.58564407",
"0.58562016",
"0.5855894",
"0.58547294",
"0.585436",
"0.584469",
"0.583796",
"0.58314043",
"0.5827583",
"0.5819407",
"0.58144915",
"0.58139586",
"0.5811042",
"0.58094704",
"0.5809354",
"0.58045155",
"0.5790889",
"0.5781178",
"0.57789236",
"0.57603216",
"0.5755776",
"0.5743983",
"0.5742317",
"0.57365644",
"0.5729781",
"0.5724008",
"0.57133037",
"0.57055545",
"0.5705491",
"0.5703667",
"0.5702354",
"0.5697598",
"0.5693833",
"0.5690235",
"0.5688385",
"0.5686157",
"0.5683854",
"0.5680699"
] | 0.7111245 | 1 |
DELETE /contact_requests/1 DELETE /contact_requests/1.json | def destroy
@contact_request = ContactRequest.find(params[:id])
@contact_request.destroy
respond_to do |format|
format.html { redirect_to contact_requests_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n @request.destroy\n @requests = @contact.requests.last_requests\n\n respond_with @request do |format|\n format.html { redirect_to(contact_requests_path) }\n end\n end",
"def destroy\n @contact.destroy\n render json: {status: 204}\n end",
"def delete(contactname)\n\n end",
"def destroy\n @contact.destroy\n #Contact.delete(@contact.id)\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Conshejointable.where(:contact_id =>@contact.id).delete_all\n Description.where(:contact_id =>@contact.id).delete_all\n puts @contact.id.to_s + \": \" + @contact.name\n @contact.delete\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contact.destroy\n render json:Contact.all\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def deleteRequest\n\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n\n @contact.destroy\n #@contact.version\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contactaction = Contactaction.find(params[:id])\n @contactaction.destroy\n\n respond_to do |format|\n format.html { redirect_to contactactions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_contact }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to admin_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n\n head :no_content\n end",
"def destroy\n @crm_contact = CrmContact.find(params[:id])\n @crm_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to crm_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_action = ContactAction.find(params[:id])\n @contact_action.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_actions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @contact.destroy\n payload = {\n success: { full_messages: [\"deleted id[#{params[:id]}]\"] }\n }\n render json: payload, status: :ok\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: t('controllers.contacts.people.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to @contact, notice: \"contact has been deleted\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_information.destroy\n respond_to do |format|\n format.html { redirect_to contact_informations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contactinfo = Contactinfo.find(params[:id])\n @contactinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to contactinfos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_type.destroy\n respond_to do |format|\n format.html { redirect_to contact_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contactable = find_contactable\n @contactable.contactos.find(params[:id]).destroy\n respond_to do |format|\n format.html { head :ok}\n # format.html { redirect_to @contactable }\n #format.json { head :ok }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n head :no_content\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { message('You have successfully deleted this request') }\n format.json { head :ok }\n end\n end",
"def destroy\n @contact = @business.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to business_contacts_url(@business) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to scenario_contacts_url(@scenario), notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_contact.destroy\n respond_to do |format|\n format.html { redirect_to member_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_contact = EntityContact.find(params[:id])\n @entity_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sa_request.destroy\n respond_to do |format|\n format.html { redirect_to sa_requests_url, notice: 'Sa request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n remove_contacts_dependencies\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = @skill.requests.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to myrequests_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n ur_contact = UrContact.find(params[:id])\n\n #you can delete contacts you don't own\n if ur_contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to delete contact you don't own\"\n head :internal_server_error\n return\n end\n\n if ur_contact.destroy then\n render json: {message:'Content Deleted'}\n else\n head :internal_server_error\n end\n end",
"def delete_contact(params={})\n @obj.delete('delete-contact', @auth.merge(params))\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to client_contacts_path(@firm), :notice => \"'#{ Contact.model_name.human } удален.'\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @contact_group.destroy\n\n render json: @contact_group, status: :ok\n end",
"def destroy\n @case_request.destroy\n respond_to do |format|\n format.html { redirect_to case_requests_url, notice: 'Case request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contactinfo = Contactinfo.find(params[:id])\n @people_id = @contactinfo.people_id\n @contactinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to person_path(@people_id) }\n format.json { head :ok }\n end\n end",
"def destroy\n @ad_contact = AdContact.find(params[:id])\n @ad_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_contacts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7712041",
"0.7394408",
"0.71834093",
"0.7075735",
"0.70171463",
"0.7016067",
"0.70110947",
"0.7008154",
"0.7008154",
"0.7008154",
"0.70038825",
"0.7000669",
"0.69926757",
"0.69926757",
"0.69926757",
"0.69824016",
"0.6978951",
"0.6978951",
"0.6978951",
"0.6978951",
"0.6978951",
"0.6978951",
"0.6971393",
"0.6957086",
"0.69442904",
"0.69442904",
"0.69442904",
"0.69442904",
"0.6929681",
"0.68913764",
"0.6890381",
"0.6888631",
"0.6879954",
"0.68765604",
"0.6874944",
"0.68595487",
"0.6851168",
"0.6835845",
"0.683323",
"0.6829208",
"0.68255097",
"0.68243074",
"0.6819311",
"0.6792138",
"0.6788767",
"0.6779533",
"0.6779363",
"0.6777831",
"0.677483",
"0.67708415",
"0.6766691",
"0.67615217",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.675524",
"0.6748676",
"0.67461836",
"0.6742829",
"0.6739668",
"0.6734664",
"0.6732787",
"0.6722457",
"0.67199844",
"0.6718611",
"0.6716836",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234",
"0.67127234"
] | 0.7967918 | 0 |
Deliver the email using ActionMailer. | def deliver
if valid?
run_callbacks :before_delivery
Mailer.deliver_active_email(self)
run_callbacks :after_delivery
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliver\n Mailer.deliver_message(options)\n end",
"def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end",
"def do_email\n @delivery = Delivery.find(params[:id])\n @email = params[:email]\n \n Notifier.delivery(@email, @delivery).deliver\n \n flash[:notice] = \"The delivery has been sent successfully.\"\n redirect_to \"/deliveries/#{@delivery.id}\"\n end",
"def deliver mail\n if @cfg[:deliver]\n mail.deliver!\n logger.debug \"Files were emailed to #{mail.to}\"\n else\n logger.debug \"Files would have been emailed to #{mail.to}, but #{self.class.name} is configured not to\"\n end\n end",
"def deliver\n Mail.new(from: from, to: formatted_to, body: sanitized_message).deliver!\n end",
"def deliver(event)\n payload = event.payload\n\n info(\n message: 'Mail sent',\n mailer_class: payload[:mailer],\n message_id: payload[:message_id],\n current_user: current_user(payload),\n email_subject: payload[:subject],\n email_to_hint: email_to_hint(payload),\n email_from: payload[:from],\n email_date: payload[:date]\n )\n end",
"def deliver!(mail)\n delivery_method.deliver!(mail)\n end",
"def rails_send_email(action)\n email = rails_create_email(action)\n email.public_send(rails_mailer_deliver_method)\n end",
"def deliver\n inform_interceptors\n if delivery_handler\n delivery_handler.deliver_mail(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end",
"def deliver_activation_email(action, params)\n from = MaSA[:from_email]\n raise \"No :from_email option set for Merb::Slices::config[:merb_auth_slice_activation][:from_email]\" unless from\n MaSA::ActivationMailer.dispatch_and_deliver(action, params.merge(:from => from, :to => self.email), :user => self)\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def perform(mailer, method, *args)\n mailer.send(method, *args).deliver\n #ex: LadybooMailer.atm_checkout_completed_successfully(order).deliver\n end",
"def deliver!\n self.do_deliver\n end",
"def deliver!\n deliver do\n begin\n if SEND_ENVS.include?(Emque::Consuming.application.emque_env)\n # TODO: This needs to be a SendGrid::Client instance. Another\n # thing for the adapter to handle\n SG.send(mailer)\n else\n write_to_logger\n end\n ensure\n persist\n end\n end\n end",
"def deliver\n newsletter_id = params[:id].to_i\n email_addr = params[:email].blank? ? params[:custom_email] : params[:email]\n\n # send_log_to = Rails.env == 'production' ? (Rails.application.class)::EMAIL_TO_DEFAULT : (Rails.application.class)::EMAIL_TO_DEVELOPER\n\n command = \"RAILS_ENV=#{Rails.env} #{Rails.root}/script/bash_runner.sh newsletter_emailer NEWSLETTER=#{newsletter_id}\"\n command += \" EMAIL_ADDR_OVERRIDE=#{email_addr}\" if email_addr\n command += \" &\"\n\n Rails.logger.warn(\"Sending newsletter with command #{command}\")\n pid = spawn(command)\n\n flash[:message] = \"started job_runner to do delivery of newsletter # #{newsletter_id} w/ pid #{pid}\"\n redirect_to :action => :show, :id => newsletter_id\n end",
"def deliver(payload)\n config = payload[:data][:notification_email]\n begin\n via_options = config.fetch(:via_options,\n Carnivore::Config.get(:fission, :mail, :smtp, :via_options) || {}\n )\n via_options = Hash[\n via_options.map do |k,v|\n [k.to_sym, v]\n end\n ]\n args = {\n :to => [config[:destination]].flatten(1).map{|d| d[:email]},\n :from => config[:origin][:email],\n :subject => config[:subject],\n :via => :smtp,\n :via_options => via_options\n }\n if(config[:attachments])\n args[:attachments] = Hash[*config[:attachments].map{|k,v|[k.to_s,v]}.flatten(1)]\n end\n message_key = config[:html] ? :html_body : :body\n args[message_key] = config[:message]\n if(args[:via_options][:authentication])\n args[:via_options][:authentication] = args[:via_options][:authentication].to_s.to_sym\n end\n if(bcc = Carnivore::Config.get(:fission, :mail, :bcc))\n args[:bcc] = bcc\n end\n result = Pony.mail(args)\n debug \"Pony delivery result: #{result.inspect}\"\n rescue => e\n error \"Delivery failed: #{e.class} - #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end",
"def deliver_now!\n processed_mailer.handle_exceptions do\n processed_mailer.run_callbacks(:deliver) do\n message.deliver!\n end\n end\n end",
"def deliver_now\n processed_mailer.handle_exceptions do\n processed_mailer.run_callbacks(:deliver) do\n message.deliver\n end\n end\n end",
"def deliver_email\n\t\treturn not_validated_error unless EmailValidator.new(content: content).validated?\n\t\tformatted_content = EmailFormatter.new(content: content, service: service).format\n\n\t\tif service == \"mandrill\"\n\t\t\tself.class.base_uri \"https://mandrillapp.com/api/1.0\"\n\t\t\tresponse = self.class.post(\"/messages/send.json\", body: {\"key\" => ENV.fetch(\"MANDRILL_API_KEY\"), \"message\" => formatted_content})\n\t\t\tif response[\"status\"] == \"sent\"\n\t\t\t\t\"Yay! Your email is on it's way!!\"\n\t\t\telse\n\t\t\t\t\"Oh no. That email couldn't be delivered\"\n\t\t\tend\n\n\t\telsif service == \"mailgun\"\n\t\t\tself.class.base_uri \"https://api.mailgun.net/v3/sandboxaebea391c02a4a0494ab285e2adf8170.mailgun.org\"\n\t\t\tself.class.basic_auth 'api', ENV.fetch(\"MAILGUN_API_KEY\")\n\t\t\tresponse = self.class.post(\"/messages\", body: formatted_content)\n\t\t\tif response[\"message\"] == \"Queued. Thank you.\"\n\t\t\t\t\"Yay! Your email is on it's way!!\"\n\t\t\telse\n\t\t\t\t\"Oh no. That email couldn't be delivered\"\n\t\t\tend\n\t\tend\n\tend",
"def delivered(order)\n @order = order\n\n mail to: order.email, subject: \"Your order is ready\"\n end",
"def deliver\n Outbound.deliver(delivery_options.merge(:conditions => ['sms_service_provider_id = ?', self.provider_id]))\n end",
"def deliver\n #find all the abonnes emails\n @abonnes = Abonne.all.collect(&:email)\n # Sends the newsletter to each one\n @abonnes.each do |abonne|\n NewsletterMailer.deliver_newsletter(abonne, self)\n end\n # Set the delivered_at time to now\n self.update_attribute(:delivered_at, Time.now)\n end",
"def send_email(email)\n email.deliver_now\n end",
"def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end",
"def deliver_email(mail)\n if mail.respond_to?(:deliver_later)\n mail.deliver_later\n else\n mail.deliver\n end\n end",
"def deliver\r\n mandrill = Mandrill::API.new(api_key)\r\n mandrill.messages.send(message, async, ip_pool, send_at)\r\n end",
"def email\n\t\temail_response = EmailHandler.new(email_content).deliver_email\n\t\t\trender text: email_response + \"\\n\"\n\tend",
"def send_confirmation_email\n BetaMailer.send_beta_confirmation_email(self).deliver_later\n end",
"def tickets_purchased_mail\n UserMailer.tickets_purchased(self).deliver_now\n end",
"def attempt_delivery\n send(EmailProxy.provider)\n end",
"def deliver\n return false if sent?\n\n if undeliverable?\n update(status: \"not_sent\")\n return false\n end\n\n begin\n delivery_adapter.deliver(message)\n update(status: 'sent', sent_at: Time.zone.now)\n rescue Net::SMTPFatalError => e\n handle_smtp_error(e)\n rescue StandardError => e\n update(status: 'failed')\n raise e\n end\n end",
"def after_deliver\n # Send email to giftor, if this order was a gift, so that he knows it has been delivered to the giftee\n Spree::OrderMailer.giftor_delivered_email(self.order).deliver() if (self.order.is_gift? && !Spree::MailLog.has_email_been_sent_already?(self.order, 'Order::giftor_delivered_email'))\n end",
"def deliver_now\n message.deliver\n end",
"def order_delivered\n @user, @order = params[:user], params[:order]\n mail(to: @user.email, subject: \"Order delivered!\")\n end",
"def deliver!(mail)\n attributes = email_attributes(mail)\n mail.destinations.each do |destination|\n ArMailerRevised.email_class.create!(attributes.merge({:to => destination}))\n end\n end",
"def deliver_email\n error = \"We forgot to define #{type}#deliver_email.\\n\"\n # Failing to send email should not throw an error in production\n return warn(error) if Rails.env.production?\n\n raise(error)\n end",
"def host_confirmation\n \t#binding.pry\n \tSendMailToHost.host_confirmation(self).deliver!\n end",
"def after_deliver; end",
"def deliver_now!\n message.deliver!\n end",
"def email\n options = { :from => params[:email], :to => \"[email protected]\", :subject => params[:subject], :body => \"From: #{params[:user]} <#{params[:email]}>\\r\\nCategory: #{params[:category]}\\r\\nSubject:#{params[:subject]}\\r\\n\\r\\n#{params[:body]}\"}\n RequestMailer.deliver_generic(options)\n flash[:notice] = \"Your email was sent successfully\"\n redirect_to params[:redirect]\n end",
"def deliver!(mail)\n # check validity\n check_delivery_params(mail)\n validate!(mail)\n\n create_factory()\n\n persist_email(mail)\n\n chain_delivery(mail)\n end",
"def send_orders_email\n UserMailer.orders(self).deliver_now\n end",
"def send_email\n InquiryMailer.inquiry_created_email(self).deliver\n end",
"def perform(email)\n UserMailer.welcome_email(email.to_s).deliver\n end",
"def deliver\n User.all.each do |user|\n UserMailer.send_message(user,self).deliver\n end\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 deliver(params={})\n puts \"**** Message#deliver\" if params[:verbose]\n#puts \"**** Message#deliver response_time_limit=#{self.response_time_limit}\"\n save! if self.new_record?\n deliver_email() if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway] || default_sms_gateway) if send_sms\n end",
"def email\n return unless can_be_emailed\n\n OfferMailer.email_contract(@offer).deliver_now!\n\n if @offer.provisional?\n # If the assignment has not been sent before, set status to pending\n @offer.pending!\n else\n # If the assignment has been sent before, make sure the emailed date gets updated.\n @offer.emailed_date = Time.zone.now\n @offer.save!\n end\n render_success @offer\n end",
"def notify_email\n begin\n QuoteMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send quote email notification. #{e.message}\")\n end\n end",
"def send_by_email\n AccountMailer.send_by_email(@account, APP_CONFIG['password_to']).deliver\n respond_to do |format|\n format.html { redirect_to(@account,\n :notice => \"Successfully sent email to #{APP_CONFIG['password_to']}\") }\n end\n end",
"def send!\n raise \"job #{job.backup_id} has no email option\" unless job.options[:email]\n # define local variables for closure over Mail.new\n from_address = settings['email_from']\n to_address = job.options[:email]\n subject_text = \"Backup of RDS #{job.rds_id} (job ID #{job.backup_id})\"\n body_text = body\n mail = Mail.new do\n from from_address\n to to_address\n subject subject_text\n body \"#{body_text}\\n\"\n end\n mail.deliver!\n end",
"def deliver(*params)\n type = ((resource_type == \"TaskNotification\") ? \n (resource.resource.nil? ?\n resource_type.underscore : \n resource.resource_type.underscore) : \n resource_type.underscore)\n begin\n Mailer.send \"deliver_#{type}\", target_user, params[0]\n rescue\n Mailer.send \"deliver_#{type}\", target_user\n end\n \n update_attribute(:delivered_at, Time.now)\n end",
"def easy_safe_deliver\n EasyJob::MailerTask.perform_async(message)\n end",
"def send(options)\n options[:body] ||= options[:message]\n options[:to] = self\n Origen.mailer.send_email(options)\n end",
"def shipped(order)\r\n @order = order\r\n mail to: order.email, subject: 'Заказ из Pragmatic Store отправлен'\r\n end",
"def deliver\n options = {\n notification: self,\n output: output\n }\n\n notifier = eval(notifier_strategy).new( options )\n notifier.deliver\n\n self.completed_at = DateTime.now\n self.save\n end",
"def deliver_email_confirmation!(controller)\n reset_email_token!\n if block_given?\n yield\n else\n name = self.class.confirmation_mailer_class.to_s\n klass = name.split('::').inject(Object) do |mod, klass|\n mod.const_get klass\n end\n klass.send(self.class.confirmation_mailer_method, self, controller).deliver_now\n end\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 deliver_failed\n OrdersMailer.deliver_failed(self)\n end",
"def email(options)\n puts \"sending to #{options}\"\n Pony.mail(BASE_EMAIL.merge(options))\n end",
"def order_received(order)\n@order=order\nmail(:to => order.email, :subject => 'Pragmatic Toy Shop Order Confirmation')\nend",
"def send_email\n return true unless RunLevel.is_normal?\n\n log_msg = \"SEND #{flavor} \" \\\n \"from=#{user&.login || \"nil\"} \" \\\n \"to=#{to_user&.login || \"nil\"} \" +\n queued_email_integers.map { |x|\n \"#{x.key}=#{x.value}\"\n }.join(\" \") +\n queued_email_strings.map do |x|\n \"#{x.key}=\\\"#{x.value}\\\"\"\n end.join(\" \")\n self.class.debug_log(log_msg)\n current_locale = I18n.locale\n result = false\n if user.present? && user == to_user\n unless Rails.env.test?\n raise(\"Skipping email with same sender and recipient: #{user.email}\\n\")\n end\n else\n result = deliver_email\n end\n I18n.locale = current_locale\n result\n rescue StandardError => e\n warn(\"ERROR CREATING EMAIL\")\n warn(log_msg)\n warn(e)\n warn(e.backtrace)\n I18n.locale = current_locale\n false\n end",
"def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end",
"def deliver_to_file\n @deliver_to_file\n end",
"def send_email\n # There is a deliver_later method which we could use\n InvoiceMailer.email_invoice(self).deliver_now\n self.sent_by_email = true\n self.save\n end",
"def perform_deliveries\n @asq.deliveries.each(&:deliver)\n end",
"def send_newsletter_email\n UserMailer.newsletter_confirmation(self).deliver_later\n end",
"def order_received\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def deliver(mail_type, clean = true)\n clean() if clean\n self.save()\n self.recipients.each do |r|\n delivery = Delivery.new(\n :message => self,\n :conversation => self.conversation,\n :mail_type => mail_type.to_s,\n :user => r\n )\n r.deliveries << delivery\n end\n end",
"def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"[email protected]\"] )\n \n end",
"def deliver!(message)\n send_opts = {}\n send_opts[:raw_message] = {}\n send_opts[:raw_message][:data] = message.to_s\n\n if message.respond_to?(:destinations)\n send_opts[:destinations] = message.destinations\n end\n\n @client.send_raw_email(send_opts)\n\n end",
"def purchase_email\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\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 deliver\r\n raise NotImplementedError.new(\"#{self.class.name}#deliver is not implemented.\")\r\n end",
"def shipped\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def shipped(order)\n @order = order\n mail to: order.email, subject: 'Заказ из Card Shop отправлен'\nend",
"def completed(order)\n @order = order\n\n mail :to => order.billing_address.email\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Envío de compra Farmacia Zi'\n end",
"def send_enquiry\r\n EnquiryMailer.submit_enquiry(self).deliver_now \r\n end",
"def send_email\n BoardMailer.email_community_board(self).deliver\n end",
"def deliver(options={})\n options||={}\n deliver_method = options.delete(:bang) ? :deliver! : :deliver\n\n error_messages = outbounds.inject([]) do |error_messages, o|\n next(error_messages) if o.delivered?\n unless o.send(deliver_method, options)\n error_messages << \"Message could not be delivered to: #{o.phone_number.human_display}\"\n end\n error_messages\n end\n \n self.update_attribute(:status, error_messages.blank? ? 'PROCESSED' : 'FAILED')\n error_messages.each { |msg| errors.add_to_base(msg) }\n error_messages.blank?\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Shipped'\n end",
"def deliver!(message)\n send_opts = {}\n send_opts[:raw_message] = {}\n send_opts[:raw_message][:data] = message.to_s\n\n if message.respond_to?(:destinations)\n send_opts[:destinations] = message.destinations\n end\n\n @client.send_raw_email(send_opts)\n end",
"def deliver_to_queue\n @deliver_to_queue\n end",
"def send_email(user)\n\t UserMailer.activate_email(user).deliver\n\tend",
"def order_received(user)\n@user = user\nActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :subject => \"Adding new product\", :body => \"the product is added into the list\").deliver\nend",
"def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end",
"def deliver\n APN::Notifications.deliver([self])\n end",
"def alert_sender\n InvitationMailer.mail_sender(self).deliver\n end",
"def send_email\n AlertNotifier.delay.email_zero_inventory(self)\n end",
"def completed\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def received(order)\n @order = order\n mail to: order.email, subject: 'Подтверждение заказа в Card Shop'\nend",
"def received(order)\r\n @order = order\r\n mail to: order.email, subject: 'Подтверждение заказа в Pragmatic Store'\r\n end",
"def resend\n @pirateMail = PirateMail.find(params[:id])\n\n UserMailer.with(pirate_mail: @pirateMail).welcome_email.deliver_now \n end",
"def shipped(order)\n @order = order \n\n mail to: order.email, subject: 'justEat Order Shipped'\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"
] | [
"0.809183",
"0.76478827",
"0.74085903",
"0.71882033",
"0.71494883",
"0.7104018",
"0.70324254",
"0.7023609",
"0.69787526",
"0.6946056",
"0.6931979",
"0.69247293",
"0.69140005",
"0.69102436",
"0.69079274",
"0.6897841",
"0.6883508",
"0.68639386",
"0.68612206",
"0.68485165",
"0.6801308",
"0.6788271",
"0.6769169",
"0.67495275",
"0.6744804",
"0.6720287",
"0.6701541",
"0.6694751",
"0.669124",
"0.6685348",
"0.66852593",
"0.6675711",
"0.66669184",
"0.666358",
"0.6643206",
"0.661957",
"0.66169184",
"0.6615108",
"0.66099066",
"0.6587454",
"0.6574792",
"0.6566815",
"0.6551855",
"0.6551517",
"0.6524192",
"0.6518004",
"0.65155596",
"0.64990205",
"0.64806163",
"0.64600545",
"0.6459374",
"0.64500564",
"0.64383227",
"0.64299434",
"0.642209",
"0.6411289",
"0.6404152",
"0.6399548",
"0.6396921",
"0.6389556",
"0.638466",
"0.6375579",
"0.63727385",
"0.6369274",
"0.63685876",
"0.6365308",
"0.63615054",
"0.63613033",
"0.63601357",
"0.6354037",
"0.63530695",
"0.6349251",
"0.63436866",
"0.63421744",
"0.6333508",
"0.63287246",
"0.63268757",
"0.6325069",
"0.6322605",
"0.6317447",
"0.6314603",
"0.6311944",
"0.6306381",
"0.6298482",
"0.6290654",
"0.6288082",
"0.62831056",
"0.6277964",
"0.62761486",
"0.6274903",
"0.6274015",
"0.62694865",
"0.6269092",
"0.62629485",
"0.62613046",
"0.62604284",
"0.6254252",
"0.62541723",
"0.62541723",
"0.62541723"
] | 0.6301469 | 83 |
Try to returns the best directory path to dump the database. | def best_dumps_path
if database.via_ssh?
return main_storage.path if same_ssh_as_database?(main_storage)
else
return main_storage.path if main_storage.local?
end
Dir.tmpdir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_directory\n File.join(@relative_to_base, DUMP_DIRECTORY_NAME)\n end",
"def dump_path\n dump = {:postgresql => 'pg_dump',:mysql => 'mysqldump'}\n # Note: the 'mysqldump_path' config option is DEPRECATED but keeping this in for legacy config file support\n @fu_conf[:mysqldump_path] || @fu_conf[:dump_path] || dump[@db_conf[:adapter].intern]\n end",
"def dump_directory\n @relative_location.end_with?('/') ? @relative_location + DUMP_DIRECTORY_NAME : @relative_location + '/' + DUMP_DIRECTORY_NAME\n end",
"def schema_dump_path\n File.join ARTest::SQLServer.root_activerecord, \"test/assets/schema_dump_5_1.yml\"\n end",
"def backupDir\n\t\tdataDir = self.dataDir\n\t\tif (dataDir.nil? || dataDir.empty? || dataDir[\"/var/pgsql\"])\n\t\t\treturn BACKUP_DIR\n\t\tend\n\t\treturn dataDir.sub(/Data\\z/, \"Backup\")\n\tend",
"def absolute_db_path\n pn = Pathname.new(__FILE__)\n install_dir = pn.dirname.parent.parent.to_s + Pathname::SEPARATOR_LIST\n install_dir + @storage_location + @database_name\n end",
"def dump_directory\n \"--out='#{ dump_path }'\"\n end",
"def dump_directory\n \"--out='#{ @dump_path }'\"\n end",
"def db_path\n @db\n end",
"def schema_dump_path\n File.join ASSETS_ROOT, \"schema_dump_5_1.yml\"\n end",
"def db_root\n dataroot.join(\"db\").tap { |p| p.mkpath unless p.exist? }\n end",
"def db_migrate_path\n database_name = MultiAR::MultiAR::databases.first[0]\n MultiAR::MultiAR::solve_migration_path database_name\n end",
"def create_database_dir_if_necessary\n dirname = File.dirname(self.database_path)\n if !Dir.exists?(dirname)\n FileUtils.mkpath(dirname)\n end\n end",
"def dump_filename\n @dump_filename ||= begin\n unless database_id\n if model.databases.select {|d| d.class == self.class }.count > 1\n sleep 1; @database_id = Time.now.to_i.to_s[-5, 5]\n Logger.warn Errors::Database::ConfigurationError.new(<<-EOS)\n Database Identifier Missing\n\n When multiple Databases are configured in a single Backup Model\n that have the same class (MySQL, PostgreSQL, etc.), the optional\n +database_id+ must be specified to uniquely identify each instance.\n e.g. database MySQL, :database_id do |db|\n This will result in an output file in your final backup package like:\n databases/MySQL-database_id.sql\n\n Backup has auto-generated an identifier (#{ database_id }) for this\n database dump and will now continue.\n EOS\n end\n end\n\n self.class.name.split('::').last + (database_id ? \"-#{ database_id }\" : '')\n end\n end",
"def build_db_name\n return Cfg.database_dir+DB_FILE_NAME\n end",
"def db_file\n self.class.db_root.join(id) if id\n end",
"def filepath(root=ROOT)\n File.expand_path(Time.now.strftime(\"#{root}/%Y/%m%B.sql\"))\n end",
"def db_migration_dirname(export_type = nil)\n loc = app_type_name || db_migration_schema\n dirname = \"db/app_migrations/#{loc}\"\n dirname += \"--#{export_type}\" if export_type\n dirname\n end",
"def db_migration_failed_dirname\n 'db/app_migrations/failed'\n end",
"def path\n @options[:database_path]\n end",
"def path\n @options[:database_path]\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def best_local_dumps_path\n spare_storage && spare_storage.local? ? spare_storage.path : Dir.tmpdir\n end",
"def ext_db_path; end",
"def ext_db_path; end",
"def local_backup_path\n [local_directory, Confluence.filename].join('/')\n end",
"def default_database_file_path\n\t\t\t@default_database_file_path ||= 'config/event_storage.yml'\n\t\tend",
"def get_destination\n File.join(@root_path, @config['save_path'], @random_filename + \".\" + @options['exportformat'])\n end",
"def db_diff_full_pathname( data_import_session )\n # Memo-ize the filename the first time this is called:\n @db_diff_filename ||= File.join( Rails.root, 'log', \"#{ get_log_basename(data_import_session) }#{ get_log_extension(data_import_session, '.diff.sql') }\" )\n end",
"def store_dir\n %(#{Rails.root}/storage/#{model.parent.class.name.pluralize.downcase}/#{model.parent.id})\n end",
"def backup_dir\n @backup_dir ||= create_backup_dir\n end",
"def migration_dir\n return Roomer.shared_migrations_directory if shared?\n return Roomer.tenanted_migrations_directory\n end",
"def get_plugin_dir\n begin\n q = @db_connection.query('SELECT @@plugin_dir;')\n q.each { |x| @pdir=x[0]; }\n if @pdir.nil?\n q = @db_connection.query(\"SHOW VARIABLES LIKE 'basedir';\")\n q.each { |x| @pdir=x[1]; }\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\lib\\\\\\\\plugin\\\\\\\\\"\n else\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\\"\n end\n return plugpath\n rescue Mysql::Error => e\n print_error(\"Problem determining the plugins directory!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return nil\n end\n end",
"def destination_path\n File.expand_path File.join(options[:root], destination) unless destination.nil?\n end",
"def store_dir\n prepend1 = model.id.to_s.split('')[8].to_s\n prepend12 = \"#{model.id.to_s.split('')[0].to_s}#{model.id.to_s.split('')[1].to_s}#{model.id.to_s.split('')[2].to_s}\"\n prepend34 = \"#{model.id.to_s.split('')[3].to_s}#{model.id.to_s.split('')[4].to_s}#{model.id.to_s.split('')[5].to_s}\"\n prepend56 = \"#{model.id.to_s.split('')[6].to_s}#{model.id.to_s.split('')[7].to_s}#{model.id.to_s.split('')[8].to_s}\"\n \n case prepend1\n when \"1\", \"5\", \"9\", \"c\"\n \"/mnt/fs/a1/portrait/#{prepend12}/#{prepend34}/#{prepend56}\"\n when \"2\", \"6\", \"0\", \"d\"\n \"/mnt/fs/a2/portrait/#{prepend12}/#{prepend34}/#{prepend56}\"\n when \"3\", \"7\", \"a\", \"e\"\n \"/mnt/fs/a3/portrait/#{prepend12}/#{prepend34}/#{prepend56}\"\n when \"4\", \"8\", \"b\", \"f\"\n \"/mnt/fs/a4/portrait/#{prepend12}/#{prepend34}/#{prepend56}\"\n end\n end",
"def storage_path\n return Neo4j::Config.storage_path unless db.running?\n db.storage_path\n end",
"def store_dir\n Rails.root.join('data', model.data_dir, model.id.to_s)\n end",
"def find_db\n log_debug\n file_name = 'com.plexapp.plugins.library.db'\n # for dev it looks in current directory first\n # can add locations as we find them. only the first match is used\n paths = [ '.',\n '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases',\n \"#{ENV['HOME']}/Library/Application Support/Plex Media Server/Plug-in Support/Databases\"\n ]\n db = ''\n \n paths.each do |path|\n if File.directory? path\n if File.exists? \"#{path}/#{file_name}\"\n # first match is used\n if db == ''\n db = \"#{path}/#{file_name}\"\n end\n end\n end\n end\n \n if db !~ /\\w/\n puts \"error : could not find db file \\\"#{file_name}\\\" \"\n exit 2\n end\n \n log_debug \"find_db using \\\"#{db}\\\"\"\n return db\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def store_dir\n #\"documentos/#{model.document_album.escuela_transporte.razonSocial.gsub(\" \",\"_\").mb_chars.normalize(:kd).gsub(/[^x00-\\x7F]/n, '').to_s.upcase.gsub(/[^a-zA-Z0-9_-]/,\"\")}/#{model.document_album.nombre.upcase}/#{model.nombre}\"\n model.document_path\n end",
"def create_link_to_dummy_directory\n FileUtils.ln_sf(\"#{destination_root}/db\", Rails.root.join('db'))\n end",
"def store_dir\n if model[\"#{mounted_as}\"]\n fname = model[\"#{mounted_as}\"]\n else\n fname = self.filename\n end\n p1,p2 = fname[0,1],fname[1,1]\n [model.class.to_s.underscore,p1,p2].join(\"/\")\n end",
"def store_dir\n File.join(model.class.to_s.underscore.pluralize, model.id.to_s, mounted_as.to_s)\n end",
"def path\n case database\n when 'MEDLINE', 'WOS'\n '/REC/static_data/fullrecord_metadata/abstracts/abstract/abstract_text'\n else\n logger.error(\"Unknown WOK database: #{database}\")\n nil\n end\n end",
"def store_dir\n \"#{model.class.to_s.pluralize.parameterize}/#{model.id}/\"\n end",
"def path\n s = lib.tcidbpath( @db )\n return File.expand_path( s ) if s\n end",
"def safe_dir\n options[:root_dir] / name.to_s\n end",
"def store_dir\n \"#{model.class.to_s.underscore}\"\n end",
"def store_dir\n File.join Rails.root, root_dir, model_dir, partition_dir\n end",
"def storage_path\n return nil unless db.running?\n db.storage_path\n end",
"def dump(path)\n infobase.designer do\n dumpDBCfg path\n end.run.wait.result.verify!\n path\n end",
"def db_name\n\treturn File.basename($0, \".*\") + \"_db.yml\"\nend",
"def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end",
"def get_plugin_dir(dbc)\n begin\n q = dbc.query('SELECT @@plugin_dir;')\n q.each { |x| @pdir=x[0]; }\n if @pdir.nil?\n q = dbc.query(\"SHOW VARIABLES LIKE 'basedir';\")\n q.each { |x| @pdir=x[1]; }\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\lib\\\\\\\\plugin\\\\\\\\\"\n else\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\\"\n end\n return plugpath\n rescue Mysql::Error => e\n puts \"Problem determining the plugins directory\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n puts \"Sorry, can't continue without this piece\".light_red + \"....\\n\\n\".white\n exit 666;\n end\nend",
"def store_dir\n \"#{model.guid}\"\n end",
"def store_dir\n consecutivo = \"#{model.consecutivo}\"\n if consecutivo.nil?\n consecutivo = Design.all.count.to_s\n end\n \"uploads/#{mounted_as}/\"+consecutivo\n end",
"def store_dir\n path = \"cliente/#{model.id}/logomarca\"\n\n # if Rails.env.development?\n # path = \"development/#{path}\"\n # end\n\n path\n end",
"def store_dir\n File.join(OpenInvoice.config.dir_prefix,\n model.class.to_s.underscore,\n mounted_as.to_s,\n model&.id.to_s)\n end",
"def destination_path\n @destination_path ||= Pathname.new(self.destination_root)\n end",
"def dumpFilename\n DumpDir + '/' + @name + '-' + dateMark\n end",
"def store_dir\n \"uploads/screenshots/2014/04/#{model.id}\"\n end",
"def create_default_databases()\n # Create subfolder for databases if needed.\n dir = \"./databases\"\n Dir.mkdir(dir) unless Dir.exist?(dir)\n # TODO: sanity check: if db-file exist, create copy first, make sure the\n # name of the copy makes it highly unlikely to match an already existing\n # file, e.g. current epoch.\n # TODO: Create DBs\nend",
"def dump_file_path(category = 'requests')\n raise '@dump_dir variable required' if !@dump_dir\n \"#{@dump_dir}/#{category}\"\n end",
"def store_dir\n path = []\n if !model.subject.nil?\n path.push(model.subject.class.name.demodulize.to_s.underscore)\n path.push(model.subject.id.to_s)\n end\n path.push(model.class.name.demodulize.to_s.underscore)\n path.push(model.id)\n return path.join('/')\n end",
"def given_destination\n dir\n end",
"def store_dir\n \"sites/#{model.site_id}/#{model.class.to_s.pluralize.underscore}/#{model.id}\"\n end",
"def destination_path\n staged_path\n end",
"def store_dir\n type = ActiveSupport::Inflector.underscore(model.class.to_s)\n \"#{HasMedia.directory_path}/#{type}/#{model.sha1}/#{model.id.to_s}\"\n end",
"def destination_root\n File.expand_path(options[:dest])\n end",
"def store_dir\n File.join STORE_DIR, \"#{model.id}\"\n end",
"def destination(base_directory); end",
"def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end",
"def local_backup_path\n local_path\n end",
"def down_dirs\n @down_dirs || DbTasks::Config.default_down_dirs\n end",
"def base_dir\r\n datastore['WritableDir']\r\n end",
"def name\n db_name = URI.parse(uri(self)).path.to_s.sub(\"/\", \"\")\n db_name.blank? ? database : db_name\n end",
"def spool_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'spool'))\n end",
"def db_treasures_found_path\r\n db_path(\"treasures\")\r\n end",
"def up_dirs\n @up_dirs || DbTasks::Config.default_up_dirs\n end",
"def destination_dir_pathname\n Pathname(ARGV[1])\n end",
"def get_db\n # we want to check a couple levels 2011-09-28 \n unless @db\n unless File.exists? @file\n 3.times do |i|\n @file = \"../#{@file}\"\n break if File.exists? @file\n end\n end\n end\n @db ||= DB.new @file\n end",
"def store_dir\n if model.class.name == 'Monologue::Post'\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n else\n \"uploads/#{model.imageable.class.name}/#{mounted_as}/#{model.id}\"\n end\n end",
"def store_dir\n #if model.nil?\n # return \"testdir\"\n #else\n Digest::MD5.hexdigest(model.owner + model.timestamp.to_s + model.data)\n #Digest::MD5.hexdigest(model.teacher.id.to_s + model.size.to_s + model.data.to_s)\n #end\n end",
"def path\r\n if Api.method_defined?(:proj_context_get_database_path)\r\n Api.proj_context_get_database_path(self.context)\r\n end\r\n end",
"def remote_backup_path\n [remote_directory, Confluence.filename].join('/')\n end",
"def ext_db_path=(_arg0); end",
"def ext_db_path=(_arg0); end",
"def store_dir\n consecutivo = \"#{model.consecutivo}\"\n if consecutivo.nil?\n consecutivo = Design.all.count.to_s\n end\n print \"\\nmodel.preid\\n\"\n print model.id\n print \"\\nmodel.id\\n\"\n print consecutivo+\"gdgdfgfd\\n\"\n print \"uiiuiuiuploads/#{model.class.to_s.underscore}/\"+consecutivo+\"/#{mounted_as}\"\n \"uploads/#{model.class.to_s.underscore}/\"+consecutivo+\"/#{mounted_as}\"\n end",
"def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end",
"def get_job_directory(job_id)\n top_directory = find_option(/d|directory/)\n if not top_directory or top_directory == true\n top_directory = DEFAULTS[:out_directory]\n end\n return File.join(top_directory, job_id.to_s)\nend",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end",
"def store_dir\n\n \"#{model.publication.product_code}/#{model.product_id}\"\n end",
"def output_directory_path\n if @output_directory.nil?\n directory = File.join(Rails.root, 'script')\n else\n directory = File.join(@output_directory, \"\")\n end\n directory\n end",
"def output_directory_path\n if @output_directory.nil?\n directory = File.join(Rails.root, 'script')\n else\n directory = File.join(@output_directory, \"\")\n end\n directory\n end",
"def store_dir\n \"uploads/screenshots/#{model.id}\"\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def to_dir\n @dst_dir\n end",
"def base_path\n Settings.form526_backup.url\n end"
] | [
"0.698278",
"0.6739662",
"0.6721679",
"0.6646991",
"0.6597641",
"0.6452779",
"0.63014305",
"0.6282399",
"0.6281804",
"0.6267054",
"0.62249774",
"0.61648196",
"0.60731304",
"0.6046728",
"0.60163337",
"0.59997964",
"0.58897877",
"0.58729047",
"0.5867233",
"0.58663917",
"0.58663917",
"0.5854188",
"0.5841558",
"0.582143",
"0.582143",
"0.58009326",
"0.579764",
"0.5702201",
"0.5636578",
"0.562534",
"0.56207585",
"0.56148446",
"0.5603797",
"0.5597798",
"0.55963117",
"0.55881137",
"0.5586639",
"0.5581732",
"0.5580654",
"0.5579885",
"0.55724525",
"0.5562113",
"0.5547658",
"0.5540695",
"0.55377626",
"0.5510527",
"0.54869646",
"0.54506797",
"0.54473567",
"0.5437842",
"0.54307073",
"0.54172105",
"0.5413361",
"0.5408589",
"0.5408302",
"0.5390112",
"0.53743017",
"0.53721136",
"0.53672177",
"0.53610486",
"0.5351162",
"0.53495556",
"0.5333199",
"0.5328704",
"0.5324412",
"0.53207123",
"0.53200305",
"0.5307937",
"0.529164",
"0.5288757",
"0.527521",
"0.52656037",
"0.5261773",
"0.5250324",
"0.5245144",
"0.522857",
"0.52268904",
"0.5223972",
"0.52229077",
"0.5220194",
"0.52173424",
"0.52172416",
"0.5207985",
"0.52031285",
"0.5200725",
"0.5198011",
"0.5194504",
"0.51932365",
"0.51904714",
"0.51883894",
"0.518336",
"0.51795655",
"0.5179042",
"0.51749855",
"0.51749855",
"0.5170954",
"0.51663345",
"0.51663345",
"0.51588786",
"0.51537955"
] | 0.718354 | 0 |
Try to returns the best local directory path. | def best_local_dumps_path
spare_storage && spare_storage.local? ? spare_storage.path : Dir.tmpdir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_local_dir\n return @resource[:local_dir]\n end",
"def localstate_default_directory\n default_dir = File.join( Config::CONFIG['localstatedir'], basedir )\n return default_dir if is_tyrant_root?( default_dir )\n return nil\n end",
"def ensure_local_drive_path(path, temp_dir_name)\n return path\n end",
"def ensure_local_drive_path(path, temp_dir_name)\n return path\n end",
"def _local_source(path)\n existent = ::Dir[\"#{ENV['DEV_HOME']}/*/{piktur/#{path},gems/#{path},#{path}}\"][0]\n Pathname(existent)\n end",
"def local_dir_exists?(full_path)\n File.directory?(full_path)\nend",
"def full_path_to_remote_dir\n (remote_dir[0] == ?/ ? remote_dir : \"$(pwd)/#{remote_dir}\").chomp('/')\n end",
"def resolve_path(path)\n unless Pathname.new(path).absolute?\n File.join(Dir.pwd, path)\n else\n path\n end\nend",
"def resolve_path(path)\n unless Pathname.new(path).absolute?\n File.join(Dir.pwd, path)\n else\n path\n end\nend",
"def containing_directory\n path.dirname\n end",
"def lookup_root\n pwd = File.expand_path(Dir.pwd)\n home = File.expand_path('~')\n while pwd != '/' && pwd != home\n return pwd if ROOT_INDICATORS.any?{ |r| File.exist?(File.join(pwd, r)) }\n pwd = File.dirname(pwd)\n end\n return nil\n end",
"def resolvePath(possiblyRelativePath, rootDir)\n\t\tpath = Pathname.new(possiblyRelativePath)\n\t\tif(path.absolute?()) then\n\t\t\treturn path.to_s()\n\t\telse\n\t\t\trootPath = Pathname.new(rootDir)\n\t\t\treturn rootPath.join(path)\n\t\tend\n\tend",
"def source_is_local?\n File.directory?(@source)\n end",
"def local_to_remote local\n local.match /#{config[:relative_dir_regex]}/\n subdir = $2\n basename = File.basename local\n File.join(config[:root_dir], subdir, basename)\n end",
"def ensure_local_drive_path(path, temp_dir_name)\n homedrive = ENV['HOMEDRIVE']\n if homedrive && homedrive.upcase != path[0,2].upcase\n local_dir = ::File.join(temp_dir, temp_dir_name)\n FileUtils.mkdir_p(local_dir)\n local_path = ::File.join(local_dir, ::File.basename(path))\n if ::File.directory?(path)\n FileUtils.rm_rf(local_path) if ::File.directory?(local_path)\n FileUtils.cp_r(::File.join(path, '.'), local_path)\n else\n FileUtils.cp(path, local_path)\n end\n path = local_path\n end\n return path\n end",
"def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end",
"def getFsPath(path)\n if path.kind_of? Array\n if path.length == 0\n localPath = @cwd.dup\n else\n localPath = normalizePath(path[0].dup)\n end\n else\n localPath = normalizePath(path.dup)\n end\n\n dl = localPath.slice!(0..1).upcase\n raise MiqException::MiqVmMountError, \"Unknown drive letter - #{dl}\" unless (fs = @driveToFS[dl])\n return fs, localPath\n end",
"def local_path\n TMP_PATH\n end",
"def __detect_project_home__(path, li = '.lithium')\n path = File.expand_path(path)\n prev_path = nil\n while path && prev_path != path\n marker = File.join(path, li)\n break if File.directory?(marker) && File.exists?(marker)\n prev_path = path\n path = File.dirname(path)\n end\n return path != prev_path ? path : nil\nend",
"def getWorkingDir\n if(@workingDir != nil)\n return @workingDir\n end\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"def parent_directory\n File.dirname(@full_path).split('/').last\n end",
"def parent_directory\n File.dirname(@full_path).split('/').last\n end",
"def getWorkingDir\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"def path_dir\n File.split(path).first\n end",
"def default_directory\n defaults = [ self.cwd_default_directory,\n self.env_default_directory,\n self.localstate_default_directory ]\n dd = nil\n loop do\n dd = defaults.shift\n break if dd or defaults.empty?\n end\n raise Error, \"No default Tyrant Manager home directory found\" unless dd\n return dd\n end",
"def default_or_home_directory\n hd = TyrantManager.home_dir\n begin\n hd = TyrantManager.default_directory\n rescue => e\n # yup, using home\n end\n return hd\n end",
"def find_root_path(path)\n return nil if path.nil?\n filepath = File.expand_path(path)\n\n if dir_exist?(filepath)\n directory = filepath\n elsif file_exist?(filepath)\n directory = File.dirname(filepath)\n else\n return nil\n end\n\n until directory.nil?\n break if file_exist?(File.join(directory, 'metadata.json')) || file_exist?(File.join(directory, 'environment.conf'))\n parent = File.dirname(directory)\n # If the parent is the same as the original, then we've reached the end of the path chain\n if parent == directory\n directory = nil\n else\n directory = parent\n end\n end\n\n directory\n end",
"def tmp_path\n File.expand_path(@dirs.first.to_s)\nend",
"def lookup_root\n root = nil\n Dir.ascend(Dir.pwd) do |path|\n check = Dir[ROOT_GLOB].first\n if check\n root = path \n break\n end\n end\n root || Dir.pwd\n end",
"def safe_dir\n options[:root_dir] / name.to_s\n end",
"def location\n return unless exists?\n folder_pathname.relative_path_from(root_path)\n end",
"def fetch_site_file(filename=\"Gumdrop\")\n here= Dir.pwd\n found= File.file? here / filename\n # TODO: Should be smarter -- This is a hack for Windows support \"C:\\\"\n while !found and File.directory?(here) and File.dirname(here).length > 3\n here= File.expand_path here /'..'\n found= File.file? here / filename\n end\n if found\n File.expand_path here / filename\n else\n nil\n end\n end",
"def location(dir)\n\tdir = File.expand_path(dir)\n\tif !File.directory? dir\n\t\tFileUtils::mkpath(dir)\n\tend\n\treturn dir\nend",
"def getMINGWPWDPath\n makeWindowsPathIntoMinGWPath Dir.pwd\nend",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def lookup_path(path, dir)\n dir = ::File.expand_path(dir)\n top = ::File.expand_path(wiki.path)\n home = ::File.expand_path('~')\n\n loop do\n found = Dir[::File.join(dir, path)].first\n return found if found\n return nil if dir == top\n return nil if dir == home # just in case\n return nil if dir == '/' # doubly so\n dir = ::File.dirname(dir)\n end\n end",
"def fetch_path(start_path)\n ['', 'config'].each do |directory|\n ['', '.'].each do |prefix|\n path = File.join(start_path, directory, \"#{prefix}#{@file_name}\")\n return path if File.exist?(path)\n end\n end\n nil\n end",
"def shorten2(path)\n p = get(path)\n home = Pa.home2\n\n return p if home.empty?\n\n ret = relative_to2(p, home)\n\n if ret == p\n p\n else\n ret == \".\" ? \"\" : ret\n File.join(\"~\", ret)\n end\n end",
"def git_root_till_home\n Pathname.new(Dir.pwd).ascend do |dir_pathname|\n return dir_pathname if File.directory?(\"#{dir_pathname}/.git\")\n return nil if dir_pathname.to_s == home_dir\n end\n end",
"def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end",
"def relative_path\n @local_path.relative_path_from(@platform.local_path)\n end",
"def is_local_path(path)\n (path =~ /^.:(\\/|\\\\)/)\nend",
"def current_dir; end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def local_path\n @io.local_path\n end",
"def find_exist_first_file\n if !(local_webs = ENV[\"APP_LOCAL_WEBS\"].split.find_all { |dir| File.basename(dir) == params[:level1] }).empty?\n File.join(local_webs.first, \"index.html\")\n else\n params_path = params.map(&:first).grep(/level/).sort.map(¶ms.method(:fetch)).join(\"/\")\n ENV[\"APP_LOCAL_WEBS\"].split.concat([ENV[\"APP_ROOT_PATH\"]])\n .map { |dir| File.join(dir, params_path) }\n .find_all(&File.method(:file?)).first\n end\n end",
"def find_existing(path)\n until File.directory?(path)\n path = File.dirname(path)\n end\n path\n end",
"def getMINGWPWDPath()\n makeWindowsPathIntoMinGWPath Dir.pwd\nend",
"def getRealPath(path) Pathname.new(path).realpath.to_s; end",
"def getRealPath(path) Pathname.new(path).realpath.to_s; end",
"def canonical_path(path)\n if Gem.win_platform?\n raise PDK::CLI::FatalError, format(\"Cannot resolve a full path to '%{path}', as it does not currently exist.\", path: path) unless PDK::Util::Filesystem.exist?(path)\n\n PDK::Util::Windows::File.get_long_pathname(path)\n else\n PDK::Util::Filesystem.expand_path(path)\n end\n end",
"def dir\n @dir ||= File.dirname(fullpath)\n end",
"def temp_dir\n if @temp_dir.nil?\n @@get_temp_dir_api = Win32::API.new('GetTempPath', 'LP', 'L') unless @@get_temp_dir_api\n buffer = 0.chr * MAX_PATH\n @@get_temp_dir_api.call(buffer.length, buffer)\n @temp_dir = pretty_path(buffer.unpack('A*').first.chomp('\\\\'))\n end\n rescue\n @temp_dir = File.join(Dir::WINDOWS, \"temp\")\n ensure\n return @temp_dir\n end",
"def subdir\n if core_project? or 'profile' == proj_type\n return @local_path.parent.relative_path_from(@platform.local_path + (proj_type + 's'))\n else\n return @local_path.parent.relative_path_from(@platform.local_path + @platform.contrib_path + (proj_type + 's'))\n end\n end",
"def find_directory(working_directory, cache_directory)\n directory = working_directory + \"/\" + cache_directory\n return directory if File.exists?(directory)\n parent_directory = File.dirname(working_directory)\n return nil if parent_directory == working_directory\n return find_directory(parent_directory, cache_directory)\n end",
"def dir\n url[-1, 1] == '/' ? url : File.dirname(url)\n end",
"def dirname_up(path)\n path =~ /(.*)\\\\(.*)$/\n\n return $1 || path\n end",
"def local_file_path\n afilePath = building.local_path + SAVE_PATH + id.to_s\n\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix\n end\n\n afilePath \n end",
"def local_backup_path\n [local_directory, Confluence.filename].join('/')\n end",
"def get_full_path(sub_path)\n File.join(Dir.pwd, sub_path)\nend",
"def source_dir_of(selection)\n if workspace_dir?(selection)\n ws.root_dir\n elsif (pkg_set = find_package_set(selection))\n pkg_set.user_local_dir\n else\n resolve_package(selection).srcdir\n end\n end",
"def dir\n @dir ||= self.class.normalize_dir(::File.dirname(@path))\n end",
"def directory\n File.dirname @path\n end",
"def resolve_path(source, required)\n Pathname.new(source).dirname.join(required.to_str).cleanpath.to_path\n end",
"def locate_root(dir=Dir.pwd)\n dir = File.expand_path(dir)\n home = File.expand_path('~')\n while dir != home && dir != '/'\n return dir if Dir[File.join(dir, '{.git,.hg,.index,.gemspec,*.gemspec}')].first\n dir = File.dirname(dir)\n end\n while dir != home && dir != '/'\n return dir if Dir[File.join(dir, '{lib/}')].first\n dir = File.dirname(dir)\n end\n nil\n end",
"def canonical_path(path)\n if Gem.win_platform?\n unless File.exist?(path)\n raise PDK::CLI::FatalError, _(\"Cannot resolve a full path to '%{path}' as it does not currently exist\") % { path: path }\n end\n Puppet::Util::Windows::File.get_long_pathname(path)\n else\n File.expand_path(path)\n end\n end",
"def parent_dir path\r\n\t(File.basename File.dirname path).gsub(/\\s+/, ' ').strip\r\nend",
"def default_dir(dir)\n Pathname(dir || Pathname.getw)\n end",
"def bits_full_local_path_dl\n \"#{bits_full_local_path}.dl\"\n end",
"def blocking_path(path)\n current_path = self.path\n relative_path = '.'\n File.dirname(path).split(File::SEPARATOR).each do |segment|\n relative_path = File.join(relative_path, segment)\n current_path = File.join(current_path, segment)\n return relative_path if File.file?(current_path)\n end\n nil\n end",
"def get_fastlane_dir(path)\n Dir.glob(File.join(path, '**', 'fastlane')) do |dir|\n return File.dirname(dir)\n end\n end",
"def resolve_path(path)\n path = File.absolute_path(path) if path.start_with?('./') || path.start_with?('../')\n\n if Pathname.new(path).absolute?\n return path if File.exists?(path)\n return nil\n end\n\n @load_path.each do |load_path|\n possible_path = File.absolute_path(path, load_path)\n return possible_path if File.exists?(possible_path)\n end\n\n nil\n end",
"def cwd_default_directory\n default_dir = Dir.pwd\n return default_dir if is_tyrant_root?( default_dir )\n return nil\n end",
"def local_to_remote_url local\n local.match /#{config[:relative_dir_regex]}/\n subdir = $2\n basename = File.basename local\n File.join(config[:root_path], subdir, basename)\n end",
"def dirname() Path::Name.new(File.dirname(path)) end",
"def full_path\n look_in.each do |dir|\n extensions.each do |ext| \n path = File.join(dir, [@path, ext].join)\n if File.exists?(path) && File.file?(path)\n return path\n end\n end\n end\n return\n end",
"def local_path=(v)\n return unless v\n @local_path = Pathname.new(v)\n raise \"No absolute paths\" if @local_path.absolute?\n raise \"No dots\" if @local_path.to_s =~ /\\.\\/|\\.\\\\/\n @local_path\n end",
"def determine_common_folder\n POSSIBLE_COMMON_CORE_FOLDERS.each do |folder|\n path = File.join(File.dirname(__FILE__),'..','..',folder)\n return folder if File.directory?(path)\n end\n\n return nil\nend",
"def a_dir\n self.path.split('/')[0...-1]\n end",
"def root; Pathname(__dir__).parent; end",
"def get_dir_from_site(site_string)\n site = get_site(site_string)\n if site == nil\n # return nil or an error\n end\n site[:dir]\n end",
"def local_ls(*args)\n begin\n @model_local.clear\n path = args[0] || @parent_local\n path = dirname(path)\n @local_path.set_text(path)\n\n Dir.entries(path).each do |file|\n if FileTest.directory?(path + File::SEPARATOR + file)\n is_dir = true\n else\n is_dir = false\n end\n iter = @model_local.append\n iter[COL_DISPLAY_NAME] = GLib.filename_to_utf8(file)\n iter[COL_PATH] = path\n iter[COL_IS_DIR] = is_dir\n iter[COL_PIXBUF] = is_dir ? @folder_pixbuf : @file_pixbuf\n iter[COL_TYPE] = \"local\"\n end\n @parent_local = path\n\n # If not possible return a *warning***\n rescue ::Exception => e\n MsfDialog::Warning.new(self, \"Local Browser\", e.to_s)\n local_ls\n end\n end",
"def current path=nil\n current = `pwd`.strip + \"/\"\n if path\n current + path \n else\n current\n end\nend",
"def use(targetdir)\n if @pwdnode[\"path\"].nil?\n puts \"ERROR: The current directory has no path. We cannot find the targetdir's path\"\n else\n if targetdir.nil?\n puts \"Cannot use a NIL directory\"\n else\n #puts \"Trying to use #{targetdir} from #{@pwdnode['path']}\"\n if targetdir =~ /^\\d+$/\n #puts \"Tgtdir was an integer: #{targetdir}\"\n if targetdir.to_i > 0\n targetdir = get_pwd_hash(true)[targetdir.to_i]\n if targetdir.nil?\n puts \"Sorry, but that folder is outside the range.\"\n return nil\n end\n else\n # Choosing 0 means choose this directory\n # I guess if a negative number is chosen, then we'll just assume use .\n return @pwdnode[\"path\"]\n end\n puts \"Changed tgtdir to the real-name: #{targetdir}\"\n elsif targetdir == '.'\n # use . == use PWD\n return @pwdnode[\"path\"]\n end\n\n filelist = @pwdnode[\"file\"]\n if not filelist.nil?\n filelist.each do |f|\n if f[\"name\"] == targetdir\n #puts \"Verified, and using #{targetdir}\"\n if f[\"path\"].nil?\n # If the desired directory doesn't yet have a path, define it as the previous directory's path + the next directory's name\n f[\"path\"] = @pwdnode[\"path\"] + '/' + f[\"name\"]\n end\n return f[\"path\"]\n end\n end\n end\n end\n end\n end",
"def base_dir\n return Gem.dir unless loaded_from\n @base_dir ||= if default_gem? then\n File.dirname File.dirname File.dirname loaded_from\n else\n File.dirname File.dirname loaded_from\n end\n end",
"def dir_path\n File.expand_path(File.dirname(@path))\n end",
"def path_for(filename)\n return nil unless filename\n for dir in @dirs\n result = path_from_dir_for(dir,filename)\n return result if result\n end\n @logger.fatal(\"Failed to locate '#{filename}'\")\n return nil\n end",
"def get_local_path(url)\n path = url.sub(/^http\\:\\/\\/www\\.thoughtless\\.ca\\/dyn_img\\/[a-z0-9\\-]+\\//i, '')\n path.gsub('/', '-')\nend",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def get_local_file(fname)\n if File.exist?(@dir+'/'+fname) then\n fname = @dir+'/'+fname\n end\n return File.open(fname)\n end",
"def resolve_path(path)\n path = File.absolute_path(path) if path.start_with?('./', '../')\n\n abs_path = File.absolute_path(path)\n if path == abs_path\n path if (@load_paths_subset || File).exist?(path)\n else\n (@load_paths_subset || self).load_paths.each do |load_path|\n possible_path = File.absolute_path(path, load_path)\n\n next unless (@load_paths_subset || File).exist?(possible_path)\n # Ruby 2.5 changed some behaviors of require related to symlinks in $LOAD_PATH\n # https://bugs.ruby-lang.org/issues/10222\n return File.realpath(possible_path) if RUBY_VERSION >= '2.5'\n return possible_path\n end\n nil\n end\n end",
"def to_local(path)\n local_abs_paths = []\n path.to_s.split(/\\s+/).each do |p|\n if p =~ /^#{remote}/\n p.sub!(/^#{remote}/, '')\n p.slice!(0) if p =~ /^\\//\n p = \"#{local}/#{p}\"\n else\n if Pathname.new(p).absolute?\n # No action required\n else\n p = \"#{local}/#{p}\"\n end\n end\n local_abs_paths << p\n end\n local_abs_paths\n end",
"def local_asset_path(asset_name)\n asset_dir = ::File.join(::File.dirname(__FILE__), 'assets', '')\n path = asset_dir + asset_name\n\n # Making sure people aren't trying to escape from the base path.\n path = path.tr('\\\\', '/')\n if path.index('/../') || path[-3..-2] == '/..'\n fail Exception::NotFound, 'Path does not exist, or escaping from the base path was detected'\n end\n\n begin\n pathname = Pathname.new(path)\n asset_path = Pathname.new(asset_dir)\n if pathname.realpath.to_s.index(asset_path.realpath.to_s) == 0 && ::File.exist?(path)\n return path\n end\n rescue Errno::ENOENT\n raise Exception::NotFound, 'Path does not exist, or escaping from the base path was detected'\n end\n\n fail Exception::NotFound, 'Path does not exist, or escaping from the base path was detected'\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def directory_path\n @directory_path || Ferver::DEFAULT_FILE_SERVER_DIR_PATH\n end",
"def find_directory(name, current = Pathname.new('.'))\n raise \"Cannot find directory #{name}\" if current.expand_path.root?\n path = current + name\n current.children.include?(path) ? path.expand_path.to_s : find_directory(name, current.parent)\n end",
"def env_default_directory\n default_dir = ENV['TYRANT_MANAGER_HOME']\n return default_dir if default_dir and is_tyrant_root?( default_dir )\n return nil\n end",
"def resolve_as_directory name\n [test_dir + name, context.root + name].detect { |dir|\n dir.directory? and handle? dir\n }\n end",
"def fit_to_filesystem(candidate)\n return candidate if candidate.bytesize <= MIN_PATH_MAX\n ext = File.extname(candidate)\n base = File.basename(candidate, ext)\n tmp = Dir.tmpdir\n loop do\n begin\n candidate = base + ext\n try_file = File.join(tmp, candidate)\n FileUtils.touch try_file\n FileUtils.rm try_file\n return candidate\n rescue Errno::ENAMETOOLONG\n if base.length > 0\n base.chop!\n retry\n else\n raise\n end\n end\n end\n end"
] | [
"0.67836654",
"0.66678035",
"0.6454074",
"0.6454074",
"0.6405758",
"0.6293029",
"0.62139404",
"0.6188333",
"0.6188333",
"0.6118948",
"0.6109734",
"0.61065394",
"0.6035522",
"0.6017777",
"0.60168386",
"0.600736",
"0.59877187",
"0.59733516",
"0.5968184",
"0.5904714",
"0.5886782",
"0.5886782",
"0.58486396",
"0.58324766",
"0.5826632",
"0.5795035",
"0.57220584",
"0.5691421",
"0.56857663",
"0.56808674",
"0.56788397",
"0.56725276",
"0.56657517",
"0.56622034",
"0.565179",
"0.565179",
"0.5649372",
"0.56468",
"0.5621259",
"0.56153303",
"0.56066185",
"0.5602715",
"0.55847377",
"0.557941",
"0.55710834",
"0.5570947",
"0.55500776",
"0.5549395",
"0.55450714",
"0.5544135",
"0.5544135",
"0.5534076",
"0.55244017",
"0.55228424",
"0.5519659",
"0.55195",
"0.55075675",
"0.55050224",
"0.5503414",
"0.55024207",
"0.5501636",
"0.54946434",
"0.54885626",
"0.5486415",
"0.54817396",
"0.54788417",
"0.54701054",
"0.54683113",
"0.5461566",
"0.5459671",
"0.54510367",
"0.5449716",
"0.54492503",
"0.5448724",
"0.54377156",
"0.5436584",
"0.5435992",
"0.54238755",
"0.542004",
"0.5407819",
"0.5398376",
"0.5397726",
"0.53933305",
"0.5380857",
"0.5379963",
"0.53695685",
"0.5367523",
"0.53609306",
"0.5359883",
"0.5357112",
"0.5355739",
"0.5344945",
"0.5338374",
"0.53307176",
"0.5326028",
"0.5324895",
"0.5320303",
"0.53180593",
"0.53175205",
"0.53164136"
] | 0.5497518 | 61 |
GET /sold_tickets GET /sold_tickets.json | def index
@sold_tickets = SoldTicket.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_tickets_sold()\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end",
"def index\n respond_with(@tickets)\n end",
"def index_all\n @tickets = Ticket.all_tickets\n render json: @tickets, status: 200\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @sprint = params[:sprint].presence || Sprint.current!\n @tickets = Ticket.for_sprint(@sprint).by_created_at_desc\n @tickets = @tickets.for_project(params[:project]) if params[:project].present?\n @tickets = @tickets.for_user(params[:user]) if params[:user].present?\n @tickets = @tickets.search_name(params[:description]) if params[:description].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @title = \"Tickets\"\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = current_user.tickets.last(15).reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n\t @tickets = Ticket.order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = @event.tickets\n end",
"def total_tickets\n respond_with json_response('total_tickets', Ticket.count)\n end",
"def my_tickets\n user = current_user.id if !current_user.nil?\n # OCO\n init_oco if !session[:organization]\n\n @search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !user.blank?\n with :created_by, user\n end\n with(:ticket_status_id).less_than(4)\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n\n @tickets = @search.results\n\n respond_to do |format|\n format.html # my_tickets.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @tickets = current_user.tickets.page(params[:page]||1)\n respond_to do |format|\n format.html\n format.xml { render :xml => @tickets }\n format.json { render :json => @tickets }\n end\n end",
"def index_user\n @tickets = Ticket.all_for_user(current_user.id)\n render json: @tickets, status: 200\n end",
"def show\n # @tickets = @user.tickets\n @conditions = {user_id: @user.id, ticket_type: 1}\n @t1 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 2}\n @t2 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 3}\n @t3 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @used_tickets = UsedTicket.where(user_id: @user.id).limit(10)\n render :json => \n {\n :status => 0,\n :user => {\n :id => @user.id,\n :name => @user.name,\n :email => @user.email,\n :tickets => {\n :t1 => @t1,\n :t2 => @t2,\n :t3 => @t3,\n :used => @used_tickets\n }\n }\n }\n end",
"def index\n @tickets = get_current_user_ticket_list(@user)\n end",
"def index\n @tickets = Ticket.effectiveness\n end",
"def index\n @ticketings = Ticketing.all\n end",
"def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n # @tickets = policy_scope(Ticket)\n render json: @tickets\n end",
"def index\n @tickets = OTRS::Ticket.where(params[:q])\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @tickets }\n wants.json { render :json => @tickets }\n end\n end",
"def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n render json: @ticket\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def index\n if current_user.is? :admin\n if params[:user_id]\n @tickets = User.find(params[:user_id]).tickets.paginate(:page => params[:page])\n elsif params[:team_id]\n @tickets = Team.find(params[:team_id]).tickets.paginate(:page => params[:page])\n else\n @tickets = Ticket.paginate(:page => params[:page])\n end\n else\n @tickets = current_user.tickets.paginate(:page => params[:page])\n end\n\n if params[:status] == \"closed\"\n @tickets = @tickets.closed\n else\n @tickets = @tickets.open\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def overall_tickets\n\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n @ticket_items = TicketItem.all\n end",
"def destroy\n @sold_ticket.destroy\n respond_to do |format|\n format.html { redirect_to sold_tickets_url, notice: 'Sold ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @support_tickets = SupportTicket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_tickets }\n end\n end",
"def index\n @tickets = Ticket.where(user: current_user)\n end",
"def index\n if params[:event_id]\n @tickets = Ticket.find_all_by_event_id(params[:event_id])\n else\n @tickets = Ticket.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def show\n @tickets = @event.tickets.find(params[:id])\n end",
"def tickets_unused\n if params[:days]\n since = Time.zone.now - params[:days].to_i.days\n tickets = Ticket.where('user_id != owner_id').where(user_id: 0)\n .joins(:event)\n .where('start_time > ?', since)\n respond_with json_response('tickets_unused', tickets.count)\n else\n respond_with json_response(\n 'tickets_unused',\n Ticket.where('user_id != owner_id').where(user_id: 0).count\n )\n end\n end",
"def update\n respond_to do |format|\n if @sold_ticket.update(sold_ticket_params)\n format.html { redirect_to @sold_ticket, notice: 'Sold ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @sold_ticket }\n else\n format.html { render :edit }\n format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ticket_owners = TicketOwner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_owners }\n end\n end",
"def get_owner_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_owner(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def sold_ticket_params\n params.fetch(:sold_ticket, {})\n end",
"def create\n @sold_ticket = SoldTicket.new(sold_ticket_params)\n\n respond_to do |format|\n if SoldTicket.multi_save\n format.html { redirect_to user(current_user.id), notice: 'Sold ticket was successfully created.' }\n format.json { render :show, status: :created, location: @sold_ticket }\n else\n format.html { render :new }\n format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buy_tickets\n tally = films().map {|ticket| ticket.price.to_f}\n tally.each {|price| @wallet -= price}\n num_of_tickets\n screenings = tickets().map{|ticket| ticket.screening}\n screenings_flat = screenings.flatten\n screenings_flat.map {|screening| screening.tickets_available -= 1}\n screenings_flat.each {|screening| p screening.update }\n update()\n end",
"def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = Ticket.all\n render_default_format(@ticket, true)\n end",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def tickets(filters = {})\n tickets = send(:get , '/api/v1/ticket_reports/dynamic.json', filters)\n\n tickets = tickets[:body][\"groups\"].first[\"tickets\"]\n\n process_list_response( tickets , Unfuddled::Ticket)\n end",
"def show\n @tickets = Ticket.get_from_event @event\n end",
"def index\n tickets = Ticket.all_relevant_tickets\n @pagy, @tickets = pagy(tickets)\n ticket_records_with_associations =\n TicketSerializer.new(@tickets, { params: { :ticketlist => true } }).hash_for_collection[:data].map { | ticket |\n ticket[:attributes]\n }\n # When we need pagination lets use the below\n #render json: { data: ticket_records_with_associations,\n # pagy: pagy_metadata(@pagy) }\n paginate json: ticket_records_with_associations\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def tickets_transferred\n if params[:days]\n since = Time.zone.now - params[:days].to_i.days\n tickets = Ticket.where('user_id != owner_id').where('user_id > 0')\n .joins(:event)\n .where('start_time > ?', since)\n respond_with json_response('tickets_transferred', tickets.count)\n else\n respond_with json_response(\n 'tickets_transferred',\n Ticket.where('user_id != owner_id').where('user_id > 0').count\n )\n end\n end",
"def index\n @sells = Sell.all\n\n render json: @sells\n end",
"def index\n @ticket_events = TicketEvent.all\n end",
"def index\n @tickets = Ticket.order(id: :desc).all\n end",
"def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def index\n @tickets = Ticket.all\n @tickets_ordered \n end",
"def get_hfi_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_hfi(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n @ticket_loops = TicketLoop.all\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @tickets_recently = Ticket.where(reporter: current_user)\n .where.not('status_id = (?) OR status_id = (?)', Status.closed_id, Status.cancel_id)\n .where(updated_at: (Time.now - 24.hours)..Time.now)\n .order(updated_at: :desc)\n .page(params[:recently]).per(6)\n @tickets = Ticket.where(reporter: current_user).order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def index\n @ticket_times = TicketTime.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_times }\n end\n end",
"def index\n\n # default: show all\n @tickets=Ticket.all\n\n # cases for showing open tockets, closed tickets, and per technician\n case params[:state]\n when \"open\"\n @[email protected](closed: nil)\n when \"closed\"\n @[email protected](closed: nil)\n end\n if params.has_key? :assigned_technician\n @[email protected](assigned_technician: params[:assigned_technician])\n end\n end",
"def show\n @product_sold = ProductSold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_sold }\n end\n end",
"def index\n @support_tickets = SupportTicket.all\n end",
"def tickets()\n sql = \"SELECT * FROM tickets where customer_id = $1\"\n values = [@id]\n ticket_data = SqlRunner.run(sql, values)\n return ticket_data.map{|ticket| Ticket.new(ticket)}\n end",
"def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end",
"def index\n @ticket_codes = TicketCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_codes }\n end\n end",
"def index\n @items_solds = ItemsSold.all\n end",
"def index\n @tickets = Ticket.all\n if params[:search]\n @tickets = Ticket.search(params[:search]).order(\"created_at DESC\")\n end\n end",
"def getUserTicketsByType\n @conditions = {user_id: params[:id], ticket_type: params[:ticket_type]}\n @tickets = Ticket.find(:all, :conditions => @conditions)\n\n # Handle empty results\n if @tickets.empty?\n raise(ActiveRecord::RecordNotFound)\n end\n\n render json: @tickets\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def index\n @tickets, params[:filter] = current_user.filtered_tickets(params[:filter])\n @tickets = @tickets.order(created_at: :desc)\n end",
"def show\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def tickets\n sql = \"\n SELECT * FROM tickets\n WHERE customer_id = $1\n \"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return nil if result.count == 0\n return result.map {|ticket| Ticket.new(ticket)}\n end",
"def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end",
"def tickets_bought()\n sql = \"SELECT * FROM tickets WHERE customer_id = $1;\"\n values = [@id]\n ticket_hash = SqlRunner.run(sql, values)\n result = Ticket.map_tickets(ticket_hash)\n end",
"def index\n @ticketalerts = Ticketalert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketalerts }\n end\n end"
] | [
"0.70010173",
"0.68604535",
"0.6770478",
"0.67574805",
"0.6751021",
"0.6730914",
"0.6714098",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.66498023",
"0.6648962",
"0.66433245",
"0.66261965",
"0.66182536",
"0.65634674",
"0.65288985",
"0.6424569",
"0.6415674",
"0.63577706",
"0.63209474",
"0.63209474",
"0.63169074",
"0.6284261",
"0.62465435",
"0.6236792",
"0.6233997",
"0.62300205",
"0.62290055",
"0.6227271",
"0.62152785",
"0.61935735",
"0.6189607",
"0.61631393",
"0.6160122",
"0.6151655",
"0.61482155",
"0.61438507",
"0.6135972",
"0.61332643",
"0.6131325",
"0.6127614",
"0.61093545",
"0.6077298",
"0.60753417",
"0.60670996",
"0.60619754",
"0.6028965",
"0.6025433",
"0.60080147",
"0.59986234",
"0.5997403",
"0.59487796",
"0.5929743",
"0.59296757",
"0.59261936",
"0.5913886",
"0.58938897",
"0.5871828",
"0.58583635",
"0.58583635",
"0.58583635",
"0.58583635",
"0.58583635",
"0.58583635",
"0.58522266",
"0.584775",
"0.5843898",
"0.5843531",
"0.5836455",
"0.58326155",
"0.5792241",
"0.57754475",
"0.57615346",
"0.57593364",
"0.57374066",
"0.5736762",
"0.57301927",
"0.5685303",
"0.56727684",
"0.56675816",
"0.56580806",
"0.56536347",
"0.5648277",
"0.5640151",
"0.56341934",
"0.56313795",
"0.5630225",
"0.5628664",
"0.5627866",
"0.5625304",
"0.5622586"
] | 0.77643716 | 0 |
GET /sold_tickets/1 GET /sold_tickets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sold_tickets = SoldTicket.all\n end",
"def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end",
"def index\n respond_with(@tickets)\n end",
"def index\n @tickets = current_user.tickets.last(15).reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show_tickets_sold()\n end",
"def index_all\n @tickets = Ticket.all_tickets\n render json: @tickets, status: 200\n end",
"def index\n @title = \"Tickets\"\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def index\n @sprint = params[:sprint].presence || Sprint.current!\n @tickets = Ticket.for_sprint(@sprint).by_created_at_desc\n @tickets = @tickets.for_project(params[:project]) if params[:project].present?\n @tickets = @tickets.for_user(params[:user]) if params[:user].present?\n @tickets = @tickets.search_name(params[:description]) if params[:description].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n\t @tickets = Ticket.order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n render json: @ticket\n end",
"def index\n @tickets = @event.tickets\n end",
"def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @ticket }\n end\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = current_user.tickets.page(params[:page]||1)\n respond_to do |format|\n format.html\n format.xml { render :xml => @tickets }\n format.json { render :json => @tickets }\n end\n end",
"def show\n @tickets = @event.tickets.find(params[:id])\n end",
"def show\n # @tickets = @user.tickets\n @conditions = {user_id: @user.id, ticket_type: 1}\n @t1 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 2}\n @t2 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 3}\n @t3 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @used_tickets = UsedTicket.where(user_id: @user.id).limit(10)\n render :json => \n {\n :status => 0,\n :user => {\n :id => @user.id,\n :name => @user.name,\n :email => @user.email,\n :tickets => {\n :t1 => @t1,\n :t2 => @t2,\n :t3 => @t3,\n :used => @used_tickets\n }\n }\n }\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = Ticket.effectiveness\n end",
"def index_user\n @tickets = Ticket.all_for_user(current_user.id)\n render json: @tickets, status: 200\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @ticket_items = TicketItem.all\n end",
"def index\n @ticketings = Ticketing.all\n end",
"def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n @tickets = OTRS::Ticket.where(params[:q])\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @tickets }\n wants.json { render :json => @tickets }\n end\n end",
"def update\n respond_to do |format|\n if @sold_ticket.update(sold_ticket_params)\n format.html { redirect_to @sold_ticket, notice: 'Sold ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @sold_ticket }\n else\n format.html { render :edit }\n format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my_tickets\n user = current_user.id if !current_user.nil?\n # OCO\n init_oco if !session[:organization]\n\n @search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !user.blank?\n with :created_by, user\n end\n with(:ticket_status_id).less_than(4)\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n\n @tickets = @search.results\n\n respond_to do |format|\n format.html # my_tickets.html.erb\n format.json { render json: @tickets }\n end\n end",
"def create\n @sold_ticket = SoldTicket.new(sold_ticket_params)\n\n respond_to do |format|\n if SoldTicket.multi_save\n format.html { redirect_to user(current_user.id), notice: 'Sold ticket was successfully created.' }\n format.json { render :show, status: :created, location: @sold_ticket }\n else\n format.html { render :new }\n format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sold_ticket.destroy\n respond_to do |format|\n format.html { redirect_to sold_tickets_url, notice: 'Sold ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def index\n @support_tickets = SupportTicket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_tickets }\n end\n end",
"def index\n # @tickets = policy_scope(Ticket)\n render json: @tickets\n end",
"def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n if current_user.is? :admin\n if params[:user_id]\n @tickets = User.find(params[:user_id]).tickets.paginate(:page => params[:page])\n elsif params[:team_id]\n @tickets = Team.find(params[:team_id]).tickets.paginate(:page => params[:page])\n else\n @tickets = Ticket.paginate(:page => params[:page])\n end\n else\n @tickets = current_user.tickets.paginate(:page => params[:page])\n end\n\n if params[:status] == \"closed\"\n @tickets = @tickets.closed\n else\n @tickets = @tickets.open\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n @product_sold = ProductSold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_sold }\n end\n end",
"def index\n @ticket_owners = TicketOwner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_owners }\n end\n end",
"def show\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def show\n @breadcrumb = 'read'\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n if params[:event_id]\n @tickets = Ticket.find_all_by_event_id(params[:event_id])\n else\n @tickets = Ticket.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def show\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_owner }\n end\n end",
"def new\n @ticket = Ticket.new(sprint: Sprint.current!)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def total_tickets\n respond_with json_response('total_tickets', Ticket.count)\n end",
"def overall_tickets\n\n end",
"def index\n @tickets = Ticket.where(user: current_user)\n end",
"def index\n @tickets = Ticket.all\n render_default_format(@ticket, true)\n end",
"def show\n @tickets = Ticket.get_from_event @event\n end",
"def get_owner_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_owner(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n @tickets = Ticket.order(id: :desc).all\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @tickets = get_current_user_ticket_list(@user)\n end",
"def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n \n end",
"def show\n @ticket = Ticket.find(params[:id])\n end",
"def index\n @sells = Sell.all\n\n render json: @sells\n end",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def show\n ticket = Ticket.find(params[:address])\n\n render json: {\n address: ticket.address,\n salt: ticket.salt,\n status: ticket.status,\n event: ticket.event.name,\n event_id: ticket.event_id,\n }\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def index\n @ticket_events = TicketEvent.all\n end",
"def index\n @ticket_loops = TicketLoop.all\n end",
"def index\n @ticket_times = TicketTime.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_times }\n end\n end",
"def sold_ticket_params\n params.fetch(:sold_ticket, {})\n end",
"def index\n tickets = Ticket.all_relevant_tickets\n @pagy, @tickets = pagy(tickets)\n ticket_records_with_associations =\n TicketSerializer.new(@tickets, { params: { :ticketlist => true } }).hash_for_collection[:data].map { | ticket |\n ticket[:attributes]\n }\n # When we need pagination lets use the below\n #render json: { data: ticket_records_with_associations,\n # pagy: pagy_metadata(@pagy) }\n paginate json: ticket_records_with_associations\n end",
"def index\n @tickets = Ticket.all\n @tickets_ordered \n end",
"def index\n @ticket_codes = TicketCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_codes }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def index\n @tickets_recently = Ticket.where(reporter: current_user)\n .where.not('status_id = (?) OR status_id = (?)', Status.closed_id, Status.cancel_id)\n .where(updated_at: (Time.now - 24.hours)..Time.now)\n .order(updated_at: :desc)\n .page(params[:recently]).per(6)\n @tickets = Ticket.where(reporter: current_user).order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def get_hfi_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_hfi(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n \n @tickets = Ticket.all\n @tickets = @tickets.order(:updated_at)\n @tickets = @tickets.joins(:payment).where(\"payments.id = ?\",params[:clave]) unless params[:clave]==\"\" or params[:clave].nil?\n \n @payment = Payment.find(params[:clave])\n end",
"def show\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_code }\n end\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end",
"def show\n @purchased = @event.purchased_tickets\n end",
"def tickets_unused\n if params[:days]\n since = Time.zone.now - params[:days].to_i.days\n tickets = Ticket.where('user_id != owner_id').where(user_id: 0)\n .joins(:event)\n .where('start_time > ?', since)\n respond_with json_response('tickets_unused', tickets.count)\n else\n respond_with json_response(\n 'tickets_unused',\n Ticket.where('user_id != owner_id').where(user_id: 0).count\n )\n end\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def show\n @ticket = Ticket.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @ticket.blank?\n format.xml { render :xml => ticket_presenter }\n format.json { render :json => ticket_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def index\n @ticketalerts = Ticketalert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketalerts }\n end\n end"
] | [
"0.7540422",
"0.6842509",
"0.67488575",
"0.67123353",
"0.6712204",
"0.6707451",
"0.6676983",
"0.66667277",
"0.6665841",
"0.6620928",
"0.66156316",
"0.6598288",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586901",
"0.6586134",
"0.65448016",
"0.6543099",
"0.6501402",
"0.6403227",
"0.63541937",
"0.63134885",
"0.62923527",
"0.6290926",
"0.6274828",
"0.62608296",
"0.62608296",
"0.62608296",
"0.62608296",
"0.62608296",
"0.62608296",
"0.6230693",
"0.62183386",
"0.6218311",
"0.6212623",
"0.6212623",
"0.62020236",
"0.6176352",
"0.61578053",
"0.6153817",
"0.61426765",
"0.6142435",
"0.6130272",
"0.61277884",
"0.6117413",
"0.6114564",
"0.6109544",
"0.6091799",
"0.60814196",
"0.60798806",
"0.6077212",
"0.60573226",
"0.60428226",
"0.6019294",
"0.6011854",
"0.6001453",
"0.60006046",
"0.599445",
"0.59538347",
"0.595059",
"0.5944211",
"0.5941431",
"0.5919982",
"0.5919519",
"0.5914102",
"0.59075284",
"0.58961964",
"0.58781207",
"0.58608866",
"0.58481735",
"0.5839254",
"0.5835453",
"0.58211476",
"0.5789881",
"0.57807416",
"0.5778821",
"0.5753791",
"0.5745702",
"0.57180345",
"0.571576",
"0.5715716",
"0.5709713",
"0.5692721",
"0.56804234",
"0.5679035",
"0.5676035",
"0.56702167",
"0.56642526",
"0.564749",
"0.56471217",
"0.5623695",
"0.5623509"
] | 0.0 | -1 |
POST /sold_tickets POST /sold_tickets.json | def create
@sold_ticket = SoldTicket.new(sold_ticket_params)
respond_to do |format|
if SoldTicket.multi_save
format.html { redirect_to user(current_user.id), notice: 'Sold ticket was successfully created.' }
format.json { render :show, status: :created, location: @sold_ticket }
else
format.html { render :new }
format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end",
"def index\n @sold_tickets = SoldTicket.all\n end",
"def create\n @tickets = []\n params[:quantity].to_i.times do\n @ticket = Ticket.new(params[:ticket])\n @ticket.viber = current_viber\n @tickets << @ticket\n end\n\n respond_to do |format|\n if @tickets.map(&:save)\n format.html { redirect_to @ticket, notice: 'Your ticket(s) are booked.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sold_ticket_params\n params.fetch(:sold_ticket, {})\n end",
"def update\n respond_to do |format|\n if @sold_ticket.update(sold_ticket_params)\n format.html { redirect_to @sold_ticket, notice: 'Sold ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @sold_ticket }\n else\n format.html { render :edit }\n format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end",
"def destroy\n @sold_ticket.destroy\n respond_to do |format|\n format.html { redirect_to sold_tickets_url, notice: 'Sold ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n ticket_params.inspect\n @ticket = Ticket.new(ticket_params)\n @ticket.user = nil\n @ticket.status = \"for_sale\"\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tickets = []\n order_number = 1\n order_number = Ticket.last.order_number + 1 unless Ticket.all.count == 0\n number_of_tickets = params[:number_of_tickets].to_i\n\n number_of_tickets.times do |num|\n @tickets[num] = Ticket.new(ticket_params)\n @tickets[num].number_of_tickets = n = params[:number_of_tickets]\n @tickets[num].amount_paid = (n.to_i)*10 - 20*((n.to_i)/12)\n @tickets[num].order_number = order_number\n @tickets[num].location = current_admin.event.name if current_admin && current_admin.event\n unless @tickets[num].payment_type\n @tickets[num].payment_type = params[:payment_type]\n end\n end\n\n @ticket = @tickets.first\n if @ticket.save\n @tickets.each do |ticket|\n ticket.save\n end\n Recipt.ticket_recipt(@ticket).deliver\n redirect_to ticket_path(@ticket), notice: \"Thank you for buying #{pluralize(number_of_tickets, 'raffle ticket')} #{@ticket.first_name}\"\n else\n render :new if current_admin\n render :new_wepay if !current_admin\n end\n end",
"def show_tickets_sold()\n end",
"def ticket_params\n params.require(:ticket).permit(:name, :description, :price, :quantity, :sales_start_datetime, :sales_end_datetime, :event_id)\n end",
"def buyTickets\n nt1 = Integer(params[:nt1])\n nt2 = Integer(params[:nt2])\n nt3 = Integer(params[:nt3])\n\n # Checks if the user deserves a free ticket\n promo = (nt1 + nt2 + nt3) >= 10? 1 : 0;\n\n ActiveRecord::Base.transaction do\n # type 1 tickets with promotion\n (nt1 + promo).times do\n Ticket.create(\n ticket_type: 1,\n uuid: SecureRandom.uuid,\n user_id: params[:id])\n end\n\n #type 2 tickets\n nt2.times do\n Ticket.create(\n ticket_type: 2,\n uuid: SecureRandom.uuid,\n user_id: params[:id])\n end\n\n #type 3 tickets\n nt3.times do\n Ticket.create(\n ticket_type: 3,\n uuid: SecureRandom.uuid,\n user_id: params[:id])\n end\n end\n\n render json: {\n :status => 0,\n :msg => :ok}\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def create\n event = Event.find(params[:event_id])\n batch_id = params[:batch_id] # for when an event has multiple types of tickets\n amount = params[:amount] # amount of tickets\n user_info = { anonymous: SecureRandom::hex } # instead of a random string this could have user info\n price = event.price * amount\n address = TicketAddresses.create_ticket_address(event.id, batch_id)\n\n ticket = Ticket.create!(\n event: event,\n batch_id: batch_id,\n amount: amount,\n price: price,\n user_info: user_info,\n address: address,\n status: :unconfirmed\n )\n\n render json: {\n address: address,\n salt: ticket.salt,\n price: event.price * amount,\n }\n end",
"def buy_tickets\n tally = films().map {|ticket| ticket.price.to_f}\n tally.each {|price| @wallet -= price}\n num_of_tickets\n screenings = tickets().map{|ticket| ticket.screening}\n screenings_flat = screenings.flatten\n screenings_flat.map {|screening| screening.tickets_available -= 1}\n screenings_flat.each {|screening| p screening.update }\n update()\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.ticket_date = Time.now\n @ticket.user_id = current_user.id\n\n respond_to do |format|\n if @ticket.save\n update_warehouse\n format.html { \n flash[:notice] = 'La boleta se creó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { render json: @ticket.to_json }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n n = params[:number_of_tickets].to_i\n\n # make sure there are enough tickets\n\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n @ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{@ticket.id}\"\n @ticket.van.seats_available -= 1\n @ticket.van.save\n @ticket.save\n Recipt.send_recipt(@ticket).deliver\n (n-1).times do\n ticket = Ticket.new(ticket_params)\n ticket.save\n ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{ticket.id}\"\n ticket.van.seats_available -= 1\n ticket.van.save\n ticket.save\n Recipt.send_recipt(ticket).deliver\n end\n\n if n == 1\n format.html { redirect_to @ticket, notice: 'Thank you for riding Gnome2Home. You will receive an email shortly with your QR code and confirmation number' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { redirect_to edit_passenger_registration_path, notice: \"Thanks for buying #{n} tickets. You can view all of you purchased tickets below. You will receive #{n} separate emails, each with a unique QR code ticket. Please keep those emails to check in. \"}\n format.json { render :show, status: :created, location: @ticket }\n end\n\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def create\n @items_sold = ItemsSold.new(items_sold_params)\n\n respond_to do |format|\n if @items_sold.save\n format.html { redirect_to @items_sold, notice: 'Items sold was successfully created.' }\n format.json { render :show, status: :created, location: @items_sold }\n else\n format.html { render :new }\n format.json { render json: @items_sold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:name, :seat_id_seq, :address, :price, :email_address, :event_id)\n end",
"def create\n @ticket = current_user.user_tries.last.tickets.build(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n current_user.user_tries.last.state_machine.transition_to(:recruit)\n format.html { redirect_to root_path, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_with(@tickets)\n end",
"def create\n # user_id = params[\"user_id\"]\n user_id = @user.id\n store_id = params[\"store_id\"]\n \n @ticket = Ticket.new\n @ticket.user_id = user_id\n @ticket.store_id = store_id\n @ticket.cnt = get_new_ticket_number (store_id)\n\n respond_to do |format|\n if @ticket.save\n @newTicket = TicketsHelper::Ticket.new\n @newTicket.store_id = @ticket.store.id\n @newTicket.store_name = @ticket.store.name\n @newTicket.reg_time = @ticket.created_at\n @newTicket.wait_number = @ticket.cnt\n @newTicket.wait_ahead_count = get_current_user_wait_ahead_count(@ticket)\n \n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show}\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize @ticket\n if @ticket.update_attributes(tag_list: @tags)\n render :json => @ticket.reload.tags, :status => :created\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end",
"def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: \"Ticket was successfully created.\" }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buyticket\n @ticket = Ticket.new(ticket_params)\n @event = Event.find(@ticket.event_id)\n if @ticket.valid?\n @ticket.save\n # this will have to change to credit card functionality later\n redirect_to events_url, notice: 'You successfully purchased your ticket to this event.'\n # redirect to my groups url (when logged in!)\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @ticket = @current_user.tickets.build(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, :notice => 'Ticket was successfully created.' }\n format.json { render :action => 'show', :status => :created, :location => @ticket }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ticket_params\n params\n .require(:ticket)\n .permit(\n :dreport_id,\n :number,\n :client,\n :starts_at,\n :ends_at,\n :status,\n :kind,\n :observation,\n :job_1, :job_2, :job_3, :job_4, :job_5, :job_6,\n :mat_1, :mat_2, :mat_3, :mat_4, :mat_5, :mat_6,\n :nt, :sma\n )\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_edited_ticket_entry\n @raw_date = params[:delivery_date]\n \n @day = @raw_date[3..4]\n @month = @raw_date[0..1]\n @year = @raw_date[6..9]\n \n @delivery_date = \"#{@year}-#{@month}-#{@day}\"\n \n @ticket = Ticket.find(params[:id])\n @ticket.number = params[:ticket_number]\n @ticket.delivery_date = @delivery_date\n @ticket.job_id = params[:job_id]\n @ticket.destination_id = params[:destination_id]\n @ticket.wood_type = params[:wood_type_id]\n \n #Because the tickets value (load pay) comes in as string in currency format\n # some parts have to be stripped off to be able to turn it into float correctly\n @value = params[:load_pay].to_s\n 3.times do\n @value.sub!(\",\", \"\")\n end\n @value = @value.to_f\n \n @ticket.value = @value\n \n @ticket.load_details.each_with_index do |i, x|\n i.species_id = params[:specieses][x]\n i.tonnage = params[:tonnages][x]\n i.mbfs = params[:mbfs][x]\n \n unless i.save\n render :status => 306, :nothing => true\n return\n end\n end\n \n unless @ticket.save\n render :status => 306, :nothing => true\n else\n render :status => 200, :nothing => true\n end\n end",
"def overall_tickets\n\n end",
"def total_tickets\n respond_with json_response('total_tickets', Ticket.count)\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\np \"ticket_params: #{ticket_params}\"\n respond_to do |format|\n if @ticket.errors.size == 0 && @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params_create)\n\n respond_to do |format|\n if @ticket.save\n TicketMailer.send_ticket_status(@ticket).deliver_later\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(admin_ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to admin_tickets_url, notice: 'Ticket was successfully created.' }\n format.json { render action: 'index', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_ticket(params)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = params[:title]\n ticket.body = params[:body]\n ticket.tags = params[:tags]\n ticket.save\n end",
"def create\n @admin_ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @admin_ticket.save\n format.html { redirect_to admin_ticket_path(@admin_ticket), notice: 'Ticket was successfully created.' }\n format.json { render json: @admin_ticket, status: :created, location: @admin_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.find(params[:event_id])\n\n count = params[:ticket][:count].to_i\n\n already_ordered_by_user = Ticket.where(:user_id => @current_user.id, :event_id => @event.id).count\n rem_count = remaining_count(already_ordered_by_user)\n total_price = count * event_price(@event)\n\n if !buying_opened(@event)\n flash[:danger] = t('tickets.new.invalid.toEarly')\n elsif invalid_count(rem_count, count)\n flash[:danger] = t('tickets.new.invalid.count', remaining: rem_count)\n elsif invalid_age(@event, @current_user)\n flash[:danger] = t('tickets.new.invalid.requiredAge')\n elsif invalid_free_seat(@event, count)\n flash[:danger] = t('tickets.new.invalid.freeSeats')\n elsif invalid_balance(@current_user.balance - total_price)\n flash[:danger] = t('tickets.new.invalid.balance')\n else\n flash[:success] = t('tickets.new.success')\n\n count.times do |i|\n ticket = @event.tickets.create(:price => event_price(@event), :want_delete => false, :seat => get_free_seat(@event))\n @current_user.tickets << ticket\n @current_user.update_attribute(\"balance\", @current_user.balance - event_price(@event))\n end\n end\n\n redirect_to event_path(@event)\n\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def ticket_params\n params.require(:ticket).permit(:description, :ticket_date, :quantity, :customer_id, :quantity_abs, :buy)\n end",
"def create\n #@ticket = Ticket.new(ticket_params)\n @ticket = current_user.tickets.build(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: \"Your ticket has been submitted. We will get back to you ASAP\" }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = @customer.tickets.create(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to edit_customer_path(@customer), notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to \"/pages/user_dashboard\", notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = OTRS::Ticket.new(params[:ticket])\n\n respond_to do |wants|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n wants.html { redirect_to(@ticket) }\n wants.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n wants.json { render :json => @ticket, :status => :created, :location => @ticket }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n wants.json { render :json => @ticket.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def tickets_unused\n if params[:days]\n since = Time.zone.now - params[:days].to_i.days\n tickets = Ticket.where('user_id != owner_id').where(user_id: 0)\n .joins(:event)\n .where('start_time > ?', since)\n respond_with json_response('tickets_unused', tickets.count)\n else\n respond_with json_response(\n 'tickets_unused',\n Ticket.where('user_id != owner_id').where(user_id: 0).count\n )\n end\n end",
"def tickets_transferred\n if params[:days]\n since = Time.zone.now - params[:days].to_i.days\n tickets = Ticket.where('user_id != owner_id').where('user_id > 0')\n .joins(:event)\n .where('start_time > ?', since)\n respond_with json_response('tickets_transferred', tickets.count)\n else\n respond_with json_response(\n 'tickets_transferred',\n Ticket.where('user_id != owner_id').where('user_id > 0').count\n )\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n set_default_data\n respond_to do |format|\n if @ticket.save\n Account::Tickets::TicketLogs.create(@ticket)\n format.html { redirect_to account_tickets_path, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ticket = Ticket.new(sprint: Sprint.current!)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def create\n @product_sold = ProductSold.new(params[:product_sold])\n\n respond_to do |format|\n if @product_sold.save\n format.html { redirect_to @product_sold, notice: 'Product sold was successfully created.' }\n format.json { render json: @product_sold, status: :created, location: @product_sold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_sold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n \n #Security check. You can only add a ticket for an event you also created!´\n \n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to tickets_path() }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n flash[:notice_bad] = 'Please fill in all required fields.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n name = params[:name]\n seat = params[:seat]\n desc = params[:desc]\n group_name = params[:group]\n group = Group.where(name:group_name).first\n\n new_ticket = group.tickets.new(name:name,seat:seat,description:desc)\n\n if new_ticket.save\n notice = {\"notice\"=>\"new ticket created successfully.\"}\n puts notice.to_json\n redirect_to \"http://hacked.io/almanac/get-help/submitted\"\n else\n alert = {\"alert\"=>\"ticket was not created. check your params.\"}\n puts alert.to_json\n redirect_to \"http://hacked.io/almanac/get-help/not-submitted\"\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n \n respond_to do |format|\n if @ticket.save\n format.html { redirect_to ticket_path( @ticket ), notice: '感謝您參與本次活動,我們將於 10 個工作日回覆您!' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:folio, :logo, :people, :total, :cupon_id, :ticket_type_id, :event_id)\n end",
"def ticket_params\n params.require(:ticket).permit(:date, :work_order, :job_code, :quantity, :user_id)\n end",
"def ticket_params\n params.require(:ticket).permit(:description, :quantity, :value, :email, :active, :profiles, :event_id)\n end",
"def create\n @ticketing = Ticketing.new(ticketing_params)\n\n respond_to do |format|\n if @ticketing.save\n format.html { redirect_to @ticketing, notice: \"Ticketing was successfully created.\" }\n format.json { render :show, status: :created, location: @ticketing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticketing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:title, :body, :status, :agent, :customer, :department, :priorety, :done_date)\n end",
"def new\n ticket_id = params[:ticket_id]\n user_id = params[:user_id]\n \n @ticket_lock = TicketLock.new(:ticket_id => ticket_id, :user_id => user_id)\n \n if @ticket_lock.save\n render :json => {:status => 'ok', :time => 300 }\n else\n render :json => {:status => 'error', :message => 'This ticket is already locked.'}\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n respond_to do |format|\n if @ticket.save\n if @ticket.table_id\n Table.find(@ticket.table_id).update(status: Table.statuses[:occupied])\n end\n if @ticket.customer_id\n Customer.find(@ticket.customer_id).update(status: Customer.statuses[:occupied])\n end\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:total_items, :transaction_amount)\n end",
"def index\n @tickets = @event.tickets\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.user = current_user\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to edit_ticket_path(@ticket), notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.user = current_user if current_user\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: {id: @ticket.id, status: :created}, status: :created }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n listing = Listing.find(params[:listing_id])\n event = Event.find(params[:event_id])\n addr = Address.find_or_create_by_street_address( params[:address][:street_address])\n\n addr.update_attributes(params[:address])\n\n order_attributes = {\n shipment_method: params[:shipment_method],\n payment_date: Time.now(),\n payment_method: 0, #TODO\n shipment_date: Time.now(),\n status: 0, #TODO\n shipment_fee: 0,\n service_fee: 0,\n total_amount: params[:tickets_amount].to_i * listing.list_price,\n tickets_amount: params[:tickets_amount].to_i\n }\n\n @order.update_attributes(order_attributes)\n\n @order.seller = listing.seller\n @order.buyer = current_user\n @order.shipment_address = addr\n\n # get tickets\n tickets = listing.get_some_available_tickets params[:tickets_amount].to_i\n\n listing.tickets.each do |t|\n @order.items.build({\n selling_price: 0,\n ticket_id: t.id\n })\n end\n\n respond_to do |format|\n if @order.save\n #format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.html { redirect_to success_order_url(@order) }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.user_id = current_user.id\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index_all\n @tickets = Ticket.all_tickets\n render json: @tickets, status: 200\n end",
"def ticket_params\n params.require(:ticket).permit(:Viewing_id, :show_date, :Order_id)\n end",
"def ticketing_params\n params.require(:ticketing).permit(:system, :Trains, :from, :To, :Date, :Price, :Class)\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def create\n @ticket_event = TicketEvent.new(ticket_event_params)\n\n respond_to do |format|\n if @ticket_event.save\n format.html { redirect_to @ticket_event, notice: 'Ticket event was successfully created.' }\n format.json { render :show, status: :created, location: @ticket_event }\n else\n format.html { render :new }\n format.json { render json: @ticket_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tickets = Ticket.all\n end",
"def buy_ticket(screening)\n ticket = Ticket.new({\n 'customer_id' => @id,\n 'screening_id' => screening.id\n })\n ticket.save()\n end",
"def ticket_params\n params.require(:ticket).permit(:ref, :command, :reservation, :resaDate, :resaTime, :price, :accessDate, :accessTime, :tarif, :type, :serie, :floor, :sellPoint)\n end",
"def create\n @ticket_owner = TicketOwner.new(params[:ticket_owner])\n\n respond_to do |format|\n if @ticket_owner.save\n format.html { redirect_to @ticket_owner, notice: 'Ticket Owner was successfully created.' }\n format.json { render json: @ticket_owner, status: :created, location: @ticket_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = current_user.tickets.new(ticket_params)\n\n if @ticket.save\n redirect_to @ticket, notice: 'Ticket was successfully created.'\n else\n render :new\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:sender_name, :sender_email, :subject, :body, :code, :department_id, :status_id, :owner_id)\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.ticket_status = 'Waiting for Staff Response'\n @ticket.ticket_interface = 'New unassigned tickets'\n @ticket.make_uniq_reference\n\n TicketConfirmingMailer.new_ticket_confirmation(@ticket).deliver\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6670911",
"0.6605518",
"0.64356005",
"0.6306255",
"0.6129994",
"0.61258847",
"0.6096558",
"0.6085693",
"0.6073113",
"0.6071858",
"0.60685337",
"0.5918079",
"0.5890387",
"0.58712465",
"0.585073",
"0.58352304",
"0.58280134",
"0.5800623",
"0.5788963",
"0.577629",
"0.5756438",
"0.5733476",
"0.57306296",
"0.5726265",
"0.5716963",
"0.57157165",
"0.57144874",
"0.569496",
"0.5691399",
"0.5690245",
"0.56880826",
"0.568579",
"0.5678862",
"0.5667805",
"0.5667805",
"0.5667805",
"0.5667805",
"0.5667607",
"0.56554925",
"0.5653385",
"0.56432205",
"0.5632105",
"0.5632105",
"0.56227285",
"0.56158394",
"0.56145406",
"0.5610509",
"0.56097955",
"0.5607193",
"0.560424",
"0.56015074",
"0.5597423",
"0.55798817",
"0.55766845",
"0.55747545",
"0.5526881",
"0.5519796",
"0.5516647",
"0.55149746",
"0.551062",
"0.5492927",
"0.54923016",
"0.54891884",
"0.5482645",
"0.5479286",
"0.5476525",
"0.5475333",
"0.54725015",
"0.54609567",
"0.54609513",
"0.54591244",
"0.54554075",
"0.5440514",
"0.54386526",
"0.5436712",
"0.543384",
"0.5430188",
"0.54297185",
"0.5426111",
"0.54247665",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5422125",
"0.5421518",
"0.54213333",
"0.54197824",
"0.5418439",
"0.5417316",
"0.5414001",
"0.54086936",
"0.5408633"
] | 0.7122735 | 0 |
PATCH/PUT /sold_tickets/1 PATCH/PUT /sold_tickets/1.json | def update
respond_to do |format|
if @sold_ticket.update(sold_ticket_params)
format.html { redirect_to @sold_ticket, notice: 'Sold ticket was successfully updated.' }
format.json { render :show, status: :ok, location: @sold_ticket }
else
format.html { render :edit }
format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @ticketold = Ticket.find(@ticket.id)\n respond_to do |format|\n if @ticket.update(ticket_params)\n Account::Tickets::TicketLogs.update(@ticket, @ticketold)\n format.html { redirect_to account_tickets_path, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = @event.tickets.find(params[:id])\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to event_ticket_path(@event.ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n logger.info { \"PARAMS: #{params.inspect}\" }\n project_id, id = params[:id].split('-')\n ticket = Lighthouse::Ticket.find(id, :params => {:project_id => project_id})\n \n # insanely hacky. can't nest json, so don't want to do a willy-nilly merge.\n # move mergeable params to the [:ticket] hash to follow usual rails conventions\n # before merging\n params[:ticket] = {}\n %w(assigned_user_id state milestone_id).each do |field|\n params[:ticket].merge!( field => params.delete(field) ) if params[field]\n end\n logger.info { \"TICKET ATTRS TO UPDATE: #{params[:ticket].inspect}\"}\n \n ticket.attributes.merge!( params[:ticket] )\n ticket.save\n\n respond_to do |format|\n # if @ticket.update_attributes(params[:ticket])\n # flash[:notice] = 'Ticket was successfully updated.'\n # format.html { redirect_to(@ticket) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to tickets_path, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end",
"def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render json: {status: :ok}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to edit_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket.update(ticket_params)\n\n end",
"def update\n respond_to do |format|\n if @ticket.update(admin_ticket_params)\n format.html { redirect_to admin_tickets_url, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |wants|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n wants.html { redirect_to(@ticket) }\n wants.xml { head :ok }\n wants.json { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n wants.json { render :json => @ticket.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { \n flash[:notice] = 'La boleta se actualizó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Home was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n if @ticket_owner.update_attributes(params[:ticket_owner])\n format.html { redirect_to @ticket_owner, notice: 'Ticket Owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params_update)\n TicketMailer.send_ticket_status(@ticket, 'updated').deliver_later\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remote_update\n @ticket = Ticket.find(params[:id])\n @event = Event.find(@ticket.event_id)\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { render :partial => \"events/old_tickets\", :object => @event }\n format.xml { head :ok }\n else\n logger.info(\"Save failed. Rendering tickets partial\")\n format.html { render :partial => \"events/old_tickets\", :object => @event , :object => @ticket }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to([@project, @ticket], :notice => 'Ticket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @admin_ticket.update_attributes(params[:ticket])\n format.html { redirect_to admin_ticket_path(@admin_ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, :notice => 'Ticket was successfully Updated.' }\n format.js do\n render :json => @ticket.to_json\n end\n else\n format.html { render :action => 'edit' }\n format.js { render :json => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticketing.update(ticketing_params)\n format.html { redirect_to @ticketing, notice: \"Ticketing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticketing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticketing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n @ticket.previous_assignee_id = @ticket.assignee_id\n @ticket.updater_id = session[:user]\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors.to_xml }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @ticket_event.update(ticket_event_params)\n format.html { redirect_to @ticket_event, notice: 'Ticket event was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_event }\n else\n format.html { render :edit }\n format.json { render json: @ticket_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticketbill.update(ticketbill_params)\n format.html { redirect_to @ticketbill, notice: 'Ticketbill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticketbill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @labticket.update(labticket_params)\n format.html { redirect_to @labticket, notice: 'Labticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @labticket }\n else\n format.html { render :edit }\n format.json { render json: @labticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket_item.update(ticket_item_params)\n format.html { redirect_to [:admin, @ticket_item], notice: 'Ticket item was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_item }\n else\n format.html { render :edit }\n format.json { render json: @ticket_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n # if open \n if params[:ticket][:ticket_status_id] == \"1\"\n \[email protected]_id = nil\n # if solved\n elsif params[:ticket][:ticket_status_id] == \"2\"\n \[email protected]_id = current_user.id\n \[email protected]_at = Time.now\n end\n \n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n \t\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @ticket.update(@ticket_params)\n render_success_format('client created correctly', @ticket)\n end\n rescue StandardError => e\n Airbrake.notify(e)\n raise e\n end",
"def update\n\n respond_to do |format|\n if @ticket_purchase.update(ticket_purchase_params)\n @ticket_purchase.send_ticket\n format.html { redirect_to event_ticket_ticket_purchase_url(:id => @ticket_purchase.id, :ticket_id => @ticket_purchase.ticket_id), notice: 'Ticket purchase was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_purchase }\n else\n format.html { render :edit }\n format.json { render json: @ticket_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n a = Ticket.find(params[:id])\n a.destroy()\n render json: \"success\"\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie zaktualizowany.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @ticket.update(ticket_params)\n redirect_to @ticket, notice: 'Ticket was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @ticket_loop.update(ticket_loop_params)\n format.html { redirect_to @ticket_loop, notice: 'Ticket loop was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_loop }\n else\n format.html { render :edit }\n format.json { render json: @ticket_loop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_as_sold\n # Header:\n # Content-Type : application/json\n # request payload example:\n # { \"copies_sold\" : 5 }\n books_in_stock = @shop.distributions.find_by(:book_id => shop_params[:book_id])\n copies_sold = shop_params[:copies_sold]\n if books_in_stock.nil?\n render status: 404, json: {\n message: \"Record not found - cannot find the book in this shop\",\n }\n elsif copies_sold.nil? || copies_sold < 0\n render status: 422, json: {\n message: \"Failed request due to invalid paylod data\",\n }\n else\n # 1. decrement copies_in_stock\n actual_sold = books_in_stock.update_copies_in_stock copies_sold\n # 2. increment total books_sold_count of the shop\n books_in_stock.shop.update_sold_count actual_sold\n render status: 200, json: {\n message: \"Successfully updated #{actual_sold} copies as sold in the shop\",\n shop: @shop\n }\n end\n end",
"def update\n if @ticket.update(namechange_params)\n redirect_to authenticated_root_url, notice: 'Ticket was successfully updated.'\n else\n render action: 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @items_sold.update(items_sold_params)\n format.html { redirect_to @items_sold, notice: 'Items sold was successfully updated.' }\n format.json { render :show, status: :ok, location: @items_sold }\n else\n format.html { render :edit }\n format.json { render json: @items_sold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tally = Tally.find(params[:id])\n respond_to do |format|\n if @tally.update(tally_params)\n format.html { redirect_to @tally, notice: 'Tally was successfully updated.' }\n format.json { render :show, status: :ok, location: @tally }\n else\n format.html { render :edit }\n format.json { render json: @tally.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n if current_user.id == @ticket.user_id || ProjectUser.verify_role(current_user.id, @project, 'developer')\n if params[:ticket][:status] == 'closed'\n # Unless doesn't work, but if! does for some reason?\n if !ProjectUser.verify_role(current_user.id, @project, 'owner')\n render json: { error: 'You must be the ticket author, or project owner to edit this' }, status: :unauthorized\n return\n end\n end\n if @ticket.update(ticket_params)\n render json: @ticket, status: 200\n else\n render json: @ticket.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'You must be the entry author, or on the admin team to edit this' }, status: :unauthorized\n end\n end",
"def create\n @sold_ticket = SoldTicket.new(sold_ticket_params)\n\n respond_to do |format|\n if SoldTicket.multi_save\n format.html { redirect_to user(current_user.id), notice: 'Sold ticket was successfully created.' }\n format.json { render :show, status: :created, location: @sold_ticket }\n else\n format.html { render :new }\n format.json { render json: @sold_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\t\tchanges = \"\"\n\t\tnew_employee = params[:ticket][:employee_id].nil? || params[:ticket][:employee_id].empty? ? nil : Employee.find(params[:ticket][:employee_id])\n\t\tunless new_employee == @ticket.employee\n\t\t\tchanges += \"> Responsible changed from #{@ticket.employee ? @ticket.employee.login : \"None\"} to #{new_employee.login}\"\n\t\t\[email protected] = new_employee\n\t\tend\n\t\tnew_status = params[:ticket][:status_id].nil? || params[:ticket][:status_id].empty? ? nil : Status.find(params[:ticket][:status_id])\n\t\tunless new_status == @ticket.status\n\t\t\tchanges += $/ + \"> Status changed from \\\"#{@ticket.status ? @ticket.status.name : \"None\"}\\\" to \\\"#{new_status.name}\\\"\"\n\t\t\[email protected] = new_status\n\t\tend\n\t\t@reply = @ticket.replies.build(params[:reply])\n\t\[email protected] = changes\n\t\[email protected] = current_user.login\n respond_to do |format|\n if @ticket.valid? && @reply.valid?\n\t\t\t\[email protected]\n\t\t\t\[email protected]\n\t\t\t\tCustomerSupport.update_ticket_email(@ticket,@reply).deliver\n format.html { redirect_to backend_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket_option.update(ticket_option_params)\n format.html { redirect_to @ticket_option, notice: 'Ticket option was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_option }\n else\n format.html { render :edit }\n format.json { render json: @ticket_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_sold = ProductSold.find(params[:id])\n\n respond_to do |format|\n if @product_sold.update_attributes(params[:product_sold])\n format.html { redirect_to @product_sold, notice: 'Product sold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_sold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket_file.update(ticket_file_params)\n format.html { redirect_to @ticket_file, notice: 'Ticket file was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_file }\n else\n format.html { render :edit }\n format.json { render json: @ticket_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stuck.update(stuck_params)\n format.html { redirect_to @stuck, notice: 'Stuck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stuck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.payment.credit.terminado\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @ticketprice_collection.update(ticketprice_collection_params)\n format.html { redirect_to @ticketprice_collection, notice: 'Ticketprice collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticketprice_collection }\n else\n format.html { render :edit }\n format.json { render json: @ticketprice_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket_action = TicketAction.find(params[:id])\n\n respond_to do |format|\n if @ticket_action.update_attributes(params[:ticket_action])\n flash[:notice] = 'TicketAction was successfully updated.'\n format.html { redirect_to(@ticket_action) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket_action.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @ticket\n @ticket.tag_list.add @tags\n if @ticket.save\n render :json => @ticket.reload.tags\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end",
"def update\n add_breadcrumb 'Update Trouble Ticket'\n\n respond_to do |format|\n if @troubleticket.update(troubleticket_params)\n format.html do\n redirect_to @troubleticket,\n notice: 'Trouble ticket was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @troubleticket }\n else\n format.html { render :edit , status: :unprocessable_entity }\n format.json do\n render json: @troubleticket.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n find_changes\n \n # Prevent assigned dev from being empty string on update\n if params[:ticket][:assigned_dev_id].blank?\n params[:ticket][:assigned_dev_id] = nil\n end\n \n if ok_to_edit? and save_histories and @ticket.update(ticket_params) \n redirect_to ticket_dashboard_path(@ticket.id), notice: \"Ticket was successfully updated.\"\n else\n flash[:alert] = \"Could not update ticket.\"\n redirect_to ticket_dashboard_path(@ticket.id)\n end\n end",
"def update\n ticket = Ticket.find(params[:id])\n status = params[:status]\n\n if status and ticket.update_attributes(status: status)\n render json: {\"notice\"=>\"status updated successfully to '#{status}'\"}\n else\n render json: {\"alert\"=>\"status not updated. check params.\"}\n end\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n @breadcrumb = 'update'\n @ticket = Ticket.find(params[:id])\n @ticket.updated_by = current_user.id if !current_user.nil?\n # Should use attachment from drag&drop?\n if $attachment != nil && !$attachment.avatar.blank? && $attachment.updated_at > @ticket.updated_at\n @ticket.attachment = $attachment.avatar\n end\n if (params[:ticket][:updated_by].blank?)\n params[:ticket][:updated_by] = current_user.id if !current_user.nil?\n end\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n destroy_attachment\n $attachment = nil\n # format.html { redirect_to @ticket, notice: I18n.t('activerecord.successful.messages.updated', :model => @ticket.class.model_name.human) }\n # format.html { redirect_to params[:referrer], notice: I18n.t('activerecord.successful.messages.updated', :model => @ticket.class.model_name.human) }\n format.html { redirect_to params[:referrer],\n notice: (crud_notice('updated', @ticket) + \"#{undo_link(@ticket)}\").html_safe }\n format.json { head :no_content }\n else\n destroy_attachment\n $attachment = Attachment.new\n @offices = @ticket.organization.blank? ? offices_dropdown : offices_dropdown_edit(@ticket.organization_id)\n @technicians = @ticket.organization.blank? ? technicians_dropdown : @ticket.organization.technicians.order(:name)\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n add_breadcrumb 'Edit Ticketnotes'\n\n respond_to do |format|\n if @ticketnote.update(ticketnote_params)\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @ticketnote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n if @ticket_code.update_attributes(params[:ticket_code])\n format.html { redirect_to @ticket_code, notice: 'Ticket code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @ticket = Ticket.find(params[:id])\n \n\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n else\n flash[:notice] = 'Failed to update ticket.' \n end \n\n if params[:send_email]\n send_email\n end \n \n redirect_to :action => \"edit\", :id => @ticket \n end",
"def update\n if @ticket.update(ticket_params)\n\n @obj = {\n id: @ticket.id,\n title: @ticket.title,\n body: @ticket.body,\n statu_id: @ticket.statu_id,\n user_id: @ticket.user_id,\n active: @ticket.active,\n image: @ticket.image.attached? ? url_for(@ticket.image) : nil,\n media: @ticket.media.attached? ? url_for(@ticket.media) : nil\n }\n\n render json: @obj\n # 'ticket was successfully updated.'\n else\n render json: @ticket.errors, status: :unprocessable_entity\n end\n end",
"def update\n @team = Team.find(params[:team_id])\n @sprint = @team.sprints.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [@sprint.team, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sold_product.update_attributes(sold_product_params)\n format.html { redirect_to @sold_product, notice: 'Sold product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sold_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tack = Tack.find(params[:id])\n\n if @tack.update(tack_params)\n head :no_content\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.72060317",
"0.66595817",
"0.6629772",
"0.6594802",
"0.65591234",
"0.65586305",
"0.65586305",
"0.65586305",
"0.6522384",
"0.6516499",
"0.65097594",
"0.6502603",
"0.64985853",
"0.6497071",
"0.6497071",
"0.64895433",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.6489519",
"0.64871264",
"0.6481842",
"0.6481842",
"0.6481842",
"0.6481842",
"0.6481842",
"0.64388365",
"0.6431032",
"0.63789797",
"0.6367588",
"0.6362424",
"0.63500124",
"0.62945205",
"0.6259955",
"0.62544096",
"0.618695",
"0.6183391",
"0.6177361",
"0.61706066",
"0.6145146",
"0.6141825",
"0.61397505",
"0.6117179",
"0.6117179",
"0.6078536",
"0.6071648",
"0.60644954",
"0.60621476",
"0.6061137",
"0.60513675",
"0.60250306",
"0.6021567",
"0.6013127",
"0.60024995",
"0.59964186",
"0.5996127",
"0.59844005",
"0.5946434",
"0.5940117",
"0.5935812",
"0.59010357",
"0.58940816",
"0.5891186",
"0.5888766",
"0.58801174",
"0.5878221",
"0.5872256",
"0.58531016",
"0.5850841",
"0.5850517",
"0.5835945",
"0.58184063",
"0.58171165",
"0.5806045",
"0.580604",
"0.57942283",
"0.5783728",
"0.57807815",
"0.5768685",
"0.57533467",
"0.5752695",
"0.5737587",
"0.571807",
"0.5693946",
"0.5678014",
"0.56735706",
"0.565824"
] | 0.72800624 | 0 |
DELETE /sold_tickets/1 DELETE /sold_tickets/1.json | def destroy
@sold_ticket.destroy
respond_to do |format|
format.html { redirect_to sold_tickets_url, notice: 'Sold ticket was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end",
"def delete id\n\t\[email protected] ['id', id]\n\tend",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = @event.tickets.find(params[:id])\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to event_tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end",
"def update\n a = Ticket.find(params[:id])\n a.destroy()\n render json: \"success\"\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to admin_tickets_url, notice: 'Ticket delete successfully.' }\n format.json { head :no_content }\n end\n end",
"def delete_ticket\n @ticket = Ticket.find(params[:id])\n @ticket.delete\n \n render :nothing => true\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to ticket_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"The tickey has been closed\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_ticket = Ticket.find(params[:id])\n @admin_ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |wants|\n wants.html { redirect_to(tickets_url) }\n wants.xml { head :ok }\n wants.json { head :ok }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ticket.destroy!\n render status: :ok, nothing: true\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find_by(seat: @seat)\n @ticket.destroy\n @seat.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_seats_url, notice: 'Seat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La boleta se eliminó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ticket.destroy\n\n respond_with(@story, @ticket)\n end",
"def destroy\n @ticket.update_attribute(:status, 'deleted')\n respond_to do |format|\n format.html do\n flash[:notice] = \"Ticket was destroyed\"\n redirect_to tickets_url\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n flash[:notice] = 'Ticket was successfully deleted.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.project, notice: 'Ticket deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_ticket_items_url, notice: 'Ticket item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @items_sold.destroy\n respond_to do |format|\n format.html { redirect_to items_solds_url, notice: 'Items sold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tally.destroy\n respond_to do |format|\n format.html { redirect_to tallies_url, notice: 'Tally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end",
"def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_purchase.destroy\n respond_to do |format|\n format.html { redirect_to event_ticket_ticket_purchase_url(:id => @ticket_purchase.id, :ticket_id => @ticket_purchase.ticket_id), notice: 'Ticket purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end",
"def destroy\n @labticket.destroy\n respond_to do |format|\n format.html { redirect_to labtickets_url, notice: 'Labticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_owner = TicketOwner.find(params[:id])\n @ticket_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to ticket_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to customer_tickets_url(@ticket.customer), notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @shelf = Shelf.find(params[:id])\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(shelves_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket_action = TicketAction.find(params[:id])\n @ticket_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_actions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@ticket = Ticket.find(params[:id])\n #@ticket.destroy\n\n #respond_to do |format|\n # format.html { redirect_to(tickets_url) }\n # format.xml { head :ok }\n #end\n\t\t\n\t\tredirect_to(tickets_url)\n end",
"def destroy\n @ticket_loop.destroy\n respond_to do |format|\n format.html { redirect_to ticket_loops_url, notice: 'Ticket loop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.user, notice: \"Permanentka na #{get_ticket_therapies_string @ticket} úspěšně odstraněna\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n van = @ticket.van\n van.seats_available += 1\n van.save\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to edit_passenger_registration_path, alert: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tickets_url(@project)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticketing.destroy\n respond_to do |format|\n format.html { redirect_to ticketings_url, notice: \"Ticketing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticketstate.destroy\n respond_to do |format|\n format.html { redirect_to ticketstates_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end",
"def destroy\n @troll.destroy\n respond_to do |format|\n format.html { redirect_to dev_trolls_path(@dev) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tick.destroy\n respond_to do |format|\n format.html { redirect_to ticks_url, notice: 'Tick was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @total_stock = TotalStock.find(params[:id])\n @total_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to total_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url,\n notice: (crud_notice('destroyed', @ticket) + \"#{undo_link(@ticket)}\").html_safe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sprintstory = Sprintstory.find(params[:id])\n @sprintstory.destroy\n\n respond_to do |format|\n format.html { redirect_to sprintstories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sprint = Sprint.find(params[:id])\n @sprint.destroy\n\n respond_to do |format|\n format.html { redirect_to sprints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sprint = Sprint.find(params[:id])\n @sprint.destroy\n\n respond_to do |format|\n format.html { redirect_to sprints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_sold = ProductSold.find(params[:id])\n @product_sold.destroy\n\n respond_to do |format|\n format.html { redirect_to product_solds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchased_stock = PurchasedStock.find(params[:id])\n @purchased_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to purchased_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchased_stock = PurchasedStock.find(params[:id])\n @purchased_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to purchased_stocks_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7492526",
"0.7138666",
"0.7116207",
"0.7116207",
"0.7116207",
"0.7116207",
"0.7116207",
"0.7116178",
"0.7059499",
"0.7029115",
"0.7022613",
"0.70065564",
"0.699963",
"0.6973767",
"0.6973767",
"0.6973767",
"0.6973767",
"0.6973767",
"0.6973767",
"0.69548655",
"0.6901134",
"0.6886488",
"0.68630534",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6844429",
"0.6842681",
"0.68384403",
"0.683337",
"0.683337",
"0.68297064",
"0.681649",
"0.68033284",
"0.6801889",
"0.6796779",
"0.67928225",
"0.67928225",
"0.67928225",
"0.67928225",
"0.67928225",
"0.67928225",
"0.67928225",
"0.6776976",
"0.67686665",
"0.67612463",
"0.6751746",
"0.6720172",
"0.6701188",
"0.6696384",
"0.6682335",
"0.6682082",
"0.66467345",
"0.664006",
"0.6631866",
"0.6622055",
"0.6613471",
"0.661058",
"0.6601982",
"0.6598642",
"0.6598503",
"0.65968084",
"0.65945405",
"0.65906155",
"0.6588615",
"0.65876186",
"0.6582109",
"0.6577548",
"0.6574959",
"0.6567307",
"0.65631896",
"0.65589154",
"0.6541865",
"0.65369064",
"0.6530237",
"0.6529794",
"0.65201664",
"0.65072685",
"0.6507002",
"0.6501869",
"0.6501869",
"0.6497465",
"0.64937216",
"0.64937216"
] | 0.76165533 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_sold_ticket
@sold_ticket = SoldTicket.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def 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 revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def 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 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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\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",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def _handle_action_missing(*args); end"
] | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865",
"0.53135896",
"0.52999926",
"0.5297309",
"0.5296569",
"0.5261449",
"0.5247048",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52323204",
"0.52310973",
"0.523081",
"0.5225785",
"0.5219039",
"0.52136266",
"0.5208033",
"0.520763",
"0.5177365",
"0.5175224",
"0.5173357",
"0.5166104",
"0.5162502",
"0.51573396",
"0.5154547",
"0.5153531",
"0.51502854",
"0.51436496",
"0.5142863",
"0.51330835",
"0.5115634",
"0.5115634",
"0.511527",
"0.5109693",
"0.51076853",
"0.5093146",
"0.5090683",
"0.50829846",
"0.50819314",
"0.50670373",
"0.5055505",
"0.5053398",
"0.50504035",
"0.50504035",
"0.5037765",
"0.5027292",
"0.5024484",
"0.50150335",
"0.5014069",
"0.50022113",
"0.5001542",
"0.49981874",
"0.49915564",
"0.49915564",
"0.49880967",
"0.4982312",
"0.49787375",
"0.49786067",
"0.49687737",
"0.49676532",
"0.49602765",
"0.49565676",
"0.49550772",
"0.495342",
"0.49522525",
"0.49463704",
"0.49447197",
"0.49362713",
"0.49328062",
"0.49280638",
"0.49272856",
"0.4927058",
"0.49221697",
"0.4919526",
"0.49185994",
"0.49184805",
"0.49170163",
"0.49168405",
"0.49167764"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def sold_ticket_params
params.fetch(:sold_ticket, {})
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 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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 url_params\n params[:url].permit(:full)\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 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.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894",
"0.6289475",
"0.62831545",
"0.6242381",
"0.6240358",
"0.6217451",
"0.6214354",
"0.62098235",
"0.61918235",
"0.6177287",
"0.61755854",
"0.61712915",
"0.61620486",
"0.6151379",
"0.61510575",
"0.6145169",
"0.61207956",
"0.6115647",
"0.6107701",
"0.61030304",
"0.60909295",
"0.60797",
"0.60701567",
"0.6062068",
"0.60203075",
"0.60167485",
"0.60125494",
"0.6009718",
"0.6007027",
"0.6007027",
"0.6000283",
"0.59990394",
"0.5996995",
"0.59915864",
"0.59914654",
"0.59912056",
"0.5979621",
"0.596686",
"0.5959418",
"0.59585625",
"0.59583765",
"0.5958032",
"0.5952298",
"0.5951678",
"0.5941885",
"0.59378815",
"0.59376645",
"0.59376645",
"0.5933908",
"0.59302104",
"0.5924862",
"0.5923981",
"0.59165645",
"0.5909916",
"0.590986",
"0.5908378",
"0.5904956",
"0.5897421",
"0.58970135",
"0.5894611",
"0.5893914",
"0.58927566",
"0.5891277",
"0.5885355",
"0.58825094",
"0.58783555",
"0.58728755",
"0.58686864",
"0.5867015",
"0.58660764",
"0.58659357",
"0.5864526",
"0.58634263",
"0.5861585",
"0.5861255",
"0.5858771",
"0.58579147",
"0.5854071",
"0.5853147",
"0.58498794",
"0.58492327"
] | 0.0 | -1 |
def valid_move?(x, y) ((self.position_x self.position_y) == (x y) || (self.position_x + self.position_y) == (x + y)) is_obstructed? to be added end | def valid_move?(x, y)
return false if is_obstructed?(x, y)
diagonal_move_left?(x, y) || diagonal_move_right?(x,y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_move?(new_x, new_y)\n true\n end",
"def legal_move?(x_destination, y_destination)\n x_movement_difference = (x_destination - self.x_pos).abs\n y_movement_difference = (y_destination - self.y_pos).abs\n\n x_movement_difference.between?(0, 1) && y_movement_difference.between?(0, 1)\n end",
"def valid_move?(x_des, y_des)\n ( no_x_move?(x_des) && standard_move?(x_des, y_des) ) ||\n ( promotion_move?(x_des, y_des) || pawn_capture_move?(x_des, y_des) )\n end",
"def valid_move?(cur_pos, next_pos)\n return false if @all_positions[next_pos] # no need to add already seen pos \n cur_col, cur_row = cur_pos\n next_col, next_row = next_pos\n bool_1 = (next_col - cur_col).abs == 2 && (next_row - cur_row).abs == 1\n bool_2 = (next_row - cur_row).abs == 2 && (next_col - cur_col).abs == 1\n bool_1 || bool_2\n end",
"def valid_move? (new_position, ally_positions, enemy_positions)\n return false if ally_positions.include?(new_position)\n return false if (new_position[1] - self.position[1]).abs > 1 && !first_move\n return false if (new_position[0] - self.position[0]).abs > 1\n if new_position[0] != self.position[0]\n return false unless enemy_positions.include?(new_position)\n end\n if enemy_positions.include?(new_position)\n return false unless (new_position[0] - self.position[0]).abs == 1\n end\n if self.colour == \"black\"\n return false if new_position[1] >= self.position[1]\n else\n return false if new_position[1] <= self.position[1]\n end\n return true\n end",
"def can_i_move?(x, y)\n x, y = x.to_i, y.to_i\n ( x >= 0 && x <= dimension.width ) && ( y >= 0 && y <= dimension.height )\n end",
"def is_valid_move x,y\n return false unless (0..3) === x\n return false unless (0..3) === y\n return @field[x][y].player == 0\n end",
"def move_valid?(x, y)\n coordinate_valid?(x, y) && !@visited[y][x]\n end",
"def move_valid?(x, y)\n coordinate_valid?(x, y) && !@visited[y][x]\n end",
"def standard_move?(x,y)\n return (x_diff(x) == 0) && (y_diff(y) == 1)\n end",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def is_move_allowed(to_x,to_y) #Checks to see if the move is allowed based on the pieces 'rule'\n allowed=false\n \n x_diff=(to_x-@x).abs\n y_diff=(to_y-@y).abs\n \n if x_diff <=1 && y_diff <=1\n allowed= true\n end\n if x==to_x && y==to_y\n allowed = false\n end\n\n return allowed\n end",
"def normal_move?(to_x, to_y)\n return true if (to_y - y_position).abs == 1 && to_x == x_position\n false\n end",
"def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end\r\n valid\r\n end",
"def move_valid?(x, y)\n (0...@columns).cover?(x) && (0...@rows).cover?(y) && !@visited[x][y]\n end",
"def can_move?( level, x, y )\n return true\n end",
"def valid_move_command?(x,y)\n @tb_event && @tb_event.tb_unit.tb_valid_move?(x,y) && $game_map.tbu_id_xy(x,y) == 0\n end",
"def check_move(start_pos, end_pos)\n # p start_pos\n # puts end_pos\n\n if self[[start_pos[0], start_pos[1]]].valid_move?(start_pos, end_pos, self)\n self[[start_pos[0], start_pos[1]]].move(start_pos, end_pos, self)\n end\n end",
"def can_move?(end_pos)\n return false if end_pos == self.pos\n return false unless on_board?(end_pos)\n return false unless self.pos.vertical_to?(end_pos) || self.pos.horizontal_to?(end_pos)\n return false if own_piece?(@board[end_pos])\n all_moves = self.pos.to(end_pos)\n return false if all_moves.empty?\n return false unless not_blocked?(all_moves)\n return false unless (self.pos - end_pos) != nil && (self.pos - end_pos).two_norm_square == 2\n return false if is_square_in_check?(end_pos, @@opponent_color[self.color])\n return true\n end",
"def horizontal_move?(x_position, x, y_position, y)\n x_position != x && y_position == y\n end",
"def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end",
"def valid_move?(input)\n (0..8).include?(input) && !position_taken?(input)\n end",
"def valid_move?(*position)\n \t[*position].all? {|coord| coord.between?(0, 2)}\n end",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def check_legal_move(y,x)\n\t\tif y > 7 || y < 0\n\t\t\treturn false\n\t\telsif x > 7 || x < 0\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def move? (x_destination, y_destination)\n\t\t# 2 options\n\t\t# When is does it return true?\n\t\tif x_destination == @x_coordinate && y_destination != @y_coordinate\n\t\t\t# vertical\n\t\t\t\t# x stays the same\n\t\t\t\t# y changes\n\t\t\ttrue \n\t\telsif y_destination == @y_coordinate && x_destination != @x_coordinate\n\t\t\t# horizontal\n\t\t\t\t# y stays the same\n\t\t\t\t# x changes\n\t\t\ttrue\n\n\t\t# When is does it return false?\n\t\telse\n\t\t\t# any other movemente\t\t\t\n\t\t\tfalse\n\t\tend\n\tend",
"def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end",
"def vertical_move?(x_position, x, y_position, y)\n x_position == x && y_position != y\n end",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def standard_move?(x_des, y_des)\n y_chg = (y_des.to_i - y_position).abs\n x_chg = (x_des.to_i - x_position).abs\n x_chg == 0 && ( y_chg == 1 ||\n ( first_move_pawn? && move_forward_two?(x_des, y_des) ) )\n end",
"def legal_move?(board,from,to)\n\t\treturn false unless super(board,to)\n\t\tfrom_y = from[1]\n\t\tfrom_x = from[0]\n\t\tto_y = to[1]\n\t\tto_x = to[0]\n\t\t#when trying to move diagonally\n\t\tif from_x != to_x\n\t\t\t#checks colour of pawn\n\t\t\tif colour == \"white\"\n\t\t\t\t#checks only 1 vertical move away\n\t\t\t\tif (from_y-to_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#when trying to move straight\n\t\tif colour == \"white\"\n\t\t\tif from_y == 6\n\t\t\t\tif (from_y-to_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\t\t\t\t\t\n\t\t\telse\n\t\t\t\tif (from_y-to_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tif from_y == 1\n\t\t\t\tif (to_y-from_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend",
"def valid_move?(start_coords, end_coords)\n return false if end_coords.size == 0 # validate user input\n return true unless valid_move_chain(start_coords, end_coords).empty?\n false\n end",
"def valid_move?(board, index)\nif position_taken?(board, index) == false\n if between?(index) == true\n true\n else\n false\n end\nelse\n false\nend\nend",
"def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend",
"def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend",
"def valid_move?(a,i)\r\n if i.between?(0,8) && !position_taken?(a,i)\r\n true\r\n else\r\n false\r\n end\r\nend",
"def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def move_valid?(pos)\n return false unless board.in_bounds?(pos)\n return false if board.occupied?(pos) && board.grid[pos[0]][pos[1]].color == self.color\n true\n end",
"def valid_move?(board, index)\n if board[index].nil? || position_taken?(board, index) || board[index] == \"X\" || board[index] == \"O\"\n false\n else\n true\n end\nend",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend",
"def valid_move?(position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<[email protected] && !position_taken?(position))\n return true\n end\n return false\n end",
"def valid_move?(robot)\n x_pos = robot.x_position\n y_pos = robot.y_position\n dir = robot.direction\n invalid_east_move = (x_pos == @dimension) && (dir == 'EAST')\n invalid_west_move = x_pos.zero? && (dir == 'WEST')\n invalid_north_move = (y_pos == @dimension) && (dir == 'NORTH')\n invalid_south_move = y_pos.zero? && (dir == 'SOUTH')\n !(invalid_east_move || invalid_west_move || invalid_north_move || invalid_south_move)\n end",
"def valid_move?\n\t\tvalid_1 = (0..2).include? (@take_from)\n\t\tvalid_2 = (0..2).include? (@move_to)\n\t\tif valid_1 == false || valid_2 == false\n\t\t\tputs \"I'm sorry, please input your move in a 'x,y' format, ensuring that you are selecting numbers between 1 and 3!\"\n\t\t\tmove_input\n\t\telsif @pegs[@take_from][0] == nil\n\t\t\tputs \"I'm sorry, I'm not in the mood for a philosophical debate so let's just agree that you cannot move nothing and you can try again.\"\n\t\t\tmove_input\n\t\tend\n\tend",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def is_move_available?\n self.robot.world.is_move_available?(self.x, self.y)\n end",
"def valid_move?(board, ix)\n if position_taken?(board, ix) == false && move_val?(ix) == true\n return true\n else\n false\n end\nend",
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def move\n return false if @position.nil?\n \n movements = { north: { x: 0, y: 1 }, east: { x: 1, y: 0 }, south: { x: 0, y: -1 }, west: { x: -1, y: 0 } }\n position, movement = @position, movements[@direction]\n\n return false unless valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n \n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n true\n end",
"def validate_move(world, new_coords)\n true if new_coords[0].between?(0, world.size-1) && new_coords[1].between?(0, world.size-1)\n end",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend",
"def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n\nend",
"def valid_move?(board, i)\n # check if position taken or 'out-of-bounds'\n if (position_taken?(board, i) == true) || (i > 8) || (i < 0)\n return false\n else \n return true\n end \nend",
"def valid_move?(board, position)\n position = position.to_i\n if (position.between?(1,9)) && !(board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n else\n return false\n end\nend",
"def can_move?\n @max_movement > 0\n end",
"def valid_move?(position)\n position = position.to_i - 1\n if position_taken?(position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(position) == true\n return false\nelse \n return false\nend\nend",
"def valid_move?(position)\n if is_number?(position)\n if position.to_i.between?(0, 10)\n if position_taken?(position.to_i-1)\n false\n else\n true\n end\n else \n false\n end\n else\n false\n end\n end",
"def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend",
"def valid_move(start, stop, board)\r\n x_diff = (stop[0] - start[0]).abs\r\n y_diff = (stop[1] - start[1]).abs\r\n return true if (x_diff == 0 || x_diff == 1) && (y_diff == 0 || y_diff ==1)\r\n return false\r\n end",
"def valid_move? (board, index)\n if position_taken?(board,index) != false || !(index.between?(0,8))\n return false\n elsif position_taken?(board,index) == false && index.between?(0,8)\n return true\n end\nend",
"def check_move(direction)\n\n if direction == 0 #up\n if @y < 1\n \n return false\n end\n elsif direction == 1 #down\n if @y > @boundry\n \n return false\n end\n elsif direction == 2 #left\n if @x < 1\n \n return false\n end\n else #right\n\n if @x > @boundry\n \n return false\n end\n\n end\n\n return true\n end",
"def valid_move?(index)\n if position_taken?(index)\n false\n elsif index < 0 || index > 8\n false\n else\n true \n end\n end",
"def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend",
"def valid_move?(board,position)\n\tif position.to_i.between?(1, 10) && empty_position?(board, position.to_i)\n\t\t\treturn true \n\telse\n\t\treturn false \n\tend\nend",
"def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end",
"def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend",
"def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend",
"def is_move_valid(move)\n @moves.include? move\n end",
"def valid_move?(board, position)\n position = position.to_i - 1\n position_taken?(board, position) == false && position.between?(0,8) == true\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend",
"def valid_move?\n\t\[email protected]_on_table?(@robot_direction, @x, @y)\n\tend",
"def can_move_to?(x, y)\n old_x = @object.x\n old_y = @object.y\n @object.move(x, y)\n\n unless @object_pool.world.can_move_to?(x, y)\n terrain = @object_pool.world.world[y][x]\n @object.stats.add_message(\"Bump into a #{terrain.id} #{terrain.symbol} (#{@object.x}, #{@object.y})\")\n return false\n end\n\n @object_pool.same_point_objects(@object.x, @object.y, @object).each do |obj|\n case obj\n when Character\n obj.on_collision(@object)\n return false\n when Item\n break if @object.input.is_a?(AiInput)\n\n obj.on_collision(@object)\n end\n end\n\n true\n ensure\n @object.move(old_x, old_y)\n end",
"def valid_move?(board, position)\n position = position.to_i\n if(position.between?(1,9))\n position -=1\n if(position_taken?(board, position))\n false\n else\n true\n end\n end\nend",
"def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend",
"def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(board, position) == true\n return false\nelse \n return false\nend\nend",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def valid_move?(index)\n if position_taken?(index)\n false\n elsif position_taken?(index) == false && index.between?(0,8)\n true\n end\n end",
"def valid_move?(position)\n position && @maze[position] != \"*\" && @times_visited[position] < 2 && position[0] < @maze.maze.length && position[1] < find_max_row_length \n end",
"def valid_move?(board, index)\n if position_taken?(board, index) or !(index >= 0 and index < 9)\n false\n else\n true\n end\nend",
"def valid_move?(board,position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=board.length && !position_taken?(board,position))\n return true\n end\n return false\nend",
"def valid_move? index_position \n index_position < 9 && !position_taken?(index_position)\n end",
"def valid_move?(board, position)\n position = position.to_i\n \n if !(position_taken?(board, position-1)) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def valid_move?( board, position )\n position_int = position.to_i\n position_ary = position_int - 1\n if !(position_taken?( board, position_ary )) && position_ary.between?( 0, 8 )\n true\n else\n false\n end\nend",
"def valid_move?( board, position )\n position_int = position.to_i\n position_ary = position_int - 1\n if !(position_taken?( board, position_ary )) && position_ary.between?( 0, 8 )\n true\n else\n false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def first_move?(to_x, to_y)\n if color == 'black' && y_position == 7 || color == 'white' && y_position == 2\n return true if ((to_y - y_position).abs == 1 || (to_y - y_position).abs == 2) && to_x == x_position\n else\n false\n end\n end",
"def valid_move?(current_obj, next_obj, current_cell, test_cell)\n cc_row = current_cell[0]\n cc_col = current_cell[1]\n tc_row = test_cell[0]\n tc_col = test_cell[1]\n\n next_obj == current_obj &&\n cc_row == tc_row - 1 && cc_col == tc_col - 1 || \\\n cc_row == tc_row - 1 && cc_col == tc_col || \\\n cc_row == tc_row - 1 && cc_col == tc_col + 1 || \\\n cc_row == tc_row && cc_col == tc_col + 1 || \\\n cc_row == tc_row + 1 && cc_col == tc_col + 1 || \\\n cc_row == tc_row + 1 && cc_col == tc_col || \\\n cc_row == tc_row + 1 && cc_col == tc_col - 1 || \\\n cc_row == tc_row && cc_col == tc_col - 1 \n end",
"def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend",
"def promotion_move?(_x_des, _y_des)\n false\n end"
] | [
"0.8775423",
"0.83912027",
"0.8263296",
"0.82556367",
"0.82047415",
"0.8173667",
"0.8152844",
"0.81271267",
"0.81271267",
"0.81244326",
"0.8100789",
"0.8078021",
"0.7983049",
"0.7937657",
"0.7935846",
"0.7927927",
"0.79033",
"0.7890252",
"0.7879887",
"0.7878882",
"0.7872121",
"0.78667486",
"0.7834854",
"0.78329116",
"0.78303987",
"0.7829813",
"0.7822833",
"0.78092885",
"0.77781516",
"0.7775944",
"0.7770254",
"0.7765162",
"0.7762116",
"0.77501583",
"0.77334",
"0.77270097",
"0.7718118",
"0.7710229",
"0.7699336",
"0.7694427",
"0.7678875",
"0.76676935",
"0.76670486",
"0.765196",
"0.7637064",
"0.76354194",
"0.763505",
"0.76337457",
"0.76246566",
"0.7621182",
"0.7619438",
"0.76190335",
"0.76140434",
"0.76051605",
"0.7605156",
"0.75986505",
"0.7597956",
"0.7589838",
"0.7586795",
"0.75866234",
"0.7586281",
"0.7582353",
"0.75816107",
"0.75808185",
"0.7578948",
"0.75691724",
"0.75612634",
"0.7560569",
"0.75601685",
"0.75573146",
"0.7553219",
"0.7548157",
"0.7544754",
"0.7544126",
"0.7540654",
"0.753936",
"0.75380087",
"0.7535718",
"0.75346273",
"0.75259393",
"0.75256085",
"0.75251025",
"0.7510622",
"0.7504106",
"0.7500233",
"0.7499967",
"0.74953943",
"0.7492972",
"0.74857557",
"0.7484943",
"0.74769855",
"0.74721456",
"0.74704444",
"0.74662036",
"0.74662036",
"0.74565256",
"0.7455074",
"0.7451314",
"0.744862",
"0.7446839"
] | 0.8724223 | 1 |
def supplier Supplier.find_by(id: supplier_id) end | def is_discounted?
price.to_f <= 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supplier\n Supplier.find_by(:id => supplier_id)\n end",
"def supplier\n # Look in the supplier's table for a supplier with an id that matches supplier_id\n Supplier.find_by(id: supplier_id)\n end",
"def get_supplier()\n supplier = Supplier.find(supplier_id)\n return supplier\n end",
"def get_supplier\n supplier = Supplier.where(:code => self.accountcode).first\n self.supplier_id = supplier.id if supplier\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def supplier()\n sql = \"SELECT * FROM suppliers WHERE id = $1\"\n values = [@supplier_id]\n result = SqlRunner.run(sql, values)[0]\n return Supplier.new(result)\n end",
"def show\n @supplier = Supplier.find(params[:supplier_id])\n \n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.friendly.find(params[:id])\n end",
"def show\n @supplier = Supplier.find(params[:id])\n end",
"def set_supplier\n @supplier = Supplier.find(params[:id])\n end",
"def set_product_supplier\n @product_supplier = ProductSupplier.find(params[:id])\n end",
"def set_supplier_product\n @supplier_product = SupplierProduct.find(params[:id])\n end",
"def edit\n @supplier = Supplier.find(params[:id])\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @products = Product.where(:supplier_id => @supplier.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @supplier }\n end\n end",
"def set_catalog_supplier\n @catalog_supplier = Catalog::Supplier.find(params[:id])\n end",
"def set_supplier_provider\n @supplier_provider = Supplier::Provider.find(params[:id])\n end",
"def set_supplier_item\n @supplier_item = SupplierItem.find(params[:id])\n end",
"def supplier_variant(supplier)\n self.supplier_variants.where(supplier_id: supplier).first\n end",
"def set_catalogs_supplier\n @catalogs_supplier = Catalogs::Supplier.find(params[:id])\n end",
"def show\n #mostra o nome ao inves do id\n @supplier = Supplier.find(@payment.supplier_id)\n end",
"def set_supplier_master\n @supplier_master = SupplierMaster.find(params[:id])\n end",
"def supplier_name\n supplier.name if supplier\n end",
"def getEntityBy_supplier_id( supplier_id)\n params = Hash.new\n params['supplier_id'] = supplier_id\n return doCurl(\"get\",\"/entity/by_supplier_id\",params)\n end",
"def set_supplierpayment_detail\n @supplierpayment_detail = SupplierpaymentDetail.find(params[:id])\n end",
"def show\n @suppliers=Supplier.where(\"id<?\",10000000);\n @products=Product.where(\"id<?\",10000000);\n end",
"def show_supplier_name\n @suppliers = Supplier.order(:name)\n end",
"def show\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end",
"def set_backoffice_supplier\n @backoffice_supplier = Supplier.find(params[:id])\n end",
"def set_supplier_type\n @supplier_type = SupplierType.find(params[:id])\n end",
"def getEntityProvisionalBy_supplier_id( supplier_id)\n params = Hash.new\n params['supplier_id'] = supplier_id\n return doCurl(\"get\",\"/entity/provisional/by_supplier_id\",params)\n end",
"def show\n @admin_supplier = Admin::Supplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_supplier }\n end\n end",
"def show\n @quartz = Quartz.find(params[:id])\n \n @supplier = Supplier.where(\"code=?\", @quartz.supplier ).first\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quartz }\n end\n end",
"def show\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def show\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def set_supplier\n @object.supplier = spree_current_user.supplier\n end",
"def best_supplier\n self.suppliers.joins(:stock_locations => :stock_items).\n where('spree_stock_items.variant_id = spree_supplier_variants.variant_id').\n where('spree_stock_items.count_on_hand > 0').\n order('spree_supplier_variants.cost').first\n end",
"def index\n @suppliers = Supplier.all\n end",
"def index\n @suppliers = Supplier.all\n end",
"def index\n @suppliers = Supplier.all\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @pagetitle = \"Suppliers - #{@supplier.name}\"\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @pagetitle = \"Suppliers - #{@supplier.name}\"\n end",
"def set_oxygen_supplier\n @oxygen_supplier = OxygenSupplier.find(params[:id])\n end",
"def set_supplier_category\n @supplier_category = SupplierCategory.find(params[:id])\n end",
"def is_supplier?\n supplier ? true : false\n end",
"def index\n @product_suppliers = ProductSupplier.all\n @suppliers=Supplier.where(\"id<?\",10000000);\n @products=Product.where(\"id<?\",10000000);\n end",
"def set_contact\n @supplier = Supplier.find(params[:supplier_id])\n @contact = @supplier.contact\n end",
"def show\n @suppliertype = Suppliertype.find(params[:id])\n end",
"def suppliers\n self.players.supplier\n end",
"def index\n @supplier_items = SupplierItem.all\n end",
"def index\n @supplier = Supplier.find(params[:supplier_id])\n @services = @supplier.services.all\n end",
"def supplier_collection\n show_only_supplier_products = try_spree_current_user &&\n !try_spree_current_user.admin? &&\n try_spree_current_user.supplier?\n if show_only_supplier_products\n @collection = \n @collection.where(supplier_id: try_spree_current_user.supplier_id)\n end\n end",
"def set_supplier_category\n @supplier_category = SupplierCategory.find(params[:id])\n end",
"def set_fabric_variant_supplier\n @fabric_variant_supplier = FabricVariantSupplier.find(params[:id])\n end",
"def supplier?\n supplier.present?\n end",
"def supplier_params\n params.require(:supplier).permit(:supplier_name, :supplier_address, :supplier_contact, :supplier_email, :user_id)\n end",
"def set_service\n @supplier = Supplier.find(params[:supplier_id])\n @service = Service.find(params[:id])\n end",
"def set_supplier_package\n @supplier_package = SupplierPackage.find(params[:id])\n end",
"def show\n @supplier_sku = SupplierSku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_sku }\n end\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @products = @supplier.products.paginate(:page => params[:page])\n \n \n\n @reorder_url = reorder_suppliers_url\n flash[:notice] = \"Supplier has (#{@products.size}) products.\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def show\n @lab_supplier = LabSupplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_supplier }\n end\n end",
"def supplier_params\n params.require(:supplier).permit(:person_id)\n end",
"def show\n if @search.industry_id.nil?\n @results = Supplier.near(@search.location)\n else\n @results = Supplier.where(\"industry_id = ?\", @search.industry_id).near(@search.location)\n end\n ids = []\n @results.each do |r|\n ids.push r.id\n end\n @offers = Offer.where(supplier_id: ids).all\n end",
"def index\n @catalog_suppliers = Catalog::Supplier.all\n end",
"def product_supplier_params\n params.require(:product_supplier).permit(:id_product, :id_supplier)\n end",
"def index\n @supplier_providers = Supplier::Provider.all\n end",
"def update\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n if @supplier.update_attributes(params[:supplier])\n format.html { redirect_to @supplier, notice: 'Supplier was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_supply\n @supply = Supply.friendly.find(params[:id])\n end",
"def update\n @pagetitle = \"Edit supplier\"\n \n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n if @supplier.update_attributes(params[:supplier])\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @warehouse_supplier = WarehouseSupplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warehouse_supplier }\n end\n end",
"def create\n @supplier = current_merchant.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n @supplier.ordering_method_ids = params[:supplier][:ordering_method_ids]\n @supplier.delivery_location_ids = params[:supplier][:delivery_location_ids]\n @supplier.online_retail_service_type_ids = params[:supplier][:online_retail_service_type_ids]\n @supplier.product_category_ids = params[:supplier][:product_category_ids]\n end",
"def has_supplier?\n supplier_product.present? && supplier.present?\n end",
"def all_suppliers\n suppliers = self.suppliers.order(\"name ASC\")\n result = []\n suppliers.each do |supplier|\n \n result << [ \"#{supplier.name}\" , \n supplier.id ]\n \n end\n return result\n end",
"def update\n @pagetitle = \"Edit supplier\"\n \n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n if @supplier.update_attributes(supplier_params)\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_supplier_promotion_activity\n @supplier_promotion_activity = Auction::PromotionActivitySupplier.find(params[:id])\n end",
"def new\n get_supplier\n @supplier_phone = @supplier.phones.new\n end",
"def supplier_params\n params.require(:supplier).permit(:name, :num_doc, :type_doc_id)\n end",
"def index\n @product = @seller.products.find(params[:product_id]) \n end",
"def supplier\n result = contact_categories.first(:conditions => {:category_type => Supplier.to_s})\n result ? result.category : nil\n end",
"def update\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n if @supplier.update_attributes(params[:supplier])\n format.html { redirect_to @supplier, :notice => 'Dobavljac je uspjesno izmjenjen.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_supplier = Admin::Supplier.find(params[:id])\n\n respond_to do |format|\n if @admin_supplier.update_attributes(params[:admin_supplier])\n format.html { redirect_to admin_suppliers_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getFirstSupplier\n\t\t# Get and return origin supplier\n\t\tfirst_connection = self.getFirstConnection\n\t\tif (first_connection != nil)\n\t\t\tfirst_supplier = Supplier.find(first_connection.supplier_a_id)\n\t\t\tfirst_supplier.name\n\t\telse\n\t\t\t\"\"\n\t\tend\n\tend",
"def change_supplier(supp_id=nil)\n return if supp_id.nil?\n self.update_attribute(:supplier_id, supp_id)\n\n #if having combis\n combis = OrderProcessing.where(\"combi_id = ?\", self.id)\n unless combis.empty?\n combis.each{|op| op.update_attribute(:supplier_id, supp_id) }\n end\n \n #if having splits\n splitted = OrderProcessing.where(\"parent_order_id = ?\", self.order_id)\n unless splitted.empty?\n splitted.each{|op| op.update_attribute(:supplier_id, supp_id) }\n end\n end",
"def index\n @supplierpayment_details = SupplierpaymentDetail.all\n end",
"def update\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @supplier, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier = Supplier.new(params[:supplier])\n \n respond_to do |format|\n if @supplier.save\n flash.now[:notice] = 'Supplier was successfully created.'\n format.html { redirect_to(suppliers_path) }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render json: @supplier, status: :created, location: @supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_supplier( employee, supplier_params) \n supplier = Supplier.new(supplier_params)\n if not employee.has_role?(:admin)\n supplier.errors.add( :authentication , \"Wrong Role: No admin role\")\n return supplier\n end\n \n \n \n supplier.office_id = self.id \n supplier.creator_id = employee.id \n supplier.save\n \n \n return supplier\n end",
"def show\n @breadcrumb = 'read'\n @supplier_payment = SupplierPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_payment }\n end\n end",
"def edit\n @suppliertype = Suppliertype.find(params[:id])\n end",
"def show\n @supplier_payment = SupplierPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier_payment }\n end\n end",
"def index\n @suppliers = Supplier.where(user_id: current_user.user_id).search(params[:search]).paginate(page: params[:page], per_page: 50).order('supplier_name ASC')\n end",
"def list_suppliers\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Suppliers\"\n \n if(@company.can_view(getUser()))\n if(params[:q] and params[:q] != \"\")\n fields = [\"email\", \"name\"]\n\n q = params[:q].strip\n @q_org = q\n\n query = str_sql_search(q, fields)\n\n @suppliers = Supplier.paginate(:page => params[:page], :order => 'name', :conditions => [\"company_id = ? AND (#{query})\", @company.id])\n else\n @suppliers = Supplier.paginate(:page => params[:page], :order => \"name\", :conditions => {:company_id => @company.id})\n end\n else\n errPerms()\n end\n end"
] | [
"0.9492767",
"0.9341116",
"0.84718066",
"0.84026754",
"0.8299823",
"0.8206647",
"0.8200205",
"0.8115367",
"0.8115367",
"0.8115367",
"0.8115367",
"0.8115367",
"0.8115367",
"0.8115367",
"0.8115367",
"0.8092614",
"0.8084593",
"0.7982103",
"0.7699587",
"0.7550884",
"0.7434136",
"0.7391752",
"0.73849595",
"0.73521155",
"0.7336573",
"0.7296812",
"0.7225514",
"0.7130437",
"0.71190524",
"0.7082537",
"0.69950974",
"0.69469327",
"0.6929463",
"0.6924598",
"0.6901927",
"0.68489754",
"0.684675",
"0.68294364",
"0.68157357",
"0.68091035",
"0.67891914",
"0.67891914",
"0.6769149",
"0.67398816",
"0.6707455",
"0.6707455",
"0.6707455",
"0.67038363",
"0.67038363",
"0.6701506",
"0.6686207",
"0.66386294",
"0.66160464",
"0.65826607",
"0.6560723",
"0.65542495",
"0.6535859",
"0.65194184",
"0.6516331",
"0.65069324",
"0.6476362",
"0.6472379",
"0.64561045",
"0.6439287",
"0.640059",
"0.6398125",
"0.6355596",
"0.6330944",
"0.6308196",
"0.62960094",
"0.6282034",
"0.6267228",
"0.62009007",
"0.6185063",
"0.616176",
"0.61579955",
"0.6154598",
"0.6154467",
"0.614024",
"0.6132904",
"0.61234003",
"0.61226207",
"0.6099254",
"0.6081319",
"0.6075367",
"0.607104",
"0.6067025",
"0.6045904",
"0.60376894",
"0.60329837",
"0.60326385",
"0.60237116",
"0.6023086",
"0.60197866",
"0.6014105",
"0.60122573",
"0.6001915",
"0.5992722",
"0.59818906",
"0.59796965",
"0.59680015"
] | 0.0 | -1 |
There is a bus moving in the city, and it takes and drop some people in each bus stop. You are provided with a list (or array) of integer arrays (or tuples). Each integer array has two items which represent number of people get into bus (The first item) and number of people get off the bus (The second item) in a bus stop. Your task is to return number of people who are still in the bus after the last bus station (after the last array). Even though it is the last bus stop, the bus is not empty, and some people are still in the bus, and they are probably sleeping there :D Take a look on the test cases. Please keep in mind that the test cases ensure that the number of people in the bus is always >= 0. So the return integer can't be negative. The second value in the first integer array is 0, since the bus is empty in the first bus stop. Example: Test.assert_equals number([[10, 0], [3, 5], [5, 8]]), 5 Test.assert_equals number([[3, 0], [9, 1], [4, 10], [12, 2], [6, 1], [7, 10]]), 17 Test.assert_equals number([[3, 0], [9, 1], [4, 8], [12, 2], [6, 1], [7, 8]]), 21 My answer: | def number(bus_stops)
item_1 = bus_stops.sum(&:first) #return the sum of first elements in arrays (i.e. people get on the bus)
item_2 = bus_stops.sum(&:last) #return the sum of last elements in arrays (i.e. people get off the bus)
p passengers = item_1 - item_2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number(bus_stops)\n entries = []\n exits = []\n bus_stops.each { |x| entries << x[0] }\n bus_stops.each { |x| exits << x[1] }\n p entries.inject(&:+) - exits.inject(&:+)\nend",
"def number(bus_stop)\n people_left = 0\n bus_stop.each do |stop|\n people_left += (stop[0] - stop[1])\n end\n people_left\nend",
"def solve2\n input = Utils.input_read(13)\n busses = input[1].split(',').each_with_index.map { |b, i| { buss: b.to_i, offset: i } }.filter { |b| b[:buss] != 0 }\n\n biggest_bus = busses.max { |b| b[:buss] }\n # puts biggest_bus\n sequence = Enumerator.new do |yielder|\n number = 0\n loop do\n number += biggest_bus[:buss]\n yielder.yield number\n end\n end\n\n t = sequence.find do |i|\n busses.all? { |b| (i + b[:offset] - biggest_bus[:offset]) % b[:buss] == 0 }\n end\n puts t\nend",
"def checkCount(arrival,duration)\n return arrival.length if arrival.length<2\n\n event_count=1\n\n (1...arrival.length).each do |idx|\n prev_arrival = arrival[idx-1]\n curr_arrival = arrival[idx]\n time_req = duration[idx]\n\n event_count+=1 if time_req <= curr_arrival-prev_arrival\n end\n\n event_count\n\nend",
"def busiest_time(doordata)\n pop_cnt = 0\n max_pop = 0\n res = 0\n \n doordata.each_with_index do |e, i| \n \n if e.last == 0 \n pop_cnt -= e[1]\n elsif e.last == 1 \n pop_cnt += e[1] \n end \n \n # need to check all values at a given time stamp \n # before making the comparison with max_pop\n next if i < doordata.length-1 && e[0] == doordata[i+1][0]\n \n if pop_cnt > max_pop \n res = e.first\n max_pop = pop_cnt\n end \n end \n \n res \nend",
"def number(bus_stops)\n x = bus_stops.flatten\n ins = x.select.with_index{|_,i| (i+2) % 2 == 0}.inject(:+)\n outs = x.each_slice(2).map(&:last).inject(:+)\n ins - outs\nend",
"def number(bus_stops)\n count = 0\n bus_stops.each { |stop| count += stop[0] -= stop[1] }\n count\nend",
"def getArrayIndexes(current_trips)\n stop_index_array = []\n user_stop_index = 0\n trip_stops_array = JSON.parse(File.read(TRIP_STOPS))\n\n for trip in trip_stops_array\n for current_trip in current_trips\n # puts \"current_trip: #{current_trip} / trip[0]: #{trip[0]}\"\n if current_trip[trip[0]] != nil\n puts \"current_trip[trip[0]] is #{current_trip[trip[0]]}\"\n stops_array = trip[1]\n if stops_array.include?(@user_stop_id)\n puts \"#{trip} comes to user\"\n user_stop_index = stops_array.index(@user_stop_id)\n for stop in stops_array\n if stop == current_trip[trip[0]]\n stop_index_array << stops_array.index(current_trip[trip[0]])\n end\n end\n end\n end\n end\n end\n\n if stop_index_array.count == 0\n puts \"there are no buses at this time\"\n else\n return calculate(user_stop_index, stop_index_array)\n end\n\n end",
"def number(bus_stops)\n bus_stops.reduce(0) do |sum, array|\n sum + array[0] - array[1]\n end\nend",
"def number(bus_stops)\n number_passengers = 0\n\n bus_stops.each do |stop|\n number_passengers += stop[0]\n number_passengers -= stop[1]\n end\n number_passengers\nend",
"def countApplesAndOranges(s, t, a, b, apples, oranges)\n # apple_tree = a\n # orange_tree = b\n # house = [s, t]\n apple_count = 0\n orange_count = 0\n\n apples.collect do |distance|\n if ((a + distance) >= s) && ((a + distance) <= t)\n apple_count += 1\n end\n end\n\n oranges.collect do |distance|\n if ((b + distance) >= s) && ((b + distance) <= t)\n orange_count += 1\n end\n end\n\n puts apple_count\n puts orange_count\n\nend",
"def missing(array, data)\n array_total = 0\n data_total = 0\n array.each {|n| array_total += n}\n data.each {|n| data_total += n }\n p (data_total - array_total)\nend",
"def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend",
"def available_spots(arr, num)\n count = 0\n arr.each_with_index do |item, index|\n next if index == arr.count - 1\n if item.odd? == arr[index + 1].odd? \n if item.odd? != num.odd?\n next\n else\n count += 1\n end\n else\n count += 1\n end\n end\n count\nend",
"def all_nailed?(a, b, c, nails)\n planks = 0\n# N and M are integers within the range [1..30,000];\n# each element of arrays A, B, C is an integer within the range [1..2*M];\n nails_marked = [0] * (2 * c.size + 1)\n\n # mark each nail # with a 1\n nails.times do |i|\n nails_marked[c[i]] = 1\n end\n\n# nails: 4\n# nails_marked: [0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1]\n\n # prefix sums\n (1..nails_marked.size - 1).each do |i|\n nails_marked[i] += nails_marked[i - 1]\n end\n\n# shows how many nails have been hammered in by certain position\n# nails_marked: [0, 0, 0, 0, 1, 1, 2, 3, 3, 3, 4]\n\n a.size.times do |i|\n # prefix sum trick: # of nails hammered in between both ends of plank i\n if nails_marked[b[i]] - nails_marked[a[i] - 1] > 0\n planks += 1\n end\n end\n planks == a.size # if # of planks nailed = all planks, return TRUE\nend",
"def find_lis_brute_force array\n max_count = -1\n # Generate all the possible sets. This is done by generating all binary numbers from 1 to 2^n.\n # The presence of a 0 in the binary number at a position will grant entry to the element at that position to the set\n for i in 1..((2**array.count) - 1)\n itr = array.count - 1\n set = []\n while i > 0\n if i%2 == 1\n set << array[itr]\n end\n i = i/2\n itr -= 1\n end\n max_count = max(max_count, evaluate(set))\n end\n return max_count\nend",
"def solution(a)\n if a.count >= 3\n distances = []\n last = nil\n (1...a.count - 1).each { |i|\n if a[i] > a[i - 1] and a[i] > a[i + 1]\n distances << i - last if last\n last = i\n end\n }\n puts distances.inspect\n \n (distances.count + 1).downto(1) { |flags|\n return flags if distances.all? { |d| d >= flags }\n }\n end\n 0\nend",
"def min_refuel array_of_gas_station, total_distance, l_km\r\n\tt1 = Time.now\r\n\ttotal_refuel = 0\r\n\trefueld_at = []\r\n\tcan_travel = l_km\r\n\tflag = \"yes\"\r\n\tarray_of_gas_station.each_with_index do |arr,index|\r\n\t\tif arr > can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << (index-1)\r\n\t\telsif arr == can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << index\r\n\t\tend\r\n\tend\r\n\trefueld_at.each_with_index do |arr, i|\r\n\t\tif refueld_at[i] == refueld_at[i+1] || refueld_at[i] < 0\r\n\t\t\tflag = \"no\"\r\n\t\tend\r\n\tend\r\n\tif flag.eql? \"yes\"\r\n\t\tt2 = Time.now\r\n\t\tp \"total refuel : #{total_refuel}\"\r\n\t\tp \"refueled at : #{refueld_at}\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\telse\r\n\t\tt2 = Time.now\r\n\t\tp \"can't travel\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\tend\r\nend",
"def countApplesAndOranges(start_point, ending_point, apple_tree,\n orange_tree, apples, oranges)\n fallen_a = Array.new(0)\n fallen_o = Array.new(0)\n v = start_point..ending_point\n apples.each do |a|\n fallen_a << a if v.include?(apple_tree + a)\n end\n oranges.each do |o|\n fallen_o << o if v.include?(orange_tree + o)\n end\n p fallen_a.size\n p fallen_o.size\nend",
"def no_overlap(time_window, deliveries)\n ans = []\n earliest, latest = time_window\n deliveries.sort_by!{ |start, finish| finish }\n deliveries.each do |start, finish|\n next if start < earliest || finish > latest\n if ans.empty?\n ans = [[start, finish]]\n elsif ans.last[1] < start\n ans << [start, finish]\n end\n end\n\n ans\n # ans.size\nend",
"def solve(fighters, bosses)\n f_count = fighters.count(1)\n return bosses.select {|sub_arr| sub_arr.count(1) >= f_count}\nend",
"def birthdayCakeCandles(ar)\n height = 0\n count = 0\n ar.collect do |number|\n if number > height\n count = 1\n height = number\n elsif number == height\n count += 1\n else\n end\n end\n return count\nend",
"def find_suspect(*numbers)\n suspect_count = Hash.new\n # Count number of times integers occurs in list and tally in hash\n numbers.each { |suspect| suspect_count[suspect] = suspect_count[suspect].to_i + 1 }\n # Integers placed into array of arrays ordered by count \n sorted_count = suspect_count.sort_by {|key, value| value}\n if sorted_count.size == 1\n return sorted_count[0][0]\n elsif sorted_count.size == 0\n return nil\n elsif sorted_count[0][1] < sorted_count[1][1]\n # Returns integer with the fewest instances\n return sorted_count[0][0]\n else\n # If all integers have same count return nil\n return nil\n end\nend",
"def makeArrayConsecutive2(statues)\n a = statues.sort\n count = 0\n if statues.count > 1\n for num in a.shift..a.pop\n unless statues.include?(num)\n count += 1\n end\n end\n end\n count\nend",
"def joltageDiff(input)\n # add my input device with rating +3\n input.append(input.max + 3)\n arr = input\n .sort\n .reverse\n \n diffs = arr\n .map.with_index{ |n, i|\n if i < arr.size - 1\n n - arr[i+1]\n end\n }\n diffs.pop # remove last element\n # puts diffs.sort\n counts = [0, 0, 0]\n counts[0] = diffs.select{ |n| n == 1 }.size + 1 # fuck knows why this is here.. #dirtyhack\n counts[1] = diffs.select{ |n| n == 2 }.size\n counts[2] = diffs.select{ |n| n == 3 }.size\n #puts counts\n return counts\nend",
"def summer (array, target_number)\n\t#tracks number position in array \n\tindex = 0\n\t#array of two element arrays that is returned by function\n\tanswer_array = []\n\twhile index <= array.length\n\t \tarray.each do |number|\n\t\t\tif (((array[index].to_i + array[number].to_i) == target_number) && index != number)\n\t\t\t\tanswer_array.push([array[index], array[number]])\n\t\t\tend \n end\n index += 1 \n end \t\n answer_array\nend",
"def busy_customers(deliveries)\n secs_in_month = 60 * 60 * 24 * 30\n hash = {} # {id: [time difference, # of deliveries]}\n ans = []\n deliveries.each do |id, time|\n if hash[id]\n last_time, delivery_num = hash[id]\n if time - last_time < secs_in_month\n delivery_num += 1\n hash[id][1] = delivery_num\n next\n end\n end\n\n hash[id] = [time, 1]\n end\n\n hash.each do |id, arr|\n ans << id if arr[1] >= 3\n end\n\n ans\nend",
"def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend",
"def cnts a\n r = []\n found = false\n a.each do |x|\n r.each do |y|\n if y[0] === x\n y[1] += 1\n found = true\n break\n end\n end\n if !found\n r.push([x, 1])\n else\n found = false\n end\n end\n r\nend",
"def count_in_array(number)\n first = first_in_array(number)\n return 0 if first == -1\n\n last = last_in_array(number)\n (last - first + 1)\n end",
"def move_count(array_of_arrays)\n position = [0, 0]\n total_distance = 0\n array_of_arrays.each do |array|\n total_distance += distance_calculator(position, array)\n position = array\n end\n #count the move back to the [0,0] ending position\n total_distance += distance_calculator(position, [0,0])\n total_distance\n end",
"def run\n # Digits 1,4,7,8 have 2,4,3,7 segments respectively\n @list.map{|line| line[1]}.flatten.map(&:length).filter{|len| [2, 4, 3, 7].include?(len)}.count\n end",
"def look_and_say(array)\n # Step 0: intialize variables\n result = []\n count = 1\n cur_num = array.first\n \n # Step 1: iterate array\n array.each.with_index do |num, idx|\n # Step 2: next if num is the first item in array\n next if idx == 0\n # Step 2a: Check if num is the same value as the previous element in array\n if num != cur_num\n result << [count, cur_num]\n cur_num = num\n # Step 2b: If cur_num and num are equivalent increment count\n else\n count += 1\n end\n end\n\n # Step 3: Push the last [count, num] into the result array\n result << [count, cur_num]\n\n result\nend",
"def solve(array)\n largest_diff = array[1] - array[0]\n result = []\n\n array.each_with_index do |element, index|\n if array[index + 1] != nil\n if (array[index + 1] - array[index]) >= largest_diff\n result << array[index + 1]\n end\n end\n end\nend",
"def freed_prisoners(arr)\n counter = 0\n return counter if arr[0] == 0\n arr.each do |cell|\n if cell == 1\n counter += 1\n arr.map! do |switch|\n if switch == 1\n switch = 0\n else\n swith = 1\n end\n end\n else\n next\n end\n end\n counter\nend",
"def verify(ans_arr, arr)\n p1 = []\n p2 = []\n [0,1,2].each do |i|\n [0,1,2].each do |j|\n if arr[i][j] == 1 \n p1.push(ans_arr[i][j])\n elsif arr[i][j] == 0\n p2.push(ans_arr[i][j]) \n end\n end\n end\n \n if p1.length == 3 \n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-3] == 15\n end\n if p1.length == 4\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-4] == 15\n end\n if p1.length == 5\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-5] == 15 || \n p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-1] + p1[p1.length-4] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-4] + p1[p1.length-5] == 15 || \n p1[p1.length-3] + p1[p1.length-4] + p1[p1.length-5] == 15 \n end\n if p2.length == 3 \n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-3] == 15\n end\n if p2.length == 4\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-4] == 15\n end\n if p2.length == 5\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-5] == 15 || \n p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-1] + p2[p2.length-4] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-4] + p2[p2.length-5] == 15 || \n p2[p2.length-3] + p2[p2.length-4] + p2[p2.length-5] == 15 \n end\nend",
"def compareTriplets(a, b)\n array_a = a\n array_b = b\n results = [0,0]\n array_a.collect.with_index do |value, index|\n if value > array_b[index]\n results[0] += 1\n elsif value < array_b[index]\n results[1] += 1\n end\n end\n return results\nend",
"def findMissingNumbers( arrayOfNumbers )\n # walk through all known numbers\n # for each known number + 1 print until reaching next number\n $last = arrayOfNumbers[0].to_i\n arrayOfNumbers.each { |known|\n $last = $last.to_i + 1\n while $last < known.to_i\n puts $last\n $last = $last + 1 \n end\n $last = known\n next\n }\nend",
"def birthdayCakeCandles(n, ar)\n tallest = ar.max\n (ar.select {|val| val < tallest }).length\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n # Your code goes here!\n return 0 if list_of_integers.length == 0\n\n flag = false\n con\n # iter array\n list_of_integers.each do |x|\n\n if x >= lower_bound || x <= upper_bound\n #flag = !flag\n new_array.push(x)\n end\n if flag == false\n list_of_integers.delete(x)\n end\n end\n return list_of_integers\nend",
"def meeting(rooms, number)\n first_num = number.dup\n final = []\n \n return 'Game On' if number == 0\n \n rooms.map! do |sub_arr|\n occupied_chars = sub_arr[0].chars.count('X')\n sub_arr = [occupied_chars, sub_arr[1]]\n if sub_arr.reverse.reduce(:-) < 0\n 0\n else\n sub_arr.reverse.reduce(:-)\n end\n end\n\n rooms.each do |available_seats|\n break if number == 0\n if available_seats >= number\n final << number\n number -= number\n elsif available_seats < number\n number -= available_seats\n final << available_seats\n end\n end\n \n return \"Not enough!\" if final.reduce(:+) < first_num\n \n final\n\nend",
"def calculate_total(cards) # input is an array of arrays\n\tarr = cards.map { |e| e[1] } # gets second element of the array and loads that into a new array\n\n\ttotal = 0\n\tarr.each do |value|\n\t\ttotal = total + value\n\tend\n\n\tarr.select { |e| e == 11}.count.times do # corrects for aces\n\t\tif total > 21\n\t\t\ttotal = total - 10\n\t\tend\n\tend\n\nreturn total\nend",
"def test_neighbour_count\n # Empty\n @game.state=[[0,0,0],[0,0,0],[0,0,0]]\n assert_equal 0,@game.neighbour_count(0,0)\n assert_equal 0,@game.neighbour_count(1,1)\n\n # One cell, check all neighbours, check proper edge wrapping\n @game.state=[[0,0,0],[0,1,0],[0,0,0]]\n assert_equal 1,@game.neighbour_count(0,2),'0,2'\n assert_equal 1,@game.neighbour_count(0,0),'0,0'\n assert_equal 1,@game.neighbour_count(0,1),'0,1'\n assert_equal 1,@game.neighbour_count(1,0),'1,0'\n assert_equal 0,@game.neighbour_count(1,1),'1,1' # Don't count self\n assert_equal 1,@game.neighbour_count(1,2),'1,2'\n assert_equal 1,@game.neighbour_count(2,0),'2,0'\n assert_equal 1,@game.neighbour_count(2,1),'2,1'\n assert_equal 1,@game.neighbour_count(2,2),'2,2'\n\n # Eight cells, check all neighbours, check proper edge wrapping\n @game.state=[[1,1,1],[1,0,1],[1,1,1]]\n assert_equal 7,@game.neighbour_count(0,2),'0,2'\n assert_equal 7,@game.neighbour_count(0,0),'0,0'\n assert_equal 7,@game.neighbour_count(0,1),'0,1'\n assert_equal 7,@game.neighbour_count(1,0),'1,0'\n assert_equal 8,@game.neighbour_count(1,1),'1,1' # Only cell with 8\n assert_equal 7,@game.neighbour_count(1,2),'1,2'\n assert_equal 7,@game.neighbour_count(2,0),'2,0'\n assert_equal 7,@game.neighbour_count(2,1),'2,1'\n assert_equal 7,@game.neighbour_count(2,2),'2,2'\n end",
"def is_finished(num, prerequisties) \n\t#edge is the desitnation, degree is the number of indegree\n\tedges = Array.new(num, Array.new(num, 0))\n\tdegrees = Array.new(num, 0)\n\n\t#update the edges and degrees base on the course number\n\tfor i in 0...prerequisties.length\n\t\tcrt_class = prerequisties[i][0]\n\t\tpre_class = prerequisties[i][1]\n\t\tdegrees[crt_class] += 1\n\t\tedges[pre_class].push(crt_class)\n\tend\n\n\t#fill the queue with courses with no prerequisties\n\tqueue = []\n\tfor i in 0...degrees.length \n\t\tif (degrees[i] == 0)\n\t\t\tqueue.push(i)\n\t\tend\n\tend\n\n\t#count number of times to make all indegrees to 0\n\tcount = 0\n\twhile (!queue.empty?)\n\t\tcourse = queue.delete_at(0)\n\t\tcount += 1\n\t\tn = edges[course].length\n\t\tfor i in 0...n\n\t\t\tpointer = edges[course][i]\n\t\t\tdegrees[pointer] -= 1\n\t\t\tif (degrees[pointer] == 0)\n\t\t\t\tqueue.push(pointer)\n\t\t\tend\n\t\tend\n\tend\n\t\n\treturn count == num\n\nend",
"def largest_contiguous_sum(arr)\n largest_sum = nil\n p_tations = subsets(arr)\n\n p_tations.each do |tation|\n if largest_sum == nil\n largest_sum = tation.sum \n elsif tation.sum > largest_sum\n largest_sum = tation.sum \n end\n end \n\n largest_sum\nend",
"def test_count_occupants_array\n @room2.check_in_guest(@guest2)\n @room2.check_in_guest(@guest3)\n assert_equal(2, @room2.count_occupants())\n end",
"def killcount(counselors, jason)\n counselors.map { |i| i[0] if i[1] < jason }.compact\nend",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def trapping_water(arr)\n tallest2, tallest1 = arr.max(2).sort\n idx1, idx2 = nil, nil\n arr.each_with_index do |building, idx|\n if [tallest2, tallest1].include?(building)\n if idx1.nil?\n idx1 = idx\n elsif idx2.nil?\n idx2 = idx\n end\n end\n end\n between = arr[idx1 + 1...idx2]\n between.map { |building| tallest2 - building }.reduce(:+) || 0\nend",
"def discount_veryfication(arr1, arr2, nbr)\n (arr1 & arr2).flat_map { |n| [n] * [arr1.count(n), arr2.count(n)].min }.length == (arr1.length - nbr)\n end",
"def count_stops_in_array(stops_array)\n result = stops_array.length()\n return result\nend",
"def reach_last_index(hops_array)\n results = []\n\n return true if hops_array.length < 2\n\n hops_array.first.times do |i|\n hops_array.shift\n results << reach_last_index(hops_array)\n end\n\n return results.any? true\nend",
"def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend",
"def solution(a)\n return 0 if a.empty?\n sorted_hash = a.sort.group_by { |x| x }\n sorted_hash.values.last.count\nend",
"def get_bookings_over_seven_array(one_day_of_bookings)\n @bookings = one_day_of_bookings\n return_string = []\n find_values = [7,8,9,10,11,12]\n \n @bookings.each do |booking|\n if find_values.include?(booking.number_of_diners)\n return_string << booking.number_of_diners\n end\n end\n return return_string\n end",
"def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend",
"def birthdayCakeCandles(ar)\n max = ar.max\n count = ar.count{|x| x == max}\nend",
"def find_consecutive_runs(array)\n return nil unless array.is_a? Array\n return nil if array.length < 3\n\n output = []\n array.each_with_index do |item, index|\n return nil unless item.is_a?(Integer) && item > 0\n first = item\n second = array[index+1]\n third = array[index+2]\n\n unless second.nil? || third.nil?\n if (first + 1 == second) && (second + 1 == third)\n output << index\n elsif (first - 1 == second) && (second - 1 == third)\n output << index\n end\n end\n end\n\n return nil if output.length == 0\n\n output\nend",
"def missing(arr)\n starting_num = arr[0]\n ending_num = arr[-1]\n complete_arr = []\n\n (ending_num - starting_num + 1).times do\n complete_arr << starting_num\n starting_num += 1\n end\n\n complete_arr - arr\nend",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def birthday(s, d, m)\n # s is array [1,2,3]\n # d is day (total)\n # m is month (number of squares)\n len = s.length - (m - 1)\n count = 0\n\n for i in 0..len do\n if s[i,m].sum == d\n count += 1\n end\n end\n\n return count\nend",
"def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend",
"def lis(array)\n helper = Array.new(array.length, 1)\n (1..array.length - 1).each do |array_index|\n (0..array_index).each do |inner_value|\n if array[inner_value] < array[array_index]\n helper[array_index] = [helper[inner_value] + 1, helper[array_index]].max\n end\n end\n end\n helper.max\nend",
"def look_and_say(array)\n return [] if array.empty?\n\n output = [[1, array[0]]]\n\n (1...array.length).each do |idx|\n el = array[idx]\n if el == output.last[1]\n output.last[0] += 1\n else\n output << [1, el]\n end\n end\n\n output\nend",
"def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend",
"def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend",
"def determine_allergies\n @allergens.each_with_index do |(allergen_name, allergen_value), index|\n keys = @allergens.keys\n if @number < allergen_value && @number > 0\n @active_allergies << keys[index - 1]\n @number = @number - @allergens[keys[index - 1]]\n break\n elsif @number == allergen_value\n @active_allergies << keys[index]\n @number = @number - allergen_value\n break\n end\n end\n end",
"def pickingNumbers(a)\n my_h = Hash.new(0)\n a.each do |elem|\n my_h[elem] = a.select {|x| (elem-x).abs < 2}\n end\n my_h.max_by {|i,v| v.size}[1].size - 1\nend",
"def count_clumps(array)\n count = []\n current_num = 0\n array.each do |num|\n if ((num === current_num) && (count.include?(num) == false))\n count << num\n end\n current_num = num\n end\n return count.length\nend",
"def opposite_count(arr)\n count = 0\n arr.each_with_index do |element1, idx1|\n arr.each_with_index do |element2, idx2|\n if idx2 > idx1 && element1 + element2 == 0\n count += 1\n end\n end\n end\n return count\nend",
"def migratoryBirds(arr)\n sight = [0,0,0,0,0,0]\n\n max = 0\n\n arr.collect do |number|\n sight[number] += 1\n max = [max, sight[number]].max\n end\n\n p sight.find_index(max)\n\nend",
"def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend",
"def lis array\n helper = Array.new(array.count, 1)\n for i in 1..(array.count - 1)\n for j in 0..i\n if array[j] < array[i]\n helper[i] = max((helper[j] + 1), helper[i])\n end\n end\n end \n return helper.max\nend",
"def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend",
"def part_two(input)\n found = false\n cleaned = input.each_with_index.map { |v, i| [v, i] unless v == 'x' }.compact\n iter = cleaned.map(&:first).max\n index = cleaned.map(&:first).find_index(iter)\n t = iter\n until found\n t += iter\n puts \"#{t}\"\n found = true\n v = t - index\n cleaned.each do |bus, i|\n if (v + i) % bus != 0\n found = false\n break\n end\n end\n end\n t\nend",
"def missing_number(array)\n\tlast = array[-1]\n\tp last+1\n\tp last/2\n\texpected_sum = (last+1) * (last/2)\n\tactual = array.inject(:+)\n\texpected_sum - actual\nend",
"def missing(array)\n result = []\n num = array.first + 1\n loop do\n result << num if !array.include?(num)\n num += 1\n break if num == array.last\n end\n result\nend",
"def can_complete_circuit(gas, cost)\n return -1 if gas.size != cost.size\n local_trip = 0\n total_trip = 0\n idx = 0\n (0...gas.size).each { |i|\n local_trip += gas[i] - cost[i]\n total_trip += local_trip\n if local_trip < 0\n local_trip = 0\n idx = (i + 1) % gas.size\n end\n }\n \n return total_trip < 0 ? -1 : idx\nend",
"def nachbarn_finden\n 0.upto(@hoehe-1) do |i|\n 0.upto(@breite-1) do |j|\n nachbarn = Array.new\n if (i>0 && j>0)\n nachbarn.push(@felder[i][j-1])\n nachbarn.push(@felder[i-1][j])\n nachbarn.push(@felder[i-1][j-1])\n end\n if (i<@hoehe-1 && j<@breite-1)\n nachbarn.push(@felder[i][j+1])\n nachbarn.push(@felder[i+1][j])\n nachbarn.push(@felder[i+1][j+1])\n end \n if (i>0 && j<@breite-1)\n nachbarn.push(@felder[i-1][j+1])\n nachbarn.push(@felder[i][j+1])\n nachbarn.push(@felder[i-1][j])\n end\n if (i<@hoehe-1 && j>0)\n nachbarn.push(@felder[i+1][j-1])\n nachbarn.push(@felder[i+1][j])\n nachbarn.push(@felder[i][j-1])\n end\n nachbarn.uniq!\n @felder[i][j].nachbarn=(nachbarn)\n @felder[i][j].finde_nachbarminenzahl\n end\n end\n end",
"def solution(a)\n # want to know the number of discs that start, stop\n # at each position. Then we can calculate how many\n # intersections there are.\n \n # create a hash with default start, stop values set to 0\n events = Hash.new{ |h, k| h[k] = {:start => 0, :stop => 0}}\n \n # store the start, stop vals for each element in a\n a.each_index do |i|\n events[i - a[i]][:start] += 1\n events[i + a[i]][:stop] += 1\n end\n \n # so now event[i][:start] is the start val for a[i]\n # sort the events\n sorted_events = events.sort_by { |index, val| index}\n sorted_events.map! {|n| n[1]}\n \n # so now sorted_events[i] tells us how many starts and stops occured at (i, 0).\n \n # iterate over our sorted array of hashes which tell us how many discs start and end at each position. There are two cases we need to worry about:\n # 1) how many discs are already going when the new disc starts: (e[:start] * past_start)\n # 2) if multiple discs start at the same position (e[:start] * (e[:start]-1) / 2)\n \n # 1) if there are 3 discs that we're in the middle of and a new disc starts, it intersects with all 3 of them. If there are 3 discs we're in the middle of and 2 new discs start, each of them will intersect with the 3 existing ones, making six interactions.\n # 2) If multiple discs start at the same location, some math is required. It's groups of 2, so the number of intersections at each index is n*(n-1)/2 - for if multiple discs start at that index - plus n*past_starts for when discs are already in progress when we start a new one. Add them all together and you have your solution.\n \n past_starts = 0\n intersects = 0\n sorted_events.each do |event|\n intersects += event[:start] * (event[:start]-1) / 2 + event[:start] * past_starts\n past_starts += event[:start]\n past_starts -= event[:stop]\n end\n \n intersects\n #puts \"events: #{events}\"\nend",
"def find_number_of_lis(nums)\n return 0 if nums.empty?\n lengths = Array.new(nums.size, 1)\n counts = Array.new(nums.size, 1)\n\n for i in 1...nums.size\n for j in 0...i\n if nums[i] > nums[j]\n if lengths[j] + 1 == lengths[i]\n counts[i] += counts[j]\n elsif lengths[j] + 1 > lengths[i]\n counts[i] = counts[j]\n lengths[i] = lengths[j] + 1\n end\n end\n end\n end\n\n max_length = lengths.max\n result = 0\n \n counts.each_with_index do |count, i|\n result += count if lengths[i] == max_length\n end\n \n result\nend",
"def tally(hand)\n arr = hand.map{|e| e[0]} #gets the second element of the nested array (cos arrays are zero indexed)\n running_total = 0 #initialise this at the beginning & then iterate through each value to get the total from our new hand_total array\n \n arr.each do |value|\n if value == 'A'\n running_total += 11\n elsif value == 'J' || value == 'Q' || value == 'K' #could also say value.to_i ==0 because it would fail and return a 0\n running_total += 10\n else\n running_total += value.to_i\n end\n end\n\n # correct for Aces\n arr.select{|e| e == \"A\"}.count.times do\n running_total -= 10 if running_total > 21\n end\n \n running_total\nend",
"def largest_contiguous_subsum_one(list)\n sub_arr = []\n sum = 0\n list.each_with_index do |ele, i|\n (i...list.length).each do |i2|\n sub_arr << list[i..i2]\n end\n end\n sub_arr.each do |arr|\n if arr.sum > sum\n sum = arr.sum\n end\n end\n sum\nend",
"def arraymap_number_of_plates(w,h,plates)\n\tmax = -1\n\teach_in_map(w,h,plates) do |x,y,plaque_index|\n\t\tmax=plaque_index if plaque_index>max\n\tend\n\tmax+1\nend",
"def accept_booking(pending)\n# if length of pending = 3\n# if pending.length == 3\n# if pending[0] + pending[2] > pending[1]\n# puts pending[0] + pending[2]\n# return pending[0] + pending[2]\n# else\n# puts pending[1]\n# end\n# end\n\n # totals_so_far store the answer to the problem at position i\n # imagining that the array was only of length i\n totals_so_far = Array.new pending.length\n\n if (i == 0)\n totals_so_far[i] = pending[i]\n end\n\n if (i == 1)\n totals_so_far[i] = max(pending[i], pending[i-1])\n end\n\n for i in pending\n pending[i]\n\n #Choose this one, or not choose it\n # I can't take i-1 and I get the max of everything before it.\n choose_this_one_max = pending[i] + totals_so_far[i-2]\n\n not_choose_this_one_max = totals_so_far[i-1]\n\n pending[i] = max(choose_this_one_max, not_choose_this_one_max)\n\n end\n\n totals_so_far[-1]\nend",
"def two_sum_big_gun(array, target)\n nums = Hash.new(0)\n\n array.each do |el|\n nums[el] += 1\n end\n\n array.any? do |el|\n wing = target - el\n nums[wing] > 0\n end\n\nend",
"def makeArrayConsecutive2(statues)\n\n sorted = statues.sort\n max = sorted[-1]\n count = 0\n array = []\n i = sorted[0]\n while i <= max\n array << i\n i += 1\n end\n p array\n p sorted\n count = array.length - sorted.length\n \n return count\n\nend",
"def disjoint_attempt(arr)\n part = [0]\n maxPrev = [0]\n maxLeft = []\n minPrev = [0]\n minLeft = []\n max = 0\n\n # main idea: subsequence sum is partial sum at end minus partial\n # sum at start. Max score is thus either\n # maxLeft[i] + maxPrev[i] - 2 * part[i] or\n # - minLeft[i] - minPrev[i] + 2 * part[i]\n # for some i\n\n\n # calculate partial sums up to each index in the array\n # calculate max of these seen so far at each index\n arr.each_with_index do |el, i|\n k = i + 1\n part[k] = part[i] + el\n maxPrev[k] = [maxPrev[i], part[k]].max\n minPrev[k] = [minPrev[i], part[k]].min\n end\n\n maxLeft[arr.size] = part[arr.size]\n minLeft[arr.size] = part[arr.size]\n\n # calculate max partial sum remaining at each index\n # now that we have enough info, update max score\n arr.size.downto(1) do |i|\n k = i - 1\n maxLeft[k] = [maxLeft[i], part[k]].max\n minLeft[k] = [minLeft[i], part[k]].min\n max = [max, maxLeft[i] + maxPrev[i] - 2 * part[i],\n 0 - minLeft[i] - minPrev[i] + 2 * part[i]].max\n end\n\n # loop doesn't catch this\n max = [max, maxLeft[0] + maxPrev[0] - 2 * part[0],\n 0 - minLeft[0] - minPrev[0] + 2 * part[0]].max\n return max\nend",
"def board_complete?(b)\n result = b.select do |sub_array|\n sub_array.any?(0)\n end\n result.empty?\nend",
"def solution(a)\n numbers = a.sort\n (0..numbers.length-3).each do |index|\n triplet = numbers[index..index + 2]\n max_value = triplet.max\n sum = triplet.min(2).inject(&:+)\n\n return 1 if sum > max_value\n end\n\n 0\nend",
"def how_many_missing(arr)\n arr.count > 0 ? (arr.first..arr.last).count - arr.count : 0\nend",
"def calcularActitud\n\t\n\t@aptitud = 0\n\t\n\tself.each_with_index do |item, index|\t\n\t\t\t\n\t\t\t\tprincipalTemp = calcularDiagonalPrincipal(index, item)\n\t\t\t\tsecondaryTemp = calcularDiagonalSecundaria(index, item)\n\t\t\t\t#puts \"principal es #{principalTemp}\"\n\t\t\t\t\n\t\t\t\t#puts \"secundario es #{secondaryTemp}\"\t\n\t\t\t\t\n\t\t\t\tprincipalTemp.row(0).each_with_index do |value , newindex|\n\t\t\t\t\n\t\t\t\t\tif (self[value] == principalTemp.row(1)[newindex] && index != value)\n\t\t\t\t\t\t\n\t\t\t\t\t\t@aptitud -=1\n\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tsecondaryTemp.row(0).each_with_index do |value , newindex|\n\t\t\t\t\t\n\t\t\t\t\tif (self[value] == secondaryTemp.row(1)[newindex] && index != value)\n\t\t\t\t\t\t@aptitud -=1\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\tend\n\tend\n \n end",
"def count_positive_subarrays(two_d_arr)\n #debugger\n # ([[-2, 5], [1, -9, 1], [4, 7]]).count(*(any args))\n two_d_arr.count{ |subarr| subarr.sum > 0}\nend",
"def check_for_bus\n uri = URI.parse( \"#{TRIMET_STOPS_URL}?json=true&appID=#{@trimet_api_key}&locIDs=#{@trimet_stops.join(',')}\" )\n response = Net::HTTP.get_response(uri)\n trimet_response =JSON.parse(response.body)\n \n next_arrival = trimet_response['resultSet']['arrival'][0]\n scheduled = next_arrival['scheduled']\n estimated = next_arrival['estimated']\n\n soonest = [scheduled,estimated].compact.min\n now = DateTime.now.strftime(\"%Q\")\n puts \"next bus at #{DateTime.strptime(soonest.to_s, '%Q')}\"\n puts \"bus is #{(soonest.to_i - now.to_i)/1000} seconds away\"\n\n\n unless (soonest - now.to_i) <= 0\n begin\n update_color ( soonest - now.to_i)\n rescue ArgumentError => e\n schedule_next_check(Time.now + 60)\n end\n end\n\n end",
"def look_and_say(array)\n output = []\n count = 1\n current = array[0]\n (1...array.length).each do |index|\n if array[index] == current\n count += 1\n else\n output << [count, current]\n current = array[index]\n count = 1\n end\n end\n output << [count, current]\nend",
"def birthdayCakeCandles(ar)\n tallest = 0\n ar.each { |candle| tallest = candle if candle > tallest}\n return ar.count { |candle| candle === tallest }\nend",
"def find_paid_splits(array)\n # [[5, true, 0], [8, true, 0], [\"new\", false, 27.78]] =>\n # [[5, true, 0]] => [ [5, true, 0], []]\n # [[5, true, 0], [8, true, 0]]\n # [[5, true, 0], [8, true, 0], [8, true, 0], [\"new\", false, 27.78]]\n # [[\"new\", false, 27.78]] => [ [], [\"new\", false, 27.78]]\n # [[16, false, 20.22]]\n\n counter = 0\n array.each do |split|\n if split[2] == 0\n counter += 1\n end\n end\n\n if counter == 0\n return array.unshift([])\n else\n\n paid_splits = array.slice(0, counter)\n\n if array.length > counter\n paid_splits.push(array[array.length - 1])\n else\n paid_splits.push([])\n end\n\n paid_splits\n end\n\n\n end",
"def count(arr)\n count = 0\n arr_length_half = arr.length / 2\n\n arr_length_half.times do |i|\n if arr [i] > arr[- i - 1]\n count += arr[i]\n else\n count += arr[-i - 1]\n end\n end\n count\nend",
"def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend",
"def phase_2_largest_contiguous_sum(arr)\n\n return [[]] if arr.empty?\n subs = arr.take(arr.count-1).phase_2_largest_contiguous_sum\n subs.concat(subs.map {|sub| sub + [last]})\n\n largest_sum = subs.first.sum \n\n subs.each do |sub|\n current_sum = sub.sum \n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n\n largest_sum\n\nend"
] | [
"0.6508321",
"0.63578063",
"0.62414706",
"0.6083835",
"0.60192657",
"0.5990421",
"0.59454006",
"0.58915025",
"0.58369255",
"0.5759814",
"0.55555826",
"0.5551596",
"0.55281836",
"0.5488759",
"0.54686403",
"0.544321",
"0.54423666",
"0.54155886",
"0.54070127",
"0.5358391",
"0.5355653",
"0.53536785",
"0.5331826",
"0.53298265",
"0.5318589",
"0.5281128",
"0.5276195",
"0.5261479",
"0.5257227",
"0.52570033",
"0.5250097",
"0.5244391",
"0.52370775",
"0.5211794",
"0.5198789",
"0.5185169",
"0.51850545",
"0.517142",
"0.515987",
"0.5153587",
"0.5142438",
"0.5137108",
"0.5136858",
"0.5133228",
"0.51157105",
"0.5114778",
"0.51083094",
"0.51013815",
"0.50954133",
"0.50943583",
"0.50921667",
"0.5087093",
"0.5082783",
"0.5078002",
"0.50774235",
"0.5070526",
"0.50701445",
"0.5055457",
"0.50504076",
"0.50464135",
"0.5045671",
"0.5043588",
"0.50392807",
"0.50327456",
"0.502867",
"0.50226736",
"0.50226",
"0.501654",
"0.5014006",
"0.50131696",
"0.501003",
"0.5009704",
"0.5001329",
"0.50013024",
"0.49962944",
"0.49950892",
"0.49905673",
"0.49878827",
"0.49878645",
"0.4984369",
"0.4984042",
"0.49801707",
"0.49766952",
"0.49762937",
"0.49762774",
"0.49727973",
"0.49684587",
"0.49661452",
"0.49661097",
"0.49630225",
"0.4958889",
"0.49547663",
"0.4954242",
"0.4946374",
"0.49410212",
"0.49400175",
"0.49363953",
"0.49356392",
"0.49302444",
"0.49248692"
] | 0.6365046 | 1 |
Get basic information about your organizations | def org
@org_resource ||= Org.new(@client)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end",
"def organization\n _get(\"/account/organization\") { |json| json }\n end",
"def get_org_information(name)\n begin\n github_api_setup.orgs.get(name)\n rescue Exception => e\n logger.error \"Github #get_org_information error #{e}\"\n end\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end",
"def orgs\n client.organizations\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def organizations \n puts \"List of organizations:\"\nend",
"def list_organizations\r\n Organization.organizations_by_user(self)\r\n end",
"def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend",
"def current_user_oganizations\n endpoint = '/api/user/orgs'\n @logger.debug(\"Getting current user organizations (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def info(org_username)\n @client.org.info(org_username)\n end",
"def account_organization\n get('account/organization')\n end",
"def find_organizations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationsApi#find_organizations ...\"\n end\n \n # resource path\n path = \"/organizations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'attribute'] = opts[:'attribute'] if opts[:'attribute']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\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 :return_type => 'Array<OrganizationComposite>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationsApi#find_organizations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def admin_organization_stats\n get_admin_stats \"orgs\"\n end",
"def show\n cf_get(path: \"/organizations/#{org_id}\")\n end",
"def index\n @organizations = Spree::Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def find_organizations\n Organization.all\n end",
"def GetOrgs params = {}\n\n params = params.merge(path: 'organizations.json')\n APICall(params)\n\n end",
"def get_organisations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_organisations ...'\n end\n # resource path\n local_var_path = '/blue/rest/organizations/'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jenkins_auth']\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 => 'Organisations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_organisations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def do_your_stuff! organization_name\n get_members_for_org organization_name\n get_repositories_for_all_members\n get_stats_for_repositories\n end",
"def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def index\n\t\t@organizations = Organization.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @organizations }\n\t\tend\n\tend",
"def index\n @orgs = Org.all\n end",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end",
"def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end",
"def organizations\n\t@organizations = Organization.all\n\t@organization_names = []\n\[email protected] do |o|\n\t\t@organization_names << o.name\n\tend\n\t\n\trespond_to do |format|\n\t\tformat.html { render :json => @organization_names }\n\tend\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def index\n @orgs ||= Github::Org.orgs(\n current_user_github_access_token,\n current_github_username\n )\n end",
"def list\n @connection.get('/user/orgs').map do |org_data|\n GitHubApi::Org.new(self, org_data)\n end\n end",
"def list \n @organizations = Organization.all\n \n render \"list\"\n end",
"def orgs(params = {})\n params.merge!(key: 'orgs')\n objects_from_response(Code42::Org, :get, 'org', params)\n end",
"def get_organization(orgId)\n params = {\n 'method' => :get,\n 'command' => \"/org/#{orgId}\"\n }\n\n response, headers = send_request(params)\n catalogs = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.catalog+xml']\").each do |item|\n catalogs[item['name']] = item['href'].gsub(\"#{@api_url}/catalog/\", \"\")\n end\n\n vdcs = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.vdc+xml']\").each do |item|\n vdcs[item['name']] = item['href'].gsub(\"#{@api_url}/vdc/\", \"\")\n end\n\n networks = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.orgNetwork+xml']\").each do |item|\n networks[item['name']] = item['href'].gsub(\"#{@api_url}/network/\", \"\")\n end\n\n tasklists = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.tasksList+xml']\").each do |item|\n tasklists[item['name']] = item['href'].gsub(\"#{@api_url}/tasksList/\", \"\")\n end\n\n { :catalogs => catalogs, :vdcs => vdcs, :networks => networks, :tasklists => tasklists }\n end",
"def orgs\n @orgs ||= begin\n client.organizations.map(&:login)\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n []\n end\n end",
"def org_show_data\n org = Organization.find(params[:org])\n\n @data = {\n name: org.name,\n website: org.website,\n logo_link: org.logo_link,\n users: user_names_and_emails_from_org(org)\n }\n\n render json: @data\n end",
"def get(*args)\n arguments(args, required: [:org_name])\n\n get_request(\"/orgs/#{arguments.org_name}\", arguments.params)\n end",
"def index\n @organizations = Organization.all\n respond_with(@organizations)\n end",
"def get_organization(orgId)\n params = {\n 'method' => :get,\n 'command' => \"/org/#{orgId}\"\n }\n\n response, headers = send_request(params)\n catalogs = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.catalog+xml']\").each do |item|\n catalogs[item['name']] = item['href'].gsub(/.*\\/catalog\\//, \"\")\n end\n\n vdcs = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.vdc+xml']\").each do |item|\n vdcs[item['name']] = item['href'].gsub(/.*\\/vdc\\//, \"\")\n end\n\n networks = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.orgNetwork+xml']\").each do |item|\n networks[item['name']] = item['href'].gsub(/.*\\/network\\//, \"\")\n end\n\n tasklists = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.tasksList+xml']\").each do |item|\n tasklists[item['name']] = item['href'].gsub(/.*\\/tasksList\\//, \"\")\n end\n\n { :catalogs => catalogs, :vdcs => vdcs, :networks => networks, :tasklists => tasklists }\n end",
"def index\n @organizations = Organization.by_query(params[:q])\n end",
"def organization_list(organizations)\n organizations or return \"\"\n \n organizations.inject([]) do |s, unit|\n s << \"#{unit.aff_fullname}(#{unit.sta_fullname}\"\n end\n s.join(\", \")\n end",
"def orgs\n @orgs = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # orgs.html.erb\n format.xml { render :xml => @orgs }\n end\n end",
"def organizations\r\n OrganizationsController.instance\r\n end",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n _do_request(grafana_options)\n rescue BackendError\n nil\n end",
"def organization_name(org)\n Hardmode.get(\"/orgs/#{org}\", :headers => @auth)\n end",
"def find_organizations(opts = {})\n data, status_code, headers = find_organizations_with_http_info(opts)\n return data\n end",
"def get_organizations\n org_references =\n locations.each_with_object({}) do |loc, acc|\n reference = loc.resource.managingOrganization.reference\n org_id = reference.match(ID_MATCHER)[1]\n\n acc[org_id] ||= []\n acc[org_id] << loc\n end\n\n facility_identifiers = org_references&.keys&.join(',')\n org_response = organization_service.search(_id: facility_identifiers, _count: '100')\n\n org_response&.resource&.entry\n end",
"def index\n @organizations = Organization.all\n respond_with @organizations\n end",
"def organization\n self[:O]\n end",
"def index\n @people = current_organization.people.all\n end",
"def build_orgs(resp)\n doc = Nokogiri.parse(resp.to_str)\n build_items(doc, 'Org')\n end",
"def show\n @organization = current_user.organization\n end",
"def organization\n capital_project.organization\n end",
"def organization\n self.data_response.organization\n end",
"def index\n @user_organizations = UserOrganization.all\n end",
"def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def show\n @organization = Organization.find(params[:id])\n end",
"def index\n redirect_to :root unless current_user.is_admin?\n @organizations = Organization.all\n end",
"def organization_members(org)\n get \"/orgs/#{org}/members\"\n end",
"def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end",
"def index\n if search_params \n logger.debug \"Got params: #{search_params}\"\n @organization = Organization.find(search_params)\n else\n logger.debug \"No params!\"\n end\n # @organizations = Organization.all\n end",
"def organization; end",
"def organization; end",
"def organization; end",
"def index\n @organization = current_user.organization\n @merits = @organization.merits\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def retrieve_organization(name = nil)\n name ||= organization_name\n org = Organization.find_by(name: name)\n halt_with_json_response(404, INVALID_ORG, 'organization does not exist') \\\n if org.nil?\n return org\n end",
"def index\n @clients_organizations = ClientsOrganization.all\n end",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n Array(do_request(grafana_options))\n rescue BackendError\n []\n end",
"def org(id = \"my\", params = {})\n object_from_response(Code42::Org, :get, \"org/#{id}\", params)\n end",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n Array(_do_request(grafana_options))\n rescue BackendError\n []\n end",
"def getActiveOrgs\n UI.important(\"Getting organization active organizations from DB\")\n\n begin\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n items = dynamodb_full_scan(dynamodb,\n {\n table_name: \"Organizations\",\n projection_expression: \"id, #SE, #ST\",\n expression_attribute_names: {\n \"#SE\" => \"settings\",\n \"#ST\" => \"status\"\n },\n expression_attribute_values: {\n \":p\" => \"public\",\n \":s\" => true\n },\n filter_expression: \"#ST.active = :s AND #SE.listing = :p\"\n })\n\n orgs = []\n UI.important(\"Organization to BUILD:\")\n items.each do |item|\n orgs.push(item['id'])\n UI.important(item['id'])\n end\n\n return orgs\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return nil\n end\nend",
"def index\n @admins_organizations = Organization.all\n end",
"def display_org_repos(org)\n repos = Commitchamp::Repo.where(organization: org).order(name: :asc)\n puts \"\\n## Repositories for Organization: #{org}\"\n repos.each do |r|\n puts \"#{r.name}\"\n end\n end",
"def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend",
"def get_organization(course)\n owners = course[\"owners\"]\n owners_array = []\n\n owners.each do |owner|\n owner[\"homepage_url\"].nil? ? url = owner[\"marketing_url\"] : url = owner[\"homepage_url\"]\n organization_hash = {}\n organization_hash[\"name\"] = owner[\"name\"]\n organization_hash[\"description\"] = owner[\"description\"]\n organization_hash[\"img\"] = owner[\"logo_image_url\"]\n organization_hash[\"url\"] = url\n owners_array << organization_hash\n end\n organization_hash = {}\n organization_hash[\"organizers\"] = owners_array\n organization_hash\n end",
"def list_org\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n org = current_org and current_org!(prm, org)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n opt = { locals: { name: org&.label } }\n respond_to do |format|\n format.html { render 'account/index', **opt }\n format.json { render 'account/index', **opt }\n format.xml { render 'account/index', **opt }\n end\n end",
"def index\n render json: Organization.all\n end",
"def org_name\n raw_info['org_name']\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @organization }\n\t\tend\n\tend",
"def organization(domain)\n _get(\"/query/dataleaks/organization/#{domain}\") { |json| json }\n end",
"def get_organization_by_id(id)\n require_relative 'telerivet/organization'\n Organization.new(self, self.do_request(\"GET\", get_base_api_path() + \"/organizations/#{id}\"))\n end",
"def index\n @casa_orgs = CasaOrg.all\n end"
] | [
"0.7904826",
"0.7794674",
"0.77018255",
"0.76004016",
"0.74847585",
"0.73995316",
"0.73995316",
"0.7376753",
"0.73588496",
"0.73469377",
"0.7300385",
"0.72276556",
"0.7159024",
"0.71496993",
"0.71327084",
"0.70964104",
"0.7095218",
"0.70886546",
"0.70810956",
"0.7018822",
"0.70096135",
"0.70056266",
"0.69912744",
"0.69886494",
"0.6942078",
"0.6875146",
"0.6853076",
"0.68381727",
"0.68381727",
"0.68381727",
"0.68381727",
"0.68381727",
"0.68381727",
"0.68381727",
"0.68381727",
"0.68381727",
"0.6831949",
"0.68317515",
"0.68317515",
"0.6799234",
"0.6798791",
"0.6756742",
"0.67453057",
"0.6744493",
"0.67421025",
"0.67266357",
"0.67209786",
"0.6719857",
"0.67046154",
"0.6686919",
"0.6667023",
"0.6637986",
"0.6623443",
"0.66057616",
"0.66016495",
"0.6598281",
"0.65958816",
"0.659479",
"0.65697473",
"0.6566598",
"0.6561998",
"0.65579915",
"0.6553281",
"0.6519138",
"0.65108085",
"0.65072495",
"0.6504204",
"0.64940286",
"0.6491563",
"0.6487972",
"0.6487633",
"0.64732975",
"0.64696985",
"0.64672935",
"0.64658165",
"0.64621586",
"0.64396137",
"0.64372146",
"0.64372146",
"0.64372146",
"0.6414488",
"0.6412584",
"0.6412584",
"0.64121205",
"0.6401883",
"0.6401034",
"0.63937986",
"0.6383412",
"0.6378833",
"0.63766366",
"0.6373422",
"0.6370561",
"0.63666385",
"0.6358847",
"0.6356142",
"0.63523775",
"0.63357675",
"0.63282514",
"0.6324907",
"0.6316727",
"0.63145125"
] | 0.0 | -1 |
All aspects of team management | def team
@team_resource ||= Team.new(@client)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team\n\t\t\trobot.team\n\t\tend",
"def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end",
"def team\n @response = CompanyApi::Request::Setting.new(\n CompanyApi::Response::Formatter::Manager,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).get_team_details({})\n\n unless @response.success?\n return handle_temporary_redirects(@response)\n end\n\n @presenter_obj = ::WebPresenter::ManagerPresenter.new(@response, params)\n @fe_no_nav = true\n end",
"def update_team\n \n end",
"def current_team\n self.teams\n end",
"def team\n diamond_mine_project.team\n end",
"def team\n return group\n end",
"def standby_team(config); end",
"def manage_team\n @user = User.first\n @project = Organization.first.projects.find_by(id: params[:id])\n end",
"def index\n # if(current_user.role == \"coach\")\n # @teams = current_user.coach.organization.teams\n # else\n # @teams = Team.all\n # end\n @current_user = @current_user\n @teams = Team.all\n @active_teams = @teams.active.sort_by! {|n| n.name}\n @top_standings = TeamStanding.for_juniors(5)\n @inactive_teams = @teams.inactive.sort_by! {|n| n.name}\n @divisions = @teams.active.map {|d| d.division}.uniq\n @junior_teams = Team.all.where(division_id: 1).to_a\n @senior_teams = Team.all.where(division_id: 2).to_a\n @seniorb_teams = Team.all.where(division_id: 3).to_a\n #@seniorb_teams = TeamStanding.for_seniorb.map{|j| j.team}.sort_by! {|n| n.name}\n @junior_standings = TeamStanding.for_juniors(5)\n @senior_standings = TeamStanding.for_seniors(5)\n @seniorb_standings = TeamStanding.for_seniorb(5)\n end",
"def seeded_teams\n raise 'Not Implemented'\n end",
"def show\n\t\t# People available to add to a team.\n\t\tnormal_users = User.normal.where(duplicate: false).order(:name)\n\t\t@users = normal_users.select { |u| !u.team && u.eligible? }\n\n\t\t@changes = @team.name_changes\n\n\t\t# n+1 :(\n\t\t@participations = @team.participations.order(:created_at).select { |p| p.game.completed? }\n\t\t@max_participation = @participations.max { |x, y| y.place <=> x.place }\n\t\t@games = Game.where(id: @participations.map(&:game_id))\n\tend",
"def team_information_list\n @teams = Team.find_teams_by_user(session[:user_id])\n \n end",
"def initialize\n team_objects\n end",
"def show_team_info(team)\n t = $nbl_league.find_team(team)\n t.show_team_full_info\nend",
"def team\n fetch('esport.teams')\n end",
"def teams(reload = false)\n options = {:include => [:center, :users]}\n teams =\n if self.has_access?(:team_show_all)\n Team.find(:all, options)\n elsif self.has_access?(:team_show_admin)\n Team.in_center(self.center_id) # Team.find(:all, :conditions => ['parent_id = ?', self.center_id])\n elsif self.has_access?(:team_show_member)\n Team.direct_groups(self)\n else\n []\n end\n end",
"def teams_data\n # selected_team = self.class.all[prompt.to_i-1]\n puts \"\"\n puts \"---------------------------\"\n puts \"Team Name: \" + self.full_name\n puts \"City: \" + self.city\n puts \"Division: \" + self.division\n puts \"Conference: \" + self.conference\n puts \"\"\n puts \"---------------------------\"\n end",
"def teams(reload = false)\n options = {:include => [:center, :users], :order => \"title\"}\n teams =\n if self.has_access?(:team_show_all)\n Team.find(:all, options)\n elsif self.has_access?(:team_show_admin)\n Team.in_center(self.center_id).sort_by &:title # Team.find(:all, :conditions => ['parent_id = ?', self.center_id])\n elsif self.has_access?(:team_show_member)\n Team.direct_groups(self).sort_by &:title\n else\n []\n end\n end",
"def team\n return @team\n end",
"def team\n @team ||= Struct.new(:name, :domain).new(@team_name, @domain)\n end",
"def current_user_team\n current_user.team\n end",
"def teams\n @teams ||= ApiFactory.new 'Orgs::Teams'\n end",
"def team\n Team.find(@current_team_id)\n end",
"def show\n # @teams = ::Services::TeamService.show_teams\n end",
"def index\n authorize! :read, parent_organization\n @teams = MnoEnterprise::Team.where(organization_id: params[:organization_id])\n end",
"def refresh_team_info(*)\n reload # SQL caching causing users to be empty when creating team making all teams ineligible\n set_team_captain\n set_slots_available\n set_eligibility\n cleanup\n end",
"def teams\n @teams\n end",
"def show\n #@projects = Project.active\n @teams = Team.for_user(current_user)\n @team_leads = @team.team_leads\n @members = @team.members.by_name\n end",
"def team_processor(payload)\n team = payload[:team]\n team_list = Hubstats.config.github_config[\"team_list\"] || []\n if team_list.include? team[:name]\n Hubstats::Team.create_or_update(team.with_indifferent_access)\n hubstats_team = Hubstats::Team.where(name: team[:name]).first\n hubstats_user = Hubstats::User.create_or_update(payload[:member])\n Hubstats::Team.update_users_in_team(hubstats_team, hubstats_user, payload[:github_action])\n end\n end",
"def set_team\n @team = Team.find(params[:id])\n @organization = @team.organization\n authorize @team\n end",
"def teams(reload = false)\n options = {:include => [:center, :users], :order => \"title\"}\n teams =\n if self.has_access?(:team_show_all)\n Team.includes([:center, :users]).order(:title) #all(options)\n elsif self.has_access?(:team_show_admin)\n Team.in_center(self.center_id).sort_by &:title\n elsif self.has_access?(:team_show_member)\n Team.direct_groups(self).sort_by &:title\n else\n []\n end\n end",
"def current_team\n \t\tTeam.find_by(id: current_user.team_id)\n \tend",
"def show\n\n \t\t\trespond_with @team\n\n \t\tend",
"def is_on_staff\n self.teams\n end",
"def team=(value)\n @team = value\n end",
"def manage\n\t\t# Author\n\t\tauthorize! :manage, Project\n\n\t\t@investors = Investor.order(updated_at: 'asc')\n\n\t\trender layout: 'layout_back'\n\tend",
"def can_manage_teams?\n admin? || board_member? || results_team?\n end",
"def team_name\n client.team.name\n end",
"def set_team\n @team = Team.accessible_for(current_user).friendly.find(params[:id])\n end",
"def getTeamNames\n #return TestSuite.\n end",
"def index\n @teams = @organization.teams\n end",
"def team_members\n if has_team?\n self.supervised ||= Employee.where(id: team_positions.map(&:efective_id))\n else\n Employee.none\n end\n end",
"def teams \n \"teams\" \n end",
"def create_teams_from_teams_playoffs()\n end",
"def train\n super\n puts \"#{@role} #{@last_name} supports the team during the training\"\n end",
"def index\n @manage_teams = ManageTeam.all\n end",
"def center_and_teams\n if(self.has_access?(:admin))\n Group.center_and_teams #find(:all, :conditions => ['type != ?', \"Journal\"])\n elsif self.has_access? :team_show_admin # self.center\n if self.centers.size > 1 # some people have more centers\n self.centers + self.centers.map { |c| c.teams }.flatten\n else\n [self.center] + self.center.teams\n end\n elsif self.has_access? :team_show\n self.groups\n else\n groups = self.centers #current_user.center #self.center\n groups.each do |center| \n center.children.each { |team| groups << team if team.instance_of? Team }\n end\n end\n end",
"def update\n\n respond_to do |format|\n ap @team.name\n ap @categorys = Category.where(:team => @team.name)\n ap @admin_tasks = AdminTask.where(:team => @team.name)\n ap @eadmin_tasks = EadminTask.where(:team => @team.name)\n ap @users = User.where(:user_info => @team.name)\n\n if @team.update(team_params)\n ap @team.name\n @admin_tasks.update_all(:team => @team.name )\n @eadmin_tasks.update_all(:team => @team.name )\n @categorys.update_all(:team => @team.name )\n @users.update_all(:user_info => @team.name )\n\n\n format.html { redirect_to team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def team_information\n @team = Team.find_by_user1(current_user.id)\n @teammate = Team.find_teammate(current_user.id)\n @user = current_user\n\n flash.now[:notice] = \"You need a teammember!\"\n render :controller => 'teams', :action => 'team_information'\n\n end",
"def test_teams\n trello = load_conf(TrelloHelper, @config.trello, true)\n assert_equal @std_teams, trello.teams\n end",
"def set_team\n @organization = Organization.find(params[:organization_id])\n @team = @organization.teams.find(params[:id])\n end",
"def no_permissions\n\n # TODO: Refactor this to use private team rabl template\n @team_json = Rails.cache.fetch \"#{@team.rabl_cache_key}/#{@demo_final}\" do\n Rabl.render(@team, \"api/v1/teams/show_reduced_gamecard\", view_path: 'app/views', :locals => { :demo_final => @demo_final }, :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe\n end\n \n @user = current_user if @user.nil?\n\n # tenant info\n @tenant = LandLord.new(@team).tenant\n @tenant_json = Rabl.render(@tenant, 'api/v1/tenants/show', view_path: 'app/views', formats: :json, locals: { page: \"team\" }).html_safe \n\n # TODO: This is duplicated in the show action above - could refactor\n @user_json = {}.to_json\n unless current_user.nil?\n @user_json = Rails.cache.fetch \"#{current_user.rabl_cache_key}\" do\n Rabl.render(@user, \"api/v1/users/show\", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe\n end\n end\n \n @current_user_teams_json = [].to_json\n unless current_or_guest_user.nil?\n @current_user_teams_json = Rails.cache.fetch \"#{current_or_guest_user.rabl_cache_key}/CurrentTeams\" do\n Rabl.render(current_or_guest_user.teams, \"api/v1/teams/index\", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe\n end\n end\n\n @current_user_leagues_json = [].to_json\n unless current_user.nil?\n @current_user_leagues_json = Rabl.render(current_user.leagues_as_organiser, \"api/v1/leagues/index\", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe\n end\n\n # Meta-tags\n title = ([email protected]? && [email protected]?) ? @team.name + \" | \" + @division.league.title : @team.name\n set_meta_tags :title => title\n\n return render 'show_public_restricted' unless can? :view_public_profile, @team\n\n\n ##### PUBLIC TEAM - SHOW PUBLIC PAGE #####\n\n # Public Meta-tags\n set_meta_tags :description => \"The #{@team.name} Full Team Page. Browse upcoming games, latest results and team news here. Stay up-to-date - View the team page now!\"\n set_meta_tags :keywords => %W[fixtures schedule results scores games #{@team.name}]\n \n @division = @team.divisions.first if @division.nil?\n\n @bf_club_teams = @team.club.teams unless @team.nil? || @team.club.nil?\n\n # USER FOLLOWING?\n @user_following = !current_user.nil? && @team.has_associate?(current_user)\n\n # USER DOWNLOADED APP?\n @current_user_has_downloaded_app = !current_user.nil? && !current_user.mobile_devices.empty?\n\n # ROLLOUT: DOWNLOAD THE APP LINK\n @download_the_app = current_user.nil? ? $rollout.active?(:faft_follow_team) : $rollout.active?(:faft_follow_team, current_user)\n\n @show_facebook_signup = false\n\n @division_presenter = DivisionPresenter.new(@division)\n @division_cache_prefix = @division.nil? ? \"\" : \"division/#{@division.id}-#{@division.updated_at.to_i}/\"\n\n if @division.nil?\n @future_fixture_events = @team.future_events\n else\n @future_fixtures = @division.fixtures.future.all.keep_if { |f| (f.home_team_id == @team.id || f.away_team_id == @team.id) }\n @future_fixture_events = @future_fixtures.map { |f| f.event_for_team(@team) }\n maximum_updated_at = @division.fixtures.future.maximum(:updated_at)\n end\n\n @future_events = EventsPresenter.new(@future_fixture_events).events\n @future_events_cache = @division_cache_prefix + \"team/#{@team.id}/future_events/#{@future_events.size}-#{maximum_updated_at.to_i}\"\n\n if @division.nil?\n @past_fixture_events = @team.past_events\n else\n @past_fixtures = @division.fixtures.past.all.keep_if { |f| f.home_team_id == @team.id || f.away_team_id == @team.id }\n @past_fixture_events = @past_fixtures.map { |f| f.event_for_team(@team) }\n maximum_updated_at = @division.fixtures.past.maximum(:updated_at)\n end\n\n @past_events = EventsPresenter.new(@past_fixture_events).events.reverse\n @past_events_cache = @division_cache_prefix + \"team/#{@team.id}/past_events/#{@past_events.size}-#{maximum_updated_at.to_i}\"\n\n # for marketing popup team dropdown\n unless @division.nil?\n @teams_json = Rabl.render(@division_presenter.teams, \"api/v1/teams/show_faft_micro\", view_path: 'app/views', :formats => [:json], :handlers => [:rabl]).html_safe\n end\n\n render 'show_public', :layout => 'app_public'\n end",
"def project_managers\n people_with_the_role(\"project_manager\")\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 managers\n if @data_object.team_id\n Role.team_managers(@data_object.team_id)\n else\n []\n end\n end",
"def new\n @team = @project.ae_teams.new\n end",
"def index\n @organization = Organization.find(params[:organization_id])\n @@organization = @organization\n @teams = @organization.teams\n end",
"def index\n @teams = current_user.teams.where(:course_id => params[:course_id]) if !current_user.has_role? :professor\n @teams = Course.find(params[:course_id]).teams if current_user.has_role? :professor\n @course = Course.find(params[:course_id])\n @course_id = @course.id\n @teams_params = getTeamNameInstructorandMembers\n end",
"def set_team\n @team = Team.find_by_id( params[:id].to_i )\n #@team = @team.decorate if @team\n end",
"def teams\n return team_1 + team_2;\n end",
"def index\n @teams = policy_scope(Team)\n @user = current_user\n end",
"def update_captain_and_eligibility(*)\n reload # SQL caching causing users to be empty when creating team making all teams ineligible\n set_team_captain\n update_eligibility\n end",
"def index\n\t\t@teams = Team.all\n\tend",
"def index\n @projects = Project.active\n if params[:project_id].present?\n @project = Project.find(params[:project_id])\n @teams = @project.teams.active\n else\n @teams = Team.for_user(current_user)\n end\n end",
"def get_involved_teams\n @involved_teams ||= retrieve_involved_teams\n end",
"def team_information\n @team = Team.find_by_user1(session[:user_id])\n @teammate = Team.find_teammate(session[:user_id])\n @user = User.find(session[:user_id])\n\n flash.now[:notice] = \"You need a teammember!\"\n render :controller => 'teams', :action => 'team_information'\n end",
"def current_team\n\t\tTeam.find_by(id: current_user.team_id)\n\tend",
"def index\n\t\t@teams = Team.order(\"name ASC\").all\n\n\t\t# Pulls upcoming fixtures in Premier League\n\t\t@data = party_time(\"http://api.statsfc.com/premier-league/fixtures.json?key=DThzCPsM_TI0XUGeUOJqr26JHwtYXVIfYvSSb0ui&timezone=America/New_York&limit=10\")\n\n\t\t# Pulls top scorers in Premier League\n\t\t@data2 = party_time(\"http://api.statsfc.com/top-scorers.json?key=DThzCPsM_TI0XUGeUOJqr26JHwtYXVIfYvSSb0ui&competition=premier-league&year=2013/2014&limit=10\")\t\n\n\t\t# Pulls news articles about the league through Google RSS\n\t\tdata = party_time(\"https://news.google.com/news/feeds?q=barclays+premier+league&output=rss\")\n\t\t@articles = data[\"rss\"][\"channel\"][\"item\"]\n\tend",
"def display_resource(team)\n team.name\n end",
"def show\n @team = @phase.team\n end",
"def create(_team)\n # stub\n end",
"def teams\n parse_domain_top '/Teams/TeamList.aspx', 'lnkTeamInfo'\n end",
"def team_name\n return @team_name\n end",
"def with_access_to_teams_with_any_role\n if c_level?\n organization.teams\n else\n TeamMember.includes(:team).where(user: self).collect(&:team)\n end\n end",
"def set_admin_team\n @admin_team = Team.find(params[:id])\n end",
"def set_team\n @team = current_team\n end",
"def teamowner_information \n team = Team.find_by_event_id(params[:event_id])\n if team != nil\n @teamowner = Team.find_teamowner(team.id)\n @initial_level = team.initial_level\n else\n flash[:notice] = \"Create a team to be an owner!\"\n flash.now\n redirect_to :controller => 'teams', :action => 'teamowner_information', :notice => \"Create a team to be an owner!\"\n end\n\n end",
"def show\n @teams = Team.all\n @group_stage_winners = GroupStageWinner.all\n @qf_winners = QfWinner.all\n @sf_winners = SfWinner.all\n @ko16_winners = Ko16Winner.all\n @final_winners = FinalWinner.all\n @users = User.all\n end",
"def show\n @teams = Team.all\n @group_stage_winners = GroupStageWinner.all\n @qf_winners = QfWinner.all\n @sf_winners = SfWinner.all\n @ko16_winners = Ko16Winner.all\n @final_winners = FinalWinner.all\n @users = User.all\n end",
"def index\n\t\t@team = Team.find(params[:team_id])\n\tend",
"def set_team\n @team = current_user.teams.find(params[:id])\n end",
"def index\n @teams_sorted = Team.sorted_by_score\n @top_reporters = Team.top_reporters\n @inactive_teams = Team.inactive if can? :manage, Team\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end",
"def index\n @teams = current_user.teams\n end",
"def index\n @teams = current_user.teams\n end",
"def set_team\n @team = Team.find(params[:id])\n end",
"def index\n\t\t@teams = Team.order(:name).select { |team| can? :read, team }\n\tend",
"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 change_team?\n raise Pundit::NotAuthorizedError, \"must be logged in\" unless user\n user.admin? || (APP_CONFIG.enabled?(\"user_permission.manage_namespace\") &&\n namespace.team.owners.exists?(user.id))\n end",
"def target_name\n team_name\n end",
"def new\n @team = Team.new\n @project = Project.find(params[:project_id]) if params[:project_id]\n\n # TODO : This should find a list of users that can be assigned to the team\n #@users = User.find(:all, :select => \"first_name, last_name, CONCAT(first_name, ' ', last_name) as 'member'\", :order => \"first_name\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def create\n @team = Team.new(team_params)\n begin\n @team.owner_id = current_user.id\n @team.save!\n\n current_user.add_role :team_owner, @team\n current_user.add_role :member, @team\n current_user.teams << @team\n redirect_to teams_url, notice: 'Team was successfully created.'\n rescue Exception => e\n render :new\n end\n end",
"def team\n @team = :true\n render '/home/landing'\n end",
"def index\n return if @team.blank?\n Vortrics.config[:advices].each_key do |key|\n @team.advices.create_by_key(key) if (@team.respond_to?(key) && @team.send(key))\n end\n @advices = @team.advices.reject(&:read?)\n @advice = Advice.new\n end"
] | [
"0.7861066",
"0.7861066",
"0.7861066",
"0.7861066",
"0.7861066",
"0.7861066",
"0.6998447",
"0.68245584",
"0.6808107",
"0.6781058",
"0.66769695",
"0.6652922",
"0.66062784",
"0.65926784",
"0.6575723",
"0.65342087",
"0.64932925",
"0.6445005",
"0.6440177",
"0.64328855",
"0.64018273",
"0.6395862",
"0.638527",
"0.63770103",
"0.63700897",
"0.636734",
"0.63640916",
"0.6346615",
"0.6342852",
"0.63412434",
"0.6312047",
"0.630546",
"0.6304895",
"0.62986034",
"0.6296349",
"0.62856996",
"0.6277776",
"0.6247167",
"0.6222536",
"0.6210449",
"0.620032",
"0.61860824",
"0.6178441",
"0.61747825",
"0.6163686",
"0.61491114",
"0.61483705",
"0.6147723",
"0.6145903",
"0.6133791",
"0.61209387",
"0.6115917",
"0.6100057",
"0.6095965",
"0.6073446",
"0.6071444",
"0.6067911",
"0.60471386",
"0.60451776",
"0.6033697",
"0.6025146",
"0.6010602",
"0.6007534",
"0.5994552",
"0.59900093",
"0.5984689",
"0.597305",
"0.59665006",
"0.5966474",
"0.5966281",
"0.59591585",
"0.5957858",
"0.595699",
"0.59568167",
"0.5952764",
"0.59486145",
"0.5939341",
"0.5935163",
"0.59334975",
"0.5931317",
"0.5926771",
"0.5921871",
"0.5909876",
"0.5903122",
"0.5901869",
"0.5901869",
"0.5897587",
"0.58946157",
"0.5894515",
"0.58784676",
"0.58784676",
"0.58771306",
"0.5875864",
"0.5868263",
"0.58656245",
"0.5863081",
"0.5860145",
"0.58533925",
"0.58522433",
"0.5850315"
] | 0.6090877 | 54 |
Info for existing organization. | def info(org_username)
@client.org.info(org_username)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def organization\n _get(\"/account/organization\") { |json| json }\n end",
"def get_org_information(name)\n begin\n github_api_setup.orgs.get(name)\n rescue Exception => e\n logger.error \"Github #get_org_information error #{e}\"\n end\n end",
"def organization\n self[:O]\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def org_name\n raw_info['org_name']\n end",
"def organization; end",
"def organization; end",
"def organization; end",
"def add_organization_info(result, info)\n\t\tresult['data']['items'].each do |organization|\n\t\t\tif info == \"name\"\n\t\t\t\t@names << organization[info]\n\t\t\telsif info == \"path\"\n\t\t\t\t@paths << organization[info]\n\t\t\tend\n\t\tend\n\tend",
"def organisation_details\n return blank_value unless organisation\n\n organisation.partnership? ? partner_names : organisation.name\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization\n capital_project.organization\n end",
"def account_organization\n get('account/organization')\n end",
"def organization\n return @organization if @organization\n @organization = Organization.find(organization_id)\n end",
"def show\n @organization = current_user.organization\n end",
"def show\n @organization = Organization.find(params[:id])\n end",
"def organization\n if solo_run?\n # configurable fake organization name for chef-solo users\n Chef::Config[:data_collector][:organization]\n else\n Chef::Config[:chef_server_url].match(%r{/+organizations/+([^\\s/]+)}).nil? ? \"unknown_organization\" : $1\n end\n end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def retrieve_organization(name = nil)\n name ||= organization_name\n org = Organization.find_by(name: name)\n halt_with_json_response(404, INVALID_ORG, 'organization does not exist') \\\n if org.nil?\n return org\n end",
"def organization\n self.data_response.organization\n end",
"def admin_organization_stats\n get_admin_stats \"orgs\"\n end",
"def Organization()\r\n ret = _getproperty(1610743808, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def org_name\n (org = self.organization) && org.name\n end",
"def requestor; organization; end",
"def find_organization\n @organization = Organization.find(params[:organization_id])\n end",
"def organization\n PDEX::OrganizationFactory.new(nppes_data, pharmacy:true).build\n end",
"def org_name\n self.org.try(:name).to_s\n end",
"def build_organization_metadata\n @organization ||= {\n '@type' => 'Organization',\n 'name' => I18n.translate('we_meditate'),\n 'logo' => {\n '@type' => 'ImageObject',\n 'url' => ApplicationController.helpers.image_url('metadata/logo.png'),\n 'width' => 132,\n 'height' => 60,\n },\n 'sameAs' => social_media_urls.values.reject(&:empty?),\n }.freeze\n end",
"def organization\n if documentable.respond_to? :organization\n documentable.organization\n else\n creator.organization\n end\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def organization\n id = Location.where(id: self.id).joins(:visits).select([:organization_id])\n Organization.where(id: id).select([:name]).first\n end",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def current_organization\n Organization.find(params[:organization_id])\n end",
"def organization_name(org)\n Hardmode.get(\"/orgs/#{org}\", :headers => @auth)\n end",
"def update\n if @organization.update(organization_params)\n render :show, status: :ok, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"def find_organizations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationsApi#find_organizations ...\"\n end\n \n # resource path\n path = \"/organizations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'attribute'] = opts[:'attribute'] if opts[:'attribute']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\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 :return_type => 'Array<OrganizationComposite>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationsApi#find_organizations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def organization_by_name(name)\n @organizations[name]\n end",
"def organization_id\n self.organization.id if self.organization && self.organization.is_a?(Organization)\n end",
"def print_existing_repos\n puts \"\\n### Existing Organizations ###\"\n orgs = Commitchamp::Repo.select(:organization).distinct.order(organization: :asc)\n orgs.each do |o|\n puts \"#{o.organization}\"\n end\n input = prompt(\"\\nWhich organization would you like to access?\", /^.+$/)\n puts\n self.display_org_repos(input)\n end",
"def set_organization\n # @org = Organization.find(params[:id])\n end",
"def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end",
"def getorganizationname()\r\n return getvalue(SVTags::ORGANIZATION_NAME)\r\n end",
"def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end",
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def set_organization\n @organization = Organization.friendly.find(params[:id])\n end",
"def set_organization\n @organization = Organization.friendly.find(params[:id])\n end",
"def set_organization\n @organization = Organization.custom_find(params[:id])\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to new_project_path, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n @organization.memberships.create(user_id: current_user.id)\n organization_info = {\n pretext: \"A new organization has been created.\",\n fallback: \"#{@organization.name}: #{@organization.description}\",\n title: \"#{@organization.name}\",\n title_link: \"#{organization_url(@organization)}\",\n text: \"#{@organization.description}\",\n color: \"#BDD6DD\",\n }\n PROJECT501_NOTIFIER.ping(attachments: [organization_info])\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def org\n @org_resource ||= Org.new(@client)\n end",
"def set_organization\n @organization = Organization.find(params[:name])\n end",
"def fill_organization\n if @param_storage.organization_id == nil\n organizations = @organization_service.all\n @param_storage.store_organization_id(organizations[0].id) if organizations.count == 1\n end\n end",
"def organization_exists?(name)\n @organizations.member?(name)\n end",
"def org_name\n test_org.name\n end",
"def new\n @organization = Organization.new\n respond_with(@organization)\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @organization }\n\t\tend\n\tend",
"def set_organization\n @organization = Spree::Organization.find(params[:id])\n end",
"def org(id = \"my\", params = {})\n object_from_response(Code42::Org, :get, \"org/#{id}\", params)\n end",
"def current_organization\n fog_model_interface.current_organization\n end",
"def organization\n records do |instance|\n instance['organization'] = organizations.where('_id': instance['organization_id']).last\n end\n end",
"def create\n\t\t@organization = Organization.new(params[:organization])\n\n\t\trespond_to do |format|\n\t\t\tif @organization.save\n\t\t\t\tformat.html { redirect_to(@organization, :notice => 'Organization was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @organization, :status => :created, :location => @organization }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def organization(domain)\n _get(\"/query/dataleaks/organization/#{domain}\") { |json| json }\n end",
"def get_organization\n return \"NSBE\" if affiliation == 1\n \"SHPE\"\n end",
"def show\n @organization = Organization.find(params[:id])\n respond_with @organization\n end",
"def kind\n @kind || :organization\n end",
"def get_organization(orgId)\n params = {\n 'method' => :get,\n 'command' => \"/org/#{orgId}\"\n }\n\n response, headers = send_request(params)\n catalogs = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.catalog+xml']\").each do |item|\n catalogs[item['name']] = item['href'].gsub(\"#{@api_url}/catalog/\", \"\")\n end\n\n vdcs = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.vdc+xml']\").each do |item|\n vdcs[item['name']] = item['href'].gsub(\"#{@api_url}/vdc/\", \"\")\n end\n\n networks = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.orgNetwork+xml']\").each do |item|\n networks[item['name']] = item['href'].gsub(\"#{@api_url}/network/\", \"\")\n end\n\n tasklists = {}\n response.css(\"Link[type='application/vnd.vmware.vcloud.tasksList+xml']\").each do |item|\n tasklists[item['name']] = item['href'].gsub(\"#{@api_url}/tasksList/\", \"\")\n end\n\n { :catalogs => catalogs, :vdcs => vdcs, :networks => networks, :tasklists => tasklists }\n end",
"def set_org\n @org = Organization.find(params[:id])\n end",
"def show\n @organization = Organization.find(params[:id])\n @editable = current_user.can_edit?(@organization) if current_user\n @grabbable = current_user ? current_user.can_request_org_admin?(@organization) : true\n # @next_path = current_user ? organization_user_path(@organization.id, current_user.id) : new_user_session_path\n @json = gmap4rails_with_popup_partial(@organization,'popup')\n end",
"def new\n\t\t@organization = Organization.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @organization }\n\t\tend\n\tend",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def set_organization\n @organization = Organization.with_deleted.find(params[:id])\n end",
"def update\n if @organization.update(organization_params)\n render :show, status: :ok, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"def show\n cf_get(path: \"/organizations/#{org_id}\")\n end",
"def organization\n @organization ||= Github::Organization.new(client, @options[:owner])\n end",
"def taxpayer_org_details(taxpayer)\n { 'ins1:CompanyName': taxpayer.org_name, 'ins1:ContactName': \"#{taxpayer.firstname} #{taxpayer.surname}\" }\n end",
"def org_id\n query('select id from Organization').first['Id']\n end",
"def org_map\n {\n dxid: {\n old: @user.org.dxid,\n new: new_org_dxid,\n },\n handle: {\n old: @user.org.handle,\n new: orgname,\n },\n name: {\n old: @user.org.name,\n new: new_org_name,\n },\n }\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end"
] | [
"0.7640379",
"0.73596096",
"0.7218846",
"0.7016799",
"0.69409794",
"0.69409794",
"0.68925655",
"0.6807708",
"0.6807708",
"0.6807708",
"0.6740632",
"0.66974705",
"0.6667614",
"0.6667614",
"0.66660506",
"0.6580457",
"0.6579217",
"0.65516776",
"0.65418136",
"0.65341735",
"0.6463044",
"0.6463044",
"0.6463044",
"0.6455903",
"0.64557123",
"0.64549696",
"0.6433168",
"0.6425016",
"0.6417308",
"0.6393855",
"0.6389454",
"0.6372125",
"0.636376",
"0.63599664",
"0.63447475",
"0.63301677",
"0.6329166",
"0.6322065",
"0.6311241",
"0.6304595",
"0.62974834",
"0.6288438",
"0.62792724",
"0.62773323",
"0.62608135",
"0.62219834",
"0.6215833",
"0.6201332",
"0.619262",
"0.61668354",
"0.61668354",
"0.61600566",
"0.61538017",
"0.6152481",
"0.61516446",
"0.6150733",
"0.61397237",
"0.6136608",
"0.6134123",
"0.6122794",
"0.6115081",
"0.61060107",
"0.6105479",
"0.6104298",
"0.6093763",
"0.6090193",
"0.6086411",
"0.60855126",
"0.60669386",
"0.60612774",
"0.60586464",
"0.60494626",
"0.60465044",
"0.60424465",
"0.60424465",
"0.6042197",
"0.60401344",
"0.60339236",
"0.6033708",
"0.6015466",
"0.60088694",
"0.60086423",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565",
"0.60037565"
] | 0.6814674 | 7 |
Create a new team. | def create(org_username, body = {})
@client.team.create(org_username, body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', body: opts)\n end",
"def create(_team)\n # stub\n end",
"def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', :body => opts)\n end",
"def create\n\t\tTeam.create(params[:team])\n\n\t\tredirect_to teams_path\n\tend",
"def create_team(name, params = {})\n params[:name] = name\n post('teams', params)\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html { redirect_to @team, notice: 'Team was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @team = Team.new(params[:team])\n if @team.save\n # the current user should join the team\n current_user.join!(@team)\n flash[:success] = \"New team created\"\n redirect_to @team\n else\n @title = \"Create a Team\"\n render :action => :new\n end\n end",
"def create\n @team = Team.new(team_params)\n if @team.save\n flash[:notice] = \"Team successfully created\"\n redirect_to teams_url\n else\n render \"new\"\n end\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html do\n\t\t\t\t\t# Add current user to team.\n\t\t\t\t\tmembership = Membership.new\n\t\t\t\t\tmembership.user_id = current_user.id\n\t\t\t\t\tmembership.team_id = @team.id\n\t\t\t\t\tmembership.started_at = DateTime.now\n\n\t\t\t\t\tredirect_to @team, notice: \"Team was successfully created.\", alert: (membership.save ? nil : \"Could not join created team.\")\n\t\t\t\tend\n\t\t\t\tformat.json { render action: \"show\", status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @project.ae_teams.new(team_params)\n if @team.save\n redirect_to editor_project_ae_team_path(@project, @team), notice: \"Team was successfully created.\"\n else\n render :new\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to '/teams', notice: 'Team was successfully created.' }\n format.json { render :index, status: :created }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n begin\n @team.owner_id = current_user.id\n @team.save!\n\n current_user.add_role :team_owner, @team\n current_user.add_role :member, @team\n current_user.teams << @team\n redirect_to teams_url, notice: 'Team was successfully created.'\n rescue Exception => e\n render :new\n end\n end",
"def create\n parent = Object.const_get(session[:team_type]).find(params[:id])\n begin\n Team.check_for_existing(parent, params[:team][:name], session[:team_type])\n @team = Object.const_get(session[:team_type] + 'Team').create(name: params[:team][:name], parent_id: parent.id)\n TeamNode.create(parent_id: parent.id, node_object_id: @team.id)\n undo_link(\"The team \\\"#{@team.name}\\\" has been successfully created.\")\n redirect_to action: 'list', id: parent.id\n rescue TeamExistsError\n flash[:error] = $ERROR_INFO\n redirect_to action: 'new', id: parent.id\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, :notice => 'Team was successfully created.' }\n format.json { render :json => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team\n new_team_code = genTeamCode(current_user.id)\n team_params = {\n :team_name => params[:teamname],\n :team_code => new_team_code,\n :advisor_users_id => current_user.id,\n }\n team = Team.new(team_params)\n team.save\n\n current_user.update_attribute( :team_name, params[:teamname] )\n current_user.update_attribute( :team_code, new_team_code)\n\n flash.now[:flash] = 'Team Created'\n render '/advisor/index'\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to root_path, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team(org, team_name, options={})\n options.merge!(:name => team_name)\n post \"/orgs/#{org}/teams\", :body => options\n end",
"def create\n @team = Team.new(params.required(:team).permit!)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n @team.user = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\tif @team.save\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n begin\n @team.save!\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n rescue => e\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html do\n flash[:notice] = 'Team was successfully created.'\n current_user.is_admin? ? (redirect_to teams_path) : (redirect_to user_teams_path(current_user))\n end\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ultimate_team = UltimateTeam.new(params[:ultimate_team])\n\n respond_to do |format|\n if @ultimate_team.save\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully created.' }\n format.json { render json: @ultimate_team, status: :created, location: @ultimate_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createTeam _args\n \"createTeam _args;\" \n end",
"def create\n @users_team = UsersTeam.new(users_team_params)\n\n respond_to do |format|\n if @users_team.save\n format.html { redirect_to @users_team, notice: 'Membro adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @users_team }\n else\n format.html { render :new }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @competition.teams.build(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\t@team = Team.new(team_params)\n\t\t@team = getLoginEventId\n\t\[email protected]_id = getLoginUserId\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html { redirect_to @team, notice: 'Die Klasse wurde erfolgreich eröffnet.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @team = Team.new(params[:team])\n\n if @team.save\n render json: @team, status: :created, location: @team\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def create\n @my_team = MyTeam.new(my_team_params)\n\n respond_to do |format|\n if @my_team.save\n format.html { redirect_to @my_team, notice: 'My team was successfully created.' }\n format.json { render :show, status: :created, location: @my_team }\n else\n format.html { render :new }\n format.json { render json: @my_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_team = UserTeam.new(user_team_params)\n\n respond_to do |format|\n if @user_team.save\n format.html { redirect_to @user_team, notice: 'User team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :my_team, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = fetch_team\n authorize @team\n @team.owners << current_user\n\n if @team.save\n @team.create_activity(:create,\n owner: current_user,\n parameters: { team: @team.name })\n respond_with(@team)\n else\n respond_with @team.errors, status: :unprocessable_entity\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n flash[:notice] = 'Team was successfully created.'\n format.html { redirect_to(@team) }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.create(team_params)\n if @team.save\n flash[:notice] = \"Success, team successfully created\"\n redirect_to teams_path\n else\n flash[:error] = @event.errors.full_messages.join(\" \")\n redirect_to new_team_path\n end\n end",
"def create\n respond_to do |format|\n if team.save\n format.html { redirect_to team, notice: 'Team was successfully created.' }\n format.json { render json: team, status: ':created', location: team }\n else\n format.html { render action: 'new' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @race.teams.build team_params\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to [@race, @team], notice: I18n.t(:create, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new\n @team.name = team_params[:name]\n @team.captain = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to(@team, :notice => 'Team was successfully created.') }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n @team.users << current_user\n\n respond_to do |format|\n if @team.save\n setup_team(@team)\n format.html { redirect_to user_root_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n\n @membership = Membership.new(team_id: @team.id, player_id: @team.player_id)\n @membership.save\n end",
"def create\n @games_team = GamesTeam.new(games_team_params)\n\n respond_to do |format|\n if @games_team.save\n format.html { redirect_to @games_team, notice: 'Games team was successfully created.' }\n format.json { render :show, status: :created, location: @games_team }\n else\n format.html { render :new }\n format.json { render json: @games_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n authorize @team\n current_user.update team: @team\n\n respond_to do |format|\n if @team.persisted?\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manage_team = ManageTeam.new(manage_team_params)\n\n respond_to do |format|\n if @manage_team.save\n format.html { redirect_to @manage_team, notice: 'Manage team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @manage_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @manage_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user_team(name, path)\n post(\"/user_teams\", :body => {:name => name, :path => path})\n end",
"def new\n\t\t@team = Team.new\n\tend",
"def new\n\t\t@team = Team.new\n\tend",
"def create\n @event_team = EventTeam.new(event_team_params)\n\n respond_to do |format|\n if @event_team.save\n format.html { redirect_to @event_team, notice: 'Event team was successfully created.' }\n format.json { render :show, status: :created, location: @event_team }\n else\n format.html { render :new }\n format.json { render json: @event_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # if he/she has already created a team, but no one else join the team\n # destroy the old team, teammember firstly\n if Team.find_by_user_id(current_user.id) != nil\n team = Team.find_by_user_id(current_user.id)\n teammember = Teammember.find_by_team_id(team.id)\n teammember.destroy\n team.destroy\n end\n \n # create team\n @team = Team.new(params[:team])\n @team.user_id = current_user.id\n sport_level_id = SportLevel.find_by_sql(\"SELECT sport_levels.id FROM sport_levels WHERE sport_levels.sport_id = \" + @team.sport_id.to_s + \" AND sport_levels.name = 1\")\n @team.sport_level_id = SportLevel.find_by_id(sport_level_id)\n @team.save\n\n # create teammember\n teammember = Teammember.new\n teammember.team_id = @team.id\n teammember.user_id = current_user.id\n teammember.save\n\n redirect_to '/teams/render_search_team', :notice_create_team => 'Team was successfully created.'\n end",
"def create\n @user_team = UserTeam.new(params[:user_team])\n\n respond_to do |format|\n if @user_team.save\n format.html { redirect_to(@user_team, :notice => 'User team was successfully created.') }\n format.xml { render :xml => @user_team, :status => :created, :location => @user_team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_team(body, opts = {})\n data, _status_code, _headers = create_team_with_http_info(body, opts)\n return data\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n @team.users << current_user\n render_success format, 'created', :created\n else\n render_errors format, @team.errors, :new\n end\n end\n end",
"def new\n @team = Team.new\n end",
"def new\n @team = Team.new\n end",
"def new\n @team = Team.new\n end",
"def create\n @users = User.active\n @team = Team.new(team_params)\n @projects = Project.active\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n unless team_registrable?\n respond_to do |format|\n format.html { redirect_to teams_path, alert: 'Team registration is closed.' }\n format.json { render json: { status: 'closed' } }\n end\n return\n end\n\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @swim_team = SwimTeam.new(params[:swim_team])\n\n respond_to do |format|\n if @swim_team.save\n format.html { redirect_to swim_teams_path(), notice: 'Swim team was successfully created.' }\n format.json { render json: @swim_team, status: :created, location: @swim_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @swim_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ab_team = AbTeam.new(ab_team_params)\n\n respond_to do |format|\n if @ab_team.save\n format.html { redirect_to @ab_team, notice: 'Record was created.' }\n format.json { render :show, status: :created, location: @ab_team }\n else\n format.html { render :new }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n team_name = params[:name]\n description = params[:description]\n\n @okr_team = OkrTeam.new(name: team_name, description: description)\n\n respond_to do |format|\n if @okr_team.save\n format.json { render json: 'Team is created successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = current_user.teams.new(team_params)\n @league = League.find_by(id: params[:league_id])\n @team.league = @league\n if @team.save\n LeagueInvite.where(email: current_user.email, league: @league).destroy_all\n flash[:success] = \"Added team to league\"\n if @league.teams.count == 10 && current_season = Season.current.first\n if LeagueSeason.where(league: @league, season: current_season).count == 0\n LeagueSeason.create(league: @league, season: current_season)\n end\n end\n redirect_to league_players_path(@league)\n else\n render action: :new\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: \"Team was successfully created.\" }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n newTeam = TeamMemberRelation.new()\n newTeam.team_id = @team.id\n newTeam.user_id = session[:user]\n newTeam.team_role_id = 1\n newTeam.save\n end",
"def new\n @team = Team.new();\n end",
"def make_fantasy_team\n puts \"What is your team name?\"\n name = gets.chomp\n puts \"What is your name?\"\n owner = gets.chomp\n your_team = FantasyTeam.create(name: name, owner: owner)\n your_team\n end",
"def new\n @team = @project.ae_teams.new\n end",
"def create\n params[:persona_team].merge!({\"account_id\" => session[:account_id]})\n @persona_team = PersonaTeam.new(params[:persona_team])\n\n respond_to do |format|\n if @persona_team.save\n flash[:notice] = 'Persona team was successfully created.'\n format.html { redirect_to(@persona_team_roster) }\n format.xml { render :xml => @persona_team, :status => :created, :location => @persona_team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @persona_team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_team = Team.new(admin_team_params)\n\n respond_to do |format|\n if @admin_team.save\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @admin_team }\n else\n format.html { render :new }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @organization.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n current_user.add_role :admin, @team\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n @team.created_by_id = current_user.id\n\n respond_to do |format|\n if @team.save!\n\n # Add creator to PlayerTeamR table\n relationship = PlayerTeamR.new(team_id: @team.id, user_id: @team.created_by_id)\n relationship.save!\n\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_teams\n number_of_teams.to_i.times do |i|\n self.teams << Team.create!(:name => TEAM_NAMES[i])\n end\n end",
"def create\n @organization = Organization.find(params[:organization_id])\n @team = @organization.teams.create(team_params)\n\n respond_to do |format|\n if @team.save\n\n Teaminvite.create!(admin_id: current_user.id,name: current_user.name,user_id: current_user.id, accepted: 'true', team_id: @team.id, email: current_user.email, admin: 'true',organization_id: @team.organization_id)\n format.html { redirect_to organization_teams_path(@team.organization_id), notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_team = SalesTeam.new(params[:sales_team])\n\n respond_to do |format|\n if @sales_team.save\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully created.' }\n format.json { render json: @sales_team, status: :created, location: @sales_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = TeamMember.new(team_member_params)\n if @member.save\n flash[:success] = t('create_team_member_success')\n redirect_to team_members_url\n else\n render 'new'\n end\n end",
"def create\n\n if (current_user.email = \"[email protected]\")\n\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n # team shouldn't be creatable through this way\n format.html { redirect_to tracks_url, notice: 'Team was successfully created.' }\n #format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n else\n format.html { redirect_to tracks_url, notice: 'You do not have the ability to create a team' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end \n end",
"def create\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to(@club, :notice => 'Team was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @team = Team.find_by_name(params[:team][:team_name])\n if @team.nil?\n @team = Team.new(captain_id: params[:team][:captain_id],\n\t\t team_name: params[:team][:team_name])\n\n respond_to do |format|\n if @team.save\n format.json { render json: @team, status: :created, location: @team }\n if params[:players]\n \tTeamPlayers.create(params[:players], team_name: @team.name)\n end\n else\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n else \n Team.update(params[:team])\n end\n end",
"def create\n @sports_team = SportsTeam.new(sports_team_params)\n\n respond_to do |format|\n if @sports_team.save\n format.html { redirect_to @sports_team, notice: 'Sports team was successfully created.' }\n format.json { render :show, status: :created, location: @sports_team }\n else\n format.html { render :new }\n format.json { render json: @sports_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n \t\t\t@team = Team.new team_params\n\n \t\t\tif @team.save\n\n \t\t\t\trender json: @team,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to new_category_path(:team => @team.name ), notice: 'Team was successfully created. Please create a Category' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to(season_team_path(@team.season_id, @team), :notice => 'Team was successfully created.') }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @nfl_team = NflTeam.new(params[:nfl_team])\n\n respond_to do |format|\n if @nfl_team.save\n format.html { redirect_to @nfl_team, notice: 'Nfl team was successfully created.' }\n format.json { render json: @nfl_team, status: :created, location: @nfl_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nfl_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @match_team = MatchTeam.new(match_team_params)\n\n respond_to do |format|\n if @match_team.save\n format.html { redirect_to @match_team, notice: 'Match team was successfully created.' }\n format.json { render :show, status: :created, location: @match_team }\n else\n format.html { render :new }\n format.json { render json: @match_team.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.84293497",
"0.841435",
"0.8381285",
"0.83776397",
"0.83551127",
"0.81242603",
"0.80644804",
"0.80554205",
"0.7988987",
"0.7985404",
"0.79497695",
"0.7943586",
"0.7941304",
"0.7941304",
"0.7941304",
"0.7941304",
"0.7941304",
"0.7941304",
"0.7941304",
"0.7941304",
"0.79409665",
"0.7937676",
"0.79254615",
"0.79254615",
"0.79254615",
"0.79220116",
"0.7851841",
"0.7849307",
"0.7848906",
"0.7832768",
"0.7827025",
"0.77954954",
"0.7793324",
"0.773323",
"0.773142",
"0.7731005",
"0.7729706",
"0.7704531",
"0.7704291",
"0.7702253",
"0.76801",
"0.7673225",
"0.767184",
"0.7669725",
"0.7668878",
"0.76328295",
"0.7604547",
"0.7597827",
"0.7597421",
"0.7595767",
"0.7583638",
"0.7581411",
"0.7577148",
"0.7574634",
"0.7568227",
"0.75552356",
"0.7554952",
"0.7527206",
"0.7524731",
"0.74927306",
"0.7492235",
"0.7484234",
"0.7483572",
"0.7436363",
"0.7436363",
"0.74266195",
"0.73840946",
"0.7382708",
"0.73591965",
"0.7354744",
"0.7345851",
"0.7345851",
"0.7345851",
"0.7335646",
"0.7321587",
"0.7311326",
"0.7307883",
"0.7301133",
"0.7286577",
"0.7280014",
"0.72583145",
"0.723774",
"0.7224004",
"0.72226447",
"0.7207912",
"0.72011775",
"0.7179531",
"0.7165732",
"0.71564525",
"0.7149434",
"0.71355504",
"0.7122932",
"0.7121253",
"0.71143574",
"0.71142215",
"0.7108836",
"0.7086885",
"0.7069255",
"0.7056191",
"0.7050186"
] | 0.7556647 | 55 |
Delete an existing team. | def delete(team_id)
@client.team.delete(team_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_team\n post('/team/destroy')\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def delete()\n\n Team.destroy(self.id)\n end",
"def delete(_team)\n # stub\n end",
"def delete_team(id)\n boolean_request :delete, \"/teams/#{id}\"\n end",
"def destroy\n\t\t@team = Team.find(params[:id])\n \t\[email protected]\n \t\tredirect_to teams_path\n\tend",
"def destroy\n @team = Team.find(params[:id]).destroy\n flash[:notice] = \"Team successfully deleted\"\n redirect_to teams_url\n end",
"def destroy\n @team = Team.find(params[:id]);\n @team.destroy();\n redirect_to(user_path(current_user) + '/teams');\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n head :no_content\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n respond_to do |format|\n format.html { redirect_to course_teams_path, notice: 'Team was successfully removed.' }\n end\n end",
"def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to teams_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n team = Team.find(@users_team.team_id)\n @users_team.destroy\n respond_to do |format|\n format.html { redirect_to team_path(team), notice: 'Membro removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :ok }\n end\n end",
"def call(_obj, args, _ctx)\n team = Team.find(args[:id])\n team.destroy\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to leagues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def delete_team_with(id)\n visit teams_path\n click_button 'Delete'\n click_button 'OK'\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to organization_teams_url(@organization), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @team, :destroy?\n\n @team.destroy\n respond_to do |format|\n format.html { redirect_to root_url(subdomain: ENV[\"DEFAULT_SUBDOMAIN\"]), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ultimate_team = UltimateTeam.find(params[:id])\n @ultimate_team.destroy\n\n respond_to do |format|\n format.html { redirect_to ultimate_teams_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to league_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @team.destroy\n # respond_to do |format|\n # format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to team_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to user_root_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to view_teams_path, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_teams_url(@competition) }\n format.json { head :no_content }\n end\n end",
"def destroy\n if (current_user.team_id != @team.id || !current_user.admin?)\n return\n end \n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n team_id = params[:id]\n @team = Team.find(team_id)\n user = current_user\n @users = [user]\n TeamMembership.find_by(\n team_id: team_id,\n member_id: user.id\n ).destroy\n\n render 'api/teams/show_team_and_members'\n end",
"def destroy\n\n if @team.destroy\n\n render json: {team: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def destroy\n begin\n @team.destroy\n rescue ActiveRecord::DeleteRestrictionError => exception\n flash[:error] = exception.message\n end\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_team = UserTeam.find(params[:id])\n @user_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n team_id = params[:id]\n status = OkrTeam.remove_team_from_system(team_id)\n\n respond_to do |format|\n if status == 200\n format.json { render json: 'Team is removed successfully from the system!', status: :ok }\n else\n format.json { render json: 'Unable to remove team from system!', status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @admin_team.destroy\n respond_to do |format|\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_app_team(org_name:, platform:, app_id:, team_name:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams/#{team_name}\"\n res = api.delete endpoint\n Response.new(res)\n end",
"def destroy\n @persona_team = PersonaTeam.find(params[:id])\n logger.debug(\"account id is #{session[:account_id]}\")\n @persona_team.destroy if session[:account_id] == @persona_team.account_id\n\n respond_to do |format|\n flash[:notice] = 'Persona team deleted.'\n format.html { redirect_to(persona_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @manage_team.destroy\n respond_to do |format|\n format.html { redirect_to manage_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to race_teams_url(@race), notice: I18n.t(:destroy, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nfl_team = NflTeam.find(params[:id])\n @nfl_team.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n \n flash[:notice] = 'Team was successfully deleted.'\n\n respond_to do |format|\n format.html { redirect_to teams_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n end\n end",
"def deleteTeam _args\n \"deleteTeam _args;\" \n end",
"def destroy\n TeamMember.find(params[:id]).destroy\n flash[:success] = t('member_deleted')\n redirect_to team_members_url\n end",
"def destroy\n if !current_user.is_admin?\n flash[:error] = I18n.t(:no_permission)\n redirect_to(teams_url) and return\n end\n\n @team = Team.find(params[:id])\n course = @team.course\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_teams_path(course)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sim_team = SimTeam.find(params[:id])\n @sim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ab_team.destroy\n respond_to do |format|\n format.html { redirect_to ab_teams_url, notice: 'Record was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n match_day_team = MatchDayTeam.find(params[:id])\n match_day_team.destroy\n head 204\n end",
"def destroy\n @user_team.destroy\n respond_to do |format|\n format.html { redirect_to user_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tournamentteam.destroy\n respond_to do |format|\n format.html { redirect_to tournamentteams_url, notice: 'Tournamentteam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @games_team.destroy\n respond_to do |format|\n format.html { redirect_to games_teams_url, notice: 'Games team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find_by_id(params[:id])\n @team.destroy\n\n if request.xhr?\n render :json => @team\n end\n end",
"def destroy\n @swim_team = SwimTeam.find(params[:id])\n @swim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to swim_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n team_members = User.with_role :member, @team\n team_members.each do |member|\n member.remove_role :member, @team\n member.remove_role :team_owner, @team\n end\n @team.destroy\n redirect_to teams_url, notice: 'Team was successfully destroyed.'\n end",
"def destroy\n @mm_team = MmTeam.find(params[:id])\n @mm_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_mm_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to teams_url, notice: 'Die Klasse wurde erfolgreich gelöscht.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def leave_team_before_delete\n team&.users&.delete(self)\n team&.cleanup\n end"
] | [
"0.85925484",
"0.85925484",
"0.8524446",
"0.83301955",
"0.82421327",
"0.81770736",
"0.81506354",
"0.81456274",
"0.80228627",
"0.7953203",
"0.79343647",
"0.7822298",
"0.78090906",
"0.7755417",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.7747579",
"0.77072895",
"0.7668155",
"0.7668155",
"0.7668155",
"0.7668155",
"0.7668155",
"0.7666721",
"0.762557",
"0.7621835",
"0.7620153",
"0.761025",
"0.7607841",
"0.760078",
"0.758967",
"0.7589435",
"0.7582968",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.7569832",
"0.755774",
"0.7555194",
"0.7555194",
"0.7555194",
"0.7555194",
"0.7529355",
"0.750852",
"0.7494604",
"0.7471585",
"0.74540293",
"0.7435643",
"0.74079126",
"0.7403027",
"0.73983955",
"0.73813844",
"0.7329702",
"0.732805",
"0.732011",
"0.731071",
"0.7308322",
"0.7290156",
"0.72877693",
"0.7286699",
"0.72851104",
"0.7272392",
"0.72613037",
"0.7254764",
"0.7233724",
"0.72278565",
"0.7225051",
"0.7205681",
"0.71987665",
"0.7196503",
"0.71922255",
"0.718882",
"0.7187554"
] | 0.83295196 | 4 |
Info for existing team. | def info(team_id)
@client.team.info(team_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_info(options={})\n post(\"team.info\", options)\n end",
"def team_info(options = {})\n post('team.info', options)\n end",
"def team_info(team_id)\n team_info_hash(team_id)\n end",
"def team_info(params = {})\n response = @session.do_post \"#{SCOPE}.info\", params\n Slack.parse_response(response)\n end",
"def show_team_info(team)\n t = $nbl_league.find_team(team)\n t.show_team_full_info\nend",
"def get_team_details(params)\n get('team', params)\n end",
"def teams_data\n # selected_team = self.class.all[prompt.to_i-1]\n puts \"\"\n puts \"---------------------------\"\n puts \"Team Name: \" + self.full_name\n puts \"City: \" + self.city\n puts \"Division: \" + self.division\n puts \"Conference: \" + self.conference\n puts \"\"\n puts \"---------------------------\"\n end",
"def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end",
"def team\n @team ||= Struct.new(:name, :domain).new(@team_name, @domain)\n end",
"def team\n fetch('esport.teams')\n end",
"def show_team_info\n puts \"\\nEnter a team name please?\"\n answer = gets.chomp\n\n team = @sport.teams.find_by(name: answer)\n\n puts \"\\n NAME: #{team.name}\\n\\n CITY: #{team.city.name}\\n\\n MASCOT: #{team.mascot}\\n\\n COLORS: #{team.colors}\\n\\n CHAMPIONSHIPS: #{team.championships}\\n\\n DESCRIPTION: #{team.info}\\n\\n\"\n end",
"def team\n Team.find(@current_team_id)\n end",
"def show\n\t\t# People available to add to a team.\n\t\tnormal_users = User.normal.where(duplicate: false).order(:name)\n\t\t@users = normal_users.select { |u| !u.team && u.eligible? }\n\n\t\t@changes = @team.name_changes\n\n\t\t# n+1 :(\n\t\t@participations = @team.participations.order(:created_at).select { |p| p.game.completed? }\n\t\t@max_participation = @participations.max { |x, y| y.place <=> x.place }\n\t\t@games = Game.where(id: @participations.map(&:game_id))\n\tend",
"def team_name\n return @team_name\n end",
"def team\n @response = CompanyApi::Request::Setting.new(\n CompanyApi::Response::Formatter::Manager,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).get_team_details({})\n\n unless @response.success?\n return handle_temporary_redirects(@response)\n end\n\n @presenter_obj = ::WebPresenter::ManagerPresenter.new(@response, params)\n @fe_no_nav = true\n end",
"def team\n return @team\n end",
"def team\n diamond_mine_project.team\n end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team_information(input)\r\n index = input - 1\r\n url = 'https://www.balldontlie.io/api/v1/teams'\r\n response = self.call_api(url)[\"data\"][index]\r\n @chosen_team_full_name = response[\"full_name\"]\r\n @chosen_team_nickname = @chosen_team_fullname.split(\" \").last\r\n\r\n # puts \"You've selected the #{response[\"full_name\"]}, from the #{response[\"division\"]} Division of the #{response[\"conference\"]}ern Conference.\"\r\n end",
"def team_information_list\n @teams = Team.find_teams_by_user(session[:user_id])\n \n end",
"def show\n\t\t@team = Team.find(params[:id])\n\tend",
"def show\n # @teams = ::Services::TeamService.show_teams\n end",
"def team_name\n client.team.name\n end",
"def show\n @team = Team.find(current_user.team_id)\n end",
"def display_resource(team)\n team.name\n end",
"def new\n @team = Team.new\n @project = Project.find(params[:project_id]) if params[:project_id]\n\n # TODO : This should find a list of users that can be assigned to the team\n #@users = User.find(:all, :select => \"first_name, last_name, CONCAT(first_name, ' ', last_name) as 'member'\", :order => \"first_name\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def team\n\t\t\trobot.team\n\t\tend",
"def team_information\n @team = Team.find_by_user1(session[:user_id])\n @teammate = Team.find_teammate(session[:user_id])\n @user = User.find(session[:user_id])\n\n flash.now[:notice] = \"You need a teammember!\"\n render :controller => 'teams', :action => 'team_information'\n end",
"def team=(value)\n @team = value\n end",
"def get_team_info( name, code, region = REGIONS.first )\n url = \"/base/teams/#{region}/#{encoded_name(name,code)}.json\"\n response = get_request(url)\n\n Character.new(response.parsed_response)\n end",
"def team_information\n @team = Team.find_by_user1(current_user.id)\n @teammate = Team.find_teammate(current_user.id)\n @user = current_user\n\n flash.now[:notice] = \"You need a teammember!\"\n render :controller => 'teams', :action => 'team_information'\n\n end",
"def current_team\n self.teams\n end",
"def team_name\n self.team == nil ? \"\" : self.team.name\n end",
"def show\n @team = Team.find(params[:id])\n end",
"def show\n @team = Team.find(params[:id])\n end",
"def all_team_info(team_name)\n team_info = game_hash.find do |color, team_data|\n team_data[:team_name] == team_name\n end\n team_info[1]\nend",
"def show\n\t\t@team = Team.find(params[:id])\n\t\tquery = @team.name\n\n\t\t# Pulls news articles about each team through Google RSS\n\t\tdata = party_time(\"https://news.google.com/news/feeds?q=#{query.downcase.gsub(/\\s/, '+')}&output=rss\")\n\t\t@articles = data[\"rss\"][\"channel\"][\"item\"]\n\n\t\t# Pulls upcoming fixtures for this team\n\t\t@data2 = party_time(\"http://api.statsfc.com/premier-league/fixtures.json?key=DThzCPsM_TI0XUGeUOJqr26JHwtYXVIfYvSSb0ui&team=#{query.downcase.gsub(/\\s/, '-')}&timezone=America/New_York&limit=5\")\n\n\t\t# Pulls past results for this team \n\t\t@data3 = party_time(\"http://api.statsfc.com/premier-league/results.json?key=DThzCPsM_TI0XUGeUOJqr26JHwtYXVIfYvSSb0ui&team=#{query.downcase.gsub(/\\s/, '-')}&timezone=America/New_York&limit=5\")\n\tend",
"def show\n\n \t\t\trespond_with @team\n\n \t\tend",
"def inspect\n %(#<MLBGameday::Team @name=\"#{@name}\">)\n end",
"def show\n @team=Team.find(params[:id])\n end",
"def team\n @team ||=\n begin\n data = Tooling::Danger::RequestHelper.http_get_json(ROULETTE_DATA_URL)\n data.map { |hash| ::Tooling::Danger::Teammate.new(hash) }\n rescue JSON::ParserError\n raise \"Failed to parse JSON response from #{ROULETTE_DATA_URL}\"\n end\n end",
"def refresh_team_info(*)\n reload # SQL caching causing users to be empty when creating team making all teams ineligible\n set_team_captain\n set_slots_available\n set_eligibility\n cleanup\n end",
"def current_team\n \t\tTeam.find_by(id: current_user.team_id)\n \tend",
"def show_teams\n puts(@teams.to_s);\n end",
"def show_teams\n puts \"\\nWhat sport would you like to see the teams for? (Enter a sport please)\"\n sport_name = gets.chomp\n\n @sport = Sport.find_by(name: sport_name)\n\n puts \"\\nHere is a list of the teams for #{sport_name}\"\n @sport.teams.each do |x|\n puts \"\\n#{x.name} - #{x.city.name}\\n\"\n # puts x.info\n end\n end",
"def known_teams_table\r\n @known_teams_table ||= TextUtils.build_title_table_for( teams )\r\n end",
"def team\n return group\n end",
"def teams\n parse_domain_top '/Teams/TeamList.aspx', 'lnkTeamInfo'\n end",
"def team_id\n return @team_id\n end",
"def show\n @team = @phase.team\n end",
"def team\n teams.where(hubstats: true).first\n end",
"def current_team\n\t\tTeam.find_by(id: current_user.team_id)\n\tend",
"def current_user_team\n current_user.team\n end",
"def show\n laxid = params[:laxid]\n @team = Team.all.where(laxid: laxid).last[:team_name]\n puts @team\n end",
"def create(_team)\n # stub\n end",
"def home_team_name\n return home_team.try(:name)\n end",
"def project_team(project_name)\n team.select { |member| member.in_project?(project_name) }\n rescue => err\n warn(\"Reviewer roulette failed to load team data: #{err.message}\")\n []\n end",
"def show\n #@projects = Project.active\n @teams = Team.for_user(current_user)\n @team_leads = @team.team_leads\n @members = @team.members.by_name\n end",
"def getTeamName(org_id)\n conf = loadIOSConfigFile(org_id)\n return conf['team_name']\nend",
"def index\n\t\t@team = Team.find(params[:team_id])\n\tend",
"def stats_vs_team(team, season = nil)\n id = find_id(team, Team)\n data = stats_request(\"vsTeam\", season)\n data.find do |s| s[\"opponent\"][\"id\"] == id end\n end",
"def teams\n @teams\n end",
"def get_teams( org )\n teams = Homework.get(\"/orgs/#{org}/teams\", :headers => @auth)\n teams.each do |team|\n puts team['id']\n end\n end",
"def test_team_name\n assert_equal(\"Glasgow Celgers\",@football_team.team)\n end",
"def new\n @team = @project.ae_teams.new\n end",
"def team( team_id )\n\n if( team_id.is_a?(String) && team_id.is_a?(Integer) )\n raise ArgumentError.new(format('wrong type. user \\'team_id\\' must be an String (for an Team name) or an Integer (for an Team Id), given \\'%s\\'', team_id.class.to_s))\n end\n raise ArgumentError.new('missing \\'team_id\\'') if( team_id.size.zero? )\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'team has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n if(team_id.is_a?(String))\n o_team = search_team(name: team_id)\n status = o_team.dig('status')\n total_count = o_team.dig('totalCount')\n\n return { 'status' => 404, 'message' => format( 'No Team \\'%s\\' found', team_id) } unless(status == 200 && total_count > 0)\n\n teams = o_team.dig('teams')\n team = teams.detect { |x| x['name'] == team_id }\n team_id = team.dig('id')\n end\n\n endpoint = format( '/api/teams/%s', team_id )\n\n @logger.debug(\"Getting team by Id #{team_id} (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def team(id)\n get \"/teams/#{id}\"\n end",
"def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end",
"def team_team_members\n if has_team?\n Employee.where(id: team_team_positions.map(&:efective_id))\n else\n Employee.none\n end\n end",
"def show\n @id = @my_team.team_id\n @team_name = Teams.find(@id)\n roster = RestClient.get(\"https://statsapi.web.nhl.com/api/v1/teams/#{@id}/roster\")\n @roster = JSON.parse(roster)[\"roster\"]\n end",
"def teams\n @teams ||= ApiFactory.new 'Orgs::Teams'\n end",
"def team\n @team_resource ||= Team.new(@client)\n end",
"def get_team_stats()\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team/stats\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def show\n @user_teams = @game.team.user_teams\n end",
"def data\n teams.map do |team|\n edit_path = link_to(fa_icon('edit lg'), edit_team_path(team))\n delete_path = link_to(fa_icon('trash-o lg'), team, method: :delete, data: { confirm: I18n.t('teams.index.delete_confirm') })\n [\n team.name,\n \"#{edit_path} #{delete_path}\"\n ]\n end\n end",
"def show\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimate_team }\n end\n end",
"def show\n @teams = Team.all\n @team_member = Team.friendly.find(params[:id])\n end",
"def show\n respond_with(@team)\n end",
"def get_team_name\n team ? team.get_full_name : '?'\n end",
"def get_team_name\n team ? team.get_full_name : '?'\n end",
"def get_team_name\n team ? team.get_full_name : '?'\n end",
"def get_team_name\n team ? team.get_full_name : '?'\n end",
"def dnd_teamInfo(options = {})\n raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?\n post('dnd.teamInfo', options)\n end",
"def profile(team_name)\n get_request(\"/2.0/teams/#{team_name.to_s}\")\n end",
"def my_team\n self.teams.first\n end",
"def seeded_teams\n raise 'Not Implemented'\n end",
"def team\n ENV['SLACK_TEAM']\n end",
"def get_team(game)\n team = 0\n get_participation_by_game game do |participation|\n team = participation.team\n end\n team\n end",
"def new\n\t\t@team = Team.new\n\tend",
"def new\n\t\t@team = Team.new\n\tend",
"def update_team\n \n end",
"def blue_team\n teams[1]\n end",
"def get_team(params = {})\n params = Utils.symbolize_hash_keys(params)\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def show\n authorize @team\n\n add_breadcrumb \"#{@event.code}\", :admin_event_path\n add_breadcrumb \"Equipes\", :admin_event_teams_path\n add_breadcrumb \"#{@team.name}\", :admin_event_team_path\n @team_users = TeamUser.where(team: @team)\n\n end",
"def team_id\n client.team.id\n end"
] | [
"0.805207",
"0.80386984",
"0.77354944",
"0.7542862",
"0.7370155",
"0.7337309",
"0.7157007",
"0.70823365",
"0.7058903",
"0.7033669",
"0.70252305",
"0.69720864",
"0.6861856",
"0.681197",
"0.6785128",
"0.6752807",
"0.67475164",
"0.674183",
"0.674183",
"0.674183",
"0.674183",
"0.674183",
"0.674183",
"0.6725277",
"0.6691515",
"0.6674086",
"0.6673636",
"0.6626639",
"0.660786",
"0.65813273",
"0.6570928",
"0.65639985",
"0.6554387",
"0.6522936",
"0.65220016",
"0.65194374",
"0.6514893",
"0.6500227",
"0.6485557",
"0.6485557",
"0.648198",
"0.6452689",
"0.6452132",
"0.645183",
"0.6416724",
"0.6412129",
"0.64008665",
"0.63814783",
"0.63729125",
"0.6369717",
"0.63620925",
"0.63558584",
"0.6335898",
"0.6330996",
"0.63000417",
"0.630003",
"0.6299185",
"0.6297358",
"0.6295966",
"0.628959",
"0.6281142",
"0.6263673",
"0.6250716",
"0.62465584",
"0.6232296",
"0.62204313",
"0.620881",
"0.62049073",
"0.6179926",
"0.6170537",
"0.61699206",
"0.61629915",
"0.6162896",
"0.6160876",
"0.6159226",
"0.6140293",
"0.6139249",
"0.61384064",
"0.6136776",
"0.6125918",
"0.61228526",
"0.61164397",
"0.6116398",
"0.61029124",
"0.61029124",
"0.61029124",
"0.61029124",
"0.60909516",
"0.60808617",
"0.60789466",
"0.60788023",
"0.60756654",
"0.60523736",
"0.60415035",
"0.60415035",
"0.6040446",
"0.6034479",
"0.6027574",
"0.6026052",
"0.6022861"
] | 0.73896635 | 4 |
List existing teams for an org. | def list(org_username)
@client.team.list(org_username)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_teams(org)\n Hardmode.get(\"/orgs/#{org}/teams\", :headers => @auth)\n end",
"def teams(org)\n get \"/orgs/#{org}/teams\"\n end",
"def get_teams( org )\n teams = Homework.get(\"/orgs/#{org}/teams\", :headers => @auth)\n teams.each do |team|\n puts team['id']\n end\n end",
"def teams\n @teams ||= @api.client.orgs.teams.list(org: @org)\n end",
"def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end",
"def index\n @teams = @organization.teams\n end",
"def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end",
"def index\n authorize! :read, parent_organization\n @teams = MnoEnterprise::Team.where(organization_id: params[:organization_id])\n end",
"def app_teams(org_name:, platform:, app_id:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams\"\n res = api.get endpoint\n Response.new(res)\n end",
"def teams\n @teams ||= ApiFactory.new 'Orgs::Teams'\n end",
"def team\n fetch('esport.teams')\n end",
"def index\n @organization = Organization.find(params[:organization_id])\n @@organization = @organization\n @teams = @organization.teams\n end",
"def teams\n synchronize { return @teams if @teams }\n\n teams = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_teams(org).each do |team|\n team = team.to_h\n team[:organization] = org\n teams[team[:id]] = team\n end\n end\n\n synchronize { @teams = teams }\n end",
"def teams\n parse_domain_top '/Teams/TeamList.aspx', 'lnkTeamInfo'\n end",
"def teams(reload = false)\n options = {:include => [:center, :users], :order => \"title\"}\n teams =\n if self.has_access?(:team_show_all)\n Team.find(:all, options)\n elsif self.has_access?(:team_show_admin)\n Team.in_center(self.center_id).sort_by &:title # Team.find(:all, :conditions => ['parent_id = ?', self.center_id])\n elsif self.has_access?(:team_show_member)\n Team.direct_groups(self).sort_by &:title\n else\n []\n end\n end",
"def index\n\t\t@teams = Team.all\n\tend",
"def load_teams\n tell \"Loading teams...\" unless options.quiet?\n teams = []\n\n doc = Nokogiri::HTML(open(TEAMS_URL))\n div1a = doc.css('div.mod-container > div.span-2').first\n list = div1a.css('div.mod-teams-list-medium ul li')\n \n list.each do |t|\n a_tag = t.search('h5 > a').first\n id = a_tag['href'].match(/_\\/id\\/([\\d]+)\\/.+\\Z/)[1]\n name = a_tag.content\n teams.push({:id => id, :name => name})\n end\n\n teams.sort_by { |team| team[:name] }\n end",
"def index\n @users_teams = UsersTeam.all\n end",
"def list\n @connection.get('/user/orgs').map do |org_data|\n GitHubApi::Org.new(self, org_data)\n end\n end",
"def get_teams\n reply = @client.call(:get_teams)\n data = reply.body.dig(:get_teams_response,\n :get_teams_result,\n :string)\n check_if_data_exists(data)\n rescue Savon::HTTPError => error\n logger.debug error.http.code\n return []\n end",
"def teams\n return [og, oo, cg, co];\n end",
"def list_teams_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TeamApi.list_teams ...\"\n end\n # resource path\n local_var_path = \"/v2/teams\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListTeamsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#list_teams\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def teams(reload = false)\n options = {:include => [:center, :users]}\n teams =\n if self.has_access?(:team_show_all)\n Team.find(:all, options)\n elsif self.has_access?(:team_show_admin)\n Team.in_center(self.center_id) # Team.find(:all, :conditions => ['parent_id = ?', self.center_id])\n elsif self.has_access?(:team_show_member)\n Team.direct_groups(self)\n else\n []\n end\n end",
"def index\n @teams = current_user.teams\n end",
"def index\n @teams = current_user.teams\n end",
"def get_project_teams(project_id_or_key)\n get(\"projects/#{project_id_or_key}/teams\")\n end",
"def index\n @orgs = Org.all\n end",
"def team(id)\n get \"/teams/#{id}\"\n end",
"def repository_teams(repo, options = {})\n paginate \"#{Repository.path repo}/teams\", options\n end",
"def teams\n @teams\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @games_teams = GamesTeam.all\n end",
"def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end",
"def index\n @user_teams = UserTeam.all\n end",
"def get_teams\n TeamNode.get(node_object_id)\n end",
"def get_teams(opts = {})\n data, _status_code, _headers = get_teams_with_http_info(opts)\n data\n end",
"def team_information_list\n @teams = Team.find_teams_by_user(session[:user_id])\n \n end",
"def all_teams_in_league\n \treturnArray = []\n\t\tbase_uri = 'https://www.thesportsdb.com/api/v1/json/1/search_all_teams.php?l=' + @league_name.to_s\n\t\tresponse = RestClient.get(base_uri)\n\t\tjson_response = JSON.parse(response)\n\t\thashIds = json_response['teams'] \n\t\thashIds.length.times do |i|\n\t\t\treturnArray[i] = \"Team ID: #{hashIds[i]['idTeam']}, Name: #{hashIds[i]['strTeam']}, Short Name: #{hashIds[i]['strTeamShort']}, Formed Year: #{hashIds[i]['intFormedYear']}, Sport: #{hashIds[i]['strSport']}, Alternate Name: #{hashIds[i]['strAlternateName']}\"\n\t\tend\n\t\treturn returnArray\n\tend",
"def teams\n render json: @team_query\n end",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def index\n @teams = Team.order(:description).page(params[:page]).per(5)\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end",
"def teams(reload = false)\n options = {:include => [:center, :users], :order => \"title\"}\n teams =\n if self.has_access?(:team_show_all)\n Team.includes([:center, :users]).order(:title) #all(options)\n elsif self.has_access?(:team_show_admin)\n Team.in_center(self.center_id).sort_by &:title\n elsif self.has_access?(:team_show_member)\n Team.direct_groups(self).sort_by &:title\n else\n []\n end\n end",
"def show\n @user_teams = @game.team.user_teams\n end",
"def index\n @team_roles = TeamRole.where(lab: @lab)\n end",
"def show_teams\n puts \"\\nWhat sport would you like to see the teams for? (Enter a sport please)\"\n sport_name = gets.chomp\n\n @sport = Sport.find_by(name: sport_name)\n\n puts \"\\nHere is a list of the teams for #{sport_name}\"\n @sport.teams.each do |x|\n puts \"\\n#{x.name} - #{x.city.name}\\n\"\n # puts x.info\n end\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 get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end",
"def show_teams\n puts(@teams.to_s);\n end",
"def index\n @manage_teams = ManageTeam.all\n end",
"def show\n # @teams = ::Services::TeamService.show_teams\n end",
"def get_teams\n doc = Nokogiri::HTML(open(\"http://www.espn.com/mens-college-basketball/teams\"))\n conferences = doc.css(\"div.mod-teams-list-medium\")\n \n # Cycle through conferences filling in the name of each team along with their homepage url\n x = 1\n conferences.each do |conference|\n conf = Conference.find_or_initialize_by(name: conference.css(\"div.mod-header h4\").text)\n conf.id = x\n conf.save\n teams = conference.css(\"ul li\")\n y = 0 \n teams.each do |row|\n team_link = row.css(\"a.bi\")\n team_name = team_link.text\n team_url = team_link[0]['href']\n team = Team.find_or_initialize_by(school: team_name)\n if team\n team.conference_id = x\n team.home_url = team_url\n team.save\n else\n print row\n end\n end\n x += 1\n end\n # Visit each team URL to get the rest of the team info and correct team name\n Team.all.each do |new_team|\n doc = Nokogiri::HTML(open(new_team.home_url))\n header = doc.css(\"div.global-nav-container ul.first-group\")\n school = header.css(\"li.team-name span.link-text-short\").text\n long_name = header.css(\"li.team-name span.link-text\").text\n logo = header.css(\"span.brand-logo img\").attr('src').to_s\n long_name.slice! school\n long_name.strip!\n logo.slice! \"&h=150&w=150\"\n new_team.school = school\n new_team.nickname = long_name\n new_team.logo_url = logo\n new_team.save\n end\n redirect_to teams_path\n end",
"def index\n pages_initialization\n\n @okr_teams = OkrTeam.all\n\n render 'app/system_teams'\n end",
"def index\n @event_teams = EventTeam.all\n end",
"def team_list(trace: false, &block)\n r = dropbox_query(query: '2/team/members/list', trace: trace)\n r['members'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/members/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['members'].each(&block)\n end\n end",
"def list_teams(opts = {})\n data, _status_code, _headers = list_teams_with_http_info(opts)\n return data\n end",
"def data\n teams.map do |team|\n edit_path = link_to(fa_icon('edit lg'), edit_team_path(team))\n delete_path = link_to(fa_icon('trash-o lg'), team, method: :delete, data: { confirm: I18n.t('teams.index.delete_confirm') })\n [\n team.name,\n \"#{edit_path} #{delete_path}\"\n ]\n end\n end",
"def teams\n return @teams if @teams\n\n @teams ||= @team_abbreviation.split(\", \").map do |team_abbreviation|\n Team.new(team_abbreviation, season: @season)\n end\n\n end",
"def get_team(params = {})\n params = Utils.symbolize_hash_keys(params)\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def index\n\t\t@teams = Team.order(:name).select { |team| can? :read, team }\n\tend",
"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 index\n @teams = @olympiad.teams.includes(:registrations, :users, :posts).order(:name)\n end",
"def index\n @teams = Team.order(:id).page(params[:page]).per(10)\n end",
"def list_teams\n\tputs \"Here are the Teams...\"\n\t# new thing! sleep() tells your program\n\t# to wait a certain amount of seconds\n\t# (passed as argument) before continuing\n\tsleep(1)\n\tputs \"---------------------\"\n\n\[email protected] do |team|\n\t\tputs \"#{team.ranking}. #{team.name}\"\n\tend\n\treturn_to_menu\nend",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end",
"def get_teams\n TeamNode.get(self.node_object_id)\n end",
"def set_team\n @organization = Organization.find(params[:organization_id])\n @team = @organization.teams.find(params[:id])\n end",
"def index\n @sourcing_orgs = SourcingOrg.all\n end",
"def organizations\n teams.map do |team|\n team.organization\n end.compact.uniq\n end",
"def get_teams_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\nend",
"def getAllTeamNames\n return TestSuite.find_by_sql(\"select DISTINCT teamname from test_suite\");\n end",
"def teams\n return ['FFA (Free For All)'] if ffa?\n\n teams = []\n @doc.css('map teams').xpath('./team').each do |t|\n name = localized_sting(t.text)\n min = t.attr('min')\n max = t.attr('max')\n teams << \"<h3 style='color: #{color_to_html(t.attr('color'))}'>#{name} <small style='color: black'>(#{min} - #{max} players)</small></h3>\"\n end\n teams\n end",
"def get_team_details(params)\n get('team', params)\n end",
"def teams()\n return MicrosoftGraph::Teams::TeamsRequestBuilder.new(@path_parameters, @request_adapter)\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 list_teams_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeamsAPI.list_teams ...'\n end\n allowable_values = ['name', '-name', 'user_count', '-user_count']\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v2/team'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?\n query_params[:'filter[keyword]'] = opts[:'filter_keyword'] if !opts[:'filter_keyword'].nil?\n query_params[:'filter[me]'] = opts[:'filter_me'] if !opts[:'filter_me'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TeamsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_teams,\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: TeamsAPI#list_teams\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @sports_teams = SportsTeam.all\n end",
"def index\n @teams = current_user.recent_teams\n end"
] | [
"0.8562008",
"0.84797186",
"0.8197575",
"0.7982986",
"0.78823084",
"0.7258482",
"0.70737994",
"0.7054997",
"0.6937374",
"0.68350524",
"0.6727801",
"0.6639845",
"0.6586247",
"0.65180814",
"0.64882165",
"0.64792675",
"0.6466502",
"0.644493",
"0.64319986",
"0.63792485",
"0.6376919",
"0.63363993",
"0.6334417",
"0.63249743",
"0.63249743",
"0.6320759",
"0.6311408",
"0.6308666",
"0.6300876",
"0.6281216",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.6250913",
"0.62467104",
"0.62408215",
"0.6239686",
"0.6229894",
"0.6211922",
"0.62023",
"0.6176127",
"0.6166831",
"0.6133962",
"0.6128435",
"0.6121564",
"0.61202055",
"0.61132014",
"0.6107317",
"0.61054116",
"0.6080088",
"0.6077575",
"0.60747975",
"0.6066541",
"0.60622025",
"0.6054146",
"0.605383",
"0.60411197",
"0.6033386",
"0.6026707",
"0.6024007",
"0.59761614",
"0.5973093",
"0.5956967",
"0.59551674",
"0.59525746",
"0.5952287",
"0.5950877",
"0.5946875",
"0.5945659",
"0.5941741",
"0.5929809",
"0.5924088",
"0.59069234",
"0.59057754",
"0.58867055",
"0.58836967",
"0.58813953",
"0.5868469",
"0.5864952",
"0.58623666"
] | 0.7684691 | 5 |
Update an existing team. | def update(team_id, body = {})
@client.team.update(team_id, body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_team\n @team.update(team_params)\n end",
"def update\n\t\tteam = Team.find(params[:id])\n\t\tteam.update_attributes(params[:team])\n\n\t\tredirect_to teams_path\n\tend",
"def update\n @team = Team.find(params[:id])\n if @team.update_attributes(team_params)\n flash[:notice] = \"Team successfully updated\"\n redirect_to teams_url\n else\n render 'edit'\n end\n end",
"def update_team(opts)\n HelloSign::Resource::Team.new post('/team', body: opts)\n end",
"def update_team(opts)\n HelloSign::Resource::Team.new post('/team', :body => opts)\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render json: @team }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @team.update(team_params)\n redirect_to teams_url, notice: 'Team was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n if @ultimate_team.update_attributes(params[:ultimate_team])\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n team_data = params[:team]\n begin\n team = Team.where(:id=>team_data[:id]).first\n if team && registration = Registration.on_team(team).for_user(current_user).first\n team.update_attributes(team_data) if registration.captain?\n end\n end\n flash[:success] = \"Your team changes were saved successfully. Check them out:\"\n redirect_to registration_olympiad_path(@olympiad, :page=>\"team\")\n end",
"def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to league_team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_team\n \n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to organization_teams_path(@team.organization_id), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @league = League.find(params[:league_id])\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end",
"def update\n\t\tteam_id = params[:id]\n\t\t@team = Team.find(team_id)\n\t\tif @team.update(team_params)\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend",
"def update\n @team.update_attributes(team_params)\n flash[:notice] = \"Success, team was updated\"\n redirect_to @team\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to teams_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to user_root_url, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n notify :notice, 'Team was successfully updated.'\n format.html { redirect_to(@team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n flash[:success] = 'Team was successfully updated.'\n format.html { redirect_to @team}\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: \"Team was successfully updated.\" }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_team = UserTeam.find(params[:id])\n\n respond_to do |format|\n if @user_team.update_attributes(params[:user_team])\n format.html { redirect_to(@user_team, :notice => 'User team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if team.update(team_params)\n format.html { redirect_to team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n authorize @team, :update?\n\n @team_form = Team::Form.new(team: @team, attributes: team_params)\n\n respond_to do |format|\n if @team_form.save\n format.html { redirect_to team_url(subdomain: @team.subdomain, auth_token: GenerateLoginToken.call(user: current_user)), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:team][:team_id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n if params[:players]\n TeamPlayers.update(params[:players], team_name: @team.name)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Tím bol úspšne zmenený.'\n format.html { redirect_to(@team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_team(id, team_name, options={})\n options.merge!(:name => team_name)\n patch \"/teams/#{id}\", :body => options\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n render_success format, 'updated', :ok\n else\n render_errors format, @team.errors, :edit\n end\n end\n end",
"def update\n respond_to do |format|\n @team.name = team_params[:name]\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona_team = PersonaTeam.find(params[:id])\n\n respond_to do |format|\n if @persona_team.update_attributes(params[:persona_team])\n flash[:notice] = 'Persona team was successfully updated.'\n format.html { redirect_to(@persona_team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @persona_team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_team( params )\n\n raise ArgumentError.new(format('wrong type. \\'params\\' must be an Hash, given \\'%s\\'', params.class.to_s)) unless( params.is_a?(Hash) )\n raise ArgumentError.new('missing \\'params\\'') if( params.size.zero? )\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'team has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n team_id = validate( params, required: true , var: 'team_id' )\n name = validate( params, required: false, var: 'name' , type: String )\n email = validate( params, required: true , var: 'email', type: String )\n\n if(team_id.is_a?(String))\n o_team = search_team(name: team_id)\n status = o_team.dig('status')\n total_count = o_team.dig('totalCount')\n\n return { 'status' => 404, 'message' => format( 'No Team \\'%s\\' found', team_id) } unless(status == 200 && total_count > 0)\n\n teams = o_team.dig('teams')\n team = teams.detect { |x| x['name'] == team_id }\n\n team_id = team.dig('id')\n end\n\n payload = {\n email: email,\n name: name\n }\n payload.reject!{ |_, y| y.nil? }\n\n endpoint = format( '/api/teams/%d', team_id )\n @logger.debug(\"Updating team with Id #{team_id} (PUT #{endpoint})\") if @debug\n\n put( endpoint, payload.to_json )\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params.required(:team).permit!)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @swim_team = SwimTeam.find(params[:id])\n\n respond_to do |format|\n if @swim_team.update_attributes(params[:swim_team])\n format.html { redirect_to swim_teams_path(), notice: 'Swim team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @swim_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to user_path(current_user), notice: 'Team information was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update_attributes(team_params)\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sales_team = SalesTeam.find(params[:id])\n\n respond_to do |format|\n if @sales_team.update_attributes(params[:sales_team])\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @team = Team.find params[:id]\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Yay, saved!'\n format.html { redirect_to(:action => :show, :id => @team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_team.update(user_team_params)\n format.html { redirect_to @user_team, notice: 'User team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_team.update(admin_team_params)\n format.html { redirect_to admin_teams_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_team }\n else\n format.html { render :edit }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_team\n @team = Team.find_by(name: params[:namespace][:team])\n\n if @team.nil?\n @namespace.errors[:team] << \"'#{params[:namespace][:team]}' unknown.\"\n else\n @namespace.create_activity :change_team,\n owner: current_user,\n parameters: { old: @namespace.team.id, new: @team.id }\n @namespace.update(team: @team)\n end\n\n @team\n end",
"def update\n @team = Team.find(params[:id])\n\n msg = check_valid_names\n if !msg.empty?\n logger.debug msg\n flash[:error] = msg\n redirect_to :action => 'update'\n return\n end\n handle_teams_people\n\n update_course_faculty_label\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Team was successfully updated.'\n format.html { redirect_to(course_teams_path(@team.course)) }\n format.xml { head :ok }\n else\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_team.update(my_team_params)\n format.html { redirect_to @my_team, notice: 'My team was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_team }\n else\n format.html { render :edit }\n format.json { render json: @my_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tournamentteam.update(tournamentteam_params)\n format.html { redirect_to @tournamentteam, notice: 'Tournamentteam was successfully updated.' }\n format.json { render :show, status: :ok, location: @tournamentteam }\n else\n format.html { render :edit }\n format.json { render json: @tournamentteam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @users_team.update(users_team_params)\n format.html { redirect_to @users_team, notice: 'Membro atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @users_team }\n else\n format.html { render :edit }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sim_team = SimTeam.find(params[:id])\n\n respond_to do |format|\n if @sim_team.update_attributes(params[:sim_team])\n flash[:notice] = 'SimTeam was successfully updated.'\n format.html { redirect_to(@sim_team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sim_team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_team.update(event_team_params)\n format.html { redirect_to @event_team, notice: 'Event team was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_team }\n else\n format.html { render :edit }\n format.json { render json: @event_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_team(identifier, opts = {})\n data, _status_code, _headers = update_team_with_http_info(identifier, opts)\n return data\n end",
"def update\n @nba_team = NbaTeam.find(params[:id])\n\n respond_to do |format|\n if @nba_team.update_attributes(params[:nba_team])\n format.html { redirect_to @nba_team, notice: 'Nba team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nba_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @users = User.active\n @projects = Project.active\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_team = Team.where(\"league_id = ?\", @league.id)[0]\n respond_to do |format|\n if @league.update(league_params)\n format.html { redirect_to team_path(@user_team.id), notice: 'League was successfully updated.' }\n format.json { render :show, status: :ok, location: @league }\n else\n format.html { render :edit }\n format.json { render json: @league.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_updated_team _user, team\n data = {\n category: 'Teams',\n action: 'Updated an Team',\n label: team.name,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def update\n respond_to do |format|\n if @ab_team.update(ab_team_params)\n format.html { redirect_to @ab_team, notice: 'Record was updated' }\n else\n format.html { render :edit }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @team.update(team_params)\n\n render json: @team,status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update\n respond_to do |format|\n if @manage_team.update(manage_team_params)\n format.html { redirect_to @manage_team, notice: 'Manage team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manage_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to [@race, @team], notice: I18n.t(:update, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nfl_team = NflTeam.find(params[:id])\n\n respond_to do |format|\n if @nfl_team.update_attributes(params[:nfl_team])\n @nfl_team.create_activity :update, owner: current_user\n format.html { redirect_to @nfl_team, notice: 'Nfl team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nfl_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team_admin = TeamAdmin.find(params[:id])\n\n respond_to do |format|\n if @team_admin.update_attributes(params[:team_admin])\n format.html { redirect_to @team_admin, notice: 'Team admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_admin.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.8587275",
"0.81969345",
"0.80520034",
"0.7996723",
"0.78804016",
"0.7848154",
"0.78084606",
"0.78082496",
"0.77981377",
"0.77981377",
"0.77981377",
"0.77981377",
"0.77981377",
"0.77981377",
"0.7783417",
"0.7783417",
"0.7724654",
"0.7688975",
"0.76819724",
"0.76708156",
"0.76529336",
"0.7647018",
"0.76389396",
"0.7619388",
"0.761801",
"0.761195",
"0.7605104",
"0.7595571",
"0.75898826",
"0.7585833",
"0.7576818",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.75571936",
"0.7557041",
"0.7545705",
"0.74979466",
"0.74964255",
"0.7474431",
"0.7471609",
"0.7438255",
"0.74363756",
"0.74278575",
"0.7420442",
"0.73996145",
"0.73996145",
"0.7381034",
"0.7344078",
"0.7343092",
"0.7323124",
"0.73190546",
"0.73174536",
"0.7292131",
"0.7268458",
"0.72644734",
"0.72469616",
"0.72323465",
"0.7213418",
"0.71859574",
"0.7174426",
"0.7165299",
"0.71477866",
"0.7146621",
"0.7124748",
"0.7118363",
"0.7103671",
"0.7100684",
"0.70977724",
"0.70752865",
"0.70662385",
"0.70602",
"0.70596087",
"0.7059422",
"0.7014716",
"0.70004445",
"0.69960606",
"0.6988551",
"0.69778925",
"0.6953509"
] | 0.81074655 | 2 |
Return the list of expressions as array of expression objects | def expressions
return @expressions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expression_bodies\n expression_bodies_arr = Array.new\n @expressions.each do |expression|\n expression_bodies_arr << expression.body\n end\n return expression_bodies_arr\n end",
"def expressions\n @expressions = operands.\n select {|op| op.is_a?(RDF::Resource) || op.is_a?(ShapeExpression) || op.is_a?(TripleExpression)}\n end",
"def expressions; end",
"def compileexpressionlist\n\n end",
"def expression_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n return_value = ExpressionListReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n char_literal104 = nil\n expression103 = nil\n expression105 = nil\n\n tree_for_char_literal104 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 146:5: expression ( ',' expression )*\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_788 )\n expression103 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression103.tree )\n # at line 146:16: ( ',' expression )*\n while true # decision 30\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == COMMA )\n alt_30 = 1\n\n end\n case alt_30\n when 1\n # at line 146:18: ',' expression\n _last = @input.look\n char_literal104 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_expression_list_792 )\n\n tree_for_char_literal104 = @adaptor.copy_node( char_literal104 )\n\n root_0 = @adaptor.become_root( tree_for_char_literal104, root_0 )\n\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_795 )\n expression105 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression105.tree )\n\n\n else\n break # out of loop for decision 30\n end\n end # loop for decision 30\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\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__, 27 )\n\n end\n \n return return_value\n end",
"def values_array\n [@name, @expression.value]\n end",
"def symbols(expr = @expr)\n expr[1..-1].map do |sym|\n case sym\n when Symbol\n sym\n when Array\n symbols(sym)\n end\n end.flatten.compact.uniq\n end",
"def expression_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n return_value = ExpressionListReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal218 = nil\n expression217 = nil\n expression219 = nil\n\n tree_for_char_literal218 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 552:5: expression ( ',' expression )*\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_3667 )\n expression217 = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression217.tree )\n end\n # at line 552:16: ( ',' expression )*\n while true # decision 49\n alt_49 = 2\n alt_49 = @dfa49.predict( @input )\n case alt_49\n when 1\n # at line 552:18: ',' expression\n char_literal218 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_expression_list_3671 )\n if @state.backtracking == 0\n\n tree_for_char_literal218 = @adaptor.create_with_payload( char_literal218 )\n root_0 = @adaptor.become_root( tree_for_char_literal218, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_3674 )\n expression219 = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression219.tree )\n end\n\n else\n break # out of loop for decision 49\n end\n end # loop for decision 49\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end\n \n return return_value\n end",
"def list\n line = peek.line\n col = peek.column\n\n return unless match(:'[')\n\n items = []\n\n while (item = expr)\n items << item\n end\n\n expect(:']')\n\n Apparat::Byte::List.new(items, line, col)\n end",
"def parse\n s_expr_list\n end",
"def split_equatation_into_expressions equatation\n expressions = []\n\n expression = []\n\n equatation.each do |value|\n if value == '='\n expressions.push expression\n\n expression = []\n else\n expression.push value\n end\n end\n\n expressions.push expression\n\n expressions\nend",
"def raw_expression_children\n\n @raw_representation[2].select { |c| c.is_a?(Array) }\n end",
"def expr_members\n []\n end",
"def evaluate(expressions)\n result_values = []\n\n expressions.each do |expression|\n stack = expression.evaluate(self)\n act = stack.length\n exp = expression.empty? ? 0 : 1\n\n raise(BASICExpressionError, 'Bad expression') if act != exp\n\n # verify each item is of correct type\n result_values.concat stack\n end\n\n result_values\n end",
"def evaluate(expressions)\n result_values = []\n\n expressions.each do |expression|\n stack = expression.evaluate(self)\n act = stack.length\n exp = expression.empty? ? 0 : 1\n\n raise(BASICExpressionError, 'Bad expression') if act != exp\n\n # verify each item is of correct type\n result_values.concat stack\n end\n\n result_values\n end",
"def compile_expression_list\n write_tag '<expressionList>'\n compile_expression unless check?(')') # Emptylist\n compile_expression while match(',')\n write_tag '</expressionList>'\n end",
"def to_a\n _evaluated_nodes\n end",
"def to_a\n self.class.operands.inject([]) do |result, (param_name, param_options)|\n result << instance_variable_get(\"@#{param_name}\")\n result\n end\n end",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def compile_expression_list\n push_non_terminal(\"expressionList\")\n\n unless match?(JackLexer::R_ROUND_BRACKET)\n compile_expression\n while match?(JackLexer::COMMA)\n symbol(JackLexer::COMMA)\n compile_expression\n end\n end\n\n push_non_terminal(\"/expressionList\")\n end",
"def array (sexp, level)\n return '[]' if sexp.empty?\n\n code, work = \"\", []\n\n until sexp.empty?\n splat = sexp.first.first == :splat\n part = process sexp.shift, :expression\n\n if splat\n if work.empty?\n code += (code.empty? ? part : \".concat(#{part})\")\n else\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n code += \".concat(#{part})\"\n end\n work = []\n else\n work << part\n end\n end\n\n unless work.empty?\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n end\n\n code\n end",
"def query(expr=\"\", query_options={})\n result = []\n self.domain.query(query_options.merge({:expr => expr})).each do |i|\n result << self.new(i.key, i.attributes, false)\n end\n return result\n end",
"def parameter_list\n recursive_expression(:expression, :comma)\n end",
"def results\n each_node.map do |node|\n [node.expression, node_runs(node)]\n end.to_h\n end",
"def root_expressions\n\n roots = @expressions.select { |e| e.h.parent_id == nil }\n\n roots = roots.each_with_object({}) { |e, h|\n h[\"#{e.h.fei['expid']}__#{e.h.fei['subid']}\"] = e\n }\n\n roots.keys.sort.collect { |k| roots[k] }\n end",
"def api_expressions\n return @api_expressions\n end",
"def statements sexp, result=[]\n if null?(sexp)\n return result\n end\n self.eval(car(sexp)) + statements(cdr(sexp), result)\n end",
"def parse_expression\n expr = []\n loop do\n raise ExpressionError, 'Expression definition incomplete.. more terms expected' unless current_token\n\n name = expect_token %i[name string]\n expr.append name\n\n debug \"Expression identifier found as #{name} - appending to expr stack\"\n\n if current_token.nil?\n raise ExpressionError, \"Expected terminator (;) or operator (+) following #{name} in expression.\"\n elsif !(current_token.type == :operator || current_token.type == :terminator)\n raise ExpressionError, \"Unexpected #{current_token} inside expression; expected terminator (;) or operator (+)\"\n elsif current_token.type == :terminator\n break\n end\n\n step_forward\n end\n\n expr\n rescue ExpressionError => e\n raise_parser_error \"Failed to parse expression: #{e.message}\" unless @state_arg\n raise_parser_error \"Expression error for #{@state_arg} command: #{e.message}\"\n end",
"def _to_a(sexp, result=[])\n if null?(sexp)\n return result\n end\n ident = self.eval(car(sexp))\n sym = ident.last.to_s.to_sym\n [sym] + _to_a(cdr(sexp), result)\n end",
"def add_expressions(*expressions); end",
"def expressions_over(op1, op2)\n expressions_over_lists( asArray(op1), asArray(op2))\nend",
"def split_expression(expression)\n result = []\n parens = 0\n buffer = \"\"\n\n expression.chars do |char|\n case char\n when ','\n if parens == 0\n result.push(buffer)\n buffer = \"\"\n next\n end\n when '('\n parens += 1\n when ')'\n parens -= 1\n end\n\n buffer << char\n end\n\n result << buffer unless buffer.empty?\n result\n end",
"def expression_parts\n find_related_frbr_objects( :contains, :which_expressions?) \n end",
"def process_masgn(exp)\n lhs = exp.shift\n rhs = exp.pop\n splat = exp.shift \n\n raise unless lhs.first == :array\n raise unless rhs.first == :array or rhs.first == :to_ary\n\n want_expression do\n with_temporary_variable do |tmp|\n assgn = [] \n without_result do\n assgn << \"#{tmp}=#{process(rhs)}\"\n\n # lhs[0] == :array -> skip it\n lhs[1..-1].each_with_index do |assignment, i| # for example where assignment == [:lasgn, :a]\n assignment << s(:special_inline_js_value, \"#{tmp}[#{i}]==null?#{@model.encode_nil}:#{tmp}[#{i}]\")\n assgn << process(assignment)\n end\n\n if splat\n # splat is for example [:lasgn, :a]\n splat << s(:special_inline_js_value, \"#{tmp}.slice(#{lhs.size-1})\")\n assgn << process(splat)\n end\n end\n\n # return value of the expression is the array\n assgn << resultify(\"#{tmp}\")\n\n \"(\" + assgn.join(\",\") + \")\" \n end\n end\n end",
"def evaluate(options)\n expanded = @production.evaluate(options).flatten.reject { |o| o.is_a?(Symbol) }.join\n chain = []\n\n expression = @modifiers.reduce(expanded) do |value, modifier|\n case modifier.type\n when :filter\n @registry.expand_filter(modifier.name, value)\n when :map\n @registry.expand_map(modifier.name, value, modifier.map_dir)\n end\n end\n\n [:expression, expression]\n end",
"def to_ast(*)\n [:predicate, [name, compiler.predicates.arg_list(name, *args)]]\n end",
"def selectElements\n ([expression] + elements).compact if select\n end",
"def to_a\n return @ops\n end",
"def find_expressions (options={})\n\n #conditions = determine_conditions(options)\n # note : this call modifies the options hash...\n\n conditions = {}\n\n #\n # maximize usage of SQL querying\n\n exps = DataMapper.repository(@dm_repository) {\n DmExpression.all(conditions)\n }\n\n #\n # do the rest of the filtering\n\n exps.inject([]) { |a, de|\n fe = de.as_owfe_expression(application_context)\n a << fe if does_match?(options, fe)\n a\n }\n end",
"def evaluate(ex)\n @stack=[]\n @expr.each do |el|\n case el\n when HopExprVar\n # evaluate variable\n var,dot,field=el.value.partition('.')\n if field==''\n # scalar\n val=VarStor.getScalar(ex,el.value)\n else\n # cortege field\n begin\n val=VarStor.getCortege(ex,var)[field]\n rescue\n warn \">> Opppps: #{var}.#{field}\"\n nil\n end\n end\n @stack.push val\n\n when Numeric, String\n # constant\n @stack.push el\n\n when HopExprOp\n case el.value\n when '+'\n [email protected]\n [email protected]\n warn \">>PLUS: #{a1},#{a2}\"\n raise SyntaxErrHopError if a2.nil?\n @stack.push a1.to_f+a2.to_f\n when '*'\n [email protected]\n [email protected]\n raise SyntaxErrHopError if a2.nil?\n @stack.push a1.to_f*a2.to_f\n when '-'\n [email protected]\n [email protected]\n warn \">>MINUS: #{a1},#{a2}\"\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f-a1.to_f\n when '/'\n [email protected]\n [email protected]\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f/a1.to_f\n when '%'\n [email protected]\n [email protected]\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f%a1.to_f\n else\n raise SyntaxErrHopError\n end\n end #~case\n end # ~each expression\n raise SyntaxErrHopError.new(@expr.to_s+' ('[email protected]_s+')') if @stack.size>1\n\n return @stack.pop\n end",
"def conditions_array\n @conditions.to_a\n end",
"def lisp_list_to_array(ast)\n\t\t\tarray = []\n\t\t\twhile ast.kind_of? LispPair\n\t\t\t\tarray << ast.first\n\t\t\t\tast = ast.rest\n\t\t\tend\n\t\t\treturn array\n\t\tend",
"def extract_filter_tokens(expression = nil) #:nodoc:\n return [] unless expression\n\n # @tokens = ($expression =~ /\"(?:[^\"]|\"\")*\"|\\S+/g); #\"\n\n tokens = []\n str = expression\n while str =~ /\"(?:[^\"]|\"\")*\"|\\S+/\n tokens << $&\n str = $~.post_match\n end\n\n # Remove leading and trailing quotes and unescape other quotes\n tokens.map! do |token|\n token.sub!(/^\"/, '')\n token.sub!(/\"$/, '')\n token.gsub!(/\"\"/, '\"')\n\n # if token is number, convert to numeric.\n if token =~ /^([+-]?)(?=\\d|\\.\\d)\\d*(\\.\\d*)?([Ee]([+-]?\\d+))?$/\n token.to_f == token.to_i ? token.to_i : token.to_f\n else\n token\n end\n end\n\n return tokens\n end",
"def expression_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = ExpressionStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n expression_list37 = nil\n statement_end38 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 315:5: expression_list statement_end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_expression_statement_2099 )\n expression_list37 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list37.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_end_IN_expression_statement_2101 )\n statement_end38 = statement_end\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end\n \n return return_value\n end",
"def consume(sexp)\n out = []\n sexp.each do |s|\n if s.kind_of?(Array)\n #\n # Reject +nil+, so that we can optimize out whole expressions\n # just by returning +nil+ from sexp_to_node. \n #\n v = @compiler.sexp_to_node(s)\n out << v unless v.nil?\n else\n out << s\n end\n end\n return out\n end",
"def parse(expr)\n eval(\"[#{expr}]\")\n end",
"def evaluate(options)\n expansion = @expressions.reduce([]) do |exp, atom|\n exp << atom.evaluate(options)\n end\n\n #[:expansion, expansion]\n # TODO: fix this along with a git rename\n # Commented out because of a lot of tests depending on :concat symbol\n [:concat, expansion]\n end",
"def create_method_from_expressions; end",
"def index\n @expression_values = ExpressionValue.all\n end",
"def create_equation\n equation =''\n for i in 0..(@operands.size-1)\n if i==0\n equation << @operands[i].to_s\n else\n #binding.pry\n equation << @operators[@operator_value[i-1]].to_s\n equation << @operands[i].to_s\n end\n end\n equation\n end",
"def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end",
"def expression; end",
"def parse_list(opsym)\n opupdate = ->(f,e1,e2) { f.call(e1) << e2 }\n sof = ->(x) { [x] }\n method(:parse_ginfix).curry.call(opsym, opupdate, sof)\n end",
"def expressions_equals? expressions\n results = expressions.map { |expression| eval(expression.join('')) }\n\n results.uniq.size == 1\nend",
"def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n __COMPARITIONOPERATORS10__ = nil\n\n begin\n # at line 705:5: exp ( COMPARITIONOPERATORS exp )?\n @state.following.push( TOKENS_FOLLOWING_exp_IN_expression_1070 )\n exp\n @state.following.pop\n # at line 705:9: ( COMPARITIONOPERATORS exp )?\n alt_26 = 2\n look_26_0 = @input.peek( 1 )\n\n if ( look_26_0 == COMPARITIONOPERATORS )\n alt_26 = 1\n end\n case alt_26\n when 1\n # at line 705:10: COMPARITIONOPERATORS exp\n __COMPARITIONOPERATORS10__ = match( COMPARITIONOPERATORS, TOKENS_FOLLOWING_COMPARITIONOPERATORS_IN_expression_1073 )\n # --> action\n #Regla 8\n \t @stack_operators.push(__COMPARITIONOPERATORS10__.text)\n \t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_exp_IN_expression_1087 )\n exp\n @state.following.pop\n # --> action\n #Regla 9\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n \t\t free_avail_const(operand_a)\n \t\t free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t \n # <-- action\n\n end\n\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__, 23 )\n\n end\n \n return \n end",
"def arglist (sexp, level)\n code, work = '', []\n\n until sexp.empty?\n splat = sexp.first.first == :splat\n arg = process sexp.shift, :expression\n\n if splat\n if work.empty?\n if code.empty?\n code += (arg[0] == \"[\" ? arg : \"#{arg}#{mid_to_jsid :to_a}()\")\n else\n code += \".concat(#{arg})\"\n end\n else\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n code += \".concat(#{arg})\"\n end\n\n work = []\n else\n work.push arg\n end\n end\n\n unless work.empty?\n join = work.join ', '\n code += (code.empty? ? join : \".concat([#{work}])\")\n end\n\n code\n end",
"def sexp_to_ast(sexp)\n eval sexp\n end",
"def expander\n Enumerator.new do |y|\n @elements.each do |elt|\n elt.kind_of?(AndExpr) ? elt.expander.each {|e| y << e } : y << elt\n end\n end\n end",
"def evaluate\n arr = []\n laststr = nil\n # Evaluate all the Nodes, turning each one into a String, SeparateString,\n # or BodyString.\n strings = _evaluated_nodes\n\n # Now process the resulting Array. All strings are concatenated together\n # except for BodyStrings and SeparateStrings; we need to preserve and\n # isolate these so that processing them later is possible. (BodyStrings\n # are used when evaluating a Document to represent `[body]` content,\n # SeparateStrings are used when evaluating a Command's argument list to\n # represent the individual arguments.)\n strings.each do |str|\n if arr.empty? || SeparateString === str || SeparateString === laststr ||\n BodyString === str || BodyString === laststr\n # Keep BodyStrings separate.\n if BodyString === str\n arr << str\n # Keep SeparateStrings separate.\n elsif SeparateString === str\n arr << String.new(str)\n # A BodyNodeList stores a list of BodyStrings, not Strings.\n elsif BodyNodeList === self\n arr << BodyString.new(str)\n else\n arr << str\n end\n # Combine Strings that appear in the NodeList successively.\n else\n arr.last << str\n end\n laststr = str\n end\n arr\n end",
"def to_a\n [self] + matches\n end",
"def expression sexp\n return nil if sexp == nil\n #pp sexp\n body = sexp.sexp_body\n case sexp[0]\n # when :block # a collection of things to do!\n # body.map { |i| convert(i) + NL }.join\n when :iasgn # assign to instance variable\n value = expression( sexp[2] )\n name = @vars.set( sexp[1], value.type )\n \"#{name} = (#{value})\"\n when :lit, :false, :true, :array # literal values\n literal(sexp)\n when :ivar\n @vars.get(sexp.value)\n when :call # call a 'method' on something\n call(sexp[1], sexp[2], sexp[3].sexp_body)\n when :if # statements resembling ifs\n condition = expression(sexp[1])\n true_code = expression(sexp[2])\n false_code = expression(sexp[3])\n \"( ( #{condition} )?( #{true_code} ):( #{false_code} ) )\"\n when :colon2 # lookup constants\n if sexp[1][0] == :const and sexp[1][1] == :Math\n case sexp[2]\n when :PI\n Value.typed CTypeFloat, Math::PI.inspect\n end\n end\n when :not # the !something operator\n Value.typed CTypeBoolean, \"!(#{ expression(sexp.value) })\"\n else\n raise \"IDK how to handle this S-expression: #{ sexp.inspect }!\"\n end\n end",
"def values\n @values ||= begin\n matches = []\n\n text.scan(VALUE_REGEXP) do\n offset = Regexp.last_match.offset(1)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression.begin_pos + offset.last)\n end\n\n matches\n end\n end",
"def to_exp(options = {})\n return nil if to_exp? == false\n t = @statement_list[0].to_exp(options)\n return t.to_exp(options) if @statement_list.length <= 1\n i = 1\n while(i < @statement_list.length)\n t = ExpComma.new(t, @statement_list[i])\n i += 1\n end\n t\n end",
"def to_a\n out = []\n\n each { |e| out << e }\n\n out\n end",
"def tokens_rpn\n output = []\n operators = []\n\n @tokens.each do |token|\n case token.type\n when :value\n output.push(token)\n when :operator\n if operators.any? && token.lexeme.precedence >= operators.last.lexeme.precedence\n output.push(operators.pop)\n end\n\n operators.push(token)\n end\n end\n\n output.concat(operators.reverse)\n end",
"def factor_list\n a = one_or_more { factor }\n AST.new(:and, a)\n end",
"def split_expression_into_numbers expression\n numbers = []\n\n number = []\n\n expression.each do |value|\n if ['+', '/', '*', '-'].include? value\n numbers.push number\n\n number = []\n else\n number.push value\n end\n end\n\n numbers.push number\n\n numbers\nend",
"def expression(options=[])\n evaluator = Bun::Expression.new(options)\n evaluator.data = self\n evaluator\n end",
"def initialize(expressions)\n @expressions = expressions\n end",
"def parse_expression(expr); end",
"def to_a\n Array(each)\n end",
"def all\n s = []\n unless @list.empty?\n s << \"Auto-display expressions now in effect:\nNum Enb Expression\"\n @list.each do |display|\n s << display.format\n end\n end\n s\n end",
"def map_expressions!(&ruby_block)\n @expressions.map! do |expression|\n expression = ruby_block.call(expression)\n expression.parent = self unless expression.parent\n expression\n end\n end",
"def query_selector_all(expr)\n Traverser.new(expr).evaluate(Context.new(node: self))\n end",
"def make_expression_attribute_values(event)\n\t\tattr_values = make_hoh\n\n\t\tevent.each do |k,v| \n\t\t\tif k == \"start_time\"\n\t\t\t\tputs \"Found start time: methods: #{v.methods}, methods contain strftime? #{v.methods.include?(:strftime)}\"\n\t\t\tend\n\t\t\tattr_values[k][make_expression_key(k,)] = v \n\t\tend\n\t\treturn attr_values\n\tend",
"def to_conditions\n [to_s] + @values\n end",
"def expression_matrix_files\n expression_matrices.to_a\n end",
"def to_a\n results = []\n traverse { |value| results << value }\n results\n end",
"def operators\n @arr.map{|h| h[:operator]}.uniq\n end",
"def collect_variables\n @expression.collect_variables.uniq\n end",
"def expression_matrices\n study_files.any_of(\n { :file_type.in => ['Expression Matrix', 'MM Coordinate Matrix'] },\n { file_type: 'AnnData', 'ann_data_file_info.has_expression' => true }\n )\n end",
"def predicates\n @predicates.values\n end",
"def _eval(exp, env)\n if list?(exp)\n if special_form?(exp)\n eval_special_form(exp, env) # [:lam, [:x, :y], [:+, :x, :y]], {} => [:closure, [:x, :y], [:+, :x, :y], {}]\n else\n fun = _eval(car(exp), env) # [[:lam, [:x, :y], [:+, :x, :y]], 3, 2] => [:closure, [:x, :y], [:+, :x, :y], {}]\n args = eval_list(cdr(exp), env) # [[:lam, [:x, :y], [:+, :x, :y]], 3, 2] => [3, 2]\n apply(fun, args) # [:closure, [:x, :y], [:+, :x, :y], {}], [3, 2] =>\n end\n else # exp := :x or :+ or 1\n if immediate_val?(exp) # 1\n exp\n else # :x or :+\n e = lookup_primitive_fun(exp) || lookup_var(exp, env)\n # :+ => [:prim, lambda { |x,y| x + y }]\n # :x, {x: 1, y: 2} => 1\n end\n end\nend",
"def program(expressions)\n expressions.map { |expr| exec(expr) }.last\n end",
"def build_facets(expr, opts={})\n case expr\n when Hash\n build_facets(::Arel.star,expr)\n when Array\n r = expr.inject([]) {|m,e| m.concat build_facets(e,opts)}\n when String, Symbol, ::Arel::Nodes::SqlLiteral\n [Ansr::Arel::Nodes::Facet.new(::Arel::Attributes::Attribute.new(table, expr.to_s), opts)]\n when ::Arel::Attributes::Attribute\n [Ansr::Arel::Nodes::Facet.new(expr, opts)]\n else\n [expr]\n end\n end",
"def all_variables\n\n return nil if @expressions.empty?\n\n @expressions.each_with_object({}) { |exp, h|\n h[exp.fei] = exp.variables if exp.variables\n }\n end",
"def parsed_expression\n return @parsed_expression\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 args(sexp)\n if call_site?(sexp)\n (rest(sexp[3])).collect { |each| Code.from_s_expression(each) }\n else\n []\n end\n end",
"def to_a\n @patterns\n end",
"def to_a\n result = []\n fill_result = proc { |node_data| result << node_data }\n in_order_run_callable(@root, fill_result)\n result\n end",
"def evaluate(expression)\n eval(expression).inspect\nend",
"def visitSimpleExpression(smexp)\n\t\tcode = []\n\t\tif smexp.sign!=nil\n\t\t\tcode = smexp.sign\n\t\tend\n\t\t#p \"In simple Expression\"\n\t\t#p smexp\n\t\t#p smexp.termlist.size\n\t\t#p smexp.termlist[0].factlist.first\n\t\t#p smexp.addingoplist\n\t\t#p smexp.termlist[1].factlist.first\n\t\tif smexp.termlist != nil\n\t\t\tcode1 = visitTerm(smexp.termlist.first)\n\t\t\tcode << code1\n\t\t\t#p smexp.termlist[0]\n\t\t\t#p smexp.termlist[1]\n\t\t\tif smexp.termlist.size > 1\n\t\t\t\tfor i in 1..(smexp.termlist.size-1)\n\t\t\t\t\tcode << smexp.addingoplist[i-1].value\n\t\t\t\t\tcode << visitTerm(smexp.termlist[i])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#p \"simple expression code\"\t\t\n\t\t#p code\n\t\treturn code\n end",
"def fetch (exp)\n\n fei = extract_fei(exp)\n\n [ get_expression_storage[fei], fei ]\n end",
"def additive_expression\n substraction_expressions = recursive_expression(:substraction_expression, :plus)\n if substraction_expressions.class == Array.class\n {plus: substraction_expressions}\n else\n substraction_expressions\n end\n end",
"def terminals(ast, expr = @expr)\n ([:alt, :diff].include?(expr.first) ? expr[1..-1] : expr[1,1]).map do |sym|\n case sym\n when Symbol\n r = ast.detect {|r| r.sym == sym}\n r if r && r.terminal?\n when String\n sym\n when Array\n terminals(ast, sym)\n end\n end.flatten.compact.uniq\n end",
"def args_to_params(sexp)\n result = []\n sexp.each do |arg|\n if arg[0] == :lasgn\n ref = variable(arg[1])\n scope.add_arg ref\n result << ref\n elsif arg[0] == :array\n result << scope.next_temp\n else\n raise \"Bad js_block_arg: #{arg[0]}\"\n end\n end\n\n result\n end",
"def expr_list_tail\n if @enum.peek.value == ','\n @instruction.push(@enum.peek.value)\n comma\n expression\n expr_list_tail\n end\n end",
"def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end",
"def get_operators(type)\n for_type(type).collect(&:operator)\n end"
] | [
"0.7358127",
"0.7051174",
"0.6998701",
"0.6899185",
"0.6677532",
"0.6608422",
"0.656691",
"0.6476871",
"0.64444166",
"0.64106655",
"0.64010644",
"0.6257234",
"0.62564933",
"0.6255756",
"0.6255756",
"0.6206655",
"0.61680716",
"0.6130374",
"0.60817456",
"0.6081187",
"0.6003012",
"0.5942009",
"0.58314",
"0.5830529",
"0.58095694",
"0.5757058",
"0.5734634",
"0.57178885",
"0.57031745",
"0.5700867",
"0.56871307",
"0.56448776",
"0.5590241",
"0.5575711",
"0.55634093",
"0.5507406",
"0.546112",
"0.54562235",
"0.5445546",
"0.54387057",
"0.5420601",
"0.53965634",
"0.5390636",
"0.53866774",
"0.5382411",
"0.53758293",
"0.53727585",
"0.5356677",
"0.5355983",
"0.53508747",
"0.5349145",
"0.534348",
"0.5332945",
"0.5330909",
"0.53269905",
"0.53226274",
"0.5320883",
"0.53138083",
"0.53060055",
"0.5279317",
"0.5264222",
"0.52572405",
"0.5234514",
"0.5229442",
"0.52255064",
"0.5218561",
"0.5216384",
"0.5195402",
"0.51854205",
"0.5181378",
"0.5163775",
"0.5163316",
"0.5160817",
"0.5152051",
"0.5128145",
"0.5127291",
"0.51256603",
"0.5114218",
"0.5110784",
"0.51099616",
"0.5104458",
"0.51035273",
"0.5100109",
"0.5090596",
"0.5088939",
"0.5080152",
"0.5075117",
"0.506954",
"0.506828",
"0.50594175",
"0.50436664",
"0.503434",
"0.50311494",
"0.50302064",
"0.5028303",
"0.50118154",
"0.50096565",
"0.49990308",
"0.4998282",
"0.49956328"
] | 0.78951705 | 0 |
Return the expression bodies as an array of strings. | def expression_bodies
expression_bodies_arr = Array.new
@expressions.each do |expression|
expression_bodies_arr << expression.body
end
return expression_bodies_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expressions\n return @expressions\n end",
"def raw_expression_children\n\n @raw_representation[2].select { |c| c.is_a?(Array) }\n end",
"def expressions; end",
"def evaluate\n arr = []\n laststr = nil\n # Evaluate all the Nodes, turning each one into a String, SeparateString,\n # or BodyString.\n strings = _evaluated_nodes\n\n # Now process the resulting Array. All strings are concatenated together\n # except for BodyStrings and SeparateStrings; we need to preserve and\n # isolate these so that processing them later is possible. (BodyStrings\n # are used when evaluating a Document to represent `[body]` content,\n # SeparateStrings are used when evaluating a Command's argument list to\n # represent the individual arguments.)\n strings.each do |str|\n if arr.empty? || SeparateString === str || SeparateString === laststr ||\n BodyString === str || BodyString === laststr\n # Keep BodyStrings separate.\n if BodyString === str\n arr << str\n # Keep SeparateStrings separate.\n elsif SeparateString === str\n arr << String.new(str)\n # A BodyNodeList stores a list of BodyStrings, not Strings.\n elsif BodyNodeList === self\n arr << BodyString.new(str)\n else\n arr << str\n end\n # Combine Strings that appear in the NodeList successively.\n else\n arr.last << str\n end\n laststr = str\n end\n arr\n end",
"def array (sexp, level)\n return '[]' if sexp.empty?\n\n code, work = \"\", []\n\n until sexp.empty?\n splat = sexp.first.first == :splat\n part = process sexp.shift, :expression\n\n if splat\n if work.empty?\n code += (code.empty? ? part : \".concat(#{part})\")\n else\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n code += \".concat(#{part})\"\n end\n work = []\n else\n work << part\n end\n end\n\n unless work.empty?\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n end\n\n code\n end",
"def transform_body(body)\n return [] if body.blank?\n lines = body.respond_to?(:lines) ? body.lines : body.split(\"\\n\")\n lines.map(&:strip)\n end",
"def compileexpressionlist\n\n end",
"def text\n map(&:text).join\n end",
"def body\n buffer = ''\n\n each { |chunk| buffer << chunk }\n return buffer\n end",
"def to_output(expr)\n\t\tif expr.kind_of? Array\n\t\t\texpr.map { |x| to_output(x) + \" \"}.join[0..-2]\n\t\telse\n\t\t\texpr.to_s\n\t\tend\n\tend",
"def values_array\n [@name, @expression.value]\n end",
"def lines; [to_s]; end",
"def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end",
"def expr_members\n []\n end",
"def to_string(expression)\n\t\t\tif expression.is_a? Array\n\t\t\t\texpression.map { |exp| to_string(exp) }\n\t\t\t\treturn \"(\" + expression.join(\" \") + \")\"\n\t\t\telse\n\t\t\t\treturn expression.to_s\n\t\t\tend\n\t\tend",
"def results\n each_node.map do |node|\n [node.expression, node_runs(node)]\n end.to_h\n end",
"def content_as_array\n begin\n # '[\"a\",\"b\", \"c\"]' -> '\"a\",\"b\",\"c\"'\n no_brackets = content[1...-1]\n\n # '\"a\",\"b\",\"c\"' -> ['\"a\"', '\"b\"', '\"c\"']\n quoted_elements = no_brackets.split(\", \")\n\n # ['\"a\"', '\"b\"', '\"c\"'] -> ['a', 'b', 'c']\n quoted_elements.map { |quoted_elt| quoted_elt[1...-1] }\n rescue\n []\n end\n end",
"def getAllTexts intervalRange\n texts = [[]]\n curr_alts = []\n # Go through the interval token by token. It is indexed by token, \n # not by character\n intervalRange.each do |j|\n tok = @tokens.get(j)\n\n # If the text is parsed code or whitespace\n if (tok.channel == 0 || tok.channel == 1)\n texts.each do |text|\n text << tok.getText\n end\n\n # Get directives\n elsif (tok.channel == 2)\n d = strip_directive(tok)\n # TODO make sure combinations of alts are handled\n case d.command\n when\"ALT\"\n # Trigger creation of alternative magnet\n curr_alts << []\n texts.each do |text|\n curr_alt = Array.new(text)\n curr_alt << d.arg\n curr_alts.last << curr_alt\n end\n when \"ENDALT\"\n texts << curr_alts.pop\n end\n end\n end\n\n ret = texts.map {|t| t.join}\n # puts \"Ret\"\n # pp ret\n return ret\n end",
"def getBody\n body = \"\"\n @body.each { |part| body << part }\n body\n ensure\n @body.close if @body.respond_to?(:close)\n end",
"def compile_expression_list\n write_tag '<expressionList>'\n compile_expression unless check?(')') # Emptylist\n compile_expression while match(',')\n write_tag '</expressionList>'\n end",
"def get_dsl \n dsl = @statements.join(\", \")\n dsl\n end",
"def all\n s = []\n unless @list.empty?\n s << \"Auto-display expressions now in effect:\nNum Enb Expression\"\n @list.each do |display|\n s << display.format\n end\n end\n s\n end",
"def transforming_body_expr; end",
"def lines\n escaped = value.to_s.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? value.to_s.split(/\\n/, -1) : [value.to_s]\n end",
"def to_s\n @expression.to_s\n end",
"def expressions\n @expressions = operands.\n select {|op| op.is_a?(RDF::Resource) || op.is_a?(ShapeExpression) || op.is_a?(TripleExpression)}\n end",
"def body_to_string(body)\n p body\n s = ''\n body.each { |line| s << line.to_s << \"\\r\\n\" }\n body.close if body.respond_to?(:close)\n s.chomp\n end",
"def lines\n return [] unless @value && text\n\n text.split(/\\r\\n|\\r|\\n/)\n end",
"def statements sexp, result=[]\n if null?(sexp)\n return result\n end\n self.eval(car(sexp)) + statements(cdr(sexp), result)\n end",
"def all\n @contents.flatten.join\n end",
"def inner_text\n map { |x| x.inner_text }.join\n end",
"def to_s\n\n s = \"\\n\\n==== #{self.class} ====\"\n\n find_expressions.each do |fexp|\n\n s << \"\\n\"\n if fexp.kind_of?(RawExpression)\n s << \"*raw\"\n else\n s << \" \"\n end\n s << fexp.fei.to_s\n end\n s << \"\\n==== . ====\\n\"\n\n s\n end",
"def parse\n s_expr_list\n end",
"def extract_body(array, tag)\n index = 0\n height = array.length\n r_array = Array.new\n opening_tag = \"<#{tag}>\"\n closing_tag = \"</#{tag}>\"\n return_array = Array.new\n while index < height\n current_line = array[index].strip\n if assert_tag(tag, current_line)\n index = index + 1\n while(array[index].strip != closing_tag)\n r_array.push(array[index].strip)\n index = index + 1\n end\n index = height\n end\n end\n r_array\n end",
"def list\n line = peek.line\n col = peek.column\n\n return unless match(:'[')\n\n items = []\n\n while (item = expr)\n items << item\n end\n\n expect(:']')\n\n Apparat::Byte::List.new(items, line, col)\n end",
"def to_s\n statements.collect { |s| s.to_s }.join(\";\\n\")\n end",
"def to_a\n _evaluated_nodes\n end",
"def consume(sexp)\n out = []\n sexp.each do |s|\n if s.kind_of?(Array)\n #\n # Reject +nil+, so that we can optimize out whole expressions\n # just by returning +nil+ from sexp_to_node. \n #\n v = @compiler.sexp_to_node(s)\n out << v unless v.nil?\n else\n out << s\n end\n end\n return out\n end",
"def array_paragraphs fragments\n [fragments]\n end",
"def text_blocks\n pdf.each_object\n .select {|o| o.instance_of? Origami::ContentStream}\n .flat_map(&:instructions)\n .select {|i| i.operator == \"Tj\"}\n .map(&:operands)\n .map { |operands| operands.join(\" \") }\n end",
"def get_bre_expression_as_string(opts = {})\n data, _status_code, _headers = get_bre_expression_as_string_with_http_info(opts)\n return data\n end",
"def process_array(exp)\n return \"rb_ary_new()\" if exp.empty? # HACK FIX! not ansi c!\n\n code = []\n until exp.empty? do\n code << process(exp.shift) \n end\n\n s = code.join ', '\n\n return s\n end",
"def lines\n escaped = content.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? content.split(/\\n/, -1) : [content]\n end",
"def body\n lines = ''\n in_head = true\n File.open(@file).each_line do |line|\n in_head = false if in_head and line.chomp.empty?\n lines << line unless in_head\n end\n return lines\n end",
"def process_block(exp)\n code = []\n until exp.empty? do\n code << process(exp.shift)\n end\n\n body = code.join(\";\\n\")\n body += \";\" unless body =~ /[;}]\\Z/\n body += \"\\n\"\n\n return body\n end",
"def expr_to_s\n buf = ''\n each_term do |term|\n if term[:operator]\n buf << term[:operator]\n end\n buf << term[:token]\n end\n buf\n end",
"def symbols(expr = @expr)\n expr[1..-1].map do |sym|\n case sym\n when Symbol\n sym\n when Array\n symbols(sym)\n end\n end.flatten.compact.uniq\n end",
"def evaluate(expressions)\n result_values = []\n\n expressions.each do |expression|\n stack = expression.evaluate(self)\n act = stack.length\n exp = expression.empty? ? 0 : 1\n\n raise(BASICExpressionError, 'Bad expression') if act != exp\n\n # verify each item is of correct type\n result_values.concat stack\n end\n\n result_values\n end",
"def evaluate(expressions)\n result_values = []\n\n expressions.each do |expression|\n stack = expression.evaluate(self)\n act = stack.length\n exp = expression.empty? ? 0 : 1\n\n raise(BASICExpressionError, 'Bad expression') if act != exp\n\n # verify each item is of correct type\n result_values.concat stack\n end\n\n result_values\n end",
"def source_body\n raise \"Cannot extract proc body on non-zero arity\" unless arity.eql?(0)\n tokens = Ripper.lex source\n body_start_idx = 2\n body_end_idx = -1\n if tokens[0][1].eql?(:on_tlambda)\n body_start_idx = tokens.index(tokens.detect { |t| t[1].eql?(:on_tlambeg) }) + 1\n end\n body_tokens = tokens[body_start_idx..-1]\n\n body_tokens.pop # ending token of proc\n # remove trailing whitespace\n whitespace = [:on_sp, :on_nl, :on_ignored_nl]\n body_tokens.pop while whitespace.include?(body_tokens[-1][1])\n # remove leading whitespace\n body_tokens.shift while whitespace.include?(body_tokens[0][1])\n\n # put them back together\n body_tokens.map {|token| token[2] }.join\n end",
"def expression_matrix_files\n expression_matrices.to_a\n end",
"def to_s(exp)\n if exp.is_a?(Array)\n \"( #{exp.map{ |t| to_s(t) }.join(' ')} )\"\n else\n exp.to_s\n end\n end",
"def evaluate(expression)\n eval(expression).inspect\nend",
"def expression()\n node = seq()\n match(Token::EOF)\n\n context = Context.new()\n fragment = node.assemble(context)\n\n return fragment.build()\n end",
"def inspect\n \"[#{map { |r| r.inspect }.join(', ')}]\"\n end",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def compile\n return [] if empty?\n\n # Build \"bracketed\" statements.\n bsta = @statements.map do |s|\n auto_brackets, scalar_s = s.is_a?(Array) ? [true, s[0]] : [false, s]\n\n # Logic:\n # brackets | auto | result\n # ----------|-------|-------\n # true | * | true\n # false | * | false\n # :auto | true | true\n # :auto | false | false\n\n brackets = if @statements.size < 2\n # If there are no neighboring statements, there WILL BE NO brackets in any case.\n false\n elsif @brackets == true or @brackets == false\n @brackets\n elsif @brackets == :auto\n auto_brackets\n else\n raise \"Unknown @brackets value #{@brackets.inspect}, SE\"\n end\n\n if brackets\n [\"(\", scalar_s, \")\"].join\n else\n scalar_s\n end\n end\n\n [bsta.join(glue)] + @args\n end",
"def syntax(tokens)\n tokens = expect(:\".syntax\", tokens)\n if id?(tokens[0])\n name = tokens[0]\n tokens.shift\n else\n fail \"syntax NAME\"\n end\n r = [:\".syntax\", name]\n\n while tokens[0] != :\".end\"\n eq, tokens = equation(tokens)\n #pp eq\n if eq\n r << eq\n else\n break\n end\n end\n\n tokens = expect(:\".end\", tokens)\n return r\n end",
"def content values\n values.map { |value| value.content }.join\nend",
"def parsed_expression\n return @parsed_expression\n end",
"def expression_parts\n find_related_frbr_objects( :contains, :which_expressions?) \n end",
"def split_expression(expression)\n result = []\n parens = 0\n buffer = \"\"\n\n expression.chars do |char|\n case char\n when ','\n if parens == 0\n result.push(buffer)\n buffer = \"\"\n next\n end\n when '('\n parens += 1\n when ')'\n parens -= 1\n end\n\n buffer << char\n end\n\n result << buffer unless buffer.empty?\n result\n end",
"def codegen\n return [\n codegen_select(),\n codegen_select_all(),\n codegen_merge()\n ].join(\"\\n\")\n end",
"def get_conditions\n\n conditions = []\n\n unless self.conditions.nil? or self.conditions.empty?\n conditions = self.conditions.split(\"\\n\").collect {|entry| entry.split('-') }\n end\n return conditions\n end",
"def terms\n values.map(&:to_s)\n end",
"def plain_source\n lines.join\n end",
"def lines\n content.lines.map(&:chomp)\n end",
"def all_expression_matrix_cells\n all_cells = []\n expression_matrix_files.each do |file|\n all_cells += expression_matrix_cells(file)\n end\n all_cells.uniq # account for raw counts & processed matrix files repeating cell names\n end",
"def body\n @texts.map { |t| \"q=#{CGI::escape(t)}\" }.join '&'\n end",
"def values\n @values ||= begin\n matches = []\n\n text.scan(VALUE_REGEXP) do\n offset = Regexp.last_match.offset(1)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression.begin_pos + offset.last)\n end\n\n matches\n end\n end",
"def plain_source\n lines.join\n end",
"def process_scope(exp)\n declarations, body = with_scope do\n process exp.shift unless exp.empty?\n end\n\n declarations = declarations.reject { |d| d =~ / static_/ }\n\n result = []\n result << \"{\"\n result << declarations.join(\"\\n\") unless declarations.empty?\n result << body.chomp if body\n result << \"}\"\n \n return result.join(\"\\n\")\n end",
"def to_s\n body\n end",
"def on_array(*body)\n @last_sexp =\n super(*body).tap do |sexp|\n next unless SPECIAL_LITERALS.include?(body.dig(0, :type))\n\n comments = sexp.dig(:body, 0).delete(:comments)\n sexp.merge!(comments: comments) if comments\n end\n end",
"def parse\n statements = []\n while !at_end?\n statements << declaration\n end\n\n return statements\n rescue Ringo::Errors::ParseError\n return nil\n end",
"def to_s\n Array(render).map(&:to_s).join(\"\\n\")\n end",
"def body\n ret = read_attribute(:body)\n if ret.nil?\n return ret\n end\n ret = ret.strip\n ret = ret.gsub(/(?:\\n\\s*){2,}/, \"\\n\\n\") # remove excess linebreaks that unnecessarily space it out\n ret\n end",
"def body_chars\n q = RDF::Query.new\n q << [nil, RDF::Vocab::OA.hasBody, :body]\n q << [:body, RDF.type, RDF::Vocab::CNT.ContentAsText]\n q << [:body, RDF::Vocab::CNT.chars, :body_chars]\n @graph.query(q).each.collect {|stmt| stmt.body_chars.value}\n end",
"def localCelestialBodies\n\t\tret = []\n\t\[email protected]('sgt-system:' + @id + ':bodies').each do |coords, bid|\n\t\t\tret.push(getCelestialBody(@db, bid))\n\t\tend\n\t\tret\n\tend",
"def print_expression(expression)\n string = ''\n if expression.is_a? Yarpler::Models::Forall\n range = expression.range.to_s\n range=range.tr(\",[]\", '')\n string << \"[#{expression} #{expression.variable} for #{range}]->\" + print_expression(expression.expression)\n elsif expression.is_a? Yarpler::Models::Cardinality\n string << \"[#{expression}]\\n\"\n string << \"[#{expression}]->\" + print_expression(expression.element)\n elsif expression.is_a? Yarpler::Models::Field\n string << \"[#{expression} #{expression.variable}.#{expression.attribute}]\\n\"\n elsif expression.is_a? Yarpler::Models::Literal\n string << \"[#{expression} #{expression.value}]\\n\"\n elsif expression.is_a? Yarpler::Models::Instance\n string << \"[#{expression} #{expression.variable}]\\n\"\n elsif expression.is_a? Yarpler::Models::CountFunction\n string << \"[#{expression}} for #{expression.range.variable}.#{expression.range.attribute} ]\\n\"\n string << \"[#{expression}} for #{expression.range.variable}.#{expression.range.attribute} ]--\" + print_expression(expression.where)\n elsif expression.is_a? Yarpler::Models::SumValueFunction\n string << \"[#{expression}} #{expression.attribute} of #{expression.set.variable}.#{expression.set.attribute} ]\\n\"\n elsif expression.is_a? Yarpler::Models::Expression\n string << \"[#{expression} #{expression.operator}]\\n\"\n string << \"[#{expression} #{expression.operator}]->\" + print_expression(expression.left)\n string << \"[#{expression} #{expression.operator}]->\" + print_expression(expression.right)\n else\n puts expression.class.to_s + ' missing.'\n end\n string\n end",
"def stringify_comment_array(comments); end",
"def parse_expression_line(found_tags)\n @tags = []\n found_tags.each do |tag_line|\n begin\n parsed_line = Parser.new.parse(tag_line)\n @tags << ParserTransform.new.apply(parsed_line)\n rescue Parslet::ParseFailed => error\n message = ['[RbTags] Error: ', 'line: ', \"#{tag_line} \", 'error: ', error.cause.ascii_tree.to_s]\n message.each { |m| $stdout.puts m.to_s }\n @tags << message.join(\"\\n\")\n end\n end\n\n @tags\n end",
"def evaluate(options)\n expanded = @production.evaluate(options).flatten.reject { |o| o.is_a?(Symbol) }.join\n chain = []\n\n expression = @modifiers.reduce(expanded) do |value, modifier|\n case modifier.type\n when :filter\n @registry.expand_filter(modifier.name, value)\n when :map\n @registry.expand_map(modifier.name, value, modifier.map_dir)\n end\n end\n\n [:expression, expression]\n end",
"def body\n if content_type_is_form && request.body.is_a?(Hash)\n URI.encode_www_form convert_hash_body_to_array_of_arrays\n else\n Pact::Reification.from_term(request.body)\n end\n end",
"def recipients_from_body\n @recipients_from_body ||= begin\n emails_from_body = body.scan(EMAIL_REGEX)\n address_list_for(emails_from_body, true)\n rescue Mail::Field::ParseError\n []\n end\n end",
"def api_expressions\n return @api_expressions\n end",
"def expression_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = ExpressionStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n expression_list37 = nil\n statement_end38 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 315:5: expression_list statement_end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_expression_statement_2099 )\n expression_list37 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list37.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_end_IN_expression_statement_2101 )\n statement_end38 = statement_end\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end\n \n return return_value\n end",
"def expression_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n return_value = ExpressionListReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n char_literal104 = nil\n expression103 = nil\n expression105 = nil\n\n tree_for_char_literal104 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 146:5: expression ( ',' expression )*\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_788 )\n expression103 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression103.tree )\n # at line 146:16: ( ',' expression )*\n while true # decision 30\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == COMMA )\n alt_30 = 1\n\n end\n case alt_30\n when 1\n # at line 146:18: ',' expression\n _last = @input.look\n char_literal104 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_expression_list_792 )\n\n tree_for_char_literal104 = @adaptor.copy_node( char_literal104 )\n\n root_0 = @adaptor.become_root( tree_for_char_literal104, root_0 )\n\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_795 )\n expression105 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression105.tree )\n\n\n else\n break # out of loop for decision 30\n end\n end # loop for decision 30\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\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__, 27 )\n\n end\n \n return return_value\n end",
"def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end",
"def build_body(ctrl, request_ctx)\n arr = []\n Launcher.new(ctrl, request_ctx).each &proc {|out| arr << out.to_s }\n end",
"def to_s\n @lines.map { |line| line.to_s }.join(\"\\n\") \n end",
"def parse_expression\n expr = []\n loop do\n raise ExpressionError, 'Expression definition incomplete.. more terms expected' unless current_token\n\n name = expect_token %i[name string]\n expr.append name\n\n debug \"Expression identifier found as #{name} - appending to expr stack\"\n\n if current_token.nil?\n raise ExpressionError, \"Expected terminator (;) or operator (+) following #{name} in expression.\"\n elsif !(current_token.type == :operator || current_token.type == :terminator)\n raise ExpressionError, \"Unexpected #{current_token} inside expression; expected terminator (;) or operator (+)\"\n elsif current_token.type == :terminator\n break\n end\n\n step_forward\n end\n\n expr\n rescue ExpressionError => e\n raise_parser_error \"Failed to parse expression: #{e.message}\" unless @state_arg\n raise_parser_error \"Expression error for #{@state_arg} command: #{e.message}\"\n end",
"def to_s\n lines.join(\"\\n\")\n end",
"def plain_text_body\n return @plain_text_body unless @plain_text_body.nil?\n\n parts = if (text_parts = email.all_parts.select {|p| p.mime_type == 'text/plain'}).present?\n text_parts\n elsif (html_parts = email.all_parts.select {|p| p.mime_type == 'text/html'}).present?\n html_parts\n else\n [email]\n end\n\n parts.reject! do |part|\n part.attachment?\n end\n\n @plain_text_body = parts.map do |p|\n body_charset = Mail::RubyVer.respond_to?(:pick_encoding) ?\n Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset\n\n body = Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset)\n # convert html parts to text\n p.mime_type == 'text/html' ? self.class.html_body_to_text(body) : self.class.plain_text_body_to_text(body)\n end.join(\"\\r\\n\")\n\n @plain_text_body\n end",
"def show_body\n brows = []\n current_context[0][:body].map do |hash|\n hash.each do |_key , _val|\n _val = _val.scan(/.{100}/).join(\"\\n\") if _val.size > 150 # This line To fix table layout\n\n brows << [\"#{_key}\".green, \"#{_val}\".white]\n brows << :separator\n end\n end\n\n return brows\n end",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def text\n lines.join(\"\\n\")\n end",
"def parse_end_body( data )\n return [data]\n end",
"def lines\n if string.respond_to?(:lines)\n string.lines.to_a\n else\n string.to_a\n end\n end"
] | [
"0.6973946",
"0.633136",
"0.61444956",
"0.6134569",
"0.58708936",
"0.5770213",
"0.5657598",
"0.5523451",
"0.55130506",
"0.54943144",
"0.5490918",
"0.54681057",
"0.546782",
"0.54629123",
"0.54245627",
"0.5313971",
"0.52920985",
"0.52837706",
"0.52603006",
"0.52591854",
"0.5251906",
"0.5248832",
"0.5234888",
"0.5231334",
"0.5221812",
"0.52206165",
"0.5208957",
"0.520532",
"0.5201439",
"0.5194742",
"0.51785916",
"0.51781607",
"0.51669145",
"0.5158987",
"0.51578045",
"0.51424044",
"0.51298296",
"0.51227844",
"0.51000595",
"0.50796235",
"0.50765175",
"0.50726527",
"0.50564396",
"0.50535697",
"0.5048829",
"0.50309324",
"0.5025766",
"0.50197715",
"0.50197715",
"0.5018568",
"0.50185037",
"0.5012627",
"0.50064975",
"0.49710703",
"0.4965716",
"0.49573553",
"0.4951848",
"0.49511036",
"0.49326906",
"0.4929949",
"0.4927365",
"0.49246013",
"0.49202564",
"0.49154076",
"0.49104524",
"0.49103996",
"0.49091086",
"0.49082595",
"0.48984966",
"0.48976418",
"0.48725063",
"0.48461998",
"0.4834527",
"0.48228773",
"0.48180145",
"0.4816188",
"0.48123294",
"0.48112908",
"0.47968554",
"0.4793064",
"0.4784584",
"0.47809988",
"0.47778198",
"0.47758344",
"0.47750908",
"0.47743797",
"0.47735342",
"0.4771485",
"0.47605813",
"0.47601047",
"0.47593048",
"0.47591966",
"0.47539964",
"0.47520772",
"0.47355753",
"0.47333738",
"0.47333738",
"0.4730704",
"0.47295547",
"0.47257072"
] | 0.8749801 | 0 |
Return entities used with there id as an array of strings. | def entities_used
entities_arr = Array.new
@entities.each do |entity|
entities_arr << entity.id unless entities_arr.include?(entity.id)
end
return entities_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entities viewerid=nil\n tagging_query(viewerid).to_a.map(&:entity)\n end",
"def entities\n _entities\n end",
"def entities\n _entities\n end",
"def entities\n @entities\n end",
"def find_entities\n []\n end",
"def entities\n @entities ||= []\n end",
"def ids\n pluck(:id)\n end",
"def ids(things)\n things.map(&:id).join(\",\")\n end",
"def entities_list\n raise 'Not implemented'\n end",
"def entities\n ordering.map(&:entity).compact\n end",
"def identifiers(filter = Set.new)\n list(filter).entities.map { |ent| ent['occi.core.id'] }\n end",
"def datastore_ids\n array = Array.new\n\n self.each(\"DATASTORES/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def alias_ids\n investments.map(&:entity_id)\n end",
"def return_ids(id)\n array = Array.new\n array.push(id)\n subprojects = subProjects(id)\n subprojects.each do |project|\n array.push(return_ids(project.id))\n end\n\n return array.inspect.gsub(\"[\",\"\").gsub(\"]\",\"\").gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\")\n end",
"def entities; end",
"def entities_for_contact(id)\n fail(\"ID #{id} not in entity map\") unless @entity_map.key? id.to_sym\n return DeepClone.clone @entity_map[id.to_sym]\n end",
"def ids(id)\n # Android auto resolves strings.xml ids\n find_elements :id, id\n end",
"def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end",
"def to_a\n fetch(ids)\n end",
"def to_a\n fetch(ids)\n end",
"def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end",
"def ids\n @ids ||= []\n end",
"def entity_objects\n ProjectMedia.where(id: self.entities).to_a\n end",
"def article_ids\n query('SELECT Id FROM KnowledgeArticle').map(&:Id)\n end",
"def get_entities(type)\n @entities[type.name]\n end",
"def from_ids_to_full_names\n full_names = []\n\n unless settings['employees'].nil?\n settings['employees'].each do |employee_id|\n full_names.push(Employee.find(employee_id).full_name)\n end\n end\n\n full_names\n end",
"def asset_ids(id)\n monograph = Hyrax::PresenterFactory.build_for(ids: [id], presenter_class: Hyrax::MonographPresenter, presenter_args: nil).first\n return if monograph.blank?\n\n docs = monograph.ordered_member_docs\n return if docs.blank?\n\n ids = []\n docs.each do |doc|\n fp = Hyrax::FileSetPresenter.new(doc, nil)\n next if fp.featured_representative?\n next if fp.id == monograph.representative_id\n next if Sighrax.tombstone?(Sighrax.from_presenter(fp))\n ids << fp.id\n end\n\n ids.join(\",\")\n end",
"def ids\n @ids ||= term.list_ids.sort\n end",
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def ingested_ids\n ingested_ids_by_type.flatten\n end",
"def ingested_ids\n ingested_ids_by_type.flatten\n end",
"def richtext_contents_ids\n contents.essence_richtexts.pluck('alchemy_contents.id')\n end",
"def object_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty?\n return object_taxon_name_id if !object_taxon_name_id.empty?\n return []\n end",
"def tags\n object.tags.map {|tag| tag.id}\n end",
"def extract_ids\n # no-op\n end",
"def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s + \",\"\n end\n ids = ids.chomp(\",\")\n ids = ids + \")\"\n return ids\n\n end",
"def get_entity id\n @entities.each do |e|\n return e if e.id == id\n end\n end",
"def entity_ids(domain)\n @providers[domain].map do |block|\n block.call(domain)\n end.flatten.compact\n end",
"def find_entity_by_id(id_list_or_array)\n end",
"def stringy_taxon_concept_ids\n taxon_concept_ids.join(',')\n end",
"def stringy_taxon_concept_ids\n taxon_concept_ids.join(',')\n end",
"def richtext_contents_ids\n descendent_contents\n .where(Element.table_name => {folded: false})\n .essence_richtexts\n .pluck(\"#{Content.table_name}.id\")\n end",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"def teams_with_ids\n team_array = []\n\n self.teams.all.each do |team|\n team_array << [team.name, team.id]\n end\n\n team_array\n end",
"def get_all\n Rutodo::Database::Todo.map(&:as_entity)\n end",
"def idlist(objects)\n safe_join(objects.collect {|o| o.id}, ',')\n end",
"def entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( control_points )\r\n result\r\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def identifiers\n return [] if __getobj__.blank?\n\n __getobj__.identifier if __getobj__.respond_to?(:identifier)\n end",
"def ids\n storage.keys\n end",
"def load_entities_of_component(component_id)\n components_for(component_id)\n end",
"def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end",
"def entities\n @entities ||= questions.map{|question|question.meta_attribute_entity}.uniq\n end",
"def asset_ids(id)\n score = Hyrax::PresenterFactory.build_for(ids: [id], presenter_class: Hyrax::ScorePresenter, presenter_args: nil).first\n return if score.blank?\n\n docs = score.ordered_member_docs\n return if docs.blank?\n\n ids = []\n docs.each do |doc|\n fp = Hyrax::FileSetPresenter.new(doc, nil)\n next if fp.featured_representative?\n next if fp.id == score.representative_id\n next if Sighrax.from_presenter(fp).tombstone?\n ids << fp.id\n end\n\n ids.join(\",\")\n end",
"def ids\n @nodes.map(&:id)\n end",
"def ids\n root.ids\n end",
"def superfamily_ids\n superfamily_ids_set.to_a\n end",
"def ids; @docs.keys end",
"def person_ids\n persons = Person.find_all_from_identifier(source: 'xkonto', identifier: username)\n return nil if persons.blank?\n return persons.map(&:id)\n end",
"def identifier_uris\n return @identifier_uris\n end",
"def possible_values\n all_objects = all_from_class\n values = []\n all_objects.each do |obj|\n values << obj.send(\"id\")\n end\n values\n end",
"def ids\n @store.transaction do\n @store.roots\n end\n end",
"def ids\n self.is_leaf? ? [@ids].flatten : self.children.inject([]) {|result, item| result += item.ids}\n end",
"def receive_erased_entites()\n\t\t\tentities = Array.new\n\t\t\tuids = @dict.get_attribute 'IterativeSG', 'erased_entities'\n\t\t\treturn nil if uids == nil\n\t\t\tuids.each { |uid| entities << Controller.entities_by_UID[uid]}\n\t\t\treturn entities\n\t\tend",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def short_ids(images)\n images.map { |img| img.id.to_s }\n .map { |x| x[0..11] }\n .join(',')\nend",
"def entity_values(kind)\n self.entities.kind(kind.to_s).pluck('value')\n end",
"def get_all_segment_ids\n allsegs = get_all_segments\n segs = JSON.parse(allsegs)\n # make an array of ids\n return segs['segments'].map {|k,v| k['id']}\n end",
"def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end",
"def child_entities(entity_id)\n API::request(:get, \"entities/#{entity_id}/child_entities\")\n end",
"def uids\n return [] unless valid?\n\n queries.search(name_query).merged_uids\n end",
"def omim_ids\n @table.keys\n end",
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def oids\n\t\treturn @storage.keys\n\tend",
"def identities\n \n return ::IdentifiesAs.object_identities( self ) \n \n end",
"def id_types\n identifiers.map(&:type).uniq\n end",
"def get_all_fences\n @coll.find.to_a\n end",
"def entities_for_group group\n questions_for_group(group).map{|questions|questions.meta_attribute_entity}.uniq\n end",
"def action_entities(action_id)\n action_resource action_id, \"entities\"\n end",
"def all_item_ids\n [id] + item_ids\n end",
"def native_entities\r\n entities = []\r\n for type, type_entities in @types\r\n if type == QuadFace\r\n entities.concat( type_entities.keys.map { |quad| quad.faces } )\r\n else\r\n entities.concat( type_entities.keys )\r\n end\r\n end\r\n entities\r\n end",
"def identifiers\n request[:ids]\n end",
"def list_ids\n @documents.keys\n end",
"def parse_taxon_ids_list full_document\n full_document.gsub(/%tl\\[(.*?)\\]/) do\n ids_string = $1\n ids = ids_string.gsub(\" \", \"\").split(\",\")\n\n ids.map do |id|\n try_linking_taxon_id id\n end.join(\", \")\n end\n end",
"def errata_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::Errata.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end",
"def associations_array\n resource.reflect_on_all_associations.map { |association| association.name.to_s }\n end",
"def ids\n @keys ||= []\n end",
"def entities(text)\n return Typogruby.entities(text.to_s)\n end",
"def find_ingredients\n self.content.scan(/E\\d{3,4}|E.\\d{3,4}/).map do |number|\n Ingredient.where([\"substring(number from '\\\\d+')::integer = ?\", number])\n end.flatten.map(&:id).uniq\n end",
"def getMissionIds\n now = Time.zone.now #time in UTC 00\n missionsArray = Mission.where \"start < ? AND ? < end\", now, now\n return missionsArray.map { |m| m.id.to_s}\n end",
"def get_ids(table)\r\n valid_ids = []\r\n table_info = @db.execute(\"SELECT * FROM #{table}\")\r\n table_info.each do |line|\r\n line_info = []\r\n line.each do |name, value|\r\n if name == 'id'\r\n valid_ids << value\r\n end\r\n end\r\n end\r\n valid_ids\r\n end",
"def ordered_entities\n ids = self.entity_ids\n self.entities.sort { |a, b| ids.index(a.id) <=> ids.index(b.id) }\n end",
"def ids(table)\n res = connection.query(\"SELECT id FROM #{table} GROUP BY id\")\n id_list = []\n res.each { |i| id_list << i[0].to_i }\n return id_list\n end",
"def to_a\n @entities.dup.freeze\n end",
"def ordered_ids\n Array(solr_document[\"member_ids_ssim\"])\n end",
"def save_wikibase_entityids(json)\n each_wikibase_entitiyid(json) do |entityid|\n @used_props << entityid[:value][:'numeric-id']\n end\n end",
"def directs\n alias_ids.map(&:e).map(&:company).map(&:id)\n end",
"def ids\n @@enums_by_id.keys\n end"
] | [
"0.7133439",
"0.6685168",
"0.6685168",
"0.6660047",
"0.66519576",
"0.6588606",
"0.6507486",
"0.6457407",
"0.6401334",
"0.63695776",
"0.6362609",
"0.63518363",
"0.634869",
"0.62718517",
"0.61698353",
"0.615606",
"0.61500823",
"0.6141816",
"0.61253065",
"0.61253065",
"0.6105137",
"0.6097529",
"0.6086501",
"0.59948224",
"0.59863657",
"0.59846056",
"0.5979557",
"0.5976797",
"0.5972717",
"0.59716696",
"0.59716696",
"0.59666103",
"0.5965317",
"0.59403414",
"0.59329444",
"0.59258324",
"0.59151405",
"0.5914852",
"0.58958167",
"0.5889253",
"0.5889253",
"0.58809805",
"0.5878038",
"0.5855713",
"0.5841893",
"0.5834735",
"0.5826442",
"0.5824867",
"0.58200973",
"0.5803702",
"0.5802834",
"0.58018184",
"0.5801073",
"0.57941467",
"0.5792692",
"0.5783642",
"0.5754101",
"0.57320815",
"0.57173806",
"0.5670906",
"0.56598663",
"0.56532145",
"0.5650446",
"0.56410694",
"0.562794",
"0.562794",
"0.562794",
"0.56044537",
"0.5583411",
"0.55773234",
"0.5566454",
"0.5565771",
"0.5559798",
"0.5549826",
"0.55435425",
"0.5538459",
"0.5534515",
"0.5534415",
"0.553194",
"0.55313647",
"0.5516812",
"0.5514437",
"0.55126566",
"0.5512211",
"0.5511332",
"0.5506831",
"0.55022895",
"0.54990935",
"0.5496785",
"0.54891574",
"0.5481528",
"0.54754776",
"0.5475304",
"0.54733646",
"0.54730695",
"0.54724044",
"0.54707015",
"0.5462049",
"0.5453215",
"0.54520214"
] | 0.7079936 | 1 |
Overide that assists in calling the proper index in the array of intent results. | def [](num)
@intents[num]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](idx)\n process_results unless @processed\n @results[idx]\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def [](index)\n execute\n return @result[index]\n end",
"def results=(_arg0); end",
"def results=(_arg0); end",
"def request_res_index(*args)\n @res_index\n end",
"def index(arg, args = {})\n if arg.is_a?(ActiveRecord::Base)\n result_ids(args).index(arg.id)\n else\n result_ids(args).index(arg.to_s.to_i)\n end\n end",
"def index=(_arg0); end",
"def aget(index)\n end",
"def cursor_to_decision\n @index = 89\n end",
"def at(index); end",
"def set_result_sentiment(sentiment, index)\n results = get_entries\n result = results[index]\n result.find(input_elements[:result_more]).click\n\n case sentiment.downcase\n when 'positive'\n sentiment_ele = mark_positive\n when 'negative'\n sentiment_ele = mark_negative\n when 'neutral'\n sentiment_ele = mark_neutral\n else fail(sentiment + ' is not a valid sentiment')\n end\n sentiment_ele.click\n end",
"def [](arg)\n @results[arg]\n end",
"def index\n arrResults = Array.new\n\n @q = Quiz.ransack(params[:q])\n @matches = @q.result\n\n @arrResults = @matches.to_a\n\n \t@quizzes = Quiz.all\n allusers = Array.new\n topusers = Array.new\n @allusers = User.order('score DESC')\n @topusers = @allusers.limit(5)\n end",
"def [](index)\n self.fetch[index]\n end",
"def get(index)\n \n end",
"def each_index(*_arg0); end",
"def method_missing method, *args, &block\n @results.send(method, *args, &block)\n end",
"def queue_item_intentions()\n next_step_intentions.each { |i| queue_intention(i) }\n end",
"def calls_array\n a = return_array\n a[1]\n end",
"def get_item(index)\n # TODO\n end",
"def results; end",
"def results; end",
"def results; end",
"def create_many_intents\n intents = []\n @switches.each do |sw|\n rest = @switches - [sw]\n intents = _create_intent sw, rest, intents\nputs intents.size\n post_slice intents\n end\n post_slice intents, true\n end",
"def [](index); @args[index] end",
"def [](index)\n demand super(index)\n end",
"def execute(index)\n matches = index.hashes_for @search_term, restrict_type: @object_type, restrict_field: @field_name\n return matches.map do |matched_object|\n # Polymorphism of some kind would probably be cleaner than this, but this is literally the\n # only part of the codebase that cares, so... ¯\\_(ツ)_/¯\n case @object_type\n when 'organization'\n ticket_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'organization_id'\n end\n user_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'user', restrict_field: 'organization_id'\n end\n next {\n '_tickets' => ticket_matches&.map { |t| t.slice('_id', 'subject')},\n '_users' => user_matches&.map { |t| t.slice('_id', 'name')},\n }.merge(matched_object)\n when 'ticket'\n asignee_matches = if matched_object['assignee_id']\n index.hashes_for matched_object['assignee_id'], restrict_type: 'user', restrict_field: '_id'\n end\n submitter_matches = if matched_object['submitter_id']\n index.hashes_for matched_object['submitter_id'], restrict_type: 'user', restrict_field: '_id'\n end\n organization_matches = if matched_object['organization_id']\n index.hashes_for matched_object['organization_id'], restrict_type: 'organization', restrict_field: '_id'\n end\n next {\n '_assignee' => asignee_matches&.map { |t| t.slice('_id', 'name') },\n '_submitter' => submitter_matches&.map { |t| t.slice('_id', 'name') },\n '_organization' => organization_matches&.map { |t| t.slice('_id', 'name') },\n }.merge(matched_object)\n when 'user'\n asignee_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'assignee_id'\n end\n submitter_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'submitter_id'\n end\n organization_matches = if matched_object['organization_id']\n index.hashes_for matched_object['organization_id'], restrict_type: 'organization', restrict_field: '_id'\n end\n next {\n '_assigned_tickets' => asignee_matches&.map { |t| t.slice('_id', 'subject') },\n '_submitted_tickets' => submitter_matches&.map { |t| t.slice('_id', 'subject') },\n '_organization' => organization_matches&.map { |t| t.slice('_id', 'name') },\n }.merge(matched_object)\n\n end \n end\n end",
"def current_results_first\n offset + 1\n end",
"def index(element); end",
"def handle_results(env, request = nil)\n # override me!\n end",
"def get_item(index_number)\n @chores[index_number]\n end",
"def click_offer_by_index(idx)\n # @todo: This should raise if the offer is not on the wall.\n raise NotImplementedError\n end",
"def result\n results[0]\n end",
"def handle_response(guess, indices)\n\t\tindices.each do |index|\n \t\t\t@board[index] = guess\n \t\tend\n \t\tcandidate_words(guess, indices)\n\tend",
"def index ; @index ; end",
"def result_scanned_position(r)\n [self.result_id(r), self.result_updated_at(r).to_i].freeze\n end",
"def results\n index.results\n end",
"def results\n @results ||= with_hit.map(&:first)\n end",
"def get_actor(index)\n @data[index]\n end",
"def answer_question(i, answer)\n @answers[i] = answer\n end",
"def index(p0) end",
"def index(p0) end",
"def sample_utterances_by_intent\n intents.map { |_name, intent| yield sample_utterances_for(intent) if block_given? }\n end",
"def to_result\n [@index.result_identifier, self.score, self.count, @combinations.to_result, self.ids] if self.count && self.count > 0\n end",
"def respond(savedIndex)\n\t\[email protected]\n\n\t\tif @context.is_a? HappyChatbot\n\t\t\tif @happy_deflection == 0\n\t\t\t\tputs \"I'd love to answer that for you, but what do you think about that?\"\n\t\t\t\t@happy_deflection += 1\n\t\t\telsif @happy_deflection == 1\n\t\t\t\tputs \"What was that?\"\n\t\t\t\t@happy_deflection = 0\n\t\t\tend\n\t\telsif @context.is_a? DepressedChatbot\n\t\t\tif @depressed_deflection == 0\n\t\t\t\tputs \"It hurts me to answer a question you already know the answer to.\"\n\t\t\t\t@depressed_deflection += 1\n\t\t\telsif @depressed_deflection == 1\n\t\t\t\tputs \"Why ask me, man? I don't know the answer, but I can bet that you do though.\"\n\t\t\t\t@depressed_deflection = 0\n\t\t\tend\n\t\telsif @context.is_a? AngryChatbot\n\t\t\tif @angry_deflection == 0\n\t\t\t\tputs \"I don't know, why don't you tell me!\"\n\t\t\t\t@angry_deflection += 1\n\t\t\telsif @angry_deflection == 1\n\t\t\t\tputs \"I bet you know the answer to that yourself, don't you?\"\n\t\t\t\t@angry_deflection = 0\n\t\t\tend\n\t\tend\n\tend",
"def result\n results.first\n end",
"def action_show( contact, i )\n contact = contact[i-1]\n\n puts\n show( contact )\n puts\nend",
"def get_result(index)\n\n if index.is_a?(String)\n idx = nil\n @results.each_with_index { |r, i|\n\tif r =~ /^#{index}/\n\t idx = i\n\tend\n }\n else\n idx = index\n end\n\n md = /^\\S+ [0-9a-fA-F]{8}/.match(@results[idx])\n @handler.send_cmd(\"read\", md[0])\n\n # swallow the whole response into a hash\n response = Hash.new\n\n each_line(@handler) { |line|\n @raw_response << line + \"\\n\"\n case line\n\twhen /^(\\d+) (\\S+)/, /^([A-Za-z0-9_]+)=(.*)/\n\t key = $1.upcase\n\n\t val = $2.gsub(/\\\\(.)/) {\n\t case $1\n\t when \"t\"\n\t\t\"\\t\"\n\t when \"n\"\n\t\t\"\\n\"\n\t else\n\t\t$1\n\t end\n }\n\n\t (response[key] ||= '') << val\n\twhen /^# Revision: (\\d+)/\n\t @revision = $1.to_i\n end\n }\n @category = response['210']\n @genre = response['DGENRE']\n @year = response['DYEAR'].to_i\n @ext_infos = response['EXTD']\n\n # Use a regexp instead of a bare string to avoid ruby >= 1.7 warning\n @artist, @title = response['DTITLE'].split(/ \\/ /, 2)\n # A self-titled album may not have a title part\n @title ||= @artist\n\n response.each { |key, val|\n case key\n\twhen /^4\\d\\d$/\n\t raise(FreedbError, val)\n\twhen /^TTITLE(\\d+)$/\n\t i = $1.to_i\n\t @tracks[i][\"title\"] = val\n\twhen /^EXTT(\\d+)$/\n\t i = $1.to_i\n\t @tracks[i][\"ext\"] = val\n end\n }\n self\n end",
"def handle_results(results:)\n if results.empty?\n puts \"No results for: \\\"#{@query}\\\"\".bold.red\n else\n results.each do |key, result|\n puts \"\\n\\\"#{@query}\\\", found in: \\\"#{key}\\\"\".bold.green\n ap result\n end\n end\n end",
"def pokemon_index(method_name, *args)\n index = $game_variables[Yuki::Var::Party_Menu_Sel].to_i\n index = party.send(method_name, *args) if index < 0\n return index\n end",
"def index( contacts )\n contacts.each_with_index do |contact , i|\n puts \"#{i+1}) #{contact[:name]}\"\n end\nend",
"def index\n @array = [45, 6, 32, 0]\n end",
"def take_results_for(name, position)\n result = Backtest::Result.receive(name, position)\n result.decode()\n end",
"def [](index)\n all[index]\n end",
"def fetch_results(which_q, subreddit, which_to)\n results = which_to.call(subreddit.name, subreddit.item_limit)\n @l.info \"results fetched from #{subreddit.name}::#{which_q}\"\n results.nil? ? results = [] : results = results \n results\n end",
"def intent_send\n\tbegin\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '1'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY, \"\", \"ACTION_MAIN\", \"\", \"com.smap.targetapp\", \"\", \"\", \"\", \"\")\n\t\t\twhen '3'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_MAIN\",\"\",\"com.smap.targetapp\",\"com.smap.targetapp.MainActivity\",\"\",\"\",\"\")\n\t\t\twhen '6'\n\t\t\t\tparams_constructor(Rho::Intent::START_SERVICE,\"\",\"\",\"\",\"com.smap.targetapp\",\"com.smap.targetapp.MyFirstService\",\"\",\"\",\"\")\n\t\t\twhen '8'\n\t\t\t\tparams_constructor(Rho::Intent::START_SERVICE,\"\",\"ACTION_MAIN\",\"\",\"com.smap.targetapp\",\"com.smap.targetapp.MyFirstService\",\"\",\"\",\"\")\n\t\t\t\tRho::Intent.send(@result)\n\t\t\twhen '9'\n\t\t\t\tdata = { 'toast' => 'Target - Test case passed if you see this in Android Toast !' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.smap.targetapp.mySecondAction\",\"\",\"\",\"\",\"\",\"\",data)\n\t\t\twhen '12'\n\t\t\t\tdata = { 'toast' => 'Target - Test case passed If you see this in Andorid Toast !' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"com.smap.targetapp\",\"\",\"\",\"\",data)\n\t\t\twhen '22'\n\t\t\t\tdata = { 'sms_body' => 'Test case passed if you see this in Message body.' }\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",\"\",\"vnd.android-dir/mms-sms\",data)\n\t\t\twhen '26'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"rhomobile TestApp/TestApp.exe\",\"\",\"\",\"\",\"\")\n\t\t\twhen '27'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"com.smap.targetapp\",\"\",\"\",\"\",\"\")\n\t\t\twhen '28'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"testapp\",\"\",\"\",\"\",\"\")\n\t\t\twhen '29'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",\"http://www.google.com\",\"\",\"\")\n\t\t\twhen '30'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"sms:9611896991\",\"\",\"\")\n\t\t\twhen '311'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"mailto:[email protected]\",\"\",\"\")\n\t\t\twhen '312'\n\t\t\t\tparams_constructor(\"\",\"\",\"\",\"\",\"\",\"\",\"mailto:[email protected]\",\"\",\"\")\n\t\t\twhen '32'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_DIAL\",\"\",\"\",\"\",\"tel:9611896991\",\"\",\"\")\n\t\t\twhen '301'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"sms:9611896991\",\"\",\"\")\n\t\t\twhen '302'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"sms:9611896991\",\"\",\"\")\n\t\t\twhen '34'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_CALL\",\"\",\"\",\"\",\"tel:9611896991\",\"\",\"\")\n\t\t\twhen '35'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",\"content://contacts/people/\",\"\",\"\")\n\t\t\twhen '37'\n\t\t\t\tdata = { 'body' => 'Test case Passed : only if this is displayed in email body content with prefilled recepient address !' };\n params_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"mailto:[email protected]\",\"\",data)\n when '441'\n \tdata = {\n \t\t'EXTRA_EMAIL' => [\"[email protected]\"],\n\t 'EXTRA_CC' => [\"[email protected]\"],\n\t 'EXTRA_BCC' => [\"[email protected]\"],\n\t 'EXTRA_SUBJECT' => \"Email Subject !\",\n\t 'EXTRA_TEXT' => \"Email body content !\"\n\t }\n params_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_SEND\",\"\",\"\",\"\",\"\",\"text/plain\",data)\n when '442'\n \tpdf = \"content://com.rhomobile.compliancetestruby/rhodata/apps/public/intent/rhodes.pdf\"\n params_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",pdf,\"\",\"\")\n else\n\n\t\t\tend\n\t\telsif @params['cat']\n\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_MAIN\",[@params['cat']],\"\",\"\",\"\",\"\",\"\")\n\t\tend\n\n\t\tRho::Intent.send(@result)\n\trescue =>ex\n\t\tjsmethod = 'Ruby.sendValueToJS(\"' + ex.message + '\")'\n\t\tRho::WebView.executeJavascript(jsmethod)\n\tend\nend",
"def results\n meth = [kind.to_s, self.search_suffix].join.to_sym\n return([]) unless respond_to?(meth) # Ensure no hijackers.\n return([]) if q.nil?\n \n send(meth)\n end",
"def get_index(*params); raise('Stub or mock required.') end",
"def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end",
"def my_each_with_index\n\t\tself.length.times do |index|\n\t\t\tyield(self[index], index)\n\t\tend\n\tend",
"def indexes(*rest) end",
"def indexes(*rest) end",
"def index; @index; end",
"def index\n get_results\n end",
"def index\n # arr.each_index.select{|i| arr[i] == 'x'}\n @followships = Followship.select{|followship| followship.follower_id == current_user.id}\n end",
"def position_result\n hurdle_match.rank.index(self) + 1\n end",
"def rindex(item, offset=MaglevUndefined, &block)\n self.__index(item, offset, 0x50) # came here via a bridge from args*\n end",
"def partner_results\n r = Result.where(:offering_id=>offering_id, :award=>award)\n end",
"def indices(*rest) end",
"def indices(*rest) end",
"def item; @data[@index]; end",
"def list_results(**opt)\n # May be overridden by the subclass.\n end",
"def [](index); end",
"def index *args\n # delegate\n self.class.names.index *args\n end",
"def store_result()\n #This is a stub, used for indexing\n end",
"def get_item(index)\n @get_items[index]\n end",
"def ele_index(class_name, index)\n results = tags(class_name)\n if index == 'last()'\n index = results.length\n index -= 1 if index >= 0\n else\n raise 'Index must be >= 1' unless index >= 1\n\n index -= 1 if index >= 1\n end\n\n # uiautomator has issues with index/instance so calculate the index\n # client side.\n results[index]\n end",
"def [](index)\n raise TypeError unless index.kind_of? Numeric\n raise IndexError if index >= @queries.length\n @queries[index]\n end",
"def row(index)\n end",
"def index\n @performed_goal_ints = PerformedGoalInt.all\n end",
"def get(index)\n args[index]\n end",
"def process_result\n end",
"def result_scanned_position(r)\n [self.result_id(r),\n self.result_file_hashes(r)].freeze\n end",
"def index()\n INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }\n end",
"def add_result name, res\n \n end",
"def record_result(homescore, awayscore, status=\"COMPLETED\")\n super(homescore, awayscore, status)\n self.advance_contestants()\n end",
"def index\n # @things = Thing.all\n # indexarr = params[:indices]\n # # indexarr = [60, 59, 62, 61, 70, 94, 72, 71, 85, 32, 16, 6, 27, 38, 14, 90, 48, 39, 74, 66]\n # # mi = indexarr.map.with_index(0).to_a\n \n # res = Thing.joins(:model_version_images).where('model_version_images.index' => indexarr).group(\"things.id\")\n\n # mindex = indexarr.each_with_index.map {|m, i| \"(#{m},#{i})\" }.join(\",\")\n # # r = Thing.select(\"things.*, MIN(x.ordering) as imgorder\").joins(:model_version_images).joins(\"INNER JOIN ( values #{mindex}) as x (index, ordering) ON model_version_images.index = x.index\").group(\"things.id\").order(\"imgorder\").includes(:model_version_images).page(1).per(2)\n # r = Thing.select(\"things.*, MIN(x.ordering) as imgorder\").joins(\"model_version_images as images ON things.id = images.thing_id\").joins(:model_version_images).joins(\"INNER JOIN ( values #{mindex}) as x (index, ordering) ON model_version_images.index = x.index\").group(\"things.id\").order(\"imgorder\").includes(:model_version_images)\n # res = Thing.joins(:model_version_images).joins(\"INNER JOIN ( values #{mindex}) as x (index, ordering) ON model_version_images.index = x.index\").group(\"things.id\")\n end",
"def click_with_index(value)\n # NO-OP\n end",
"def get_item(index_num)\r\n @arr.fetch(index_num)\r\n end",
"def each\n @intents.each do |intent|\n lambda{intent}\n end\n end",
"def assign_rooms(speaker)\nspeaker.collect.with_index(1) do |name, index|\n \"Hello, #{name}! You'll be assigned to room #{index}!\"\n #binding .pry\nend \nend",
"def [](index) # i.e. array style index lookup.\n end",
"def index\n @q = FoundItem.ransack(params[:q])\n @found_items = @q.result\n end",
"def index\r\n @index ||= 0\r\n end",
"def results\n# not_observed, no_relation, shows_progress, meets_standard, exceeds_standard\n# For Plan, Presentation, Activity, Assessment, Climate\n results = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n \n # If application Complete (no section is nil)\n if (completed)\n (0..4).each do |i|\n results[0][i] += plan.planResults[i] \n results[1][i] += presentation.presentationResults[i] \n results[2][i] += activity.activityResults[i] \n results[3][i] += assessment.assessmentResults[i] \n results[4][i] += climate.climateResults[i]\n end\n end\n \n return results\n end",
"def determine_winner\n cards = deal\n hands = cards.sort_by do |hand, i|\n hand[:card][2] #limits the hand with two arrays\n end\n winner = hands.last[:player]\n winnerCard = hands.last[:card]\n winnerCard = winnerCard.join(\" of \") #ROADBLOCK: I can't seem to figure this part out. I want to just return the rank and the suit, and return the index for score. Example, 7 of hearts instead of 7 of hearts of 6. I don't want the 6 there.\n\n # score = hands.last[:card].split(\"\")\n\n puts \"#{winner} drew the card, #{winnerCard}\"\n\n # puts \"#{winner}'s score is #{score}'\"\n #ROADBLOCK: I want the index to print out for the score here\n\n puts \"#{winner} wins!\"\nend",
"def retrieve_for_index(index)\n page = (index / 10) + 1\n populate_results(API.search(@query, page))\n end",
"def find(search_string)\n result_array = []\n search_words = search_string.split(/\\s+/)\n\n # Loop over all entries in the index.\n @data.each{ |entry|\n begin\n # Check whether this entry matches the search words.\n score = 0\n search_words.each{ |search_word|\n next if search_word.empty?\n\n s = 2 * AE::LaunchUp::Scorer.score(search_word, entry[:name]) if entry[:name].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:description]) if entry[:description].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:category]) if entry[:category].is_a?(String)\n s += exact_matches(search_word, entry[:keywords].join(\" \"))/(entry[:keywords].length|1).to_f if entry[:keywords].is_a?(Array) && !entry[:keywords].empty?\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:keywords].join(\" \")) if entry[:keywords].is_a?(Array)\n s += exact_matches( search_word.gsub(/\\/|\\\\/, \"\"), entry[:file].gsub(/\\/|\\\\/, \"\") ) if entry[:file].is_a?(String) && search_word.length > 4\n\n # Skip if no match has been found.\n break score = 0.0 if s == 0.0\n score += s\n }\n\n # Tweaks for relevance:\n # Entries with icons match better with users's expectation,\n # urls or \"about\" rather not.\n score *= 3 if entry[:icon].is_a?(String)\n #score *= 0.5 if entry[:name][/about|paypal/i] || entry[:description][/http/]\n\n # Check wether the command is available in the current context. We don't\n # want to reject it completely from the search results, so that the user\n # won't miss it in an explicit search will. We give a hint if it's disabled.\n if entry[:validation_proc]\n status = nil\n begin\n status = entry[:validation_proc].call == MF_ENABLED\n rescue LocalJumpError => e\n # Validation proc contains a \"return\"?\n $stderr.write(\"Validation proc of '#{entry[:name]}' (#{entry[:id]}) contains 'return'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n rescue Exception => e\n # Validation proc contains other bug.\n $stderr.write(\"Error in validation proc of '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/) if $VERBOSE\n end\n entry[:enabled] = status\n score *= 0.5 if status == false\n end\n\n # Skip if no match has been found.\n next if score < 1.0\n\n # Consider tracking data, how often this entry has been selected over others:\n # Divide track by half of average track (total_track/data.length).\n score += [entry[:track] / (@total_track|1).to_f * 0.5 * @data.length, 5].min if entry[:track]\n entry[:score] = score\n\n # Add it to results.\n result_array << entry\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n break\n end\n }\n\n return result_array\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{search_string}'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n return []\n end",
"def at(array, i)\n array[i]\nend"
] | [
"0.62582564",
"0.5883612",
"0.57228786",
"0.57067853",
"0.57067853",
"0.5573621",
"0.55102",
"0.5475681",
"0.54631186",
"0.54112345",
"0.5398668",
"0.53559667",
"0.5341848",
"0.53290284",
"0.5311468",
"0.5307291",
"0.52837557",
"0.522945",
"0.5228645",
"0.5222701",
"0.5216538",
"0.5206246",
"0.5206246",
"0.5206246",
"0.51821434",
"0.51784277",
"0.51718646",
"0.51632196",
"0.51576763",
"0.51255447",
"0.5122247",
"0.5117937",
"0.5106272",
"0.5099768",
"0.5080206",
"0.5076134",
"0.50720066",
"0.505321",
"0.5051806",
"0.5051586",
"0.50407493",
"0.50349844",
"0.50349844",
"0.50296247",
"0.5024241",
"0.501776",
"0.50093466",
"0.5000037",
"0.49823725",
"0.4982167",
"0.4979112",
"0.49666482",
"0.4964954",
"0.4959582",
"0.49562192",
"0.49557215",
"0.4953974",
"0.49536765",
"0.49449056",
"0.4937467",
"0.4912388",
"0.49115074",
"0.49115074",
"0.49110788",
"0.49023858",
"0.4900118",
"0.48975238",
"0.48969278",
"0.4893535",
"0.48785493",
"0.48785493",
"0.48719013",
"0.48649013",
"0.48561344",
"0.48558033",
"0.48546892",
"0.4852095",
"0.48434",
"0.48416343",
"0.48405355",
"0.4838578",
"0.4818005",
"0.48173264",
"0.4814902",
"0.48130846",
"0.48128504",
"0.48092985",
"0.48092788",
"0.48075828",
"0.48062035",
"0.48036474",
"0.4802329",
"0.47966915",
"0.47953102",
"0.4793724",
"0.47893682",
"0.47872496",
"0.47837248",
"0.4781062",
"0.47742113"
] | 0.50121397 | 46 |
Assists in going through each intent in the instance variable. | def each
@intents.each do |intent|
lambda{intent}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_many_intents\n intents = []\n @switches.each do |sw|\n rest = @switches - [sw]\n intents = _create_intent sw, rest, intents\nputs intents.size\n post_slice intents\n end\n post_slice intents, true\n end",
"def intent xA\n result = @attributes.clone\n for g in xA do\n result.and_equals(self.object_intent(g))\n end\n result\n end",
"def object_intent g\n @intent_map[g]\n end",
"def queue_item_intentions()\n next_step_intentions.each { |i| queue_intention(i) }\n end",
"def sample_utterances_by_intent\n intents.map { |_name, intent| yield sample_utterances_for(intent) if block_given? }\n end",
"def search_all\n r=[]\n [:find_histogram,:find_density,:find_statistics,:find_original, :find_classification, :find_im,:find_ct].each do |m|\n r << self.send(m)\n puts \"Done with #{m}\"\n end\n r.flatten\nend",
"def update!(**args)\n @intent = args[:intent] if args.key?(:intent)\n end",
"def update!(**args)\n @intent = args[:intent] if args.key?(:intent)\n end",
"def context\n unless @instance_context\n @instance_context = IntentStatisticsContext.new(\n @version,\n @params['assistant_sid'],\n @params['intent_sid'],\n )\n end\n @instance_context\n end",
"def set_intent\n @intent = Intent.find(params[:id])\n end",
"def my_followers_mottos\n my_followers.each {|follower_instance| puts follower_instance.life_motto }\n end",
"def activities\n return @activities if @activities != nil && @activities.length > 0\n \n @activities = []\n self.board.cards.each do |card|\n card.actions.each do |action|\n member = Trello::Member.find(action.member_creator_id)\n action_record = {action: action, member: member}\n activity = (Parser.new(action_record, @prefix)).parse\n @activities.push(activity) unless activity == nil\n end\n end\n \n @activities\n end",
"def each\n end",
"def intent_send\n\tbegin\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '1'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY, \"\", \"ACTION_MAIN\", \"\", \"com.smap.targetapp\", \"\", \"\", \"\", \"\")\n\t\t\twhen '3'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_MAIN\",\"\",\"com.smap.targetapp\",\"com.smap.targetapp.MainActivity\",\"\",\"\",\"\")\n\t\t\twhen '6'\n\t\t\t\tparams_constructor(Rho::Intent::START_SERVICE,\"\",\"\",\"\",\"com.smap.targetapp\",\"com.smap.targetapp.MyFirstService\",\"\",\"\",\"\")\n\t\t\twhen '8'\n\t\t\t\tparams_constructor(Rho::Intent::START_SERVICE,\"\",\"ACTION_MAIN\",\"\",\"com.smap.targetapp\",\"com.smap.targetapp.MyFirstService\",\"\",\"\",\"\")\n\t\t\t\tRho::Intent.send(@result)\n\t\t\twhen '9'\n\t\t\t\tdata = { 'toast' => 'Target - Test case passed if you see this in Android Toast !' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.smap.targetapp.mySecondAction\",\"\",\"\",\"\",\"\",\"\",data)\n\t\t\twhen '12'\n\t\t\t\tdata = { 'toast' => 'Target - Test case passed If you see this in Andorid Toast !' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"com.smap.targetapp\",\"\",\"\",\"\",data)\n\t\t\twhen '22'\n\t\t\t\tdata = { 'sms_body' => 'Test case passed if you see this in Message body.' }\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",\"\",\"vnd.android-dir/mms-sms\",data)\n\t\t\twhen '26'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"rhomobile TestApp/TestApp.exe\",\"\",\"\",\"\",\"\")\n\t\t\twhen '27'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"com.smap.targetapp\",\"\",\"\",\"\",\"\")\n\t\t\twhen '28'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"testapp\",\"\",\"\",\"\",\"\")\n\t\t\twhen '29'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",\"http://www.google.com\",\"\",\"\")\n\t\t\twhen '30'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"sms:9611896991\",\"\",\"\")\n\t\t\twhen '311'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"mailto:[email protected]\",\"\",\"\")\n\t\t\twhen '312'\n\t\t\t\tparams_constructor(\"\",\"\",\"\",\"\",\"\",\"\",\"mailto:[email protected]\",\"\",\"\")\n\t\t\twhen '32'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_DIAL\",\"\",\"\",\"\",\"tel:9611896991\",\"\",\"\")\n\t\t\twhen '301'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"sms:9611896991\",\"\",\"\")\n\t\t\twhen '302'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"sms:9611896991\",\"\",\"\")\n\t\t\twhen '34'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_CALL\",\"\",\"\",\"\",\"tel:9611896991\",\"\",\"\")\n\t\t\twhen '35'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",\"content://contacts/people/\",\"\",\"\")\n\t\t\twhen '37'\n\t\t\t\tdata = { 'body' => 'Test case Passed : only if this is displayed in email body content with prefilled recepient address !' };\n params_constructor(Rho::Intent::START_ACTIVITY,\"\",\"\",\"\",\"\",\"\",\"mailto:[email protected]\",\"\",data)\n when '441'\n \tdata = {\n \t\t'EXTRA_EMAIL' => [\"[email protected]\"],\n\t 'EXTRA_CC' => [\"[email protected]\"],\n\t 'EXTRA_BCC' => [\"[email protected]\"],\n\t 'EXTRA_SUBJECT' => \"Email Subject !\",\n\t 'EXTRA_TEXT' => \"Email body content !\"\n\t }\n params_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_SEND\",\"\",\"\",\"\",\"\",\"text/plain\",data)\n when '442'\n \tpdf = \"content://com.rhomobile.compliancetestruby/rhodata/apps/public/intent/rhodes.pdf\"\n params_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_VIEW\",\"\",\"\",\"\",pdf,\"\",\"\")\n else\n\n\t\t\tend\n\t\telsif @params['cat']\n\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY,\"\",\"ACTION_MAIN\",[@params['cat']],\"\",\"\",\"\",\"\",\"\")\n\t\tend\n\n\t\tRho::Intent.send(@result)\n\trescue =>ex\n\t\tjsmethod = 'Ruby.sendValueToJS(\"' + ex.message + '\")'\n\t\tRho::WebView.executeJavascript(jsmethod)\n\tend\nend",
"def intentions(i = nil)\n return @intentions if i.nil?\n if i.is_a? ElementPool\n raise \"Not an element pool of intentions\" unless i.element_type == Intention \n i = i.pool\n end\n i.each do |intt|\n @intentions << intt\n end\n end",
"def build_intents_with_samples\n intent_samples = []\n intents.map { |_name, intent| intent_samples.concat([add_sample_utterances_to(intent)]) }\n Hash[intent_samples.map { |intent| [intent.name, intent] }]\n end",
"def use_item_to_actors\r\n item_target_actors.each do |target|\r\n item.repeats.times { target.item_apply(user, item) }\r\n end\r\n end",
"def action_instances(body, headers)\n logger.debug \"Parsing Occi::Core::ActionInstance from #{body.inspect} and #{headers.inspect}\" if logger_debug?\n entity_parser = Text::Entity.new(model: model)\n tformed = transform(body, headers)\n\n action_instance = Occi::Core::ActionInstance.new(\n action: action_instance_category(entity_parser, tformed)\n )\n entity_parser.plain_attributes! tformed, action_instance.attributes\n setify(action_instance)\n end",
"def activity\n end",
"def update!(**args)\n @intents = args[:intents] if args.key?(:intents)\n end",
"def update!(**args)\n @intents = args[:intents] if args.key?(:intents)\n end",
"def update!(**args)\n @intents = args[:intents] if args.key?(:intents)\n end",
"def update!(**args)\n @intents = args[:intents] if args.key?(:intents)\n end",
"def args() return @args end",
"def all\n super | entities | action_instances\n end",
"def param_map\n\t\tintent.parameters\n\tend",
"def gifts_setup\n @activities = Activity.all.sort{|a,b| a.name.downcase <=> b.name.downcase }\n #@activities = Activity.all\n #@activities = Activity.all.sortby(:name)\n #@activities = Activity.all.map { |activity| [ activity.name, activity.id ] }\n end",
"def forEachMemberAgent _obj, _args\n \"_obj forEachMemberAgent _args;\" \n end",
"def harvest_all(run_context)\n self.class.aspect_types.each do |aspect_name, aspect_klass|\n res = aspect_klass.harvest(run_context, self)\n self.send(aspect_name, res)\n end\n end",
"def activities_setup\n @activities = Activity.all\n end",
"def actions\n actions = []\n @model.with_each_action_for(self) do |action|\n actions << action\n end\n actions\n end",
"def add_intents_by_name(intents_by_name, intent)\n return intents_by_name << { intent: intent.name, samples: intent.samples } unless intent.slots.any?\n \n slots = []\n intent.slots.map { |slot| slots << { name: slot.name, type: slot.type } }\n intents_by_name << { intent: intent.name, slots: slots, samples: intent.samples }\n end",
"def each(*args)\n routes.each(*args)\n end",
"def each\r\n @many = true\r\n yield(self)\r\n end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def fetch\n\t\t\t\t[self.[], @args]\n\t\t\tend",
"def through; end",
"def get_actions(type=nil)\n res = []\n \n @actions.each do |a|\n if a.is_a?(type) or type.nil?\n res.push a\n end\n end\n \n return res\n end",
"def each(*) end",
"def case_activity_list\n\t\t@case_activitites = @surgery_case.case_activities\n\tend",
"def instances\n @controller.instance_variable_get(:\"@#{plural_instance_name}\")\n end",
"def each(&block)\n if self.equal?(ShEx::Extension)\n # This is needed since all Semantic Action classes are defined using\n # Ruby's autoloading facility, meaning that `@@subclasses` will be\n # empty until each subclass has been touched or require'd.\n @@subclasses.values.each(&block)\n else\n block.call(self)\n end\n end",
"def get_verbs\n @verbs ||= self.verbs\n end",
"def each\n @links.each { |_, actor| yield(actor) }\n end",
"def generate_intents(intent_files, responses_files, entity_files)\n intent_files.collect do |intent_file|\n # Find a matching responses file for this intent file, if one exists.\n responses_file = responses_files.select do |responses_file|\n responses_file.intent_name == intent_file.intent_name\n end.first\n\n Expando::ApiAi::Objects::Intent.new(\n source_file: intent_file,\n responses_file: responses_file,\n entity_files: entity_files,\n api_client: client\n )\n end\n end",
"def do_stuff more_actions=[], num_actions=5\n actions = []\n num_actions.times do\n actions.push ((['move', 'eat', 'nap'] + more_actions).sample)\n end\n actions.each do |action|\n m = method action\n m.call\n end\n puts \"#{@name} is done doing stuff!\"\n end",
"def activities\n return @activities\n end",
"def each\n # Include every to be inside enumerable:\n yield \"pizza\"\n yield \"spaghetti\"\n yield \"salad\"\n yield \"water\"\n yield \"bread\"\n end",
"def create_random_intent\n intents = []\n sw = @switches.shuffle[0]\n rest = @switches - [sw]\n intents = _create_intent sw, rest, intents\n post_slice intents, true\n end",
"def methods() end",
"def each\n raise 'Not implemented'\n end",
"def initialize(name)\n @name = name\n @@all << self #pushes every instance into the @@all array\nend",
"def each(&block)\n retractions.each &block\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def activities\n PointActivity.for_activity(obj, user)\n end",
"def iterate\n raise \"You should implement this\"\n end",
"def initialize\n @actions = []\n end",
"def intentions_for_next_step(*args)\n raise \"StateItem must be subclassed to be used!\"\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def instances; end",
"def instances; end",
"def _lex_actions; end",
"def get_petition_related_activities\n get_new_petitions\n get_petition_signatures_activity\n end",
"def make_cards\n #14 restuarants\n scrape_cards.each do |res|\n binding.pry\n ResInfo::Restaurant.new_from_scraper(res)\n end\n end",
"def args\n n = self.num_args\n a = []\n n.times { |i|\n a.push Arg::new(self, i)\n }\n return a\n end",
"def args\n n = self.num_args\n a = []\n n.times { |i|\n a.push Arg::new(self, i)\n }\n return a\n end",
"def actions\n self.class.actions\n end",
"def actors \n self.characters.collect{ |character| character.actor}\n end",
"def iterate\n\t\t\t# First off, if we can free up resources, we should do that first.\n\t\t\tModel::Instance.marked_on_host(AppManager.host).each { |i|\n\t\t\t\tAppManager.kill_marked i\n\t\t\t}\n\n\t\t\t# We do this right after to avoid too long a wait for instances to\n\t\t\t# spin up.\n\t\t\tModel::Instance.started_on_host(AppManager.host).each { |i|\n\t\t\t\tAppManager.check_startup i\n\t\t\t}\n\n\t\t\tModel::Instance.live_on_host(AppManager.host).each { |i|\n\t\t\t\tAppManager.check_running i\n\t\t\t}\n\n\t\t\t# TODO: ready_dataset needs a .where(:some_criterion => foo); JG\n\t\t\t# suggests a distributed hashing algorithm for selecting instances,\n\t\t\t# which from the sound of it would avoid collisions. The goal is\n\t\t\t# to distribute load semi-optimally for capacity, ideally without\n\t\t\t# requiring that the nodes communicate with or monitor each other.\n\t\t\ti = Model::Instance.ready_dataset.first\n\t\t\tif i\n\t\t\t\tAppManager.spin_up i\n\t\t\tend\n\t\tend",
"def update!(**args)\n @android_intent = args[:android_intent] if args.key?(:android_intent)\n @companion_uri = args[:companion_uri] if args.key?(:companion_uri)\n @ios_uri = args[:ios_uri] if args.key?(:ios_uri)\n end",
"def instances\n end",
"def run\n methods = self.class.instance_methods - Object.instance_methods\n methods.grep(%r!^set_!).each do |v|\n send(v)\n end\n end",
"def actors\n request = Message::List.new(Thread.mailbox)\n list = send_request request\n list.map!(&:to_sym)\n end",
"def actions\n @actions ||= []\n end",
"def perform_serial\n @enum.inject(@initial, &@inject_proc)\n end",
"def args\n @args\n end",
"def initialize()\r\n @programs = []\r\n @swimmers = []\r\n @results = []\r\n end",
"def __find_args__\n self\n end",
"def actions\r\n return @actions\r\n end",
"def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action, self.params[\"screen\"]) } \n end",
"def each(&block)\n attributes.each(&block)\n end",
"def each(&block)\n attributes.each(&block)\n end",
"def sentiments_counts\n #This will get the sentiments related to each instance\n x = self.sentiments\n\n #These two lines are instantiated for the while loop below\n y = 0\n sentiments_count = []\n\n #This is a loop taking 'positive', 'negative', or 'neutral' from the instances\n while y < x.count\n sentiments_count << x[y][:sentiment]\n y += 1\n end\n\n #This creates a hash and counts each of the words' occurrences in the array\n #The output will look something like:\n # {\"Positive\" => 2, \"Neutral\" => 1, \"Negative\" => 3}\n hash = sentiments_count.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n hash.map {|key, value| puts \"#{key} - #{value}\"}\n end",
"def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end",
"def skill _obj, _args\n \"_obj skill _args;\" \n end",
"def evaluate\n load_activities\n @ta_delivery_methods = TaDeliveryMethod.all\n @intensity_levels = IntensityLevel.all\n @ta_categories = TaCategory.all\n end",
"def each\n\t\tyield \"piaza\"\n\t\tyield \"spaghetti\"\n\t\tyield \"salad\"\n\t\tyield \"water\"\n\tend"
] | [
"0.61879927",
"0.6010818",
"0.5610221",
"0.5534706",
"0.54216284",
"0.53657794",
"0.5201076",
"0.5201076",
"0.5165043",
"0.51494354",
"0.5130485",
"0.507602",
"0.5018144",
"0.5009547",
"0.50058293",
"0.49816284",
"0.49804",
"0.49364328",
"0.493144",
"0.4920903",
"0.49194878",
"0.49194878",
"0.49194878",
"0.49193105",
"0.48908198",
"0.4876847",
"0.48688796",
"0.4862584",
"0.48565504",
"0.48155898",
"0.48056775",
"0.48004708",
"0.47882742",
"0.478579",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47825587",
"0.47732309",
"0.47642145",
"0.47577587",
"0.4755443",
"0.4754642",
"0.47531104",
"0.47463655",
"0.47457394",
"0.4744073",
"0.47397658",
"0.47292215",
"0.4725792",
"0.4724489",
"0.4714147",
"0.47100365",
"0.47083136",
"0.47031605",
"0.4702793",
"0.46925396",
"0.46925396",
"0.46925396",
"0.46920884",
"0.46840838",
"0.46801913",
"0.4679409",
"0.46784782",
"0.46784782",
"0.46778888",
"0.46778888",
"0.46764505",
"0.46725103",
"0.4670631",
"0.4665749",
"0.4665749",
"0.46592766",
"0.46574536",
"0.46507654",
"0.46461952",
"0.4644423",
"0.4644213",
"0.46424654",
"0.4636009",
"0.4633695",
"0.4631073",
"0.4622633",
"0.46216166",
"0.46198502",
"0.46160826",
"0.46142974",
"0.46142974",
"0.46079335",
"0.46061885",
"0.45883703",
"0.45862404",
"0.4584336"
] | 0.66019195 | 0 |
verica que el objeto de guarde en la base de datos correctamente (se usa a mano en casos de objetos que se generan automaticamente sin intervencion del usuario) | def secure_save(variable)
begin
if variable.save
return true
end
rescue ActiveRecord::RecordNotFound
# handle not found error
logger.error "no se encontro el registro que se solicito"
return false
rescue ActiveRecord::ActiveRecordError
# handle other ActiveRecord errors
logger.error ("hubo un error en el ActiveRecord" + logger.debug)
rescue # StandardError
# handle most other errors
rescue Exception
# handle everything else
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auditoria_antes(accion, tabla, objeto)\n auditoria = Auditoria.new\n auditoria.usuario = current_usuario.login\n auditoria.ip = request.remote_ip\n auditoria.accion = accion\n auditoria.tabla = tabla\n auditoria.pista_antes = objeto.to_json\n auditoria.sistema = \"RUE\"\n auditoria.save\n\n auditoria.id\n\n end",
"def author\n #Este self.object hace referencia al object que se esta serializando\n user = self.object.user\n {\n name: user.name,\n email: user.email,\n id: user.id\n }\n end",
"def recreate_from(obj)\n keys = self.key_column_names\n args = {}\n if obj.respond_to?(:enterprise_id) and obj.respond_to?(:uid)\n args[keys.delete(:enterprise_id)] = obj.enterprise_id\n if keys.length == 1\n args[keys.first] = obj.uid\n self.get_cached(args)\n else\n puts keys.to_a.to_s\n raise NotImplementedError, 'See octocore/models.rb'\n end\n end\n end",
"def single_object_db; end",
"def user_obj\r\n User.select(:name).where(id: object.user_id).last || User.new(name: \"Not Found\")\r\n end",
"def prepare_serialization!\n # force the group/owner to be translated from uid/gid, if those keys\n # were given on instantiation\n owner\n group\n end",
"def completa_info(root_usuario_id=nil)\n if usuario_id.present?\n self.es_propietario = root_usuario_id == self.usuario_id ? true : false\n\n begin # Por si viene del scope datos_basicos y encontro el usuario\n self.nombre = u_nombre\n self.correo = u_email\n self.institucion = u_institucion\n rescue\n u = usuario\n self.nombre = \"#{u.nombre} #{u.apellido}\".strip\n self.correo = u.email\n self.institucion = u.institucion\n end\n\n else # Por si no esta el usuario_id\n begin # Trato de ver si venia de un scope\n self.nombre = c_nombre\n self.institucion = c_institucion\n self.es_propietario = true\n rescue\n self.es_propietario = true\n end\n end\n end",
"def object_from_guzzoni(object, connection) \n\t\tobject\n\tend",
"def from_postgres(postgres_user_info)\n # user = UserInfo.new\n # puts \"FROM POSTGRES INFO #{postgres_user_info.inspect}\"\n if postgres_user_info\n\n self.id = postgres_user_info['id'] || ''\n self.name = postgres_user_info['name'] || ''\n self.updated_at = postgres_user_info['updated_at']? postgres_user_info['updated_at'].to_datetime : DateTime.now\n self.title = postgres_user_info['title'] || ''\n if (postgres_user_info['about'])\n postgres_user_info['about'][0] = '['\n postgres_user_info['about'][postgres_user_info['about'].length-1] = ']'\n\n\n unescaped_about = PostgresHelper.unescape_from_postgres(postgres_user_info['about'])\n else\n\n end\n # puts \"UNESAPED ABOUT #{unescaped_about}\"\n # self.about =(unescaped_about)? JSON.parse(unescaped_about) : Array.new\n self.about =(unescaped_about)? PostgresHelper.from_array_string_load(unescaped_about) : Array.new\n self.location = (postgres_user_info['location'] && postgres_user_info['location'] != 'null')? PostgresUserInfos.from_json_load( postgres_user_info['location']) : Hash.new\n self.location_id = postgres_user_info['location_id'] || ''\n\n self.latitude = (postgres_user_info['latitude'] && !postgres_user_info['latitude'].empty?)? postgres_user_info['latitude'].to_f : nil\n self.longitude = (postgres_user_info['longitude'] && !postgres_user_info['longitude'].empty?)? postgres_user_info['longitude'].to_f : nil\n self.public_service = (postgres_user_info['public_service'])? postgres_user_info['public_service'] : false\n\n\n self.keywords_rated = from_json_load(postgres_user_info['keywords_rated'])\n # self.current_keywords = self.keywords_rated\n\n\n self.current_keywords = (self.keywords_rated && !self.keywords_rated.empty?)?self.keywords_rated.keys : Array.new\n\n end\n end",
"def load_obj\n @obj=nil\n raise 'Sovrascrivi funzione \"load_obj\" in figli la definizione di questa variabile: @obj'\n end",
"def de_serialiaze\n Logger.d(\"de_serialiazing the user object\")\n data_json = get_from_shared_prefs(@context, self.class)\n \n begin\n @data = JSON.parse(data_json) if not data_json.nil? and data_json.length > 0\n rescue Exception => e\n Logger.exception(:de_serialiaze, $!)\n end\n end",
"def hay_obra?\n @obra.try :persisted?\n end",
"def create\n @objeto = current_usuario.objetos.new(objeto_params)\n #@objeto.objetovalparametros.valparametros = nil\n\n #print @objeto.parametros\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Objeto was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare_row(params={}, current_user=nil, objeto=nil)\n if params[:persona]\n @persona = self if self\n @persona ||= objeto.persona if (objeto)\n @persona ||= (params[:persona][:id_persona] && params[:persona][:id_persona].size > 0)? Persona.find(params[:persona][:id_persona]) : nil\n @persona ||= (params[:persona][:per_curp] && params[:persona][:per_curp].size > 0) ? Persona.find(:first, :conditions => [\"per_curp = ?\", params[:persona][:per_curp]]) : nil\n anio = params[:persona][\"per_nacimiento(1i)\"]\n mes= params[:persona][\"per_nacimiento(2i)\"]\n dia=params[:persona][\"per_nacimiento(3i)\"]\n date = Date.new(anio.to_i,mes.to_i,dia.to_i)\n ## Si no existe vamos a crear el objeto persona ##\n @persona ||= Persona.new\n @persona.update_attributes(:per_nombre => params[:persona][:per_nombre], :per_paterno => params[:persona][:per_paterno], :per_materno => params[:persona][:per_materno], :per_nacimiento => date)\n if params[:contacto]\n @persona.set_datos_contacto('telefono_celular', :con_parametro => params[:contacto][:telefono_celular], :con_usu_modi => current_user.persona.id) if params[:contacto][:telefono_celular] && params[:contacto][:telefono_celular].size > 0\n @persona.set_datos_contacto('telefono_casa', :con_parametro => params[:contacto][:telefono_casa], :con_usu_modi => current_user.persona.id) if params[:contacto][:telefono_casa] && params[:contacto][:telefono_casa].size > 0\n @persona.set_datos_contacto('direccion', :con_parametro => params[:contacto][:direccion], :con_usu_modi => current_user.persona.id) if params[:contacto][:direccion] && params[:contacto][:direccion].size > 0\n @persona.set_datos_contacto('correo_electronico', :con_parametro => params[:contacto][:correo_electronico], :con_usu_modi => current_user.persona.id) if params[:contacto][:correo_electronico] && params[:contacto][:correo_electronico].size > 0\n @persona.set_datos_contacto('direccion_laboral', :con_parametro => params[:contacto][:direccion_laboral], :con_usu_modi => current_user.persona.id) if params[:contacto][:direccion_laboral] && params[:contacto][:direccion_laboral].size > 0\n @persona.set_datos_contacto('telefono_laboral', :con_parametro => params[:contacto][:telefono_laboral], :con_usu_modi => current_user.persona.id) if params[:contacto][:telefono_laboral] && params[:contacto][:telefono_laboral].size > 0\n end\n if params[:clave_elector] && params[:clave_elector][:descripcion].size > 0\n @clave_elector = (@persona.clave_elector) ? @persona.clave_elector : ClaveElector.new(:persona_id => @persona.id )\n @clave_elector.descripcion ||= params[:clave_elector][:descripcion]\n @clave_elector.save\n end\n if params[:extension] && params[:extension].size > 0\n @extension = (@persona.extension_persona) ? @persona.extension_persona : ExtensionPersona.new(:persona_id => @persona.id)\n @extension.update_attributes!(params[:extension])\n end\n @persona.set_datos_familiares(\"padre\", params[:padre]) if params[:padre]\n @persona.set_datos_familiares(\"madre\", params[:madre]) if params[:madre]\n end\n end",
"def update_from_gram\n self.synced_with_gram = false\n if self.syncable?\n begin\n gram_data= GramV2Client::Account.find(self.uuid)\n self.email=gram_data.email\n self.firstname=gram_data.firstname\n self.lastname=gram_data.lastname\n self.last_gram_sync_at = Time.now\n self.hruid = gram_data.hruid\n if self.save\n self.synced_with_gram = true\n return self\n else\n return false\n end\n rescue ActiveResource::ResourceNotFound\n logger.error \"[GrAM] Utilisateur introuvable : hruid = #{self.hruid} uuid = #{self.uuid}\"\n return false\n rescue ActiveResource::ServerError\n logger.error \"[GrAM] Connexion au serveur impossible\"\n return false\n rescue ActiveResource::UnauthorizedAccess, ActiveResource::ForbiddenAccess\n logger.error \"[GrAM] Connexion au serveur impossible : verifier identifiants\"\n return false\n end\n else\n return false\n end\n\n end",
"def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end",
"def grabar_usuario_ensambladora(nombre,password)\n @usuario = Usuario.find(:first, :conditions => \"nombre='#{nombre}'\")\n if @usuario!=nil\n $tirajson = '{ \"success\": \"true\", \"exito\": \"true\", \"message\": \"Ya existe ese nombre de usuario!\" }'\n else\n @usuario= Usuario.new\n @usuario.nombre=nombre\n @usuario.password=password\n @usuario.rols_id= 3\n @usuario.estatus='a'\n @usuario.save\n $tirajson = '{ \"success\": \"true\", \"exito\": \"true\", \"message\": \"Datos guardados satisfactoriamente!\" }'\n valor=1\n end\n \n \n end",
"def grabar_usuario_concesionario(nombre,password)\n @usuario = Usuario.find(:first, :conditions => \"nombre='#{nombre}'\")\n if @usuario!=nil\n $tirajson = '{ \"success\": \"true\", \"exito\": \"true\", \"message\": \"Ya existe ese nombre de usuario!\" }'\n else\n @usuario= Usuario.new\n @usuario.nombre=nombre\n @usuario.password=password\n @usuario.rols_id= 2\n @usuario.estatus='a'\n @usuario.save\n end\n valor=1\n $tirajson = '{ \"success\": \"true\", \"exito\": \"true\", \"message\": \"Datos guardados satisfactoriamente!\" }'\n end",
"def load_Obj\n @grupos = Grupo.all\n @nivels = Nivel.select(:id, :nombre).where(\"nombre != ?\", \"CAPITULO\" )\n# @papa = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ? \", false, true) \n @ajuste = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ?\", true, true )\n @laux = Libroauxiliar.select(:id, :descripcion).where(\"activo = ?\", true)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n token == o.token &&\n tipo == o.tipo &&\n id_cliente == o.id_cliente &&\n id_fornitore == o.id_fornitore &&\n nome == o.nome &&\n indirizzo_via == o.indirizzo_via &&\n indirizzo_cap == o.indirizzo_cap &&\n indirizzo_citta == o.indirizzo_citta &&\n indirizzo_provincia == o.indirizzo_provincia &&\n indirizzo_extra == o.indirizzo_extra &&\n paese == o.paese &&\n lingua == o.lingua &&\n piva == o.piva &&\n cf == o.cf &&\n numero == o.numero &&\n valuta == o.valuta &&\n valuta_cambio == o.valuta_cambio &&\n prezzi_ivati == o.prezzi_ivati &&\n importo_netto == o.importo_netto &&\n importo_iva == o.importo_iva &&\n importo_totale == o.importo_totale &&\n rivalsa == o.rivalsa &&\n importo_rivalsa == o.importo_rivalsa &&\n cassa == o.cassa &&\n importo_cassa == o.importo_cassa &&\n rit_acconto == o.rit_acconto &&\n imponibile_ritenuta == o.imponibile_ritenuta &&\n importo_rit_acconto == o.importo_rit_acconto &&\n rit_altra == o.rit_altra &&\n importo_rit_altra == o.importo_rit_altra &&\n marca_bollo == o.marca_bollo &&\n oggetto_visibile == o.oggetto_visibile &&\n oggetto_interno == o.oggetto_interno &&\n centro_ricavo == o.centro_ricavo &&\n centro_costo == o.centro_costo &&\n note == o.note &&\n nascondi_scadenza == o.nascondi_scadenza &&\n ddt == o.ddt &&\n ftacc == o.ftacc &&\n id_template == o.id_template &&\n ddt_id_template == o.ddt_id_template &&\n ftacc_id_template == o.ftacc_id_template &&\n mostra_info_pagamento == o.mostra_info_pagamento &&\n metodo_pagamento == o.metodo_pagamento &&\n metodo_titolo_n == o.metodo_titolo_n &&\n metodo_desc_n == o.metodo_desc_n &&\n mostra_totali == o.mostra_totali &&\n mostra_bottone_paypal == o.mostra_bottone_paypal &&\n mostra_bottone_bonifico == o.mostra_bottone_bonifico &&\n mostra_bottone_notifica == o.mostra_bottone_notifica &&\n lista_articoli == o.lista_articoli &&\n lista_pagamenti == o.lista_pagamenti &&\n ddt_numero == o.ddt_numero &&\n ddt_colli == o.ddt_colli &&\n ddt_peso == o.ddt_peso &&\n ddt_causale == o.ddt_causale &&\n ddt_luogo == o.ddt_luogo &&\n ddt_trasportatore == o.ddt_trasportatore &&\n ddt_annotazioni == o.ddt_annotazioni &&\n link_doc == o.link_doc &&\n link_ddt == o.link_ddt &&\n link_ftacc == o.link_ftacc &&\n link_allegato == o.link_allegato &&\n bloccato == o.bloccato &&\n pa == o.pa &&\n pa_tipo_cliente == o.pa_tipo_cliente &&\n pa_tipo == o.pa_tipo &&\n pa_numero == o.pa_numero &&\n pa_cup == o.pa_cup &&\n pa_cig == o.pa_cig &&\n pa_codice == o.pa_codice &&\n pa_esigibilita == o.pa_esigibilita &&\n pa_modalita_pagamento == o.pa_modalita_pagamento &&\n pa_istituto_credito == o.pa_istituto_credito &&\n pa_iban == o.pa_iban &&\n pa_beneficiario == o.pa_beneficiario &&\n pa_ts == o.pa_ts &&\n pa_ts_stato == o.pa_ts_stato &&\n split_payment == o.split_payment\n end",
"def single_object_db=(v); end",
"def usuario_actual\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la base de datos todo el tiempo\n \t@usuario_actual ||= Alumno.find(session[:alumno_id]) if session[:alumno_id]\n end",
"def insert_obj(obj) # :nodoc:\n chk_conn\n tx = @hibernate_session.begin_transaction\n @hibernate_session.save(obj)\n tx.commit\n obj\n end",
"def objet_id\n @objet_id ||= begin\n if objet.nil?\n nil\n else\n objet_hash? ? objet[:id] : objet.id\n end\n end\n end",
"def saveObject(params)\r\n \r\n @solicitudlabexa.usuario_id = params[:usuario][:identificador].to_i\r\n if params[:asignatura].nil?\r\n @solicitudlabexa.asignatura=Asignatura.new\r\n @solicitudlabexa.asignatura.titulacion_id=params[:titulacion][:titulacion_id] unless params[:titulacion].nil? \r\n @solicitudlabexa.asignatura.curso=params[:nivel]\r\n @solicitudlabexa.asignatura.id=0\r\n else\r\n @solicitudlabexa.asignatura_id = params[:asignatura][:id].to_i\r\n end\r\n @solicitudlabexa.fechasol=Date.today\r\n @solicitudlabexa.npuestos=params[:npuestos]\r\n @solicitudlabexa.curso=params[:nivel].to_s == '0' ? 'optativa' : params[:nivel].to_s\r\n @solicitudlabexa.comentarios=Iconv.conv('ascii//translit//ignore', 'utf-8', params[:comentarios].to_s)\r\n @solicitudlabexa.horaini=params[:horaini][:comienzo]\r\n @solicitudlabexa.horafin=params[:horafin][:fin]\r\n @solicitudlabexa.asignado=\"N\"\r\n \r\n pref=\"\"\r\n @especiales=Laboratorio.where('especial=?',\"t\").to_a \r\n for especial in @especiales do\r\n nombre=especial.ssoo.to_s\r\n if params[:\"#{nombre}\"] and params[:\"#{nombre}\"].to_s!='in'\r\n pref+=especial.nombre_lab.to_s+'-'+nombre+'-'+params[:\"#{nombre}\"]+\";\"\r\n end\r\n end\r\n @solicitudlabexa.preferencias=pref\r\n\r\n if params[:fecha]=~ /[0-3]?[0-9]\\-[0-1]?[0-9]\\-[0-9]{4}/\r\n @solicitudlabexa.fecha=formato_europeo(params[:fecha])\r\n else\r\n @solicitudlabexa.fecha=nil\r\n end\r\n end",
"def get_object\n class_name.create_from_database(id)\n end",
"def recibir_auto(usuario)\n if self.estado_id == 2\n traza_creada = Traza.create(:copia_id => self.id, :movimiento_id => 2, :usuario => usuario, :buzon_id => usuario.puesto.buzon_id)\n return false unless traza_creada\n self.estado_id = 3\n return true if self.save \n #si llega aqui, algo malo paso.\n return false\n end\n end",
"def persisted?; end",
"def persisted?; end",
"def new?\n # not sure..\n self.db4o_id == 0\n # or maby it should be\n # self.uuid.nil?\n end",
"def load objid\n DataObj.new @repo, self, objid\n end",
"def init_jaxb_json_hash(_o)\n super _o\n if !_o['userId'].nil?\n _oa = _o['userId']\n if(_oa.is_a? Hash)\n @userId = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @userId = Fixnum.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @userId = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @userId.push Fixnum.from_json(_item)\n else\n @userId.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @userId = _oa\n end\n end\n if !_o['username'].nil?\n _oa = _o['username']\n if(_oa.is_a? Hash)\n @username = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @username = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @username = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @username.push String.from_json(_item)\n else\n @username.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @username = _oa\n end\n end\n if !_o['firstName'].nil?\n _oa = _o['firstName']\n if(_oa.is_a? Hash)\n @firstName = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @firstName = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @firstName = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @firstName.push String.from_json(_item)\n else\n @firstName.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @firstName = _oa\n end\n end\n if !_o['lastName'].nil?\n _oa = _o['lastName']\n if(_oa.is_a? Hash)\n @lastName = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @lastName = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @lastName = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @lastName.push String.from_json(_item)\n else\n @lastName.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @lastName = _oa\n end\n end\n if !_o['password'].nil?\n _oa = _o['password']\n if(_oa.is_a? Hash)\n @password = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @password = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @password = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @password.push String.from_json(_item)\n else\n @password.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @password = _oa\n end\n end\n if !_o['token'].nil?\n _oa = _o['token']\n if(_oa.is_a? Hash)\n @token = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @token = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @token = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @token.push String.from_json(_item)\n else\n @token.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @token = _oa\n end\n end\n if !_o['addresses'].nil?\n _oa = _o['addresses']\n if(_oa.is_a? Hash)\n @addresses = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @addresses = Com::Pmk::App::Model::Address.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @addresses = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @addresses.push Com::Pmk::App::Model::Address.from_json(_item)\n else\n @addresses.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @addresses = _oa\n end\n end\n if !_o['roles'].nil?\n _oa = _o['roles']\n if(_oa.is_a? Hash)\n @roles = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @roles = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @roles = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @roles.push String.from_json(_item)\n else\n @roles.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @roles = _oa\n end\n end\n if !_o['country'].nil?\n _oa = _o['country']\n if(_oa.is_a? Hash)\n @country = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @country = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @country = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @country.push String.from_json(_item)\n else\n @country.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @country = _oa\n end\n end\n if !_o['website'].nil?\n _oa = _o['website']\n if(_oa.is_a? Hash)\n @website = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @website = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @website = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @website.push String.from_json(_item)\n else\n @website.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @website = _oa\n end\n end\n if !_o['phones'].nil?\n _oa = _o['phones']\n if(_oa.is_a? Hash)\n @phones = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @phones = Com::Pmk::App::Model::Phone.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @phones = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @phones.push Com::Pmk::App::Model::Phone.from_json(_item)\n else\n @phones.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @phones = _oa\n end\n end\n if !_o['emails'].nil?\n _oa = _o['emails']\n if(_oa.is_a? Hash)\n @emails = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @emails = Com::Pmk::App::Model::Email.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @emails = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @emails.push Com::Pmk::App::Model::Email.from_json(_item)\n else\n @emails.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @emails = _oa\n end\n end\n if !_o['showpassword'].nil?\n _oa = _o['showpassword']\n if(_oa.is_a? Hash)\n @showpassword = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @showpassword = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @showpassword = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @showpassword.push String.from_json(_item)\n else\n @showpassword.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @showpassword = _oa\n end\n end\n end",
"def druid_db_obj\n @druid_db_obj ||= Druid.find_or_create_by!(druid: druid)\n end",
"def create\n @alumno = Alumno.new(params[:alumno])\n respond_to do |format|\n if @alumno.save\n user = @alumno.user\n edad = calcular_edad user\n user.update_attribute(:is_alumno, true)\n user.update_attribute(:edad, edad )\n @alumno.cursos << @alumno.curso\n format.html { redirect_to @alumno, notice: 'El alumno ha sido registrado con exito.' }\n CustomLogger.info(\"Nuevo alumno: #{@alumno.user_nombre.inspect} ,Apellido: #{@alumno.user_apellido.inspect} ,Cedula de Identidad: #{@alumno.user_CINro.inspect} ,Sexo: #{@alumno.user_sexo.inspect} ,Telefono:#{@alumno.user_telefono.inspect} ,Correo Electronico: #{@alumno.user_email.inspect} ,Fecha de Nacimiento:#{@alumno.user_fecha_nacimiento.inspect} ,Lugar de Nacimiento: #{@alumno.user_lugar_nacimiento.inspect} ,Nombre del Responsable: #{@alumno.responsable.inspect} ,Telefono del Responsable: #{@alumno.telefono_responsable.inspect} ,Direccion: #{@alumno.user.address.direccion.inspect} ,Documentos Personales: Certificado de Estudio: #{@alumno.doc_cert_estudios.inspect} ,Cedula: #{@alumno.doc_cedula.inspect} ,Certificado de Nacimiento: #{@alumno.doc_cert_nacimiento.inspect} ,Foto Tipo Carnet: #{@alumno.doc_foto.inspect} ,Nombre de Usuario: #{@alumno.user_username.inspect} creado por el usuario: #{current_user.full_name.inspect} ,#{Time.now}\")\n format.json { render json: @alumno, status: :created, location: @alumno }\n format.js {}\n else\n @new = true\n atributos\n format.html { render action: \"new\" }\n CustomLogger.error(\"Error al querer crear el nuevo alumno: #{@alumno.user_nombre.inspect} y sus demas atributos, por el usuario: #{current_user.full_name.inspect} ,#{Time.now}\")\n format.json { render json: @alumno.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objet = Objet.new(params[:objet])\n @objet.user_id = @user.id if [email protected]?\n load_ressources\n respond_to do |format|\n if @objet.save\n format.html { redirect_to @objet, notice: 'Objet a été crée avec succès.' }\n format.json { render json: @objet, status: :created, location: @objet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @objet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def is_object()\n res = super(context,self)\n return res\n end",
"def serialize\n begin \n ActiveRecord::Base.transaction do \n o = \"#{@obj.class.name.downcase}_id\".to_sym\n if r = IptRecord.find(:first, :conditions => {o => @obj.id }) \n r.destroy \n end\n if i = self.ipt_record\n i.save!\n else\n return false\n end\n end\n rescue\n return false \n end \n true\n end",
"def to_obj; end",
"def set_datos_contacto(tipo=nil, parametros={})\n @objeto_contacto = eval(\"(Contacto.#{tipo}.find(:first, :conditions => ['fk_persona = ?', self.id]))? Contacto.#{tipo}.find(:first, :conditions => ['fk_persona = ?', self.id]) : Contacto.#{tipo}.new(:fk_persona => self.id)\") if tipo\n @objeto_contacto.update_attributes!(parametros) if @objeto_contacto && parametros\n end",
"def valid?\n @obj && obj_class_data\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n id_pessoa == o.id_pessoa &&\n nome == o.nome &&\n id_produto == o.id_produto &&\n id_origem_comercial == o.id_origem_comercial &&\n nome_origem_comercial == o.nome_origem_comercial &&\n id_fantasia_basica == o.id_fantasia_basica &&\n nome_fantasia_basica == o.nome_fantasia_basica &&\n id_status_conta == o.id_status_conta &&\n status_conta == o.status_conta &&\n dia_vencimento == o.dia_vencimento &&\n melhor_dia_compra == o.melhor_dia_compra &&\n data_status_conta == o.data_status_conta &&\n valor_renda == o.valor_renda &&\n data_cadastro == o.data_cadastro &&\n data_ultima_alteracao_vencimento == o.data_ultima_alteracao_vencimento &&\n data_hora_ultima_compra == o.data_hora_ultima_compra &&\n numero_agencia == o.numero_agencia &&\n numero_conta_corrente == o.numero_conta_corrente &&\n forma_envio_fatura == o.forma_envio_fatura &&\n titular == o.titular &&\n limite_global == o.limite_global &&\n limite_saque_global == o.limite_saque_global &&\n saldo_disponivel_global == o.saldo_disponivel_global &&\n saldo_disponivel_saque == o.saldo_disponivel_saque &&\n dias_atraso == o.dias_atraso &&\n proximo_vencimento_padrao == o.proximo_vencimento_padrao\n end",
"def construct_new_object(db_object)\n end",
"def initialize(obj)\n super\n @search_in_database = obj.is_a?(ActiveRecord::Relation) && !obj.loaded?\n end",
"def reload\n raise \"Can't reload object without id\" if !@id || @id.to_i == 0\n new_obj = self.class.find(@id)\n self.database_fields = new_obj.database_fields\n self.class.table_fields.each {|key| self.send(\"#{key}=\", new_obj.send(key)) }\n end",
"def guarda_geoserver_info(v)\n return unless v[:estatus]\n t = v[:taxon]\n\n if p = t.proveedor\n geoserver_info = asigna_geoserver_info(v, p.geoserver_info)\n p.geoserver_info = geoserver_info\n p.save if p.changed?\n else\n geoserver_info = asigna_geoserver_info(v)\n p = Proveedor.new({ especie_id: t.id, geoserver_info: geoserver_info })\n p.save\n end\n\nend",
"def full_object\n fail NotImplementedError\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create objid\n DataObj.new @repo, self, objid, true\n end",
"def instantiate_and_cast(obj, change = true)\n couchrest_parent_will_change! if change && use_dirty?\n obj.casted_by = casted_by if obj.respond_to?(:casted_by)\n obj.casted_by_property = casted_by_property if obj.respond_to?(:casted_by_property)\n obj\n end",
"def object\n @obj\n end",
"def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end",
"def reload_obj(dirty_obj)\n persisted_obj = dirty_obj.class.find_one(dirty_obj.id)\n dirty_obj.instance_variable.each do |instance_variable|\n dirty_obj.instance_variable_set(instance_variable, persisted_obj.instance_variable_get(instance_variable))\n\n \n end\n end",
"def utiliser( objet )\n\t\[email protected]( objet )\n\t\trafraichir\n\tend",
"def save(table = nil)\n # Converts object to hash\n hash = {}\n instance_variables.map { |q| hash[q.to_s.gsub('@', '')] = instance_variable_get(q) }\n\n dataset = select_dataset(table)\n hash['body'] = hash['body'].to_s if hash['body']\n\n if instance_variables.include?(:@id) && id.is_a?(Integer)\n # Object has a id and thereby is only updated\n dataset.where(id: id).update(hash)\n else\n # Object is inserted into database\n DB.transaction do\n hash.delete('id')\n dataset.insert(hash)\n # Retrives the new id\n if self.class.columns.include?(:id)\n id = dataset.limit(1).order(:id).reverse\n instance_variable_set(:@id, id.first[:id])\n end\n end\n end\n end",
"def person\n PersonSerializer.new(object.person) if object.person.present?\n end",
"def new\n @usuario = Usuario.new\n \n @personasvinculadas = PersonaVinculada.anioescolar_colegio(anio_escolar.id).where(\"personas_vinculadas.id not in (select persona_vinculada_id from usuarios where colegio_id = ? and persona_vinculada_id <> 0)\", colegio.id).order(\"apellido_paterno\", \"apellido_materno\", \"nombres\")\n @alumnoscolegio = Alumno.por_anio_escolar(anio_escolar.id).where(\"alumnos.id not in (select alumno_id from usuarios where colegio_id = ? and alumno_id <> 0)\", colegio.id).order(\"apellido_paterno\", \"apellido_materno\", \"nombres\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end",
"def remitente\n user = User.find(self.envia_id) if self.envia_id\n remitente ||= user.persona.nombre_completo if user && user.persona.nombre_completo\n return remitente\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n numero_estabelecimento == o.numero_estabelecimento &&\n flag_matriz == o.flag_matriz &&\n id_grupo_economico == o.id_grupo_economico &&\n numero_receita_federal == o.numero_receita_federal &&\n nome == o.nome &&\n descricao == o.descricao &&\n nome_fantasia == o.nome_fantasia &&\n cep == o.cep &&\n nome_logradouro == o.nome_logradouro &&\n numero_endereco == o.numero_endereco &&\n bairro == o.bairro &&\n cidade == o.cidade &&\n complemento == o.complemento &&\n uf == o.uf &&\n cep2 == o.cep2 &&\n nome_logradouro2 == o.nome_logradouro2 &&\n numero_endereco2 == o.numero_endereco2 &&\n bairro2 == o.bairro2 &&\n cidade2 == o.cidade2 &&\n complemento2 == o.complemento2 &&\n uf2 == o.uf2 &&\n obs == o.obs &&\n contato == o.contato &&\n email == o.email &&\n flag_arquivo_secr_fazenda == o.flag_arquivo_secr_fazenda &&\n flag_cartao_digitado == o.flag_cartao_digitado &&\n inativo == o.inativo &&\n id_moeda == o.id_moeda &&\n id_pais == o.id_pais &&\n associado_spc_brasil == o.associado_spc_brasil &&\n mcc == o.mcc &&\n id_tipo_estabelecimento == o.id_tipo_estabelecimento &&\n correspondencia == o.correspondencia &&\n cargo_contato == o.cargo_contato &&\n tipo_pagamento == o.tipo_pagamento &&\n consulta == o.consulta &&\n consulta2 == o.consulta2 &&\n consulta3 == o.consulta3 &&\n terminal == o.terminal &&\n data_cadastramento == o.data_cadastramento &&\n usuario == o.usuario\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id_transferencia == o.id_transferencia &&\n valor_cet == o.valor_cet &&\n id_autorizacao == o.id_autorizacao &&\n codigo_autorizacao == o.codigo_autorizacao &&\n nsu_origem == o.nsu_origem &&\n id_conta == o.id_conta &&\n id_cartao == o.id_cartao &&\n id_operacao == o.id_operacao &&\n valor_compra == o.valor_compra &&\n valor_parcela == o.valor_parcela &&\n valor_contrato == o.valor_contrato &&\n numero_parcelas == o.numero_parcelas &&\n valor_iof == o.valor_iof &&\n valor_tac == o.valor_tac &&\n valor_taxa_saque == o.valor_taxa_saque &&\n taxa_juros == o.taxa_juros &&\n data_compra == o.data_compra &&\n data_movimento == o.data_movimento &&\n data_vencimento_real == o.data_vencimento_real &&\n data_vencimento_padrao == o.data_vencimento_padrao &&\n data_autorizacao == o.data_autorizacao &&\n banco == o.banco &&\n numero_agencia == o.numero_agencia &&\n digito_agencia == o.digito_agencia &&\n numero_conta == o.numero_conta &&\n digito_conta == o.digito_conta &&\n flag_conta_poupanca == o.flag_conta_poupanca &&\n documento_favorecido == o.documento_favorecido &&\n nome_favorecido == o.nome_favorecido &&\n status == o.status &&\n status_processamento == o.status_processamento\n end",
"def build(base, object, _type = nil, selected_fields = nil)\n if object.is_a?(Hash)\n if _loading? && base.persisted?\n Factory.execute_from_db(klass, object, nil, selected_fields, execute_callbacks: false)\n else\n Factory.build(klass, object)\n end\n else\n clear_associated(object)\n object\n end\n end",
"def user\n {\n id: object.user.id,\n email: object.user.email,\n birthday: object.user.birthday,\n first_name: object.user.first_name,\n middle_name: object.user.middle_name,\n last_name: object.user.last_name,\n phone: object.user.phone,\n gender: object.user.gender,\n neighborships: object.user.neighborships\n }\n end",
"def object\n @obj\n end",
"def valor_nuevo\n begin\n if self.campo =~ /\\w+id$/ && self.value\n row = eval(\"#{self.campo.gsub(\"_id\", \"\").camelize}.find('#{self.value}')\") if self.campo == 'persona_id' && Object.const_defined?(self.campo.gsub(\"_id\", \"\").camelize)\n row ||= eval(\"#{self.campo.gsub(\"_id\", \"\").camelize}.find(#{self.value})\") if Object.const_defined?(self.campo.gsub(\"_id\", \"\").camelize)\n row ||= eval(\"Catalogo.#{self.campo.gsub(\"_id\", \"\")}.find(#{self.value})\") if Catalogo.respond_to?(self.campo.gsub(\"_id\", \"\").downcase)\n vn = (row && row.respond_to?(:descripcion)) ? row.descripcion : nil\n vn ||= (row && row.respond_to?(:persona_id)) ? row.persona.nombre_completo : self.value\n return vn\n else\n return self.value\n end\n rescue SyntaxError, NameError => err\n err\n end\n end",
"def persisted?; false; end",
"def get_database_object\n\t\t\t\t\t$TRACE.debug 5, \"getting database object #{self.database_object} for object #{self.class}:#{self.id}, called by #{caller[0]}\"\n\t\t\t\t\tself.database_object\n\t\t\t\tend",
"def obj_change(obj,klass)\n #raise_if_obj_is_not obj , klass\n session do \n # raise_if_transaction_running\n cmd = klass.to_s.split(\"::\").last.downcase\n transaction do\n self.send(\"#{cmd}_delete\", obj)\n self.send(\"#{cmd}_create\", obj)\n end\n obj_pull obj, klass\n end\n end",
"def save\n if valid?\n entity = to_entity\n User.dataset.save entity\n self.id = entity.key.id\n true\n else\n false\n end\n end",
"def analizarPago(idPago, idFactura)\n sist = Sistema.new\n pago = JSON.parse(sist.obtenerTransaccion(idPago))\n Rails.logger.debug(\"debug:: Se obtuvo el pago\")\n ## Vemos que el pago exista\n if pago[0] == nil\n return false \n end\n if pago[0][\"param\"] == \"id\"\n return false\n end\n Rails.logger.debug(\"debug:: Pago existe\")\n ## Vemos que la factura exista\n factura = JSON.parse(sist.obtenerFactura(idFactura))\n if factura[0] == nil\n return false \n end\n if factura[0][\"param\"] == \"id\"\n return false\n end \n Rails.logger.debug(\"debug:: Factura existe\")\n\n ## Obtenemos la orden de compra de la factura (asumimos que existe)\n idoc = factura[0][\"oc\"]\n oc = JSON.parse(sist.obtenerOrdenDeCompra(idoc))\n Rails.logger.debug(\"debug:: Orden de Compra obtenida\")\n\n ## Comprobamos que el monto sea el correcto\n if factura[0][\"total\"].to_i != pago[0][\"monto\"].to_i\n return false\n end\n Rails.logger.debug(\"debug:: Monto Correcto\")\n\n ## Comprobamos que seamos el destinatario del pago\n if pago[0][\"destino\"] != sist.idBanco\n return false\n end\n Rails.logger.debug(\"debug:: Destinatario Correcto\")\n\n ## Vemos que ese pago no estuviera ya ingresado\n oc = Oc.find_by(pago: idPago)\n if oc != nil\n return false\n end\n sist.facturaPagada(idFactura)\n Rails.logger.debug(\"debug:: El pago es nuevo, se marcó en el sistema como \")\n\n \n ## Actualizamos la oc\n ocBD = Oc.find_by(oc: idoc)\n \n ## La OC es de otro?\n if ocBD == nil\n return false\n end\n \n ocBD.update(estados: \"Pagada\")\n ocBD.update(pago: idPago)\n Rails.logger.debug(\"debug:: Datos actualizados\")\n \n invent = Inventario.new \n invent.definirVariables\n Thread.new do\n Rails.logger.debug(\"debug:: intentamos despachar\")\n ## Gatillamos el envio desde aqui si es posible?\n res = invent.verSiEnviar(idFactura)\n nOtroGrupo = Grupo.find_by(factura: idFactura)[\"nGrupo\"]\n #url = \"http://localhost:3000/api/despacho/recibir/\" + fact[\"_id\"]\n url = \"http://integra\" + nOtroGrupo.to_s + \".ing.puc.cl/api/despacho/recibir/\" + idFactura\n ans = sist.httpGetRequest(url ,nil)\n Rails.logger.debug(\"debug:: le avisamos al otro grupo\")\n\n\n end\n return true \n end",
"def build_from_current_user!(user)\n self.nombres = user.name\n self.email = user.info[\"email\"]\n end",
"def as_json\n\t\t{\n\t\t\t:id => self.id,\n\t\t\t:agencia => self.agencia.as_json,\n\t\t\t:usuario => self.usuario.as_json,\n\t\t}\n\tend",
"def rescatar\n self.estado_id = 1 #salida si lo creo, entrada/foliado si lo redirijo\n self.estado_id = 3 if self.trazas.count(:conditions => 'movimiento_id in (2,7,8)') > 0\n if self.origen.externo\n RAILS_DEFAULT_LOGGER.info \"devolviendo de origen externo #{self.origen.to_label} a #{self.documento.buzon}\"\n self.buzon_id = self.documento.buzon_id\n else\n self.buzon_id = self.origen_id\n end\n self.add_traza(current_user.id, 14, current_user.puesto.buzon_id)\n self.save!\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 save\n temp = eval(self.class.name.to_s + \".find(\" + self.id.to_s + \")\") unless self.new_record? ## moze to zmienic, zeby nie odwolywac sie dodatkowo do bazy ? ;)\n \n ##DO ZMIANY PO ZAINSTALOWANIU BORTA \n self.edited_by = 33\n #self.edited_by = current_user.id\n self.user_stamp = @user_stamp\n \n wrk1 = self.changed? & !self.new_record?\n wrk2 = super\n\n archiving temp unless !(wrk1 & wrk2)\n \n wrk2\n end",
"def update_from_object(obj)\n\t\tfor to_type,fields in [[\"to_block_length\",%w{x y z stance}],[\"to_rotation_in_degrees\",%w{yaw pitch}],[\"to_i\",[\"is_on_ground\"]]]\n\t\t\tfor field in fields do\n\t\t\t\t#puts \"checking field #{field}\"\n\t\t\t\tif obj.respond_to?(field)\n\t\t\t\t\tinstance_variable_set(\"@\"+field,obj.send(field).send(to_type))\n\t\t\t\t#\tputs \"\\tset field #{field} to value #{obj.send(field)} enforcing type #{to_type}\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\tend\n\tend",
"def hacerOcDB(oc_id)\n\tif (Oc.find_by(_id: oc_id) != nil)\n\t\tputs \"xxxYA EXIXTExxx\"\n\t\treturn false\n\telse\n\t\trequest= RequestsOc.new\n\t\tparamsOc = request.obtenerOc(oc_id)\n\t\tif(paramsOc==false)\n\t\t\treturn false\n\t\tend\n\t\tocGenerada = Oc.new(paramsOc)\n\t\tocGenerada.save\n\t\treturn ocGenerada\n\tend\n\nend",
"def data needed=nil\n unless @data\n @data = {\n obj_type_singular: object_type,\n obj_type_plural: object_type(true),\n human_name: human_name(false, false),\n human_name_capitalize: human_name(false, true),\n human_name_plural: human_name(true, false),\n human_name_plural_capitalize: human_name(true, true)\n }\n # templateData.subs.picdata ||= templateData.subs.picurl || \"/assets/NoPictureOnFile.png\" # Default\n\n if @object\n toget = needed || (@object.class.mass_assignable_attributes + [:id])\n toget.each { |key|\n key = key.to_sym\n @data[key] = @object.send(key) if @object.respond_to? key\n }\n end\n end\n @data\n end",
"def to_database\n {\n type: self.class.name,\n params: params,\n # account: Current.account,\n }\n\n end",
"def guarda_nombres_comunes_todos\n dame_nombres_comunes_todos\n\n if x_nombre_comun_principal.present?\n a = adicional ? adicional : Adicional.new(especie_id: id)\n a.nombres_comunes = x_nombres_comunes.encode('UTF-8', {invalid: :replace, undef: :replace, replace: ''})\n a.nombre_comun_principal = x_nombre_comun_principal.force_encoding(\"UTF-8\")\n\n if a.changed?\n a.save\n reload\n end\n end\n end",
"def destinatario\n user = User.find(self.recibe_id) if self.recibe_id\n destinatario ||= user.persona.nombre_completo if user && user.persona\n return destinatario\n end",
"def crear_en_bloque\r\n if current_user.nil?\r\n redirect_to(log_in_path) and return\r\n end\r\n\r\n ActiveRecord::Base.transaction do\r\n params[:alumno_id].each do |alumno|\r\n @asistencia_alumno_persona_vinculada = Asistencia.new(\r\n :anio_alumno_id => AnioAlumno.find_by_anio_escolar_id_and_alumno_id(anio_escolar.id, alumno).id,\r\n :fecha_hora => Time.now,\r\n :persona_vinculada_id => params[:persona_vinculada_id],\r\n :usuario => current_user.usuario,\r\n :tipo_movimiento => 2\r\n )\r\n\r\n if !@asistencia_alumno_persona_vinculada.save\r\n flash[:notice] = 'Ocurrio un error al registrar la salida'\r\n format.html { render action: \"consultar\" }\r\n else\r\n if @guardados.nil?\r\n @guardados = [@asistencia_alumno_persona_vinculada.id]\r\n else\r\n @guardados.push(@asistencia_alumno_persona_vinculada)\r\n end\r\n \r\n @notificar = AlumnoPersonaVinculada.notificar_salida(alumno)\r\n if [email protected]?\r\n @notificar.each do |alumnopersona|\r\n if alumnopersona.persona_vinculada_id != params[:persona_vinculada_id]\r\n @persona = PersonaVinculada.find(alumnopersona.persona_vinculada_id)\r\n @alumno = Alumno.find(alumno)\r\n AsistenciaMailer.delay.notificar_asistencia(2, @alumno, @asistencia_alumno_persona_vinculada, @persona) ## Asincrono\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n tipo = PersonaVinculada.find(params[:persona_vinculada_id]).tipo_documento\r\n numero = PersonaVinculada.find(params[:persona_vinculada_id]).numero_documento\r\n redirect_to :controller => 'alumnos_personas_vinculadas', :action => 'consultar',\r\n :tipo_documento => tipo, :numero_documento => numero\r\n end",
"def dbrow_serialization\n dbrow = super[\"dbrow\"]\n dbrow[:xml] = self.xml\n dbrow.delete(:_xml_entity_created_by)\n dbrow.delete(:_xml_entity_created_at)\n dbrow.delete(:_xml_entity_modified_by)\n dbrow.delete(:_xml_entity_modified_at)\n\n {\n \"dbrow\" => dbrow\n }\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n type == o.type &&\n state == o.state &&\n country == o.country &&\n street == o.street &&\n postal_code == o.postal_code &&\n city == o.city &&\n phone_country == o.phone_country &&\n phone_number == o.phone_number &&\n email == o.email &&\n ip == o.ip &&\n address_description == o.address_description &&\n identification_number == o.identification_number &&\n identification_type == o.identification_type &&\n lang == o.lang &&\n name == o.name &&\n first_name == o.first_name &&\n middle_name == o.middle_name &&\n last_name == o.last_name &&\n birth_date == o.birth_date &&\n occupation == o.occupation &&\n nationality == o.nationality &&\n legal_entity_type == o.legal_entity_type &&\n registration_date == o.registration_date &&\n registration_number == o.registration_number &&\n nature_of_business == o.nature_of_business &&\n source_of_funds == o.source_of_funds &&\n custom_source_of_funds == o.custom_source_of_funds &&\n core_business_activity == o.core_business_activity &&\n purpose_of_opening_account == o.purpose_of_opening_account &&\n office_phone == o.office_phone &&\n vat_registration_number == o.vat_registration_number &&\n financial_regulator == o.financial_regulator &&\n regulatory_licence_number == o.regulatory_licence_number &&\n contact_person_email == o.contact_person_email &&\n trading_country == o.trading_country &&\n trading_address == o.trading_address &&\n trading_name == o.trading_name &&\n number_monthly_transactions == o.number_monthly_transactions &&\n amount_monthly_transactions == o.amount_monthly_transactions &&\n documents == o.documents &&\n metadata == o.metadata &&\n errors == o.errors &&\n onboarding_status == o.onboarding_status &&\n politically_exposed_people == o.politically_exposed_people &&\n external_id == o.external_id &&\n city_of_birth == o.city_of_birth &&\n country_of_birth == o.country_of_birth &&\n gender == o.gender &&\n sales_lead_id == o.sales_lead_id &&\n created_at == o.created_at &&\n company_office_number == o.company_office_number &&\n company_office_number_country == o.company_office_number_country &&\n aml_officer_email == o.aml_officer_email &&\n aml_officer_phone == o.aml_officer_phone &&\n aml_officer_phone_country == o.aml_officer_phone_country &&\n company_website_url == o.company_website_url &&\n number_of_employees_in_company == o.number_of_employees_in_company &&\n list_of_countries_of_operation == o.list_of_countries_of_operation &&\n estimated_annual_revenue_turnover == o.estimated_annual_revenue_turnover &&\n declaration == o.declaration\n end",
"def object_data\n raise NotImplementedError, 'Subclass of EVSSClaimBaseSerializer must implement object_data method'\n end",
"def persisted? ; false ; end",
"def logear_usuario(nombre_de_usuario,clave_de_usuario)\n @usuario_actual = validar_usuario(nombre_de_usuario,clave_de_usuario)\n @usuario_actual.logear\n end",
"def update_obj(obj) # :nodoc:\n chk_conn\n tx = @hibernate_session.begin_transaction\n @hibernate_session.update(obj)\n tx.commit\n obj\n end",
"def createuser(clazz, info, gender, location, pass = 'webeng12')\n ret = clazz.new\n info.each_pair do |k, v|\n ret[k] = v\n end\n ret.gender = Gender.find_by_sex(gender)\n ret.location = Location.find_by_postal_code(location)\n ret.password, ret.password_confirmation = pass, pass \n ret\nend",
"def valid?\n super && !object.nil?\n end",
"def init_by_user(user)\n return self unless user\n self.user = user\n self.name = user.name\n self.email = user.email\n self\n end",
"def init_jaxb_json_hash(_o)\n if !_o['id'].nil?\n _oa = _o['id']\n if(_oa.is_a? Hash)\n @id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @id = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @id = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @id.push String.from_json(_item)\n else\n @id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @id = _oa\n end\n end\n if !_o['createDt'].nil?\n _oa = _o['createDt']\n if(_oa.is_a? Hash)\n @createDt = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @createDt = Time.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @createDt = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @createDt.push Time.from_json(_item)\n else\n @createDt.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @createDt = _oa\n end\n end\n if !_o['updateDt'].nil?\n _oa = _o['updateDt']\n if(_oa.is_a? Hash)\n @updateDt = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @updateDt = Time.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @updateDt = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @updateDt.push Time.from_json(_item)\n else\n @updateDt.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @updateDt = _oa\n end\n end\n if !_o['updateBy'].nil?\n _oa = _o['updateBy']\n if(_oa.is_a? Hash)\n @updateBy = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @updateBy = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @updateBy = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @updateBy.push String.from_json(_item)\n else\n @updateBy.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @updateBy = _oa\n end\n end\n if !_o['deleteDt'].nil?\n _oa = _o['deleteDt']\n if(_oa.is_a? Hash)\n @deleteDt = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @deleteDt = Time.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @deleteDt = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @deleteDt.push Time.from_json(_item)\n else\n @deleteDt.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @deleteDt = _oa\n end\n end\n end",
"def user\n UserSerializer.new(object.user).attributes\n end",
"def deserialized?\n true\n end",
"def build_from_database(data)\n return nil if data.blank?\n \n # Create an instance of the object\n obj = self.new(data['data'])\n obj.raw_data = data\n obj\n end",
"def set_empresa\n @empresa = Empresa.first\n end",
"def set_objeto\n @objeto = Objeto.find(params[:id])\n end",
"def set_objeto\n @objeto = Objeto.find(params[:id])\n end",
"def set_objeto\n @objeto = Objeto.find(params[:id])\n end",
"def set_objeto\n @objeto = Objeto.find(params[:id])\n end",
"def build(base, object, type = nil, selected_fields = nil)\n return object unless object.is_a?(Hash)\n if _loading?\n Factory.from_db(klass, object, nil, selected_fields)\n else\n Factory.build(klass, object)\n end\n end",
"def persistent(obj)\n (@persistent ||= {})[obj.object_id] = true\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id_conta == o.id_conta &&\n id_pessoa == o.id_pessoa &&\n id_cartao == o.id_cartao &&\n id_bandeira == o.id_bandeira &&\n id_tipo_cartao == o.id_tipo_cartao &&\n numero_cartao == o.numero_cartao &&\n nome_plastico == o.nome_plastico &&\n cvv2 == o.cvv2 &&\n data_geracao == o.data_geracao &&\n data_validade == o.data_validade &&\n cpf == o.cpf &&\n tipo_portador == o.tipo_portador &&\n trilha1 == o.trilha1 &&\n trilha2 == o.trilha2 &&\n trilha_cvv1 == o.trilha_cvv1 &&\n trilha_cvv2 == o.trilha_cvv2 &&\n flag_virtual == o.flag_virtual &&\n nome_bandeira == o.nome_bandeira &&\n flag_titular == o.flag_titular &&\n sequencial_cartao == o.sequencial_cartao &&\n id_status == o.id_status &&\n descricao_status_cartao == o.descricao_status_cartao &&\n data_status == o.data_status &&\n id_estagio == o.id_estagio &&\n descricao_estagio == o.descricao_estagio &&\n data_estagio == o.data_estagio &&\n numero_bin == o.numero_bin &&\n id_produto == o.id_produto &&\n descricao_produto == o.descricao_produto &&\n id_status_conta == o.id_status_conta &&\n descricao_status_conta == o.descricao_status_conta &&\n data_embossing == o.data_embossing &&\n codigo_desbloqueio == o.codigo_desbloqueio &&\n nome_pessoa == o.nome_pessoa &&\n tipo_pessoa == o.tipo_pessoa &&\n data_nascimento == o.data_nascimento &&\n id_endereco == o.id_endereco &&\n id_tipo_endereco == o.id_tipo_endereco &&\n descricao_tipo_endereco == o.descricao_tipo_endereco &&\n cep == o.cep &&\n logradouro == o.logradouro &&\n numero_endereco == o.numero_endereco &&\n complemento_endereco == o.complemento_endereco &&\n bairro == o.bairro &&\n cidade == o.cidade &&\n uf == o.uf &&\n pais == o.pais &&\n senha_criptografada == o.senha_criptografada &&\n icvv == o.icvv &&\n id_status_impressao == o.id_status_impressao\n end"
] | [
"0.6005672",
"0.57852143",
"0.57479227",
"0.57031995",
"0.5674326",
"0.56485367",
"0.55354387",
"0.55126214",
"0.55069363",
"0.5505872",
"0.55039835",
"0.55016184",
"0.54981256",
"0.54905915",
"0.5433577",
"0.5423064",
"0.5406326",
"0.53848165",
"0.5382944",
"0.5381717",
"0.5363068",
"0.5357578",
"0.53314275",
"0.53182834",
"0.5298083",
"0.5289176",
"0.52864975",
"0.523283",
"0.523283",
"0.5232699",
"0.5210497",
"0.5205329",
"0.51908547",
"0.5166981",
"0.51582015",
"0.5155082",
"0.5154277",
"0.5152833",
"0.51361376",
"0.5129332",
"0.51269805",
"0.5114475",
"0.51013255",
"0.5098585",
"0.5096613",
"0.5090216",
"0.50881815",
"0.50828046",
"0.50823855",
"0.5076683",
"0.507332",
"0.50667405",
"0.50612545",
"0.5052325",
"0.5048335",
"0.5048324",
"0.50449353",
"0.50400674",
"0.50327164",
"0.5031612",
"0.5023937",
"0.50201416",
"0.50160915",
"0.5015564",
"0.5006973",
"0.50057375",
"0.5000497",
"0.4998114",
"0.4994608",
"0.49855796",
"0.4985027",
"0.49844444",
"0.4971101",
"0.4969147",
"0.4961184",
"0.4953757",
"0.4953626",
"0.49476913",
"0.49362627",
"0.4933627",
"0.49318582",
"0.49293125",
"0.49284968",
"0.49259803",
"0.49210387",
"0.49189714",
"0.4912002",
"0.49053594",
"0.49029514",
"0.4898781",
"0.48974058",
"0.48958823",
"0.48950464",
"0.48893195",
"0.48883015",
"0.48883015",
"0.48883015",
"0.4888275",
"0.48875576",
"0.4884955",
"0.48830265"
] | 0.0 | -1 |
metodo que verifica la existencia de la variable (se usa a mano en donde se ocupe) | def var_verify(variable)
begin
if variable
return true
end
rescue ActiveRecord::RecordNotFound
# handle not found error
logger.error "no se encontro el registro que se solicito"
puts "-------------------------------------------------------------"
puts "no se encontro el Record"
puts variable.inspect
puts "-------------------------------------------------------------"
return false
rescue ActiveRecord::ActiveRecordError
# handle other ActiveRecord errors
logger.error ("hubo un error en el ActiveRecord" + logger.debug)
rescue # StandardError
# handle most other errors
rescue Exception
# handle everything else
puts "-------------------------------------------------------------".
puts "ocurrio una excepcion"
puts variable.inspect
puts "-------------------------------------------------------------"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variable_exists?(id) #method\n @variables.key?(id)\n end",
"def invariable?\n false\n end",
"def variable?\n !@variable_id.nil?\n end",
"def instance_variable_defined?(p0) end",
"def variable_exists(name)\n assert_type name, :String, :name\n bool(environment.caller.var(name.value))\n end",
"def hasVar?( name )\n\t\t\t\tArgTest::type( \"name\", name, String )\n\t\t\t\tname.strip!()\n\t\t\t\tArgTest::stringLength( \"name\", name, 1 )\n\t\t\t\treturn @vars.has_key?( name )\n\t\t\tend",
"def variable?\n not constant?\n end",
"def variable_definition?\n @variable\n end",
"def get_variable( var_name)\n\t\tvar = Vim::evaluate(\n\t\t\t\"exists(\\\"#{var_name}\\\") ? #{var_name} : \\\"__NIL__\\\"\"\n\t\t)\n\n\t\tvar == '__NIL__' ? nil : var\n\tend",
"def include_variable?\n VariableTable.check_include_variable(@value)\n end",
"def var_exist?(name, scope=@@scope_no)\n scope.downto(0).each do |idx|\n if @@variable_list.at(idx).has_key?(name) then return idx end\n end\n return -1\nend",
"def is_variable(element)\n !(@cfg.variables.index(element) == nil)\n end",
"def exist?\n nil\n end",
"def check_var(varname,var=nil)\n var.nil? and fail \"Requires #{varname} be set!\"\n var\nend",
"def include_variable?\n return VariableTable.check_include_variable(@content)\n end",
"def defined?(name); end",
"def defined?(name); end",
"def exist?\n not self.name.nil?\n end",
"def value_loaded?(name)\n !self.instance_variable_get(\"@#{name}\").nil?\n end",
"def defined?\n false\n end",
"def available_variable?(name)\n # if the current scope is already using the variable, it's\n # unavailable.\n return false if variable?(name)\n\n # if any of the child scopes reference the variable as a\n # parent variable, it's not available.\n !any_child_references_parent_variable?(name)\n end",
"def has_var name\n raise \"has_var #{name}.#{name.class}\" unless name.is_a? Symbol\n index = has_arg(name)\n return index if index\n has_local(name)\n end",
"def has_variable?(variable)\n return true if internal?(variable)\n if variable.kind_of?(ScopedVariable)\n return false unless has_variable?(variable.scope)\n scope_id = variable_id(variable.scope)\n else\n scope_id = TOPLEVEL_SCOPE_ID\n end\n id = @internal_evaluator.select(\n [\"variable_id\"],\n \"variables\",\n [\"scope_id\", \"variable_name\"],\n [scope_id, variable.name]\n )\n raise DataError, \"More than one table id for table #{variable.to_s}.\" if id.length > 1\n !id.empty?\n end",
"def exist? ; ! @element.nil? ; end",
"def find_variable(key, raise_on_not_found: T.unsafe(nil)); end",
"def var_present?(var)\n !ENV[var].nil? && !ENV[var].empty?\n end",
"def exists?(param_name)\n return !@h[param_name].nil?\n end",
"def exists?; end",
"def exist?\n !!@exist\n end",
"def exist?\n !!@exist\n end",
"def if_fn(name)\n ivar_name = \"@#{name}\".to_sym\n lambda do |opts|\n if opts[:user_options] && opts[:user_options][:skip_undefined]\n if respond_to?(:key?)\n self.key?(name) || instance_variable_defined?(ivar_name)\n else\n instance_variable_defined?(ivar_name)\n end\n else\n true\n end\n end\n end",
"def data_exist?(parameter)\n !parameter.nil? && !parameter.empty?\n end",
"def exists?\n # Always true if the object is not set as reference\n return true unless reference?\n # If we have a value, return it\n return @exists unless @exists.nil?\n ensure_grpc!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def exists?\n # Always true if the object is not set as reference\n return true unless reference?\n # If we have a value, return it\n return @exists unless @exists.nil?\n ensure_grpc!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def exist\n\treturn true\n end",
"def exists?(name)\n self[name] != nil\n end",
"def local_variable_defined_for_node?(node, name); end",
"def class_variable_defined?(sym) end",
"def exist?\n true\n end",
"def exists? name\r\n\t\t\tunless @data[name].nil?\r\n\t\t\t\ttrue\r\n\t\t\telse\r\n\t\t\t\tfalse\r\n\t\t\tend\r\n\t\tend",
"def include_variable?\n @elements.any?{|elt| elt.include_variable?}\n end",
"def exists?\n !@not_found\n end",
"def exists?(monkey)\n true unless get(monkey).nil?\n end",
"def check_vars\n @to_load.each do |hash|\n assert_not_nil(instance_variable_get(hash[:name]))\n end\n end",
"def existent; end",
"def exists?\n data != {}\n end",
"def defined?\n not undefined?\n end",
"def valid?(lookup, global)\n fake = global[lookup] || {}\n fake.values.all?(&:empty?)\n end",
"def exists?\n\t\treturn false\n\tend",
"def thread_variable?(key)\n _locals.has_key?(key.to_sym)\n end",
"def is_variable_available\n super\n end",
"def has_value?(p0) end",
"def missing?\n @missing\n end",
"def variable?\n any? {|op| op.respond_to?(:variable?) && op.variable?}\n end",
"def exist?(key)\n !find(key).nil?\n end",
"def has?(arg)\n !!find(arg)\n end",
"def has_value?\n false\n end",
"def exist?\n !find_exists.nil?\n end",
"def exist?(cccc)\n not find_data_by_cccc(cccc).nil?\n end",
"def present?(name)\n val = self[name]\n !(val.nil? || val.empty?)\n end",
"def class_variable_defined?(arg0)\n end",
"def dictionary_exist?(dic_name)\n\t\t@db::Dictionary.where(:title => dic_name).present?\n\tend",
"def exists? obj\n not [obj].nil?\n end",
"def include_variable?\n # FIXME\n @table.values.any?{|val| val.include_variable?}\n end",
"def include?(value)\n !get(value).nil?\n end",
"def exist?(cccc)\n !find_data_by_cccc(cccc).nil?\n end",
"def checkable?\n @variables.each { |variable|\n return false unless variable.instantiated?\n }\n true\n end",
"def is_existing?()\n #p \"randomize is_existing flag\"\n false\n end",
"def exists?()\n #This is a stub, used for indexing\n end",
"def has_value?\n true\n end",
"def include_variable?\n @expr.include_variable?\n end",
"def defined?(value_key)\n true\n end",
"def exists?\n [email protected]? && @exists\n end",
"def exists?\n [email protected]? && @exists\n end",
"def include_variable?\n @blocks.values.any?{|block| block.include_variable?}\n end",
"def exist?\n @exists\n end",
"def elem_exists(elem)\n\t\treturn eval(\"@browser.\"+elem+\".exists?\")\n end",
"def exists?\n [email protected]?\n end",
"def exists?(name)\n get(name).exists?\n end",
"def exists?\n !data.empty?\n end",
"def exist_name(name)\n @names.value?(name)\n end",
"def has?(session_variable)\n !! get(:session_variable)\n end",
"def exists?()\n end",
"def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end",
"def exists?\n false\n end",
"def exists?\n false\n end",
"def exists?\n [email protected]? && @exists\n end",
"def exists?\n [email protected]? && @exists\n end",
"def exists?\n [email protected]? && @exists\n end",
"def exists?(path)\n !!scope.get(path)\n end",
"def definition_required?\n # We have to distinguish the false value from the non\n # existence of the variable. Therefore the ||= operator\n # can't help us.\n if @definition_required.class.kind_of?(NilClass)\n\t @definition_required = true\n else\n @definition_required\n end\n end",
"def has?(param)\n \tparam and param.length > 0\n end",
"def loaded?(resource)\n resource.instance_variable_defined?(instance_variable_name)\n end",
"def has?(item)\r\n ! @contents[item].nil?\r\n end",
"def look_up(variable)\n \ti = @@scope\n \twhile(i>=@@scope_base.last)\n \tif @@variables[i][variable] != nil\n \t\treturn @@variables[i][variable][0]\n \t\tputs \"#{@@variables[i][variable]} is found\" if (@@Debug)\n \t\t#return var[0]\n \tend\n \ti -= 1\n \tend\n \tputs \"Variable '#{variable}' does not exist.\"\n \t:FALSE\nend",
"def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend",
"def ivar_defined?(name)\n instance_variable_defined?(\"@#{name}\")\n end",
"def contains?(key)\n not get(key).nil?\n end",
"def local_variable_defined_for_node?(node, name)\n match(node) do |current|\n current.include?(name)\n end\n end",
"def existential_vars\n @existentials ||= vars.select(&:existential?)\n end"
] | [
"0.72650063",
"0.7253521",
"0.7211516",
"0.7176143",
"0.71503454",
"0.7125426",
"0.70509857",
"0.6996074",
"0.696279",
"0.6949997",
"0.6882179",
"0.6824669",
"0.680964",
"0.67310625",
"0.6692534",
"0.65885967",
"0.65885967",
"0.65701616",
"0.65647644",
"0.6556827",
"0.6549507",
"0.65489936",
"0.6503593",
"0.649357",
"0.6493411",
"0.6485619",
"0.64228034",
"0.64161897",
"0.6402483",
"0.6402483",
"0.6396858",
"0.63761353",
"0.63716185",
"0.63716185",
"0.6360831",
"0.6358235",
"0.63571346",
"0.6354911",
"0.6328534",
"0.6325825",
"0.63256913",
"0.6293356",
"0.6289794",
"0.6284633",
"0.6276045",
"0.6256567",
"0.62460613",
"0.62455076",
"0.6238151",
"0.6236076",
"0.6225576",
"0.62235075",
"0.6216833",
"0.62104243",
"0.62098926",
"0.61983126",
"0.61969036",
"0.6170024",
"0.6167812",
"0.6165106",
"0.6164584",
"0.616202",
"0.6160629",
"0.61601925",
"0.61301786",
"0.6128406",
"0.61203355",
"0.6116946",
"0.61161935",
"0.61139673",
"0.610984",
"0.6109283",
"0.6108774",
"0.6108774",
"0.6108168",
"0.6105853",
"0.61023605",
"0.6084769",
"0.6077145",
"0.60737777",
"0.6059252",
"0.60572016",
"0.6053019",
"0.6038256",
"0.60332334",
"0.60332334",
"0.6031061",
"0.6031061",
"0.6031061",
"0.6029553",
"0.60289437",
"0.6026591",
"0.6024103",
"0.60236067",
"0.6019837",
"0.6005308",
"0.6005209",
"0.5996326",
"0.598818",
"0.59849465"
] | 0.65192956 | 22 |
funcion que administra los errores de servidor | def server_error(exception)
# Whatever code that handles the exception
ExceptionNotifier.notify_exception(exception,
:env => request.env, :data => {:message => "was doing something wrong"})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_error\n\n end",
"def server_errors; end",
"def server_error?; end",
"def error(x, status:200, type:\"request\", title:\"An error occurred\", message:\"\", args: [])\n x.res.status = status\n if App[:app_error][type.to_sym]\n App[:app_error][type.to_sym][:get][x, title, message, *args]\n else\n x << \"ERROR: #{title} - #{message}\"\n end\n end",
"def error\r\n\t\t\t`#{BITS::BITSADMIN} /geterror {#{@id}}`\r\n\t\tend",
"def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"def send_error(e, res)\n res.code = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"def mensaje_error(mensaje)\n\t\tmostrar_mensaje 31, mensaje\n\tend",
"def error(ex) [:error, ex]; end",
"def error\n expires_in 1.month, public: true\n set_metadata({ 'title' => translate('errors.error') })\n render status: request.env['PATH_INFO'][1, 3].to_i\n end",
"def error\n expires_in 1.month, public: true\n set_metadata({ 'title' => translate('errors.error') })\n render status: request.env['PATH_INFO'][1, 3].to_i\n end",
"def server_error\n messages = [\"Captain!\", \"Man overboard!\", \"Ekk!\"]\n MsteamsNotifier::Message.quick_message \"#{messages.sample} We've had a 500 error at #{request.referrer}\"\n render status: 500, layout: \"dash/error\"\n end",
"def severe_error(note =\"\", excpt)\n if @controller and @controller.class < ApplicationController\n @controller.expires_now\n @controller.head :internal_server_error,\n x_error_details: 'Something is wrong with this relay. Try again later.'\n end\n _log_exception ERROR,note,excpt\n end",
"def foreign_server_failure\n [ 503, {'Content-Type'=>'text/plain', 'Content-Length' => '23'},\n ['Foreign server failure.'] ]\n end",
"def error\n end",
"def before_server_error(exception); end",
"def error\n render plain: '500 Internal Server Error', status: :internal_server_error\n end",
"def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end",
"def client_error(e, client); end",
"def errmsg(message); end",
"def error\n end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"def errorhandling\n end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def err_mex \n flash.now[:notice] = \"Non sei il possessore di questo feed e non detieni i privilegi per alterarlo!\" \t\t\t\n render \"show\"\n end",
"def errores_listado\n if self.errores.to_i > 0\n \"<span class=\\\"error b\\\">#{self.errores}</span>\"\n else\n errores\n end\n end",
"def error\n\tputs \" - Dis donc #{@name}, tu vois pas que c'est pas possible ?!? Allez rejoue ! \"\n\tputs \" \"\n end",
"def client_error?; end",
"def error(url); end",
"def friendly_error(e)\n case e\n when Ncio::Support::RetryAction::RetryException::Timeout\n 'Timeout expired connecting to the console service. Verify it is up and running.'\n when OpenSSL::SSL::SSLError\n friendly_ssl_error(e)\n when Ncio::Api::V1::ApiAuthenticationError\n 'Make sure the --cert option value is listed in the certificate whitelist, '\\\n 'and you are able to run puppet agent --test on the master. '\\\n 'The certificate whitelist on the master is located at '\\\n '/etc/puppetlabs/console-services/rbac-certificate-whitelist'\n else\n e.message\n end\n end",
"def errback(http)\n raise \"Web API rtm.start failed: #{http.error}\"\n end",
"def error(exception) nil ; end",
"def hastur_error!(code=501, message=\"FAIL\", bt=[])\n error = {\n :status => code,\n :message => message,\n :backtrace => bt.kind_of?(Array) ? bt[0..10] : bt\n }\n\n # remove this after getting the loggers to do the right thing\n STDERR.puts MultiJson.dump(error, :pretty => true)\n\n if self.is_a? Grape::API\n throw :error, error\n elsif self.is_a? Sinatra::Base\n error[:url] = request.url\n halt serialize(error, {})\n else\n abort \"BUG: not a Grape::API or Sinatra::Base\"\n end\n end",
"def error\n @error_response\n end",
"def error!(text, **message)\n\t\t\t\t\tmessage[:errno] ||= -1\n\t\t\t\t\t\n\t\t\t\t\tsend(status: text, **message)\n\t\t\t\tend",
"def serve_exception(_exception); end",
"def error\n\t\t@page_title = '500 Error'\n\t\t@url_path = get_path\n\t\tflash.now[:error] = \"An error occurred while attempting to access ‘#{@path}’.\"\n\t\trender :action=>'error', :status=>'500 Error'\n\tend",
"def error!(url); end",
"def connection_error(error, req, text = T.unsafe(nil)); end",
"def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend",
"def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend",
"def status_error\n @status = 500\n end",
"def default_errors!\n configure :production do\n error ::Exception do\n boom = env['sinatra.error']\n logger.error [\"#{boom.class} - #{boom.message}:\", *boom.backtrace].join(\"\\n \")\n response.status = 500\n content_type 'text/html'\n '<h1>Internal Server Error</h1>'\n end\n end\n end",
"def server_error_status_code\n _undefined\n end",
"def check_error(response) #:nodoc:\n case response.code\n when 200 then # ignore, ok\n when 500 then\n raise Error, 'server error'\n when 601 then\n raise AddressError, 'missing address'\n when 602 then\n raise AddressError, 'unknown address'\n when 603 then\n raise AddressError, 'unavailable address'\n when 610 then\n raise CredentialsError, 'invalid key'\n when 620 then\n raise CredentialsError, 'too many queries'\n else\n raise Error, \"unknown error #{response.code}\"\n end\n end",
"def failed_message\n Online::OPERATION_FAILED_ADVICES[@data['error_code'].to_i || \"Errore sconosciuto (#{error_code})\"]\n end",
"def error!(status, message)\n request.halt status, {error: message}.to_json\n end",
"def error!(status, message)\n request.halt status, {error: message}.to_json\n end",
"def error(nvae)\n end",
"def raise_api_error_msg(res)\n \"HTTP status code: #{res.status}, \" \\\n \"Error message: #{res.body['message']}, \" \\\n \"Reference: #{res.body['reference']}\"\n end",
"def error(event, msg, code=500, trace = [])\n title = case code\n when 400\n \"Bad Request (400)\"\n when 401\n \"Unauthorized Request\"\n when 403\n \"Access Restricted\"\n when 404\n \"Page Not Found\"\n when 405\n \"HTTP Method Not Allowed\"\n else\n \"An Error Has Occured\"\n end\n @content = render('error', {title: title, message: msg, error_code: code, trace: trace})\n warnlog 'Error handler called with \"' << msg << '\", code ' << code.to_s << ' (trace: ' << trace.to_s << ')'\n end",
"def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n response.write({error: message}.to_json)\n request.halt\n end",
"def display_http_error(error)\n display_error(\"\\e[33;1m#{error[:code]} #{Rack::Utils::HTTP_STATUS_CODES[error[:code].to_i]\n }\\e[0m for \\e[34;1m#{error[:url]}\\e[0m\")\n end",
"def errno; end",
"def error\n params[\"ErrDesc\"]\n end",
"def handleError(msg)\n # For right now, throw an exception\n raise \"Error in obtaining information from LIMS. \" +\n \"Error from LIMS : \" + msg\n end",
"def error(*args); end",
"def err(cod)\n @st = :err\n @ie = cod\n end",
"def invalid_request(obj, code, message=nil)\n $stderr.puts \"error #{code}: #{message}\"\n end",
"def internal_server_error(exception = nil)\n error_rendering exception, __callee__\n end",
"def error_message; end",
"def err\n @err\n end",
"def resp_error(message = '')\n # {code: 300, message: message}\n error!({code: 300, message: message}, 300)\n end",
"def render_error(msg, status)\n render_403\n end",
"def output_error(cmd)\n puts \"La commande '#{cmd}' n'existe pas ou a été mal formulée.\".red\n end",
"def error\n\t\t\t\t\"ERROR\"\n\t\t\tend",
"def error\r\n @error\r\n end",
"def manage_errors event, client\n\n puts \"Error Counter #{ @@error_counter }\"\n \n @@error_counter += 1\n\n if @@error_counter > 5\n client.chat_postMessage(channel: event.channel, text: \"This is really fishy now. Why are you doing this? :unamused: Please be nice or type `help` to find my commands.\", as_user: true)\n elsif @@error_counter > 2 and @@error_counter <= 4\n client.chat_postMessage(channel: event.channel, text: \"Hmmm, you seem to be different today :thinking_face:. Hope all is well. Anyways, type `help` to find my commands.\", as_user: true) \n else\n client.chat_postMessage(channel: event.channel, text: \"I didn't get that but that's alright. If you're stuck, type `help` to find my commands.\", as_user: true)\n end\n end",
"def error_message\n if error == 'on_reserve'\n 'another user has already reserved this item'\n elsif error == 'too_many'\n \"you cannot renew a loan more than 10 times\"\n elsif code == 'PatronNotFound'\n 'problem with user id - please contact an administrator for assistance'\n end\n end",
"def api_error; end",
"def handle_errored_login(code)\n Log.error(\"error code #{code}.\")\n end",
"def mssql_send_error( msg )\n return [\n Constants::TDS_MSG_RESPONSE,\n 1, # status\n 0x0020 + msg.length * 2,\n 0x0037, # channel: 55\n 0x01, # packet no: 1\n 0x00, # window: 0\n Constants::TDS_TOKEN_ERROR,\n 0x000C + msg.length * 2,\n 18456, # SQL Error number\n 1, # state: 1\n 14, # severity: 14\n msg.length, # error msg length\n 0,\n msg.unpack('C*').pack('v*'),\n 0, # server name length\n 0, # process name length\n 0, # line number\n \"fd0200000000000000\"\n ].pack(\"CCnnCCCvVCCCCA*CCnH*\")\n end",
"def error msg, e\n # XXX - this sort of sucks\n if msg.query?\n msg.connection.raw \"NOTICE #{msg.nick} :Error: #{e}\"\n else\n msg.connection.raw \"PRIVMSG #{msg.destination} :#{msg.nick}: Error: #{e}\"\n end\n\n $log.error('Command.run') { e }\n $log.error('Command.run') { e.backtrace }\n end",
"def internal_error\n\t\tself.status = 500\n\t\tself.headers = {}\n\t\tself.content = [\"Internal error\"]\n\t\tself\n\tend",
"def on_error(connection, reason)\n end",
"def error(m, e)\n bot.loggers.error e.message\n\n m.reply \"Sorry, something went wrong.\"\n end",
"def render_show_server_error\n\t\trender :action => :show_server_error\n\tend",
"def error_handler\n flash[:notice] = \"Something went wrong here...\"\n end",
"def errored(error)\n @greeting = \"Hi\"\n @error = error\n\n mail to: \"[email protected]\", :subject => 'App Errored'\n end",
"def write_error_info\n end",
"def error(text)\n GitPusshuTen::Log.error(text)\n end",
"def check_conn_error(conn)\n return nil if conn.code == 200\n\n @errors.push(\n time: Time.now.strftime('%d.%m.%Y-%H:%M:%S:%L'),\n code: conn.code,\n message: conn.msg,\n request: conn.request.path.to_s\n )\n end",
"def error_log\n end",
"def error_log\n end",
"def error_log\n end"
] | [
"0.7281446",
"0.6988511",
"0.6832737",
"0.6781073",
"0.67684156",
"0.65982616",
"0.6594593",
"0.65492034",
"0.6532545",
"0.6487213",
"0.64863896",
"0.6448598",
"0.64338565",
"0.64249736",
"0.6399204",
"0.6397197",
"0.6384347",
"0.63229156",
"0.63082665",
"0.6266615",
"0.6261535",
"0.6261164",
"0.6261164",
"0.6261164",
"0.6261164",
"0.6261164",
"0.6261164",
"0.6261164",
"0.62203485",
"0.6213412",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6177453",
"0.6137639",
"0.6130189",
"0.61102015",
"0.60843086",
"0.60791713",
"0.6069464",
"0.6067811",
"0.60605896",
"0.605142",
"0.60417795",
"0.6037861",
"0.60282993",
"0.60253966",
"0.6017654",
"0.6016059",
"0.60156703",
"0.60156703",
"0.6014322",
"0.60130656",
"0.60076475",
"0.5997971",
"0.59770185",
"0.59719175",
"0.59719175",
"0.5965694",
"0.5963276",
"0.5949532",
"0.59149104",
"0.5911758",
"0.58984435",
"0.5896349",
"0.5895373",
"0.5891962",
"0.58878386",
"0.5885639",
"0.5883254",
"0.58653885",
"0.58643585",
"0.5860257",
"0.5859378",
"0.58581936",
"0.58334696",
"0.583334",
"0.5827469",
"0.5825004",
"0.5815624",
"0.5814973",
"0.58066577",
"0.5804926",
"0.5802965",
"0.5795538",
"0.57944983",
"0.5794258",
"0.57876897",
"0.5787129",
"0.5781429",
"0.5777964",
"0.57677317",
"0.57545996",
"0.57545996",
"0.57545996"
] | 0.6070348 | 44 |
funcion que activa las traducciones | def set_locale
I18n.locale = :es || I18n.default_locale
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _activate\n\t\t\tend",
"def activate; end",
"def transact; end",
"def pro_activate\n set_activate\n end",
"def activate()\n end",
"def activate\n @r.activate\n end",
"def activar\n # flash[:notice] = \"klkkkk\"\n \n session[:cliente_id] = \"desktop\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n session[:tipo_cliente] = \"123\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n\n @tipo_cliente = \"desktop\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n @cliente_id = \"123\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n session[:chekeado] = \"chekeado\"\n\n if (session[:terminal_autorizada] == false)\n sign_out(current_user) \n end\n session[:terminal_autorizada] = true\n #creado para complemento (convention over configuration) del controlador del view de acticion de equipos. ok ted.\n end",
"def activate\r\n # puts 'activate'\r\n @@activated = true\r\n @suspended = false\r\n @user_esc = false\r\n @cancel_reason = nil\r\n @enable_redraw = true\r\n end",
"def activate\n @status = true\n end",
"def activer\n DBC.require( !actif?, \"Cours deja actif: #{self}\" )\n\n @actif = true\n end",
"def activate\n self.active = true\n end",
"def inactivate!(reason = nil)\n end",
"def activate\n @active = true\n end",
"def activate!\n @active = true\n end",
"def activate!\n self.status = 'Active'\n nil\n end",
"def activate\n true\n end",
"def activate!\n self.active = true\n save\n end",
"def activar\n\t\t\t#update_attribute(:activado, true)\n\t\t\t#update_attribute(:activado_en, Time.zone.now)\n\t\tupdate_columns(activado: true, activado_en: Time.zone.now)\n\tend",
"def despachar\n self.estado_id = 2 # en ruta\n self.buzon_id = self.destinatario_id\n self.add_traza(current_user.id ,1, current_user.puesto.buzon_id)\n self.recepcion = Time.now\n self.save!\n end",
"def activate!\n self.active = true\n self.save!\n end",
"def activate_trainer\n\t\t@trainer = Trainer.find_by(id: params[:id])\n\t\[email protected] = 1\n\t\tif @trainer.save\n\t\t\tflash[:success] = @trainer.user.name.to_s + \" \" + @trainer.user.surname.to_s + \" został aktywowany\"\n\t\t\tredirect_to trainers_path\n\t\telse\n\t\t\tflash[:danger] = \"Nie udalo sie aktywowac trenera\"\n\t\tend\n\tend",
"def activate\n @activated = true\n self.active = true\n save(false)\n end",
"def set_transaccion\n @transaccion = current_user.transacciones.find(params[:id])\n end",
"def activation_instructions\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.activate!\n save!\n end",
"def activate\n self.active = true\n save\n end",
"def activate\n copy self.class.activate(@id)\n true\n end",
"def activate!\n raise NotImplementedError\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n update_attribute(:status, STATUS[:active])\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.save(false)\n end",
"def activate\n @activated = true\n # self.activated_at = Time.now.utc #此行变更为下一行\n self.activated_at = Time.now\n self.activation_code = nil\n save(false)\n # save\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n self.status = \"Active\"\n end",
"def activate\n self.send(@activation_block)\n end",
"def activate\n (self.class.activate_hooks + activate_hooks).each do |block|\n block.call self\n end\n end",
"def activate\r\n @activated = true\r\n self.activated_at = Time.now.utc\r\n self.activation_code = nil\r\n save(false)\r\n end",
"def create_and_activate\n create\n activate\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @user = User.find(params[:id])\n @user.activate!\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_activated(@user) \n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно активирован.' }\n end\n end",
"def handle_activation(user)\n\t\t\n\tend",
"def reactivacion\r\n\t\tif session[:usuario_id]\r\n\t\t\tenti = Usuarioentidad.where(usuario_id: session[:usuario_id]).take\r\n\t\tend\r\n\t\t#Solamente el consejo de facultad tiene la posibilidad de reactivar instructores\r\n\t\tif session[:usuario_id] && session[:entidad] == true && enti.entidad_id == 13\r\n\t\t\tsession[:adecuacion_id] = nil\r\n\t\t\tsession[:plan_id] = nil\r\n\t\t\tsession[:instructorName] = nil\r\n\t\t\tsession[:informe_id]=nil\r\n\t\t\t@cjpTipo=Usuario.find(session[:usuario_id]).tipo\r\n\t\t\t@nombre = session[:nombre_usuario]\r\n\t\t\t@usu=Usuarioentidad.where(entidad_id: session[:entidad_id]).take\r\n\t\t\t@entidad_escuela_id= @usu.escuela_id\r\n\t\t\t@usuarios = Usuario.where(activo: 0).all\r\n\t\t\t@instructores = []\r\n\t\t\tcpcontador = 0\r\n\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t@instructores[cpcontador][0] = \"Seleccione el instructor\"\r\n\t\t\t@instructores[cpcontador][1] = 0\r\n\t\t\tcpcontador = cpcontador + 1\r\n\r\n\t\t\[email protected] do |usuari|\t\t#Arreglo con los usuarios inahibilitados\r\n\t\t\t\tcppersona = Persona.find_by usuario_id: usuari.id\r\n\t\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t\t@instructores[cpcontador][0] = cppersona.nombres.to_s.split.map(&:capitalize).join(' ') + \" \" + cppersona.apellidos.to_s.split.map(&:capitalize).join(' ')\r\n\t\t\t\t@instructores[cpcontador][1] = usuari.id\r\n\t\t\t\tcpcontador = cpcontador + 1\r\n\t\t\tend\r\n\r\n\t\t\ti = 1\r\n\t\t\tj = 1\r\n\t\t\tnombre = \"hola\"\r\n\t\t\tcpid = 1\r\n\r\n\t\t\t#Ordena los nombres por orden alfabetico (Ordenamiento Burbuja)\r\n\t\t\twhile i < cpcontador do\r\n\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\tj = i + 1\r\n\t\t\t\twhile j < cpcontador do\r\n\r\n\t\t\t\t\tif @instructores[j][0] < nombre\r\n\t\t\t\t\t\t@instructores[i][0] = @instructores[j][0]\r\n\t\t\t\t\t\t@instructores[i][1] = @instructores[j][1]\r\n\t\t\t\t\t\t@instructores[j][0] = nombre\r\n\t\t\t\t\t\t@instructores[j][1] = cpid\r\n\t\t\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\tj +=1\r\n\t\t\t\tend\r\n\t\t\t\ti +=1\r\n\t\t\tend\r\n\r\n\t\telse\r\n\t\t\tredirect_to controller:\"forminst\", action: \"index\"\r\n\t\tend\r\n\tend",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save!\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.make_admin_if_first_user\n save(false)\n end",
"def activate(notify = true)\n self.activation_code = nil\n self.activated_at = Time.now.utc\n @activated = true if notify\n save(false)\n end",
"def activate \r\n logger.info(\"UserController::Activate::Params-----#{params}\")\r\n @update_message=\"\"\r\n begin\r\n input = {\"user\"=>{\"activationCode\"=>params['id']}}\r\n logger.info(\"UserController::Activate:---Input #{input}\")\r\n @activate = smvActivateUser(input, request.env)\r\n logger.info(\"UserController::Activate:---#{@activate}\")\r\n @update_message = I18n.t(\"message.successful_activation\")\r\n rescue Exception => exc\r\n @update_message = I18n.t(\"message.unsuccessful_activation\")\r\n logger.error(\"save_reg::Exception occured #{@update_message}\")\r\n end \r\n end",
"def set_transaccion\n\t\t@transaccion = Transaccion.find(params[:id])\n\tend",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(:validate => false)\n end",
"def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end",
"def activate\n self.status = 'current'\n self.save\n end",
"def active; end",
"def active; end",
"def activate\n update active: true\n end",
"def do_activate\n self.activated_at = Time.now.utc\n self.deleted_at = nil\n end",
"def activate\n change, @active, @acknowledged = !@active, true, false\n update_timestamp if change\n change\n end",
"def enable\n end",
"def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end",
"def activate_adaptations\n\t\[email protected]{ |a| @manager.activate_adaptation(a) }\n\tend",
"def activate\n self.activated_at = Time.now.utc\n self.perishable_token = nil\n save(false)\n end",
"def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end",
"def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end",
"def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end",
"def activate! record\n record.update_column(:active, true)\n end",
"def send_activation_request\n end",
"def _deactivate\n\t\t\tend",
"def activatews(*)\n super\n end",
"def set_transaccion\n @transaccion = Transaccion.find(params[:id])\n end",
"def activate!\n @activated = true\n\n self.active = true\n \n # Authlogic resets the perishable token by default on save, but I'm leaving the call\n # to reset_perishable_token! here directly to help reveal intent (which's is kinda a\n # dead purpose after this long comment, but who cares).\n #\n # This also saves the record.\n #\n reset_perishable_token!\n end"
] | [
"0.6603873",
"0.65292674",
"0.65143627",
"0.64128673",
"0.63732445",
"0.617129",
"0.61607",
"0.61297745",
"0.60468346",
"0.603206",
"0.5944918",
"0.59187263",
"0.5914407",
"0.5877657",
"0.5815545",
"0.5788684",
"0.57590157",
"0.5727486",
"0.5706203",
"0.5695396",
"0.56945753",
"0.5676354",
"0.5675524",
"0.56730205",
"0.56612754",
"0.56344646",
"0.5615084",
"0.56084687",
"0.5606989",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.5593846",
"0.556365",
"0.5554722",
"0.5551577",
"0.55483824",
"0.5543472",
"0.55415386",
"0.5539016",
"0.55300117",
"0.5524429",
"0.55240756",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55193776",
"0.55116427",
"0.54790896",
"0.54713917",
"0.54640424",
"0.54370403",
"0.543016",
"0.54264396",
"0.54254055",
"0.5423833",
"0.542378",
"0.5417805",
"0.54171586",
"0.54171586",
"0.54079443",
"0.539707",
"0.5395092",
"0.5388631",
"0.5376387",
"0.53649765",
"0.5361062",
"0.53589535",
"0.53589535",
"0.53589535",
"0.53562164",
"0.5347667",
"0.5341696",
"0.5339397",
"0.53378946",
"0.5336471"
] | 0.0 | -1 |
string Commadelimited list of user IDs who are group administrators (separated by commas) | def admin_ids
@attributes[:admin_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discover_users_string\n discover_users.join(', ')\n end",
"def admin_ids\n group_user_ids(admins_join_table)\n end",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def discover_groups_string\n discover_groups.join(', ')\n end",
"def admin_group_ids\n @attributes[:admin_group_ids]\n end",
"def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend",
"def users\n Webmail::User.in(group_ids: id)\n end",
"def get_users\n #users = []\n static_admins=[\"root\", \"n8\", \"daemon\", \"puppet\", \"nobody\"]\n userlist=`/usr/bin/dscl . -list /users`.split(\" \").slice(1..-1)-static_admins\n userlist.grep(/^[a-z]/) { |u| puts u }\nend",
"def edit_groups_string\n edit_groups.join(', ')\n end",
"def group_admins\n group.blank? ? [] : group.has_admins\n end",
"def local_admins\n\tlist_of_users_tocheck = []\n\tfor x in Dir.entries(\"/Users\")\n\t\tif !x.start_with?(\".\")\n\t\t\tlist_of_users_tocheck.push(x)\n\t\tend\n\tend\n\n\tlocaladmins = []\n\tfor x in list_of_users_tocheck\n\t\tif `dsmemberutil checkmembership -U #{x} -G admin 2>/dev/null`.chomp == \"user is a member of the group\"\n\t\tlocaladmins.push(x)\n\t\tend\n\tend\n\tputs \"Local Admins:\"\n\treturn localadmins\nend",
"def group_member_ids\n member_ids(\"Group\")\n end",
"def read_users_string\n read_users.join(', ')\n end",
"def current_user_group_ids\n container.current_user_group_ids\n end",
"def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end",
"def visible_to_nick_str\n return '' if !visible_to || visible_to_self\n ary = Array.new\n visible_to.each do |uid|\n user = User.find(uid)\n ary << user.nick_name if user && !ary.include?(user.nick_name)\n end\n return ary.sort.join(',')\n end",
"def reply_users_names\n reply_users&.split(/[, ]+/)&.map do |reply_user_id|\n User.find(reply_user_id).real_name\n end&.join(', ')\n end",
"def user_member_ids\n member_ids(\"User\")\n end",
"def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end",
"def admin_ids\n ids = self.retrieve_elements(\"ADMINS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end",
"def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def users_ids\n object.member_ids\n end",
"def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def group_ids\n [Ecircle.client.find_memberships_by_email(:email => email)].flatten.compact\n end",
"def admins\n app_users.select(&:admin?)\n end",
"def user_ids\n users.collect(&:id)\n end",
"def curator_list\n users.map(&:email)\n end",
"def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end",
"def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def player_names\n groups.flat_map{ |group| group.users }.map{ |user| user.login }\n end",
"def role_names\n roles.split(',')\n end",
"def group_ids\n @group_ids ||= current_user.group_ids\n end",
"def group_ids\n groups.map{|g| g.id}\n end",
"def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end",
"def read_groups_string\n read_groups.join(', ')\n end",
"def admins\n group_users(admins_join_table)\n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n end",
"def all_users\n `dscl . list /Users`.split(\"\\n\").delete_if { |e| e =~ /^_/ }\n end",
"def users_and_groups\n return @users_and_groups\n end",
"def groups\n if (groups_last_update.blank? || ((Time.now-groups_last_update) > 24*60*60 ))\n return groups!\n end\n return self.group_list.split(\";?;\")\n end",
"def groups\n if (groups_last_update.blank? || ((Time.now-groups_last_update) > 24*60*60 ))\n return groups!\n end\n return self.group_list.split(\";?;\")\n end",
"def priv_groups(domain,username,password,dc_ip)\n groupArr = [\"Domain Admins\",\"Enterprise Admins\",\"Administrators\"]\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups = Array.new\n\n groupArr.each do |group|\n groupFormatted = group.gsub(' ','-')\n file = \"#{domain}-#{groupFormatted}.txt\"\n r = File.open(file)\n r.each_line {|line| priv_groups.push line.split(\"\\\\\")[1].chomp}\n end\n\n priv_groups.sort!.uniq!\n\n for i in 0 .. priv_groups.length-1 do\n group = priv_groups[i].to_s\n puts \"\"\n puts \"[+] Searching for users in the group #{group}\"\n enum_group_membership(domain,username,password,dc_ip,group)\n end\nend",
"def users_and_groups=(value)\n @users_and_groups = value\n end",
"def get_buzz_limited_member_names(buzz_members)\n user_name = []\n buzz_members.each{|member| user_name << member.user.full_name}\n user_name.join(' , ')\n end",
"def roles_presented\n roles.join(\", \")\n end",
"def user_ids\n users.pluck(:id)\n end",
"def make_dlist(cuds)\n emails = []\n\n cuds.each do |cud|\n emails << cud.user.email.to_s\n end\n\n emails.join(\",\")\n end",
"def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end",
"def private(users)\n [users].flatten.map{ |user| \"user_#{user.is_a?(User) ? user.id : user}\" }\n end",
"def nonmembered_groups(user)\n (LogicalAuthz::group_model.all - user.groups).map { |g| [ g.name, g.id ] }\n end",
"def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end",
"def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def administrators\n members.where(memberships: { role: 'admin' })\n end",
"def groups\n institution_groups + ['registered']\n end",
"def get_user_groups\n user_groups.keys\n end",
"def roles_string() \n self[:roles].join(\",\") \n end",
"def members\n subscribers.split\n end",
"def filter_owner(group_ids)\n group_ids = Array(group_ids)\n group_ids.delete(user.my_group_id)\n group_ids\n end",
"def current_user_group_ids\n @current_user_group_ids ||= Manage::Group.group_ids_for current_user\n end",
"def members_to_users(provider, members)\n members = members.split(',') if members.is_a?(String)\n unless provider.resource[:auth_membership]\n current_members = provider.members\n current_members = [] if current_members == :absent\n members = (members + current_members).uniq\n end\n\n members.join(',')\n end",
"def user_tags\n self.tag_list.join(\" , \")\n end",
"def humanized_roles\n roles.split(' ').collect {|x| x.titleize}.join(\", \")\n end",
"def user_admin\n user_role.in? [\"Department Admin\",\"College Admin\",\"Tech User\"] if user_role\n end",
"def is_admin?\n group_names.include?(ADMIN_GROUP_NAME)\n end",
"def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end",
"def userids\n metadata[\"userids\"]\n end",
"def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n \n if administrator?(usr)\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups order by user_groups.name\n SQL\n else\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups, user_groups_users\n where user_groups.id = user_groups_users.user_group_id\n and user_groups_users.user_id = #{usr.id}\t \n order by user_groups.name\n SQL\n end\n end",
"def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end",
"def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end",
"def writer_ids\n group_user_ids(writers_join_table)\n end",
"def user_ids\n self.users.collect{|ud| ud.id}\n end",
"def user_labels\n @users = User.where(id: params[:user_ids].split(\",\").map(&:to_i).uniq).all\n end",
"def active_admins\n admins.select {|admin| circle.has_active_user?(admin) }\n end",
"def user_in_admin_group?\r\n cmd_exec(\"groups `whoami`\").split(/\\s+/).include?(SUDOER_GROUP)\r\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def display_rolegroups\n return [] if !ds_field_value?\n ds_field_value.map{|rolegroup| rolegroup.name.to_sym }\n end",
"def display_rolegroups\n return [] if !ds_field_value?\n ds_field_value.flatten.map do |rolegroup| \n rolegroup.name.to_sym \n end\n end",
"def discover_users_string=(users)\n self.discover_users = users.split(/[\\s,]+/)\n end",
"def user_ids\n @attributes[:user_ids]\n end",
"def user_ids\n @attributes[:user_ids]\n end",
"def user_ids\n @attributes[:user_ids]\n end",
"def group_members\n members(\"Group\")\n end",
"def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n # TODO: necessary to include #hyrax_group_names?\n @user_groups |= current_user.hyrax_group_names if current_user.respond_to? :hyrax_group_names\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.roles.count.positive?\n # OVERRIDE: add the names of all user's roles to the array of user_groups\n @user_groups |= all_user_and_group_roles\n\n @user_groups\n end",
"def active_admins\n admins.select { |admin| circle.has_active_user?(admin) }\n end",
"def user_ids\n ids = self.retrieve_elements(\"USERS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end",
"def groups_to_show\n begin\n group_names = plugin_setting('groups_shown').to_s\n group_names.split(',').map {|group_name|\n Group.named(group_name)\n }.flatten \n rescue\n []\n end\n end",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end",
"def adapt_user_ids!(p)\n p[:user_ids] = p[:user_ids].split(',') if p[:user_ids].is_a?(String)\n end",
"def arr_participants\n participants.split(',').map{|id|\n User.find(id) rescue nil\n }\n end",
"def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n ug_table = Lockdown.user_groups_hbtm_reference.to_s\n if administrator?(usr)\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table} order by #{ug_table}.name\n SQL\n else\n usr_table = Lockdown.users_hbtm_reference.to_s\n if usr_table < ug_table\n join_table = \"#{usr_table}_#{ug_table}\"\n else\n join_table = \"#{ug_table}_#{usr_table}\"\n end\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table}, #{join_table}\n where #{ug_table}.id = #{join_table}.#{Lockdown.user_group_id_reference}\n and #{join_table}.#{Lockdown.user_id_reference} = #{usr.id}\t \n order by #{ug_table}.name\n SQL\n end\n end",
"def visible_to_nick_str=(str)\n if str==VISIBLE_TO_SELF\n return self.visible_to = [VISIBLE_TO_SELF]\n end\n ary = Array.new\n str.split(%r{\\s*,\\s*}).each do |nick|\n user = User.first(conditions: {nick_name: nick})\n ary << user._id if user\n end\n self.visible_to = ary\n end",
"def groups\n roles\n end",
"def admin_accept_team_member_list\n %w( [email protected] )\n end",
"def list_user(param = '1110')\n @group_users.each { |item| puts item.info(param) }\n end",
"def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end",
"def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end",
"def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def print_users\n users.map(&:email).sort.join(', ')\n end"
] | [
"0.6773825",
"0.6649143",
"0.6350244",
"0.63407445",
"0.62768835",
"0.6272521",
"0.6247548",
"0.61904824",
"0.61843437",
"0.6176734",
"0.6174171",
"0.6142453",
"0.6131808",
"0.6130034",
"0.6060415",
"0.6031385",
"0.5992851",
"0.5992424",
"0.59850425",
"0.5963289",
"0.59444857",
"0.59213364",
"0.59189826",
"0.5902905",
"0.59013826",
"0.58966774",
"0.5834954",
"0.5823065",
"0.5821944",
"0.5796142",
"0.5784677",
"0.57737094",
"0.5752271",
"0.5728738",
"0.57205975",
"0.5719261",
"0.571849",
"0.5696492",
"0.569441",
"0.5690608",
"0.5690608",
"0.56853527",
"0.5682704",
"0.56820136",
"0.56701756",
"0.5661457",
"0.56520766",
"0.5649801",
"0.56497514",
"0.5647387",
"0.56408596",
"0.564048",
"0.5637304",
"0.5626817",
"0.56202936",
"0.5615843",
"0.5612805",
"0.5602973",
"0.55970025",
"0.55958724",
"0.5589034",
"0.55655575",
"0.5564486",
"0.55628884",
"0.55616975",
"0.55613947",
"0.55585426",
"0.5540466",
"0.5540331",
"0.55349857",
"0.5534616",
"0.5532334",
"0.55276996",
"0.55255574",
"0.55226487",
"0.5519888",
"0.5514696",
"0.5512406",
"0.5504766",
"0.5504766",
"0.5504766",
"0.54923224",
"0.5489758",
"0.5486412",
"0.54785746",
"0.5473899",
"0.54716563",
"0.54716563",
"0.546246",
"0.5456787",
"0.5452888",
"0.54500896",
"0.54414284",
"0.543921",
"0.54283375",
"0.54272795",
"0.5426964",
"0.5426964",
"0.54249156",
"0.54240054"
] | 0.5748722 | 33 |
string Notes about this group | def notes
@attributes[:notes]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n [@group.description,@description].join(' ')\n end",
"def liner_note\n info = \"(authorized accounts: #{@groups.keys.join(', ')})\" \n info = '' if @groups.empty?\n \"%s %s\" % [@name.bright, info]\n end",
"def to_s\n string = super.to_s + \"\\tgrupo alimenticio:#{@group}\" \n end",
"def to_s\n descr\n end",
"def to_s; description end",
"def notes\n @reason_structure[@num]\n end",
"def text\n #[@organism, @symbol, @description, @aka, @protnames, @summary,@comentaries.join(\". \")].join(\". \") \n [@symbol, @description, @aka, @protnames, @summary].flatten.join(\". \") \n end",
"def description\n return summary\n end",
"def description; @text; end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def formatted_text\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn \"Discussion added, \\'#{self.reference.subject}\\'\"\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn \"Comment added to \\'#{self.reference.discussion.subject}\\'\"\n\t\tend\n\tend",
"def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def description\n \"\"\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def general_info\n return <<HERE\n Manuscript Title: #{self.title}<br />\n Manuscript Type: #{self.manuscript_type.name}<br />\n Main Subject Category: #{self.article_section.article_section_name}<br />\n Manuscript Counts<br />\n Pages: #{self.num_pages}<br />\n References: #{self.num_refs}<br />\n Tables: #{self.num_tables}<br />\n Figures: #{self.num_figures}<br />\n Supplemental Materials: #{self.num_suppl_mtrls}<br />\n Co-Authors: #{self.coauthors.count}<br />\nHERE\n end",
"def to_s\n format 'remark %s', tag_remark(@comment.to_s)\n end",
"def description\n @sg.description\n end",
"def description\n @sg.description\n end",
"def text\n add_spaces(@text, @chars_per_group)\n end",
"def to_s( )\n\t\t\"#@title by #@artist <<#@duration>>\"\n\tend",
"def to_s\n TEXT_SYMBOLS[self.entry_type] + \n \"] \" +\n body\n end",
"def name\r\n descr.sub(/\\n.*/m, '')\r\n end",
"def to_s_details\n ''\n end",
"def text_name\n summary.to_s\n end",
"def to_s\n \"[#{@type}]#{@content}\"\n end",
"def to_s\n descr_value\n end",
"def description\n text = ['A']\n text << [duration, 'minute'] if duration.present?\n text << [format, 'publication']\n text << [ 'from', pretty_date(published_on) ] if published_on.present?\n text << ['by', presentations.first.speaker_names] if presentations.present?\n text.join(' ')\n end",
"def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n parts << \"#{number_to_currency(sa)} setup fee\" if sa && sa > 0\n \n am = amount(false)\n parts << \"#{number_to_currency(am)}/mo\"\n \n if prepaid_message_count >= UNLIMITED\n texts = \"unlimited\"\n else\n texts = \"#{prepaid_message_count}/mo prepaid\"\n end\n \n @description = parts.join(', ') + \" and #{texts} texts after that.\"\n\n return @description\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n \"PMID: #{pmid}\" + \"\\n \" + \"AUTHORS: #{authors}\" + \"\\n \" + \"TITLE: #{title}\"\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def description\n [basic_description, extra_description].compact.join(\" \")\n end",
"def option_group_description\n data[:option_group_description]\n end",
"def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end",
"def text\n Notification.generate(self, self.class.level)\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def to_s\n \"#{titre}: #{summary}.\"\n end",
"def to_s\r\n\t\t@description\r\n\tend",
"def full_description(example_group)\n example_group.metadata.fetch(:full_description)\n end",
"def to_s\n self.title(:public_note).to_s\n end",
"def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"def descr\n return text_get(2, id)\n end",
"def to_s()\n\t\treturn \"Chapter : #{@title}, levels : #{@levels}, stars required : #{@starsRequired}\"\n\tend",
"def pan_string()\n pan_body().join(',') + \".\"\n end",
"def description\n end",
"def description\n end",
"def to_string\n h = ''\n h << \"Groups\\n\"\n groups.each do |group|\n h << \" #{group}\\n\"\n end\n \n h << \"\\nHosts:\\n\"\n hosts.each do |host|\n h << \" #{host}\\n\"\n end\n \n h << \"\\nRoles\\n\"\n roles.each do |role|\n h << \" #{role}\\n\"\n end\n\n h << \"\\nTop-level tasks\\n\"\n tasks.each do |task|\n h << \" #{task}\\n\"\n end\n\n h\n end",
"def description\n text_get(7, @id)\n end",
"def summary\n \"#{name} (#{email})\"\n end",
"def formatted_body\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn self.reference.body\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn self.reference.body\n\t\tend\t\t\n\tend",
"def description\n\t\tret = [super]\n\t\tif (is_open?)\n\t\t\tret << text('is_open')\n\t\telsif (is_closed?)\n\t\t\tret << text('is_closed')\n\t\tend\n\t\treturn ret.flatten.join(\"\\n\")\n\tend",
"def description\n return @description\n end",
"def notes(opts)\n return \"\"\n end",
"def to_s\n self.description\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_prescription.details\n end",
"def to_s\n \"Last Modified: #{@modifiedAt}\\nStatus: #{@status}\\nAssigned to: #{@owner}\\nSubject: #{@subject}\\n#{@preview}\"\n end",
"def message\n 'Example grouping has no name'\n end",
"def curate_text\n notification_type = get_nagios_var('NAGIOS_NOTIFICATIONTYPE')\n if notification_type.eql?('ACKNOWLEDGEMENT')\n @text += self.content[:short_text][:ack_info] unless self.content[:short_text][:ack_info].empty?\n else\n [:host_info, :state_info, :additional_info, :additional_details].each do |info|\n @text += self.content[:short_text][info] unless self.content[:short_text][info].empty?\n end\n end\n end",
"def to_s\n\t\t@material_name + \": \" + @markup.to_s + \"%\" + (!@material_parent.nil? ? (\", Parent: \" + material_parent) : \"\")\n\tend",
"def group_name\n @sg.group_name\n end",
"def group_name\n @sg.group_name\n end",
"def to_s\n return \"#{@permissions} #{@owner} #{@group} #{@name}\"\n end",
"def to_s\n '(Problem: %s)' % self.problem_number\n end",
"def description\n\n return @description\n\n end"
] | [
"0.7585577",
"0.6932081",
"0.66503984",
"0.6527764",
"0.6483832",
"0.6466546",
"0.6459814",
"0.64060223",
"0.6402603",
"0.6401579",
"0.63809556",
"0.63594997",
"0.6345348",
"0.6340556",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.6338869",
"0.63349736",
"0.6334155",
"0.6317052",
"0.6317052",
"0.63122064",
"0.6296752",
"0.62764674",
"0.6271632",
"0.6270266",
"0.62666947",
"0.62628716",
"0.62567216",
"0.62437326",
"0.62191653",
"0.6218584",
"0.6218584",
"0.62121564",
"0.61986077",
"0.6150016",
"0.61463195",
"0.614386",
"0.6137799",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6120235",
"0.6117768",
"0.6113502",
"0.6108923",
"0.61056113",
"0.61041206",
"0.61026335",
"0.60986966",
"0.6098032",
"0.6096664",
"0.6096664",
"0.60941774",
"0.60818285",
"0.60781294",
"0.6075716",
"0.6072707",
"0.604859",
"0.6048583",
"0.604707",
"0.6040432",
"0.6037544",
"0.6021321",
"0.60212296",
"0.6006915",
"0.60058737",
"0.60058737",
"0.60025847",
"0.5996474",
"0.5994817"
] | 0.0 | -1 |
string Commadelimited list of user IDs who belong to this group (separated by commas) | def user_ids
@attributes[:user_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend",
"def discover_users_string\n discover_users.join(', ')\n end",
"def read_users_string\n read_users.join(', ')\n end",
"def get_following_ids_string\n following_ids = self.followed_users.pluck(:id) << self.id\n following_ids.reduce('(') { |final_string, id| final_string + id.to_s + ','}.chop + ')'\n end",
"def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s + \",\"\n end\n ids = ids.chomp(\",\")\n ids = ids + \")\"\n return ids\n\n end",
"def user_ids\n users.collect(&:id)\n end",
"def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def user_ids\n users.pluck(:id)\n end",
"def userids\n metadata[\"userids\"]\n end",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def group_ids\n [Ecircle.client.find_memberships_by_email(:email => email)].flatten.compact\n end",
"def users\n Webmail::User.in(group_ids: id)\n end",
"def users_ids\n object.member_ids\n end",
"def reply_users_names\n reply_users&.split(/[, ]+/)&.map do |reply_user_id|\n User.find(reply_user_id).real_name\n end&.join(', ')\n end",
"def user_labels\n @users = User.where(id: params[:user_ids].split(\",\").map(&:to_i).uniq).all\n end",
"def user_ids\n ids = self.retrieve_elements(\"USERS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end",
"def adapt_user_ids!(p)\n p[:user_ids] = p[:user_ids].split(',') if p[:user_ids].is_a?(String)\n end",
"def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end",
"def arr_participants\n participants.split(',').map{|id|\n User.find(id) rescue nil\n }\n end",
"def current_user_group_ids\n container.current_user_group_ids\n end",
"def user_ids\n self.users.collect{|ud| ud.id}\n end",
"def user_member_ids\n member_ids(\"User\")\n end",
"def account_ids()\n return [1, 2]\n end",
"def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end",
"def group_member_ids\n member_ids(\"Group\")\n end",
"def user_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.users = Incline::User.where(id: values).to_a\n end",
"def stringy_taxon_concept_ids\n taxon_concept_ids.join(',')\n end",
"def stringy_taxon_concept_ids\n taxon_concept_ids.join(',')\n end",
"def visible_to_nick_str\n return '' if !visible_to || visible_to_self\n ary = Array.new\n visible_to.each do |uid|\n user = User.find(uid)\n ary << user.nick_name if user && !ary.include?(user.nick_name)\n end\n return ary.sort.join(',')\n end",
"def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def ids(things)\n things.map(&:id).join(\",\")\n end",
"def curator_list\n users.map(&:email)\n end",
"def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end",
"def user_tags\n self.tag_list.join(\" , \")\n end",
"def assignable_people_ids\n ([self.scrum_master_id.to_s] + self.team_member_ids).select {|u_id| !u_id.blank?}\n end",
"def followees\n if user.followees == \"[]\"\n [\"You are not following anyone!\"]\n else\n user.followees.gsub(\"\\\"\",\"\").split(\", \").map do |r|\n r.gsub(\"[\",\"\").gsub(\"]\",\"\")\n end\n end\n end",
"def ids\n options[:id][1..-2].split(\",\").map(&:to_i)\n end",
"def discover_groups_string\n discover_groups.join(', ')\n end",
"def idlist(objects)\n safe_join(objects.collect {|o| o.id}, ',')\n end",
"def get_members_list()\n members_list = []\n DATA[CARDS][$card_index][ID_MEMBERS].each_index do |members|\n DATA[MEMBERS].each_index do |names|\n #puts DATA[MEMBERS][names][ID]\n #puts DATA['members'][names]['id']\n if DATA['members'][names]['id'] == DATA[CARDS][$card_index][ID_MEMBERS][members]\n members_list.push(DATA[MEMBERS][names][USERNAME])\n end\n end\n end\n members_list = members_list.join(\",\")\n\n members_list\nend",
"def participants_to_s \n names_arr = Array.new\n real_participants.each {|p| names_arr.push p.user.username}\n return ((event.users.map(&:username) - names_arr).empty? ? \"All\" : names_arr.join(','))\n end",
"def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end",
"def group_ids\n groups.map{|g| g.id}\n end",
"def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end",
"def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\r\n many_ids.map {|ids| \"#{left_bracket}#{ids}#{right_bracket}\"}.join(list_sep)\r\n end",
"def user_ids \n @user_ids ||= input[\"users\"].map{|user| user[\"id\"]}\nend",
"def email_ids\n []\n end",
"def uids\n return [] unless valid?\n\n queries.search(name_query).merged_uids\n end",
"def user_ids\n post\n .organization\n .users\n .select(:id)\n .where('members.active = true')\n .where('users.push_notifications = true')\n end",
"def group_ids\n @group_ids ||= current_user.group_ids\n end",
"def user_ids\n UsersRole\n .joins(:role)\n .where(Role.arel_table[:resource_identifier].in(identifiers))\n .pluck(:user_id)\n .uniq\n end",
"def get_buzz_limited_member_names(buzz_members)\n user_name = []\n buzz_members.each{|member| user_name << member.user.full_name}\n user_name.join(' , ')\n end",
"def get_lawyer_user_ids\n @assigned_lawfirm_users.map(&:id)\n end",
"def group_ids\n groups.pluck(:id)\n end",
"def get_set_of_user_ids(arr_of_user_names)\n set_of_user_ids = Set.new\n\n arr_of_user_names.each { |name|\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/users\"\n puts \"@url is #{@url}\"\n \n @payload={'search_term': name}\n puts(\"@payload is #{@payload}\")\n \n @getResponse = HTTParty.get(@url, :body => @payload.to_json, :headers => $header)\n puts(\" GET to get user has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n user_data = @getResponse.parsed_response\n \n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end\n }\n \n return set_of_user_ids\nend",
"def read_groups_string\n read_groups.join(', ')\n end",
"def active_glm_id_list\n self.active_group_loan_memberships.map{|x| x.id }\n end",
"def member_ids_field\n \"member_ids_ssim\"\n end",
"def member_ids\n team_users.pluck(:user_id)\n end",
"def member_ids\n team_users.pluck(:user_id)\n end",
"def member_ids\n team_users.pluck(:user_id)\n end",
"def uids\n @uids ||= records.map(&:uid)\n end",
"def current_user_group_ids\n @current_user_group_ids ||= Manage::Group.group_ids_for current_user\n end",
"def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end",
"def private(users)\n [users].flatten.map{ |user| \"user_#{user.is_a?(User) ? user.id : user}\" }\n end",
"def account_ids\n user.app_metadata.fetch('account_ids', [])\n end",
"def tags_with_user_ids\n _tags.collect{|t| [t.id, t.user_id] }\n end",
"def members_to_users(provider, members)\n members = members.split(',') if members.is_a?(String)\n unless provider.resource[:auth_membership]\n current_members = provider.members\n current_members = [] if current_members == :absent\n members = (members + current_members).uniq\n end\n\n members.join(',')\n end",
"def user_ids\n self.class.where(id: id).user_ids\n end",
"def recipients\n @recipients ||= User.where(id: self.user_ids.split(/,/))\n end",
"def participants_email_list(exclude_email=nil)\n participants(exclude_email).collect{ |p| \"#{p[0]} <#{p[1]}>\" }.join(\", \")\n end",
"def user_ids\n page = 1\n per_page = 100\n user_ids = []\n puts 'collecting all user ids'\n loop do\n response = @conn.get api_url('/users'),\n { page: page, per_page: per_page }.merge(token)\n raise 'Error Retrieving user_ids' if response.status != 200\n ids = JSON.parse(response.body).collect { |u| u['id'] }\n user_ids.concat(ids)\n break if ids.size < per_page\n page += 1\n end\n puts 'returning now the user ids'\n user_ids.sort\n end",
"def group_ids\n @attributes[:group_ids]\n end",
"def group_ids\n @attributes[:group_ids]\n end",
"def group_ids\n @attributes[:group_ids]\n end",
"def multi_ids\n params[multi_id_key].split(',')\n end",
"def associates_list()\n\t\tassocs = Contract.associates_for(current_user()).all.inject([]) \\\n\t\t\t{ |ret, assoc| ret << ([assoc.username, assoc.id] unless assoc.id == 2) }.compact\n\tend",
"def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\n many_ids.map {|ids| \"#{left_bracket}#{CompositePrimaryKeys::CompositeKeys.new(ids)}#{right_bracket}\"}.join(list_sep)\n end",
"def get_users_in_group(group_id)\n list_users_in_group = HTTParty.get(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/users\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n user_data = list_users_in_group.parsed_response\n\n arr_of_user_ids = Array.new\n\n user_data.each do |user_data_info|\n arr_of_user_ids.push user_data_info[\"id\"]\n end \n\n return arr_of_user_ids\nend",
"def make_dlist(cuds)\n emails = []\n\n cuds.each do |cud|\n emails << cud.user.email.to_s\n end\n\n emails.join(\",\")\n end",
"def admin_ids\n group_user_ids(admins_join_table)\n end",
"def reader_ids\n group_user_ids(readers_join_table)\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def significados_id_comma\n model.traducciones.collect(&:significado_id).join(',')\n end",
"def group_user_ids(table)\n @group_user_ids ||= {}\n @group_user_ids[table] ||=\n table.to_s.classify.constantize.\n joins(user_group: :user_group_users).\n where(\"#{type_tag}_id\" => id).\n order(user_id: :asc).distinct.\n pluck(:user_id)\n end",
"def inspect\n jids = to_a.collect { |item| item.jid.inspect }\n jids.join(', ')\n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n end",
"def person_ids\n persons = Person.find_all_from_identifier(source: 'xkonto', identifier: username)\n return nil if persons.blank?\n return persons.map(&:id)\n end",
"def get_user_ids(fname=\"../id_list\")\n file = File.open(fname, \"r\")\n ids = []\n file.each do |line|\n ids += [Integer(line.split(\":\")[1].strip())]\n end\n file.close() \n return ids\nend",
"def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end",
"def fellow_group_member_ids\n user_ids = GroupUser\n .where(group_id: group_ids + owned_group_ids)\n .uniq\n .pluck(:user_id)\n\n # don't include self\n user_ids.delete(id)\n\n user_ids\n end",
"def discover_users_string=(users)\n self.discover_users = users.split(/[\\s,]+/)\n end",
"def userids(*values)\n values.inject(self) { |res, val| res._userids(val) }\n end",
"def followers_ids\n followers.pluck('users.id')\n end",
"def user_ids_sql\n \"#{member_user_ids_sql} UNION SELECT user_id FROM project_medias WHERE team_id = #{team_id}\"\n end",
"def role_names\n roles.split(',')\n end",
"def player_names\n groups.flat_map{ |group| group.users }.map{ |user| user.login }\n end",
"def to_s\n return @role_array.join(',')\n end"
] | [
"0.70399874",
"0.6944412",
"0.68309927",
"0.679464",
"0.6781506",
"0.6645395",
"0.6578697",
"0.6536222",
"0.6525982",
"0.6491802",
"0.64493734",
"0.6448474",
"0.64100623",
"0.6395395",
"0.63564736",
"0.6340574",
"0.6333712",
"0.62917244",
"0.62711585",
"0.6207097",
"0.6173816",
"0.6171539",
"0.616062",
"0.6123608",
"0.6066538",
"0.60602266",
"0.6048108",
"0.6048108",
"0.6045363",
"0.60420465",
"0.6034641",
"0.6031764",
"0.59999055",
"0.5993332",
"0.5988041",
"0.5987275",
"0.5986069",
"0.59738785",
"0.5973224",
"0.5972376",
"0.59654003",
"0.59594303",
"0.5950886",
"0.59464467",
"0.5941311",
"0.5941264",
"0.5922024",
"0.59124565",
"0.5909119",
"0.59049743",
"0.5885585",
"0.58848137",
"0.5882284",
"0.58710325",
"0.5844263",
"0.5841163",
"0.58369243",
"0.5836819",
"0.58273214",
"0.58273214",
"0.58273214",
"0.581872",
"0.58147955",
"0.5810304",
"0.5810185",
"0.5767037",
"0.57599944",
"0.5759527",
"0.5746512",
"0.57429457",
"0.57324225",
"0.5719606",
"0.5706851",
"0.5706851",
"0.5706851",
"0.5700806",
"0.56919235",
"0.5691066",
"0.56861734",
"0.5669366",
"0.56642073",
"0.56635034",
"0.5658914",
"0.56481403",
"0.56459266",
"0.5642141",
"0.5635918",
"0.56264657",
"0.56236833",
"0.5616228",
"0.56055045",
"0.55947304",
"0.5593395",
"0.55929273",
"0.5581801",
"0.5576307",
"0.55755764",
"0.5554866"
] | 0.64967775 | 9 |
string Commadelimited list of usernames who belong to this group (separated by commas) | def usernames
@attributes[:usernames]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discover_users_string\n discover_users.join(', ')\n end",
"def reply_users_names\n reply_users&.split(/[, ]+/)&.map do |reply_user_id|\n User.find(reply_user_id).real_name\n end&.join(', ')\n end",
"def read_users_string\n read_users.join(', ')\n end",
"def complete_name_list\n #User.select(:name).map{|user_record| user_record.name}\n end",
"def get_buzz_limited_member_names(buzz_members)\n user_name = []\n buzz_members.each{|member| user_name << member.user.full_name}\n user_name.join(' , ')\n end",
"def visible_to_nick_str\n return '' if !visible_to || visible_to_self\n ary = Array.new\n visible_to.each do |uid|\n user = User.find(uid)\n ary << user.nick_name if user && !ary.include?(user.nick_name)\n end\n return ary.sort.join(',')\n end",
"def participants_to_s \n names_arr = Array.new\n real_participants.each {|p| names_arr.push p.user.username}\n return ((event.users.map(&:username) - names_arr).empty? ? \"All\" : names_arr.join(','))\n end",
"def player_names\n groups.flat_map{ |group| group.users }.map{ |user| user.login }\n end",
"def first_names\n str = ''\n users.each { |u| str << u.first_name << \" \" }\n str.strip.split(\" \").join(', ')\n end",
"def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end",
"def names\n @users.values.map(&:name)\n end",
"def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend",
"def usernames\n Message::Statement.display_usernames(raw_data.keys)\n end",
"def user_tags\n self.tag_list.join(\" , \")\n end",
"def list_names\n list_of_names = String.new\n Contacts.each { |contact| list_of_names = list_of_names + contact[1][:name_choices] + \", \" }\n return list_of_names\nend",
"def mentioned_people_names\n self.mentioned_people.map(&:name).join(', ')\n end",
"def curator_list\n users.map(&:email)\n end",
"def get_members_list()\n members_list = []\n DATA[CARDS][$card_index][ID_MEMBERS].each_index do |members|\n DATA[MEMBERS].each_index do |names|\n #puts DATA[MEMBERS][names][ID]\n #puts DATA['members'][names]['id']\n if DATA['members'][names]['id'] == DATA[CARDS][$card_index][ID_MEMBERS][members]\n members_list.push(DATA[MEMBERS][names][USERNAME])\n end\n end\n end\n members_list = members_list.join(\",\")\n\n members_list\nend",
"def print_users\n users.map(&:email).sort.join(', ')\n end",
"def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def group_names\n @group_names ||= groups.map { |g| g[:cn].first }\n end",
"def team_members\n\t\tUser.where(:id => self.installation_team.split(\",\")).pluck(:full_name).join(\",\")\n\tend",
"def player_names\n self.players.pluck(:username).join(\", \")\n end",
"def registered_usr\n name_arry =[ \"david\", \"haggai\", \"mark\"]\n return name_arry\n end",
"def discover_groups_string\n discover_groups.join(', ')\n end",
"def followees\n if user.followees == \"[]\"\n [\"You are not following anyone!\"]\n else\n user.followees.gsub(\"\\\"\",\"\").split(\", \").map do |r|\n r.gsub(\"[\",\"\").gsub(\"]\",\"\")\n end\n end\n end",
"def members_to_users(provider, members)\n members = members.split(',') if members.is_a?(String)\n unless provider.resource[:auth_membership]\n current_members = provider.members\n current_members = [] if current_members == :absent\n members = (members + current_members).uniq\n end\n\n members.join(',')\n end",
"def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end",
"def group_names\n # In order to avoid multiple ldap-connection requests we do not\n # iterate over `.groups` (AKA @attributes[:memberof] but extract\n # the names from the DNs and return the CN part.\n @ldap_entry[:memberof].map do |dn|\n dn.split(',').first.split('=').last\n end.sort\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def discover_users_string=(users)\n self.discover_users = users.split(/[\\s,]+/)\n end",
"def contributor_usernames\n @contributor_usernames ||= contributors.map(&:username)\n end",
"def names_array\n @names_array ||= fullname.split(',').map(&:strip)\n end",
"def role_names\n roles.split(',')\n end",
"def artist_names\n names = \"\"\n self.artists.each do |artist|\n names += \"#{artist.name}, \"\n end\n\n # Remove trailing ,\n names.chomp!(\", \")\n return names\n end",
"def usernames\n if @usernames\n @usernames\n else\n users = PadmaUser.paginate(account_name: self.name, per_page: 100)\n @usernames = users.nil? ? nil : users.map(&:username).sort\n end\n end",
"def author_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end",
"def name(users)\n #arr = []\n variable = Deck.find(users).users.uniq\n variable.each do |user|\n p user.name\n end\n #arr\n end",
"def all_names\n @json_data['family_members'].collect { |user| user['name'] }\n end",
"def usernames\n users = PadmaUser.paginate(account_name: self.name, per_page: 100)\n users.nil? ? nil : users.map(&:username)\n end",
"def username_list_helper(array)\n if array.size == 0 or array.size == 1\n return fast_link(display_user_name(array[0]), \"#{array[0].username}\")\n elsif array.size == 2\n return fast_link(display_user_name(array[0]), \"#{array[0].username}\") + \" and \" + fast_link(display_user_name(array[1]), \"#{array[1].username}\")\n else\n index_minus_one = array.size - 2\n s = fast_link(display_user_name(array[0]), \"#{array[0].username}\")\n for i in (1..index_minus_one.to_i)\n s = s + \", \" + fast_link(display_user_name(array[i]), \"#{array[i].username}\")\n end\n s = s + \" and \" + fast_link(display_user_name(array[array.size-1]), \"#{array[array.size-1].username}\")\n \n return s\n end\n end",
"def name\n result = []\n result << self.first_name\n result << self.last_name\n if result.compact.empty?\n self.user.login if self.user\n else\n result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ')\n end\n end",
"def load_users \n\tFile.readlines(file_input).each do |line|\n\t\tusernames = line.split(\",\")\n\t\t# the return value of this method needs to be an array, not the file\n\t\t# so there's an explicit return\n\t\treturn usernames\n\tend\nend",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def subscribers_to_s\n subscribers.map { |subscriber|\n \"#{subscriber.name}<#{subscriber.email}>\"\n }.join(\", \")\n end",
"def members\n subscribers.split\n end",
"def read_groups_string\n read_groups.join(', ')\n end",
"def roles_string() \n self[:roles].join(\",\") \n end",
"def wholist( user )\n\t\trval = \"[Connected Users]\\n\" <<\n\t\t\t\" *#{user}*\\n\"\n\t\[email protected] {|u|\n\t\t\tnext if u == user\n\t\t\trval << \" #{u}\\n\"\n\t\t}\n\n\t\treturn rval\n\tend",
"def make_dlist(cuds)\n emails = []\n\n cuds.each do |cud|\n emails << cud.user.email.to_s\n end\n\n emails.join(\",\")\n end",
"def winner_usernames\n return winners.map {|p| p.username}\n end",
"def wholist( user )\n\t\trval = \"[Connected Users]\\n\" <<\n\t\t \" *#{user}*\\n\"\n\n\t\[email protected] do |u|\n\t\t\tnext if u == user\n\t\t\trval << \" #{u}\\n\"\n\t\tend\n\n\t\treturn rval\n\tend",
"def joined_names\n values.map(&:name).join(\", \").gsub(/, ([^,]*)$/, ' and \\1')\n end",
"def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end",
"def membership(username)\n grlist = []\n begin\n userpw = Etc.getpwnam(username)\n rescue\n return grlist\n end\n begin\n usergr = Etc.getgrgid(userpw.gid)\n grlist.push(usergr.name)\n rescue\n # This shouldn't happen, if it does it means\n # someone was probably hand-editing the passwd/\n # group files and messed up. \n end\n Etc.group { |g|\n if g.mem.index(username)\n grlist.push(g.name)\n end\n }\n return grlist.uniq.sort\n end",
"def user_labels\n @users = User.where(id: params[:user_ids].split(\",\").map(&:to_i).uniq).all\n end",
"def distribution_names\n\t\tunless @distribution\n\t\t\t@distribution = account.usernames.map{|username| {username: username, sql_username: sql_username(username)}}\n\t\tend\n\n @distribution.map{|u| u[:username]}.compact\n\tend",
"def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end",
"def participants_email_list(exclude_email=nil)\n participants(exclude_email).collect{ |p| \"#{p[0]} <#{p[1]}>\" }.join(\", \")\n end",
"def distinct\n \"#{username}\\##{tag}\"\n end",
"def distinct\n \"#{username}\\##{tag}\"\n end",
"def full_names\n names = raw_names\n if match_names\n names += match_names.downcase.split(%r{,\\s*})\n end\n names\n end",
"def names_string(names)\n names_array(names).join(', ')\n end",
"def email_list\n @entries.collect do |line|\n name, email = line.split(\",\")\n format_email_address name, email.chomp\n end.join(\", \")\n end",
"def all_users\n return [] if @json_data['users'].nil?\n @json_data['users'].collect { |user| [user['first'], user['last']].join(' ') }\n end",
"def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end",
"def authority_name\n [surname, given_name].reject(&:blank?).join(', ')\n end",
"def get_following_ids_string\n following_ids = self.followed_users.pluck(:id) << self.id\n following_ids.reduce('(') { |final_string, id| final_string + id.to_s + ','}.chop + ')'\n end",
"def parse\n\t\tparsed = @email.split(\" \")\n\t\tparsed.each do |email|\n\t\t\tif email[-1] == \",\"\n\t\t\t\temail.chomp!(\",\")\n\t\t\tend\n\t\tend\n\t\tparsed.uniq\n\tend",
"def user_string(with_links = false)\n return self.users.collect { |user|\n with_links ? user.link_to_page_with_first_name : user.first_name\n }.join(\", \")\n end",
"def list names\n names = names.map { |name| name[:name] }\n last_name = names.pop\n return last_name.to_s if names.empty?\n \"#{names.join(', ')} & #{last_name}\"\nend",
"def tokenize_person_comma_org(line) \n elems = line.split(',')\n if elems.size >= 2\n return elems.map{|e| e.strip } \n else\n return ['',''] # let caller to decide how to deal with empty info\n end\nend",
"def user_list\n execute('dscacheutil -q user') do |result|\n users = []\n result.stdout.each_line do |line|\n users << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n users\n end\n end",
"def all_users\n `dscl . list /Users`.split(\"\\n\").delete_if { |e| e =~ /^_/ }\n end",
"def parse\n emails.split(/, | /).uniq\n end",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def normalize_reviewers(list)\n list.split(',').map { |reviewer|\n name, domain = reviewer.strip.split('@', 2)\n domain ||= Config.data['domain']\n [name, domain].join('@')\n }.compact.uniq\n end",
"def get_users\n #users = []\n static_admins=[\"root\", \"n8\", \"daemon\", \"puppet\", \"nobody\"]\n userlist=`/usr/bin/dscl . -list /users`.split(\" \").slice(1..-1)-static_admins\n userlist.grep(/^[a-z]/) { |u| puts u }\nend",
"def list_of_users\n\tusers=[]\n\tfor username in Dir.entries(\"/Users\")\n\t\tif !username.start_with?(\".\")\n\t\t\tusers.push(username)\n\t\tend\n\tend\n\treturn users\nend",
"def names(channel)\n target = bot.Channel(channel)\n users = target.users.map { |u,m| \"#{'@' if m.include? \"o\" }#{'+' if m.include? \"v\"}#{u}\"}.sort\n send_command(\"names\",users: users, channel: channel)\n end",
"def names\n self.name.split(' ')\n end",
"def arr_participants\n participants.split(',').map{|id|\n User.find(id) rescue nil\n }\n end",
"def read_users_string=(users)\n self.read_users = users.split(/[\\s,]+/)\n end",
"def userlist_text(userlist)\n userlist.sort!\n case userlist.length\n when 1 then return userlist.first\n when 2 then return userlist.join(\" AND \")\n else return userlist[0..-2].join(\", \") + \", AND #{userlist.last}\"\n end\nend",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def city_names\n cities.pluck(:name).join(\", \")\n end",
"def visible_to_nick_str=(str)\n if str==VISIBLE_TO_SELF\n return self.visible_to = [VISIBLE_TO_SELF]\n end\n ary = Array.new\n str.split(%r{\\s*,\\s*}).each do |nick|\n user = User.first(conditions: {nick_name: nick})\n ary << user._id if user\n end\n self.visible_to = ary\n end",
"def humanized_roles\n roles.split(' ').collect {|x| x.titleize}.join(\", \")\n end",
"def get_all_user_names\n @user_manager.get_all_user_names\n end",
"def comma_names\n @comma_names\nend",
"def fetch_groups!\n ldap_groups.map do |dn|\n /^cn=([^,]+),/i.match(dn)[1]\n end\n end",
"def all_name_strings\n names.collect { |a| a.name }\n end",
"def followers\n if user.followers == \"[]\"\n [\"You have no followers LOSER!\"]\n else\n user.followers.gsub(\"\\\"\",\"\").split(\", \").map do |r|\n r.gsub(\"[\",\"\").gsub(\"]\",\"\")\n end\n end\n end",
"def store_names\n\n names = @store_names.dup\n names << \"users\" unless names.include?(\"users\")\n names\n end",
"def build_users_list\n User.with_overdue_monthly_memberships.inject([]) do |list, user|\n list << \"- #{user.aka} (#{user.overdue_monthly_memberships.to_i})\"\n end.join(\"\\n\")\n end",
"def roles_presented\n roles.join(\", \")\n end"
] | [
"0.72588146",
"0.7121007",
"0.70382947",
"0.6846178",
"0.6837458",
"0.66396487",
"0.66323876",
"0.65394366",
"0.6497406",
"0.6465287",
"0.6452495",
"0.64344865",
"0.6402158",
"0.6398522",
"0.63426787",
"0.62771237",
"0.6203201",
"0.61898583",
"0.6170373",
"0.6145119",
"0.60934156",
"0.6064293",
"0.6059207",
"0.60469836",
"0.60463184",
"0.6041311",
"0.6032369",
"0.6014458",
"0.60142416",
"0.6013491",
"0.6013491",
"0.598815",
"0.5976139",
"0.5974157",
"0.59659773",
"0.5940886",
"0.59225684",
"0.59092313",
"0.5904305",
"0.5900979",
"0.58843267",
"0.58766234",
"0.5859272",
"0.58589876",
"0.58581",
"0.58446807",
"0.5844458",
"0.58287656",
"0.58196527",
"0.580424",
"0.57997644",
"0.57992375",
"0.5780895",
"0.5778927",
"0.5778715",
"0.5767341",
"0.57612354",
"0.57197523",
"0.57128465",
"0.57079643",
"0.57016116",
"0.5699654",
"0.569047",
"0.56840855",
"0.5676053",
"0.56723595",
"0.56702447",
"0.566696",
"0.5659194",
"0.5658098",
"0.56511295",
"0.56351537",
"0.56328094",
"0.562809",
"0.56256944",
"0.561857",
"0.561771",
"0.561771",
"0.5615714",
"0.56149393",
"0.5607793",
"0.56025404",
"0.5599554",
"0.55944425",
"0.5594177",
"0.5593986",
"0.559325",
"0.559325",
"0.5592695",
"0.55913234",
"0.55876625",
"0.5581318",
"0.55793685",
"0.55768555",
"0.5575501",
"0.5571449",
"0.5566949",
"0.55658776",
"0.5558312"
] | 0.64081985 | 13 |
Parameters: name string Group name. notes string Group notes. user_ids string A list of user ids. If sent as a string, should be commadelimited. admin_ids string A list of group admin user ids. If sent as a string, should be commadelimited. | def update(params = {})
params ||= {}
params[:id] = @attributes[:id]
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
raise InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].is_a?(String)
raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String)
raise InvalidParameterError.new("Bad parameter: admin_ids must be an String") if params[:admin_ids] and !params[:admin_ids].is_a?(String)
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
Api.send_request("/groups/#{@attributes[:id]}", :patch, params, @options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_group\n ids = params[:ids]\n group = Group.find(params[:group_id])\n if ids.present?\n users = User.where(id: ids)\n users.each do |u|\n GroupUser.create(user: u, group: group, created_by: current_user)\n if current_user != u\n u.notify(\n \"#{current_user.to_s} has added you to user group: #{group.name}\",\n group, \n \"group\"\n )\n else\n group.admin.each do |admin|\n admin.notify(\n \"#{current_user.to_s} has requested to be added to the user group: #{group.name}\",\n group,\n \"group\"\n )\n end\n end\n end\n if users.count === 1 && users.first === current_user\n flash[:notice] = \"Request sent!\"\n else\n flash[:notice] = \"#{\"Invitation\".pluralize(users)} sent!\"\n end\n end\n respond_to do |format|\n format.json { render :json => {}, :status => :ok }\n format.html {\n if users\n flash.now[:success] = \"Group membership pending for #{users.map(&:username).join(', ')}.\"\n end \n redirect_to group_path(group) \n }\n end\n end",
"def update_groups(desc, type, groups)\n for id, val in groups\n if group = UserGroup.safe_find(id)\n update_group(desc, type, group, (val == '1'))\n else\n flash_error(:runtime_description_user_not_found.t(:name => id))\n end\n end\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def create_full_group(creator_id, groupname, title = nil, description = nil)\n creator = User.new(creator_id, \"testuser\")\n @sling.switch_user(creator)\n #POST 1 - creating the manager sub-group\n create_pseudo_group(groupname + \"-manager\", groupname + \" Manager\", description)\n\n #POST 2 - creating the member sub-group\n create_pseudo_group(groupname + \"-member\", groupname + \" Member\", description)\n\n #POST 3 creating the main group\n group = create_target_group(groupname, title, description) #POST 3\n\n update_uri = \"/#{$USERMANAGER_URI}group/\"\n\n #POST 4 - updating the group managers\n batch_post = []\n batch_post[0] = {\"url\" => \"#{update_uri}#{groupname}-member.update.json\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"#{update_uri}#{groupname}-manager.update.json\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"#{update_uri}#{groupname}.update.json\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 4 - updating the group managersbatch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 4 - updating the group managersbatch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 4 - updating the group managers response code is: #{response.code}\")\n @file_log.info(\"POST 4 - updating the group managers response code is: #{response.code}\") if (@file_log)\n\n #POST 5 - updating the group members\n batch_post = []\n batch_post[0] = {\"url\" => \"#{update_uri}#{groupname}-manager.update.json\", \"method\" => \"POST\", \"parameters\" => {\":member\" => \"#{creator_id}\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"#{update_uri}#{groupname}.update.json\", \"method\" => \"POST\", \"parameters\" => {\":member\" => \"#{groupname}-member\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"#{update_uri}#{groupname}.update.json\", \"method\" => \"POST\", \"parameters\" => {\":member\" => \"#{groupname}-manager\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 5 - updating the group members batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 5 - updating the group members batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 5 - updating the group members response code is: #{response.code}\")\n @file_log.info(\"POST 5 - updating the group members response code is: #{response.code}\") if (@file_log)\n\n #POST 6 - creating test tags\n batch_post = []\n batch_post[0] = {\"url\" => \"/tags/test-tag1\", \"method\" => \"POST\", \"parameters\" => {\"sakai:tag-name\" => \"test-tag1\", \"sling:resourceType\" => \"sakai/tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/tags/test-tag2\", \"method\" => \"POST\", \"parameters\" => {\"sakai:tag-name\" => \"test-tag2\", \"sling:resourceType\" => \"sakai/tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 6 - creating test tags batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 6 - creating test tags batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 6 - creating test tags response code is: #{response.code}\")\n @file_log.info(\"POST 6 - creating test tags response code is: #{response.code}\") if (@file_log)\n\n #POST 7 - updating group visibility, joinability and permissions\n batch_post = []\n batch_post[0] = {\"url\" => \"#{update_uri}#{groupname}.update.html\", \"method\" => \"POST\", \"parameters\" => {\"rep:group-viewers@Delete\" => \"\", \"sakai:group-visible\" => \"public\", \"sakai:group-joinable\" => \"yes\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/~#{groupname}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => \"everyone\", \"privilege@jcr:read\" => \"granted\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"/~#{groupname}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => \"anonymous\", \"privilege@jcr:read\" => \"granted\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 7 - updating group visibility, joinability and permissions batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 7 - updating group visibility, joinability and permissions batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 7 - updating group visibility, joinability and permissions response code is: #{response.code}\")\n @file_log.info(\"POST 7 - updating group visibility, joinability and permissions response code is: #{response.code}\") if (@file_log)\n\n #POST 8 - creating initial sakai docs\n batch_post = []\n batch_post[0] = {\"url\" => \"/system/pool/createfile\", \"method\" => \"POST\", \"parameters\" => {\"sakai:pooled-content-file-name\" => \"Library\", \"sakai:description\" => \"\", \"sakai:permissions\" => \"public\", \"sakai:copyright\" => \"creativecommons\", \\\n \"structure0\" => \"{\\\"library\\\":{\\\"_ref\\\":\\\"id9867543247\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Library\\\",\\\"main\\\":{\\\"_ref\\\":\\\"id9867543247\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Library\\\"}}}\", \\\n \"mimeType\" => \"x-sakai/document\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n\n batch_post[1] = {\"url\" => \"/system/pool/createfile\", \"method\" => \"POST\", \"parameters\" => {\"sakai:pooled-content-file-name\" => \"Participants\", \"sakai:description\" => \"\", \"sakai:permissions\" => \"public\", \"sakai:copyright\" => \"creativecommons\", \\\n \"structure0\" => \"{\\\"participants\\\":{\\\"_ref\\\":\\\"id6573920372\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Participants\\\",\\\"main\\\":{\\\"_ref\\\":\\\"id6573920372\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Participants\\\"}}}\", \\\n \"mimeType\" => \"x-sakai/document\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"#POST 8 - creating initial sakai docs batch post is: #{batch_post_json}\")\n @file_log.debug(\"#POST 8 - creating initial sakai docs batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 8 - creating initial sakai docs response code is: #{response.code}\")\n @file_log.info(\"POST 8 - creating initial sakai docs response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 8 - creating initial sakai docs results: #{results}\")\n @file_log.debug(\"POST 8 - creating initial sakai docs results: #{results}\") if (@file_log)\n library_doc_hash, participants_doc_hash = nil, nil\n i = 0\n results.each do |result|\n result_body_json = JSON result[\"body\"]\n content_item = result_body_json[\"_contentItem\"]\n doc_hash = content_item[\"poolId\"]\n content_item_name = content_item[\"item\"][\"sakai:pooled-content-file-name\"]\n if (\"Library\".eql? content_item_name)\n library_doc_hash = doc_hash\n elsif (\"Participants\".eql? content_item_name)\n participants_doc_hash = doc_hash\n else\n @log.warn(\"could not find sakai doc name to confirm doc_hash\")\n end\n end\n @log.info(\"POST 8 - creating initial sakai docs Library sakai doc hash: #{library_doc_hash}, Participants sakai doc hash #{participants_doc_hash}\")\n @file_log.info(\"POST 8 - creating initial sakai docs Library sakai doc hash: #{library_doc_hash}, Participants sakai doc hash #{participants_doc_hash}\") if (@file_log)\n\n #POST 9 - importing sakai docs content \n batch_post = []\n batch_post[0] = {\"url\" => \"/p/#{library_doc_hash}.resource\", \"method\" => \"POST\", \"parameters\" => {\":operation\" => \"import\", \":contentType\" => \"json\", \":replace\" => \"true\", \":replaceProperties\" => \"true\", \\\n \":content\" => \"{\\\"id9867543247\\\":{\\\"page\\\":\\\"<img id='widget_mylibrary_id1367865652332' class='widget_inline' style='display: block; padding: 10px; margin: 4px;' \\\n src='/devwidgets/mylibrary/images/mylibrary.png' data-mce-src='/devwidgets/mylibrary/images/mylibrary.png' data-mce-style='display: block; padding: 10px; margin: 4px;' border='1'><br></p>\\\"},\\\n \\\"id1367865652332\\\":{\\\"mylibrary\\\":{\\\"groupid\\\":\\\"#{groupname}\\\"}}}\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n\n batch_post[1] = {\"url\" => \"/p/#{participants_doc_hash}.resource\", \"method\" => \"POST\", \"parameters\" => {\":operation\" => \"import\", \":contentType\" => \"json\", \":replace\" => \"true\", \":replaceProperties\" => \"true\", \\\n \":content\" => \"{\\\"id6573920372\\\":{\\\"page\\\":\\\"<img id='widget_participants_id439704665' class='widget_inline' style='display: block; padding: 10px; margin: 4px;' src='/devwidgets/participants/images/participants.png' \\\n data-mce-src='/devwidgets/participants/images/participants.png' data-mce-style='display: block; padding: 10px; margin: 4px;' border='1'><br></p>\\\"}, \\\n \\\"id439704665\\\":{\\\"participants\\\":{\\\"groupid\\\":\\\"#{groupname}\\\"}}}\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 9 - importing sakai docs content batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 9 - importing sakai docs content batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 9 - importing sakai docs content response code is: #{response.code}\")\n @file_log.info(\"POST 9 - importing sakai docs content response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 9 - importing sakai docs content results from importing sakai docs post: #{results}\")\n @file_log.debug(\"POST 9 - importing sakai docs content results from importing sakai docs post: #{results}\") if (@file_log)\n\n #POST 10 - applying the test tags\n batch_post = []\n batch_post[0] = {\"url\" => \"/~#{groupname}/public/authprofile\", \"method\" => \"POST\", \"parameters\" => {\"key\" => \"/tags/test-tag1\", \":operation\" => \"tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/~#{groupname}/public/authprofile\", \"method\" => \"POST\", \"parameters\" => {\"key\" => \"/tags/test-tag2\", \":operation\" => \"tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n @log.debug(\"resource batch post is: #{batch_post}\")\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 10 - applying the test tags batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 10 - applying the test tags batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 10 - applying the test tags response code is: #{response.code}\")\n @file_log.info(\"POST 10 - applying the test tags response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 10 - applying the test tags results from :operation => tag post: #{results}\")\n @file_log.debug(\"POST 10 - applying the test tags results from :operation => tag post: #{results}\") if (@file_log)\n\n\n #POST 11 - setting the global viewers and permissions on the sakai docs\n batch_post = []\n batch_post[0] = {\"url\" => \"/p/#{library_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => [\"everyone\", \"anonymous\"]}}\n batch_post[1] = {\"url\" => \"/p/#{library_doc_hash}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => [\"everyone\", \"anonymous\"], \"privilege@jcr:read\" => \"granted\"}}\n batch_post[2] = {\"url\" => \"/p/#{participants_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => [\"everyone\", \"anonymous\"]}}\n batch_post[3] = {\"url\" => \"/p/#{participants_doc_hash}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => [\"everyone\", \"anonymous\"], \"privilege@jcr:read\" => \"granted\"}}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 11 - setting the global viewers and permissions on the sakai docs response code is: #{response.code}\")\n @file_log.info(\"POST 11 - setting the global viewers and permissions on the sakai docs response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs results from setting permissions on sakai docs #{results}\")\n @file_log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs results from setting permissions on sakai docs #{results}\") if (@file_log)\n\n #POST 12 - setting the member viewer and manager viewer for the sakai docs\n batch_post = []\n batch_post[0] = {\"url\" => \"/p/#{library_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => \"#{groupname}-member\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/p/#{library_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"/p/#{participants_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => \"#{groupname}-member\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post[3] = {\"url\" => \"/p/#{participants_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 12 - setting the member viewer and manager viewer for the sakai docs response code is: #{response.code}\")\n @file_log.info(\"POST 12 - setting the member viewer and manager viewer for the sakai docs response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = response.body[\"results\"]\n @log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs results from setting viewer and manager on sakai docs #{results}\")\n @file_log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs results from setting viewer and manager on sakai docs #{results}\") if (@file_log)\n\n #POST 13 - setting the doc structure on the sakai docs\n struct0 = {}\n str = \"{\\\"library\\\":{\\\"_title\\\":\\\"Library\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_view\\\":\\\"[\\\\\\\"everyone\\\\\\\",\\\\\\\"anonymous\\\\\\\",\\\\\\\"-member\\\\\\\"]\\\",\\\"_edit\\\":\\\"[\\\\\\\"-manager\\\\\\\"]\\\",\\\"_pid\\\":\\\"#{library_doc_hash}\\\"},\\\"participants\\\":{\\\"_title\\\":\\\"Participants\\\",\\\"_order\\\":1,\\\"_nonEditable\\\":true,\\\"_view\\\":\\\"[\\\\\\\"everyone\\\\\\\",\\\\\\\"anonymous\\\\\\\",\\\\\\\"-member\\\\\\\"]\\\",\\\"_edit\\\":\\\"[\\\\\\\"-manager\\\\\\\"]\\\",\\\"_pid\\\":\\\"#{participants_doc_hash}\\\"}}\"\n struct0[\"structure0\"] = str\n params = {}\n params[\":content\"] = JSON.generate struct0\n params[\":contentType\"] = \"json\"\n params[\":operation\"] = \"import\"\n params[\":replace\"] = true\n params[\":replaceProperties\"] = true\n params[\"_charset_\"] = \"utf-8\"\n @log.debug(\"POST 13 - setting the doc structure on the sakai docs post params are: \" + params.inspect)\n @file_log.debug(\"POST 13 - setting the doc structure on the sakai docs post params are: \" + params.inspect) if (@file_log)\n uri = \"/~#{groupname}/docstructure\"\n response = @sling.execute_post(@sling.url_for(uri), params)\n #this is an html response\n @log.info(\"POST 13 - setting the doc structure on the sakai docs response code: #{response.code}\")\n @file_log.info(\"POST 13 - setting the doc structure on the sakai docs response code: #{response.code}\") if (@file_log)\n\n # return the group that was created in create_target_group\n return group\n end",
"def create_group(user_ids)\n raise 'Attempted to create group channel on a non-pm channel!' unless pm?\n\n response = API::Channel.create_group(@bot.token, @id, user_ids.shift)\n channel = Channel.new(JSON.parse(response), @bot)\n channel.add_group_users(user_ids)\n end",
"def group_ids=(ids)\n ids.each do |group_id|\n if group_id.presence\n group = ::Burlesque::Group.find(group_id)\n self.groups << group unless self.groups.include?(group)\n end\n end\n\n to_deletes = []\n self.groups.each do |group|\n to_deletes << group unless ids.include?(group.id) or ids.include?(group.id.to_s)\n end\n\n to_deletes.each do |group|\n self.groups.delete(group) if self.group?(group)\n end\n end",
"def email_group_params\n params.require(:email_group).permit(:name, :description, users_ids: [])\n end",
"def set_groups(user, grouplist)\n\t\t\tend",
"def add_group_users(user_ids)\n raise 'Attempted to add a user to a non-group channel!' unless group?\n\n user_ids = [user_ids] unless user_ids.is_a? Array\n user_ids.each do |user_id|\n API::Channel.add_group_user(@bot.token, @id, user_id.resolve_id)\n end\n self\n end",
"def update_multiple\n params[:group_ids].each do |group_name|\n Admin::Group.find(group_name).delete\n end\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end",
"def update_multiple\n params[:group_ids].each do |group_name|\n Admin::Group.find(group_name).delete\n end\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end",
"def group_users_added(group_id, user_ids)\n # get role of group\n role = acl.get_group_role(group_id)\n return if role.nil?\n end",
"def group_params\n params.require(:group).permit(:name, :user_id, :description)\n end",
"def process_groups(gateway_name, phone, body)\n if !(from_user = is_sender_registered?(phone))\n return reply_to_sender_with_error(phone, REPLY_PHONE_NOT_REGISTERED)\n end\n groups = from_user.groups.collect { |g| g.name }.sort\n result = sprintf(REPLY_YOUR_GROUP_LIST, groups.length, groups.join(','))\n reply_to_sender(phone, result)\n return result, false\n end",
"def update_multiple\n params[:group_ids].each do |group_name|\n group = Admin::Group.new\n group.name = group_name \n group.resources.each do |resource|\n resource_obj = MediaObject.find(resource)\n read_groups = resource_obj.read_groups\n read_groups.delete(group_name) \n resource_obj.read_groups = read_groups\n resource_obj.save\n end\n \n RoleControls.remove_role(group_name)\n end\n RoleControls.save_changes\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end",
"def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\[email protected]_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend",
"def groups(*args)\n end",
"def create\n @notify = current_user.invited_members;\n if group_params[:name] == \"\"\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was Empty Cant created.' }\n end\n\t\t\t\n else\n if current_user.groups.exists? name: group_params[:name]\n\t\t\t\t#this group is already exist\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was Found .' }\n end\n else\n @group = Group.new(group_params.merge(user: current_user))\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :index }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end",
"def group_params\n params.require(:group).permit(:name, :group_image, user_ids: [])\n end",
"def group_params\n params.require(:group).permit(:org_id, :name, :description, permission_ids: [], user_ids: [])\n end",
"def group_params\n params.require(:group).permit(:user_id, :name)\n end",
"def groups_create(params = {})\n fail ArgumentError, \"Required arguments 'name' missing\" if params['name'].nil?\n response = @session.do_post \"#{SCOPE}.create\", params\n Slack.parse_response(response)\n end",
"def manage_groups\n \n if request.get?\n course_id = params[:id]\n @course = Course.find(course_id)\n \n group_1 = CourseGroup.find_all_by_course_id_and_group(course_id, 0).collect(&:user_id)\n group_2 = CourseGroup.find_all_by_course_id_and_group(course_id, 1).collect(&:user_id)\n\n course_students = StudentInCourse.find_all_by_course_id(course_id).collect(&:user_id)\n \n @ungrouped = User.find_all_by_id(course_students).reject{ |user| user.id.in? group_1 or user.id.in? group_2 }\n @group_1 = User.find_all_by_id(group_1)\n @group_2 = User.find_all_by_id(group_2)\n else #post request\n course_id = params[:id]\n group1 = params['group1']\n group2 = params['group2']\n ungrouped = params['ungrouped']\n \n \n \n CourseGroup.destroy_all(:course_id => course_id)\n group1.each do |user|\n CourseGroup.create(:course_id => course_id, :user_id => user, :group => 0)\n end\n group2.each do |user|\n CourseGroup.create(:course_id => course_id, :user_id => user, :group => 1)\n end\n \n render :nothing => true\n flash[:notice] = \"Groups updated!\"\n end\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def group_params\n params.require(:group).permit(:name, :user_id)\n end",
"def group_params\n params.require(:group).permit(:name, :user_id)\n end",
"def groups\r\n save_default_group(params)\r\n delete_group(params)\r\n end",
"def add_members_to_group(team_id, group_id, user_ids)\n params = { query: [team_id, group_id, :members, :add], req: user_ids.to_array_obj(:users) }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_put\n\n resource 'TeamUserGroup', data\n end",
"def create(id, user_id, name)\n user = get_user(user_id)\n group = Group.new(id, user.id, name)\n @@group[id] = group\n group.add(user.id)\n return \"Group Created\"\n end",
"def add_to_group\n if request.post?\n @user_id = params[:user_id]\n @group = params[:group_ids]\n @created_g_u= Array.new\n @group.each do |g|\n #g_user = GroupUser.find(:all,:conditions=>[\"user_id=#{@user_id.to_i} and group_id=#{g.to_i}\"])\n group_user = GroupUser.create(:user_id=>@user_id.to_i,:group_id=>g.to_i)# if g_user.blank?\n @created_g_u << group_user if group_user.id\n end\n @notice = \"Successfully added to group.\"\n respond_to do |format|\n format.js\n end\n \n else\n render :partial=>\"add_to_group_form\", :locals=>{:user=>@login_user,:user_id=>params[:id]}, :layout=>false\n end\n end",
"def group_params\n params.require(:group).permit!\n #params.require(:group).permit(:name, :email, :course_id, :creator_id, :creator_username, :creator_firstname, :creator_lastname, :creator_email, :members)\n end",
"def user_groups_operation(user, groups, operation)\n params = {\n :first => user['first'],\n :last => user['last'],\n :username => user['username'],\n :uid => user['uid']\n }\n \n groups.each do |group|\n params[:groupname] = group\n group_op = JSON.parse(\n @config[:templates][:group].result(binding),\n :symbolize_names => true\n )\n \n group_op[:ops].each do |op|\n op[0] = operation\n op[1] = op[1].to_sym\n end\n \n ret = modify({:name => \"localuser\", :ip => \"127.0.0.1\"}, group_op[:dn], group_op[:ops])\n end\n end",
"def group_params\n params.permit(:group_title, :image, new_members: [], del_members: [], new_admins: [], del_admins: [])\n end",
"def add_group(*args)\n end",
"def form_params\n params.require(:user).permit(:username,{ :group_ids => [] })\n end",
"def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end",
"def s_group_params\n params.require(:s_group).permit(:name, :manager, :admin_comment)\n end",
"def create\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.create(group_params)\n @owner = current_user\n if @group.persisted?\n flash[:green] = \"Group created!\"\n redirect_to groups_path\n else\n render root_path\n end\n end",
"def group(*groups)\n @current_groups = groups\n\n yield\n\n ensure\n @current_groups = nil\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def update_groups\n unless group_ids.nil?\n self.groups_members.each do |m|\n m.destroy unless group_ids.include?(m.group_id.to_s)\n group_ids.delete(m.group_id.to_s)\n end\n group_ids.each do |g|\n self.groups_members.create(:group_id => g) unless g.blank?\n end\n reload\n self.group_ids = nil\n end\n end",
"def set_group\n @group = Group.find(params[:id])\n @notify = current_user.invited_members;\n end",
"def edit_groups\n search_by_type_and_mode(:group, ::ACL.Write).map(&:agent_name)\n end",
"def move_users_to_group(group_id, arr_of_user_ids)\n arr_of_user_ids.each { |id|\n populate_group = HTTParty.post(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/memberships\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" },\n body: {\n user_id: id\n } \n )\n }\nend",
"def groups\n Group.groups(user_name)\n end",
"def watcher_group_ids_with_uniq_ids=(group_ids)\n if group_ids.is_a?(Array)\n group_ids = group_ids.uniq\n end\n send :watcher_group_ids_without_uniq_ids=, group_ids\n end",
"def twilio_create_group(name,owner_name,members)\n client = twilio_auth!\n twilio_broadcast!(client,members,\"Welcome to #{name} an event created by #{owner_name}\")\n end",
"def create\n name = params[:name]\n @group = Group.new(name: name)\n @group.creator_id = @current_user.id\n if @group.save\n @current_user.creator_join!(@group)\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20101, @group.errors.as_json)\n end\n end",
"def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end",
"def create_groups(groupnames)\r\n groupnames.map {|groupname| @logger.debug(\"Checking #{groupname} for existence...\")\r\n if get_groupid(groupname) == nil\r\n\t\t\t\[email protected](\"Looks like #{groupname} is empty, therefore creating it\")\r\n\t\t\t\tgroupobject = OpenNebula::Group.new(OpenNebula::Group.build_xml,@client)\r\n\t\t\t\trc = groupobject.allocate(groupname)\r\n\t\t\t\tif OpenNebula.is_error?(rc)\r\n \t\t\t\[email protected](\"Error occured while creating group: #{rc.message}\")\r\n \t\t end\r\n end\r\n }\r\n end",
"def groupChat _obj, _args\n \"_obj groupChat _args;\" \n end",
"def atest_ID_25862_new_post_in_group_you_manage()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Open Group\", \"Family\")\n logout_common\n login_as_user2\n post_to_any_group(\"Family\",groupName)\n logout_common\n login_as_user1\n verify_updates\n end",
"def atest_ID_25874_user_follows_a_group_you_manage()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Open Group\", \"News\")\n logout_common\n login_as_user2\n read_all_updates\n find_a_group(\"#{groupName}\")\n follow_a_group\n logout_common\n login_as_user1\n verify_updates\n end",
"def remove_group_users(user_ids)\n raise 'Attempted to remove a user from a non-group channel!' unless group?\n\n user_ids = [user_ids] unless user_ids.is_a? Array\n user_ids.each do |user_id|\n API::Channel.remove_group_user(@bot.token, @id, user_id.resolve_id)\n end\n self\n end",
"def create_group\n name_param = params[:name]\n description_param = params[:description]\n members_param = params[:members] || []\n maillists_param = params[:maillists] || []\n leader_id_param = params[:leader_id]\n join_type_param = params[:join_type]\n\n if name_param.nil? || name_param.blank?\n render json: { field: 'name', error: 'You must provide a name for your space' }, status: :bad_request\n return\n end\n\n unless group_name_is_unique? name_param\n render json: { field: 'name', error: \"A Space named \\\"#{name_param}\\\" already exists\" }, status: :bad_request\n return\n end\n\n if description_param.nil? || description_param.blank?\n render json: { field: 'description', error: 'No description specified' }, status: :bad_request\n return\n end\n\n if join_type_param.nil? || join_type_param.blank?\n render json: { field: 'join_type', error: 'No join_type specified' }, status: :bad_request\n return\n end\n\n if (!params[:maillist].empty? && !maillist_is_valid?(params[:maillist]))\n render json: { field: 'maillist', error: \"\\\"#{params[:maillist]}\\\" is not a valid maillist\" }, status: :bad_request\n return\n end\n\n # concat maillist members into the members array so they get added for the initial load\n members_param.concat maillist_members(params[:maillist]) unless params[:maillist].empty?\n\n # filter out non-canvas users\n members = members_param.map do | member |\n pseudonym = Pseudonym.active.by_unique_id member\n pseudonym.first.user unless pseudonym.empty?\n end\n members.compact.uniq!\n\n if @current_user.account.site_admin?\n if leader_id_param && !leader_id_param.blank?\n leader = User.find_by_id(leader_id_param)\n if leader.nil?\n render json: { error: \"Can't find user specified for leader\" }, status: :bad_request\n return\n end\n else\n leader = @current_user\n end\n else\n # if a non-admin is creating the group then\n # the leader is that user and that id is used to determine who \"owns\"\n # the group and can make changes to it\n leader = @current_user\n end\n\n if join_type_param == 'free_to_join'\n join_type = 'parent_context_auto_join'\n elsif join_type_param == 'request'\n join_type = 'parent_context_request'\n elsif join_type_param == 'invite_only'\n join_type = 'invitation_only'\n else\n render json: { field: 'join_type', error: 'Invalid join_type value. Valid: request, free_to_join, invite_only' }, status: :bad_request\n return\n end\n\n group = @domain_root_account.groups.create( name: name_param,\n group_category: CanvasSpaces.GroupCategory,\n leader: leader,\n join_level: join_type,\n description: description_param )\n group.add_user(leader)\n group.save\n members.each { |member| group.add_user(member) } unless members.empty?\n\n add_maillist = set_maillist_for_space(group.id, params[:maillist]) unless params[:maillist].empty?\n\n render json: group.as_json(only: [ :id, :name, :description, :leader_id, :created_at ],\n include_root: false)\n .merge({ size: 0, join_type: join_type_param }), status: :ok\n end",
"def users_and_groups=(value)\n @users_and_groups = value\n end",
"def group_comment_params\n params.require(:group_comment).permit(:body, :user_id, :group_id)\n end",
"def filter_owner(group_ids)\n group_ids = Array(group_ids)\n group_ids.delete(user.my_group_id)\n group_ids\n end",
"def add_x_users(num, *args)\n\n puts \"Adding #{num} users, params=#{args.inspect}\"\n\n org = Org.find(:first)\n\n name = \"Test User\"\n login_name = \"testuser\"\n password = \"password\"\n phone = \"+123456789\"\n validated = true\n group_name = nil\n\n if args.length==1\n params = args[0]\n name = params[:name] if params[:name]\n login_name = params[:username] if params[:username]\n password = params[:password] if params[:password]\n phone = params[:phone] if params[:phone]\n validated = params[:validated] if params[:validated]\n group_name = params[:group]\n end\n\n if group_name and Group.find_by_name(:first,group_name)\n raise \"The group #{group_name} already exists!\"\n end\n \n # find the first unique test user name\n next_avail_user_num = 0\n found = true\n while found do\n next_avail_user_num = next_avail_user_num + 1\n found = User.find_by_login_name(login_name+next_avail_user_num.to_s) != nil \n print \".\"\n end\n\n puts \"found next #{login_name} #{next_avail_user_num}\"\n\n users = []\n num.times do |i|\n u = User.new\n u.org = org\n u.name = name + (next_avail_user_num+i).to_s\n u.login_name = login_name + (next_avail_user_num+i).to_s\n u.password = password\n u.phone = phone\n u.save!\n u.force_sms_validation!(validated)\n users << u\n puts \"Added user #{u.inspect}\"\n end\n\n if group_name\n # now create the group_name from this\n group = Group.new\n group.org = org\n group.name = group_name\n group.save!\n puts \"Added group #{group.inspect}\"\n users.each do |u|\n u.groups << group\n end\n puts \"Added all users to groups\"\n end\n\n users\nend",
"def update\n @groups = Group.all\n @users = User.all\n @message = Message.find(params[:id])\n if params[:message_group_ids] \n @select_group_ids = params[:message_group_ids]\n end\n if !params[:message_group_ids].nil?\n params[:message_group_ids].each do |group_id|\n user_ids = Group.find(group_id).users.collect(&:id)\n user_ids.each do |user_id|\n if !params[:message][:user_ids].include?(user_id.to_s)\n params[:message][:user_ids] << user_id.to_s\n end\n end\n end\n end\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: t(:message_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def group_params\n params.require(:group).permit(:user_id, :name, :describe)\n end",
"def edit_groups_string=(groups)\n self.edit_groups = groups.split(/[\\s,]+/)\n end",
"def update_muscle_groups groups\n groups = {} unless groups.is_a?(Hash)\n groups.symbolize_keys\n self.muscle_groups = \"\"\n Activity::MUSCLE_GROUP_VALUES.each do |name|\n bit = groups[name] == \"1\" ? \"1\" : \"0\"\n self.muscle_groups = self.muscle_groups + bit\n end\n end",
"def groups(*groups); end",
"def groups(*groups); end",
"def createGroup _args\n \"createGroup _args;\" \n end",
"def groupreply_params\n params.require(:groupreply).permit(:body, :user_id, :groupmessage_id)\n end",
"def groups=(value)\n @groups = value\n end",
"def add_groups_with_role(group_ids, role, want_affected)\n # filter out the owning user so never accidentally downgraded\n group_ids = filter_owner(group_ids)\n affected_user_ids = []\n\n if want_affected\n # determine users with the exact role currently\n users_with_role_before = acl.get_users_with_role(role, true)\n # add the groups to the role\n acl.add_groups(group_ids, role)\n # determine users with the exact role now\n users_with_role_after = acl.get_users_with_role(role, true)\n # now see which users just got this role. If they already had the role, they\n # will be in the user_ids_with_role_before list and can be excluded\n affected_user_ids = users_with_role_after - users_with_role_before\n else\n acl.add_groups(group_ids, role)\n end\n\n affected_user_ids\n end",
"def add_groups(group_ids = [])\n g = self.groups.pluck(:id)\n self.promotion_groups.where(group_id: g - group_ids).destroy_all\n (group_ids - g).each do |g_id|\n self.promotion_groups.create(group_id: g_id)\n end\n end",
"def add_new_groups(params = {})\n post(\"/groups\", params)\n end",
"def add_to_group(group_id, users)\n url = \"/groups/#{group_id}/members\"\n body = {\n members: users\n }\n post(url, body)\n end",
"def group_get_info(external_group_ids: nil, group_ids: nil, trace: false)\n if group_ids != nil\n group_query = \"{\\\".tag\\\":\\\"group_ids\\\",\\\"group_ids\\\":[\\\"#{group_ids.join('\",\"')}\\\"]}\"\n elsif external_group_ids != nil\n group_query = \"{\\\".tag\\\":\\\"group_external_ids\\\",\\\"group_external_ids\\\":[\\\"#{external_group_ids.join('\",\"')}\\\"]}\"\n else\n return nil\n end\n dropbox_query(query: '2/team/groups/get_info', query_data: group_query, trace: trace)\n end",
"def assign_multiple_notes_form\n @note_ids = params[:note_ids].split(',')\n @notes=[]\n for note_id in @note_ids\n @notes << Communication.find(note_id)\n end\n @common_clusters = notes_tasks_common_clusters(@notes)\n @valid = !@common_clusters.blank? && !@common_clusters.class.eql?(String)\n if @valid\n livian_users = User.all_cluster_livian(@common_clusters)\n @livian_users = livian_users.blank? ? \"\" : livian_users.collect{|user|[user.full_name,user.id]}\n end\n render :layout => false\n end",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @group = Group.new(group_params)\n @group.admin_id = current_user.id\n respond_to do |format|\n if @group.save\n\tUserGroup.create(admin: true, user_id: current_user.id, group_id: @group.id)\n\tflash[:success] = \"Group was successfully created!\"\n format.html { redirect_to @group }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end",
"def groups()\n id_list = SQLQuery.new.get('groups_handler', ['group_id']).where.if('user_id', @id).send\n groups_list = []\n id_list.each do |id|\n groups_list << Groupchat.get(id['group_id'])\n end\n return Sorter.last_interaction(groups_list)\n end",
"def group_add_members(emails:, external_group_id: nil, group_id: nil, trace: false)\n members = []\n emails.each do |e|\n members << \"{\\\"user\\\":{\\\".tag\\\":\\\"email\\\",\\\"email\\\":\\\"#{e}\\\"},\\\"access_type\\\":{\\\".tag\\\":\\\"member\\\"}}\"\n end\n group_query = if group_id.nil?\n \"{\\\"group\\\":{\\\".tag\\\":\\\"group_external_id\\\",\\\"group_external_id\\\":\\\"#{external_group_id}\\\"},\\\"members\\\":[#{members.join(',')}]}\"\n else\n \"{\\\"group\\\":{\\\".tag\\\":\\\"group_id\\\",\\\"group_id\\\":\\\"#{group_id}\\\"},\\\"members\\\":[#{members.join(',')}]}\"\n end\n # puts group_query\n dropbox_query(query: '2/team/groups/members/add', query_data: group_query, trace: trace)\n end",
"def group(name, &blk)\n add_child(:groups, Hubcap::Group.new(self, name, &blk))\n end",
"def create\n @user = current_user\n @order = @user.order.new(order_params)\n respond_to do |format|\n if @order.save\n group_params['group_ids'].each do |g|\n gu = GroupUser.where(group_id: g)\n gu.each do |u|\n @u = User.find(u.user_id)\n @u.orders << Order.find(@order.id)\n end\n end\n\n format.html { redirect_to orders_path, notice: 'Order was successfully created.' }\n # format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n # format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def group_request (v1_requests_params)\n req = Request.find(v1_requests_params[:id])\n @group = Group.where(id: v1_requests_params[:group_id]).first\n user = User.find(req.reciever_id)\n if v1_requests_params[:response]\n @group.users << user\n end\n @group\n end",
"def edit_groups_string\n edit_groups.join(', ')\n end",
"def add_group_members(members)\n logger.debug(\"#{new_resource} adding members #{members.join(\", \")}\") unless members.empty?\n members.each do |user|\n shell_out!(\"user\", \"mod\", \"-G\", new_resource.group_name, user)\n end\n end",
"def group_params\n params.require(:group).permit(:user_id, :identifier, :name, :description, :group_type, :tags, :member_count, :topic_count, :post_count, :lat, :lng)\n end",
"def create\n @users = User.all\n @groups = Group.all\n if params[:message_group_ids]\n @select_group_ids = params[:message_group_ids]\n end\n params[:message][:user_id] = current_user.id\n if !params[:message_group_ids].nil?\n params[:message_group_ids].each do |group_id|\n user_ids = Group.find(group_id).users.collect(&:id)\n user_ids.each do |user_id|\n unless params[:message][:user_ids].include?(user_id.to_s)\n params[:message][:user_ids] << user_id.to_s\n end\n end\n end\n end\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: t(:message_created) }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_user(data)\n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => data[:usrgrpids],\n :userids => data[:userids]\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def save_group_visibilities(group_ids)\n groups.clear\n if group_ids\n selected_groups = Group.find(group_ids)\n selected_groups.each do |group|\n groups << group\n end\n end\n end",
"def add_contributors(group_ids, want_affected = false)\n add_groups_with_role(group_ids, AlbumACL::CONTRIBUTOR_ROLE, want_affected)\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => group_id, :user_id => user_id)\n \tm.save\n end",
"def create_group(name, description, visible, owner_id=nil)\n url = \"/groups/#{name}\"\n body = {\n description: description,\n visible_to_all: visible,\n }\n body[:owner_id] = owner_id unless owner_id.nil? || owner_id.empty?\n put(url, body)\n end",
"def setGroupId _obj, _args\n \"_obj setGroupId _args;\" \n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def test_add_multiple_users\n quietly do\n assert_cmd_posts(\"add to #{id} #{users[0]} #{users[1]}\",\n \"/api/v2/usergroup/#{id}/addUsers\",\n users.to_json)\n end\n end",
"def create_a_user_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IamUserGroupsApi.create_a_user_group ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/user-groups'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"IamUserGroupsApi.create_a_user_group\",\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: IamUserGroupsApi#create_a_user_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def user_group_params\n params.permit(:name, :description)\n end",
"def invite_users\n if GroupsController.group_owner? current_user.id, params[:id]\n set_group\n params[:users].each do |email|\n user = User.find_by_email(email) # TODO: only possible because email is unique. Should make magic assist to return user id's\n @group.users << user unless @group.users.include? user or user.nil?\n end unless params[:users].nil?\n respond_to do |format|\n format.html { redirect_to group_path(@group), alert: 'Invited users successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to groups_path, alert: \"Not invited. You are not the group owner\" }\n format.json { render json: \"Only owners can add users to the respective group\", status: :unauthorized}\n end\n end\n end",
"def group_member_ids\n member_ids(\"Group\")\n end"
] | [
"0.6211643",
"0.597901",
"0.5842245",
"0.58307934",
"0.58105415",
"0.5749629",
"0.5683097",
"0.5631074",
"0.55885214",
"0.5519266",
"0.5519266",
"0.5482365",
"0.54697216",
"0.5469077",
"0.5463548",
"0.5412069",
"0.53925276",
"0.5386765",
"0.53752464",
"0.5362075",
"0.5334245",
"0.53314024",
"0.532265",
"0.5308132",
"0.5304503",
"0.52941614",
"0.52941614",
"0.5245282",
"0.5244804",
"0.5203435",
"0.5196773",
"0.51877993",
"0.51868135",
"0.518264",
"0.5166655",
"0.5166007",
"0.5163923",
"0.5158356",
"0.5151025",
"0.5150827",
"0.51445234",
"0.5140942",
"0.51406854",
"0.5138528",
"0.5134859",
"0.5123589",
"0.5119809",
"0.51004523",
"0.5097209",
"0.5093667",
"0.50918597",
"0.5089169",
"0.5087546",
"0.5085372",
"0.50794655",
"0.50719094",
"0.5060694",
"0.5053532",
"0.50409883",
"0.50397104",
"0.50373286",
"0.5027671",
"0.50272495",
"0.50238484",
"0.50208896",
"0.50208896",
"0.5014376",
"0.5012733",
"0.50124496",
"0.5004256",
"0.5003799",
"0.5001808",
"0.49986842",
"0.49961692",
"0.49807817",
"0.49716377",
"0.49710023",
"0.49611136",
"0.49544767",
"0.4952352",
"0.49522614",
"0.49520198",
"0.49505833",
"0.49472764",
"0.49464703",
"0.49410725",
"0.49393022",
"0.493155",
"0.4929475",
"0.49266967",
"0.49266627",
"0.4923965",
"0.49235514",
"0.49209252",
"0.4915529",
"0.49139073",
"0.49130437",
"0.49127468",
"0.490533",
"0.49047622"
] | 0.519643 | 31 |
GET /api/tests/testable?resource= Get the details of a given test plan : test cases resources covered by test cases Since v.3.5 ==== Examples get the test plan defined by the file com/mycompany/FooTest.c of my_project : GET /api/tests/plan?resource=my_project:com/mycompany/FooTest.c | def testable
require_parameters :resource
resource=Project.by_key(params[:resource])
not_found("Not found: #{params[:resource]}") unless resource
access_denied unless has_role?(:user, resource)
testable = java_facade.testable(resource.key)
json = {}
if testable
resource = testable.component
json[:key] = resource.key
json[:name] = resource.name if resource.name
json[:longName] = resource.longName if resource.longName
json[:coveredLines] = testable.testedLines
json[:coverages] = testable.coverageBlocks.map do |coverage|
test_case = coverage.testCase
coverage_json = {}
coverage_json[:lines] = coverage.lines
coverage_json[:name] = test_case.name
coverage_json[:status] = test_case.status.to_s if test_case.status
coverage_json[:durationInMs] = test_case.durationInMs
coverage_json[:testPlan] = test_case.testPlan.component.key
coverage_json.delete_if { |k, v| v.nil? }
coverage_json
end
end
json.delete_if { |k, v| v.nil? }
respond_to do |format|
format.json { render :json => jsonp(json) }
format.xml { render :xml => xml_not_supported }
format.text { render :text => text_not_supported }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end",
"def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_plans/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end",
"def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_plan }\n end\n end",
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @test_plans = @project.test_plans\n end",
"def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end",
"def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = testrail_send('get', uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = testrail_send('get', uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = testrail_send('get', uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = testrail_send('get', uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end",
"def test_info(project_name, plan_name, test_case_name)\n test_plan_id = test_plan_id(project_name, plan_name)\n test_cases = test_cases_for_test_plan(test_plan_id)\n\n test_cases.values.find do |test_case|\n test_case[:name] == test_case_name\n end\n end",
"def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = @testrail.send_get(uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = @testrail.send_get(uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = @testrail.send_get(uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = @testrail.send_get(uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end",
"def find_test_plans()\n begin\n plan_shells = @testrail.send_get(\"get_plans/#{@tr_project['id']}\")\n plans = []\n plan_shells.each do |plan_shell|\n plan = @testrail.send_get(\"get_plan/#{plan_shell['id']}\")\n runs = []\n tests = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n run = @testrail.send_get(\"get_run/#{run_shell['id']}\")\n runs.push(run)\n test = @testrail.send_get(\"get_tests/#{run_shell['id']}\")\n tests.push(test)\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n \n return plans\n end",
"def get_ab_tests(opts = {})\n @transporter.read(:GET, '/2/abtests', {}, opts)\n end",
"def show\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end",
"def test_resource\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal('resource', schema.resource('resource').name)\n end",
"def show\n set_client_profile(@plan)\n @goals = @plan.goals\n @tasks = @plan.tasks\n end",
"def test_describe_plan\n response=@root_key_api.describe_plan(\"[email protected]\",\"password\",@account_id)\n assert_equal Hash, response.class\n assert_include response, 'type'\n assert_equal 'Free', response['type']\n end",
"def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_cases/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end",
"def fetch_plans (id = nil)\n @plans = []\n parameters = {}\n @networks_by_plan = {}\n parameters[:_profile] = 'http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-InsurancePlan' \n if(id)\n parameters[:_id] = id\n end\n\n @client.search(\n FHIR::InsurancePlan,\n search: { parameters: parameters }\n )&.resource&.entry&.map do |entry|\n @plans << {\n value: entry&.resource&.id,\n name: entry&.resource&.name\n }\n @networks_by_plan [ entry&.resource&.id] = entry&.resource&.network\n end\n @plans.sort_by! { |hsh| hsh[:name] }\n rescue => exception\n redirect_to root_path, flash: { error: 'Please specify a plan network server' }\n\n end",
"def get_of_with_http_info(project_id, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: TestrunApi.get_of ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling TestrunApi.get_of\" if project_id.nil?\r\n if opts[:'parent_type'] && !['root', 'release', 'test-cycle', 'test-suite'].include?(opts[:'parent_type'])\r\n fail ArgumentError, 'invalid value for \"parent_type\", must be one of root, release, test-cycle, test-suite'\r\n end\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/test-runs\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'parentId'] = opts[:'parent_id'] if !opts[:'parent_id'].nil?\r\n query_params[:'parentType'] = opts[:'parent_type'] if !opts[:'parent_type'].nil?\r\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'TestRunListResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: TestrunApi#get_of\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"def get_campaign_plan_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MarketingApi.get_campaign_plan_all_using_get ...'\n end\n # resource path\n local_var_path = '/campaign_plan'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n 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 => 'PageCampaignPlan')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MarketingApi#get_campaign_plan_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_service_plans()\n @client.service_plans\n end",
"def get(resource)\n puts construct_url(@mode, resource)\n @agent.get construct_url(@mode, resource)\n end",
"def test_resource_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal('resource',\n schema.resource('resource').link('list').resource_name)\n end",
"def test_pretty_resource_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('another-resource').link('list')\n assert_equal('another-resource', link.pretty_resource_name)\n end",
"def show\n @vendor_test_plan = VendorTestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor_test_plan }\n end\n end",
"def url\n resource.url + '/application_plans'\n end",
"def resources_mode\n OrigenTesters::Interface.with_resources_mode do\n yield\n end\n end",
"def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def retrieve_plan_list\n options = { limit: 100 }\n options[:offset] = @offset if @offset.present?\n ChargeBee::Plan.list(options)\n end",
"def index\n respond_with(@plans = Plan.all)\n end",
"def api_v1_online_job_plans_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OnlineJobPlanApi.api_v1_online_job_plans_get ...'\n end\n # resource path\n local_var_path = '/api/v1/online_job_plans'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'filter[id]'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'filter[owner_id]'] = opts[:'filter_owner_id'] if !opts[:'filter_owner_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/vnd.api+json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiEmail', 'apiToken']\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 => 'OnlineJobPlansResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OnlineJobPlanApi#api_v1_online_job_plans_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_test_plan_items(test_plan_id=nil)\r\n if test_plan_id.nil?\r\n if params.key?(\"test_plan_id\") && (!params[\"test_plan_id\"].nil?) #For Web browser test\r\n test_plan_id=params[\"test_plan_id\"]\r\n elsif !params.key?(0) || !params.key?(\"test_plan_id\") || (params[\"test_plan_id\"].nil?) \r\n raise(\"Test Plan ID is required\")\r\n else\r\n test_plan_id=params[0][\"test_plan_id\"]\r\n end\r\n end\r\n begin\r\n sf_test_plan=SfTestPlan.find(test_plan_id.to_i)\r\n rescue ActiveRecord::RecordNotFound => recnotfound\r\n raise \"Test Plan Unknown\"\r\n end\r\n if (sf_test_plan.nil?)\r\n raise(\"Test Plan [\"+test_plan_id+\"] Not Known\")\r\n end\r\n logger.debug \"Getting Test Plan for :\" + test_plan_id.to_s\r\n sfchannels=sf_test_plan.sf_test_channels.collect { |sfc|\r\n { \r\n :number => sfc.sf_channel.channel_number,\r\n :name => sfc.sf_channel.channel_name,\r\n :chtype => sfc.sf_channel.channel_type,\r\n :direction => sfc.sf_channel.direction,\r\n :freq => sfc.sf_channel.display_frequency,\r\n :dtls => sfc.sf_channel.channel_dtls\r\n }\r\n }\r\n testplan= [{ :sfchannels => sfchannels}]\r\n respond_to do |format|\r\n format.xml { render :xml => sfchannels }\r\n format.amf { render :amf => testplan }\r\n end\r\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end",
"def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end",
"def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end",
"def test_description\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal('Show all sample resources',\n schema.resource('resource').link('list').description)\n end",
"def show\n @new_plan = Plan.new\n @incident = Incident.find(params[:incident_id])\n @resources = @incident.resources.order(:category, :order_number)\n @resource = Resource.new\n @plan = Plan.find(params[:id])\n @plans = Plan.all.order(date: :desc)\n @objectives = @plan.objectives.order(order: :asc)\n @objective = Objective.new\n @activity = Activity.new\n end",
"def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end",
"def test_list_available_resources\n puts \"## list_available_resources (retrieveable SF objects) ##\"\n resp = Salesforce::Rest::AsfRest.xlist_available_resources()\n\n resp.each {|key, val| pp key + ' => ' + val.to_s}\n assert !resp.nil?\n end",
"def show\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case = @test_suite.test_cases.find(params[:id])\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def test_resources\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal(['resource', 'another-resource', 'underscored_resource'],\n schema.resources.map(&:name))\n end",
"def get_test_plan\n @takt = Taktinfo.find(params[:id])\n @testplans = @takt.testplans.where(:format =>params[:testp])\n\n respond_to do |format|\n format.json{render json:@testplans.as_json(root:false),:callback =>params[:callback]}\n end\n end",
"def index\n @actual_action_plans = ActualActionPlan.all\n end",
"def descriptive_resources\n find_related_frbr_objects( :is_described_by, :which_resources?) \n end",
"def descriptive_resources\n find_related_frbr_objects( :is_described_by, :which_resources?) \n end",
"def show_service_plan_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServicePlansApi.show_service_plan ...'\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 ServicePlansApi.show_service_plan\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling ServicePlansApi.show_service_plan, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/service_plans/{id}'.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\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] || 'ServicePlan' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: ServicePlansApi#show_service_plan\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_resource(identity)\n @subject.get(identity, TEST_ZONE)\n end",
"def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end",
"def show\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def show_resource(resource, opts)\n debug \"i m in show resource\"\n unless about = opts[:req].path\n throw \"Missing 'path' declaration in request\"\n end\n path = opts[:path] || about\n\n case opts[:format]\n when 'xml'\n show_resources_xml(resource, path, opts)\n when 'ttl'\n self.class.omn_response_json(resource, opts)\n else\n show_resources_json(resource, path, opts)\n end\n end",
"def status\n @plan = Plan.find(params[:id])\n authorize @plan\n respond_to do |format|\n format.json { render json: @plan.status }\n end\n end",
"def set_test_plan\n @test_plan = TestPlan.where(project_id: @project.id).find(params[:id])\n end",
"def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end",
"def test_change_plan\n response=@root_key_api.change_plan(\"[email protected]\",\"password\",@account_id, \"Bronze\")\n \n response=@root_key_api.describe_plan(\"[email protected]\",\"password\",@account_id)\n assert_include response, 'type'\n assert_equal 'Bronze', response['type']\n\n response=@root_key_api.change_plan(\"[email protected]\",\"password\",@account_id, \"Free\")\n end",
"def show\n set_client_profile(@goal)\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n\n @needs = @goal.needs\n end",
"def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end",
"def test_parameter_details\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('info')\n parameters = link.parameter_details\n assert_equal(1, parameters.length)\n parameter = parameters[0]\n assert_equal('resource_uuid_field', parameter.name)\n assert_equal('A sample UUID field', parameter.description)\n end",
"def resources\n @task[:resources]\n end",
"def index\n authorize Plan\n @plans = Plan.includes(:roles).active(current_user).page(1)\n @organisationally_or_publicly_visible = if current_user.org.is_other?\n []\n else\n Plan.organisationally_or_publicly_visible(current_user).page(1)\n end\n # TODO: Is this still used? We cannot switch this to use the :plan_params\n # strong params because any calls that do not include `plan` in the\n # query string will fail\n @template = Template.find(params[:plan][:template_id]) if params[:plan].present?\n end",
"def resource(path, params={})\n r = Resource.process_detailed(self, *do_get(path, params))\n\n # note that process_detailed will make a best-effort to return an already\n # detailed resource or array of detailed resources but there may still be\n # legacy cases where #show is still needed. calling #show on an already\n # detailed resource is a no-op.\n r.respond_to?(:show) ? r.show : r\n end",
"def info(test_id, options={})\n args = {testId: test_id}.merge(options)\n get('testinfo', args)\n end",
"def test_shall_list_briefcase_items\n login_as :administrator\n get :list\n assert :success\n end",
"def show\n @service_plan = ServicePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_plan }\n end\n end",
"def show\n @plan = Plan.find(params[:id])\n end",
"def resource\n @resource\n end",
"def resourceType\n 'InsurancePlan'\n end",
"def show\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plan }\n end\n end",
"def show\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plan }\n end\n end",
"def show\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plan }\n end\n end",
"def show\r\n @work_plan = WorkPlan.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @work_plan }\r\n end\r\n end",
"def plan\n plan_rebuilder.plan\n end",
"def plan_information(plan, options = {})\n apps = get_option(options, \"apps\", [])\n stages = get_option(options, \"stages\", [])\n report = []\n plan.plan_stages.each do |stage|\n if stages.empty? || stages.include?(stage.name)\n report << {\"stage\" => stage.name}\n components = []\n requests = stage.requests.include(:apps_requests).where(\"aasm_state IN ('complete, planned')\").order(\"apps_requests.app_id, aasm_state, requests.id DESC\")\n cur_app = \"\"; cur_env = \"\"\n request.each do |request|\n if request.app_name.first != cur_app\n report += components.sort{|a,b| a[\"component\"] <=> b[\"component\"] }\n report << {\"app\" => request.app_name.first, \"environment\" => request.environment.name }\n components = []\n cur_app = request.app_name.first\n end\n request_component_versions(request).each do |comp, ver|\n components << {\"component\" => comp, \"version\" => ver, \"request\" => request.number, \"environment\" => request.environment.name }\n end\n end\n end\n end\n report\nend",
"def all\n describe(resource_uri)\n end",
"def resource\n @index.project.resource( @id )\n end",
"def test_parameter_details_without_parameters\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('list')\n assert_equal([], link.parameter_details)\n end",
"def show\n @work_plan = WorkPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_plan }\n end\n end",
"def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end",
"def get(\n id,\n deadline: nil\n )\n req = V1::ResourceGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"Resources.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = ResourceGetResponse.new()\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource)\n resp\n end",
"def tests(run_id)\n get(\"get_tests/#{run_id}\")\n end",
"def describe_resource(base_path, options = {}, &block)\n abstract_describe(base_path, { single_resource: true }.merge(options), &block)\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_suite }\n end\n end",
"def tst_plan_name\n defined?(@@test_plan) ? @@test_plan : nil\n end",
"def show\n @test_set = TestSet.find(params[:id])\n permitted_to! :inspect, @test_set.problem\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_set }\n end\n end",
"def list_plans(filter: nil)\n {\n plans: filter_content(pal.list_plans_with_cache(filter_content: true), filter),\n modulepath: pal.user_modulepath\n }\n end",
"def plan_questions(plan_id, opts)\n HTTParty.get('https://www.lift.do/api/v3/plans/%d/questions' % plan_id, @options.merge(query: opts))\n end",
"def list(resource,limit=0,params={})\n uri = '/api/' + resource.to_s\n params.merge!({limit: limit.to_s})\n http_get(uri,params)\n end",
"def suite_info(project_name, plan_name, suite_name)\n test_plan_id = test_plan_id(project_name, plan_name)\n test_suites = test_suites_for_test_plan(test_plan_id)\n\n if test_suites.empty?\n return nil\n end\n\n test_suites.find do |test_suite|\n test_suite[:name].include? suite_name\n end\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def all_plans\n file = File.read('./data/bundle.json')\n plan_hash = JSON.parse(file)\n plans = plan_hash['plans']\n end",
"def plan(accountname)\n response = get_request(\"/users/#{accountname}/plan\")\n end",
"def plan(accountname)\n response = get_request(\"/users/#{accountname}/plan\")\n end",
"def show \n\t\trender_direct Testcase.find(params[:id])\n end",
"def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan }\n end\n end",
"def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end",
"def show_all\n styled_header('Resources')\n display_addons(get_addons, ['Plan', 'Name', 'Billed to', 'Price'])\n end",
"def execute_plan_tests(node, plan)\n @env.ui.info(\"[#{node.name}]\")\n close_ssh\n configure_serverspec(node)\n plan['flags'].prepend \"-I #{@config.spec.directory} \"\n ret_code = RSpec::Core::Runner.run(plan['flags'].split, $stderr, $stdout)\n RSpec.clear_examples\n @ret_code = ret_code unless ret_code.zero?\n end",
"def list_tests(target,\n project,\n machine,\n pool,\n test_type = nil,\n test_status = nil,\n playlist = nil)\n handle_action_exceptions(__method__) do\n cmd_line = [\"listtests '#{target}' '#{project}' '#{machine}' '#{pool}'\"]\n cmd_line << 'json' if @json\n cmd_line << \"-#{test_type}\" unless test_type.nil?\n cmd_line << \"-#{test_status}\" unless test_status.nil?\n\n do_list_tests(cmd_line, playlist)\n end\n end",
"def show\n admin_only do\n \t# get the schedule object to be shown.\n\t @test = get_test_with_rescue\n @suite = TestSuites.where(:scheduleid => @test.id)\n end\n end",
"def show\n render json: @plan\n end"
] | [
"0.6353359",
"0.62036073",
"0.60681015",
"0.6039246",
"0.6034119",
"0.59960186",
"0.58718604",
"0.584755",
"0.5809333",
"0.5755498",
"0.57186514",
"0.5650956",
"0.5615706",
"0.5615158",
"0.5608367",
"0.5582736",
"0.55267173",
"0.55170166",
"0.5514333",
"0.5508896",
"0.5499957",
"0.5496946",
"0.5486307",
"0.54726774",
"0.5446945",
"0.54200923",
"0.541116",
"0.54110533",
"0.53651386",
"0.53614706",
"0.5359615",
"0.5346494",
"0.5341426",
"0.5341426",
"0.5322184",
"0.5318942",
"0.5315937",
"0.53122824",
"0.5312167",
"0.53119016",
"0.53053266",
"0.5297227",
"0.529329",
"0.52732944",
"0.52732944",
"0.5264358",
"0.52534306",
"0.524667",
"0.523307",
"0.5218662",
"0.52161235",
"0.52142227",
"0.52136236",
"0.5212475",
"0.5203893",
"0.5203775",
"0.52023053",
"0.51958287",
"0.51929593",
"0.5188295",
"0.5185243",
"0.51780283",
"0.5177485",
"0.5175427",
"0.51746005",
"0.51735353",
"0.51718223",
"0.51718223",
"0.51718223",
"0.51652145",
"0.5149885",
"0.5148478",
"0.514838",
"0.5144141",
"0.51430416",
"0.51409924",
"0.5136681",
"0.51168966",
"0.5114728",
"0.5113773",
"0.51137084",
"0.51097727",
"0.5104023",
"0.50924796",
"0.5091545",
"0.50729835",
"0.50673693",
"0.50667435",
"0.50667435",
"0.50642467",
"0.5058422",
"0.5058422",
"0.50514174",
"0.5048575",
"0.5048008",
"0.5045106",
"0.5043405",
"0.50408363",
"0.50397336",
"0.50334555"
] | 0.6823678 | 0 |
Creates a wrapped function spec based on the provided spec. The hash must have the following keys: name:: the name of the wrapped function params:: a list of parameters to supply when calling Each member of the params list must be a hash, with a mandatory key of 'value' holding the value to be supplied as the parameter. If only a 'name' key is provided, this will be used as the value. A 'type' may be supplied as well, and is necessary if an equivalent struct or pointer is to be supplied as the value so that casting can be performed correctly. The following key is optional: includes:: a list of includes needed for this function | def initialize(spec)
@spec = self.class.normalize_spec_hash(spec)
check = @spec['error-check']
@error_rules = check['rules'].map do |rule_spec|
RuleSpec.new(rule_spec)
end
action = check['error-action']
@error_action = ActionSpec.new(action) unless @error_rules.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_from(function_spec)\n resolved_params = []\n\n @spec['params'].each do |param|\n resolved_params << function_spec.resolve_wrapped_param(param)\n end\n\n \"#{@spec['name']}( #{resolved_params.join(', ')} )\"\n end",
"def json_spec(name, &block)\n # Parse the input token data\n Data.generate(json_spec_path, name, &block)\n end",
"def initialize(spec)\n @spec = ParamSpec.normalize_spec_hash(spec)\n @type = TypeSpec.new(@spec['type'])\n end",
"def register_spec_type(*args, &block); end",
"def to_proc(spec=nil, &block)\n # Split the filter spec into a straight value => value hash and a pattern => value hash.\n ph, vh = spec.split { |k, v| k =~ REGEXP_PAT }\n # The Regexp => value hash is built from the pattern => value hash.\n reh = regexp_hash(ph)\n # The value proc.\n value_proc(reh, vh)\n end",
"def field(spec, name = nil, data_lambda = nil)\n @field_specs << spec\n add_field(name, data_lambda)\n end",
"def add_spec(type, name, desc = nil, params = {})\n # Ensure required params are set\n raise SpecificationError.new(\"Invalid #{type} specification - name must be a string\") unless name.is_a?(String)\n \n # Bump over options if needed (ie no description provided)\n if desc.is_a?(Hash)\n params = desc\n desc = nil\n end\n \n # Add in extra options if needed\n params.merge!(@extra_options)\n \n # Create a new instance of the given argument spec type\n klass = type.to_s.split(/[_\\-]/).collect{|s| s.capitalize}.join\n klass = \"Console::#{klass}Specification\".constantize\n item = klass.new(name, desc, params)\n \n # Add it to the list!\n self << item\n\n # All set here...\n item\n end",
"def filter_specs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_specs ...'\n end\n # resource path\n local_var_path = '/filters/_specs'\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/vnd.feedpushr.filter-spec.v1+json; type=collection'])\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<FilterSpec>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: FilterApi#filter_specs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def build_stubbed(name, *traits_and_overrides, &block); end",
"def coprocessor_descriptor_from_hash(spec)\n classname = spec[CLASSNAME]\n raise ArgumentError.new \"CLASSNAME must be provided in spec\" if classname.nil?\n jar_path = spec[JAR_PATH]\n priority = spec[PRIORITY]\n properties = spec[PROPERTIES]\n\n builder = CoprocessorDescriptorBuilder.newBuilder classname\n builder.setJarPath jar_path unless jar_path.nil?\n builder.setPriority priority unless priority.nil?\n properties&.each { |k, v| builder.setProperty(k, v.to_s) }\n\n builder.build\n end",
"def add_spec(gem_spec, name = T.unsafe(nil)); end",
"def spec(name, type = nil, mode = nil, &block)\n return specs(name, type) unless block_given?\n fail 'A type argument is required when defining a spec!' unless type\n\n _specs\n name = name_audit(name)\n fail 'Specification names must be of SPEC_TYPES Symbol or String and cannot start with a number' if name.nil?\n fail \"Spec type must be one of #{SPEC_TYPES.join(', ')}\" unless SPEC_TYPES.include? type\n\n type = type\n mode = get_mode if mode.nil?\n owner_name = ''\n if respond_to?(:name) && send(:name)\n owner_name = self.name.to_s.downcase.to_sym\n elsif self == Origen.top_level\n owner_name = self.class.to_s.split('::').last.downcase.to_sym\n else\n owner_name = self.class.to_s.split('::').last.downcase.to_sym\n end\n spec_placeholder = Spec\n .new(name, type, mode, owner_name, &block)\n # Check if the spec already exists\n if has_spec?(name, type: type, mode: mode, sub_type: spec_placeholder.sub_type, creating_spec: true)\n # Spec already exists. Go ahead flag error and drop processing.\n # This is a fatal error.\n fail \"Spec already exists for name: #{name}, type: #{type}, mode: #{mode} for object #{self}\"\n end\n\n @_specs[name][mode][type][spec_placeholder.sub_type] = spec_placeholder\n end",
"def spec name, version, &block\n Gem::Specification.new name, v(version), &block\n end",
"def requirement_hash(spec = self)\n result = {}\n if String === spec\n parts = spec.split(/\\s*->\\s*/, 3).map(&:strip)\n case parts.size\n when 1\n result[:spec] = ArtifactNamespace.to_hash(parts.first)\n when 2\n if /^\\w+$/ === parts.first\n result[:name] = parts.first\n result[:spec] = ArtifactNamespace.to_hash(parts.last)\n else\n result[:spec] = ArtifactNamespace.to_hash(parts.first)\n result[:requirement] = VersionRequirement.create(parts.last)\n end\n when 3\n result[:name] = parts.first\n result[:spec] = ArtifactNamespace.to_hash(parts[1])\n result[:requirement] = VersionRequirement.create(parts.last)\n end\n else\n result[:spec] = ArtifactNamespace.to_hash(spec)\n end\n result[:name] ||= result[:spec][:id].to_s.to_sym\n result[:requirement] ||= VersionRequirement.create(result[:spec][:version])\n result\n end",
"def field(spec, name = nil, data_lambda = nil)\n add_field Field.new(String, spec, name || next_unknown_field_name, data_lambda)\n end",
"def to_hash\n hash = {}\n\n hash[:name] = name\n hash[:file] = file\n hash[:line] = line\n hash[:type] = @function_type.to_s\n hash[:signatures] = []\n\n if has_tag? :overload\n # loop over overloads and append onto the signatures array\n tags(:overload).each do |o|\n hash[:signatures] << { signature: o.signature, docstring: PuppetStrings::Yard::Util.docstring_to_hash(o.docstring, %i[param option enum return example]) }\n end\n else\n hash[:signatures] << { signature: signature, docstring: PuppetStrings::Yard::Util.docstring_to_hash(docstring, %i[param option enum return example]) }\n end\n\n hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)\n defaults = Hash[*parameters.reject { |p| p[1].nil? }.flatten]\n hash[:defaults] = defaults unless defaults.nil? || defaults.empty?\n hash[:source] = source unless source.nil? || source.empty?\n hash\n end",
"def build(name, *traits_and_overrides, &block); end",
"def function_declaration(kind)\n name = consume(:identifier, \"Expect #{kind} name.\")\n consume(:lparen, \"Expect '(' after #{kind} name.\")\n parameters = []\n if !check?(:rparen)\n loop do\n if parameters.length >= 8\n error(peek, 'Cannot have more than 8 parameters')\n end\n parameters << consume(:identifier, 'Expect parameter name')\n break unless match?(:comma)\n end\n end\n consume(:rparen, \"Expect ')' after parameters.\")\n\n consume(:lbrace, \"Expect '{' before #{kind} body\")\n body = block\n return Ringo::Function.new(name, parameters, body)\n end",
"def map_parameters(instance, name, actual, format = true)\n method = instance.method(\"__hyper_trace_pre_#{name}\")\n map_with_specs(method, actual.dup, format) || map_without_specs(actual, format)\n end",
"def fetch_spec(name_tuple)\n @wrapped.fetch_spec name_tuple\n end",
"def initialize(name, description, how_to_pass, required, type, params, known_types)\n check_name(name)\n @name = name\n\n if description\n @description = description\n end\n\n how_to_pass = how_to_pass.to_s\n unless HOW_TO_PASS.include? how_to_pass\n raise SwaggerInvalidException.new(\"Unknown how to pass value [#{how_to_pass}]#{list_or_none(HOW_TO_PASS, 'registered types')}\")\n end\n @how_to_pass = how_to_pass\n\n if @how_to_pass == HOW_TO_PASS_BODY\n get_type(type, PRIMITIVE_TYPES + known_types + [TYPE_FILE])\n else\n get_type(type, PRIMITIVE_TYPES_FOR_NON_BODY)\n end\n\n unless [true, false].include? required\n raise SwaggerInvalidException.new(\"Required should be a boolean instead of [#{required}]\")\n end\n @required = required\n\n params = white_list_params(params, PARAMS_LIST, SwaggerTypeProperty::PROPERTIES)\n validate_params(@type == TYPE_ARRAY ? @items : @type, params)\n @default = params[PARAMS_DEFAULT]\n @params = params\n end",
"def lambda(function_name, properties={})\n custom_type = properties.delete(:CustomType)\n depends_on = properties.delete(:DependsOn)\n custom_resource = {\n Type: properties.delete('Type') || \"Custom::#{custom_type || function_name}\",\n Properties: {\n ServiceToken: {'Fn::Join' => [':', [\n 'arn:aws:lambda',\n {Ref: 'AWS::Region'},\n {Ref: 'AWS::AccountId'},\n 'function',\n function_name\n ]]}\n }.merge(properties)\n }\n custom_resource['DependsOn'] = depends_on if depends_on\n custom_resource.to_json\n end",
"def get_field_spec(field_name,field_spec)\n fspec = field_spec[field_name]\n fspec ||= field_name\n case\n when fspec.is_a?(String)\n fspec = {'type' => fspec}\n when fspec.is_a?(Array)\n fspec = {'values_enum' => fspec}\n end\n fspec['description'] ||= field_name.gsub(/_/,' ').capitalize\n fspec\n end",
"def signature(method_name, same_as_type = nil, **opts, &block)\n method = method_name.to_sym\n @signatures ||= {}\n raise \"signature definition for #{method_name}: need to pass either an existing type or a block, not both\" if block_given? && same_as_type\n\n if block_given?\n type =\n Class.new(Attributor::Struct) do\n attributes(**opts) do\n instance_eval(&block)\n end\n end\n @signatures[method] = type\n elsif same_as_type\n raise \"Options for signature definition for #{method_name} are not supported when passing an already existing type\" unless opts.empty?\n\n @signatures[method] = same_as_type\n else\n @signatures[method]\n end\n end",
"def create(name, *traits_and_overrides, &block); end",
"def as_gemspec\n spec_values = SPEC_KEYS.inject({}) do |keys,spec_key|\n keys[spec_key] = metadata_hash[spec_key] || default_or_inferred_for(spec_key)\n keys\n end\n gemspec_from_values(spec_values)\n end",
"def func_params\n params.fetch(:func, {})\n end",
"def spec_type(desc, *additional); end",
"def expect_hash name, value\n expect_type name,\n value,\n \"hash\",\n lambda{ value.is_a?(Hash)},\n lambda{ value.to_h.stringify_keys if value.respond_to?(:to_h) }\n end",
"def create_cmock_style_parsed_header(functions, typedefs = nil)\n parsed_header = {\n :includes => nil,\n :functions => [],\n :typedefs => []\n }\n\n # Add the typedefs.\n if typedefs\n typedefs.each do |typedef|\n parsed_header[:typedefs] << typedef\n end\n end\n\n # Add the functions.\n if functions\n functions.each do |function|\n # Build the array of arguments.\n args = []\n if function.key?(:args)\n function[:args].each do |arg|\n args << {\n :type => arg\n }\n end\n end\n parsed_header[:functions] << {\n :name => function[:name],\n :modifier => \"\",\n :return => {\n :type => function[:return_type],\n :name => \"cmock_to_return\",\n :ptr? => false,\n :const? => false,\n :str => \"void cmock_to_return\",\n :void? => true\n },\n :var_arg => nil,\n :args_string => \"void\",\n :args => args,\n :args_call => \"\",\n :contains_ptr? => false\n }\n end\n end\n parsed_header\nend",
"def create_cmock_style_parsed_header(functions, typedefs = nil)\n parsed_header = {\n :includes => nil,\n :functions => [],\n :typedefs => []\n }\n\n # Add the typedefs.\n if typedefs\n typedefs.each do |typedef|\n parsed_header[:typedefs] << typedef\n end\n end\n\n # Add the functions.\n if functions\n functions.each do |function|\n # Build the array of arguments.\n args = []\n if function.key?(:args)\n function[:args].each do |arg|\n args << {\n :type => arg\n }\n end\n end\n parsed_header[:functions] << {\n :name => function[:name],\n :modifier => \"\",\n :return => {\n :type => function[:return_type],\n :name => \"cmock_to_return\",\n :ptr? => false,\n :const? => false,\n :str => \"void cmock_to_return\",\n :void? => true\n },\n :var_arg => nil,\n :args_string => \"void\",\n :args => args,\n :args_call => \"\",\n :contains_ptr? => false\n }\n end\n end\n parsed_header\nend",
"def generate(name, glsl, typeInfo)\n # Merge type information for all argument lists a function might\n # have.\n minParam, paramTypes = mergeParameterLists(typeInfo.parameterLists)\n\n # Assemble type annotations for the closure compile.\n paramtypestr = []\n paramstr = []\n (0...minParam).each do |i|\n paramtypestr << \" * @param {!(#{paramTypes[i].toClosure})} arg#{i}\\n * Function argument #{i}.\"\n paramstr << \"arg#{i}\"\n end\n (minParam...paramTypes.size).each do |i|\n paramtypestr << \" * @param {!(#{paramTypes[i].toClosure})=} arg#{i}\\n * Function argument #{i}.\"\n paramstr << \"arg#{i}\"\n end\n annotations = paramtypestr.join(\"\\n\")\n\n return <<EOF\n\n/**\n * Create expression for GLSL function '#{glsl}'.\n *\n#{annotations}\n * @return {!embedsl.Expression} Created expression.\n */\nembedsl.lang.#{name} = (function() {\n var cached = #{typeInfo.toEsl};\n return function(#{paramstr.join(\",\\n \")}) {\n var args = Array.prototype.slice.call(arguments);\n return new embedsl.Expression(\n embedsl.Kind.BUILTIN, cached, '#{name}', '#{glsl}', args);\n };\n})();\nEOF\nend",
"def register_spec_type *args, &block\n if block then\n matcher, klass = block, args.first\n else\n matcher, klass = *args\n end\n TYPES.unshift [matcher, klass]\n end",
"def to_spec(hash)\n hash = to_hash(hash) unless Hash === hash\n version = \":#{hash[:version]}\" if hash[:version]\n classifier = \":#{hash[:classifier]}\" if hash[:classifier]\n \"#{hash[:group]}:#{hash[:id]}:#{hash[:type] || DEFAULT_TYPE}#{classifier}#{version}\"\n end",
"def create_function(function_name, returning, definition, options = {})\n\n end",
"def create_with_methods!\n @parameters.reject(&:header?).each do |parameter|\n self.class.define_method(:\"with_#{parameter.to_method_name}\") do |value|\n @with_params[parameter.name] = value\n self\n end\n end\n end",
"def json_spec_schema(spec)\n Data.export(json_spec_path, spec, DummyUtil.new)\n end",
"def to_hash(spec)\n if spec.respond_to?(:to_spec)\n to_hash spec.to_spec\n elsif Hash === spec\n rake_check_options spec, :id, :group, :type, :classifier, :version, :scope\n # Sanitize the hash and check it's valid.\n spec = ARTIFACT_ATTRIBUTES.inject({}) { |h, k| h[k] = spec[k].to_s if spec[k] ; h }\n fail \"Missing group identifier for #{spec.inspect}\" unless spec[:group]\n fail \"Missing artifact identifier for #{spec.inspect}\" unless spec[:id]\n fail \"Missing version for #{spec.inspect}\" unless spec[:version]\n spec[:type] = (spec[:type] || DEFAULT_TYPE).to_sym\n spec\n elsif String === spec\n group, id, type, version, *rest = spec.split(':').map { |part| part.empty? ? nil : part }\n unless rest.empty?\n # Optional classifier comes before version.\n classifier, version = version, rest.shift\n fail \"Expecting <group:id:type:version> or <group:id:type:classifier:version>, found <#{spec}>\" unless rest.empty?\n end\n to_hash :group=>group, :id=>id, :type=>type, :version=>version, :classifier=>classifier\n else\n fail 'Expecting a String, Hash or object that responds to to_spec'\n end\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def add_spec sym, spec \n SPECS[sym] = spec\n end",
"def add_spec sym, spec \n SPECS[sym] = spec\n end",
"def wrap_object(wrapper_name, to_wrap)\r\n { wrapper_name => to_wrap }\r\n end",
"def create_parsed_header(functions, typedefs = nil)\n parsed_header = {\n :includes => nil,\n :functions => [],\n :typedefs => []\n }\n\n # Add the typedefs.\n if typedefs\n typedefs.each do |typedef|\n parsed_header[:typedefs] << typedef\n end\n end\n\n # Add the functions.\n if functions\n functions.each do |function|\n # Build the array of arguments.\n args = []\n if function.key?(:args)\n function[:args].each do |arg|\n args << {\n :type => arg\n }\n end\n end\n parsed_header[:functions] << {\n :name => function[:name],\n :modifier => \"\",\n :return => {\n :type => function[:return_type],\n :name => \"cmock_to_return\",\n :ptr? => false,\n :const? => false,\n :str => \"void cmock_to_return\",\n :void? => true\n },\n :var_arg => nil,\n :args_string => \"void\",\n :args => args,\n :args_call => \"\",\n :contains_ptr? => false\n }\n end\n end\n parsed_header\nend",
"def spec name, version, &block\n Gem::Specification.new name, v(version) do |s|\n s.author = \"RubyGems Tests\"\n s.description = \"A test gem.\"\n s.email = \"[email protected]\"\n s.homepage = \"http://example.com\"\n s.platform = Gem::Platform::RUBY\n s.summary = \"A test gem summary.\"\n\n yield s if block_given?\n end\n end",
"def add_spec(name, config)\n unless spec = specs[name.to_sym]\n spec = ModelMe::Adapters::AdapterSpecification.new(name, config)\n specs[name.to_sym] = spec\n end\n spec\n end",
"def build_stubbed(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Stub, traits_and_overrides).run(&block)\n end",
"def load_spec(name, ver, platform, source) # :nodoc:\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end",
"def to_spec\n raise NotImplementedError\n end",
"def to_spec\n raise NotImplementedError\n end",
"def gen_wrapper(klass, name, options, kind)\n args = options[:arguments].dup\n return nil if options[:stub]\n unless args_convertable?(args)\n STDERR.puts \"WARN: cannot wrap method #{klass.name}::#{name} (#{kind})\"\n return nil\n end\n\n returns = args.delete(:returns) || \"void\"\n\n s = ([[\"__self__\", \"VALUE\"]] + args.to_a).map {|n,_| \"VALUE #{n}\"}.join(\", \")\n\n out = \"\"\n out << \"static VALUE\\n\"\n out << \"#{klass.name}_#{kind}__#{name}(#{s})\\n\"\n out << \"{\\n\"\n\n # declare C++ return value\n if returns != 'void'\n out << @model.typing.var_decl(returns, '__res__') + \";\\n\"\n end\n \n # declare C++ object reference\n out << \"#{klass.name} *__cobj__;\\n\"\n #out << @model.var_decl(klass, '__cobj__') + \";\\n\"\n\n # convert __self__ to C++ object reference (FIXME: can remove?)\n out << \"Check_Type(__self__, T_DATA);\\n\"\n out << \"__cobj__ = (#{klass.name}*) DATA_PTR(__self__);\\n\"\n\n # check argument types\n out << args.map {|n, t| @model.typing.convert(t, n.to_s, :ruby2c_checktype) + \";\\n\" }.join\n\n # call arguments\n call_args = args.map {|n, t| @model.typing.convert(t, n.to_s, :ruby2c)}\n\n # build method call\n out << \"__res__ = \" if returns != 'void'\n case kind\n when :wrap\n out << \"__cobj__->#{name}(#{call_args.join(', ')});\\n\"\n when :get\n out << \"__cobj__->#{name};\\n\"\n when :set\n raise ArgumentError if call_args.size != 1\n out << \"__cobj__->#{name} = #{call_args.first};\\n\"\n else\n raise ArgumentError\n end\n\n # convert return value\n retval = @model.typing.convert(returns, '__res__', :c2ruby)\n\n out << \"return #{retval};\\n\"\n out << \"}\\n\"\n\n return out\n end",
"def initialize(spec, attrs = { }, fields = { })\n super(spec, attrs)\n self.set_fields!(fields)\n self.extend(spec)\n end",
"def wrap_parameters(name_or_model_or_options, options = T.unsafe(nil)); end",
"def gen_getter(method_spec)\n method_id = \"0x\" + calc_id(gen_method_id(method_spec[\"name\"], get_types(method_spec)))\n self.class.send(:define_method, method_spec[\"name\"].underscore) do |*args|\n encoded_inputs = W3::Encoder::encode_inputs(args, method_spec[\"inputs\"])\n outputs = @eth.call({\n \"to\" => @address,\n \"data\" => encoded_inputs.unshift(method_id).join\n })\n W3::Decoder::decode_outputs(outputs, method_spec[\"outputs\"])\n end\n end",
"def build_parameter(name, where, schema, opts = {})\n validate_parameter_where_arg(where)\n param = {\n name: name.to_s,\n in: where.to_s,\n required: opts[:optional] ? false : true\n }.merge(generate_parameter_schema(schema))\n @json.values.first[:parameters] << param\n self\n end",
"def fake_http_signature_test_with_http_info(pet, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FakeApi.fake_http_signature_test ...'\n end\n # verify the required parameter 'pet' is set\n if @api_client.config.client_side_validation && pet.nil?\n fail ArgumentError, \"Missing the required parameter 'pet' when calling FakeApi.fake_http_signature_test\"\n end\n # resource path\n local_var_path = '/fake/http-signature-test'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'query_1'] = opts[:'query_1'] if !opts[:'query_1'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/xml'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params['header_1'] = opts[:'header_1'] if !opts[:'header_1'].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(pet)\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['http_signature_test']\n\n new_options = opts.merge(\n :operation => :\"FakeApi.fake_http_signature_test\",\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: FakeApi#fake_http_signature_test\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(name, argument_types)\n @function_hash[[name, argument_types]]\n end",
"def compose(name, spec)\n use(name, spec)\n plug(name, spec)\n end",
"def initialize name, type, callable: nil, request_class: nil, &block\n @name = name\n @type = type\n @request_class = request_class\n @callable = @callable_class = nil\n if callable.respond_to? :call\n @callable = callable\n elsif callable.is_a? ::Class\n @callable_class = callable\n elsif block_given?\n @callable_class = ::Class.new Callable do\n define_method :call, &block\n end\n else\n raise ::ArgumentError, \"No callable given for function\"\n end\n end",
"def create_expectation(func_name, has_name, object, space_used,\n prop_list = [], id = 1)\n prop_list << \"name: 'title#{id - 1}'\" unless has_name\n\n rref_list = object.uri_properties.map do |ref|\n # We need to verify that only resourcerefs directly belonging to this\n # object are inserted into the expectation.\n next unless ref.is_a? Api::Type::ResourceRef\n name = Google::StringUtils.underscore(ref.resource_ref.name)\n value = @data_gen.value(ref.property.class, ref.property, id - 1)\n { name => value }\n end\n\n prop_list.concat(\n rref_list.flatten.compact.reduce({}, :merge)\n .map { |k, v| \"#{k}: '#{v}'\" }\n )\n\n return \"#{func_name} #{id}\" if prop_list.empty?\n\n prop_list.unshift id.to_s\n\n @provider.format([\n [\"#{func_name} #{prop_list.join(', ')}\"],\n [\n \"#{func_name} #{prop_list[0]},\",\n @provider.indent_list(prop_list.drop(1),\n func_name.length + 1)\n ],\n [\n \"#{func_name} \\\\\",\n @provider.indent_list(prop_list, 2)\n ]\n ], 0, space_used)\n end",
"def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n attributes_processors\n )\n end",
"def method_missing(method, *args, &block)\r\n @spec.send(method, *args, &block)\r\n end",
"def populate_method_data(specifications)\n specifications.map do |spec|\n method_data = @method_data_factory.new\n method_data.container = container\n method_data.name = find_match(spec, tkn_regex[:name])[0]\n method_data.input_types = separate_types( find_match(spec, REGEX[:ins]) )\n method_data.output_types = separate_types( find_match(spec, REGEX[:outs]) )\n method_data\n end\n end",
"def normalize_spec(spec)\n spec.inject({}) do |normalized, (name, direction)|\n normalized[database_field_name(name).to_sym] = direction\n normalized\n end\n end",
"def create_function(params={})\n runtime = params.delete('Runtime') || 'nodejs'\n code = params.delete('Code')\n function_name = params.delete('FunctionName')\n handler = params.delete('Handler')\n role = params.delete('Role')\n\n data = {\n 'Runtime' => runtime,\n 'Code' => code,\n 'FunctionName' => function_name,\n 'Handler' => handler,\n 'Role' => role\n }\n\n description = params.delete('Description')\n data.merge!('Description' => description) if description\n\n memory_size = params.delete('MemorySize')\n data.merge!('MemorySize' => memory_size) if memory_size\n\n timeout = params.delete('Timeout')\n data.merge!('Timeout' => timeout) if timeout\n\n request({\n :method => 'POST',\n :path => '/functions',\n :expects => 201,\n :body => Fog::JSON.encode(data),\n :parser => Fog::AWS::Parsers::Lambda::Base.new\n }.merge(params))\n end",
"def declaration(name)\n \"struct #{@spec['name']} #{name}\"\n end",
"def parameter_filler(name, value)\n Proc.new do |result|\n result.add_parameter(name, value)\n end\n end",
"def load_spec name, ver, platform, source\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end",
"def hash name = nil, **params, &cb\n return super() if name.nil? # HACK: for method name collision\n\n current = @current # closure scope\n\n schema { __send__(current, name).schema(Nested.!(current, &cb)) }\n\n case\n when params[:discard_empty] then schema.discarded!(name)\n when Nested === self then # do nothing\n else define_method(name) { Utils::Hash(@inputs[name]) }\n end\n end",
"def to_hash(spec)\n if spec.respond_to?(:to_spec)\n to_hash spec.to_spec\n elsif Hash === spec\n return spec\n elsif String === spec || Symbol === spec\n spec = spec.to_s\n if spec[-1,1] == ':'\n group, id, type, classifier, *rest = spec.split(':').map { |part| part.empty? ? nil : part }\n else\n group, id, type, version, *rest = spec.split(':').map { |part| part.empty? ? nil : part }\n unless rest.empty?\n # Optional classifier comes before version.\n classifier, version = version, rest.shift\n end\n end\n fail \"Expecting <group:id:type:version> or <group:id:type:classifier:version>, found <#{spec}>\" unless rest.empty?\n { :group => group, :id => id, :type => type, :version => version, :classifier => classifier }.reject { |k,v| v == nil }\n else\n fail \"Unexpected artifact spec: #{spec.inspect}\"\n end\n end",
"def sdef(name, depth=nil, overflow = nil, &ruby_block)\n # Create the function.\n funcT = SequencerFunctionT.new(name,depth,overflow,&ruby_block)\n # Register it for calling.\n if HDLRuby::High.in_system? then\n define_singleton_method(name.to_sym) do |*args|\n funcT.call(*args)\n end\n else\n define_method(name.to_sym) do |*args|\n funcT.call(*args)\n end\n end\n # Return the create function.\n funcT\n end",
"def build(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Build, traits_and_overrides).run(&block)\n end",
"def create_where_from_args(*args)\n opts = args.last.is_a?(Hash) ? args.pop : {}\n args = args.compact.flatten.map {|a| a.to_s }\n raise ArgumentError, \"Name parameter required\" if args.blank?\n opts[:name] ||= args.first\n opts[:types] ||= ALL_TYPES\n opts[:types] = [opts[:types]].flatten\n opts[:cast] = opts[:cast]\n opts[:predicate] ||= :eq\n opts[:splat_param] ||= false\n opts[:skip_compounds] ||= false\n opts[:formatter] ||= Proc.new {|param| param}\n if opts[:formatter].is_a?(String)\n formatter = opts[:formatter]\n opts[:formatter] = Proc.new {|param| eval formatter}\n end\n unless opts[:formatter].respond_to?(:call)\n raise ArgumentError, \"Invalid formatter for #{opts[:name]}, should be a Proc or String.\"\n end\n opts[:validator] ||= Proc.new {|param| !param.blank?}\n unless opts[:validator].respond_to?(:call)\n raise ArgumentError, \"Invalid validator for #{opts[:name]}, should be a Proc.\"\n end\n opts[:aliases] ||= [args - [opts[:name]]].flatten\n @@wheres ||= {}\n if @@wheres.has_key?(opts[:name])\n raise ArgumentError, \"\\\"#{opts[:name]}\\\" is not available for use as a where name.\"\n end\n @@wheres[opts[:name]] = opts\n opts[:aliases].each do |a|\n if @@wheres.has_key?(a)\n opts[:aliases].delete(a)\n else\n @@wheres[a] = opts[:name]\n end\n end\n new(opts[:name])\n end",
"def render_function_hash(input_pair_array)\n hash = {};\n hash[:partial] = input_pair_array[0].to_s;\n if(!input_pair_array.empty?) #if this partial has inputs\n hash[:locals] = input_pair_array[1]; #put in hash\n end\n return hash;\n end",
"def wrapper(name); end",
"def create(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Create, traits_and_overrides).run(&block)\n end",
"def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end",
"def symfun name\n Symbolic.check_name name\n fs = SymbolicFunction.new(name)\n meta_def name do\n fs\n end\n fs\n end",
"def initialize spec, key_converter = nil\n unless spec.respond_to? :size and spec.respond_to? :each\n raise ArgumentError, \"cannot be used as a template: #{spec.inspect}\"\n end\n\n @spec = spec\n @size = spec.size\n @key_converter = key_converter\n @matchers = []\n \n if spec.respond_to? :to_hash # assume hash-like\n @shibboleth = :to_hash\n spec.each do |k, v|\n if key_converter\n k = key_converter[k => nil].keys[0]\n # Note: the [k=>nil].keys[0] is needed instead of just [k]\n # because the key_converter might not convert values, only keys.\n # We do not assume that k is a scalar.\n end\n fill_matchers k, v\n end\n\n else # assume array-like\n @shibboleth = :to_ary\n spec.each_with_index do |v, i|\n fill_matchers i, v unless v.nil?\n end\n end\n end",
"def parameterize(hash)\n _hash = {}\n hash.each do |k,v|\n _hash[k.to_sym] = parameterized?(k) ? attributes_to_hash(v) : v\n end\n _hash\n end",
"def to_spec\n @spec ||= if @data\n loaded = Gem.loaded_specs[name]\n loaded if loaded && loaded.version == version\n end\n\n @spec ||= Gem::Specification.load(loaded_from)\n end",
"def create_spec(command)\n if command.kind_of? CommandSpec then\n command\n elsif command.kind_of? Command then\n command.to_command_spec\n elsif command.kind_of? Hash then\n CommandSpec.new(command)\n elsif command.kind_of? String then\n CommandSpec.from_json(command)\n elsif command.kind_of? Fixnum then\n Command.find(command).to_command_spec\n else\n command\n end\n end",
"def operation_params\n params.require(:operation).permit(:function_name)\n end",
"def installFunction(*args)\n\t\t\t args = args.first if args.class == Array and args.first.class == Hash\n\t\t\t\tcase args\n\t\t\t\t when Hash\n\t\t\t\t raise \"Must pass an instance of SAPNW::RFC::FunctionDescriptor to installFunction()\\n\" unless args.has_key?(:descriptor) and args[:descriptor].class == SAPNW::RFC::FunctionDescriptor\n\t\t\t\t\t\tfunc = args[:descriptor]\n\t\t\t\t\t\tsysid = args.has_key?(:sysid) ? args[:sysid] : \"\"\n\t\t\t\t\twhen Array\n\t\t\t\t raise \"Must pass an instance of SAPNW::RFC::FunctionDescriptor to installFunction()\\n\" unless args.first.class == SAPNW::RFC::FunctionDescriptor \n\t\t\t\t\t\tfunc = args.first\n\t\t\t\t\t\tsysid = args.length > 1 ? args[1] : \"\"\n\t\t\t\t\telse\n\t\t\t\t raise \"Must pass an instance of SAPNW::RFC::FunctionDescriptor to installFunction()\\n\"\n\t\t\t\tend\n #$stderr.print \"sysid: #{sysid}\\n\"\n\t\t\t\tres = func.install(sysid)\n\t\t\t\t@functions[func.name] = func\n\t\t\t\treturn res\n\t \tend",
"def create_capability_switch_descriptor_with_http_info(capability_switch_descriptor, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.create_capability_switch_descriptor ...'\n end\n # verify the required parameter 'capability_switch_descriptor' is set\n if @api_client.config.client_side_validation && capability_switch_descriptor.nil?\n fail ArgumentError, \"Missing the required parameter 'capability_switch_descriptor' when calling CapabilityApi.create_capability_switch_descriptor\"\n end\n # resource path\n local_var_path = '/api/v1/capability/SwitchDescriptors'\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(capability_switch_descriptor)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CapabilitySwitchDescriptor'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.create_capability_switch_descriptor\",\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: CapabilityApi#create_capability_switch_descriptor\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def specs(s = nil, options = {})\n options = {\n type: nil,\n sub_type: nil,\n mode: current_mode.nil? ? nil : current_mode.name,\n spec: nil,\n symbol: false,\n creating_spec: false\n }.update(options || {})\n _specs\n if s.nil?\n show_specs(options)\n elsif s.is_a? Hash\n # no spec was passed but some option was passed\n options.update(s)\n show_specs(options)\n else\n # a spec was passed\n options[:spec] = s\n show_specs(options)\n end\n end",
"def create_function(name, definition, opts=OPTS)\n self << create_function_sql(name, definition, opts)\n end",
"def install_spec_helper\n stubbed_facts = String.new\n if @config[@origin].has_key?('stubbed_facts')\n @config[@origin]['stubbed_facts'].keys.each do |k|\n stubbed_facts += \" :#{k} => '#{@config[@origin]['stubbed_facts'][k]}',\\n\"\n end\n end\n\n code_coverage = String.new\n if @config[@origin].has_key?('code_coverage')\n percent = @config[@origin]['code_coverage']\n code_coverage = \" c.after(:suite) do\n RSpec::Puppet::Coverage.report!(#{percent})\n end\"\n end\n\n subs = {\n '##STUBBED_FACTS##' => stubbed_facts,\n '##CODE_COVERAGE##' => code_coverage,\n }\n\n install_template([\"#{@templates}/spec_helper.rb\"], 'spec/spec_helper.rb', subs)\n end",
"def define_parameter(name, parameter_data, &block)\n if RailsApiDoc::Controller::Request::Param.valid_nested?(parameter_data[:type], block_given?)\n parameter_data = nested_parameter(parameter_data, &block)\n elsif RailsApiDoc::Controller::Request::Param.valid_enum?(parameter_data[:type], parameter_data[:enum])\n parameter_data[:enum].map!(:to_s)\n end\n\n repo[name] = RailsApiDoc::Controller::Request::Param.new(name, parameter_data)\n end",
"def create_capability_switch_manufacturing_def_with_http_info(capability_switch_manufacturing_def, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.create_capability_switch_manufacturing_def ...'\n end\n # verify the required parameter 'capability_switch_manufacturing_def' is set\n if @api_client.config.client_side_validation && capability_switch_manufacturing_def.nil?\n fail ArgumentError, \"Missing the required parameter 'capability_switch_manufacturing_def' when calling CapabilityApi.create_capability_switch_manufacturing_def\"\n end\n # resource path\n local_var_path = '/api/v1/capability/SwitchManufacturingDefs'\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(capability_switch_manufacturing_def)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CapabilitySwitchManufacturingDef'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.create_capability_switch_manufacturing_def\",\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: CapabilityApi#create_capability_switch_manufacturing_def\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def wrapped_request(rpc_method, request)\n request = request_class(rpc_method).new(request) if request.is_a?(Hash)\n\n ::Protobuf::Socketrpc::Request.new(\n :service_name => subject_service.to_s,\n :method_name => rpc_method.to_s,\n :request_proto => request.encode,\n :caller => 'protobuf-rspec'\n )\n end",
"def initialize(type, spec, name = nil, data_lambda = nil, limit = nil)\n super(type, spec, name, data_lambda)\n @limit = limit\n len_field, string_field = PascalStringField.pascal_string_fields(@name)\n @len_field = Field.new(Integer, spec[0], len_field)\n # have to turn it back into a pascal string!\n # so the proc here actually returns the values\n # for both the len, and the string\n # this will get flattened into the values list\n # when packing the struct\n @string_field = Field.new(String, spec[1..-1], string_field, Proc.new {\n val = @data_lambda.call\n if @limit\n val.slice!(@limit..-1)\n end\n [ val.length, val ]\n })\n @@pascal_strings << self\n end",
"def apply_spec(spec)\n spec = Artifact.to_hash(spec)\n ARTIFACT_ATTRIBUTES.each { |key| instance_variable_set(\"@#{key}\", spec[key]) }\n self\n end",
"def create_method(object, name, value)\n # Create the necessary method based on the var that has been passed\n # Test the value for its type so that the method can be setup correctly\n case value.class.to_s\n when 'String', 'Integer', 'TrueClass', 'FalseClass', 'Fixnum'\n object.define_singleton_method name do\n value\n end\n when 'Hash'\n value.count.zero? ? return_value = value : return_value = GcpResourceProbe.new(value)\n object.define_singleton_method name do\n return_value\n end\n # there are nested Google API classes throughout\n when /Google::Apis::.*/\n object.define_singleton_method name do\n if value.respond_to? :to_h\n value = value.to_h\n end\n GcpResourceProbe.new(value)\n end\n when 'Array'\n # Some things are just string or integer arrays\n # Check this by seeing if the first element is a string / integer / boolean or\n # a hashtable\n # This may not be the best method, but short of testing all elements in the array, this is\n # the quickest test\n # p value[0].class.to_s\n case value[0].class.to_s\n when 'String', 'Integer', 'TrueClass', 'FalseClass', 'Fixnum'\n probes = value\n else\n probes = []\n value.each do |value_item|\n # p value_item\n if value_item.respond_to? :to_h\n value_item = value_item.to_h\n end\n probes << GcpResourceProbe.new(value_item)\n end\n end\n object.define_singleton_method name do\n probes\n end\n end\n end",
"def get_hash(*params); raise('Stub or mock required.') end",
"def my_method_hash(attrs = {})\n puts \"Name is #{attrs[:name]}\"\nend",
"def specializeMethodOrConstructor(newMethodName, arguments, store = Store.new)\n #this collection contains the parameters that need to be removed because the arguments passed in for the parameters are compile time\n paramsToRemove = []\n\n #loop through all the arguments and check if it are compile time variables.\n #if it is a compile time argument add it to the store and to the paramsToRemove collection.\n argCount = (arguments.respond_to? :length) ? arguments.length : 0\n\n return nil, nil if(argCount != @astNode.params.elements.length && !store.inStore?(Helpers.blockIdentifier))\n\n for i in 0..argCount-1\n paramName = @astNode.params.elements[i].param.token\n if (Helpers.compileTime?(arguments[i]))\n store.update(StoreVar.new(paramName, arguments[i], :compileTime))\n paramsToRemove << i\n else\n store.update(StoreVar.new(paramName, arguments[i], (arguments[i].respond_to?(:external) && arguments[i].external) ? :external : :runtime))\n end\n end\n\n #the cloned Method gets partial evaluated so it becomes the specialized method\n clonedMethod = @astNode.deep_copy\n\n #remove the parameters that contain ct arguments.\n paramsToRemove.reverse.each { |i| clonedMethod.params.elements.delete_at(i) }\n env = PeEnv.new\n env.store = store\n\n #set the new name of the method.\n clonedMethod.peIdentifier = newMethodName\n\n #be sure that there is always a whitespace between the method name and the first parameter and that it is not a \",\"\n if (clonedMethod.params.elements[0] && clonedMethod.params.elements[0].prolog.elements[0])\n clonedMethod.params.elements[0].prolog.elements[0].token = \" \"\n end\n\n #partial evaluate the method with the ct arguments mapped to the parameters of the method (using the store).\n peBodyExpResult, peBodyValueResult = clonedMethod.peBody(env)\n\n return clonedMethod, peBodyValueResult\n end",
"def macro_signature_for(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)\n parameter_list = \"#{macro_name}(\"\n if return_type != \"\"\n parameter_list += return_type\n parameter_list += \", \"\n end\n parameter_list += \"CALLING_CONVENTION, \" if (has_calling_conventions)\n parameter_list += \"FUNCNAME\"\n\n arg_count.times { |i| parameter_list += \", ARG#{i}_TYPE\" }\n\n parameter_list += \", ...\" if has_varargs\n\n parameter_list += \") \\\\\"\n\n parameter_list\nend",
"def generate_call_for_function(function_name, param_hash, function_params)\n output = \"\"\n payload_variable_name = 'parsed_payload'\n function_params.each do |param| \n output += \"#{param} = #{payload_variable_name}['#{param}']\\n\"\n end\n\n joined_param_string = function_params.join(', ')\n output += \"output = #{function_name}(#{joined_param_string})\"\n return output\nend",
"def spec_datastream(args, defaults, &block)\n if args.first.is_a? String \n name = args.first\n args = args[1] || {}\n args[:name] = name\n else\n args = args.first || {}\n end\n spec = defaults.merge(args.select {|key, value| defaults.has_key? key})\n name = spec.delete(:name)\n raise ArgumentError, \"You must provide a name (dsid) for the datastream\" unless name\n raise ArgumentError, \"You must provide a :type property for the datastream '#{name}'\" unless spec[:type]\n spec[:versionable] = args[:versionable] if args.has_key? :versionable\n spec[:block] = block if block\n build_datastream_accessor(name)\n ds_specs[name]= spec\n end",
"def to_struct_class\n # flatten fields to handle the case where a helper has contributed a series of fields\n # in an array\n args = @fields.flatten\n # prepend the name if specified\n args = [ @name ] + args if @name\n \n # create an array.pack field specifier string from all the field specs\n field_spec_string = @field_specs.flatten.join(' ')\n \n # obtain the class for the arguments\n struct_class = self.class.create_struct_class(*args)\n \n # define metadata for this particular class\n struct_class.const_set(\"SIZE\", @size)\n struct_class.const_set(\"FIELD_SPEC_STRING\", field_spec_string)\n struct_class.const_set(\"LAMBDAS\", @lambdas)\n struct_class.const_set(\"PASCAL_STRINGS\", @pascal_strings)\n\n # create the struct class\n # mix in the record parse helpers\n struct_class.class_eval do\n include StructMixin\n end\n\n struct_class\n end"
] | [
"0.52312267",
"0.52049226",
"0.50881684",
"0.5011314",
"0.49133167",
"0.48622757",
"0.4739138",
"0.47299454",
"0.47129807",
"0.46225414",
"0.46154743",
"0.4555072",
"0.45069322",
"0.446761",
"0.44175696",
"0.44130325",
"0.44049078",
"0.43754166",
"0.4368848",
"0.4346952",
"0.43217334",
"0.43117118",
"0.4306543",
"0.42935753",
"0.4273655",
"0.42630404",
"0.4242903",
"0.4238432",
"0.4228967",
"0.42268997",
"0.42268997",
"0.42251748",
"0.42182368",
"0.4217117",
"0.42095566",
"0.42068565",
"0.4206425",
"0.4200779",
"0.41935933",
"0.41935933",
"0.41853705",
"0.41853705",
"0.41824675",
"0.41803735",
"0.41736752",
"0.416064",
"0.4157361",
"0.4156911",
"0.41516036",
"0.41516036",
"0.41399443",
"0.41374758",
"0.41094837",
"0.41008404",
"0.4094446",
"0.4079777",
"0.4076027",
"0.4067437",
"0.40557685",
"0.40488228",
"0.40486586",
"0.40404743",
"0.40360084",
"0.40349823",
"0.40332478",
"0.4030093",
"0.40253714",
"0.40229264",
"0.401824",
"0.401799",
"0.40148428",
"0.40118837",
"0.40118626",
"0.40105796",
"0.39984217",
"0.39968204",
"0.39961374",
"0.39960623",
"0.3995355",
"0.3993136",
"0.3982255",
"0.39751017",
"0.39729646",
"0.39667767",
"0.39658487",
"0.39619243",
"0.39594743",
"0.3957576",
"0.3954573",
"0.39510083",
"0.39391485",
"0.3937096",
"0.39341182",
"0.39292094",
"0.39287025",
"0.39247984",
"0.39130622",
"0.39110586",
"0.39080194",
"0.39027202",
"0.39018574"
] | 0.0 | -1 |
Generates a function call from a provided FunctionSpec. Paremeters and types are resolved using this function's context. | def call_from(function_spec)
resolved_params = []
@spec['params'].each do |param|
resolved_params << function_spec.resolve_wrapped_param(param)
end
"#{@spec['name']}( #{resolved_params.join(', ')} )"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_call_for_function(function_name, param_hash, function_params)\n output = \"\"\n payload_variable_name = 'parsed_payload'\n function_params.each do |param| \n output += \"#{param} = #{payload_variable_name}['#{param}']\\n\"\n end\n\n joined_param_string = function_params.join(', ')\n output += \"output = #{function_name}(#{joined_param_string})\"\n return output\nend",
"def general_func_call(fn)\n \"#{@scanner.next.value} #{expr_list(fn)} #{@scanner.next.value}#{@scanner.next.value}\\n\"\n\n end",
"def build_compiler\n node_name = nodename(:function)\n fact_values = facts_hash(node_name)\n\n # if we specify a pre_condition, we should ensure that we compile that\n # code into a catalog that is accessible from the scope where the\n # function is called\n Puppet[:code] = pre_cond\n\n node_options = {\n :parameters => fact_values,\n }\n\n stub_facts! fact_values\n\n node = build_node(node_name, node_options)\n\n compiler = Puppet::Parser::Compiler.new(node)\n compiler.compile\n compiler\n end",
"def run_function(name, params)\n payload = Payload.new\n payload.function_name = name\n payload.params = params\n call_route(:function, name, payload)\n end",
"def process_function f, args, options = {}\n fn_reg = 'temp1'\n self_reg = 'temp2'\n args_reg = 'temp3'\n\n block = CompiledBlock.new\n CODE_MGR.add_block block\n block.add_instr [INIT]\n block.add_instr [WRITE, fn_reg, f]\n\n if options[:self]\n block.add_instr [WRITE, self_reg, options[:self]]\n end\n\n # Create argument object and add to a register\n args_obj = Gene::Lang::Object.new\n args_obj.data = args\n block.add_instr [WRITE, args_reg, args_obj]\n\n block.add_instr [DEFAULT, f.body]\n\n # Call function\n if options[:self]\n block.add_instr [CALL, 'default', {\n 'fn_reg' => fn_reg,\n 'self_reg' => self_reg,\n 'args_reg' => args_reg,\n 'return_reg' => 'default',\n }]\n else\n block.add_instr [CALL, 'default', {\n 'fn_reg' => fn_reg,\n 'args_reg' => args_reg,\n 'return_reg' => 'default',\n }]\n end\n\n process block, options\n end",
"def test_method_calls_can_take_and_execute_fn_parm\n result = interpret 'a=~{foo: ->(fn) { %fn }};%a.foo(->() {4})'\n assert_eq result, 4\n end",
"def call_function(function_name, *args, &block)\n internal_call_function(closure_scope, function_name, args, &block)\n end",
"def compile_call(scope, func, args)\n if func == :yield\n warning(\"YIELD is NOT IMPLEMENTED\")\n # FIXME: Yeah, we're pretending whatever happens to be in \n # %eax is the result of a yield we've not done... Temporary hack\n return [:subexpr]\n end\n args = [args] if !args.is_a?(Array)\n @e.with_stack(args.length, true) do\n args.each_with_index do |a, i|\n param = compile_eval_arg(scope, a)\n @e.save_to_stack(param, i)\n end\n @e.call(compile_eval_arg(scope, func))\n end\n return [:subexpr]\n end",
"def function(*code)\n Function.new(*code)\nend",
"def process_defn(exp)\n make_function exp\n end",
"def call(function, *args)\n context.call(function, *args)\n end",
"def internal_call_function(scope, function_name, args, &block)\n\n the_loader = loader\n unless the_loader\n raise ArgumentError, _(\"Function %{class_name}(): cannot call function '%{function_name}' - no loader specified\") %\n { class_name: self.class.name, function_name: function_name }\n end\n\n func = the_loader.load(:function, function_name)\n if func\n Puppet::Util::Profiler.profile(function_name, [:functions, function_name]) do\n return func.call(scope, *args, &block)\n end\n end\n\n # Check if a 3x function is present. Raise a generic error if it's not to allow upper layers to fill in the details\n # about where in a puppet manifest this error originates. (Such information is not available here).\n loader_scope = closure_scope\n func_3x = Puppet::Parser::Functions.function(function_name, loader_scope.environment) if loader_scope.is_a?(Puppet::Parser::Scope)\n unless func_3x\n raise ArgumentError, _(\"Function %{class_name}(): Unknown function: '%{function_name}'\") %\n { class_name: self.class.name, function_name: function_name }\n end\n\n # Call via 3x API\n # Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.\n # NOTE: Passing an empty string last converts nil/:undef to empty string\n result = scope.send(func_3x, Puppet::Pops::Evaluator::Runtime3FunctionArgumentConverter.map_args(args, loader_scope, ''), &block)\n\n # Prevent non r-value functions from leaking their result (they are not written to care about this)\n Puppet::Parser::Functions.rvalue?(function_name) ? result : nil\n end",
"def create_function(params={})\n runtime = params.delete('Runtime') || 'nodejs'\n code = params.delete('Code')\n function_name = params.delete('FunctionName')\n handler = params.delete('Handler')\n role = params.delete('Role')\n\n data = {\n 'Runtime' => runtime,\n 'Code' => code,\n 'FunctionName' => function_name,\n 'Handler' => handler,\n 'Role' => role\n }\n\n description = params.delete('Description')\n data.merge!('Description' => description) if description\n\n memory_size = params.delete('MemorySize')\n data.merge!('MemorySize' => memory_size) if memory_size\n\n timeout = params.delete('Timeout')\n data.merge!('Timeout' => timeout) if timeout\n\n request({\n :method => 'POST',\n :path => '/functions',\n :expects => 201,\n :body => Fog::JSON.encode(data),\n :parser => Fog::AWS::Parsers::Lambda::Base.new\n }.merge(params))\n end",
"def process_func_call(match, func, func_list, type_table)\n unless func_list.is_a? FunctionList\n raise \"Internal: func_list isn't a FunctionList\"\n end\n unless func.is_a? Function\n raise \"Can only call functions inside other functions\"\n end\n\n expr = process_expression(match[0], func.ident_list, type_table)\n unless expr.is_a?(FunctionExpression)\n raise \"Invalid function call expression?\"\n end\n\n instruction = FunctionCallInstruction.new(func, expr)\n func.add_instruction(instruction)\n\n return true\nend",
"def call_function(function_name, *args, &block)\n # TRANSLATORS: do not translate variable name strings in these assertions\n Pal::assert_non_empty_string(function_name, 'function_name', false)\n Pal::assert_type(Pal::T_ANY_ARRAY, args, 'args', false)\n internal_evaluator.evaluator.external_call_function(function_name, args, topscope, &block)\n end",
"def function_call_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n\n value = nil\n\n\n name = nil\n args = nil\n chain = nil\n\n\n begin\n # at line 105:5: name= IDENT (args= function_arguments )? chain= function_call_statement_float\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_function_call_statement_813 )\n # at line 105:20: (args= function_arguments )?\n alt_27 = 2\n look_27_0 = @input.peek( 1 )\n\n if ( look_27_0 == T__34 )\n alt_27 = 1\n end\n case alt_27\n when 1\n # at line 105:20: args= function_arguments\n @state.following.push( TOKENS_FOLLOWING_function_arguments_IN_function_call_statement_817 )\n args = function_arguments\n @state.following.pop\n\n end\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_float_IN_function_call_statement_822 )\n chain = function_call_statement_float\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = FunctionCallStatementEval.new(name.text, args)\n value.chain = chain unless chain.nil?\n \n # <-- action\n end\n\n\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__, 16 )\n\n\n end\n\n return value\n end",
"def process_fcall(exp)\n method = exp.shift\n args = exp.shift\n\n str = without_result do\n generate_method_call(@model.encode_self, method, get_iter(), args)\n end\n\n resultify(str)\n end",
"def callMe (functionParam)\n yield\n yield\nend",
"def function_call\n unless tokens_are?(:id, :open_parentheses)\n return nil\n end\n\n method_name = @scanner.get_next_token.content\n @scanner.get_next_token # open parentheses\n params = parameter_list()\n\n require :close_parentheses\n require :new_line\n\n return { function_call: method_name, params: params }\n end",
"def apply_function(scope, ast)\n case ast.name\n when 'concat'\n apply_function_concat(scope, ast)\n when 'lower'\n apply_function_lower(scope, ast)\n when 'upper'\n apply_function_upper(scope, ast)\n when 'like'\n apply_function_like(scope, ast)\n when 'unlike'\n apply_function_unlike(scope, ast)\n when 'prop'\n apply_function_prop(scope, ast)\n when 'to_i'\n apply_function_to_i(scope, ast)\n when 'to_f'\n apply_function_to_f(scope, ast)\n when 'coalesce'\n apply_function_coalesce(scope, ast)\n when 'sqrt'\n apply_function_sqrt(scope, ast)\n when 'pow'\n apply_function_pow(scope, ast)\n when 'log'\n apply_function_log(scope, ast)\n when 'ln'\n apply_function_ln(scope, ast)\n when 'exp'\n apply_function_exp(scope, ast)\n when 'abs'\n apply_function_abs(scope, ast)\n when 'round'\n apply_function_round(scope, ast)\n when 'floor'\n apply_function_floor(scope, ast)\n when 'ceil'\n apply_function_ceil(scope, ast)\n when 'is_even'\n apply_function_is_even(scope, ast)\n when 'is_odd'\n apply_function_is_odd(scope, ast)\n when 'current_date'\n apply_function_current_date(scope, ast)\n when 'current_timestamp'\n apply_function_current_timestamp(scope, ast)\n when 'interval'\n apply_function_interval(scope, ast)\n when 'second'\n apply_function_second(scope, ast)\n when 'minute'\n apply_function_minute(scope, ast)\n when 'hour'\n apply_function_hour(scope, ast)\n when 'day'\n apply_function_day(scope, ast)\n when 'day_of_week'\n apply_function_day_of_week(scope, ast)\n when 'day_of_year'\n apply_function_day_of_year(scope, ast)\n when 'week_of_year'\n apply_function_week_of_year(scope, ast)\n when 'month'\n apply_function_month(scope, ast)\n when 'quarter'\n apply_function_quarter(scope, ast)\n when 'year'\n apply_function_year(scope, ast)\n when 'lookup_s'\n apply_function_lookup(scope, 'text', ast)\n when 'lookup_i'\n apply_function_lookup(scope, 'integer', ast)\n when 'lookup_f'\n apply_function_lookup(scope, 'float', ast)\n when 'lookup_b'\n apply_function_lookup(scope, 'boolean', ast)\n when 'st_area'\n apply_function_st_area(scope, ast)\n when 'st_centroid'\n apply_function_st_centroid(scope, ast)\n when 'st_point'\n apply_function_st_point(scope, ast)\n when 'st_distance'\n apply_function_st_distance(scope, ast)\n when 'st_within'\n apply_function_st_within(scope, ast)\n when 'st_intersects'\n apply_function_st_intersects(scope, ast)\n when 'st_box'\n apply_function_st_box(scope, ast)\n else\n raise Kaprella::Errors::UndefinedFunctionError.new(ast.name)\n end\n end",
"def visitFunction func,args=nil\n type=func.type.accept(self)\n name=func.name.accept(self)\n args=func.args.collect{|arg| arg.accept(self)}\n body=func.body.accept(self)\n Function.new(name,type,args,body)\n end",
"def compile_call(scope, func, args, block = nil)\n return compile_yield(scope, args, block) if func == :yield\n\n # This is a bit of a hack. get_arg will also be called from\n # compile_eval_arg below, but we need to know if it's a callm\n fargs = get_arg(scope, func)\n\n return compile_callm(scope,:self, func, args,block) if fargs && fargs[0] == :possible_callm\n\n args = [args] if !args.is_a?(Array)\n @e.caller_save do\n @e.with_stack(args.length, true) do\n args.each_with_index do |a, i|\n param = compile_eval_arg(scope, a)\n @e.save_to_stack(param, i)\n end\n @e.movl(args.length, :ebx)\n @e.call(compile_eval_arg(scope, func))\n end\n end\n @e.evict_regs_for(:self)\n reload_self(scope)\n return [:subexpr]\n end",
"def my_function(param)\n param.call\n end",
"def make_function(exp, register = true)\n name = map_name exp.shift\n args = exp.shift\n ruby_args = args.deep_clone\n ruby_args.shift # :args\n\n @method_name = name\n @c_method_name = \"rrc_c#{@c_klass_name}_#{normal_to_C name}\"\n\n @env.scope do\n c_args = check_args args, register # registered methods get self\n @methods[name] = ruby_args if register\n\n body = process exp.shift\n\n if name == :initialize then\n body[-1] = \"return self;\\n}\"\n end\n\n return \"static VALUE\\n#{@c_method_name}#{c_args} #{body}\"\n end\n end",
"def eval_function_call(args, current_cont)\n\t\t\tfunc_slot, func_args = args[:ast], args[:args]\n\t\t\tenv = args[:env]\n\t\t\t\n\t\t\tif func_slot.kind_of? LispSym\n\t\t\t\tbuildin_name = func_slot.val.to_sym\n\t\t\t\tif Buildins.singleton_methods.include? buildin_name\n\t\t\t\t\treturn current_cont.create_after Buildins.method(buildin_name), arg_ast: func_args, env: env\n\t\t\t\telse\n\t\t\t\t\treturn current_cont.heap[:error_handler].with message:\n\t\t\t\t\t\t\"Tried to call unknown buildin with the name \\\"#{buildin_name}\\\"\",\n\t\t\t\t\t\tast: LispPair.new(func_slot, func_args), backtrace: caller(0)\n\t\t\t\tend\n\t\t\telsif func_slot.kind_of? Continuation\n\t\t\t\t# If we got a continuation in the function slot eval its first argument and then\n\t\t\t\t# continue with that continuation.\n\t\t\t\treturn func_slot.create_before method(:eval), ast: func_args.first, env: env\n\t\t\telsif func_slot.kind_of? LispLambda\n\t\t\t\treturn current_cont.create_after method(:eval_lambda), lambda: func_slot, arg_ast: func_args, env: env\n\t\t\telse\n\t\t\t\treturn current_cont.heap[:error_handler].with message:\n\t\t\t\t\t\"Got unknown stuff in the function slot: #{Printer.print(func_slot)}\",\n\t\t\t\t\tast: LispPair.new(func_slot, func_args), backtrace: caller(0)\n\t\t\tend\n\t\tend",
"def FunctionCall(rest, parsed); end",
"def generate(name, glsl, typeInfo)\n # Merge type information for all argument lists a function might\n # have.\n minParam, paramTypes = mergeParameterLists(typeInfo.parameterLists)\n\n # Assemble type annotations for the closure compile.\n paramtypestr = []\n paramstr = []\n (0...minParam).each do |i|\n paramtypestr << \" * @param {!(#{paramTypes[i].toClosure})} arg#{i}\\n * Function argument #{i}.\"\n paramstr << \"arg#{i}\"\n end\n (minParam...paramTypes.size).each do |i|\n paramtypestr << \" * @param {!(#{paramTypes[i].toClosure})=} arg#{i}\\n * Function argument #{i}.\"\n paramstr << \"arg#{i}\"\n end\n annotations = paramtypestr.join(\"\\n\")\n\n return <<EOF\n\n/**\n * Create expression for GLSL function '#{glsl}'.\n *\n#{annotations}\n * @return {!embedsl.Expression} Created expression.\n */\nembedsl.lang.#{name} = (function() {\n var cached = #{typeInfo.toEsl};\n return function(#{paramstr.join(\",\\n \")}) {\n var args = Array.prototype.slice.call(arguments);\n return new embedsl.Expression(\n embedsl.Kind.BUILTIN, cached, '#{name}', '#{glsl}', args);\n };\n})();\nEOF\nend",
"def send_as_function arg\n case arg\n when Symbol then __send__ arg\n when Array then __send__(*arg)\n else yield_or_eval(&arg)\n end\n end",
"def call(address, sig, args, result_types)\n data = self._encode_function(sig, args)\n data_hex = RLP::Utils.encode_hex(data)\n response = eth_call(to: address, data: data_hex)\n return decode_abi(result_types, RLP::Utils.encode_hex(response[2..-1]))\n end",
"def call\n @func[*@args]\n end",
"def call(callable, *args)\n if callable.is_a?(String) || callable.is_a?(Symbol)\n proc = @library.macros(true)[callable.to_sym]\n fun = @library.functions(true)[callable.to_sym]\n if proc\n count = proc.arity >= 0 ? proc.arity : 0\n if args.count != count\n raise ArgumentError, \"Wrong number of arguments passed to macro (#{args.count} for #{count})\" \n end\n self.instance_exec(*args, &proc)\n elsif fun\n @builder.call(fun, *args.map{|arg| Convert(arg, fun.arg_types[args.index(arg)])})\n else\n raise NoMethodError, \"Function or macro, '#{function.to_s}', does not exist.\"\n end\n elsif callable.kind_of?(LLVM::Script::Function)\n @builder.call(callable, *args.map{|arg| Convert(arg, callable.arg_types[args.index(arg)])})\n elsif callable.kind_of?(LLVM::Value) && (callable.type.kind == :function || callable.type.kind == :pointer)\n @builder.call(callable, *args.map{|arg| Convert(arg)})\n else\n raise ArgumentError, \"Callable passed to call must be a LLVM::Value or a name of a Library function or macro.\"\n end\n end",
"def function_for(path)\n\t\t\t\tparent = @attributes\n\n\t\t\t\tfunction = path.inject(parent) do |current, key|\n\t\t\t\t\tparent = current\n\n\t\t\t\t\tthrow ArgumentError.new(\"Invalid function name #{path.join(\".\")}\") unless current\n\n\t\t\t\t\tcurrent[key]\n\t\t\t\tend\n\n\t\t\t\t# Compile the function if required:\n\t\t\t\tif String === function\n\t\t\t\t\tparent[path.last] = @context.parse_function(function, binding, 'design-document')\n\t\t\t\telse\n\t\t\t\t\tfunction\n\t\t\t\tend\n\t\t\tend",
"def function(*args)\n Function.new(self, *args)\n end",
"def function(*args)\n Function.new(self, *args)\n end",
"def function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)\n return_type = is_value_function ? \"RETURN_TYPE\" : \"void\"\n varargs = has_varargs ? \", ...\" : \"\"\n calling_conventions = has_calling_conventions ?\n \"#{return_type} FFF_GCC_FUNCTION_ATTRIBUTES CALLING_CONVENTION FUNCNAME(#{arg_val_list(arg_count)}#{varargs})\" :\n \"#{return_type} FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(#{arg_val_list(arg_count)}#{varargs})\"\nend",
"def visitFunction func,args=nil\n code=Code.new\n tname=func.type.accept(self)\n fname=func.name.accept(self)\n args=func.args.collect{|arg| arg.accept(self)}\n args=args.join(\",\")\n code << \"\\n#{tname} #{fname}(#{args})\"\n code.indent=2\n code << func.body.accept(self)\n code.indent=0\n return code\n end",
"def gen_getter(method_spec)\n method_id = \"0x\" + calc_id(gen_method_id(method_spec[\"name\"], get_types(method_spec)))\n self.class.send(:define_method, method_spec[\"name\"].underscore) do |*args|\n encoded_inputs = W3::Encoder::encode_inputs(args, method_spec[\"inputs\"])\n outputs = @eth.call({\n \"to\" => @address,\n \"data\" => encoded_inputs.unshift(method_id).join\n })\n W3::Decoder::decode_outputs(outputs, method_spec[\"outputs\"])\n end\n end",
"def f(*args)\n function.f(*args)\n end",
"def serialize_function(func)\n case func\n when String\n serialize_function_from_string(func)\n when Symbol\n serialize_function_from_symbol(func)\n when Proc\n serialize_function_from_proc(func)\n when Method\n serialize_function_from_method(func)\n else\n raise Spark::CommandError, 'You must enter String, Symbol, Proc or Method.'\n end\n end",
"def createFunction(code:, name:, isDeterministic: nil) # TESTED\n body = {\n \"code\" => code,\n \"name\" => name,\n \"isDeterministic\" => isDeterministic\n }.delete_if{|k,v| v.nil?}\n request = @@request.merge({ :body => body.to_json })\n result = self.class.post(\"/_db/#{@database}/_api/aqlfunction\", request)\n self.class.return_result result: result\n end",
"def func_params\n params.fetch(:func, {})\n end",
"def function_declaration(kind)\n name = consume(:identifier, \"Expect #{kind} name.\")\n consume(:lparen, \"Expect '(' after #{kind} name.\")\n parameters = []\n if !check?(:rparen)\n loop do\n if parameters.length >= 8\n error(peek, 'Cannot have more than 8 parameters')\n end\n parameters << consume(:identifier, 'Expect parameter name')\n break unless match?(:comma)\n end\n end\n consume(:rparen, \"Expect ')' after parameters.\")\n\n consume(:lbrace, \"Expect '{' before #{kind} body\")\n body = block\n return Ringo::Function.new(name, parameters, body)\n end",
"def installFunction(*args)\n\t\t\t args = args.first if args.class == Array and args.first.class == Hash\n\t\t\t\tcase args\n\t\t\t\t when Hash\n\t\t\t\t raise \"Must pass an instance of SAPNW::RFC::FunctionDescriptor to installFunction()\\n\" unless args.has_key?(:descriptor) and args[:descriptor].class == SAPNW::RFC::FunctionDescriptor\n\t\t\t\t\t\tfunc = args[:descriptor]\n\t\t\t\t\t\tsysid = args.has_key?(:sysid) ? args[:sysid] : \"\"\n\t\t\t\t\twhen Array\n\t\t\t\t raise \"Must pass an instance of SAPNW::RFC::FunctionDescriptor to installFunction()\\n\" unless args.first.class == SAPNW::RFC::FunctionDescriptor \n\t\t\t\t\t\tfunc = args.first\n\t\t\t\t\t\tsysid = args.length > 1 ? args[1] : \"\"\n\t\t\t\t\telse\n\t\t\t\t raise \"Must pass an instance of SAPNW::RFC::FunctionDescriptor to installFunction()\\n\"\n\t\t\t\tend\n #$stderr.print \"sysid: #{sysid}\\n\"\n\t\t\t\tres = func.install(sysid)\n\t\t\t\t@functions[func.name] = func\n\t\t\t\treturn res\n\t \tend",
"def make_function(num_timed, instruction_pool)\n\n # The __asm__ macro is used to insert assembly instructions \n # into C code. Create one __asm__ macro for each assembly \n # instruction to be timed.\n pool_size = instruction_pool.length\n asm_statements = (0..num_timed-1).map do |i|\n \"__asm__ volatile(\\\"#{instruction_pool[i % pool_size]}\\\");\\n \"\n end\n \n answer = {:name => \"time_#{num_timed}_ops\"}\n\n # Insert the function name and __asm__ macros into the C function\n # (The ~ after the << allows us to indent the body of the multiline string.)\n answer[:body]=<<-HERE\n unsigned long long #{answer[:name]}() {\n register uint32_t start = my_rdtsc();\n\n #{asm_statements.join}\n register uint32_t stop = my_rdtsc();\n return stop - start;\n }\n HERE\n answer # return answer\nend",
"def parse_func\n return_type = parse_type\n @buffer.skip(/\\s*/)\n scan_or_fail(/\\w+/, 'Invalid function name')\n\n func = FunctionDecl.new(name: @buffer[0], entity: @entity, is_method: true, return_type: return_type, comment: @entity_comment)\n @buffer.skip(/\\s*/)\n\n scan_or_fail(/\\(/, 'Invalid function declaration. Expected (')\n until @buffer.scan(/\\)/)\n type = parse_type\n @buffer.skip(/\\s*/)\n\n # Special case for `x f(void)`` style prototypes\n break if type.name == :void && @buffer.scan(/\\)/)\n\n name = ''\n if type.name == :data && !type.size.nil?\n name = 'result'\n elsif type.name == :string && !type.size.nil?\n name = 'result'\n else\n name = @buffer.scan(/\\w+/)\n end\n param = Parameter.new(name: name, type: type)\n func.parameters << param\n @buffer.skip(/\\s*,\\s*/)\n end\n\n @buffer.skip(/;/)\n func\n end",
"def create_function(function_name, returning, definition, options = {})\n\n end",
"def to_proc\n lambda{ call }\n end",
"def valueFor(expectedValue,inputs,solution)\n case expectedValue\n when Symbol\n return solution\n when Proc\n return call_lambda(expectedValue,inputs).to_s\n else\n return expectedValue\n end\n end",
"def eval_call(node, env, stack_trace)\n\n\tcase env[node.fnc_name]\n\tin Closure\n\t\tstrace = stack_trace.clone\n\t\tstrace.append(StackTraceElement.new(node.line, node.col, node.fnc_name, node.args))\n\t\tnew_env = env[node.fnc_name].env.clone # Clone the environment saved in the closure\n\t\tif node.args and env[node.fnc_name].arg_ids and node.args.length != env[node.fnc_name].arg_ids.length\n\t\t\tthrow_error(\"Calling '#{node.fnc_name}', expected #{env[node.fnc_name].arg_ids.max_term_length} arguments and got #{node.args}.\", node, stack_trace)\n\t\t\treturn nil, env\n\t\tend\n\t\tif node.args\n\t\t\tenv[node.fnc_name].arg_ids.each_with_index{ |arg, index| # Eval arg and assign to arg_id in new_env.\n\t\t\t\tnew_env[arg.name], _ = eval_node_under(node.args[index], env, stack_trace)\n\t\t\t}\n\t\tend\n\telse\n\t\tthrow_error(\"Calling '#{node.fnc_name}', which does not seem to be a function.\", node, stack_trace)\n\tend\n\nend",
"def visit_call_expr(expr)\n callee = evaluate expr.callee\n\n # Apply the block to each item in expr.arguments\n # and construct a new list from the results.\n # Ruby:\n # https://ruby-doc.org/core-2.7.0/Enumerable.html#method-i-map\n # https://ruby-doc.org/core-2.7.0/Array.html#method-i-map\n # Java 8 streams:\n # https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#map-java.util.function.Function-\n arguments = expr.arguments.map do |argument|\n evaluate argument\n end\n\n unless callee.is_a?(LoxCallable)\n raise LoxRuntimeError.new(expr.paren, \"Can only call functions and classes.\")\n end\n\n function = callee\n if arguments.size == function.arity\n function.call self, arguments\n else\n message = \"Expected #{function.arity} arguments but got #{arguments.size}.\"\n raise LoxRuntimeError.new(expr.paren, message)\n end\n end",
"def execute(method_function, method_name, resource, **params)\n\n resource_uri = URI.parse(\"#{@rest_endpoint}#{resource}\")\n\n encoded_fields = ''\n if %w[POST PUT].include? method_name\n request = method_function.new(resource_uri.request_uri)\n if content_type == \"application/x-www-form-urlencoded\"\n unless params.empty?\n encoded_fields = URI.encode_www_form(params, Encoding::UTF_8)\n request.set_form_data(params)\n end\n else\n encoded_fields = params.to_json\n request.body = encoded_fields\n request.set_content_type(\"application/json\")\n end\n else\n resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8)\n request = method_function.new(resource_uri.request_uri)\n end\n\n headers = RestClient.generate_telesign_headers(@customer_id,\n @api_key,\n method_name,\n resource,\n content_type,\n encoded_fields,\n user_agent: @@user_agent)\n\n headers.each do |k, v|\n request[k] = v\n end\n\n http_response = @http.request(resource_uri, request)\n\n Response.new(http_response)\n end",
"def inspect_func(func)\n return inspect_object(func) unless func.is_a?(Proc)\n inspect_proc(func)\n end",
"def call_function(function_name, args)\n function_name = Saxon::QName.resolve(function_name).to_java\n transformation_invocation(:callFunction, function_name, function_args(args))\n end",
"def compute( &math_func )\n math_func.call( 3, 5 )\nend",
"def call(value)\n fn[value, *args]\n end",
"def have_func(function, headers = [])\n headers = get_header_string(headers)\n\n erb_ptr = ERB.new(read_template('have_func_pointer.erb'))\n erb_std = ERB.new(read_template('have_func.erb'))\n\n ptr_code = erb_ptr.result(binding)\n std_code = erb_std.result(binding)\n\n # Check for just the function pointer first. If that fails, then try\n # to compile with the function declaration.\n try_to_compile(ptr_code) || try_to_compile(std_code)\n end",
"def call(scope, *args)\n #local scope\n local = Scope.new(scope)\n\n bind_ctr = 0\n arg_ctr = 0\n\n if @max_args != -1\n raise \"Expected between #{@min_args} and #{@max_args} arguments for function, \" +\n \"but got #{args.length}\" unless args.length.between?(@min_args, @max_args)\n else\n raise \"Expected at least #{@min_args} arguments for function, \" +\n \"but got #{args.length}\" unless args.length >= @min_args\n end\n\n while bind_ctr < @bindings.value.length - 1 and (arg_ctr < args.length \\\n or arg_ctr < @max_args \\\n or @max_args == -1)\n arg_eval = args[arg_ctr].eval(scope)\n val = @bindings.value[bind_ctr].value\n if val =~ /\\?$/ and (args.length < @max_args)\n local[val[0...-1]] = Keyword.new(\"not-provided\")\n elsif val =~ /\\&$/\n local[val[0...-1]] = List.new(arg_ctr < args.length ? args[arg_ctr..-1] : [])\n break\n else\n val = val[0...-1] if val =~ /\\?$/\n local[val] = arg_eval\n arg_ctr += 1\n end\n bind_ctr += 1\n end\n\n @body.eval(local)\n end",
"def process(spec, argv)\n compile(spec)\n interpret(argv)\n self\n end",
"def compile_defun(scope, name, args, body)\n f = Function.new(args, body,scope)\n name = clean_method_name(name)\n\n # add function to the global list of functions defined so far\n @global_functions[name] = f\n\n # a function is referenced by its name (in assembly this is a label).\n # wherever we encounter that name, we really need the adress of the label.\n # so we mark the function with an adress type.\n return [:addr, clean_method_name(name)]\n end",
"def f; @function.to_s; end",
"def output_functions\n # This is a bit ugly, but handles the case of lambdas or inner\n # functions being added during the compilation... Should probably\n # refactor.\n while f = @global_functions.shift\n name = f[0]\n func = f[1]\n # create a function scope for each defined function and compile it appropriately.\n # also pass it the current global scope for further lookup of variables used\n # within the functions body that aren't defined there (global variables and those,\n # that are defined in the outer scope of the function's)\n\n fscope = FuncScope.new(func)\n\n pos = func.body.respond_to?(:position) ? func.body.position : nil\n fname = pos ? pos.filename : nil\n\n @e.include(fname) do\n # We extract the usage frequency information and pass it to the emitter\n # to inform the register allocation.\n varfreq = func.body.respond_to?(:extra) ? func.body.extra[:varfreq] : []\n @e.func(name, pos, varfreq) do\n minargs = func.minargs\n\n compile_if(fscope, [:lt, :numargs, minargs],\n [:sexp,[:call, :printf, \n [\"ArgumentError: In %s - expected a minimum of %d arguments, got %d\\n\",\n name, minargs - 2, [:sub, :numargs,2]]], [:div,1,0] ])\n\n if !func.rest?\n maxargs = func.maxargs\n compile_if(fscope, [:gt, :numargs, maxargs],\n [:sexp,[:call, :printf, \n [\"ArgumentError: In %s - expected a maximum of %d arguments, got %d\\n\",\n name, maxargs - 2, [:sub, :numargs,2]]], [:div,1,0] ])\n end\n\n if func.defaultvars > 0\n @e.with_stack(func.defaultvars) do \n func.process_defaults do |arg, index|\n @e.comment(\"Default argument for #{arg.name.to_s} at position #{2 + index}\")\n @e.comment(arg.default.inspect)\n compile_if(fscope, [:lt, :numargs, 1 + index],\n [:assign, (\"#\"+arg.name.to_s).to_sym, arg.default],\n [:assign, (\"#\"+arg.name.to_s).to_sym, arg.name])\n end\n end\n end\n\n compile_eval_arg(fscope, func.body)\n\n @e.comment(\"Reloading self if evicted:\")\n # Ensure %esi is intact on exit, if needed:\n reload_self(fscope)\n end\n end\n end\n end",
"def scanf_func_call(fn)\n text = \"scanf(\"\n match(Token.new(:reserved, 'scanf'))\n match(Token.new(:symbol, '('))\n text << \"#{@scanner.next.value}, &\"\n comma\n match(Token.new(:symbol, '&'))\n #match(Token.new(:symbol, '&'))\n text << \"#{expression(fn)});\\n\"\n match(Token.new(:symbol, ')'))\n semicolon\n fn.code << text\n end",
"def new_function_call\n\t\t\t return create_function_call(SAPNW::RFC::FunctionCall)\n\t\t\tend",
"def call (fn, *args)\n elisp([fn.to_sym, *args])\n end",
"def call(*args)\n locals = if @formals.is_a? Sym # rest args\n { @formals => args.to_list }\n else # regular arg list\n raise BusScheme::ArgumentError, \"Wrong number of args passed to #{@symbol}.\n expected #{@formals.size}, got #{args.size}\n in #{@file}:#{@line}\" if @formals.length != args.length\n @formals.zip(args).to_hash\n end\n\n @scope = RecursiveHash.new(locals, @enclosing_scope)\n # we dupe the lambda so that @scope is unique for each call of the function\n @@stack << self.dup\n \n begin\n return BusScheme.eval(@body.unshift(:begin.sym))\n ensure\n @@stack.pop\n end\n end",
"def generate_method_call(receiver, method, iter, args)\n\n method_name = @model.encode_method(method)\n @model.add_method_call(method_name)\n\n without_result do\n want_expression do\n if args.nil?\n # no arguments\n #\n # NOTE: We don't have to encode an iter of \"nil\" as \"nil\".\n # Instead we save us the space and check for undefined in the\n # method definition.\n \"#{receiver}.#{method_name}(#{iter})\"\n elsif args.first == :array\n # one or more arguments\n args_string = args[1..-1].map{|a| process(a)}.join(\",\")\n \"#{receiver}.#{method_name}(#{iter || @model.encode_nil},#{args_string})\"\n elsif args.first == :splat or args.first == :argscat\n #\n # puts(*a) # => [:fcall, :puts, [:splat, [:lvar, :a]]]]]]\n #\n # puts(1, *a) # => ... [:argscat, [:array, [:lit, 1]], [:lvar, :a]]\n #\n @model.add_method_call(__invoke = @model.encode_method('__invoke'))\n \"#{receiver}.#{__invoke}(#{iter || @model.encode_nil},'#{method_name}',#{ process(args) })\"\n else\n raise\n end\n end\n end\n end",
"def get_function(params={})\n function_name = params.delete('FunctionName')\n request({\n :method => 'GET',\n :path => \"/functions/#{function_name}/versions/HEAD\",\n :parser => Fog::AWS::Parsers::Lambda::Base.new\n }.merge(params))\n end",
"def to_proc(spec=nil, &block)\n # Split the filter spec into a straight value => value hash and a pattern => value hash.\n ph, vh = spec.split { |k, v| k =~ REGEXP_PAT }\n # The Regexp => value hash is built from the pattern => value hash.\n reh = regexp_hash(ph)\n # The value proc.\n value_proc(reh, vh)\n end",
"def output_custom_function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)\n return_type = is_value_function ? \"RETURN_TYPE\" : \"void\"\n ap_list = has_varargs ? \", va_list ap\" : \"\"\n calling_conv = has_calling_conventions ? \", CALLING_CONVENTION\" : \"\"\n putd_backslash \"CUSTOM_FFF_FUNCTION_TEMPLATE(#{return_type}#{calling_conv}, custom_fake, #{arg_type_list(arg_count)}#{ap_list});\"\nend",
"def parse_function(function, args)\n # TODO: handle Refs\n if args.kind_of?(Hash)\n args.each_pair do |nested_name, nested_values|\n nested = CFDoc::Model::Function.new(nested_name)\n parse_function(nested, nested_values)\n function.arguments << nested\n end\n elsif args.kind_of?(Array)\n # TODO: capture into an array type?\n args.each { |a| parse_function(function, a)}\n elsif args.kind_of?(String)\n function.arguments << args\n end\n end",
"def compile_lambda(scope, args, body)\n compile_defun(scope, @e.get_local, args,body)\n end",
"def create_lambda(arg)\n case arg\n when Proc then arg\n when Symbol then lambda { |request| request[arg] }\n else raise \"Canot create a lambda expression from this argument: #{arg.inspect}!\"\n end\n end",
"def create_lambda(arg)\n case arg\n when Proc then arg\n when Symbol then lambda { |request| request[arg] }\n else raise \"Canot create a lambda expression from this argument: #{arg.inspect}!\"\n end\n end",
"def iterate_function(start_value, function)\n Node.new(start_value, lambda{ iterate_function( function.call(start_value), function ) })\nend",
"def call(container, context)\n if spec.respond_to?(:to_proc) && !spec.is_a?(Symbol)\n spec.to_proc\n elsif spec.respond_to?(:call)\n spec\n elsif spec.nil?\n context.method(name)\n elsif container[spec]\n with(container[spec]).call(container, context)\n else\n raise InvalidPlugError, name\n end\n end",
"def to_proc\n ->(input) { call(input) }\n end",
"def invoke(fun, args, normal, exception, name = \"\")\n invoke2(nil, fun, args, normal, exception, name)\n end",
"def on_call(ast_node, context)\n name, *args = *ast_node\n\n handler = name.gsub('-', '_')\n\n return send(\"on_call_#{handler}\", context, *args)\n end",
"def generate_client_function(output_folder, fn)\n target_folder = File.join(output_folder, 'libraries', 'google',\n 'functions')\n {\n fn: fn,\n target_folder: target_folder,\n template: 'templates/chef/function.erb',\n output_folder: output_folder,\n out_file: File.join(target_folder, \"#{fn.name}.rb\")\n }\n end",
"def create_custom_function(dbc, file)\n dll_name = randz(15) + \".dll\"\n plugin_path = get_plugin_dir(dbc)\n @udf_dest = plugin_path.chomp + dll_name\n fake_function = 'sys_' + randz(5)\n\n # Upload our UDF DLL Payload file\n if write_bin_file(dbc, file, @udf_dest)\n begin\n puts \"Payload DLL writen to disk\".light_green + \"!\".white\n puts \"Creating function to trigger now\".light_blue + \"....\".white\n puts \"Make sure your listener is ready\".light_yellow + \"....\".white\n sleep(3)\n # Drop function if its already there, then create new\n q = dbc.query(\"DROP FUNCTION IF EXISTS #{fake_function};\")\n q = dbc.query(\"CREATE FUNCTION #{fake_function} RETURNS string SONAME '#{dll_name}';\")\n return fake_function\n rescue Mysql::Error => e\n puts \"Error Triggered, Payload should have also been triggered\".light_green + \"!\".white\n return fake_function\n end\n end\nend",
"def _inspect_function(func)\n return func unless func.is_a?(Proc)\n File.readlines(func.source_location[0])[func.source_location[1]-1].match(/^\\s+(\\w+)/)[1]\n end",
"def eval_function(text)\n eval(text, binding, File.join(__dir__, 'template'), __LINE__ + 1)\nend",
"def generate_method_call_receiver_exp(recv_exp, method, iter, args)\n generate_method_call(receiver_exp(recv_exp), method, iter, args)\n end",
"def call(f)\n CAS::Help.assert(f, Hash)\n Math::sin(@x.call(f))\n end",
"def call_me(some_code)\n some_code.call\nend",
"def in(function)\n eval(\"firstresult = 1.#{function}; self/firstresult\")\n end",
"def function\n build_function(super, constants)\n end",
"def prepare_lambda given\n case given\n when String\n if given['%s']\n ->(x){ eval(given % x) }\n else\n ->(x){ eval given }\n end\n else\n given\n end\n end",
"def call_function(fn_name, args)\n case fn_name\n when 'hiera'\n val = @hiera.lookup(args[0], args[1], @scope)\n if val.nil?\n val = @scope[args[0]]\n end\n if val.nil? && !(args.length >= 2)\n # TODO: display exception coloured in output\n raise Exception, \"undefined variable '#{args[0]}' and no default\"\n end\n val\n when 'hiera_hash'\n @hiera.lookup(args[0], args[1], @scope, resolution_type = :hash)\n when 'template'\n erb, _ = make_erb(args[0])\n erb.result(self.get_binding())\n when 'warning'\n puts red(\"[WARNING]: #{args[0]}\")\n when 'fail'\n raise RuntimeError, args[0]\n else\n raise Exception, \"call_function: unknown function '#{fn_name}'\" if fn_name != 'hiera'\n end\n end",
"def generate_client_function(output_folder, fn)\n target_folder = File.join(output_folder, 'lib', 'puppet', 'functions')\n {\n fn: fn,\n target_folder: target_folder,\n template: 'templates/puppet/function.erb',\n output_folder: output_folder,\n out_file: File.join(target_folder, \"#{fn.name}.rb\")\n }\n end",
"def exec(bytecode, *params)\n inst_spec = instspec_table[bytecode]\n instance_exec(*params, &inst_spec.func)\n end",
"def printf_func_call(fn)\n\n fn.code << \"#{@scanner.next.value}#{@scanner.next.value}#{@scanner.next.value}#{printf_func_call_tail(fn)}\"\n end",
"def build_rendering_proc( template, scope )\n\t\tcode = %q{\n\t\t\tProc.new {\n\t\t\t\t%s {|%s| res << __callback.call(%s)}\n\t\t\t\tres\n\t\t\t}\n\t\t} % [ self.methodchain, self.args.join(\",\"), self.pureargs.join(\",\") ]\n\t\tcode.untaint\n\n\t\t#self.log.debug \"Rendering proc code is: %p\" % code\n\t\tdesc = \"[%s (%s): %s]\" %\n\t\t\t[ self.class.name, __FILE__, self.methodchain ]\n\n\t\treturn eval( code, scope.get_binding, desc, __LINE__ )\n\tend",
"def eval_lambda(exp, env)\n make_closure_from_lambda(exp, env)\n end",
"def function_define(name=\"\",&block)\n \"function #{name}() { #{block.call} }\" \n end",
"def new_function_text(line, matchdata, randomized_name)\n \"#{line}\n record = {}\n method(__method__).parameters.each{|arg| record[arg[1].to_s] = (eval arg[1].to_s)}\n RECORDER.push([\\\"#{matchdata[2]}\\\", record, \\\"called\\\"])\n x = #{randomized_name}(*(record.values))\n RECORDER.push([\\\"#{matchdata[2]}\\\", x, \\\"returned\\\"])\n return x\nend\n\n#{matchdata[1]}#{randomized_name}#{matchdata[3]}\n \"\nend",
"def source\n @callable\n end",
"def source\n @callable\n end",
"def call_as_function(ctx,object,thisObject,argumentCount,arguments,exception)\n JS::Lib.JSObjectCallAsFunction(ctx,object,thisObject,argumentCount,arguments,exception)\n end",
"def main\n func = ARGV.shift\n outdir = ARGV.shift || '.'\n Dir.mkdir(outdir) unless File.exists?(outdir)\n binformat = (ARGV.shift || 'elf').downcase\n format = (ARGV.shift || 'asm').downcase\n platform = `uname -s`.chomp.downcase\n print \"testing #{func} ... \"\n success = run( build(\"test_#{func}.code\", outdir, platform, binformat) )\n if success == 0\n puts \"pass\"\n else\n puts \"FAIL! (#{success})\"\n end\n exit(success.to_i)\nend"
] | [
"0.61701816",
"0.53646755",
"0.5325305",
"0.5321283",
"0.5281186",
"0.5237938",
"0.52055365",
"0.5160128",
"0.51426977",
"0.5130135",
"0.5103285",
"0.50887305",
"0.5080676",
"0.5080396",
"0.5074464",
"0.507376",
"0.5069834",
"0.50623256",
"0.50463223",
"0.5031352",
"0.5022494",
"0.5018825",
"0.50017196",
"0.49831888",
"0.49646097",
"0.49560112",
"0.494382",
"0.4941545",
"0.49354783",
"0.49042267",
"0.4861222",
"0.48581427",
"0.4851459",
"0.4851459",
"0.48148963",
"0.48138782",
"0.47975713",
"0.47934744",
"0.4774027",
"0.47673747",
"0.47527117",
"0.4749517",
"0.4737096",
"0.470866",
"0.4701854",
"0.47016734",
"0.46616647",
"0.46550977",
"0.46407947",
"0.46291855",
"0.46258473",
"0.459609",
"0.45952815",
"0.45696303",
"0.45472738",
"0.45313513",
"0.4522283",
"0.45216846",
"0.4512913",
"0.4503467",
"0.44921902",
"0.4490595",
"0.44766137",
"0.44763762",
"0.44744036",
"0.4468352",
"0.44682276",
"0.44533655",
"0.44495136",
"0.4439689",
"0.44326904",
"0.44297886",
"0.44297886",
"0.44267508",
"0.4413351",
"0.440778",
"0.44037706",
"0.44022658",
"0.43890545",
"0.4388628",
"0.4374502",
"0.43642068",
"0.4341197",
"0.43388945",
"0.43362987",
"0.43276715",
"0.43239772",
"0.43217558",
"0.43197697",
"0.43117833",
"0.43070203",
"0.4305712",
"0.43045434",
"0.43016797",
"0.4297131",
"0.42968756",
"0.42963368",
"0.42963368",
"0.42920643",
"0.42781842"
] | 0.7800188 | 0 |
Yields each line of the error check and any actions taken for this wrapped function. If this function does not have any error check defined, then this function returns without yielding anything. +return_val+ is used as the replacement for a return value signified by the use of RETURN_VALUE_KEYWORD in the spec. If not specified it defaults to +'return_val'+. This parameter was added in release 0.4.2. | def error_check(return_val: 'return_val')
return if @error_rules.empty?
checks = @error_rules.map { |rule| rule.check(return_val: return_val) }
yield "if( #{checks.join(' && ')} ){"
yield " #{@error_action.take};"
yield '}'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_check\n @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) }\n end",
"def each_error(&blk)\n yield value\n self\n end",
"def with_checking(description)\n puts \"Checking #{description}\"\n result = yield\n if result\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend",
"def ret!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n\n type = RET\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 7:7: 'returns'\n match(\"returns\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 1)\n\n end",
"def returning(value)\n yield(value)\n value\n end",
"def with_error_check\n msg = yield\n if msg.to_s[0,5] == \"fatal\"\n puts \"Error:\"\n puts msg\n return false\n end\n puts msg\n return true\nend",
"def return!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = RETURN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 327:10: 'return'\n match( \"return\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n end",
"def return!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n\n type = RETURN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 141:10: 'return'\n match( \"return\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n end",
"def with_clean_result # :nodoc:\n was_result = @result\n yield\n @result\n ensure\n @result = was_result\n end",
"def returnsomething\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n begin\n # at line 613:5: expression\n @state.following.push( TOKENS_FOLLOWING_expression_IN_returnsomething_848 )\n expression\n @state.following.pop\n # --> action\n\n \trt = @stack_operands.pop\n rt_t = @stack_types.pop\n if(rt_t != @current_method.return_type)\n raise \"Invalid return type #{rt_t} in the #{@current_method.return_type} type method #{@current_class.name}::#{@current_method.name}\"\n end\n generate('ret', nil, nil ,rt )\n @is_returning = true\n free_avail(rt)\n free_avail_const(rt)\n \n \n # <-- action\n\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__, 18 )\n\n end\n \n return \n end",
"def return(&block); end",
"def _reduce_44(val, _values, result)\n line = val[0].last\n result = s(:return, ret_args(val[1])).line(line)\n \n result\nend",
"def _reduce_44(val, _values, result)\n line = val[0].last\n result = s(:return, ret_args(val[1])).line(line)\n \n result\nend",
"def _reduce_44(val, _values, result)\n line = val[0].last\n result = s(:return, ret_args(val[1])).line(line)\n \n result\nend",
"def may_fail # block\n begin\n yield\n rescue\n end\nend",
"def get_return_value exp, env = nil\n process_method exp, env\n value = make_return_value\n value.original_line = exp.line\n value\n end",
"def do_something\n value = yield('Hello world') if block_given?\n puts \"The block returned #{value}\"\nend",
"def return!(&block); end",
"def foo\n return raise\n#> xxxxxx\n end",
"def return!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n\n\n type = RETURN\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 223:9: 'return'\n match( \"return\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n\n end",
"def use_return?\n @error_rules.any?(&:use_return?)\n end",
"def method_with_explicit_return\n :a_non_return_value\n return :return_value\n :another_non_return_value\n end",
"def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end",
"def do_sth_with_arg_and_return\n value = yield \"Yielding a string\" if block_given?\n p value\nend",
"def return_block\n yield\nend",
"def assert\n\traise \"Error! Error!\" unless yield\nend",
"def meth\n res = yield \n \"The block returns #{res}\"\nend",
"def with_block_returning\n 42.times do |i|\n return i if i > 20\n end.to_s\n#> ---xxxxx\n end",
"def returns(value=nil, &b)\n @expectation.return(value, &b)\n self\n end",
"def assert_1\n raise \"Invalid argument\" unless yield\nend",
"def map_error(&blk)\n Failure.new(yield(value))\n end",
"def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end",
"def do_something_with_params_line\n if block_given?\n value = yield\n puts value\n end\nend",
"def assert\n raise \"ERROR!\" unless yield \nend",
"def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)\n # Do nothing\n end",
"def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end",
"def returnstmt\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n begin\n # at line 608:4: 'return' ( returnsomething )? ';'\n match( T__43, TOKENS_FOLLOWING_T__43_IN_returnstmt_820 )\n # at line 608:13: ( returnsomething )?\n alt_21 = 2\n look_21_0 = @input.peek( 1 )\n\n if ( look_21_0.between?( IDENTIFIER, INTEGER ) || look_21_0.between?( FLOAT, NULL ) || look_21_0 == T__28 || look_21_0 == T__41 || look_21_0.between?( T__49, T__51 ) )\n alt_21 = 1\n end\n case alt_21\n when 1\n # at line 608:13: returnsomething\n @state.following.push( TOKENS_FOLLOWING_returnsomething_IN_returnstmt_822 )\n returnsomething\n @state.following.pop\n\n end\n match( T__31, TOKENS_FOLLOWING_T__31_IN_returnstmt_825 )\n\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__, 17 )\n\n end\n \n return \n end",
"def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end",
"def on_non_test_result_line(&block)\n raise ArgumentError.new('must provide a block') unless block_given?\n @on_non_test_result_line_block = block\n end",
"def parse_returns(section)\n returns, raises, current = [], [], []\n\n lines = section.split(\"\\n\") \n lines.each do |line|\n case line\n when /^Returns/\n returns << line\n current = returns\n when /^Raises/\n raises << line\n current = raises\n when /^\\s+/\n current.last << line.squeeze(' ')\n else\n current << line # TODO: What to do with non-compliant line?\n end\n end\n\n @returns, @raises = returns, raises\n end",
"def yield_call(compiler)\n method_check(compiler) << yield_arg_block(compiler)\n end",
"def compute_f_e(yielded, &block)\n return block.(yielded) if block_given?\n\n do_not_exist.nil? NameError\n rescue \n\n block.nil?\nend",
"def return_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n return_value = ReturnStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal97 = nil\n expression98 = nil\n\n tree_for_string_literal97 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 130:5: ^( 'return' ( expression )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal97 = match( RETURN, TOKENS_FOLLOWING_RETURN_IN_return_statement_725 )\n\n tree_for_string_literal97 = @adaptor.copy_node( string_literal97 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal97, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 130:17: ( expression )?\n alt_27 = 2\n look_27_0 = @input.peek( 1 )\n\n if ( look_27_0.between?( AMP, AMP_ASGN ) || look_27_0 == POST_DECR || look_27_0.between?( GEQ, AREF ) || look_27_0.between?( GREATER, HAT ) || look_27_0.between?( ARROW, HAT_ASGN ) || look_27_0 == ASGN || look_27_0 == REGEX || look_27_0 == IN || look_27_0 == INCR || look_27_0.between?( INSTANCEOF, RSHIFT3 ) || look_27_0 == RSHIFT3_ASGN || look_27_0 == RSHIFT_ASGN || look_27_0 == LEQ || look_27_0.between?( LESS, SLASH ) || look_27_0 == SLASH_ASGN || look_27_0.between?( STAR, DECR ) || look_27_0 == STAR_ASGN || look_27_0 == LSHIFT || look_27_0.between?( DELETE, THIS ) || look_27_0.between?( MINUS, TILDE ) || look_27_0.between?( MINUS_ASGN, MOD ) || look_27_0.between?( MOD_ASGN, TYPEOF ) || look_27_0.between?( NEQ, UMINUS ) || look_27_0.between?( NEQQ, UNDEFINED ) || look_27_0 == NEW || look_27_0 == NOT || look_27_0.between?( NULL, UPLUS ) || look_27_0 == OBJECT || look_27_0.between?( EQ, OR_ASGN ) || look_27_0 == FALSE || look_27_0 == PIPE || look_27_0 == PIPE_ASGN || look_27_0 == PLUS || look_27_0.between?( ID, DOC ) )\n alt_27 = 1\n end\n case alt_27\n when 1\n # at line 130:17: expression\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_return_statement_727 )\n expression98 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression98.tree )\n\n\n end\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\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__, 24 )\n\n end\n \n return return_value\n end",
"def ret(val=nil)\n return if @finished\n if @function.return_type == Types::VOID\n @builder.ret_void\n else\n pret val\n @builder.br(@function.return_block)\n end\n self.finish\n end",
"def wrap\n old_enabled, old_inline = enabled, inline\n self.inline = false\n self.enabled = true\n yield\n rescue Exception => ex\n if ex.should_intercept?\n enter_exception(ex)\n else\n raise ex\n end\n ensure\n self.enabled = old_enabled\n self.inline = old_inline\n end",
"def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)\n tc_before_step_result(exception, keyword, multiline_arg, source_indent, status, step_match, background)\n super\n end",
"def yieldreturn_tag(text); end",
"def yield_return\n p yield\nend",
"def silently\n warn_level = $VERBOSE\n $VERBOSE = nil\n begin\n result = yield\n ensure\n $VERBOSE = warn_level\n end\n result\nend",
"def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend",
"def assert\n raise \"Found an error!\" unless yield\nend",
"def capture_return\n @returns = @code.split(/\\(/).first !~ /void/ \n end",
"def transform_error_with(&blk)\n @transform_error_with = blk if blk\n @transform_error_with || DEFAULT_ERROR_TRANSFORM\n end",
"def return_block\n return @function.return_block\n end",
"def test\n yield(1, 2)\nend",
"def eval_custom_validator_block(state, original_state = nil)\n yield(state, original_state)\n invalid!(state) if state.errors.present?\n state\n end",
"def returns val = nil\n @returns = val\n self\n end",
"def transform_error_with(&blk)\n @transform_error_with = blk if blk\n @transform_error_with || DEFAULT_ERROR_TRANSFORM\n end",
"def assert\n\traise \"Something's not right.\" unless yield\n\tputs yield\nend",
"def each_result_arg\n match_all = ->(_) { true }\n changeset.file_paths.each do |relative_filename|\n next unless relative_filename.to_s.end_with?(\".rb\")\n path = case relative_filename\n when Pathname then relative_filename\n else\n File.expand_path(relative_filename, @relative_git_dir)\n end\n\n root_ast = Imagen::Node::Root.new.build_from_file(path)\n next if root_ast.children.empty?\n\n coverage = lcov.source_files[path.to_s]\n\n root_ast.children[0].find_all(match_all).each do |node|\n yield(path.to_s, coverage, node)\n end\n end\n end",
"def perform_action(message, multiline, mark_fn, on_fail_msg, tally_on_fail, abort_on_fail)\n line = \"#{message}... \"\n endline = \"...#{message} \"\n if multiline\n puts line\n else\n print line\n end\n $stdout.flush\n result = yield\n mark = mark_fn.nil? ? \"\" : mark_fn.call(result)\n # if multiline, put checkmark at full width\n print endline if multiline\n puts mark.to_s.rjust(WIDTH - line.length, \" \")\n unless result\n puts on_fail_msg unless on_fail_msg.nil?\n @failure_count += 1 if tally_on_fail\n # print out error messaging here if we've captured it\n terminate if abort_on_fail\n end\n result\nend",
"def assert\n \n raise \"Assertion failed\" unless yield \nend",
"def assert\n\tyield\nend",
"def assert\n\tyield\nend",
"def f\n # This calls the block:\n yield == 2 or raise\n yield == 2 or raise\n end",
"def _reduce_279(val, _values, result)\n result = lexer.line\n \n result\nend",
"def capture_error\n begin\n yield\n @error = all_output unless last_exit_status == 0\n rescue => @error\n end\n end",
"def gather_errors\n if @propagation_exceptions\n raise InternalError, \"recursive call to #gather_errors\"\n end\n\n # The ensure clause must NOT apply to the recursive check above.\n # Otherwise, we end up resetting @propagation_exceptions to nil,\n # which wreaks havoc\n begin\n @propagation_exceptions = []\n yield\n @propagation_exceptions\n\n ensure\n @propagation_exceptions = nil\n end\n\tend",
"def assert\n raise \"Something is wrong\" unless yield\nend",
"def assert\n raise \"something is wrong!\" unless yield\nend",
"def assert\n raise \"something is wrong!\" unless yield\nend",
"def assert \n raise \"Error! your code sucks!\" unless yield\nend",
"def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end",
"def rci ci, &blk\n begin\n loop do\n yield ci if block_given?\n raise StopIteration if ci.bc.peek == :halt\n ci.step\n end\n rescue => err\n \n \n end\n [ci.ctx.stack.peek, err]\nend",
"def show_error\n yield(@source, @index_1, @length_1, @index_2, @length_2)\n end",
"def run(argarr)\n #$stderr.puts \"Calling function with arguments #{@args.class}\"\n callargs = Hash.new\n if @args.class == Array\n @args.each do |v|\n callargs[v] = argarr[v]\n end\n elsif @args.class == Symbol and argarr[@args].class == Hash\n argarr[@args].each do |k,v|\n callargs[k] = v\n end\n elsif @args.class == Symbol\n callargs[:__argument] = argarr[@args]\n end\n \n Function[@function].run(callargs)\n retarr = callargs[:__return]\n if ((!@returns) ^ (!retarr)) and (!@returns or !retarr)\n $stderr.puts \"Return from #{@function} failed - expectation was nil xor returns was nil\"\n $stderr.puts \"Non-fatal for now, but shame on you\"\n \n return\n elsif (!@returns) #and by extension retarr has to be nil\n return #this is ok\n elsif (@returns.class == Symbol and retarr.class != Array)\n argarr[@returns] = retarr\n return\n elsif (@returns.class == Array and retarr.class != Array)\n $stderr.puts \"Return from #{@function} failed - expectation was an array but returns wasn't\"\n $stderr.puts \"Invalid statement:\"\n YAML.dump(self, $stderr)\n $stderr.puts\n raise \"Function return error - returning from #{@function} expecting returns #{@returns}\"\n end\n #now we know @returns should be an array\n @returns.each do |r|\n argarr[r] = retarr.shift\n end\n end",
"def block_caller\n result_of_block = yield 'passed from block_caller'\n return result_of_block\nend",
"def sreturn(val)\n # HDLRuby::High.top_user.hprint(\"sreturn\\n\")\n # Get the top function.\n funcI = SequencerFunctionI.current\n unless funcI then\n raise \"Cannot return since outside a function.\"\n end\n # Applies the return on it.\n funcI.make_return(val)\n end",
"def assert \n\traise \"Assertion failed!\" unless yield\nend",
"def process_return(exp)\n return \"return #{process exp.shift}\"\n end",
"def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end",
"def make_return(val = nil)\n SequencerT.current.step\n # puts \"make_return with val=#{val}\"\n # Update the type of the return value.\n if val then\n # Update the type.\n @returnValue.instance_variable_set(:@type, @returnValue.type.resolve(val.to_expr.type))\n # Sets the return value if any.\n self.return_value <= val\n end\n # Create the state for the return command.\n state = SequencerT.current.step\n # Get the return state value.\n # ret_state_value = self.peek(@returnIdx, HDLRuby::High.top_user.mux(@stack_ptr < @depth,-1,0))\n # Peek before the stack pointer value to account from the fact that\n # the pop is performed beforehand.\n ret_state_value = self.peek(@returnIdx, HDLRuby::High.top_user.mux(@stack_ptr < @depth,0,+1))\n # Return.\n this = self\n state.gotos << proc do\n HDLRuby::High.top_user.instance_exec do\n # Set the next state.\n next_state_sig <= ret_state_value\n # # Pop must be place after setting the return state.\n # this.pop_all\n end\n end\n # Pop (done at clock edge, hence before the update of the state).\n old_code = state.code\n state.code = proc do\n old_code.call\n HDLRuby::High.top_user.instance_exec do\n this.pop_all\n end\n end\n\n return state\n end",
"def check_array_ret(line, output)\n puts \"LINE: '#{line}'\"\n assert_nothing_thrown do\n res = tagparser.parse_input(line)\n assert_equal output, line\n end\n return res\n end",
"def return_values(block_body_node); end",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise \"Assertion failed!\" unless yield\nend",
"def assert\n\traise ArgumentError.new(\"Assertion failed!\") unless yield\nend",
"def assert \n\traise \"Assertion failed\" unless yield\nend",
"def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend",
"def parse_function_return\n return_kw = expect(:KW_RETURN)\n value = nil\n\n unless peek?(:SEPARATOR)\n value = parse_expression\n end\n\n ret = StmtReturn.new(@curr_parsed_method, value, return_kw)\n\n @curr_parsed_method.returns << ret\n\n ret\n end"
] | [
"0.5953187",
"0.580142",
"0.5736961",
"0.5692616",
"0.5527312",
"0.54786634",
"0.5445796",
"0.5445641",
"0.54100806",
"0.54085886",
"0.53746337",
"0.53572744",
"0.53572744",
"0.53572744",
"0.53377837",
"0.531385",
"0.5305816",
"0.5300508",
"0.52881557",
"0.5242474",
"0.52341634",
"0.5232086",
"0.52295387",
"0.5219969",
"0.52198195",
"0.5218518",
"0.5215616",
"0.51590276",
"0.51294947",
"0.51224536",
"0.51210386",
"0.51200485",
"0.51151884",
"0.51129055",
"0.5109448",
"0.5107068",
"0.5094514",
"0.5085678",
"0.508433",
"0.5066527",
"0.50605327",
"0.5041572",
"0.50379956",
"0.5027411",
"0.5021183",
"0.50190693",
"0.50091535",
"0.5005346",
"0.5000608",
"0.4993599",
"0.49901456",
"0.49877477",
"0.49872172",
"0.4977903",
"0.49720785",
"0.49714595",
"0.49704668",
"0.4967823",
"0.49605682",
"0.49599218",
"0.4951711",
"0.49516633",
"0.49492747",
"0.49492747",
"0.49446023",
"0.494332",
"0.4941296",
"0.49390617",
"0.4933577",
"0.4929622",
"0.4929622",
"0.4924691",
"0.49154538",
"0.49116772",
"0.49094793",
"0.49043047",
"0.49041632",
"0.49009728",
"0.48949003",
"0.4893047",
"0.48869455",
"0.48861623",
"0.48822248",
"0.48796454",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.48719123",
"0.4871796",
"0.4870161",
"0.4865175",
"0.48521784",
"0.48481074"
] | 0.7073704 | 0 |
True if the wrapped function has an error check associated with it. | def error_check?
!@error_rules.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_on_error?\n defined? @on_error\n end",
"def raise_on_error?\n !!@raise_on_error\n end",
"def error?\n !!@error\n end",
"def error?\n !!@error\n end",
"def error?\n not @error.nil?\n end",
"def error?()\n #This is a stub, used for indexing\n end",
"def error?\n !!@error\n end",
"def error?\n !! @error\n end",
"def error?\n !error.nil?\n end",
"def error?\n !error.nil?\n end",
"def error?\n return true if errors.count > 0\n\n false\n end",
"def has_error?\n status == ERROR \n end",
"def error?\n error.to_bool\n end",
"def errors?\n process_errors.errors?\n end",
"def error?\n !!@exception\n end",
"def error?\n !!exception\n end",
"def error?\n !error.nil?\n end",
"def error?\n return !ok?\n end",
"def has_errors?\n @has_errors == true\n end",
"def with_errors?\n self.errors.any?\n end",
"def on_error?\n @kind == :on_error\n end",
"def error?\n get_last_error['err'] != nil\n end",
"def error?\n get_last_error['err'] != nil\n end",
"def has_error?\n !(error.nil? || error.empty?)\n end",
"def has_error?\n !(error.nil? || error.empty?)\n end",
"def call_error?(rc) (rc.respond_to?(:ok?) and rc.ok?) ? false : true end",
"def error?\n true\n end",
"def error?\n !failure?\n end",
"def error?\n last_error.present?\n end",
"def error?\n false\n end",
"def errors?\n\t\treturn !self.okay?\n\tend",
"def errors?\n\t\treturn !self.okay?\n\tend",
"def error?(method)\n @object.present? and @object.errors[method].present?\n end",
"def error?\n respond_to? :error\n end",
"def error?\n @error\n end",
"def error?\n @error\n end",
"def hasError?\r\n\t\t@expected != nil\r\n\tend",
"def error?\n !error.blank?\n end",
"def error?\n error\n end",
"def regular_error_handling?(ex) #:nodoc:\n if @@error_block\n @@error_block.call(ex)\n else\n true\n end\n end",
"def raise_errors?\n @raise_errors != false\n end",
"def error?\n @status == ERROR_FLAG\n end",
"def error?\n false\n end",
"def error?\n false\n end",
"def has_errors?\r\n @errors.present?\r\n end",
"def error?\n false\n end",
"def has_errors?\n @_errors ||= {}\n @_errors == {}\n end",
"def errors?\n @error_count > 0\n end",
"def error?\n !success?\n end",
"def errors?\n @statistics[:error] != 0\n end",
"def failing_with_errors?\n completed? && has_failures? && has_errors?\n end",
"def return_check\n @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) }\n end",
"def error?\n self.error || false\n end",
"def ok?\n !@error\n end",
"def has_errors?\n errors.count > 0\n end",
"def error?\n !success?\n end",
"def error?\n type == :error\n end",
"def failure?\n !error?\n end",
"def error?\n self.type == :error\n end",
"def error?\n self.type == :error\n end",
"def failed?\n error.present?\n end",
"def errors?\n errors.any?\n end",
"def error?\n attributes['error'] != 0\n end",
"def errors?\n @errors.size > 0\n end",
"def errors?\n !errors.empty?\n end",
"def error?\n raise NotImplementedError.new\n end",
"def error?\n !success?\n end",
"def use_return?\n @error_rules.any?(&:use_return?)\n end",
"def error?\n @exception.present?\n end",
"def errors_for?(method)\n nil\n end",
"def error?\n status == STATUS_ERROR\n end",
"def has_errors?\n outputs.any?(&:error)\n end",
"def raise_on_error?\n @raise\n end",
"def errors?\n !success?\n end",
"def has_errors?\n @errors.length > 0\n end",
"def has_errors\n [email protected]?\n end",
"def error?\n outcome == ERROR\n end",
"def error?\n level <= ERROR\n end",
"def has_errors?\n options[:success] == false || super\n end",
"def error?\n !@data['error'].nil?\n end",
"def error?\n !@data['error'].nil?\n end",
"def error?\n converter_results[:errors] && converter_results[:errors].any?\n end",
"def call\n resource.errors.any?\n end",
"def any_errors?\n @errors.any?\n end",
"def errors_found?\n errors.size > 0\n end",
"def something_should_fail?\n @should_fail\n end",
"def errors?\n @errors.size > 0\n end",
"def valid?\n @errors == []\n end",
"def error?\n return false if error_text.nil? or error_text.empty?\n return true\n end",
"def error?\n no_error_code = error_code.nil? || error_code.zero?\n done? && !(err.nil? && no_error_code)\n end",
"def include_errors?\n !!self.__options[:include_errors]\n end",
"def valid?\r\n self.error.nil?\r\n end",
"def valid?\n [email protected]?\n end",
"def valid?\n check!\n true\n rescue\n false\n end",
"def runtime_error?\n state = self.peek_current_state\n error_state?(state) &&\n !exception_state?(state) &&\n !fatal_error_state?(state)\n end",
"def error?\n error_state?(peek_current_state)\n end",
"def error?\n\t\tEventMachine::report_connection_error_status(@signature) != 0\n\tend",
"def valid?\n @error.nil?\n end",
"def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end",
"def error?\n status[:error] || false\n end"
] | [
"0.7195475",
"0.7030983",
"0.7009783",
"0.7009783",
"0.6987915",
"0.6957566",
"0.6941116",
"0.693001",
"0.6914877",
"0.6914877",
"0.6909985",
"0.6841991",
"0.6827234",
"0.6826043",
"0.68109643",
"0.6802435",
"0.6802012",
"0.6774842",
"0.6768849",
"0.6734169",
"0.6725946",
"0.67222184",
"0.67222184",
"0.6709039",
"0.6709039",
"0.6683371",
"0.6679057",
"0.66645944",
"0.66559565",
"0.664912",
"0.6642387",
"0.6642387",
"0.66377485",
"0.66370565",
"0.66169184",
"0.66169184",
"0.6609633",
"0.6604905",
"0.6582023",
"0.6557039",
"0.6550398",
"0.65350246",
"0.6530912",
"0.6530912",
"0.65296805",
"0.6515275",
"0.65130705",
"0.6510106",
"0.6498702",
"0.64876944",
"0.6469349",
"0.6447169",
"0.6444535",
"0.6442688",
"0.6419805",
"0.64138424",
"0.64090276",
"0.6406002",
"0.64025587",
"0.64025587",
"0.6400063",
"0.63911635",
"0.6391163",
"0.63853145",
"0.6374949",
"0.63748753",
"0.63747174",
"0.6345662",
"0.6344143",
"0.6343822",
"0.63405067",
"0.6339721",
"0.63390845",
"0.6335478",
"0.63317436",
"0.6319643",
"0.6310274",
"0.63080096",
"0.6299763",
"0.62923163",
"0.62923163",
"0.62827784",
"0.62758887",
"0.62751997",
"0.6268171",
"0.62530833",
"0.6242446",
"0.6242226",
"0.6239032",
"0.623227",
"0.6213626",
"0.6204584",
"0.6200381",
"0.6187067",
"0.6183856",
"0.61669534",
"0.6160421",
"0.6157733",
"0.6145954",
"0.6145926"
] | 0.71104485 | 1 |
A list of includes required for this function call. | def includes
includes = @spec['includes'].dup
includes.concat(@error_action.includes) if error_check?
includes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_includes\n []\n end",
"def includes() return @includes end",
"def allowed_includes\n []\n end",
"def includes\n @includes ||= params[:include].to_s.split(',')\n end",
"def includes\n []\n end",
"def includes\n end",
"def includes\n end",
"def included_in\n @included_in ||= []\n end",
"def includes()\n includes = @data[\"includes\"]\n if includes.nil? || includes == \"\"\n return []\n elsif includes.class == String\n return [includes]\n elsif includes.class == Array\n return includes\n else\n raise InvalidIncludesFormat.new(\"Value for 'includes' in #{@name} must be a String or an Array, (#{includes.inspect})\")\n end\n end",
"def set_includes\n @includes = params[:i].nil? ? [] : eval(params[:i])\n @includes_list = @includes.map{|b| b.is_a?(Hash) ? b.to_a.flatten : b}.flatten || []\n #Rails.logger.debug @includes\n #Rails.logger.debug @includes_list\n end",
"def default_includes\n []\n end",
"def includes(*args)\n @options[:include] ||= []\n @options[:include] |= args\n end",
"def includes\n include_params.select { |i| config_for(i).present? }\n end",
"def includes\n @spec['includes'].dup.concat(@type.includes)\n end",
"def extract_includes\n return @extract_includes if @extract_includes\n @extract_includes = []\n query_conditions.each do |condition|\n unless condition.nil? || condition.empty?\n if(condition.is_a?(Hash) && condition[:include])\n @extract_includes << condition[:include]\n end\n end\n end\n @extract_includes.uniq!\n @extract_includes\n end",
"def includes\n return @includes if @includes\n @includes = []\n @context.includes.each do |i|\n ref = R2Doc.all_references[i.name]\n ref = @context.find_symbol(i.name)\n ref = ref.viewer if ref\n if ref and ref.document_self\n @includes << {:name=>i.name, :url=>ref.path}\n else\n @includes << {:name=>i.name}\n end\n end\n @includes\n end",
"def inclusions; end",
"def add_includes(inc)\r\n return if inc.nil?\r\n \r\n inc = [inc] if (!inc.respond_to?(:each) || inc.kind_of?(String))\r\n \r\n if inc.include?(:all)\r\n ole_methods.each do |m|\r\n m = m.to_s\r\n if m =~ /\\AInclude/ && m != 'IncludeRetElementList'\r\n @request.__send__(\"#{m.underscore}=\", true)\r\n end\r\n end\r\n return\r\n end\r\n \r\n inc.each do |item|\r\n cam_item = item.to_s.camelize.gsub(/Id/, \"ID\")\r\n if @request.respond_to_ole?(\"Include#{cam_item}\")\r\n @request.__send__(\"include_#{item}=\", true)\r\n else\r\n @request.IncludeRetElementList.Add(cam_item)\r\n end\r\n end\r\n end",
"def includes(*args)\n config.includes.push *args\n end",
"def include_strategy\n :includes\n end",
"def includes(*paths)\n @includes.concat(paths) unless paths.empty?\n @includes\n end",
"def includes(options)\n @includes = options\n end",
"def included; end",
"def get_all_includes includes = nil, recurse = nil\n\t\tif includes == nil\n\t\t\tif @includes.is_a? Array\n\t\t\t\tincludes = @includes\n\t\t\telsif @includes.is_a? Hash\n\t\t\t\treturn @includes\n\t\t\telse\n\t\t\t\t$log.warn \"NERO_Skill(#{@name}) has includes in an invalid format!\"\n\t\t\t\treturn []\n\t\t\tend\n\t\tend\n\t\trecurse = 0 if recurse == nil\n\n\t\t$log.debug \"#{@name}.get_all_includes(#{includes.inspect},#{recurse})\"\n\n\t\treturn includes if recurse >= 5 or includes.nil?\n\t\textra_includes = []\n\t\tincludes.each do |skill_name|\n\t\t\tnskill = NERO_Skill.lookup(skill_name)\n\t\t\tnext if nskill.nil?\n\t\t\textra_includes = extra_includes + nskill.includes unless nskill.includes.nil?\n\t\tend\n\t\textra_includes = extra_includes - includes\n\t\tincludes = Set.new(includes + extra_includes).to_a\n\t\tif extra_includes.empty?\n\t\t\t$log.info \"#{@name}.get_all_includes() = #{includes.inspect}\"\n\t\t\treturn includes\n\t\tend\n\t\treturn get_all_includes(includes, recurse + 1)\n\tend",
"def includes\n @spec['includes'].dup\n end",
"def includes_data\n [\"#include\", *self.includes.map(&:to_s)].join(\"\\n\")\n end",
"def include(*i)\n @includes |= i.flatten\n end",
"def inclusions\n @inclusions ||= []\n end",
"def include_params\n @include_params ||= begin\n params[:include].present? ? params[:include].split(',').map!(&:strip) : []\n end\n end",
"def valid_includes(includes)\n result = []\n includes.each do |i|\n if association = associations.find { |a| a.includes == i }\n result << association.name\n end\n end\n result\n end",
"def included\n @included.uniq! if @included.respond_to?(:uniq!)\n @included\n end",
"def includes\n @include_ids.collect { |idx| BInclude.store[idx] }\n end",
"def includes(*args)\n fresh.tap do |criteria|\n criteria.includes_values = (includes_values || []) + args\n end\n end",
"def eager_includes(include_referenced: true)\n {}\n end",
"def included_resources\n if @include_param.nil?\n @include_param = []\n else\n included_resources_returns_only_non_wildcards\n end\n end",
"def include inc\n @includes << inc\n end",
"def included_files; end",
"def test_not_included\n refute_includes(list, 'xyz')\nend",
"def default_includes\r\n read_inheritable_attribute(\"include_by_default\").to_a\r\n end",
"def included\n return [] if directory.empty? || directory == '*'\n @included ||= process_globs(@raw_data['include'])\n end",
"def sting_test_includes\n (@sting_test_includes ||= [])\n end",
"def model_includes\n @model_includes ||= parse_for_active_record_includes(resources: included_resources)\n end",
"def jsonapi_include\n params['include'].to_s.split(',').map(&:strip).compact\n end",
"def includes_for_sorting\n []\n end",
"def inclusions=(_arg0); end",
"def includes\n @includes ||= remove_through_model(full_includes)\n end",
"def idl_includes(*incs)\n @recipe.idl_includes << incs.flatten.compact\n end",
"def included_resources\n @include_param ? @include_param.split(\",\").reject{ |r| r.include?(\"*\") } : Array.new\n end",
"def include_options\n { include: parsed_associations || [], methods: parsed_methods || [] }\n end",
"def cpp_includes\n\t\tselect {|x| x.class == CppInclude }\n\tend",
"def include; end",
"def include; end",
"def included_constants; end",
"def included_resources\n @included_resources ||= begin\n return [] if include_param.nil?\n\n include_param.split(RESOURCES_SEPARATOR_CHAR).uniq.reject { |resource| invalid_resource?(resource) }\n end\n end",
"def preview_includes\n []\n end",
"def included\n included = @objects.try(:map) { |o| o.try(:included) }\n included.try(:flatten!)\n included.try(:compact!) || included\n end",
"def find_includes include_dirs, src\r\n includes = Rake::CParser.parse_file_includes src\r\n res = includes.collect { |inc|\r\n search_includes include_dirs, src, inc\r\n }\r\n res.compact\r\n end",
"def headers\n @attributes + @includes.values.flatten\n end",
"def normalize_includes!\n # TODO: normalize Array of Symbol, String, DM::Property 1-jump-away or DM::Query::Path\n end",
"def includes(*paths)\n self.included_files.concat(expand_globs(paths))\n end",
"def model_includes\n # 1st level convertion -- allows same-level repetition of attributes\n build_deep = lambda { |arr| arr.collect { |res| res.include?(\".\") ? { res.split(\".\").shift.to_sym => build_deep.call([res.split(\".\").drop(1).join(\".\")]) } : res.to_sym } }\n a1 = build_deep.call(included_resources).uniq\n \n # merges the repetitions into single structures -- it may add some \"{ key: nil }\" hashes to represent simple attributes of the includes clause\n hashify = lambda { |arr|\n h = {}\n arr.each{ |res|\n h.merge!(res.is_a?(Hash) ? res : { res => nil }) { |key, res1, res2|\n res1.is_a?(Array) ? (res2.is_a?(Array) ? hashify.call(res1 + res2) : res1) : (res2.is_a?(Array) ? res2 : nil)\n }\n }\n h\n }\n a2 = hashify.call(a1)\n \n # simplifies \"{ key: nil }\" hashes back to \":key\" symbols \n simplify = lambda { |hsh|\n r = []\n hsh.each{ |key, val| r << ( val.nil? ? key : { key => simplify.call(val) } ) }\n r\n }\n a3 = simplify.call(a2)\n end",
"def model_includes\n if @include_param.nil?\n @include_param = []\n else\n if check_two_level\n model_includes_single_or_multiple_two_level_resources\n #duplicate_item\n else\n model_includes_single_or_multiple_three_level_resources\n end\n end\n end",
"def lookup_includes_list(file)\n file_key = form_file_key(file)\n return [] if (@includes[file_key]).nil?\n return @includes[file_key]\n end",
"def process_includes(mainclass, params_data)\n includes = {}\n errors = []\n if params_data\n include_requests = {}\n if params_data.kind_of?(Hash)\n params_data.each do |key,value|\n if value == ''\n include_requests[key] = {}\n else\n include_requests[key] = value\n end\n end\n elsif params_data.kind_of?(Array)\n params_data.each { |p| include_requests[p] = {} }\n else\n include_requests[params_data] = {}\n end\n\n include_requests.each do |include_request, value|\n assoc = mainclass.reflect_on_association(include_request.to_sym)\n if assoc.nil?\n # FIXME: Need better error handling for XML users\n errors << \"Ignored invalid include #{include_request}\"\n logger.info \"Ignored invalid include #{include_request}\"\n next\n else\n # Rails appears to have a bug as of 2.1.1 such that including a\n # has_one, through association causes an exception. The exception\n # looks like this for future reference:\n # NoMethodError (undefined method `to_ary' for #<Datacenter:0x3aaa1b0>)\n if assoc.macro == :has_one && assoc.options.has_key?(:through)\n # FIXME: Need better error handling for XML users\n errors << \"Ignored has_one, through include #{include_request}\"\n logger.info \"Ignored has_one, through include #{include_request}\"\n else\n if !value.empty?\n value = process_includes(assoc.klass, value)\n end\n includes[include_request.to_sym] = value\n end\n end\n end\n end\n return includes\n end",
"def includes\r\n return nil unless @joins and not @joins.empty?\r\n includes = @joins.collect{|j| j.includes}\r\n end",
"def include(*args)\n include_or_extend(:include, *args)\n end",
"def do_includes\n @body.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n if cls = @classes[c]\n m = @known_classes[m] || m\n cls.add_include(Include.new(m, \"\"))\n end\n end\n end",
"def search_process_includes(mainclass, params_data)\n includes = {}\n errors = []\n if params_data\n include_requests = {}\n if params_data.kind_of?(Hash)\n params_data.each do |key,value|\n if value == ''\n include_requests[key] = {}\n else\n include_requests[key] = value\n end\n end\n elsif params_data.kind_of?(Array)\n params_data.each { |p| include_requests[p] = {} }\n else\n include_requests[params_data] = {}\n end\n\n include_requests.each do |include_request, value|\n assoc = mainclass.reflect_on_association(include_request.to_sym)\n if assoc.nil?\n # FIXME: Need better error handling for XML users\n errors << \"Ignored invalid include #{include_request}\"\n logger.info \"Ignored invalid include #{include_request}\"\n next\n else\n # Rails appears to have a bug as of 2.1.1 such that including a\n # has_one, through association causes an exception. The exception\n # looks like this for future reference:\n # NoMethodError (undefined method `to_ary' for #<Datacenter:0x3aaa1b0>)\n if assoc.macro == :has_one && assoc.options.has_key?(:through)\n # FIXME: Need better error handling for XML users\n errors << \"Ignored has_one, through include #{include_request}\"\n logger.info \"Ignored has_one, through include #{include_request}\"\n else\n if !value.empty?\n value, suberrors = search_process_includes(assoc.klass, value)\n end\n includes[include_request.to_sym] = value\n end\n end\n end\n end\n return includes, errors\n end",
"def includes\n @mpc_project.recipe.get_relative_paths(@mpc_project.includes)\n end",
"def included_associations(include = [])\n include += [:hostgroup, :compute_resource, :operatingsystem, :environment, :model ]\n include += [:fact_values] if User.current.user_facts.any?\n include\n end",
"def included_sources\n return @included_sources\n end",
"def has_includes?\n @context.includes.length > 0\n end",
"def included_associations\n @included_associations ||= begin\n self.options[:include_associations] ||= []\n self.options[:include_associations].collect(&:to_sym)\n end\n end",
"def json_include()\n return [\n :events,\n :goals,\n :tracker_days,\n # :journal\n ]\n end",
"def include_constants\n @_include_constants ||= Set.new\n end",
"def included_modules; end",
"def included(*args)\n quando_incluso *args\n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def add_default_includes!(options)\r\n return if options[:include] or default_includes.blank?\r\n options[:include] = default_includes\r\n end",
"def includes(*_args)\n relations.map { |rel| rel[1] }\n end",
"def include(*others)\n IncludesTracker.reset!\n __orig_include(*others)\n end",
"def include_all(*args) \n set_option_value(:include_all, true, *args)\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def include_locations\n return @include_locations\n end",
"def includes\n return :project_roles => {:protocol => {:service_requests => {:line_items => :service, :sub_service_requests => :organization}}}\n end",
"def included(mod); end",
"def including(*models)\n @expected_options[:include] = (models.length == 1) ? models.first : models\n self\n end",
"def included_attributes\n @included_attributes ||= begin\n ret = self.options[:include_extras] || []\n ret.map(&:to_sym)\n end\n end",
"def included_modules() end",
"def get_all_includes(systems,code = @code)\n return [] unless code.is_a?(Array)\n return code.reduce([]) do |ar,sub|\n ar + get_all_includes(systems,sub)\n end + (code.select { |sub| is_include?(sub,systems) }).to_a\n end",
"def includes\n return :identity => {:service_providers => :organization}\n end",
"def included_rules\n @included_rules ||= {}\n end",
"def test_0210_includeq\n @@log.debug \"test_0210_includeq starts\" if @@log.debug?\n assert_respond_to(@list, :include?, \"test_0210_includeq_respond\")\n # Test does include\n assert(@list.include?(@bsb),\"test_0210_includeq_basic\")\n # Test does not include\n ta = Person.new(\"A\", \"B\", \"C\", 456)\n assert(@list.include?(ta) == false,\"test_0210_includeq_backwards\")\n\n @@log.debug \"test_0210_includeq ends\" if @@log.debug?\n end",
"def public_nav_includeables\n [\n public_nav_can_include_albums,\n public_nav_can_include_audio,\n public_nav_can_include_events,\n public_nav_can_include_info,\n public_nav_can_include_pictures,\n public_nav_can_include_stream,\n public_nav_can_include_videos\n ]\n end",
"def include(*files)\n @include += files.flatten\n self\n end",
"def index\n @included_ins = IncludedIn.all\n end",
"def get_included(file)\n included = []\n\n @include_path.each do |dir|\n file_name = File.join dir, file\n\n if File.exist? file_name then\n included = IO.readlines file_name\n break\n end\n end\n\n included\nend",
"def include(*args)\n include_private(*args)\n end",
"def owners_included; end"
] | [
"0.8081024",
"0.80346656",
"0.791811",
"0.7884439",
"0.7582941",
"0.75183076",
"0.75183076",
"0.7514233",
"0.7455574",
"0.73687845",
"0.7367305",
"0.73432255",
"0.73165125",
"0.719227",
"0.7162343",
"0.7124008",
"0.70960987",
"0.7028111",
"0.6995484",
"0.699491",
"0.69945925",
"0.69836473",
"0.69341624",
"0.69070435",
"0.6884249",
"0.6828072",
"0.67645913",
"0.67157745",
"0.6684255",
"0.6674901",
"0.66657084",
"0.665189",
"0.6640782",
"0.66371363",
"0.6618384",
"0.66092384",
"0.6605404",
"0.65914494",
"0.6590601",
"0.65858126",
"0.65616417",
"0.6561577",
"0.6559088",
"0.655394",
"0.6547051",
"0.6504766",
"0.6503804",
"0.648171",
"0.646525",
"0.6464544",
"0.6415335",
"0.6415335",
"0.6412505",
"0.6409733",
"0.63995296",
"0.6385309",
"0.6372696",
"0.6365515",
"0.6359987",
"0.6345465",
"0.63397485",
"0.6333071",
"0.6324897",
"0.63079935",
"0.6307751",
"0.629855",
"0.62918603",
"0.6289381",
"0.62883353",
"0.6286451",
"0.6267883",
"0.6267256",
"0.626477",
"0.6255197",
"0.62506104",
"0.6238231",
"0.62125134",
"0.62057865",
"0.62032455",
"0.61934596",
"0.6186521",
"0.6182994",
"0.617659",
"0.617659",
"0.61500573",
"0.6140739",
"0.61386746",
"0.61169595",
"0.6112266",
"0.61119336",
"0.61070603",
"0.6085268",
"0.60753024",
"0.60589767",
"0.60558635",
"0.6045902",
"0.60401464",
"0.6035898",
"0.6030485",
"0.6022232"
] | 0.73677224 | 10 |
A TypeSpec describing the type of the return value. Changed in release 0.4.2 to return a TypeSpec instead of a String. | def return_val_type
TypeSpec.new(@spec['return']['type'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_type\n as_java_type(@ast.return_type)\n end",
"def spec_type(desc, *additional); end",
"def expected_type\n 'string'\n end",
"def spec_type desc, *additional\n TYPES.find { |matcher, _klass|\n if matcher.respond_to? :call then\n matcher.call desc, *additional\n else\n matcher === desc.to_s\n end\n }.last\n end",
"def type\n return :unknown unless properties['result_type']\n\n properties['result_type'].to_sym\n end",
"def type\n Type.new(type_param).yard_type_string\n end",
"def returned_type(defn)\n single_returned_type(defn) or conditional_returned_types(defn)\n end",
"def return_type\n self.class.const_get(:RETURN_TYPE)\n end",
"def type_str\n Types.type_str(type)\n end",
"def type (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_type(to_native, value.is_a?(Symbol) ? value : C::GetType[value])\n\t\telse\n\t\t\tto_native[:type]\n\t\tend\n\tend",
"def get_type(type_str)\n return :integer if /^\\d+\\.$/.match(type_str)\n return :decimal if /^\\d+\\.\\d+$/.match(type_str)\n return :string\n end",
"def result_type\n properties['type']\n end",
"def type\n result_hash['typ']\n end",
"def find_type(type_spec)\n if type_spec.is_a?(TyRaw) && (typaram = @data[:typarams][type_spec.name])\n typaram\n else\n check_type_exists(type_spec)\n type_spec\n end\n end",
"def return(type)\n valid = %w{ none raw structured }.include? type.to_s\n raise InvalidReturnTypeError unless valid\n\n self.return_type = type\n end",
"def get_type\n\n end",
"def yard_type_string\n if association?(ast)\n yard_type_from_association(ast)\n elsif collection?(ast)\n yard_type_from_collection(ast)\n elsif ast.ref?\n yard_type_from_reference(ast)\n elsif !ast[0].nil?\n Type.new(ast[0]).yard_type_string\n else\n nil\n end\n end",
"def human_type\n self[:type].to_human\n end",
"def value_type\n @type.value_type\n end",
"def type\r\n if immediate?\r\n return Fixnum if fixnum?\r\n return Float if flonum?\r\n return TrueClass if @val == Qtrue\r\n return Symbol if static_sym?\r\n return \"undef\" if @val == Qundef\r\n elsif !test_true?\r\n return NilClass if @val == Qnil\r\n return FalseClass if @val == Qfalse\r\n end\r\n builtin_type\r\n end",
"def returned_type\n model.returned_type\n end",
"def type(value)\n _type(value) or fail ArgumentError, \"Unknown value for type: #{value}\"\n end",
"def type(value)\n _type(value) or fail ArgumentError, \"Unknown value for type: #{value}\"\n end",
"def type\n return @type if @type != \"unknown\"\n info\n @type\n end",
"def expected_type\n @data[\"expected_type\"]\n end",
"def rb_type(value)\n type_str = nil\n # IMMEDIATE_P\n if @gdb.cmd_get_value(\"p (int)(#{value}) & RUBY_IMMEDIATE_MASK\") != '0'\n # FIXNUM_P\n if @gdb.cmd_get_value(\"p (int)(#{value}) & RUBY_FIXNUM_FLAG\") != '0'\n type_str = 'RUBY_T_FIXNUM'\n # FLONUM_P\n elsif @gdb.cmd_get_value(\"p ((int)(#{value}) & RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG\") != '0'\n type_str = 'RUBY_T_FLONUM'\n elsif @gdb.cmd_get_value(\"p (#{value}) == RUBY_Qtrue\") != '0'\n type_str = 'RUBY_T_TRUE'\n # SYMBOL_P\n elsif @gdb.cmd_get_value(\"p (VALUE)(#{value}) & ~(~(VALUE)0 << RUBY_SPECIAL_SHIFT) == RUBY_SYMBOL_FLAG\") != '0'\n type_str = 'RUBY_T_SYMBOL'\n elsif @gdb.cmd_get_value(\"p (#{value}) == RUBY_Qundef\") != '0'\n type_str = 'RUBY_T_UNDEF'\n end\n elsif @gdb.cmd_get_value(\"p (int)(#{value}) & RUBY_FIXNUM_FLAG\") != '0'\n # special consts\n const = @gdb.cmd_get_value(\"p (enum ruby_special_consts)(#{value})\")\n # TODO: change to map\n case const\n when 'RUBY_Qnil'\n type_str = 'RUBY_T_NIL'\n when 'RUBY_Qfalse'\n type_str = 'RUBY_T_FALSE'\n end\n else\n # builtin type\n type_str = @gdb.cmd_get_value(\"p (enum ruby_value_type)(((struct RBasic*)(#{value}))->flags & RUBY_T_MASK)\")\n end\n end",
"def type_for(value)\n case value\n when Numeric\n :numeric\n when String\n :string\n when true, false\n :logical\n when :add, :subtract, :multiply, :divide, :mod, :pow\n :operator\n when :open, :close, :comma\n :grouping\n when :lbracket, :rbracket\n :access\n when :le, :ge, :ne, :lt, :gt, :eq\n :comparator\n when :and, :or\n :combinator\n when :if, :round, :roundup, :rounddown, :not\n :function\n else\n :identifier\n end\nend",
"def get_type()\n # Check if a type has been specified and if not set it to :round.\n if @metadata[:type] == nil\n @metadata[:type] = :round\n end\n return @metadata[:type]\n end",
"def data_type\n ns_definition(:query_spec_datatypes)\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'BOOLEAN'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map {|item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n SwaggerClient.const_get(return_type).new.tap do |model|\n model.build_from_hash data\n end\n end\n end",
"def type_str\n self.class.const_get(:TYPE_STR)\n end",
"def type\n @type.to_s\n end",
"def human_type\n Core::TYPES_DESC[type]\n end",
"def return_type; end",
"def return_type; end",
"def return_type; end",
"def simple_value_type_code\n value_type_code\nend",
"def to_type\n case @cfg.type_name\n when :bool\n bool_from_str(@str.downcase)\n when :int, :positive_int, :unsigned_int\n raise exc unless valid_int_str?(cleaned_num_str)\n cleaned_num_str.to_i\n when :float\n raise exc unless valid_float_str?(cleaned_num_str)\n cleaned_num_str.to_f\n when :string\n @str\n when :symbol\n @str.to_sym\n when :int_array, :positive_int_array, :unsigned_int_array\n ints_from_csv_str\n # add more _array types!\n when :float_array\n floats_from_csv_str\n else\n raise ConfigError, \"Type not yet supported: #{@cfg.type_name}.\"\n end\n end",
"def type\n read_attr :type, :to_sym\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'BOOLEAN'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object, return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map {|item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n SimplyRetsClient.const_get(return_type).new.tap do |model|\n model.build_from_hash data\n end\n end\n end",
"def type\n attr_val('./@typeCode')\n end",
"def type\n if validator_hash[:numericality] == true ||\n validator_hash[:numericality] == { allow_nil: true }\n 'Decimal'\n elsif validator_hash.dig(:numericality, :only_integer)\n 'Integer'\n elsif validator_hash[:ingested_date]\n 'Date'\n elsif validator_hash.dig(:case_insensitive_inclusion, :in) == %w[Y N]\n 'YesNo'\n elsif inclusion_list_with_lookup_values?(validator_hash.dig(:case_insensitive_inclusion, :in))\n attr.name.tr(' ', '')\n else\n 'String'\n end\n end",
"def type\n 'describe'\n end",
"def expect_string name, value\n expect_type name,\n value, \n \"string\",\n String\n end",
"def value_type(vals)\n types = vals.map {|v| v.class }.uniq\n\n # Convert everything to string if there isn't a single unique type\n return Thrift::Types::STRING if types.size > 1\n\n type = types.first\n\n # Array -> LIST\n return Thrift::Types::LIST if type == Array\n\n # Hash can be a MAP or STRUCT\n if type == Hash\n if vals.first.has_key?(STRUCT)\n return Thrift::Types::STRUCT\n else\n return Thrift::Types::MAP\n end\n end\n\n Thrift::Types::STRING\n end",
"def expected_type\n @property.expected_type\n end",
"def to_s\n type\n end",
"def simplified_type(field_type)\n case field_type\n when /tsvector/i\n :text\n when /regprocedure/i\n :string\n else\n simplified_type_base(field_type)\n end\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'Boolean'\n data == true\n when 'Time'\n # parse date time (expecting ISO 8601 format)\n Time.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models (e.g. Pet) or oneOf\n klass = Petstore.const_get(return_type)\n klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)\n end\n end",
"def revert_generic_type( type )\n case type\n when /\\Avarchar/\n return :String, :default_size => 255\n when /\\Achar/\n return :String, :fixed => true, :default_size => 255\n when /\\Atext\\z/\n return :String, :text => true\n when /\\A(\\w+)\\([\\s\\d,]+\\)\\z/\n return $1.to_sym\n when /\\A\\w+\\z/\n return type.to_sym\n end\n end",
"def type\n :puppet_type\n end",
"def raw_type\n JavaType.new(@package, @name)\n end",
"def value_type\n return @value_type\n end",
"def type_of_type(value)\n if value.is_a?(Range) || value.is_a?(Array) || value.is_a?(Hash)\n :complex\n else\n :simple\n end\nend",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'Boolean'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n OpenapiClient.const_get(return_type).build_from_hash(data)\n end\n end",
"def type(type); end",
"def type ; metadata[:type] ; end",
"def get_primitive_type_string(attr_details)\n attr_details[:primitive].to_s.downcase == 'nilclass' ? 'string' : attr_details[:primitive].to_s.downcase\n end",
"def ruby_type_of(value, dry_sum_type)\n json_type_of_value = Types.json_type(value.class)\n\n walk_dry_sum(dry_sum_type) do |type|\n return type if json_type_of_value == Types.json_type(type.primitive)\n end\n end",
"def type\n return @type\n end",
"def spec_type_params\n params[:spec_type]\n end",
"def type\n return constant_value_type\n end",
"def name_to_type(name,metadata)\n # Lookup this metric metadata\n meta=metadata[name]\n return nil if meta.nil?\n\n return meta['type']\n end",
"def get_type(property_name, type)\n type ||= property_name\n type = type.to_s.classify if type.is_a?(Symbol)\n name = type.to_s\n base = name.demodulize.to_sym\n base = :Boolean if %i[TrueClass FalseClass].include?(base)\n if base.blank? || (base == :String)\n type = nil\n elsif SCALAR_TYPES.include?(base)\n type = \"Axiom::Types::#{base}\"\n elsif !name.include?('::')\n type = \"Ils::#{name}\"\n end\n type.is_a?(String) ? type.constantize : type\n end",
"def ruby_type\n raise NotImplementedError\n end",
"def typecast(value)\n return value if type === value || (value.nil? && type != TrueClass)\n\n if type == TrueClass then %w[ true 1 t ].include?(value.to_s.downcase)\n elsif type == String then value.to_s\n elsif type == Float then value.to_f\n elsif type == Fixnum then value.to_i\n elsif type == BigDecimal then BigDecimal(value.to_s)\n elsif type == DateTime then DateTime.parse(value.to_s)\n elsif type == Date then Date.parse(value.to_s)\n elsif type == Class then find_const(value)\n end\n end",
"def type_name\n @type_name ||= determine_type_name(descriptor)\n end",
"def get_type(value) #method\n if value == 'verdadero'\n true\n elsif value == 'falso'\n false\n elsif value.include? '.'\n value.to_f\n elsif value.scan(/\\D/).empty?\n value.to_i\n else\n value\n end\n end",
"def convert_to_type(data, return_type, api_version)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'Boolean'\n data == true\n when 'Time'\n # parse date time (expecting ISO 8601 format)\n Time.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type, api_version) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type, api_version) }\n end\n else\n # models (e.g. Pet) or oneOf\n klass = DatadogAPIClient.const_get(api_version).const_get(return_type)\n klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)\n end\n end",
"def type\n @types ||= strip(:type)\n end",
"def type() end",
"def getScalaType(dmDomType)\n typeRenderer = SCALA_TYPES[dmDomType.type]\n typeRenderer ? typeRenderer.call(dmDomType) : dmDomType.type\n end",
"def type\n self.class.type_to_string(self)\n end",
"def type\n type_and_version[0]\n end",
"def determine_dataype(value)\n return validate_field(value)\n end",
"def data_type\n if @data_type\n @data_type\n else\n (@is_string ? String : nil)\n end\n end",
"def type\n field[:type]\n end",
"def type_matcher(mod)\n TypeMatcher.new(mod)\n end",
"def type\n \"t\"\n end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type\n @grpc.type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def csharp_type_for_schema_definition( schema )\n types = {\n ::Respect::ArraySchema => \"List<string>\",\n ::Respect::BooleanSchema => \"bool#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::FloatSchema => \"float#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::HashSchema => \"Dictionary<string, object>\",\n ::Respect::IntegerSchema => \"long#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::StringSchema => \"string\",\n ::Respect::AnySchema => \"object\",\n ::Respect::GeoPointSchema => \"global::#{ base_api_namespace() }.Fields.GeoPoint\",\n ::Respect::AttachmentSchema => \"global::#{ base_api_namespace() }.Fields.Attachment\"\n }\n\n types = if options[:use_noda_time] == \"true\" || options[:use_noda_time] == \"1\"\n types.merge({\n ::Respect::DatetimeSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"NodaTime.LocalDate#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n else\n types.merge({\n ::Respect::DatetimeSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n end\n\n type = types[ schema.class ]\n\n custom = nil\n collection = false\n\n schema_item = schema.instance_variable_get(:@item)\n if type == \"List<string>\" && schema_item && schema_item.is_a?(::Respect::AnySchema)\n type = \"List<object>\"\n end\n\n if schema.is_a?(Respect::HasOneSchema)\n type = sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of )\n custom = type\n collection = false\n end\n\n if schema.is_a?(Respect::EnumSchema)\n type = sanitize_model_namespace( schema.values_module ) + \".\" + sanitize_model_class( schema.values_module )\n custom = type\n collection = false\n\n emit_enum!( schema.values_module )\n end\n\n if schema.is_a?(Respect::HasManySchema)\n type = \"List<\" + sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of ) + \">\"\n custom = type\n collection = true\n end\n\n return type, custom, collection\n end"
] | [
"0.6271245",
"0.61185175",
"0.5996158",
"0.58966744",
"0.5846511",
"0.5816263",
"0.5807003",
"0.5798122",
"0.57817715",
"0.57322943",
"0.5635026",
"0.56271523",
"0.55972743",
"0.55916053",
"0.55712104",
"0.5548467",
"0.5525777",
"0.54927045",
"0.54885375",
"0.54859537",
"0.54742664",
"0.5468397",
"0.5468397",
"0.5365106",
"0.53529507",
"0.5339525",
"0.53372073",
"0.5295777",
"0.5278956",
"0.52704954",
"0.5270021",
"0.5268377",
"0.5258462",
"0.5252886",
"0.5252886",
"0.5252886",
"0.52343076",
"0.5230388",
"0.52207613",
"0.521496",
"0.52142394",
"0.5212027",
"0.5206023",
"0.52013034",
"0.51943827",
"0.51888806",
"0.5169412",
"0.51538306",
"0.5152935",
"0.51266646",
"0.5113973",
"0.5103868",
"0.51028126",
"0.50988317",
"0.5077",
"0.5075704",
"0.50753087",
"0.5072996",
"0.5055101",
"0.50546277",
"0.50541943",
"0.5053914",
"0.5049207",
"0.50476474",
"0.5044757",
"0.5042492",
"0.5037997",
"0.502707",
"0.50251794",
"0.5022465",
"0.5007987",
"0.4996596",
"0.49915498",
"0.4989333",
"0.49804714",
"0.497233",
"0.49709168",
"0.49645573",
"0.49630672",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.4958123",
"0.49499804",
"0.49418348",
"0.4940123",
"0.4940123",
"0.4940123",
"0.49363726"
] | 0.81955373 | 0 |
True if calling this wrapped function needs to save/use the return value for error checking. This is equivalent to checking all error rules for the use of RETURN_VALUE_KEYWORD. This method was added in release 0.4.2. | def use_return?
@error_rules.any?(&:use_return?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_retval?\n @keep_retval\n end",
"def has_return_value?\n @return_value.type != VoidType\n end",
"def supports_returning?\n false\n end",
"def returns_something?; @return_type || !@returned_arguments.empty? end",
"def return_check\n @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) }\n end",
"def may_return?\n @returnsites = instructions.list.select { |i| i.returns? } unless @returnsites\n ! @returnsites.empty? || must_return?\n end",
"def returns_nil_bad\n 3 # error: Returning value that does not conform to method result type\n end",
"def something_should_fail?\n @should_fail\n end",
"def return_value_from_query?\n @this_val_where[:mode] == 'return_value'\n end",
"def success?(*) end",
"def include_error_data?\n self.return_error_data\n end",
"def ok?\n skip? || @result\n end",
"def may_return_to?\n function.identify_return_sites if @may_return_to.nil?\n @may_return_to\n end",
"def success?() end",
"def ok?\n return @ok\n end",
"def check_return_code(ret, key = nil) #:doc:\n if ret == 0 # Lib::MEMCACHED_SUCCESS\n elsif ret == 32 # Lib::MEMCACHED_BUFFERED\n elsif ret == 16\n raise @not_found # Lib::MEMCACHED_NOTFOUND\n elsif ret == 14\n raise @not_stored # Lib::MEMCACHED_NOTSTORED\n else\n reraise(key, ret)\n end\n rescue TypeError\n # Reached if show_backtraces is true\n reraise(key, ret)\n end",
"def result?\n false\n end",
"def ok? \n @funct == nil ? (return false) : (return true)\n end",
"def returns val = nil\n @returns = val\n self\n end",
"def return_value\n @return_value\n end",
"def value_if_false\n return @value_if_false\n end",
"def must_have_value?\n return false\n end",
"def acceptable_return?(return_val, element_name); end",
"def can_have_value?()\n return true\n end",
"def error?()\n #This is a stub, used for indexing\n end",
"def return_value; end",
"def can_have_value?\n return false\n end",
"def define_value_checking_method\n self.class.send :define_method, \"#{symbol}?\" do\n __callee__[0..-2].to_sym == symbol\n end\n end",
"def ok?\n @ok\n end",
"def supports_returning?(type)\n true\n end",
"def supports_returning?(type)\n true\n end",
"def value_valid?\n return true\n end",
"def validated?\n [email protected]?\n end",
"def pret(val=nil)\n return if @finished\n @function.setup_return\n unless @function.return_type == Types::VOID || val.nil?\n @builder.store(Convert(val, @function.return_type), @function.return_val)\n end\n end",
"def no_return?\n !note[TSBS::NoReturnTAG].nil?\n end",
"def no_return?\n !note[TSBS::NoReturnTAG].nil?\n end",
"def can_have_value?\n return true\n end",
"def success?\n @success_value\n end",
"def error?\n return !ok?\n end",
"def ok?\n @result.retval == 0\n end",
"def ok_enabled?\r\n return true\r\n end",
"def good?(value)\n value\n end",
"def valid?\n !!result\n end",
"def be_truthful\n 42\n true # The last expression is always the one that gets returned\nend",
"def result?\n true\n end",
"def success?\n raise RuntimeError, \"#success or #error should be called inside #call\" unless @pristine\n raise RuntimeError, \"both #success and #error where called\" if (@success && @error)\n @success && !@error\n end",
"def ok_enabled?; handle?(:ok); end",
"def valid?\n return true if skip?\n handler.valid?(value)\n end",
"def warning?\n @result.retval == 1\n end",
"def return_result_from_query?\n @this_val_where[:mode] == 'return_result'\n end",
"def method_with_explicit_return\n :a_non_return_value\n return :return_value\n :another_non_return_value\n end",
"def do_validation \n return true if self.ok\n set_ok\n self.ok\n end",
"def valid?\n begin\n return true if @value.has_key?(\"Meta\")\n rescue\n logger.warn \"#{self.class.to_s}:#{__method__}:#{__LINE__}: invalid WAPI wrapper: #{+self.to_s}\"\n end\n nil\n end",
"def payment_api_return?\n\t\ttrue\n\tend",
"def returns?\n branch_type == 'return'\n end",
"def result_of_checking; end",
"def return_value=(value)\n @return_value = value\n end",
"def evaluated?\n if @promise.respond_to? :call or @promise.is_a? Symbol\n not @value.nil?\n else\n true\n end\n end",
"def ok?\n !@error\n end",
"def valid?\n !!outcode\n end",
"def void_command?\n (command? && !keep_retval?) || retval == CommandContext::VOID_VALUE\n end",
"def success?\n return true\n end",
"def test_early_exit_needed_in_contexts_with_method_return_value_set\n method_context = @manager.enter_method_scope(@test_self)\n method_context.return_type = Constants[\"Boolean\"]\n flow_context = @manager.enter_flow_control_block_scope()\n flow_context.set_return(Constants[\"true\"])\n assert_true flow_context.need_early_exit\n @manager.leave_scope(flow_context)\n assert_true method_context.need_early_exit\n @manager.leave_scope(method_context)\n end",
"def success?\n execution_attempted? && errors.empty?\n end",
"def ok?\n @ok\n end",
"def success?()\n result != false\n end",
"def successful?\n a = any_args? ? [:any] : @args\n begin\n @recorder.was_called?(@method_name, @block_args, @mode, *a)\n rescue ArgumentError\n false\n end\n end",
"def true(_argvs)\n return nil\n end",
"def tainted?() end",
"def hasValue\n @valueCreator.hasValue\n end",
"def single_value?\n return false\n end",
"def value_if_true\n return @value_if_true\n end",
"def has_value?\n false\n end",
"def evaluate?\n false\n end",
"def evaluate?\n false\n end",
"def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false\n end",
"def capture_return\n @returns = @code.split(/\\(/).first !~ /void/ \n end",
"def has_errors?\n options[:success] == false || super\n end",
"def error?\n !success?\n end",
"def success?\n end",
"def valid?(result)\n log(result)\n\n true\n end",
"def can_throw?\n\t\treturn @can_throw\n\tend",
"def success?\n !error\n end",
"def searchNCheckReturn(fooName,fooType)\n if !fooType.nil?\n attrs.each do |a|\n if a.class.to_s == \"Return\"\n raise ReturnTypeError::new(fooName, a.expression.type(), fooType, a.expression.line()) unless a.expression.type() == fooType\n return true\n end\n return a.searchNCheckReturn(fooName, fooType) if a.respond_to? :searchNCheckReturn\n end\n else\n attrs.each do |a|\n return true if a.class.to_s == \"Return\"\n return a.searchNCheckReturn(fooName, fooType) if a.respond_to? :searchNCheckReturn\n end\n end\n return false\n end",
"def a\n puts \"a was evaluated!\"\n return false\nend",
"def success?\n false\n end",
"def success?\n false\n end",
"def custom_failure?\n if instance_variable_defined?(:@custom_failure)\n !!@custom_failure\n else\n false\n end\n end",
"def failed?\n not @ok\n end",
"def failure?\n false\n end",
"def raise_errors?\n @raise_errors != false\n end",
"def success?\n not failure_occurred\n end",
"def success?\n not failure_occurred\n end",
"def test_nothing\n return true\n end",
"def run(_value)\n false\n end",
"def a\n return true\nend",
"def success?\n @exception.nil?\n end",
"def void_true(*args)\n return true\n end",
"def void_false(*args)\n return false\n end",
"def check_retval(rc, e_klass = nil)\n return true unless ::OpenNebula.is_error?(rc)\n fail (e_klass ? e_klass : RuntimeError ), rc.message\n end"
] | [
"0.71043986",
"0.66771823",
"0.65141886",
"0.6433797",
"0.6295656",
"0.5985675",
"0.5794631",
"0.5765681",
"0.5738969",
"0.5715086",
"0.5699672",
"0.5696634",
"0.56964314",
"0.56748056",
"0.56563294",
"0.5634929",
"0.5634213",
"0.5633445",
"0.5629417",
"0.56275827",
"0.56249374",
"0.5619268",
"0.56154174",
"0.5610815",
"0.5591605",
"0.5591149",
"0.55895066",
"0.55755204",
"0.5573233",
"0.5562388",
"0.5562388",
"0.5548533",
"0.552553",
"0.5522804",
"0.55078334",
"0.55078334",
"0.54998744",
"0.5493292",
"0.54872966",
"0.547645",
"0.54687",
"0.5467421",
"0.5461867",
"0.5461575",
"0.5450603",
"0.54479915",
"0.54302984",
"0.54186124",
"0.5412976",
"0.54119873",
"0.5403822",
"0.5403112",
"0.5397177",
"0.5387029",
"0.53823274",
"0.5380485",
"0.5368202",
"0.53540355",
"0.5348752",
"0.5341537",
"0.5341013",
"0.53157705",
"0.5315031",
"0.530745",
"0.5303686",
"0.5298995",
"0.5297162",
"0.52966434",
"0.5296219",
"0.5294062",
"0.5291675",
"0.5289972",
"0.5283877",
"0.5260121",
"0.5260121",
"0.52536345",
"0.52529925",
"0.5252935",
"0.5246049",
"0.5244969",
"0.524137",
"0.5232697",
"0.52312124",
"0.52254856",
"0.5223399",
"0.52230114",
"0.52230114",
"0.5209325",
"0.5204796",
"0.51973134",
"0.51912653",
"0.5190768",
"0.5190768",
"0.5188071",
"0.5187875",
"0.5187414",
"0.51816964",
"0.5180686",
"0.5174721",
"0.5173742"
] | 0.69108576 | 1 |
Utilities executes +block+ once. Inside +block+ one may use +break+, +next+ and +redo+. | def once(&block)
while true
yield
break
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_blocker\n blocker do\n # next\n # break\n # return\n \"HA!\"\n # next\n # break\n # return\n end\n puts \"DONE!\"\nend",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def record_block\n @block = true\n end",
"def call_twice\n puts \"I'm about to call your block.\"\n yield\n puts \"I'm about to call your block again.\"\n yield\nend",
"def block?; end",
"def runner(&block)\n if Vedeu.config.once?\n run_once { yield }\n\n else\n run_many { yield }\n\n end\n end",
"def test_block\n\tputs \"You are in the method\"\n\tyield\n\tputs \"You are again back to the method\"\n\tyield\nend",
"def twice(&my_block)\n puts \"In the method, about to call the block!\"\n my_block.call #call the block\n puts \"Back in the method, about to call the block again!\"\n my_block.call #call the block again\n puts \"Back in the method, about to return!\"\nend",
"def block\n true\n end",
"def call_this_block_twice\n yield\n yield\nend",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_block = block.parent.blocks[my_index + 1]\n return unless next_block && next_block.context == :pass\n\n next_block\n end",
"def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end",
"def test(&block)\n puts \"inside test -- calling block\"\n block.call\n puts \"inside test -- after calling block\"\n yield\nend",
"def doittwice(&block)\n block.call\n block.call\nend",
"def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend",
"def call_block\n puts 'Start'\n yield\n yield\n puts 'End'\nend",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def one\n too { yield }\nendbegin;1;rescue => e1;e1;end",
"def call_block\n @_block.call(self) if @_block\n end",
"def block_method\nputs \"called outside block in block_method\"\n#add method, to check if there is a block on this method\nyield if block_given? #predicate method, it have question mark on end\nputs \"now we are returning again to block\"\nend",
"def run_block\n yield\nend",
"def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end",
"def i_continue\n yield\n puts \"after yield\"\nend",
"def block_sample\n p \"AAA\"\n yield\n p \"BBB\"\nend",
"def block_try1(num, &block)\n block.call\n puts \"do second. num is [#{num}]\"\nend",
"def blocks() end",
"def run_block_proc\n yield\nend",
"def i_take_a_block\n yield\nend",
"def multiple_pass\n puts \"Inside the method\"\n yield if block_given? # Invoke block only it is given \n puts \"Back inside the method\"\n yield if block_given?\n yield if block_given?\n yield if block_given?\n yield if block_given?\nend",
"def simple\n puts 'Here comes the code block!'\n yield\n puts 'There was the code block!'\nend",
"def block!(block)\n\t\t@grid[block.position.y][block.position.x] = 0\n\t\[email protected]_if { |b| block == b }\n\tend",
"def do_something\n puts \"before the block\"\n yield\n puts \"after the block\"\nend",
"def callBlock\n yield\n yield\nend",
"def execute(&block)\n block.call\n puts \"End of block\"\nend",
"def while(&block)\n\t\t\t\t\trepeat &block\n\t\t\t\tend",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def many(&block)\n return false unless try(&block)\n while try(&block); end\n true\n end",
"def block_method\n puts \"This is printing from the method.\"\n yield(\"Alice\", \"Bill\")\n yield(\"Dan\", \"Carlos\")\n yield\n puts \"This is printing from the method again.\"\nend",
"def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend",
"def execute_block(&block)\n @currently_executing_block = true\n output \"tell session id #{name}_tty\"\n self.instance_eval(&block)\n output \"end tell\"\n @currently_executing_block = false\n end",
"def block?\n !!block\n end",
"def blockTest\n\tputs \"Method!\"\n\tputs \"Yield!\"\n\tyield\n\tputs \"Method!\"\nend",
"def block_node=(_); end",
"def gimme\n if block_given?\n yield\n else\n puts \"I'm blockless!\"\n end\nend",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end",
"def block_node; end",
"def block_node; end",
"def run_once\n if @first_pointer\n @busy = true\n procedure = forward\n procedure = forward while @first_pointer and procedure.canceled?\n procedure.run unless procedure.canceled?\n end\n ensure\n @busy = false\n end",
"def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend",
"def test2(block)\n puts \"hello\"\n block.call # calls the block that was originally passed to test()\n puts \"good-bye\"\nend",
"def run(&block)\n end",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def keep_if(&block); end",
"def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend",
"def interact(&block)\n\t\tinit_tab_complete\n\n\t\t# Run queued commands\n\t\tcommands.delete_if { |ent|\n\t\t\trun_single(ent)\n\t\t\ttrue\n\t\t}\n\n\t\t# Run the interactive loop\n\t\trun { |line|\n\t\t\t# Run the command\n\t\t\trun_single(line)\n\n\t\t\t# If a block was supplied, call it, otherwise return false\n\t\t\tif (block)\n\t\t\t\tblock.call\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\t}\n\tend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def return!(&block); end",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def run(&block); end",
"def block_print\r\n\tputs \"Before the block!\"\r\n\tyield(10)\r\n\tputs \"After the block!\"\r\nend",
"def duas2\n # calls the default_block\n yield 1\n yield 2\nend",
"def once_per_run(key, &block)\n Pedant::OncePerRun.once_per_run(key, &block)\n end",
"def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend",
"def block_test\r\n puts \"We're in the method!\"\r\n puts \"Yielding to the block...\"\r\n yield\r\n puts \"We're back in the method!\"\r\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def while(&blk)\n loop{ !blk[] }\n end",
"def foo\n # Call the block\n yield\n yield\nend"
] | [
"0.69492686",
"0.6783201",
"0.6722293",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6556273",
"0.6530744",
"0.65145653",
"0.64992267",
"0.63900495",
"0.63736874",
"0.6338545",
"0.62737226",
"0.62436706",
"0.62244505",
"0.61804944",
"0.6166237",
"0.6158291",
"0.6156088",
"0.6143971",
"0.6119149",
"0.61113906",
"0.61041796",
"0.60964",
"0.60724086",
"0.6058098",
"0.60452056",
"0.60446113",
"0.60376614",
"0.6027676",
"0.6010554",
"0.6001111",
"0.59995496",
"0.598745",
"0.5984909",
"0.5968079",
"0.59637713",
"0.59522045",
"0.5950914",
"0.5935092",
"0.58885485",
"0.5881498",
"0.58773005",
"0.5861625",
"0.5848128",
"0.5840045",
"0.5836264",
"0.5819536",
"0.5819057",
"0.58170575",
"0.58154863",
"0.5811224",
"0.5811224",
"0.5785846",
"0.5780492",
"0.57710934",
"0.5766712",
"0.5766454",
"0.5766454",
"0.5766454",
"0.57606894",
"0.57550573",
"0.5750843",
"0.57456243",
"0.57456243",
"0.5733437",
"0.5728607",
"0.5728607",
"0.5727861",
"0.57249784",
"0.572431",
"0.57186925",
"0.5714426",
"0.57138294",
"0.5702975",
"0.5702975",
"0.5702975",
"0.5702975",
"0.5702975",
"0.5702975",
"0.5702975",
"0.57006806",
"0.56978005"
] | 0.6661393 | 3 |
method takes the location of the card as index and returns the rank of that card | def rank_of_cards_at(index)
return cards[index].rank
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank_of_card_at(index)\n cards[index].rank\n end",
"def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end",
"def rank_of_card_at(index_number)\n #this if statment assumes that if a deck runs out of cars,\n #then the rank of a non-existant card will be 0.\n #there are other options we could try, such as...\n #\"look at the last card in the deck and use it's rank\"\n #but this is the one we are going with untill instructed other wise.\n if self.cards[index_number] == nil\n return 0\n else\n return self.cards[index_number].rank\n end\n end",
"def rank_of_card_at (num)\n cards.fetch(num, \"Index #{num} is out of bounds.\")\n end",
"def rank_of_suit\n SUITS.each_with_index do |suit, i|\n if suit == @suit\n return i\n end\n end\n raise 'suit not found'\n end",
"def find_card(rank, suit, deck)\n (0..51).each do |i|\n c = deck[i]\n if (c & suit) && (rank(c) == rank)\n i\n else\n -1\n end\n end\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def rank; end",
"def rank; end",
"def rank_test(index)\n @player1.deck.rank_of_card_at(index) == @player2.deck.rank_of_card_at(index)\n end",
"def rank\n return @rank\n end",
"def determine_winner\n cards = deal\n hands = cards.sort_by do |hand, i|\n hand[:card][2] #limits the hand with two arrays\n end\n winner = hands.last[:player]\n winnerCard = hands.last[:card]\n winnerCard = winnerCard.join(\" of \") #ROADBLOCK: I can't seem to figure this part out. I want to just return the rank and the suit, and return the index for score. Example, 7 of hearts instead of 7 of hearts of 6. I don't want the 6 there.\n\n # score = hands.last[:card].split(\"\")\n\n puts \"#{winner} drew the card, #{winnerCard}\"\n\n # puts \"#{winner}'s score is #{score}'\"\n #ROADBLOCK: I want the index to print out for the score here\n\n puts \"#{winner} wins!\"\nend",
"def rank_index\n RANKS.keys.index(@rank)\n end",
"def position_result\n hurdle_match.rank.index(self) + 1\n end",
"def rank\n @data['rank']\n end",
"def getValue(card_number)\n # get card rank\n rank = case card_number % 13\n when 0, 11, 12 then 10\n when 1 then 11\n else card_number % 13 \n end\n \n return rank\n \nend",
"def rank\n FREECELL_VALUES[value]\n end",
"def get_rank\n hash = Hash[UserGame.for_game(self.game.id).by_portfolio_value.map.with_index.to_a]\n if hash[self] == 0\n return 1\n else\n x = hash[self]\n while x > 0 && hash.key(x).get_portfolio == hash.key(x-1).get_portfolio\n x -= 1\n end\n return x + 1\n end\n end",
"def card_ranks(cards)\n ranks = cards.map { |card| '--23456789TJQKA'.index(card[0]) }\n ranks.sort! { |a, b| b <=> a }\n if ranks == [14, 5, 4, 3, 2]\n [5, 4, 3, 2, 1]\n else\n ranks\n end\nend",
"def rank\n @rank > 10 ? 10 : @rank\n end",
"def value\n card_value = @rank\n if @rank == :A\n card_value = 11\n elsif @rank == :K || @rank == :Q || @rank == :J\n card_value = 10\n end\n card_value\n end",
"def to_i\n @rank\n end",
"def getValue(rank)\n\tif /\\d/.match(rank)\n\t\treturn rank.to_i\n\telsif rank == 'Ace'\n\t\treturn 11\n\telse\n\t\treturn 10\n\tend\nend",
"def what_rank\n 10 - all_ranks.find_index{ |truth| truth != 2014} \n end",
"def rank\n return inv + neg + nsp\n end",
"def ranking\n Player.order('rating DESC').select(:id).map(&:id).index(self.id) + 1\n end",
"def get_rank\n list = self.tournament.rounds.to_a;\n #this list will be chronological already\n\n i = 0;\n while list[i].id != self.id\n i = i + 1;\n end\n return (i + 1);\n end",
"def rank\n\t\tRANKINGS.each do |ranking|\n\t\t\treturn ranking if self.send(\"#{ranking}?\".to_sym)\n\t\tend\n\tend",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def rank\n unless player.nil?\n series.rank_of player\n else\n 0\n end\n end",
"def rank\n\t\trr = self.clone\n\t\trr.row_reduce_below\n\t\trr.rank_rr\n\tend",
"def rank_starting_hand\r\n sorted_hand = @hole_cards.sort_by { |card| card.rank } # [4,2] => [2,4]\r\n\r\n # Shorthand variables for two cards in hand\r\n (first,second) = [sorted_hand[0],sorted_hand[1]]\r\n\r\n suited = first.suit == second.suit # True if cards have same suit\r\n paired = first.rank == second.rank # True if cards have same rank\r\n connected = first.rank + 1 == second.rank # True if cards have consecutive ranks\r\n\r\n # Check for playable hands and return their rank\r\n # (Some of these checks aren't necessary but are included for readibility)\r\n case first.rank\r\n when 8 then return 14 if paired # Pocket Eights\r\n when 9 then return 9 if paired # Pocket Nines\r\n when 10\r\n return 6 if paired # Pocket Tens\r\n return 20 if second.rank == 12 and suited # Queen-Ten Suited\r\n return 16 if second.rank == 13 and suited # King-Ten Suited\r\n return 12 if second.rank == 14 and suited # Ace-Ten Suited\r\n when 11\r\n return 4 if paired # Pocket Jacks\r\n return 17 if second.rank == 12 and suited # Queen-Jack Suited\r\n return 15 if second.rank == 13 and suited # King-Jack Suited\r\n if second.rank == 14\r\n return suited ? 10 : 18 # Ace-Jack Suited/Offsuit\r\n end\r\n when 12\r\n return 3 if paired # Pocket Queens\r\n if second.rank == 13\r\n return suited ? 11 : 19 # King-Queen Suited/Offsuit\r\n elsif second.rank == 14\r\n return suited ? 8 : 13 # Ace-Queen Suited/Offsuit\r\n end\r\n when 13\r\n return 2 if paired # Pocket Kings\r\n if second.rank == 14\r\n return suited ? 5 : 7 # Ace-King Suited/Offsuit\r\n end\r\n when 14 then return 1 if paired # Pocket Aces\r\n end\r\n # Still played if the hand is suited, paired, or connected, otherwise not played\r\n return (suited or paired or connected) ? 21 : -1\r\n end",
"def rank\n case @owner\n # Prefer volumes from Princeton most strongly\n when 'njp'\n @rank = 4\n # Recap partners are next in order of preference\n when 'nyp', 'nnc1', 'nnc2.ark'\n @rank = 3\n # Followed by Borrow Direct partners\n when 'yale', 'hvd', 'coo', 'chi'\n @rank = 2\n # These are mentioned by Meagan\n when 'mdp', 'miun', 'uc1', 'uc2', 'loc.ark', 'uva', 'umn', 'dul1.ark', 'ien', 'inu', 'nc01.ark', 'pst', 'pur1', 'ucm', 'uiug', 'wu'\n @rank = 1\n # Anything else is unknown; rank lowest.\n else\n @rank = 0\n end\n @rank # return the rank\n end",
"def card(index)\n \tif index < 0 || index >= @cards.size\n \t raise Exception \"Position does not exist in hand: #{index}\"\n \tend\n \t@cards[index]\n end",
"def army_rank; end",
"def ranking\n Player.order('rating DESC').select(:id).map(&:id).index(id) + 1\n end",
"def same_rank(same)\n @rank_count.select {|rank, cards| cards.length == same }.first[0]\n end",
"def hand_rank(hand)\n ranks = card_ranks(hand) # card_ranks return the ranks in sorted order\n\n if straight(ranks) && flush(hand)\n return [8, ranks.max] # 2 3 4 5 6 => [8, 6], 6 7 8 9 T => [8, T]\n elsif kind(4, ranks)\n return [7, kind(4, ranks), kind(1, ranks)] # 9 9 9 9 3 => [7, 9, 3]\n elsif kind(3, ranks) && kind(2, ranks) # 8 8 8 K K => [6, 8, 13]\n return [6, kind(3, ranks), kind(2, ranks)]\n elsif flush(hand)\n return [5, ranks]\n elsif straight(ranks)\n return [4, ranks.max]\n elsif kind(3, ranks)\n return [3, kind(3, ranks), ranks]\n elsif two_pair(ranks)\n return [2, kind(2, ranks), ranks]\n elsif kind(2, ranks)\n return [1, kind(2, ranks), ranks]\n else\n return [0, ranks]\n end\nend",
"def new_rank\n row + @board.active_piece.rank_direction\n end",
"def new_rank\n row + @board.active_piece.rank_direction\n end",
"def rank(short = false)\n if (2..10) === @rank\n @rank.to_s\n else\n h = { 11 => 'Jack', 12 => 'Queen', 13 => 'King', 14 => 'Ace' }\n h[@rank] && short ? h[@rank][0] : h[@rank]\n end\n end",
"def navy_rank; end",
"def rank\n y + 1\n end",
"def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end",
"def index_of_11\n cards.index { |card| card[:points] == 11 }\n end",
"def rank(prog); @ranks[prog]; end",
"def rank_for_print\n rank_print = @rank\n case @rank\n when :A then rank_print = \"Ace\"\n when :K then rank_print = \"King\"\n when :Q then rank_print = \"Queen\"\n when :J then rank_print = \"Jack\"\n end\n rank_print\n end",
"def rank_rr\n\t\trank = 0\n\t\tfor i in 0..(@num_rows-1)\n\t\t\tif @rows[i].bits == 0\n\t\t\t\treturn rank\n\t\t\telse\n\t\t\t\trank += 1\n\t\t\tend\n\t\tend\n\t\trank\n\tend",
"def rank(input, name: nil)\n _op(:rank, input, name: name)\n end",
"def initialize(card)\n @card = card #TODO: change this to @rank\n end",
"def shelfrank\n return Traject::MarcExtractor.cached(\"991z\").extract(source_record).collect {|i| i.to_i}.inject(:+)\n end",
"def find_card(name, suit)\r\n return @order.index(Card.to_s(name, suit))\r\n end",
"def [](rank)\n if @ranking[rank] == UNRANKED_ID\n unranked_candidates\n else\n @ranking[rank]\n end\n end",
"def rank\n inv_num = 0\n 1.upto(size-1) do |i|\n (i+1).upto(size) do |j|\n inv_num += 1 if self[i] > self[j]\n end\n end\n return inv_num\n end",
"def sort_using_rank\n score[1]\n end",
"def <=> card\n if rank_of_kind > card.rank_of_kind\n return 1\n end\n if rank_of_kind < card.rank_of_kind\n return -1\n end\n if rank_of_suit > card.rank_of_suit\n return 1\n end\n if rank_of_suit < card.rank_of_suit\n return -1\n end\n if rank_of_suit == card.rank_of_suit\n notify_observers_fraud card.to_string\n #return 0 # should not happen in a single-pack card game!\n end\n end",
"def rank\n\t\treturn self.class.rank\n\tend",
"def rank\n @team_records.sort_by! do |team|\n team.wins\n end #still correct\n @team_records.reverse! #up until here we're okay\n\n @team_records.each_with_index do |team, index| #line that doesn't function as expected\n team.rank = index + 1 #returns only two teams repeated twice, with wrong indexes\n end\n end",
"def rerank\n s = score * DAY_POINTS\n self.rank = Time.now.to_i + s\n end",
"def rank\n fetch('games.league_of_legends.rank')\n end",
"def cards_by_rank(ranks)\n @cards.select { |card| ranks.include?(card.rank) }\n end",
"def rank_name\n self.class.get_rank_name rank if respond_to? :rank\n end",
"def point_value\n return 500 if flush?\n return 300 if three_kind?\n return 200 if two_kind?\n return highest_card.numeric_rank\n end",
"def cards_by_rank\n @cards_by_rank ||= @cards.group_by(&:rank).sort do |b,a|\n cmp_key_a, cmp_key_b = [a, b].map {|entry| entry[1]}\n\n cmp = cmp_key_a.count <=> cmp_key_b.count\n cmp.zero? ? cmp_key_a.first <=> cmp_key_b.first : cmp\n end.to_h\n end",
"def rank(idx_rank)\n return self if idx_rank == left_size\n return left.rank(idx_rank) if idx_rank < left_size \n return right.rank(idx_rank - left_size - 1) \n end",
"def rank_of_colour\r\n COLOURS.each_with_index do |colour, i|\r\n if colour == @colour\r\n return i\r\n end\r\n end\r\n raise \"colour not found: #{@colour}\"\r\n end",
"def index_rank\n case rank\n when 'species', 'subspecies', 'variety'\n 'species_group'\n when 'genus', 'subgenus'\n 'genus_group'\n when nil, \"\"\n 'unknown'\n else\n rank.downcase\n end\n end",
"def rank\n\t\t\t(const_defined?('Rank')) ? const_get('Rank') : NormalRanking\n\t\tend",
"def get_rank(key)\n connection.zrevrank(key_label, key)\n end",
"def array_suit_rank\n h = []; d = []; c = []; s = []\n (0..6).each { |i|\n h << (@cards[i][1]) if @cards[i][0] == 1\n d<<(@cards[i][1]) if @cards[i][0] == 2\n c<<(@cards[i][1]) if @cards[i][0] == 3\n s<<(@cards[i][1]) if @cards[i][0] == 4 }\n # sort rank in any suit\n { :suit_H => h, :suit_D => d, :suit_C => c, :suit_S => s }.each { |suit, rank|\n rank.sort! { |first, second| second <=> first } }\n end",
"def marines_rank; end",
"def ranked_item_position(ranked_object)\n self.values.find_by_ranked_object_id(ranked_object).try(:position)\n end",
"def index\n CARDs_RANKS[@face]\n end",
"def f2p_clues_rank(clue_type)\n f2p_rank [[\"clues_#{clue_type}\", :DESC],\n [\"id\", :ASC]]\n end",
"def rank_to_i(rank)\n case rank.to_s\n when /^(a|ace)/i; 14\n when /^(k|king)/i; 13\n when /^(q|queen)/i; 12\n when /^(j|jack)/i; 11\n when '10'; 10\n when '2'..'9'; rank\n else 0\n end\n end",
"def index_of_card(id)\n cards.find_index(find_card(id))\n end",
"def row(row_number, get_by = :copy)\n rank(0, row_number, get_by)\n end",
"def lead_value\n club? ? rank : rank + 13\n end",
"def rank_of_kind\n KINDS.each_with_index do |kind, i|\n if kind == @kind\n return i\n end\n end\n raise \"kind not found: #{@kind}\"\n end",
"def ranked_board\n # pre-process to remove sunken ships\n string = remove_sunken_ships board_to_string\n self.board = string_to_board(string)\n set_base_rank\n increment_adjacent_to_hits\n increment_ends_of_pairs\n cell_rankings\n end",
"def next_rank()\n return NEXT_RANK[self]\n end",
"def rank(p,n)\n r(p,n,1,0)\n end",
"def rank_of_candidate(candidate_id)\n @ranking.each_index do |rank|\n return rank if Array(@ranking[rank]).include?(candidate_id) \n end\n return default_rank\n end",
"def check_playedcard(name, card_lbl)\r\n pos = 0\r\n #p @cards_played\r\n @cards_played.each do |cd_played_info|\r\n if cd_played_info[:name] == name and card_lbl.to_s == cd_played_info[:card_s]\r\n return pos\r\n end\r\n pos += 1\r\n end\r\n return nil\r\n end",
"def calculate_level_raking(rank)\n value = 0\n if rank.include?(\"-\")\n value = rank.split(\"-\")[0].to_f + 0.5\n # if value = rank.split(\"-\")[0].to_i == 0\n # value = 0.5\n # elsif rank.split(\"-\")[0].to_i == 1\n # value = 1.5\n # else\n # value = rank.split(\"-\")[1].to_i / rank.split(\"-\")[0].to_i\n # end \n elsif rank.include?(\"++\")\n value = (rank.gsub(\"++\",\"\").to_i - 1) + 0.8\n else\n value = rank.to_i\n end\n \n return value\n end",
"def rank _args\n \"rank _args;\" \n end",
"def rank(key)\n node_rank(@root, key)\n end",
"def <=> card\r\n if rank_of_colour > card.rank_of_colour\r\n return 1\r\n end\r\n if rank_of_colour < card.rank_of_colour\r\n return -1\r\n end\r\n\r\n if rank_of_colour == card.rank_of_colour\r\n notify_observers_fraud card.to_string\r\n #return 0 # should not happen in a Noddy card game!\r\n end\r\n end",
"def find_same_rank(givencard)\n result = []\n for card in @cards do\n result << card if card.same_rank?(givencard)\n end\n return result\n end",
"def find_relative_ranks(nums)\n output = Array.new(nums.length, nil)\n sorted_nums = nums.sort\n rank = nums.length\n \n sorted_nums.each do |n|\n idx = nums.find_index(n)\n \n ranking = case rank\n when 1\n \"Gold Medal\"\n when 2\n \"Silver Medal\"\n when 3\n \"Bronze Medal\"\n else\n rank.to_s\n end\n \n output[idx] = ranking\n rank -= 1\n end\n output\nend",
"def check_playedcard(name, card_lbl)\n pos = 0\n #p @cards_played\n @cards_played.each do |cd_played_info|\n if cd_played_info[:name] == name and card_lbl.to_s == cd_played_info[:card_s]\n return pos\n end\n pos += 1\n end\n return nil\n end",
"def opponent_pawn_starting_rank\n color = capturing_pawn.opposite_color\n Pawn.starting_ranks[color]\n end",
"def suit_index\n return nil unless self.suit\n SUITS.index(self.suit.downcase)\n end",
"def display_rank(i)\n rank = Hash[(2..10).to_a.map do |x|\n [x, x]\n end\n ].merge({ 11 => :jack,\n 12 => :queen,\n 13 => :king,\n 14 => :ace})\n\n rank[i]\nend",
"def rankval ( rank )\n if rank.is_a? Numeric\n return rank\n elsif rank ==\"J\"\n return (11)\n elsif rank ==\"Q\"\n return (12)\n elsif rank ==\"K\"\n return (13)\n elsif rank ==\"A\"\n return (14)\n end\t #if\nend",
"def rank=(value)\n @rank = value\n end",
"def rank(rank_name)\n ranks_dataset.first(Name: rank_name.capitalize)\n end",
"def message_rank\n RANKING.fetch(message) { 0 }\n end",
"def tokenizer_ranking_row_rank_position\n TokenExtractor.new(\n :rank_position,\n 0,\n #/(.)(?=[a-z°)])/i\n /\\s*(\\w|\\?){3}-(\\d|\\?){6}/i\n )\n end",
"def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end"
] | [
"0.884389",
"0.8548879",
"0.8367248",
"0.78868616",
"0.78296036",
"0.75964",
"0.7415967",
"0.7248068",
"0.7248068",
"0.72296023",
"0.7200215",
"0.7164571",
"0.70517623",
"0.6994914",
"0.69148576",
"0.6909316",
"0.68993384",
"0.68619055",
"0.68509597",
"0.6834928",
"0.6818249",
"0.6797792",
"0.6792269",
"0.6785385",
"0.6769372",
"0.6745686",
"0.6713415",
"0.67099017",
"0.6709337",
"0.66787153",
"0.66647744",
"0.6656839",
"0.6656773",
"0.66504323",
"0.66401255",
"0.663167",
"0.66188645",
"0.6607153",
"0.65960455",
"0.65960455",
"0.65923864",
"0.6570202",
"0.6547611",
"0.65472144",
"0.65417784",
"0.6522227",
"0.6521202",
"0.6510397",
"0.64795405",
"0.6470416",
"0.64399576",
"0.6435708",
"0.64348453",
"0.64281017",
"0.6427518",
"0.64213",
"0.63865924",
"0.63841695",
"0.6380768",
"0.6350816",
"0.6328666",
"0.63275385",
"0.631639",
"0.63043505",
"0.6303495",
"0.6292916",
"0.6283419",
"0.6269285",
"0.62631285",
"0.6262717",
"0.62526596",
"0.6248198",
"0.62444246",
"0.62272185",
"0.6226433",
"0.6215474",
"0.6214961",
"0.6184311",
"0.61673576",
"0.6160298",
"0.6144643",
"0.61259353",
"0.6124558",
"0.6104633",
"0.6102741",
"0.60999143",
"0.6072657",
"0.60666335",
"0.6056409",
"0.6056286",
"0.6055264",
"0.6054404",
"0.605371",
"0.60469675",
"0.60446143",
"0.60316014",
"0.6022537",
"0.5997793",
"0.59853226",
"0.59801114"
] | 0.8682236 | 1 |
method that returns an array of cards in the deck that have a rank of 11 or above | def high_ranking_cards
array_high_cards = []
cards.each do |card|
if card.rank >= 11
array_high_cards << card
end
end
array_high_cards
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end",
"def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end",
"def high_ranking_cards\n high_cards = []\n @cards.each do|card|\n if card.rank >= 11\n high_cards << card\n end\n end\n high_cards\n end",
"def cards_by_rank(ranks)\n @cards.select { |card| ranks.include?(card.rank) }\n end",
"def high_ranking_cards\n cards.map do |card|\n if card.rank >= 11\n high_cards << card\n end\n end\n high_cards\n end",
"def get_cards_above_10\n return ['V', 'Q', 'K', 'A']\nend",
"def card_ranks(cards)\n ranks = cards.map { |card| '--23456789TJQKA'.index(card[0]) }\n ranks.sort! { |a, b| b <=> a }\n if ranks == [14, 5, 4, 3, 2]\n [5, 4, 3, 2, 1]\n else\n ranks\n end\nend",
"def find_card(rank, suit, deck)\n (0..51).each do |i|\n c = deck[i]\n if (c & suit) && (rank(c) == rank)\n i\n else\n -1\n end\n end\n end",
"def high_ranking_cards(cut_off = 10)\n high_cards = []\n for card in self.cards\n if card.rank > cut_off\n high_cards.append(card)\n end\n end\n\n return high_cards\n end",
"def possible_scores(cards)\n scores = [0]\n\n cards.each do |card|\n if card.face != 'Ace'\n scores.map! {|score| score + card.value} \n else\n new_scores = Array.new\n scores.each do |score|\n new_scores << score + 1\n new_scores << score + 11\n end\n scores = new_scores\n end\n end\n\n return scores.uniq.select {|score| score < 22}\nend",
"def find_same_rank(givencard)\n result = []\n for card in @cards do\n result << card if card.same_rank?(givencard)\n end\n return result\n end",
"def have_new_cards\n cards = []\n suits = [\"♣\", \"♦\", \"♥\", \"♠\"]\n ranks = [\"A\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"J\",\"Q\",\"K\"]\n suits.each do |suit|\n ranks.each do |rank|\n cards << [suit, rank]\n end\n end\n return cards\nend",
"def cards_by_rank\n @cards_by_rank ||= @cards.group_by(&:rank).sort do |b,a|\n cmp_key_a, cmp_key_b = [a, b].map {|entry| entry[1]}\n\n cmp = cmp_key_a.count <=> cmp_key_b.count\n cmp.zero? ? cmp_key_a.first <=> cmp_key_b.first : cmp\n end.to_h\n end",
"def what_rank\n 10 - all_ranks.find_index{ |truth| truth != 2014} \n end",
"def find_same_rank_not_wild(givencard)\n result = []\n for card in @cards do\n if card.same_rank?(givencard) && (!card.wild?)\n result << card\n end \n end\n return result\n end",
"def index_of_11\n cards.index { |card| card[:points] == 11 }\n end",
"def array_suit_rank\n h = []; d = []; c = []; s = []\n (0..6).each { |i|\n h << (@cards[i][1]) if @cards[i][0] == 1\n d<<(@cards[i][1]) if @cards[i][0] == 2\n c<<(@cards[i][1]) if @cards[i][0] == 3\n s<<(@cards[i][1]) if @cards[i][0] == 4 }\n # sort rank in any suit\n { :suit_H => h, :suit_D => d, :suit_C => c, :suit_S => s }.each { |suit, rank|\n rank.sort! { |first, second| second <=> first } }\n end",
"def get_high_cards(cards)\n @cards_by_score.each_key do |card|\n if cards.length < 5 && !cards.include?(card)\n cards << card\n end\n end\n end",
"def matched_cards\n result = {}\n for card in @cards do\n if card.wild? ## wild cards belong to all ranks \n for rank in Rank::RANKS do\n result[rank] ||= []\n result[rank] << card\n end \n else \n result[card.rank] ||= []\n result[card.rank] << card\n end \n end\n return result\n end",
"def try_getting_cards_from_player(selected_rank)\n selected_player = select_other_player\n selected_player_id = game.get_player_index(selected_player)\n if game.players[selected_player_id].has_card_with_rank?(selected_rank)\n add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank), selected_player.name)\n return true\n end\n return false\n end",
"def highest_card?\n single_cards = Array.new(5, -1)\n single_count = 0\n (12).downto(0) do |i|\n if @ranks[i] == 1 and single_count < 5\n single_cards[single_count] = i\n single_count += 1\n end\n end\n return [1] + single_cards\n end",
"def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the highest combination to win\n $hash_7_card = array_suit_rank\n end",
"def affordable_cards\n answer = Array.new()\n (@game.all_displayed_cards + @player.tableau.reserved_cards).each do |card|\n @cost = @player.tableau.tokens_required(card)\n answer << card if !@cost==false\n end\n answer\n end",
"def get_by_count(probe)\n pair_info = Hash[@rank_count.select {|rank, cards| cards.length==probe }]\n pair_cards = cards_by_rank(pair_info.keys)\n end",
"def choose_cards(turn, player)\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n list_of_cards = case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(1)\n end\n else\n list_of_cards = turn.turn_get_cards_from_stack(1)\n end\n list_of_cards.concat(turn.turn_get_cards_from_stack(1))\n end",
"def suits\n cards.map(&:suit)\n end",
"def trump_cards\n @cards.select {|c| c.suit == @trump_suit}\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def determine_playable_cards\n playable_cards = []\n hand.each do |card_in_hand|\n if card_in_hand[\"cost\"] <= @mana_available\n playable_cards.push(card_in_hand)\n end \n end\n if mana_available >= 2\n playable_cards.push(\"hero ablity\")\n end\n playable_cards\n end",
"def hand_rank(hand)\n ranks = card_ranks(hand) # card_ranks return the ranks in sorted order\n\n if straight(ranks) && flush(hand)\n return [8, ranks.max] # 2 3 4 5 6 => [8, 6], 6 7 8 9 T => [8, T]\n elsif kind(4, ranks)\n return [7, kind(4, ranks), kind(1, ranks)] # 9 9 9 9 3 => [7, 9, 3]\n elsif kind(3, ranks) && kind(2, ranks) # 8 8 8 K K => [6, 8, 13]\n return [6, kind(3, ranks), kind(2, ranks)]\n elsif flush(hand)\n return [5, ranks]\n elsif straight(ranks)\n return [4, ranks.max]\n elsif kind(3, ranks)\n return [3, kind(3, ranks), ranks]\n elsif two_pair(ranks)\n return [2, kind(2, ranks), ranks]\n elsif kind(2, ranks)\n return [1, kind(2, ranks), ranks]\n else\n return [0, ranks]\n end\nend",
"def rank_of_card_at (num)\n cards.fetch(num, \"Index #{num} is out of bounds.\")\n end",
"def cards_by_suit\n @cards_by_suit ||= @cards.group_by(&:suit)\n end",
"def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end",
"def my_cards\n index = 0\n @my_cards = []\n @suits.each do |suit|\n (1..13).each do |value|\n card = Card.new(value, suit)\n @my_cards.push(card)\n end\n end\n return @my_cards\n end",
"def deck_cards\n ranks = [\"A\", 2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\" ]\n suits = [ \"hearts\", \"spades\", \"clubs\", \"diamonds\" ]\n deck = []\n players = []\n\n values.each_with_index do |value, index|\n suits.each do |suit|\n deck.push([value,suit])\n end\n end\n return deck.shuffle\nend",
"def get_multiples(number)\n cards = []\n\n @cards_by_score.each_key do |card|\n if @card_scores.count(card.score) == number\n cards << card\n end\n end\n\n cards\n\n end",
"def greater_than?(other_card)\n order = [:A, 2, 3, 4, 5, 6, 7, 8, 9, 10, :J, :Q, :K]\n order.index(@rank) > order.index(other_card.rank) \n end",
"def get_cards(deck)\n\n end",
"def rank_of_cards_at(index)\n return cards[index].rank\n end",
"def choose_cards(turn, player)\n num = rand(turn.turn_stack_inspect.size)\n num += 1\n\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(num)\n end\n else\n turn.turn_get_cards_from_stack(num)\n end\n end",
"def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end",
"def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end",
"def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end",
"def full_house?\n return unless size >= 5\n\n the_cards = cards_by_rank.values\n the_cards[0].count >= 3 && the_cards[1].count >= 2\n end",
"def high_card?\n cards_by_rank.count == @size\n end",
"def build_deck_of_cards(deck)\n SUITS.each do |suit|\n RANKS.each do |rank|\n if suit == \"Hearts\" || suit == \"Diamonds\"\n if rank.match(/[B-Z]/)\n deck[\"#{rank} of #{suit}\".red] = 10\n elsif rank.match(\"A\")\n deck[\"#{rank} of #{suit}\".red] = 11\n else\n deck[\"#{rank} of #{suit}\".red] = rank.to_i\n end\n else\n if rank.match(/[B-Z]/)\n deck[\"#{rank} of #{suit}\".light_black] = 10\n elsif rank.match(\"A\")\n deck[\"#{rank} of #{suit}\".light_black] = 11\n else\n deck[\"#{rank} of #{suit}\".light_black] = rank.to_i\n end\n end\n end\n end\nend",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def cards_in_deck\n Card.where(game_id: @game.id, owner: 0).size\n end",
"def ranked_candidates\n Array(@ranking - [UNRANKED_ID]).flatten.sort\n end",
"def player_card_minors(_player)\n []\n end",
"def pair?\n cards_by_rank.values.first.count >= 2\n end",
"def validate_card(card)\n\n rank = [2,3,4,5,6,7,8,9,10,11,12,13,14]\n name = ['2','3','4','5','6','7','8','9','10','Jack','Queen','King','Ace']\n suit = [:heart, :diamond, :spade, :club]\n\n suit.each do |suit|\n rank.each_with_index do |rank, nam|\n temp = [name[nam], suit, rank]\n @valid_cards << temp\n end\n end\n #require 'pry' ; binding.pry\n @valid_cards.index(card).nil?\n end",
"def rank_starting_hand\r\n sorted_hand = @hole_cards.sort_by { |card| card.rank } # [4,2] => [2,4]\r\n\r\n # Shorthand variables for two cards in hand\r\n (first,second) = [sorted_hand[0],sorted_hand[1]]\r\n\r\n suited = first.suit == second.suit # True if cards have same suit\r\n paired = first.rank == second.rank # True if cards have same rank\r\n connected = first.rank + 1 == second.rank # True if cards have consecutive ranks\r\n\r\n # Check for playable hands and return their rank\r\n # (Some of these checks aren't necessary but are included for readibility)\r\n case first.rank\r\n when 8 then return 14 if paired # Pocket Eights\r\n when 9 then return 9 if paired # Pocket Nines\r\n when 10\r\n return 6 if paired # Pocket Tens\r\n return 20 if second.rank == 12 and suited # Queen-Ten Suited\r\n return 16 if second.rank == 13 and suited # King-Ten Suited\r\n return 12 if second.rank == 14 and suited # Ace-Ten Suited\r\n when 11\r\n return 4 if paired # Pocket Jacks\r\n return 17 if second.rank == 12 and suited # Queen-Jack Suited\r\n return 15 if second.rank == 13 and suited # King-Jack Suited\r\n if second.rank == 14\r\n return suited ? 10 : 18 # Ace-Jack Suited/Offsuit\r\n end\r\n when 12\r\n return 3 if paired # Pocket Queens\r\n if second.rank == 13\r\n return suited ? 11 : 19 # King-Queen Suited/Offsuit\r\n elsif second.rank == 14\r\n return suited ? 8 : 13 # Ace-Queen Suited/Offsuit\r\n end\r\n when 13\r\n return 2 if paired # Pocket Kings\r\n if second.rank == 14\r\n return suited ? 5 : 7 # Ace-King Suited/Offsuit\r\n end\r\n when 14 then return 1 if paired # Pocket Aces\r\n end\r\n # Still played if the hand is suited, paired, or connected, otherwise not played\r\n return (suited or paired or connected) ? 21 : -1\r\n end",
"def available_cards\n (@deck.size + board.size)\n end",
"def get_rounds_cards\n # get all the cards from this round's deck\n @cards = self.deck.cards\n end",
"def return_cards_from_top(count)\n if cards and count > 0\n cards.where(\"card_order > ?\", (get_top_order-count) )\n end\n end",
"def cards\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end",
"def index\n CARDs_RANKS[@face]\n end",
"def rank_of_card_at(index)\n cards[index].rank\n end",
"def build_deck(ranks, suits)\n deck = []\n ranks.each_with_index do |rank, i|\n suits.each do |suit|\n card = {\n suit: suit,\n rank: rank,\n worth: i\n }\n deck << card\n end\n end\n deck.shuffle\nend",
"def cards_to_score(cards)\n \n total = 0\n cards_num = []\n\n cards.each { |card| cards_num.push(card % 13) }\n\n cards_num.sort.reverse.each do |num|\n if num >= 9 #9, 10, 11, 12 means 10, J, Q, K\n total = total + 10\n elsif num > 0 #which means 2, 3, 4, 5, 6, 7, 8, 9\n total = total + num + 1\n end\n end\n\n a_count = cards_num.count(0)\n\n total = total + a_count\n\n a_count.times do\n total = total + 10 if total <= 11\n end\n\n return total\nend",
"def [](rank)\n if @ranking[rank] == UNRANKED_ID\n unranked_candidates\n else\n @ranking[rank]\n end\n end",
"def available_pink_cabs\n arr = []\n @pink_cabs.select { |pink_cab| arr << pink_cab if (pink_cab.available == true) }\n return arr\n end",
"def possibleHandValues\n \thand_values = Set.new [0] # start with value 0\n \[email protected] do |card| # for each card in the hand\n \t card_values = card.getValue\n \t new_hand_values = Set.new # add its value to all the possible\n \t hand_values.each do |total| # values for each of the previous\n \t \tcard_values.each do |card_value| # cards\n new_hand_values << total+card_value\n end\n end\n # Swap variable names. This makes the loop simpler\n new_hand_values, hand_values = hand_values, new_hand_values\n new_hand_values.clear\n end\n # Get the values that are below 21\n hand_values.delete_if do |value|\n if value > BLACKJACK\n true\n end\n end\n hand_values # Return set of possible values\n end",
"def played_cards\n player_cards.select { |c| c.played? }\n end",
"def hand_value(cards)\n value = 0\n val_arr = []\n cards.each do |sub_array|\n val_arr << sub_array.last\n val_arr.sort!\n end\n val_arr.each do |val|\n if val == 11 && value > 10\n value = value + 1 \n else\n value = value + val\n end\n end\n return value\nend",
"def full_deck\n Game::LANDS.collect do |land|\n (['Inv'] * 3 + (2 .. 10).to_a).collect do |value|\n Game::Card.new(value, land)\n end\n end.flatten\n end",
"def game\nranks = [2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\", \"A\"]\nsuits = [ \"hearts\", \"spades\", \"clubs\", \"diamonds\" ]\ndeck = []\npoints = []\n\nranks.each_with_index do |rank, score|\n suits.each do |suit|\n deck.push({\n points: points,\n ranks: rank,\n suits: suit\n })\n\n end\n end\n\n return deck.shuffle\nend",
"def candidates_above_default\n Array(@ranking[0...@default_rank]).flatten.sort\n end",
"def getCardArray()\n\t\treturn @cards\n\tend",
"def rank_test(index)\n @player1.deck.rank_of_card_at(index) == @player2.deck.rank_of_card_at(index)\n end",
"def getCards(aDeck)\n\t\treturn 13.times{self << aDeck.next}\t\n\tend",
"def deck_creator\n deck = []\n suits = [\"♠\", \"♥\", \"♦\", \"♣\"]\n ranks = [\"A\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"J\", \"Q\", \"K\"]\n\n suits.each do |value|\n current_suit = value\n\n ranks.each do |value|\n card = {}\n card[:suit] = current_suit\n card[:rank] = value\n if value === \"A\"\n card[:value] = 1\n elsif [\"J\", \"Q\", \"K\"].include?(value)\n card[:value] = 10\n else\n card[:value] = value.to_i\n end\n\n deck.push(card)\n end\n end\n return deck\nend",
"def filter_cards(cards)\n cards = Array(cards) unless cards.respond_to?(:count) \n return cards.select { |card| Card.get(card.id).nil? } #TODO: move this to method\n end",
"def cards\n @cards\n end",
"def ranks\n @ranks ||= RANK_RANGE.map(&:to_i)\n end",
"def four_of_a_kind?\n cards_by_rank.values.first.count == 4\n end",
"def show_rankings()\n players = Player.all\n rankings = Array.new\n players.each do |r|\n player << r.id\n played = Result.where(:player_id => player).count\n ranking = Ranking.where(:player_id => player).last.id\n rankings << [player, played, ranking]\n end\n return rankings\n end",
"def choose_cards(turn, player)\n num = rand(turn.turn_stack_inspect.size)\n num += 2\n\n turn.turn_get_cards_from_stack(num)\n end",
"def active_rank(student, rank)\n \treturn student.ranks.include?(rank)\n\tend",
"def gamefield\n cards.find_all {|card| card.gamefield? }.sort\n end",
"def ranking(limit=4)\n return [] unless self.votes ## empty array if no ranks\n self.votes.map.sort {|x, y| y[1] <=> x[1] }.collect {|y| y[0] }[0..limit]\n end",
"def candidates_below_default\n Array(@ranking[@[email protected]]).flatten.sort\n end",
"def determine_high_card hsh,num\n arr = []\n num1 = 2\n\n hsh.each_value {|card| arr << card}\n arr.flatten!\n arr.sort! {|x,y| y.number <=> x.number}\n while arr.length > num\n arr.pop\n end\n return arr\n end",
"def non_trump_cards\n @cards.select {|c| c.suit != @trump_suit}\n end",
"def ask_for_cards_until_go_fish_and_get_last_requested_rank\n while true\n selected_rank = player.select_rank\n if !try_getting_cards_from_player(selected_rank)\n return selected_rank\n end\n end\n end",
"def check_points(cards)\n points = []\n point = 0\n\n cards.each do |card|\n if %w(J K Q).include?(card[:value])\n point += 10\n elsif card[:value] == 'A'\n point += 11\n else\n point += card[:value].to_i\n end\n end\n\n points << point if point <= 21\n\n cards.select { |ele| ele[:value] == 'A' }.count.times do\n point -= 10\n points << point if point <= 21\n end\n\n points\nend",
"def candidates\n players = []\n players += Player.where(:position => \"QB\").first(20)\n players += Player.where(:position => \"RB\").first(20)\n players += Player.where(:position => \"WR\").first(20)\n players\n end",
"def build_deck\n# This function builds an array of 52 cards made up of 4 copies of fixed nums with values from 1 to 13\n\t@deck = []\n\tfor num in 1..4\n\t\tfor num in 1..13\n\t\t\[email protected](num)\n\t\tend\n\tend\nend",
"def cards_at(indices)\n\t\tcards = []\n\t\tindices.each {|x| cards << @board[x.to_i-1] }\n\t\tcards\n\tend",
"def value\n card_value = @rank\n if @rank == :A\n card_value = 11\n elsif @rank == :K || @rank == :Q || @rank == :J\n card_value = 10\n end\n card_value\n end",
"def recipecards\n RecipeCard.all.select do | card |\n card.user == self\n end\n end",
"def tie_breaker\n all_ranks.find{|truth| truth != 2014}\n end",
"def check_order\n rps = RankParticipant.all\n\n #sort the rank participants and extract an array of only the ranks (that are sorted)\n all_ranks_sorted = rps.sort_by { |x| [x.rank] }.map { |rp| rp.rank }\n\n #array of missing ranks\n @missing = []\n\n all_ranks_sorted.each_with_index do |item, index|\n if index > 0\n #difference between consecutive ranks, should be 1\n difference = all_ranks_sorted[index] - all_ranks_sorted[index - 1]\n\n if difference > 1\n @missing.concat(((all_ranks_sorted[index - 1] + 1)...(all_ranks_sorted[index])).to_a)\n end\n end\n end\n end",
"def tie_breaker_cards\n matched = self.matched_cards\n sorted = @cards.sort.reverse\n # sorted so the card with highest value is first \n if five_of_a_kind? \n # All cards break the tie\n return sorted \n elsif flush?\n # All cards break the tie\n return sorted \n elsif four_of_a_kind?\n four = matched.find{ |rank, cards| cards.size == 4}\n # quads break the tie first, then the other card \n return four + [(sorted - four).first] \n elsif full_house?\n three = matched.find{ |rank, cards| cards.size == 3}\n two = matched.find{ |rank, cards| cards.size == 2}\n return three + two\n elsif straight?\n # Special case for ace, 2, 3, 4 ,5 straight, which sorts as\n # 2,3,4,5,A \n if sorted.first.rank == Rank::Ace && sorted.last.rank == Rank::Two \n ace = sorted.pop \n sorted.unshift(ace) # put ace at the back\n return [ sorted.first ] # should be the 5 now \n else\n return [ sorted.first ] \n end\n elsif three_of_a_kind?\n three = matched.find{ |rank, cards| cards.size == 3} \n return three + (sorted - three).first(2)\n elsif two_pair?\n pairs = [] \n matched.each{ |rank, cards| pairs << cards if cards.size == 2 } \n two_pair = pairs[0] + pairs[1]\n two_pair + [(sorted - two_pair).first]\n elsif pair?\n two = matched.find{ |rank, cards| cards.size == 2} \n two + (sorted - two).first(3)\n else\n sorted.first(5)\n end\n end",
"def get_card\n all_cards = self.deck.cards\n correct_cards = self.guesses.where(correct: true).map { |guess| guess.card }\n (all_cards - correct_cards).shuffle.sample\n end",
"def getValue(card_number)\n # get card rank\n rank = case card_number % 13\n when 0, 11, 12 then 10\n when 1 then 11\n else card_number % 13 \n end\n \n return rank\n \nend",
"def all_cards_like_this\n user.creditcards.where(:cc_type => cc_type, :last_digits => last_digits, :first_name => first_name, :last_name => last_name, :year => year, :month => month)\n end"
] | [
"0.8250881",
"0.81045336",
"0.7728543",
"0.77278906",
"0.7680578",
"0.7147253",
"0.6939794",
"0.6838715",
"0.6696209",
"0.66387737",
"0.6634485",
"0.64832735",
"0.64506555",
"0.64208394",
"0.6374412",
"0.63446575",
"0.6340148",
"0.6287293",
"0.62323934",
"0.61858",
"0.61779904",
"0.615709",
"0.6129267",
"0.61231726",
"0.6056222",
"0.60469407",
"0.6025622",
"0.6009176",
"0.6002682",
"0.59844285",
"0.5951115",
"0.59385604",
"0.5929712",
"0.5915335",
"0.5904898",
"0.5904843",
"0.5900206",
"0.5870657",
"0.5859",
"0.5839276",
"0.58356065",
"0.58294564",
"0.5808246",
"0.5796215",
"0.57883257",
"0.5784315",
"0.5778137",
"0.5778137",
"0.5778137",
"0.5750985",
"0.5744515",
"0.57286865",
"0.5726838",
"0.57185197",
"0.5706487",
"0.5700638",
"0.5693045",
"0.56602603",
"0.5654861",
"0.5634019",
"0.5622705",
"0.5621295",
"0.56161547",
"0.5615798",
"0.56112516",
"0.56078994",
"0.56066465",
"0.55975616",
"0.5597207",
"0.55970395",
"0.55950326",
"0.5587976",
"0.5561983",
"0.55454",
"0.55438226",
"0.55293435",
"0.55282354",
"0.5522003",
"0.5519419",
"0.5509137",
"0.55007577",
"0.54961556",
"0.5480181",
"0.54737234",
"0.5468913",
"0.5461873",
"0.5457014",
"0.54460764",
"0.5440087",
"0.5438806",
"0.5437278",
"0.5436909",
"0.542309",
"0.5418217",
"0.5416379",
"0.54158115",
"0.541135",
"0.54069877",
"0.54015744",
"0.5396191"
] | 0.8188311 | 1 |
method that returns the percentage of cards that are high ranking | def percent_high_ranking
count_high = 0
cards.each do |card|
if card.rank >= 11
count_high += 1
end
end
count_high_f = count_high.to_f
count_total = cards.length
count_total_f = count_total.to_f
(100 * (count_high_f/count_total_f)).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent_high_ranking\n percent = high_ranking_cards.length / cards.length.to_f\n end",
"def percent_high_ranking\n ((high_ranking_cards.count.to_f / @cards.count.to_f) * 100).round(2)\n end",
"def percent_high_ranking\n (high_ranking_cards.count.fdiv(@cards.count) * 100).round(2)\n end",
"def percent_high_ranking\n number_of_high_cards = self.high_ranking_cards.length.to_f\n number_of_all_cards = self.cards.length.to_f\n\n percentage = number_of_high_cards / number_of_all_cards\n percentage_rounded = (percentage * 100).round(2)\n\n return percentage_rounded\n end",
"def percent_high_ranking\n high = 0.0\n low = 0.0\n cards.each do |card|\n if card.rank >= 11\n high += 1\n else\n low += 1\n end\n end\n (high * 100 / (high + low)).ceil(2)\n end",
"def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end",
"def point_value\n return 500 if flush?\n return 300 if three_kind?\n return 200 if two_kind?\n return highest_card.numeric_rank\n end",
"def sub_percentage_by_rank(rank)\n case rank\n when 1\n return 0.25\n when 2\n return 0.20\n when 3\n return 0.15\n when 4\n return 0.10\n when 5\n return 0.05\n else\n # If you update any of the above values, you MUST update the value below.\n # They should equal a total of 1 for 100%.\n return 0.25 / @num_users_eligible.to_f\n end\n end",
"def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end",
"def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end",
"def get_score (cards)\n\t\tscore = 0\n\t\tcards.each do |card|\n\t\t\tmeasure = card[0]\n\t\t\tscore += @score[measure]\n\t\tend\n\t\tscore\n\tend",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def get_score\n flush = is_flush?\n straight = is_straight?\n pairs = pairs?\n\n return 45 if pairs.size == 1 && pairs[0][1] == 5\n return 44 if flush && straight\n return 31 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 4\n return 30 if pairs.size == 2 && (pairs[0][1] + pairs[1][1]) == 5\n return 29 if flush\n return 28 if straight\n return 15 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 3\n return 14 if pairs.size == 2\n return 1 + pairs[0][0] - 2 if pairs.size == 1\n -14 + high_card #high card return\n end",
"def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end",
"def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end",
"def score\n suit_score = [\n Suit.spades,\n Suit.clubs,\n Suit.diamonds,\n Suit.hearts,\n Suit.none\n ].index(suit) * 20 + 40\n\n (number - 6) * 100 + suit_score\n end",
"def score\n score = 0\n aces_count = 0\n @hand_contents.each do |card|\n if card.type == :face\n score += 10\n elsif card.type == :ace\n aces_count += 1\n score += 11\n elsif card.type == :number\n score += card.rank.to_i\n end\n end\n\n while score > 21 && aces_count > 0\n score -= 10\n aces_count -= 1\n end\n score\n end",
"def score\n @cards.map(&:value).inject(:+)\n end",
"def calculate\n\t\taverage_rank\n\t\tfound_percent\n\tend",
"def ranked_points\n points.to_f/User.top_ranked.points.to_f * 100\n end",
"def score\n if g = royal_flush?\n r = 5000\n elsif g = straight_flush?\n r = 4000 + g.last.rank\n elsif g = four_of_a_kind?\n r = 3500 + g.first.rank\n elsif g = full?\n high1 = three_of_a_kind?.first.rank\n high2 = pair?.first.rank\n r = 3000 + high1 * 100 + high2\n elsif g = flush?\n highest = g.last.rank\n r = 2500 + highest\n elsif g = straight?\n r = 2000 + g.last.rank\n elsif g = three_of_a_kind?\n r = 1500 + 100 * g.first.rank\n elsif g = two_pairs?\n high1 = g.last.rank\n high2 = g.first.rank\n r = 1000 + 100 * high1 + high2\n elsif g = pair?\n r = 500 + g.first.rank\n else\n g = highest?\n r = highest?.rank\n end\n [val - [g].flatten, r]\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def game_score\n previous_hands = self.game_player.hand_players.joins(:hand).where(\n \"hands.position <= ?\", self.hand.position\n )\n gs = 0\n for h in previous_hands\n gs += h.hand_score\n end\n return gs\n end",
"def get_percent_of_vote\n\t\t(@votes.count(@winner).to_f / @votes.count.to_f * 100).round\n\tend",
"def popularity_contest\n @popular = Work.maximum(:impressions_count).to_f\n n = 1 - self.impressions_count.fdiv(@popular).round(2)\n return (n*255).round\n end",
"def base_score\n rank.last\n end",
"def get_optimum_hand_score(hand)\n total = 0\n hand.each do |card|\n total += get_card_value(card)\n end\n\n #Count the number of aces we have\n num_aces = (hand.select{|card| get_card_value(card) == 11}).length\n\n #Account fo aces\n while total > 21 && num_aces > 0 do\n total -= 10\n num_aces -= 1\n end\n return total\nend",
"def score\n dealt.inject(0){|sum,card| sum + card.value}\n end",
"def high_card\n @hand.max_by{|card| card.point}.point.to_i\n end",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def calcScore(hand)\n return hand.inject(0) { |sum, n| sum + n.points }\nend",
"def player_win_percentage\n (games_won/user_games)\n end",
"def winning_scores\n high_score = scores.max{|score| score.total}.total\n scores.select {|score| score.total == high_score}\n end",
"def get_win_percentage(strategy)\n score = 0\n @turns.each do |t|\n score += t.result.to_i if t.strategy.include?(strategy)\n end\n score\n end",
"def player1_score\n player_hand.inject(0){|sum,n| sum + n.value }\n end",
"def high_ranking_cards\n\n array_high_cards = []\n\n cards.each do |card|\n\n if card.rank >= 11\n array_high_cards << card\n end\n\n end\n\n array_high_cards\n\n end",
"def calculate_score(values)\n total = 0\n values.each do |card|\n total += card\n if total > 21 && card == 11\n total -= 10\n end\n end\n total\n end",
"def cards_to_score(cards)\n \n total = 0\n cards_num = []\n\n cards.each { |card| cards_num.push(card % 13) }\n\n cards_num.sort.reverse.each do |num|\n if num >= 9 #9, 10, 11, 12 means 10, J, Q, K\n total = total + 10\n elsif num > 0 #which means 2, 3, 4, 5, 6, 7, 8, 9\n total = total + num + 1\n end\n end\n\n a_count = cards_num.count(0)\n\n total = total + a_count\n\n a_count.times do\n total = total + 10 if total <= 11\n end\n\n return total\nend",
"def calculate_popularity_score\n top_guide = (Guide.order_by(\"impressions_field\" => :asc).last)\n at_most = (top_guide.impressions_field || 0).to_i\n normalized = impressions_field.to_f / at_most\n write_attributes(popularity_score: normalized)\n end",
"def high_card\n high_value = 0\n @grip.each do |card|\n new_value = FACE_VALUES.find_index(card.value)\n if new_value > high_value\n high_value = new_value\n end\n end\n FACE_VALUES[high_value]\n end",
"def calc_pct(wins, losses)\n return (wins + losses) == 0 ? 0.0 : wins.to_f / (wins + losses).to_f\nend",
"def displayScore()\n puts \"#{name} has #{@hand.length} cards in their deck\"\n end",
"def rank\n groups = PoliceGroup.all.sort_by(&:grand_total)\n index = groups.index(self) + 1\n place = index / groups.size.to_f\n if place > 0.75\n 'High'\n elsif place > 0.25\n 'Moderate'\n else\n 'Low'\n end\n end",
"def completion\n\t\t@cards[0..TOTAL_UNIQUE_CARDS-1].reduce(0) {|memo, card| card.complete? ? memo + 1 : memo} / TOTAL_UNIQUE_CARDS.to_f\n\tend",
"def pick_percentage\n self.score.to_f / Matchup.amount_finished.to_f\n end",
"def hand_total(hand) \n\n #A flag to see if the hand contains an ace\n have_ace = ! ( session[hand].select{|card| card['rank'] == \"ace\"}.empty? ) \n\n total = 0 \n\n #Look up the point value of each card in the hand\n session[hand].each do |card|\n total += RANK_TO_POINTS[ card['rank']]\n end\n \n #Convert from hard (ace=1) to a soft (ace=11) \n #score if hand contains an ace\n #and it won't cause the hand to bust\n if (total <= 11 && have_ace) then total += 10 end \n\n return total \n\n end",
"def get_hand_score\n score = 0\n \n # Add up score of non-aces\n values = hand.map{|card| card.value}\n values.each do |val|\n if Array(2..10).include?(val.to_i)\n score += val.to_i\n elsif [\"J\", \"Q\", \"K\"].include?(val)\n score += 10\n end\n end\n\n # deal with the aces\n values.count(\"A\").times do\n if score + 11 <= 21\n score += 11\n else\n score += 1\n end\n end\n\n return score\n end",
"def high_card \n\t\tcards.max\n\tend",
"def percent_of_total\n # Prevents a error caused by attempting to round the value NaN\n poll.total_points == 0 ? 0 : (score.to_f/poll.total_points.to_f * 100).round\n end",
"def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend",
"def percentile(pct)\n n = raw_statistics.length\n i = ((pct.to_f / 100) * n).ceil\n\n x = raw_statistics[n - (i - 0)]&.won || 0\n y = raw_statistics[n - (i - 1)]&.won || 0\n\n ((x + y).to_f / 2).ceil\n end",
"def bayesian_rank\n\n #this is an ad hoc value, which basically represents the minimum number of \n #votes we think an Idea should have before it's even considered relevant. \n #eventually this value will come from the admin screen\n @magic_number_of_votes = 0.5\n\n @return_value = ((@magic_number_of_votes*Idea.average_rank_of_all_ideas.to_f)+(self.count_of_users_ranked*self.average_rank.to_f))/(@magic_number_of_votes+self.count_of_users_ranked)\n\n if @return_value == 0\n return 10\n else\n return @return_value.round(2)\n end\n\nend",
"def score\n p_score = player_hand.collect{|x| x.value}.inject(:+)\n c_score = computer_hand.collect{|x| x.value}.inject(:+)\n puts \"You have #{player_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{p_score}\"\n puts \"The computer has #{computer_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{c_score}\"\n puts \" \"\n end",
"def high_card?\n cards_by_rank.count == @size\n end",
"def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end",
"def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end",
"def most_points_scored\n most_points = 0\n most_points_player = nil\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player_stats|\n if most_points < player_stats[:points]\n most_points = player_stats[:points]\n most_points_player = player_stats[:player_name]\n end\n end\n end\n most_points_player\nend",
"def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end",
"def total_score\n sum = self.games.sum{|game|game.points}\n sum.to_i / self.games.count\n end",
"def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end",
"def most_points_scored\n big_score_player = player_collection.reduce { |memo, next_player|\n memo[:points] > next_player[:points] ? memo : next_player; \n }\n big_score_player[:player_name];\nend",
"def score\n return self.progress - self.budget_ratio\n end",
"def score\n # make a local array that will disappear when not in this method\n tally = []\n # for each of the cards in the hand, add their score to the tally from points\n @hand.each do |card|\n tally.push(@points[card])\n end\n # return the tally of the scores\n return tally.sum\nend",
"def score\n total = 0\n docs = 0\n [@classes, @modules, @methods, @constants, @attrs].each do |collection|\n collection.each do |item|\n total += 1\n docs += 1 if item\n end\n end\n return 100 if total == 0\n return ((docs.to_f / total) * 100).to_i\n end",
"def most_points_scored\n most_points = 0\n leading_scorer = \"\"\n\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player[:points] > most_points\n most_points = player[:points]\n leading_scorer = player[:player_name]\n end\n end\n end\n return leading_scorer\nend",
"def top_n_to_percentage(percent)\n top = top_n\n total = top.map(&:last).sum\n cumulative_count = 0.0\n top_to_percentage = []\n\n while (cumulative_count / total) * 100 < percent\n result = top.shift\n top_to_percentage << result\n cumulative_count += result[1]\n end\n top_to_percentage\n end",
"def highest_player_score\n players.max_by{|player| player.score}.score\n end",
"def get_percentage_score(val, to_base)\n return (1.0 - val[:score] / to_base[:score])*100 * (@greater_is_better ? -1.0 : 1.0)\nend",
"def is_high_card( hand )\n\treturn hand.map { | e | card_value( e ) }.max\nend",
"def most_points_scored\n stat_by_player = collect_stat_by_name(:points)\n player_with_max_stat = find_max_stat_by_player(stat_by_player)\n player_with_max_stat\nend",
"def get_expected_score(player_rating, opponent_rating)\n 1.0 / (1.0 + 10.0 ** ((opponent_rating.to_f - player_rating.to_f) / 400.0))\n end",
"def percentage_home_wins\n home_wins = @teams.map { |team| team.home_wins }.sum\n home_games = @teams.map { |team| team.home_games }.sum\n (home_wins.to_f / home_games.to_f).round(2)\n end",
"def high_ranking_cards\n cards.map do |card|\n if card.rank >= 11\n high_cards << card\n end\n end\n high_cards\n end",
"def percent_wins(wins)\n ((wins.to_f / @num_games.to_f) * 100).round(4)\n end",
"def stat_hcr\n percentage(self.heifers, self.heifers_calved)\n end",
"def hp_rate\r\n @hp.to_f / mhp\r\n end",
"def high_ranking_cards\n high_cards = []\n @cards.each do|card|\n if card.rank >= 11\n high_cards << card\n end\n end\n high_cards\n end",
"def percent_correct_by_category(card_category)\n total_by_category = []\n @turns.each do |card|\n if card.card.category == card_category\n total_by_category << card\n end\n end\n number_correct_by_category(card_category).fdiv(total_by_category.count) * 100\n end",
"def find_best_score(total_per_player)\n best_score = 0\n winner = ''\n total_per_player.each do |player_name,total|\n\n if total > best_score\n best_score = total\n winner = player_name\n end\n end\n return winner\n end",
"def highest_score\n sort\n all.first.score\n end",
"def score_counts(counts)\n if counts.count > 0\n _num = counts.map { |x| x.obp }\n _num.percentile(90)\n else\n 0.01\n end\n end",
"def calculate_score(user_id)\n Game.score(self.card_numbers user_id)\n end",
"def detect_result(dealer_cards, player_cards)\r\n player_total = total(player_cards)\r\n dealer_total = total(dealer_cards)\r\n\r\n if player_total > HAND_LIMIT\r\n :player_busted\r\n elsif dealer_total > HAND_LIMIT\r\n :dealer_busted\r\n elsif dealer_total < player_total\r\n :player\r\n elsif dealer_total > player_total\r\n :dealer\r\n else\r\n :tie\r\n end\r\nend",
"def res_score\n return 0 if report.users.size == 0\n ((report.unique_recipient_count / report.users.size.to_f) * 100).round(2)\n end",
"def res_score\n return 0 if report.users.size == 0\n ((report.unique_recipient_count / report.users.size.to_f) * 100).round(2)\n end",
"def count_score(array)\n total = 0\n sorted_hand = array.sort_by { |x| value(x) }\n sorted_hand.each do |x|\n if value(x) == 11 && total >= 11\n total += 1\n else\n total += value(x)\n end\n end\n total\nend",
"def scores\n return Game.score(self.card_numbers self.user_id), Game.score(self.card_numbers nil)\n end",
"def total_score\n rank_items.to_a.sum { |item| item.rank_score * item.weight }\n end",
"def percentage; end",
"def pct()\n\t (self.wins()==0) ? 0 : self.wins().to_f/(self.wins()+self.losses()) \n\tend",
"def calculate_final_score\n self.scores.average(:total_score)\n end",
"def calculate_probability(useful_results, reroll_count)\n return 100.0 * useful_results / ( 6 ** reroll_count )\n end",
"def calculate_rank_and_grade \n points_off = 0\n points_off += self.opt_out_count * 5 \n points_off += self.un_solicited_count * 10 \n points_off += self.sell_count * 21 \n points_off += self.vulgar_count * 31 \n points_off = points_off/(self.surveys.count) \n result = case rank = 100 - points_off\n when 96..500 then \"A+\"\n when 90..95 then \"A-\"\n when 80..89 then \"B\"\n when 70..79 then \"C\"\n when 60..69 then \"D\"\n when 0..60 then \"F\"\n end\n self.grade = result\n self.rank = rank\n end",
"def quality_percentage\n require 'hpricot'\n doc = Hpricot(File.read(\"#{Continuous4r::WORK_DIR}/flog/index.html\"))\n doc.search('//h3') do |h3|\n if h3.inner_text.match(/^Project average score/)\n score = h3.inner_text.split(/Project average score : /)[1].to_f\n if score > 100.0\n percent = 0\n elsif score < 11.0\n percent = 100\n else\n percent = ((100.0 - score) * 100.0) / 89.0\n end\n return percent\n end\n end\n end",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to_i == 0 #For suits ie Jester, Queen\n total+= 10\n else \n total+= card_value.to_i\n end\n end \n\n#adjust for Aces\n card_values.select{|card| card == \"ACE\"}.count.times do \n total-=10 if total > 21\n end \n total\nend",
"def high_card(hand)\n\t\thand_num = check_num(hand)\n\t\treturn hand_num.max\n\tend",
"def highest_total_score\n @game_manager.highest_total_score\n end",
"def win_percent\n matchmade_games < 1 ? 0 : ((total_exp.to_f/matchmade_games.to_f) * 100).to_d\n end"
] | [
"0.91720563",
"0.9121698",
"0.91184473",
"0.8980694",
"0.8806858",
"0.74805653",
"0.71984434",
"0.71831447",
"0.7152803",
"0.7034786",
"0.69695306",
"0.69002855",
"0.69002855",
"0.6896839",
"0.6883806",
"0.6872848",
"0.68479615",
"0.684721",
"0.6840927",
"0.6837351",
"0.6836189",
"0.68332714",
"0.6780364",
"0.67653203",
"0.6761498",
"0.67332435",
"0.67064834",
"0.6694673",
"0.66845775",
"0.665274",
"0.6640855",
"0.66259366",
"0.662582",
"0.662495",
"0.66243905",
"0.6622751",
"0.6609243",
"0.6607665",
"0.6604182",
"0.65682775",
"0.65441746",
"0.65216875",
"0.65165734",
"0.6501562",
"0.6497098",
"0.64888906",
"0.64814776",
"0.6466601",
"0.6462432",
"0.64471346",
"0.6438546",
"0.6435721",
"0.6433239",
"0.6427034",
"0.6426595",
"0.64260244",
"0.6423876",
"0.6423109",
"0.64148223",
"0.64098215",
"0.639243",
"0.6378493",
"0.6370877",
"0.63705117",
"0.6368629",
"0.6367649",
"0.6366529",
"0.63633275",
"0.63576466",
"0.6352006",
"0.634912",
"0.63455427",
"0.6341166",
"0.6339793",
"0.63343674",
"0.63339245",
"0.6327313",
"0.63259053",
"0.6321933",
"0.6318831",
"0.63160396",
"0.62955976",
"0.6294118",
"0.62937903",
"0.62927806",
"0.62927806",
"0.62827086",
"0.6280892",
"0.6275328",
"0.62707543",
"0.62629604",
"0.6251884",
"0.62509555",
"0.62488884",
"0.6245941",
"0.6240893",
"0.6237035",
"0.623653",
"0.6235608",
"0.6231922"
] | 0.92016345 | 0 |
method that removes the top card from the deck | def remove_card
@cards.shift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_card_top\n @cardList.pop\n end",
"def remove_card\n @cards.shift\n end",
"def remove_card\n @cards.delete_at(0)\n end",
"def remove_card\n self.cards.delete_at(0)\n end",
"def test_discard_top_card\n top_card = @manager.draw_pile.cards[0]\n assert_not_equal(top_card, @manager.discard_pile.cards[0])\n @manager.discard_top_card\n assert_equal(top_card, @manager.discard_pile.cards[0])\n end",
"def deal_card\n @deck.remove(:front)\n end",
"def remove_card\n cards.shift\n return cards\n end",
"def show_top_card\n self.discard(draw)\n end",
"def deal_card\n @deck.pop\n end",
"def remove remove_card\r\n @card_list.remove remove_card\r\n end",
"def remove_card_from_deck (card)\n\t\t@deck -= [card]\n\tend",
"def get_card\n @deck.pop\n end",
"def remove remove_card\n @card_list.remove remove_card\n end",
"def deal_card\r\n\t\tcards.pop\r\n\tend",
"def remove_cards\n\t\[email protected]!(0,2)\n\tend",
"def drawcard\n @deck.pop\n end",
"def deal_card\n @cards.pop\n end",
"def take_card\n raise OutOfCardsError if empty?\n @cards.pop\n end",
"def removeCard(card)\n @cards.delete(card)\n end",
"def remove_all_but_top_cards\n piles.map { |pile| pile.slice!(0, pile.size - 1) }\n end",
"def remove_card(card)\n @all_cards.delete(card)\n end",
"def high_card\n @cards.sort[-1]\n end",
"def hit \n card = self.cards_deck.pop\n return card\n end",
"def top_card\n raise 'This pile is empty!' if empty?\n @store.last\n end",
"def pop_cards(num_pops)\r\n #p @deck_todisp.size\r\n num_pops.times{|ix| @deck_todisp.pop}\r\n if @briscola and @card_briscola_todisp and @deck_todisp.size == 0\r\n #if @card_briscola_todisp and @realgame_num_cards == 0\r\n # no more cards on deck, pick the briscola\r\n @card_briscola_todisp.visible = false\r\n end\r\n #p @deck_todisp.size\r\n end",
"def deal\r\n @deck_of_cards.shift\r\n end",
"def take_card\n @deck.shift\n end",
"def top\n cards.first\n end",
"def deal_flop\n @pokerdeck.pop\n flop = @pokerdeck.pop(3)\n @communal_cards = flop\n return flop\n end",
"def pull(card)\n card = self.cards.delete(card)\n raise \"Cannot find card. May already have been dealt\" unless card\n return card\n end",
"def deal_one\n cards.pop\n end",
"def hit(deck)\n rand_card = deck.sample # pulls a random card from the playing deck.\n deck.delete(rand_card)\nend",
"def take_card\n @store.pop\n end",
"def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end",
"def deal\r\n @cards.shift\r\n end",
"def discard(card)\n discard_pile << card\n end",
"def top_card\n return nil if @discard.empty?\n @discard.last.to_s\n end",
"def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\n end",
"def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end",
"def remove_set_from_hand(card)\n\t\[email protected](card)\n\tend",
"def draw_card\n self.cards.pop\n end",
"def play_like_a_dummy\r\n # very brutal algorithm , always play the first card\r\n card = @cards_on_hand.pop\r\n return card\r\n end",
"def add_card_to_top(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == get_top_order)\n #Update order of card's current deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Add the card to the top of the new deck\n card.update_attributes(deck_id: id, card_order: (get_top_order+1) )\n end\n end",
"def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end",
"def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end",
"def retrieve_card\n card = @cards.pop\n if card.nil?\n self.reset\n card = @cards.pop\n end\n return card\n end",
"def deal()\n card = self.cards.shift()\n raise \"Cannot deal more than 52 cards.\" unless card\n return card\n end",
"def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end",
"def take!\n\t\[email protected]\n\tend",
"def pull_from(index)\n error_unless_index_is_in_bounds index\n\n card = @stack[index]\n @stack.delete_at index\n card\n end",
"def add_deck_to_top(add_deck)\n if add_deck.cards and add_deck.id != self.id and add_deck.cards.size > 0\n orig_count = self.cards.size\n add_deck.cards.each do |c|\n c.update_attributes(deck_id: id, card_order: (c.card_order + orig_count))\n end\n end\n end",
"def hand_over_player \r\n puts \"Player getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @player_deck[@random_card] = random_card_val # to player\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@player_deck = #{@player_deck}\"\r\n\r\n end",
"def draw\n @cards.pop\n end",
"def discard_card(player)\n if player.player_hand.size == 0\n nil\n else\n rand_index = rand(5)\n rand_index += 1\n Keepem.new(Image.new(\"keepem.gif\"), rand_index)\n end\n end",
"def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end",
"def deal\n @deckOfCards.shift\n end",
"def choose_card \n\n @cards.shift\n end",
"def discard\n player.hand.first\n end",
"def discard\n\n # organize hand into sorted array of cards\n #### METHOD\n\n puts \"here is your hand #{hand}\"\n\n puts 'what cards? you can only discard 3.'\n\n #the player returns [2,3]\n ##### METHOD\n\n # find hand[2], hand[3] and remove from hand\n ##### METHOD\n\n # hand currently has 3 cards\n\n # hand << deck.deal(2)\n\n #RETURNS new hand\n\n\n #....player1.hand = the new hand\n end",
"def draw(amount = 1)\n cards.pop(amount)\n end",
"def draw_card\n #change for chapel if no card to draw\n if ! (top_card = deckcards.find_by(library_position: 1))\n shuffle\n top_card = deckcards.find_by(library_position: 1)\n end\n top_card.status = \"hand\"\n top_card.library_position = nil\n top_card.save\n library.each do |library_member|\n library_member.library_position -=1\n library_member.save\n end\n top_card\n end",
"def empty\n @cards.shift(@cards.size)\n end",
"def delete card\n @hand.delete(Card.new(card))\n end",
"def remove remove_card\n @cards.each_with_index do |card, i|\n if card.to_string == remove_card.to_string\n @cards.delete_at(i)\n return true\n end\n end\n false\n end",
"def pop\n delete_at(0)\n end",
"def pick\n raise NoMoreCardsException.new(\"Deck is empty\") if cards_left == 0\n @deck.shift\n end",
"def select_card\n num_random = rand(@cards.length)\n card = @cards[num_random]\n @cards.delete_at(num_random)\n card\n end",
"def get_card()\n return @cards.delete_at(rand(@cards.length))\n end",
"def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end",
"def deal\n @deck.shift\n end",
"def deal_turn\n @pokerdeck.pop\n turn = @pokerdeck.pop\n @communal_cards << turn\n return turn\n end",
"def test_reshuffle_discard_into_draw\n # drain the draw pile into the discard pile\n while [email protected]_pile.is_empty?\n @manager.discard_top_card\n end\n assert_equal([], @manager.draw_pile.cards)\n assert_not_equal([], @manager.discard_pile.cards)\n\n @manager.reshuffle_discard_into_draw\n\n # draw pile should have cards and discard pile should be empty again\n assert_equal([], @manager.discard_pile.cards)\n assert_not_equal([], @manager.draw_pile.cards)\n end",
"def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end",
"def discard(card)\n hand.transfer!(card: card, to: discard_pile)\n end",
"def return_cards_from_top(count)\n if cards and count > 0\n cards.where(\"card_order > ?\", (get_top_order-count) )\n end\n end",
"def remove_card_row_cards\n card_row.each do |gc|\n gc.discard! if gc && gc.position < self.card_row_discard_size\n end\n end",
"def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n elsif player.player_hand.wildcards.size > 0\n wildcards = player.player_hand.wildcards\n rand_index = rand(wildcards.size)\n return wildcards.fetch(rand_index)\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end",
"def draw\n return @cards.pop\n end",
"def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end",
"def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end",
"def pop\n raise \"Stack Underflow - The stack is empty\" if self.is_empty?\n top_element = @store.pop\n @top -= 1\n top_element\n end",
"def add_top (card)\n @cards.push(card);\n end",
"def top_cut(pack,cut=nil)\nif cut == nil\ncut = rand(1...pack.length)\nend\ntop = pack.slice(0,cut)\nbottom = pack.slice(cut..-1)\ncut_pack = bottom + top\np \"#{cut} card(s) cut from top of deck.\"\ncut_pack\nend",
"def drawCards!(n)\n\t\treturn @cards.pop(n)\n end",
"def deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\n end",
"def create_card(deck)\n card = deck.shuffle.pop\nend",
"def pick_random_card\n random_card = @all_cards.sample\n remove_card(random_card)\n return random_card\n end",
"def clear_hand\n @hand_cards.clear\n @points = 0\n end",
"def delete_front()\n \n end",
"def top_cut(pack,cut=nil)\n if cut == nil\n cut = rand(1...pack.length)\n end\n top = pack.slice(0,cut)\n bottom = pack.slice(cut..-1)\n cut_pack = bottom + top\n p \"#{cut} card(s) cut from top of deck.\"\n cut_pack\n end",
"def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end",
"def get_top_order\n cards.maximum('card_order') || 0\n end",
"def deal\n\n @first_card = @cards.shift\n\n return @first_card\n\n end",
"def deal_card(hand)\n\t# pick a random card and add to the hand\n\tindex = rand($card_deck.length)\n\thand << $card_deck[index]\n\n\t# remove the card from the deck\n\t$card_deck.delete_at(index)\nend",
"def deal\n puts @deck.first\n @deck.shift\n end",
"def dealSelf(deck)\n \t@hands[0].addCard(deck.removeCard)\n end",
"def get_trump_card\n if self.trump_card.nil?\n trump_index = rand(self.cards_set.length)\n self.trump_card = self.cards_set[trump_index]\n self.cards_set.delete_at(trump_index)\n end \n send_update\n return self.trump_card\n end",
"def draw\n raise \"not enough cards\" if @cards.empty?\n @cards.shift\n end",
"def remove\n\t @pieces[chosen] -= 1\n\t update_buttons chosen\n\tend",
"def remove\n @stack.pop\n end"
] | [
"0.83992624",
"0.7904575",
"0.7892877",
"0.7848877",
"0.76699847",
"0.76046175",
"0.7569525",
"0.7489352",
"0.73779875",
"0.73430866",
"0.73252714",
"0.7307331",
"0.72515976",
"0.7188678",
"0.7121172",
"0.7077429",
"0.69806933",
"0.69581836",
"0.6956428",
"0.6951054",
"0.6938792",
"0.6932175",
"0.6900531",
"0.6860524",
"0.68289363",
"0.68201077",
"0.6795353",
"0.6793035",
"0.67912316",
"0.6740751",
"0.67301565",
"0.671446",
"0.66762066",
"0.6675865",
"0.66455966",
"0.66176945",
"0.6615868",
"0.6601419",
"0.6593892",
"0.65825367",
"0.6567745",
"0.65445465",
"0.6533217",
"0.65172696",
"0.65145767",
"0.6512823",
"0.65083754",
"0.6505545",
"0.64994967",
"0.6470607",
"0.6461031",
"0.6460011",
"0.64511013",
"0.644508",
"0.6434935",
"0.64329857",
"0.64242136",
"0.64189506",
"0.6416786",
"0.6399205",
"0.6371625",
"0.63643825",
"0.63602656",
"0.63565326",
"0.6350957",
"0.63394994",
"0.63363934",
"0.63306546",
"0.632132",
"0.63029975",
"0.62978",
"0.6291713",
"0.6279515",
"0.62606364",
"0.6250554",
"0.62494355",
"0.62396294",
"0.6238157",
"0.62210035",
"0.62210035",
"0.6219434",
"0.6184327",
"0.6183912",
"0.61743367",
"0.6173672",
"0.61662054",
"0.61550605",
"0.6150198",
"0.6149148",
"0.61481917",
"0.6144342",
"0.6133163",
"0.6131757",
"0.6130625",
"0.61302346",
"0.61274534",
"0.61224824",
"0.61143583",
"0.6109255",
"0.61048317"
] | 0.78837436 | 3 |
method that adds one card to the bottom (end) of the deck | def add_card(card)
@cards << card
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bottom (card)\n @cards.unshift(card);\n end",
"def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Increase the orders for cards above in the new deck\n cards.each do |r|\n r.update_attributes(card_order: (r.card_order+1) )\n end\n # Add the card to the bottom of the new deck\n card.update_attributes(deck_id: id, card_order: 1)\n end\n end",
"def add_card(card)\n @deck.add(card, :back)\n end",
"def add_cards_to_deck(card)\n @game_deck.deck << card\n end",
"def return_card( card )\n @deck.unshift( card )\n end",
"def add_top (card)\n @cards.push(card);\n end",
"def add_to_deck (suit)\n cards = [2,3,4,5,6,7,8,9,10,'J','Q','K','A']\n cards.each {|val| @deck << Card.new(val, suit)}\n end",
"def add_card(card)\n @addhand = @addhand + card\n end",
"def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend",
"def add_card card\n card.deck = self\n @cards[card.id] = card\n end",
"def add_deck_to_top(add_deck)\n if add_deck.cards and add_deck.id != self.id and add_deck.cards.size > 0\n orig_count = self.cards.size\n add_deck.cards.each do |c|\n c.update_attributes(deck_id: id, card_order: (c.card_order + orig_count))\n end\n end\n end",
"def add_card_to_top(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == get_top_order)\n #Update order of card's current deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Add the card to the top of the new deck\n card.update_attributes(deck_id: id, card_order: (get_top_order+1) )\n end\n end",
"def draw_into(deck)\n card = draw\n deck << card\n card\n end",
"def deal\r\n @deck_of_cards.shift\r\n end",
"def add(card)\n\t\t@hand_contents.push(card)\n\tend",
"def take_card\n @deck.shift\n end",
"def add_card(new_card)\n self.cards.append(new_card)\n end",
"def add_card(new_card)\n cards.push(new_card)\n end",
"def deal\n @deckOfCards.shift\n end",
"def drawcard\n @deck.pop\n end",
"def deal_card\n @deck.pop\n end",
"def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend",
"def deal\n @deck.shift\n end",
"def add_card_to_hand(curr_hand)\n curr_hand.push(get_rand_card)\n end",
"def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end",
"def add_card(card)\n \t@cards << card\n end",
"def add_a_card(card)\n if is_full?\n puts \"Deck is full.You can't add a card\"\n return false\n elsif empty?\n @deck << card\n @added_cards << card\n cards_left\n elsif !find_card(card)\n random = rand(cards_left)\n insert_card(random, card)\n @added_cards << card\n random\n else\n puts \"Can't add a duplicate card to the Deck\"\n return false\n end\n end",
"def add_card(c)\n @cards_showing.push(c)\n @table_size += 1\n end",
"def deal\r\n @cards.shift\r\n end",
"def return(cards)\n @deck += cards\n end",
"def add card\r\n @card_list.add card\r\n end",
"def add_card(card)\n @cards.push\n end",
"def add card\n @cards.push card\n end",
"def add_card(card)\n @cards.push(card)\n end",
"def deal_card(player)\n if !self.is_empty?\n player.hand << cards.pop\n else\n self.initialize(1)\n end\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def addCardToHand(card)\n @hand << card\n end",
"def draw\n @deck.shift\n end",
"def add!(playing_card)\n if playing_card.suit == suit &&\n (\n (playing_cards.empty? && playing_card.rank == 1) ||\n playing_card.rank == (playing_cards.last.rank + 1)\n )\n playing_cards.push(playing_card)\n else\n raise \"Cannot add #{playing_card} to #{self}\"\n end\n end",
"def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to this hand anymore.\"\n \tend\n end",
"def <<(deck)\n @decks << deck\n end",
"def hit!(deck)\n @dealt << deck.cards.shift\n end",
"def hit\n @cards.push @deck.shift\n end",
"def addCard(card)\n\t\t@cards << card\n\t\t@value += getValue(card.rank)\n\t\tif card.rank == 'Ace'\n\t\t\t@hasAce = true\n\t\tend\n\t\tif @cards.length == 2 and @value == 21 and @hasAce # updates should be in different method\n\t\t\t@blackjack = true\n\t\tend\n\t\tif @value > 21 and @hasAce\n\t\t\t@value -= 10\n\t\t\t@hasAce = false\n\t\tend\n\tend",
"def deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\n end",
"def get_card\n @deck.pop\n end",
"def addCardsToHand(cards)\n @hand.concat(cards)\n end",
"def add_cards(cs)\n\t\tcards.concat cs\n\tend",
"def draw\n raise \"not enough cards\" if @cards.empty?\n @cards.shift\n end",
"def addCard(card = Card.new)\n @cards << card\n @cards.sort! #sorts least to greatest\n return self \n end",
"def deal_a_card(players_hand, deck_final)\n players_hand << deck_final.pop\n return players_hand, deck_final\nend",
"def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend",
"def draw_from(deck)\n cards.concat(deck.take(1))\n end",
"def addCardToDeck\n @user = current_user\n card_id = params[:card_id]\n card = MTG::Card.where(id: card_id).all\n card = card[0]\n deck_id = params[:deck_id]\n number = params[:quantity].to_i\n @deck = Deck.find(deck_id)\n\n for i in 1..number\n @deck.cardlist += (card_id + \",\")\n @deck.cardtypes += (card.type + \",\")\n if card.image_url != nil\n @deck.imageurls += (card.image_url + \",\")\n else\n @deck.imageurls += (\"nil,\")\n end\n @deck.cardnames += (card.name + \"%\")\n end\n @deck.save\n\n redirect_back(fallback_location: root_path)\n #redirect_to \"/users/#{@user.id}/decks/#{@deck.id}/edit/1\"\n end",
"def draw_card(number_of_cards)\n for i in 1..number_of_cards\n @hand.push(@deck.pop)\n end\n end",
"def deal\n puts @deck.first\n @deck.shift\n end",
"def add_card(name, suit, rank)\r\n card = Card.new(name, suit, rank)\r\n @cards << card\r\n @order << card.to_s\r\n end",
"def get_card(card)\n @hand.append(card)\n end",
"def draw\n @cards.shift\n end",
"def deal_card\n @cards.pop\n end",
"def take_card(card)\n @cards << card\n end",
"def deal_one\n cards.pop\n end",
"def add card\n if card.is_a? Card\n @hand.push card\n else\n @hand.push Card.new(card)\n end\n\n @analysis = analyse @hand\n end",
"def deal(card)\n\t\[email protected](card)\n\tend",
"def add_card(card)\r\n\t\tcards << card\r\n\t\tcalc_value\r\n\tend",
"def add_to_bottom\n self.position = bottom + 1\n end",
"def draw_card\n self.cards.pop\n end",
"def hit(hand, deck)\n hand.push(deck.pop)\nend",
"def deal_card\r\n\t\tcards.pop\r\n\tend",
"def move_joker_b\n b_pos = $deck.find_index('B')\n $deck.delete('B')\n if b_pos == 51\n $deck << 'B'\n else\n $deck.insert (b_pos + 2) % 53, 'B'\n end\nend",
"def deal()\n card = self.cards.shift()\n raise \"Cannot deal more than 52 cards.\" unless card\n return card\n end",
"def dealSelf(deck)\n \t@hands[0].addCard(deck.removeCard)\n end",
"def add_card(rank)\n @cards << Card.new(rank)\n end",
"def <<(card)\n @cards << card\n end",
"def return(new_cards)\n\n new_cards.each do |card|\n self.deck.push(card)\n end\n\n end",
"def add_card(card)\n raise \"invalid placement!\" unless valid_placement?(card)\n @store << card\n end",
"def deal_into_new_stack(deck)\n deck.reverse\nend",
"def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end",
"def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend",
"def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end",
"def return(cards)\n @stockpile += cards\n end",
"def add_hand(hand)\n @hands << hand\n return @hands[-1]\n end",
"def add_row\n @rows += 1\n @current_cards.push [@deck.removeAny, @deck.removeAny, @deck.removeAny]\n end",
"def return(cards)\n @deck.concat(cards)\n end",
"def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end",
"def draw(amount = 1)\n cards.pop(amount)\n end",
"def add(card)\n return unless card.is_a? Card\n # only allow cards to be added\n @cards << card\n end",
"def draw_card\n #change for chapel if no card to draw\n if ! (top_card = deckcards.find_by(library_position: 1))\n shuffle\n top_card = deckcards.find_by(library_position: 1)\n end\n top_card.status = \"hand\"\n top_card.library_position = nil\n top_card.save\n library.each do |library_member|\n library_member.library_position -=1\n library_member.save\n end\n top_card\n end",
"def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend",
"def draw\n @cards.pop\n end",
"def draw\n # if there are no more cards in the deck,\n # we readd all of the cards and shuffle\n if self.size == 0\n for suit in suits\n for rank in ranks\n self.push(BlackJackCard.new(rank, suit))\n end\n end\n self.shuffle\n end\n return self.shift\n end",
"def deal_card\n @deck.remove(:front)\n end",
"def hit(deck)\n @hand << deck.draw!\n end",
"def add_to_pile_beneath(card)\n @pile_beneath << @pile.remove(card)\n end",
"def draw_cards(count)\n self.deck.shift(count)\n end",
"def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end",
"def take_card\n raise OutOfCardsError if empty?\n @cards.pop\n end"
] | [
"0.8549377",
"0.82762897",
"0.7870316",
"0.73916227",
"0.7202082",
"0.7191213",
"0.71750593",
"0.71626335",
"0.70505977",
"0.70304286",
"0.7019423",
"0.70159894",
"0.70115626",
"0.699303",
"0.6983935",
"0.6910869",
"0.68974435",
"0.68651557",
"0.6864277",
"0.68529093",
"0.6850929",
"0.6847656",
"0.68222326",
"0.67995644",
"0.67777264",
"0.6776971",
"0.6762778",
"0.6737406",
"0.67225075",
"0.67190564",
"0.66868955",
"0.6685818",
"0.66837204",
"0.6679136",
"0.6656963",
"0.6656114",
"0.6656114",
"0.6656114",
"0.664812",
"0.6628133",
"0.66245043",
"0.65897",
"0.65767443",
"0.6555452",
"0.65514535",
"0.65511215",
"0.65477765",
"0.65439785",
"0.650384",
"0.6491967",
"0.64875275",
"0.6481743",
"0.6480389",
"0.6474715",
"0.64725906",
"0.6446335",
"0.64455616",
"0.6430334",
"0.64296675",
"0.6423689",
"0.64043057",
"0.63874924",
"0.6382394",
"0.6375132",
"0.6366096",
"0.63586867",
"0.63433194",
"0.6338251",
"0.6335349",
"0.632732",
"0.6323068",
"0.6321743",
"0.63197005",
"0.6311087",
"0.62892395",
"0.6289229",
"0.6279321",
"0.62750345",
"0.62704855",
"0.6269978",
"0.6268603",
"0.62660444",
"0.62462014",
"0.6245887",
"0.62340903",
"0.62247455",
"0.6207826",
"0.6181255",
"0.6178273",
"0.6169466",
"0.61672986",
"0.61655843",
"0.6154191",
"0.6150733",
"0.61409",
"0.61299634",
"0.6111988",
"0.61021394",
"0.6083464"
] | 0.67092746 | 31 |
create seo attributes with options + default attributes | def cama_build_seo(options = {})
options[:image] = current_site.get_option("screenshot", current_site.the_logo) unless options[:image].present?
options[:title] = current_site.the_title unless options[:title].present?
options[:description] = current_site.the_option("seo_description") unless options[:description].present?
options[:url] = request.original_url
options[:keywords] = current_site.the_option("keywords") unless options[:keywords].present?
s = {
keywords: options[:keywords],
author: current_site.get_option('seo_author'),
icon: current_site.the_icon,
og: {
title: options[:title],
description: options[:description],
type: 'website',
url: options[:url],
image: options[:image]
},
twitter: {
card: 'summary',
title: options[:title],
description: options[:description],
url: options[:url],
image: options[:image],
site: current_site.get_option('twitter_card'),
creator: current_site.get_option('twitter_card'),
domain: request.host
},
alternate: [
{ type: 'application/rss+xml', href: cama_rss_url }
]
}.merge(options.except(:object))
l = current_site.get_languages
if l.size > 1
l.each do |lang|
s[:alternate] << {
href: current_site.the_url(locale: lang),
hreflang: lang
}
end
end
# call all hooks for seo
r = { seo_data: s, object: options[:object] }
hooks_run('seo', r)
r[:seo_data]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes_options(options)\n html_options = options.stringify_keys!\n self.default_options = {'data-role' => \"listview\", 'data-inset' => \"true\"}\n\n if html_options.has_key?('data-inset')\n self.default_options = default_options.merge({'data-inset' => html_options['data-inset']})\n end\n\n if html_options.has_key?('data-theme')\n self.default_options = default_options.merge({'data-theme' => html_options['data-theme']})\n end\n\n if html_options.has_key?('data-rel')\n self.default_options = default_options.merge({'data-rel' => html_options['data-rel']})\n end\n\n if html_options.has_key?('data-transition')\n self.default_options = default_options.merge({'data-transition' => html_options['data-transition']})\n end\n\n end",
"def create_attribute options\n attributes = options[ :attributes ]\n attr_value = options[ :value ]\n attributes.each do | attr_name |\n self.class.class_eval do\n define_method attr_name do\n instance_variable_get \"@#{ attr_name }\"\n end\n define_method \"#{ attr_name }=\" do | value |\n instance_variable_set( \"@#{ attr_name }\", value )\n end\n end\n self.public_send( \"#{ attr_name }=\", attr_value )\n end\n end",
"def init(options = {})\n\t\tdefaults = {:year => Constant.constants[:cur_year], :status => 'Accepted', :id=>Mentee.new_id}\n \t\toptions = defaults.merge(options)\n \t\tputs options\n\t \toptions.keys.each do |attribute|\n\t \tself[attribute] = options[attribute] \t\n\t \tend\n\t \t#puts self.attributes\n\tend",
"def default_sg_attributes\n {\n security_group_id: 'sg-00000000',\n name: 'A fake sg',\n description: 'A fake sg',\n owner_id: 'fakeownerid',\n vpc_id: 'fakevpc'\n }\n end",
"def prepared_attributes_for_essence\n attributes = {\n ingredient: default_text(definition['default'])\n }\n attributes\n end",
"def tool_attributes(overrides = {})\n {\n name: \"Pros and Cons\",\n description: \"Weighing up pros and cons can speed up the decision-making process,\n improve your understanding of the situation and help you avoid decision-making\n paralysis.\",\n price: 10.00\n }.merge(overrides)\nend",
"def make_builder_settings(extra_settings = {})\n opts = super\n opts[:auto_inventory_attributes] = false\n opts\n end",
"def attr_options name, options = {}\n @attr_options ||= {}\n @attr_options[name] = options\n end",
"def attributes=(_arg0); end",
"def new_option(opts = {})\n Survey::Option.new(option_attributes.merge(opts))\nend",
"def prepared_attributes_for_essence\n attributes = {\n ingredient: default_text(description['default'])\n }\n attributes\n end",
"def generate_attributes(name = default_fauxture_name)\n Sweatshop.attributes(self, name)\n end",
"def options\n attributes.fetch(:options)\n end",
"def assign_tag_attrs(attributes)\n # support default data, class, and aria attribute names\n data_attr(attributes.delete(:data)) if attributes[:data]\n aria_attr(attributes.delete(:aria)) if attributes[:aria]\n add_class(*attributes.delete(:class)) if attributes[:class]\n root_attr(attributes.delete(:splat)) if attributes[:splat]\n end",
"def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end",
"def tag_attributes(options)\n return '' unless options\n options.inject('') do |all,(key,value)|\n next all unless value\n all << ' ' if all.empty?\n all << if value.is_a?(Hash)\n nested_values(key, value)\n elsif BOOLEAN_ATTRIBUTES.include?(key)\n %(#{key}=\"#{key}\" )\n else\n %(#{key}=\"#{escape_value(value)}\" )\n end\n end.chomp!(' ')\n end",
"def initialize(options={})\n @attributes = options\n end",
"def initialize *args\n @attributes = {}\n opts = args.last.is_a?(Hash) ? args.pop : {}\n each_with_index { |(name, _), i| send \"#{name}=\", args[i] } unless args.empty?\n opts.each { |name, value| send \"#{name}=\", value }\n end",
"def initialize(args={})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def set_options(markup, options)\n @_options = { id: 'nav', class: '', active_class: 'on', bootstrap: false, no_wrapper: false }\n\n markup.scan(::Liquid::TagAttributes) { |key, value| @_options[key.to_sym] = value.gsub(/\"|'/, '') }\n\n @_options[:exclude] = Regexp.new(@_options[:exclude]) if @_options[:exclude]\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize attr={}\n super\n self.attributes = attr\n end",
"def attrs\n @options[:attrs]\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def default_attributes(custom = {})\n {}\n end",
"def set_attributes(options)\n @options.keys.each do |opt_name|\n instance_variable_set(\"@#{opt_name}\", options[opt_name])\n end\n end",
"def initialize\n super\n self.class.attributes.reject { |attr| attr.default.nil? }.each do |attr|\n send(\"#{attr.method_name}=\", attr.default)\n end\n end",
"def construct_data\n add_properties(@adv_settings, :if_missing)\n super\n end",
"def attrs_or_default(attrs)\n options = attrs.extract_options!\n attrs = yield if attrs.blank?\n attrs << options\n end",
"def option_attributes\n @option_attributes || {}\n end",
"def options\n options = {}\n attributes_for(self).each do |p|\n option = self.send(p.to_sym) \n options[p] = option unless option.nil?\n end\n options\n end",
"def attributes(options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes if @attributes\n\t\t\t@attributes = {}\n\t\t\[email protected] do |value|\n\t\t\t\t@attributes[value[:name]] = value.evaluate(@node, :attrs => true)\n\t\t\t\t@attributes[value[:name]].strip! if options[:strip]\n\t\t\t\t@attributes[value[:name]] = nil if @attributes[value[:name]].blank? && options[:null_if_blank]\n\t\t\tend\n\t\t\t@attributes\n\t\tend",
"def senior_attributes=(attributes)\n unless attributes.blank?\n self.senior = attributes\n # * TODO: check if this is still required\n # attributes.each {|_key, _value| self.senior.send(\"#{_key}=\", _value) }\n [\"vip\", \"demo_mode\"].each {|e| self.senior.send(\"#{e}=\", [\"1\", \"true\", \"yes\"].include?( attributes[e] ) )}\n end\n senior\n end",
"def initialize (options = {})\n options.each do |attribute, value|\n self.send(\"#{attribute}=\", value)\n end\n end",
"def merge_attributes(data)\n data.fetch(\"default\", {})\n .merge(data.fetch(\"normal\", {}))\n .merge(data.fetch(\"override\", {}))\n .merge(data.fetch(\"automatic\", {}))\n end",
"def create_attributes(color)\n if weekend? && !self.today?\n color = TODAY_BACKGROUND_COLOR\n color = color.colorWithAlphaComponent(0.2) unless self.active?\n end\n {\n NSFontAttributeName => DEFAULT_FONT,\n NSForegroundColorAttributeName => color,\n NSParagraphStyleAttributeName => PARAGRAPH_STYLE\n }\n end",
"def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end",
"def initialize(options={})\n options.each do |attr, value|\n self.send((\"#{attr}=\"), value) if self.respond_to?(attr.to_sym)\n end\nend",
"def add_options; end",
"def attribute(opts)\n raise ArgumentError unless opts.is_a?(Hash)\n @attributes << Attribute.new(opts)\n end",
"def __strval_optkeys\n super() << 'selectcolor' << 'title'\n end",
"def set_default_options(options = nil)\n #give some sensical options instead of blank elements\n @options = Hash.new\n @options[:default_title] = \"My Awesome Title\"\n @options[:default_link] = \"http://default.wordpress.com\"\n @options[:default_description] = \"My Awesome Description\"\n @options[:pub_date] = \"Tue, 10 Mar 2009 00:12:59 +0000\"\n @options[:base_blog_url] = \"http://default.wordpress.com\"\n @options[:creator] = \"Hiro\"\n end",
"def create_standard_options\n option_separator\n option_separator 'Standard options:'\n option_config_name\n option_logging\n end",
"def build_options(node)\n options = {}\n node.elements.each(\"option\") do |option|\n options[attr(option, :name)] = attr(option, :value)\n end\n options\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 build_price_attributes(options)\n # convert all options to string values\n options.each_value {|option| option = options.to_s}\n\n rate_attributes = {\n :RatingServiceSelectionRequest => {\n :Request => {\n :RequestAction => 'Rate',\n :RequestOption => 'Rate',\n :TransactionReference => {\n :XpciVersion => '1.0'}\n },\n :PickupType => {\n :Code => '01'\n },\n :CustomerClassification => {:Code => '01'},\n :Shipment => {\n :Shipper => @rate_from_attributes,\n :ShipTo => {:Address => {\n :City => options[:city],\n :StateProvinceCode => options[:state],\n :PostalCode => options[:zip],\n :CountryCode => options[:country_code]}\n },\n :Service => {:Code => '03'},\n :Package => {:PackagingType => {:Code => '02'},\n :PackageWeight => {:Weight => options[:weight], :UnitOfMeasurement => 'LBS'}\n }\n } \n }\n }\n end",
"def options_to_attributes(opts)\n opts.each do |key, value|\n setter = key.to_s.concat('=')\n next if value.nil?\n next unless self.class.public_method_defined?(setter)\n\n self.__send__(setter, value)\n end\n end",
"def initialize(options)\n @attributes = Array.wrap(options[:attributes])\n raise \":attributes cannot be blank\" if @attributes.empty?\n @options = options.freeze\n end",
"def generate_seo_option_name\n self.name = self.name.to_url\n end",
"def define_attribute_methods(name, options) # :nodoc:\n define_method name do\n attributes[name] || options[:default]\n end\n\n define_method \"#{name}=\" do |object|\n attributes[name] = object\n end\n\n self.attribute_options[name] = options\n end",
"def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end",
"def attributes\n @attributes = {\n \"placa\" => placa,\n \"UF\" => UF\n }\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs = {})\n super(attrs)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def prepare_attribute!(_element, _options)\n end",
"def default_chart_attributes(attrs={})\n return @chart_attributes if attrs.empty?\n # if superclass.respond_to? :chart_attributes \n # keys = attrs.keys + (superclass.chart_attributes || [])\n # else\n # keys = attrs.keys\n # end\n \n # chart attributes method\n meta_def :chart_attributes do \n if superclass.respond_to? :chart_attributes\n # if we have attrs in the super class, union them with this\n attrs.keys | (superclass.chart_attributes || [])\n else\n attrs.keys\n end\n end\n \n # accessors for the attributes/keys\n attrs.keys.each do |sym|\n module_eval(<<-EVAL, __FILE__, __LINE__)\n def #{sym}; @#{sym}; end\n \n def #{sym}=(value)\n @#{sym} = value\n end\n EVAL\n end\n \n # set the defaults\n class_eval do\n define_method :initialize do |*options|\n super rescue super() # call to super\n # set instance variables for the attributes\n attrs.each do |k,v|\n # FIXME: we call dup here, which means that we have one extra class instance defined for every call. Ugh.\n v = v.dup unless %w(NilClass Fixnum TrueClass FalseClass Float).include? v.class.name \n instance_variable_set( \"@#{k}\", v )\n end\n # Provides a way to pass a hash of values to the initialize method\n # of a class and have any keys that are attributes of that class\n # sent to the class with the corresponding value.\n #\n # example = SomeClass.new(:name => 'Buckaroo', :girlfriend => 'Penny Priddy')\n # Would set example.name = 'Buckaroo' and example.girlfriend = 'Penny Priddy'\n #\n # Skips any keys that aren't attributes of the class.\n # Provides an options attribute to retrieve the passed in hash \n opts = options.first || Hash.new\n opts.each do |k,v| \n # use send rather than instance_variable so we can get aliased methods/attributes\n self.send(\"#{k.to_sym}=\",v) if self.respond_to? k.to_sym\n # instance_variable_set( \"@#{k}\", v ) \n end \n end\n # method to return a hash of attributes and values\n define_method :chart_attribute_values do\n self.class.chart_attributes.inject({}) do |values, name|\n values[name.to_s] = instance_variable_get(\"@#{name}\")\n values\n end \n end\n end\n \n end",
"def initialize_attributes()\n @attributes ||= {}\n merged_attributes = {}\n defaults = self.class.schema.defaults(self)\n\n # Merge the defaults in where attributes don't have a value defined.\n defaults.each do |name, value|\n merged_attributes[name] = attributes[name] || value\n end\n @attributes = merged_attributes\n end",
"def initialize(options={})\n #if nothing is passed, it's an empty hash\n options.each do |property, value|\n self.send(\"#{property}=\", value)\n end\n #this works together with the attributes. the attributes are already created with attr_accessor...\n #now u just assign values to these attributes\n #send does that(but can do other things). \n #ex: x.send(\"name=\", \"beyonce\") sets the attribute name to beyonce\n end",
"def tag_attributes\n attrs = {}\n @opts.each_pair{|k, v| attrs[k.to_s] = v.to_s}\n attrs[\"src\"] = image_url\n attrs.reject{|k,v| %w(host scheme).include? k.to_s}\n end",
"def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end",
"def initialize_attributes(attributes); end",
"def generate_options(action, xml, extra_params={})\n opts = extra_params || {}\n\n if EC2[action][:args]\n EC2[action][:args].each {|k,v|\n str = ec2_value(xml, k, &v[:proc])\n if str\n tmp = opts\n last_key = nil\n v[:opt].split('/').each { |key|\n k = key.to_sym\n tmp = tmp[last_key] if last_key\n tmp[k] = {}\n last_key = k\n }\n tmp[last_key] = str\n end\n }\n end\n\n opts\n end",
"def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end",
"def method_missing( symbol, *arguments )\n if symbol.to_s =~ /(.+)=/ && arguments.size == 1 then\n @attributes[ $1.to_sym ] = arguments.first\n elsif @attributes.has_key?( symbol ) && arguments.empty? then\n @attributes[ symbol ]\n else\n super symbol, arguments\n end\n end",
"def initialize(args = {})\n # We must set flags before the other values\n @flags = [false, false, false, false]\n update_attributes(ATTR_DEFAULTS.merge(args))\n end",
"def haml_attribute_pair(name, value, options)\n value = dynamic_attribute?(name, options) ? dynamic_attributes[name] : value.inspect\n if options[:html_style_attributes]\n \"#{name}=#{value}\"\n else\n name = name.index(/\\W/) ? name.inspect : \":#{name}\"\n \"#{name} => #{value}\"\n end\n end",
"def html_options\n { :class => attribute }\n end",
"def as_json(options = {})\n attrs = super.except('client_id')\n\n attrs[:client_id] = client.user_id\n attrs[:operator_id] = operator.user_id\n\n if options\n if options[:client]\n attrs[:client] = client.user \n end\n if options[:operator]\n attrs[:operator] = operator.user\n end\n if options[:store] && store\n attrs[:store] = store.as_json(only: [:id, :name])\n end\n if options[:loyalty_program] && loyalty_program\n attrs[:loyalty_program] = loyalty_program.as_json(only: [:id, :name]) \n end\n if options[:promotion] && promotion\n attrs[:promotion] = promotion.as_json(only: [:id, :name]) \n end\n if options[:client_point] && client_point\n attrs[:points] = client_point.initial_points\n end\n end\n\n return attrs\n end",
"def normalize_options\n copy_options_to_attributes(ATTRIBUTE_OPTIONS)\n copy_boolean_options_to_attributes(ATTRIBUTE_BOOLEAN_OPTIONS)\n handle_key_option\n handle_errors_option\n\n Forme.attr_classes(@attr, @opts[:class]) if @opts.has_key?(:class)\n\n if @opts[:error]\n Forme.attr_classes(@attr, 'error')\n @attr[\"aria-invalid\"] = \"true\"\n if @opts.fetch(:error_handler, true)\n if @opts[:error_id]\n @attr['aria-describedby'] ||= @opts[:error_id]\n else\n if id = @attr[:id] || @attr['id']\n error_id = @attr['aria-describedby'] ||= \"#{id}_error_message\"\n @opts[:error_id] = error_id\n end\n end\n end\n end\n\n if data = opts[:data]\n data.each do |k, v|\n k = k.to_s.tr(\"_\", \"-\") if k.is_a?(Symbol) && input.opts[:dasherize_data]\n sym = :\"data-#{k}\"\n @attr[sym] = v unless @attr.has_key?(sym)\n end\n end\n end",
"def tag_options\n {}\n end",
"def force_singular\n AttributeOptions.new(type: type, hashable: hashable)\n end",
"def container_attributes\r\n\t\t\t{ class: 'grapple' }\r\n\t\tend",
"def post_code_attribute_set(instance, name, attributes)\n self.default_attribute_set(instance, name, attributes)\n end",
"def maxwell_model_attributes\n attrs = basic_attributes\n\n if attrs[:client_type] == :person\n attrs.merge!(names_from_social_reason)\n else\n attrs[:company_name] = self.RazonSocial\n end\n\n attrs\n end",
"def initialize\n @options = {}\n @options[:extra] = true\n end",
"def add_attribute(name, &block); end",
"def initialize options={}\n options.each_pair do |att_name, att_val|\n instance_variable_set(\"@#{att_name}\", att_val)\n end\n end",
"def create_datetime_options(attrs, method = nil)\n values = if (time = attrs[:value])\n case time\n when Time, DateTime\n { :day => time.day,\n :month => time.month,\n :year => time.year,\n :hour => time.hour,\n :minute => time.min }\n when Date\n { :day => time.day,\n :month => time.month,\n :year => time.year }\n end\n end\n\n datetime_options.inject({}) do |h, (suffix, defaults)|\n h[suffix] = defaults.merge(attrs).merge(\n :id => '%s_%s' % [attrs[:id] || attrs[:name], suffix],\n :name => '%s[%s]' % [attrs[:name] || attrs[:id], suffix],\n :value => values && values[suffix]\n ) ; h\n end\n end",
"def chef_set_client_attributes(name, attributes={})\n @chef_client_attributes = (@chef_client_attributes || {}).merge(attributes) { |k,o,n| (k = (o + n)) }\n end",
"def html_attributes(attr); end",
"def initialize(*attrs)\n options = attrs.empty? ? {} : attrs.first\n options = self.class.defaults.merge(options)\n set_instance_variables options\n end",
"def attr(name); end",
"def set_default_options\n end",
"def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end",
"def setup_object_attributes; end",
"def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end"
] | [
"0.64910275",
"0.6320029",
"0.6137898",
"0.6031069",
"0.5932591",
"0.58328396",
"0.58277667",
"0.5821638",
"0.581378",
"0.58037084",
"0.57967025",
"0.5790875",
"0.5789192",
"0.5751775",
"0.5727037",
"0.5687015",
"0.5685451",
"0.5669663",
"0.56654084",
"0.5626645",
"0.5611722",
"0.5611722",
"0.5611722",
"0.5611722",
"0.5611722",
"0.5611722",
"0.5596812",
"0.5577379",
"0.5573561",
"0.5573561",
"0.5553028",
"0.55493706",
"0.5489245",
"0.5470852",
"0.54676366",
"0.5467507",
"0.54354095",
"0.54265463",
"0.5421092",
"0.5409361",
"0.5398884",
"0.5393327",
"0.5387682",
"0.53852856",
"0.5383571",
"0.5370446",
"0.5370256",
"0.5358843",
"0.5357815",
"0.5343513",
"0.5343078",
"0.5340961",
"0.5340153",
"0.53360355",
"0.5328375",
"0.53055173",
"0.5302633",
"0.5302422",
"0.5299811",
"0.5299811",
"0.5299811",
"0.5299811",
"0.5296203",
"0.5294834",
"0.5294834",
"0.5294834",
"0.5294834",
"0.5294834",
"0.52915806",
"0.5289446",
"0.5286593",
"0.52865916",
"0.5281204",
"0.5279457",
"0.52665156",
"0.52659893",
"0.52634084",
"0.5260135",
"0.5259035",
"0.5254119",
"0.5237941",
"0.5236298",
"0.5235225",
"0.5233943",
"0.5230226",
"0.5225589",
"0.52229196",
"0.5215537",
"0.52085423",
"0.520784",
"0.5207527",
"0.5205273",
"0.5201936",
"0.5196055",
"0.51950437",
"0.5190717",
"0.5188657",
"0.51870465",
"0.51854926",
"0.51823777"
] | 0.540985 | 39 |
Remove any color codes from _text_. | def strip_color(text)
text.to_s.gsub(/(\001)?\e\[.*?(\d)+m(\002)?/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_color_codes(text); end",
"def strip_color_codes(text)\n text.gsub(/\\e\\[(\\d+)(;\\d+)*m/, '')\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/ , '')\n end",
"def remove_colors\n gsub(/\\e\\[\\d+m/, '')\n end",
"def strip_color\n return self.gsub(/\\e\\[0;[39]\\d;49m/, '').gsub(/\\e\\[0m/, '')\n end",
"def strip_color\n gsub(COLOR_REGEXP, '')\n end",
"def strip_colors\n self.class.new self.raw.gsub(/\\x03(?:[019]?[0-9](?:,[019]?[0-9])?)?/, \"\")\n end",
"def remove_colors(data)\n data.gsub(/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/, \"\")\n end",
"def decolorize!\n gsub!(/\\e\\[\\d+[;\\d]*m/, '')\n self\n end",
"def uncolored(text = nil)\n if block_given?\n uncolorize(yield)\n elsif text\n uncolorize(text)\n elsif respond_to?(:to_str)\n uncolorize(to_str)\n else\n ''\n end\n end",
"def colorize_without_wrapper(text)\n if text = colorize(text)\n text[%r{<div class=\"highlight\"><pre>(.*?)</pre>\\s*</div>}m, 1]\n else\n ''\n end\n end",
"def decolorize!\n gsub! /\\e\\[\\d+[;\\d]*m/, ''\n self\n end",
"def clean(message)\n message = message.to_s.strip\n message.gsub!(/\\e\\[[0-9;]*m/, '') # remove useless ansi color codes\n message\n end",
"def decolorize\r\n self.gsub(/\\[0;\\d\\d;\\d\\dm([^\\[]*)\\[0m/) { $1 }\r\n end",
"def decolorize\r\n self.gsub(/\\[0;\\d\\d;\\d\\dm([^\\[]*)\\[0m/) { $1 }\r\n end",
"def uncolorize(string)\n string.gsub(/\\e\\[(\\d+)(;(\\d+))*m/, '')\n end",
"def escape_text\n color.strip text.dup\n end",
"def scrub_text(text)\n TEXT_GSUBS.inject(text) { |memo, sub| memo = memo.gsub(*sub) }\n end",
"def plain_text\n self.gsub(/\\e\\[[0-9]m|\\e\\[[34][0-7]m/, '')\n end",
"def uncolor(string)\n Style.uncolor(string)\n end",
"def clean_text(text)\n lines = text.strip.each_line\n lines = lines.reject { |line| SOURCE_LINE =~ line }\n lines.join.strip.delete(\"\\r\")\n end",
"def text_only\n @text_only = @text.gsub(@@PRIREG, '')\n #.gsub(@@CONREG, '').gsub(@@PROREG, '')\n end",
"def uncolored\n map {|n| n.to_s.uncolored}\n end",
"def clear_text(text)\n text = text.tr(\"\\n\", \" \")\n text.gsub(/[^0-9A-Za-z. ]/, '')\n end",
"def clean_text(text)\n text.gsub!(/\\r\\n/, '')\n text.gsub!(/\\r/, '')\n text\n end",
"def strip_ansi(str)\n str.gsub(\n ANSI_MATCHR, \"\"\n )\n end",
"def uncolor(string=nil, &block)\n if block_given?\n block.call.to_str.gsub(ANSI_REGEX, '')\n elsif string.respond_to?(:to_str)\n string.to_str.gsub(ANSI_REGEX, '')\n elsif respond_to?(:to_str)\n to_str.gsub(ANSI_REGEX, '')\n else\n ''\n end\n end",
"def sanitize text\n [' ', '\\r\\n', \"\\r\\n\", \"\\n\", \"\\r\", \"\\t\", / ^/, / $+/, /^ /, /^ /].each { |text_to_remove|\n text.gsub!(text_to_remove,'')\n }\n return text\n end",
"def unansi(string)\n string.gsub(PATTERN, '')\n end",
"def colorize(text)\n Albino.new(text, self).colorize(:O => 'stripnl=false')\n end",
"def strip_bbcode(text)\n text.gsub!(\"[code]\", \"\")\n text.gsub!(\"[/code]\", \"\")\n text.gsub!(\"8\", \"8\") \n text.gsub!(\"[\", \"[\")\n text.gsub!(\"]\", \"]\")\n text.gsub!(\".\", \".\")\n text.gsub!(\":\", \":\")\n text.gsub!(\";)\", \";)\")\n \n return text \n end",
"def strip_ansi(str)\n str.gsub(ANSI, '')\n end",
"def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^\\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\\s+$/, empty)\n end",
"def clean_text(text)\n text = strip_html_quote_entities(text)\n text = Helper::Text.strip_html_tags(text)\n text = strip_copyright_text(text)\n text.strip!\n text = Helper::Text.clean_verse_start(text)\n text = Helper::Text.clean_verse_end(text)\n end",
"def extract_text(text)\n text\n .gsub(/(?:\\e|\\033)\\[\\d+(?>(;\\d+)*)m/, \"\")\n .gsub(/\\\\\\[|\\\\\\]/, \"\")\n .gsub(/\\007|\\016|\\017/, \"\")\n end",
"def filter_out(str)\n return \"\" if str.nil? || str.empty?\n if @pstack.color_on\n str.gsub!(/\\[COLOR\\s+(\\w+)\\s+ON\\s+(\\w+)\\]/mi) do |m|\n if ColorTable[$1] && ColorTable[$2]\n ColorTable[$1][2]+ColorTable[$2][3]\n else\n ''\n end\n end\n str.gsub!(/\\[COLOR\\s+(\\w+)\\]/mi) do |m|\n if ColorTable[$1]\n ColorTable[$1][2]\n else\n ''\n end\n end\n str.gsub!(/\\[\\/COLOR\\]/mi) do |m|\n ANSICODE['reset']\n end\n str.gsub!(/\\[[BI]\\]/mi) do |m|\n ANSICODE['bold']\n end\n str.gsub!(/\\[U\\]/mi) do |m|\n ANSICODE['underline']\n end\n str.gsub!(/\\[\\/[BUI]\\]/mi) do |m|\n ANSICODE['reset']\n end\n else\n str.gsub!(/\\[COLOR\\s+(\\w+)\\s+ON\\s+(\\w+)\\]/mi,'')\n str.gsub!(/\\[COLOR\\s+(\\w+)\\]|\\[\\/COLOR\\]/mi, '')\n str.gsub!(/\\[SIZE .*?\\]|\\[\\/SIZE\\]/mi, '')\n str.gsub!(/\\[FONT .*?\\]|\\[\\/FONT\\]/mi, '')\n str.gsub!(/\\[[BUI]\\]|\\[\\/[BUI]\\]/mi, '')\n end\n str\n end",
"def strip(string)\n string.to_s.gsub(/(\\[)?\\033(\\[)?[;?\\d]*[\\dA-Za-z](\\])?/, '')\n end",
"def process_text text, color = \"#000000\"\n end",
"def safe_colorize(text, color=nil)\n CLIColorize.safe_colorize(text, color)\n end",
"def decolorize_maybe(str)\n if _pry_.config.color\n str\n else\n Helpers::Text.strip_color str\n end\n end",
"def sanitize(string)\n string.gsub(ANSI_MATCHER, \"\")\n end",
"def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end",
"def remove_nonprinting_chars(text)\n return text if text.blank?\n\n text.chars.map { |char| rejected_char?(char) ? ' ' : char }.join\n end",
"def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend",
"def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend",
"def strip_ansi(str)\n str.gsub(/\\e\\[(?:\\d+)(?:;\\d+)?m/, \"\")\n end",
"def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"def strip_redcloth_html(html)\n returning html.dup.gsub(html_regexp, '') do |h|\n redcloth_glyphs.each do |(entity, char)|\n sub = [ :gsub!, entity, char ]\n @markup_handle_unicode ? h.chars.send(*sub) : h.send(*sub)\n end\n end\n end",
"def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"def strip_copyright_text(text)\n text.gsub(COPYRIGHT_TEXT_REGEX, '')\n end",
"def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n text.gsub(/^\\s*(#+)/) { $1.tr '#',' ' }\n end",
"def clean(text)\n ctext = text.gsub(/[^\\p{Latin}0-9']/, ' ')\n ctext.gsub!(\"'\", \"' \")\n ctext\n end",
"def scrub(text)\n return '' unless text.present?\n\n text.to_s.gsub(/[\\r\\n]/, ' ').gsub('%', '%25')\n end",
"def uncolorize\n @uncolorized || self\n end",
"def filter_text txt\n txt.split(\"\\n\").reject { |l| l =~ /^[ ]*$/ or l =~ /^[ ]*#(.*?)$/ }\n end",
"def filter text\n if width + @font.text_width(text) < 133\n return text.gsub(/[^A-Z0-9a-z ]/, '')\n else \n return nil\n end\n end",
"def remove_coding_comment text\n text.sub(/\\A# .*coding[=:].*$/, '')\n end",
"def smooth_offtags( text )\n unless @pre_list.empty?\n ## replace <pre> content\n text.gsub!(/<redpre#(\\d+)>/) do\n content = @pre_list[$1.to_i]\n if content.match(/<code\\s+class=\"(\\w+)\">\\s?(.+)/m)\n content = \"<code class=\\\"#{$1} syntaxhl\\\">\" + \n Redmine::SyntaxHighlighting.highlight_by_language($2, $1)\n end\n content\n end\n end\n end",
"def raw\n parsed_colors[:string].uncolor\n end",
"def reset_color(text)\n deprecation('UI.reset_color(text) is deprecated, please use color(text, ' ') instead.')\n color(text, '')\n end",
"def uncolor(string = T.unsafe(nil)); end",
"def uncolor(string = T.unsafe(nil)); end",
"def clean_up_text\n text.gsub!(/<br/, \"\\n<br\")\n text.gsub!(/<p/, \"\\n<p\")\n text.gsub!(/<\\/?span(.*?)?>/, '')\n text.gsub!(/<\\/?div(.*?)?>/, '')\n end",
"def no_color\n reset_prev_formatting self, :color\n end",
"def sanitze_for_chat(text)\n # Remove bash colorings\n o = text.gsub(/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, '')\n # Limit text to 50 lines\n o = (o.lines.to_a[0...49] << \"\\n... truncated to 50 lines\").join if o.lines.size > 50\n # return the output\n o\n end",
"def remove_urls(text)\n text.gsub!(/#{URI::regexp}/, '')\n text\n end",
"def sanitize_text(text)\n text = unescape_text(text)\n text = extract_text(text) if aruba.config.remove_ansi_escape_sequences\n\n text.chomp\n end",
"def remove_nonprintable!\n replace(remove_nonprintable)\n end",
"def colorize(text, color_code)\n \"#{color_code}#{text}\\e[0m\"\nend",
"def create_cleared_text(s)\n s.gsub(/[RMQ]T @[a-zA-Z0-9_]+:.*/, '')\n .gsub(/\\. ?(@[a-zA-Z0-9_]+ )+/, '')\n .gsub(/@[a-zA-Z0-9_]+/, '')\n .gsub(%r[(https?|ftp)(:\\/\\/[-_.!~*\\'()a-zA-Z0-9;\\/?:\\@&=+\\$,%#]+)], '')\n .gsub(/#.+([ 、。]|$)/, '')\n .strip\n end",
"def sanitize_text(text)\n doc = Nokogiri::HTML.fragment(text)\n UNSUPPORTED_HTML_TAGS.each do |tag|\n doc.search(tag).each(&:remove)\n end\n doc.inner_html\n end",
"def clean text\n text.gsub(/(\\n|\\t|\\r)/, ' ').gsub(/>\\s*</, '><').squeeze(' ')\n end",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def remove_styles\n\n\t\tif self.about\n\t\t self.about = self.about.gsub(/font-family[^;]*;/,'')\n\t\t self.about = self.about.gsub(/font-size[^;]*;/,'')\n\t\t self.about = self.about.gsub(/background[^;]*;/,'')\n\t\t self.about = self.about.gsub(/color[^;]*;/,'')\n\t\t self.about = self.about.gsub(/border[^;]*;/,'')\n\t\tend\n\tend",
"def red(text)\n colorize text, \"\\033[1;31m\"\n end",
"def safe_colorize_deactive\n CLIColorize.off\n end",
"def sanitize(text)\n sanitized_text = text.dup\n\n # Strip URLs\n sanitized_text.gsub!(URL_REGEX, '')\n\n # Strip @mention style tokens\n sanitized_text.gsub!(MENTION_REGEX, '')\n\n sanitized_text\n end",
"def text_urgent(text); text_green(text);end",
"def cleanText(txt)\r\n clean = txt.gsub(\"<\", \"<\")\r\n clean.gsub!(\">\", \">\")\r\n\r\n puts \"cleaned text: #{txt} -> #{clean}\" if $DEBUG\r\n clean\r\n\r\n end",
"def colorize(text, color_code)\n \"#{color_code}#{text}\\033[0m\"\n end",
"def clean_text\n text.tr(\"'@_\", '').gsub(/\\W/, ' ').gsub(/[0-9]/, '').downcase\n end",
"def cleanup(text)\n text.gsub(/[^a-z]/i, '')\nend",
"def colorize txt, fg, bg, flags\n txt\n end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def remove_lines(text)\n text.gsub(/\\n/, '')\n end",
"def text_colors\n @colors = {\n red: 31,\n yellow: 33,\n green: 32\n }\n end",
"def stripsub(text)\n return (text.strip).gsub(\"'\",\"''\").gsub(\"’\", \"''\")\n end",
"def erubis_filter(text)\n return text if text.nil?\n \n t = text.dup\n t.gsub!('<%', '<%')\n t.gsub!('%>', '%&rt;')\n t\n end",
"def color(text)\n \"\\e[31m#{text}\\e[0m\"\n end",
"def strip_html_tags(text)\n return text.gsub!(/(<[^>]*>)|\\n|\\t/s) {\" \"}\n end",
"def colorize(text, color_code)\n if windows?\n text\n else\n \"\\e[#{color_code}m#{text}\\e[0m\"\n end\n end",
"def red(text)\n colorize(text, 31)\nend",
"def white\n colorize(37)\n end",
"def strip_bad_chars(text)\n text.gsub!(/\"/, \"'\");\n text.gsub!(/\\u2018/, \"'\");\n text.gsub!(/[”“]/, '\"');\n text.gsub!(/’/, \"'\");\n return text\nend",
"def reset_prev_formatting(str, type)\n case type\n when :color\n str = str.gsub(\"\\e[1m\", '').gsub(/\\e\\[[3][0-7]m/, '')\n when :bg_color\n str = str.gsub(/\\e\\[[4][0-7]m/, '')\n when :underline\n str = str.gsub(\"\\e[4m\", '')\n when :strikethrough\n str = str.gsub(\"\\e[9m\", '')\n end\n\n # Remove ANSI termination characters from `str`.\n str = str.gsub(\"\\e[0m\", '')\n\n # Hack! Add ANSI termination character at the end of `str` if `str`\n # contains any fancy stuff added by term colorizer methods before.\n if str.scan(/\\e\\[[1-9]/).any?\n str = str + \"\\e[0m\" unless str.end_with? \"\\e[0m\"\n end\n\n return str\n end",
"def remove_nonprintable\n gsub(/[^[:print:]\\n\\t]/i, '')\n end",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\n end",
"def text_only(html)\n Nokogiri::HTML.parse(html).text.gsub(/\\A\\p{Space}+|\\p{Space}+\\z/, '')\n .strip\n end",
"def clean_text(datacontent)\n return datacontent.gsub(/[^a-z0-9]/i, \"\").downcase\nend",
"def select_odd_chars(text)\n text.gsub(/(?!&)([[:punct:]])\\u200c/, \"\\\\1\")\n end"
] | [
"0.879744",
"0.8459457",
"0.83087665",
"0.7689787",
"0.7493423",
"0.733087",
"0.7223662",
"0.71777344",
"0.7055508",
"0.7013991",
"0.69740856",
"0.6934507",
"0.6890726",
"0.6877144",
"0.6877144",
"0.68487966",
"0.6791423",
"0.6777379",
"0.6740813",
"0.6739731",
"0.66795635",
"0.66761905",
"0.65698767",
"0.6503769",
"0.6462747",
"0.64556015",
"0.6446373",
"0.6399772",
"0.63718116",
"0.6370396",
"0.6366383",
"0.63255566",
"0.62799186",
"0.6276254",
"0.62651056",
"0.621585",
"0.6214503",
"0.6201347",
"0.6199045",
"0.616592",
"0.6149782",
"0.6131029",
"0.61277604",
"0.6126801",
"0.6126801",
"0.61207116",
"0.6099365",
"0.6086502",
"0.60667366",
"0.6056499",
"0.60308474",
"0.59674793",
"0.5965816",
"0.59572244",
"0.5934606",
"0.5929464",
"0.59272194",
"0.5924587",
"0.5921167",
"0.5915481",
"0.589762",
"0.589762",
"0.5896555",
"0.5891617",
"0.58740073",
"0.58693105",
"0.5842914",
"0.58401424",
"0.5824636",
"0.5822305",
"0.5817234",
"0.58118683",
"0.58077735",
"0.5801542",
"0.57971126",
"0.57936066",
"0.5785174",
"0.5770134",
"0.576441",
"0.57518214",
"0.57496464",
"0.57238865",
"0.57233566",
"0.5693391",
"0.5692038",
"0.5683463",
"0.56772566",
"0.5659621",
"0.56533545",
"0.5645976",
"0.56316006",
"0.56315076",
"0.5628644",
"0.5620627",
"0.56193364",
"0.5610759",
"0.5603345",
"0.5582615",
"0.5575007",
"0.5571445"
] | 0.8455379 | 2 |
Returns _text_ as bold text for use on a terminal. | def bold(text)
"\e[1m#{text}\e[0m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bold_print(text)\n text.split(//).each do |ch|\n print ch, BS, ch\n end\n end",
"def bold\n surround_with_ansi(ANSI_BOLD)\n end",
"def bold(str)\n console_bold=\"\\e[1m\"\n console_reset=\"\\e[0m\"\n \"#{console_bold}#{str}#{console_reset}\"\nend",
"def bold(string_to_bold)\n Term::ANSIColor.bold string_to_bold\n end",
"def bold text, pry=(defined?(_pry_) && _pry_) || Pry\n (pry and pry.color) ? \"\\e[1m#{text}\\e[0m\" : text\n end",
"def bold\n \"<b>#{self}</b>\".html_safe\n end",
"def bold; end",
"def bold; end",
"def bold(output)\n color('1', output)\n end",
"def bold; \"\\e[1m#{self}\\e[22m\" end",
"def bold(*args); end",
"def bold_puts(msg)\n output.puts(bold(msg))\n end",
"def bold_message(message)\n Format(:bold, message)\n end",
"def scr_bold\n print \"\\33[1m\"\nend",
"def bold\n @info[:bold]\n end",
"def to_bold\n %(<strong>#{self}</strong>)\n end",
"def to_bold_s\n \"\\e[1m#{titre}\\e[22m: #{summary}.\"\n end",
"def bold(*args)\n color('1', *args)\n end",
"def bold_italic\n @font.fullname = 'MS-Mincho.BoldItalic'\n @desc.flags = flag_value(\n @desc_flags.merge(italic: true, force_bold: true)\n )\n @desc.italic_angle = -11\n @desc.stem_v = 156\n @font\n end",
"def bold(id)\n {\n 0x0190 => :BLSNORMAL, # Normal font weight\n 0x02BC => :BLSBOLD, # Bold font weight\n 0xFFFF => :ignored # Indicates that this specification is to be ignored\n }[id]\n end",
"def format_double_bold(text)\n redcarpet_markdown.render(text)\n end",
"def colored_string\n color(to_bold_s)\n end",
"def cnt_bold(c)\n \"#{c}\"\n end",
"def bold_title=(value)\n @title_font.bold = value\n end",
"def format_text(text)\n h(text.to_s).gsub(/\\n/, '<br>').html_safe\n end",
"def format_text(text)\n h(text.to_s).gsub(/\\n/, '<br>').html_safe\n end",
"def a_puts(line, bold = false)\n new_line = pad(line)\n line = bold && STDOUT.tty? ? Term::ANSIColor.bold(new_line) : new_line\n puts line\nend",
"def strong text\n if text =~ /\\A[a-z\\d.\\/-]+\\z/i then\n \"*#{text}*\"\n else\n \"<b>#{text}</b>\"\n end\n end",
"def ttext(text)\n tag(:br) + content_tag(:ttext, t(text)) + tag(:br)\n end",
"def color(text, color, bold = false)\n bold = bold ? BOLD : \"\"\n \"#{bold}#{color}#{text}#{CLEAR}\"\n end",
"def cp(text, opts={})\n embolden = opts[:bold] ? COLORS[:bold] : ''\n color = opts[:color] || default_color\n puts \"#{embolden}#{COLORS[color]}#{text}#{COLORS[:clear]}\"\n end",
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def display_text(text)\n print(text)\n end",
"def text_block(text)\n h(text).gsub(/\\n/, '<br/>').html_safe\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def Text(x, y, txt)\n\t\t#Output a string\n\t\ts=sprintf('BT %.2f %.2f Td (%s) Tj ET', x * @k, (@h-y) * @k, escapetext(txt));\n\t\tif (@underline and (txt!=''))\n\t\t\ts += ' ' + dolinetxt(x, y, txt);\n\t\tend\n\t\tif (@color_flag)\n\t\t\ts='q ' + @text_color + ' ' + s + ' Q';\n\t\tend\n\t\tout(s);\n\tend",
"def banner()\n print \"\"\" \n =================================================================\n =================================================================\n\t ==========International Morse Code translator v 0.0.1 =========\n ==========Transates user supplied Morse Code to text ============\n\t =================================================================\n ==========Coded by Rick Flores | nanotechz9l ====================\n ==========E-mail 0xnanoquetz9l<<\\|/>>gmail.com ===================\n\t =================================================================\n =================================================================\n \n\"\"\".foreground(:blue).bright\nend",
"def itext(text)\n tag(:br) + content_tag(:itext, t(text)) + tag(:br)\n end",
"def bold= bool\n self.weight = bool ? :bold : nil\n end",
"def info(text)\n puts \"#{text}\".foreground(:cyan)\n end",
"def green txt\n \"\\033[32m#{txt}\\033[0m\"\n end",
"def markup\n self.text.sub(/^(.*)$/,'<b>\\1</b>')\n end",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def simple_format(text)\n text.gsub!(/ +/, \" \")\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.gsub!(/\\n/, \"<br />\\n\")\n text\n end",
"def setBold(btn, nom)\n label = Gtk::Label.new\n label.set_markup(\"<span weight = 'ultrabold'>#{nom}</span>\")\n btn.add(label)\n btn.set_height_request(60)\n end",
"def title(text)\n # Use $stdout directly to bypass the indentation that our `puts` does.\n $stdout.puts(color.colorize(\"\\n#{text}\\n\", :blue))\n end",
"def colorize(text, code)\n if output.respond_to?(:tty?) && output.tty?\n \"\\033[#{code}m#{text}\\033[0m\"\n else\n text\n end\n end",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def label(text, options = {})\n opts = {\n rgb: [255, 255, 255],\n loc: [0,0]\n }.merge(options)\n\n @curr_font.draw_blended_utf8(\n @buff, \n text, \n opts[:loc][0], opts[:loc][1], \n opts[:rgb][0], opts[:rgb][1], opts[:rgb][2]\n )\n end",
"def text(s, x, y, color=0xffffffff)\n color = sym_color(color) if color.is_a? Symbol\n @font.draw(s, x, y, 0, 1, 1, color)\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def text= text\n @text = text\n @w,@h = @font.size_text text\n @surface = @font.render_blended text, @color\n render\n @text\n end",
"def highlight_text_if(condition, text, opts={})\n highlight_class = opts.fetch(:highlight_class, 'bold')\n content_tag(:span, text, :class => (condition ? highlight_class : nil))\n end",
"def status(text)\n STDERR.puts blue_term_text(text)\n end",
"def emphasis(text)\n \"<em>#{do_not_break_string text}</em>\"\n end",
"def nice_typography(text)\n widont(amp(rubypants(text)))\n end",
"def text\n t = status.try(:text) || model.text\n TweetPipeline.new(t).to_html\n end",
"def cyan(string)\n \"\\033[0;36m#{string}\\033[0m\"\nend",
"def ptext(text)\n tag(:br) + content_tag(:p, t(text)) + tag(:br)\n end",
"def green(text)\n colorize text, \"\\033[1;32m\"\n end",
"def say(text)\n @console.say(text)\n end",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def colorize(text, color_code)\n \"#{color_code}#{text}\\033[0m\"\n end",
"def xtext(text)\n tag(:br) + content_tag(:xtext, t(text)) + tag(:br)\n end",
"def draw_status_text\n draw_text(0, 0, contents_width, line_height, status_text, 1)\n end",
"def escape_text\n color.strip text.dup\n end",
"def h3; self.green.bold end",
"def beautify(txt)\n #txt.gsub!(/\\*(.*)\\*/, \"<span style=\\\"font-weight: bold;\\\">\\\\1</span>\")\n #txt.gsub!(/\\/(.*)\\//, \"<em>\\\\1</em>\") # Italic\n #txt.gsub!(/\\_(.*)\\_/, \"<span style=\\\"font-decoration: underline;\\\">\\\\1</span>\")\n #txt.gsub!(/\\-(.*)\\-/, \"<span style=\\\"font-decoration: line-through;\\\">\\\\1</span>\")\n # <span style=\"font-size: large;\">ok?</span>\n # <span style=\"color: #FF0000;\">ok?</span>\n txt\n end",
"def ansi_to_bbcode(string); end",
"def bleu\n \"\\033[0;96m#{self}\\033[0m\"\n # 96=bleu clair, 93 = jaune, 94/95=mauve, 92=vert\n end",
"def text(txt=\"A\", x=0, y=0)\n txt = txt.to_s unless txt.kind_of?(String)\n if @registration == :center\n width = textwidth(txt)\n x = x - width / 2\n y = y + @fsize / 2\n end\n CGContextShowTextAtPoint(@ctx, x, y, txt, txt.length)\n end",
"def puts_blue(string)\n puts \"\\033[34m\" + string + \"\\033[0m\"\nend",
"def crlfs_to_brs( text )\n if ( text.nil? || text.strip.blank? )\n return \"[אין]\";\n else\n escaped = h(text.strip);\n escaped.gsub!(/\\r\\n/, \"<br />\");\n escaped.gsub!(/\\r|\\n/, \"<br />\");\n return escaped;\n end\n end",
"def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def text(input)\n command = \"pdftotext #{input.shellescape} -\"\n command_stdout(command)\n end",
"def colorize(text, *colors)\n sgr = \"\\e[%sm\"\n none = 0\n bold = 1\n fg = 30\n\n codes = colors.map do |k|\n if k == :bold\n bold\n else\n i = COLORS.index {|c| c == k }\n raise \"No such color: #{k}\" unless i\n fg + i\n end\n end\n\n [sgr % codes.join(';'), text, sgr % none].join\nend",
"def italic; end",
"def italic; end",
"def text text\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def draw\n @font.draw(@text, @x, @y, 0, 1, 1, @color)\n end",
"def echo(text)\n\ttext \nend",
"def ansi_to_html(string); end",
"def bold_red(output)\n color('1;31', output)\n end",
"def banner(text, line_width=40)\n banner_text = \"=\" * line_width\n banner_text << \"\\n\"\n banner_text << text.center(line_width)\n banner_text << \"\\n\"\n banner_text << \"=\" * line_width\n puts banner_text\n nil\n end",
"def simple_format_content text\n simple_format(text.gsub('<br>', \"\\n\").html_safe).gsub(\"\\n\", '').html_safe if text\n end",
"def colorize txt, fg, bg, flags\n txt\n end",
"def process(text, model)\n text = text.to_s.gsub(\"\\n\", \"<br>\").gsub(\"\\t\", \" \" * 2).gsub(\" \", \" \")\n model.process_output(text)\n end",
"def say text\n @output.say text\n end",
"def bold_italic_cell(options = {}, &block)\n cell({ font_style: :bold_italic }.merge(options || {}), &block)\n end",
"def nl2br(text)\n return text.to_s.gsub(/\\n/, \"<br />\\n\")\n end",
"def text(text, x = :center, y = :center, options = HashWithIndifferentAccess.new)\n font = theme.font\n unless options.empty?\n options.reverse_merge! theme[:font]\n font = Font.select(options)\n end\n dims = font.sizeof(text)\n\n case x\n when :left, :west then x = 0\n when :center then x = center.x - dims.width / 2\n when :right, :east then x = width - dims.height\n else raise ArgumentError, \"Expected x to be one of [:west, :center, :east, :left, :right]; found #{x.inspect}\"\n end if x.kind_of? Symbol\n\n case y\n when :top, :north then y = 0\n when :center then y = center.y + dims.height / 2\n when :bottom, :south then y = height - dims.height\n else raise ArgumentError, \"Expected y to be one of [:north, :center, :south, :top, :bottom]; found #{y.inspect}\"\n end if y.kind_of? Symbol\n\n draw.stroke options[:stroke] || \"transparent\"\n draw.fill options[:color] || theme[:font][:color] if options[:color] || theme[:font][:color]\n draw.text(x, y, text)\n draw.fill theme[:fill][:color] if theme[:fill] and theme[:fill][:color]\n draw.stroke theme[:stroke][:color] if theme[:stroke] and theme[:stroke][:color]\n end",
"def formatted_text(text)\n raw(coderay(text))\n end",
"def draw_text_cs(x, y, w, h, t, a = 0)\r\n original_color = self.font.color.clone\r\n self.font.color = Color.new(0,0,0,100)\r\n draw_text(x + 2, y + 2, w, h, t, a)\r\n self.font.color = original_color\r\n draw_text(x, y, w, h, t, a) \r\n end",
"def text(*args)\n if args.size.zero?\n @text = ''\n else\n @text = args.first\n end\n end",
"def text(*args)\n if args.size.zero?\n @text = ''\n else\n @text = args.first\n end\n end"
] | [
"0.7857709",
"0.7768464",
"0.7630191",
"0.7427221",
"0.7356232",
"0.7208961",
"0.7185732",
"0.7185732",
"0.71615183",
"0.70104885",
"0.6975165",
"0.69276106",
"0.6916251",
"0.68806916",
"0.68738055",
"0.6823167",
"0.6579228",
"0.649576",
"0.6494936",
"0.64502823",
"0.64007753",
"0.6370013",
"0.63363004",
"0.63073975",
"0.60600805",
"0.60600805",
"0.60332394",
"0.6030002",
"0.5990426",
"0.5932315",
"0.59124917",
"0.5862885",
"0.58503014",
"0.58331877",
"0.5828725",
"0.5747205",
"0.57371503",
"0.57132703",
"0.57103956",
"0.5655383",
"0.5614033",
"0.56128615",
"0.56074464",
"0.5558314",
"0.5550986",
"0.55507994",
"0.553256",
"0.54979837",
"0.5496311",
"0.5487741",
"0.54602766",
"0.5442724",
"0.5442589",
"0.5424169",
"0.5418508",
"0.54166746",
"0.5416231",
"0.5410347",
"0.54009205",
"0.5393216",
"0.5380931",
"0.5366807",
"0.5366807",
"0.5366807",
"0.53631467",
"0.5359166",
"0.5358771",
"0.5354016",
"0.53529006",
"0.53294957",
"0.5329014",
"0.53239775",
"0.531088",
"0.5303938",
"0.52738386",
"0.5262899",
"0.5255602",
"0.5255602",
"0.52427614",
"0.5238685",
"0.5233552",
"0.5233552",
"0.5231814",
"0.523159",
"0.5212554",
"0.52111566",
"0.5206886",
"0.5189458",
"0.5189251",
"0.5182675",
"0.51749694",
"0.51616037",
"0.5160671",
"0.51577985",
"0.51519555",
"0.5146775",
"0.5144386",
"0.51425683",
"0.51416594",
"0.51416594"
] | 0.85225856 | 0 |
Returns `text` in the default foreground colour. Use this instead of "black" or "white" when you mean absence of colour. | def default(text)
text.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def textColor\n return @text_color\n end",
"def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end",
"def color(text)\n \"\\e[31m#{text}\\e[0m\"\n end",
"def colorize txt, fg, bg, flags\n txt\n end",
"def color_text\n @attributes[:color_text]\n end",
"def color(text, color)\n if COLORS[color]\n \"#{start_color color}#{text}#{reset_color}\"\n end\n end",
"def process_text text, color = \"#000000\"\n end",
"def colorize(text, color = :default, bg_color = :default)\n colors = {\n :default => \"38\",\n :black => \"30\",\n :red => \"31\",\n :green => \"32\",\n :brown => \"33\",\n :blue => \"34\",\n :purple => \"35\",\n :cyan => \"36\",\n :gray => \"37\",\n :dark_gray => \"1;30\",\n :light_red => \"1;31\",\n :light_green => \"1;32\",\n :yellow => \"1;33\",\n :light_blue => \"1;34\",\n :light_purple => \"1;35\",\n :light_cyan => \"1;36\",\n :white => \"1;37\"\n }\n\n bg_colors = {\n :default => \"0\",\n :black => \"40\",\n :red => \"41\",\n :green => \"42\",\n :brown => \"43\",\n :blue => \"44\",\n :purple => \"45\",\n :cyan => \"46\",\n :gray => \"47\",\n :dark_gray => \"100\",\n :light_red => \"101\",\n :light_green => \"102\",\n :yellow => \"103\",\n :light_blue => \"104\",\n :light_purple => \"105\",\n :light_cyan => \"106\",\n :white => \"107\"\n }\n\n color_code = colors[color]\n bg_color_code = bg_colors[bg_color]\n return \"\\033[#{bg_color_code};#{color_code}m#{text}\\033[0m\"\nend",
"def colorize(text, color)\n\t\"\\e[#{Colors[color]}m#{text}\\e[0m\"\nend",
"def crisis_color\n return text_color(17)\n end",
"def color(text, color_code)\n \"#{color_code}#{text}\\e[0m\"\n end",
"def color(text, color_code)\n ::Guard::UI.send(:color_enabled?) ? \"\\e[0#{ color_code }m#{ text }\\e[0m\" : text\n end",
"def colorize(color, text)\n \"\\e[#{color}m#{text}\\e[0m\"\n end",
"def in_color(text, color)\n # TODO: Disable if the output is not a terminal.\n return text unless enabled?\n # Source of color codes:\n # https://misc.flogisoft.com/bash/tip_colors_and_formatting\n code =\n case color\n when :red then 31\n when :green then 32\n when :yellow then 33\n when :blue then 34\n when :magenta then 35\n when :cyan then 36\n when :light_gray then 37\n when :dark_gray then 90\n when :light_red then 91\n when :light_green then 92\n when :light_yellow then 93\n when :light_blue then 94\n when :light_magenta then 95\n when :light_cyan then 96\n when :white then 97\n when :default_background then 49\n when :black_background then 40\n when :red_background then 41\n when :green_background then 42\n when :yellow_background then 43\n when :blue_background then 44\n when :magenta_background then 45\n when :cyan_background then 46\n when :light_gray_background then 47\n when :dark_gray_background then 100\n when :light_red_background then 101\n when :light_green_background then 102\n when :light_yellow_background then 103\n when :light_blue_background then 104\n when :light_magenta_background then 105\n when :light_cyan_background then 106\n when :white_background then 107\n else raise \"Unrecognized color: #{color}\"\n end\n \"\\e[#{code}m#{text}\\e[0m\"\n end",
"def red(text)\n colorize text, \"\\033[1;31m\"\n end",
"def fg(c)\n return self unless ANSI_COLORS[c]\n return colorize(ANSI_COLORS[c])\n end",
"def green(text)\n colorize text, \"\\033[1;32m\"\n end",
"def text_colors\n @colors = {\n red: 31,\n yellow: 33,\n green: 32\n }\n end",
"def textbackground(color = nil)\n if color\n @text.background(color)\n else\n @text.background\n end\n end",
"def green txt\n \"\\033[32m#{txt}\\033[0m\"\n end",
"def colorize(text = '_', color = 'default', bgcolor = 'default')\n colors = {\n 'default' => 38,\n 'black' => 30,\n 'red' => 31,\n 'green' => 32,\n 'brown' => 33,\n 'blue' => 34,\n 'purple' => 35,\n 'cyan' => 36,\n 'gray' => 37,\n 'dark gray' => '1;30',\n 'light red' => '1;31',\n 'light green' => '1;32',\n 'yellow' => '1;33',\n 'light blue' => '1;34',\n 'light purple' => '1;35',\n 'light cyan' => '1;36',\n 'white' => '1;37'\n }\n bgcolors = {\n 'default' => 0,\n 'black' => 40,\n 'red' => 41,\n 'green' => 42,\n 'brown' => 43,\n 'blue' => 44,\n 'purple' => 45,\n 'cyan' => 46,\n 'gray' => 47,\n 'dark gray' => 100,\n 'light red' => 101,\n 'light green' => 102,\n 'yellow' => 103,\n 'light blue' => 104,\n 'light purple' => 105,\n 'light cyan' => 106,\n 'white' => 107\n }\n\n color_code = colors[color]\n bgcolor_code = bgcolors[bgcolor]\n\n return \"\\033[#{bgcolor_code};#{color_code}m#{text}\\033[0m\"\nend",
"def text_color_for_image(image)\n dominant = dominant_color(image)\n brightness = brightness(dominant)\n # Por ahora sólo devolvemos blanco o negro.\n # Si lo vemos muy feo, pensar una solución\n # más inteligente.\n if brightness < 255 / 2\n \"#fff\"\n else\n \"#000\"\n end\n end",
"def textColor(theColor, target = nil)\n return if theColor.nil?\n views = @alert.window.contentView.subviews # the standard label fields\n case target\n when 'message' then views[4].textColor = MEalert.getColor(theColor, 'textColor')\n when 'informative' then views[5].textColor = MEalert.getColor(theColor, 'textColor')\n else @coloration[:text] = theColor\n end\n end",
"def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend",
"def colorize(text, *options)\n\n font_style = ''\n foreground_color = '0'\n background_color = ''\n\n options.each do |option|\n if option.kind_of?(Symbol)\n foreground_color = \"3#{COLORS[option]}\" if COLORS.include?(option)\n font_style = \"#{STYLES[option]};\" if STYLES.include?(option)\n elsif option.kind_of?(Hash)\n option.each do |key, value|\n case key\n when :color; foreground_color = \"3#{COLORS[value]}\" if COLORS.include?(value)\n when :background; background_color = \"4#{COLORS[value]};\" if COLORS.include?(value)\n when :on; background_color = \"4#{COLORS[value]};\" if COLORS.include?(value)\n when :style; font_style = \"#{STYLES[value]};\" if STYLES.include?(value)\n end\n end\n end\n end\n return \"\\e[#{background_color}#{font_style}#{foreground_color}m#{text}\\e[0m\"\n end",
"def colorize(text, color=nil)\n CLIColorize.colorize(text, color)\n end",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def color(text, color, bold = false)\n bold = bold ? BOLD : \"\"\n \"#{bold}#{color}#{text}#{CLEAR}\"\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def colorize(text, color_code)\n return \"\\e[#{color_code}m#{text}\\e[0m\"\n end",
"def green(text)\n colorize(text, 32)\nend",
"def c(text, colors)\n text = \"%{B#{colors[:bg]}}#{text}%{B-}\" if colors[:bg]\n text = \"%{F#{colors[:fg]}}#{text}%{F-}\" if colors[:fg]\n text\nend",
"def get_user_text_color(user)\n user_color = get_user_color(user).gsub(\"#\", \"\")\n\n # Get the hex color as red, green, blue\n r = user_color[0..1].hex\n g = user_color[2..3].hex\n b = user_color[4..5].hex\n\n if ((r * 0.299) + (g * 0.587) + (b * 0.114)) > 186\n \"#4a4a4a\"\n else\n \"#ffffff\"\n end\n end",
"def blue(text)\n colorize(text, 34)\nend",
"def colorize(text, color_code)\n \"#{color_code}#{text}\\033[0m\"\n end",
"def colorize(text, status = :normal)\n case status\n when :success\n text.green\n when :error\n text.red\n when :warning\n text.yellow\n when :neutral\n text.blue\n else\n text.white\n end\n end",
"def colour(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def colorize(text, color_code)\n if windows?\n text\n else\n \"\\e[#{color_code}m#{text}\\e[0m\"\n end\n end",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def default_colour\n\t\t\tOmniboard::Colour.new(0).standard\n\t\tend",
"def font_color()\n validate_worksheet\n if @workbook.fonts[font_id()][:font][:color].nil?\n '000000' #black\n else\n @workbook.fonts[font_id()][:font][:color][:attributes][:rgb]\n end\n end",
"def colored_string\n color(to_bold_s)\n end",
"def colorize(text, color_code)\n \"#{color_code}#{text}\\e[0m\"\nend",
"def colorize(str, foreground)\n if @color\n fore = FOREGROUND[foreground] or raise ArgumentError, \"Unknown foreground color #{foreground.inspect}\"\n \"#{fore}#{str}#{RESET}\"\n else\n str.to_s\n end\n end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\n end",
"def gprint (text)\n\tprint colorize(colorize(text, \"black\"), \"white_bg\")\nend",
"def colorize txt, fg, bg, flags\n fgc = (fg.nil? || Color === fg ) ? fg : Color.parse(fg)\n bgc = (bg.nil? || Color === bg) ? bg : Color.parse(bg)\n esc = []\n esc << '01' if flags[:b]\n esc << '03' if flags[:i]\n esc << '04' if flags[:u]\n esc << '07' if flags[:r]\n esc << \"38;05;#{fgc.xterm256}\" if fgc\n esc << \"48;05;#{bgc.xterm256}\" if bgc\n \n esc.empty? ? txt : \"\\e[#{esc.join(';')}m#{txt}\\e[0m\" \n end",
"def color(text, *color_options)\n color_code = ''\n color_options.each do |color_option|\n color_option = color_option.to_s\n if color_option != ''\n if !(color_option =~ /\\d+/)\n color_option = const_get(\"ANSI_ESCAPE_#{ color_option.upcase }\")\n end\n color_code += ';' + color_option\n end\n end\n color_enabled? ? \"\\e[0#{ color_code }m#{ text }\\e[0m\" : text\n end",
"def ansi_color(color, text)\n #\"\\x1b[38;5;#{color}m#{text}\\x1b[0m\"\n \"\\e[38;5;#{color}m#{text}\\e[0m\"\nend",
"def colorize(text, code)\n if output.respond_to?(:tty?) && output.tty?\n \"\\033[#{code}m#{text}\\033[0m\"\n else\n text\n end\n end",
"def color\n if not @title\n 'blank'\n elsif @warnings\n 'missing'\n elsif @missing\n 'missing'\n elsif @approved\n if @approved.length < 5\n 'ready'\n elsif @comments\n 'commented'\n else\n 'reviewed'\n end\n elsif @text or @report\n 'available'\n elsif @text === undefined\n 'missing'\n else\n 'reviewed'\n end\n end",
"def text_color(threshold=0.6, formula=:standard)\n brightness(formula) > threshold ? Colorist::Color.new(0x000000) : Colorist::Color.new(0xffffff)\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/, '')\n end",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end",
"def coordinate_labels_font_color\n if self.options[:font_color].blank?\n '#333333'\n else\n self.options[:font_color]\n end\n end",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def text_color(param)\n begin \n colour = case param\n when Integer then super(param) rescue normal_color\n when Symbol then send(param) rescue normal_color\n when Array then Color.new(*param) rescue normal_color\n else\n normal_color\n end\n end\n colour.is_a?(Color) ? colour : normal_color\n end",
"def text_color(threshold=0.6, formula=:standard)\n brightness(formula) > threshold ? Colorist::Color.new(0x000000) : Colorist::Color.new(0xffffff)\nend",
"def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend",
"def colorize_text(text)\n return text unless ActiveRecordQueryTrace.colorize\n # Try to convert the choosen color from string to integer or try\n # to use the colorize as the color code\n colors = {\n true => \"38\", \"blue\" => \"34\", \"light red\" => \"1;31\",\n \"black\" => \"30\", \"purple\" => \"35\", \"light green\" => \"1;32\",\n \"red\" => \"31\", \"cyan\" => \"36\", \"yellow\" => \"1;33\",\n \"green\" => \"32\", \"gray\" => \"37\", \"light blue\" => \"1;34\",\n \"brown\" => \"33\", \"dark gray\" => \"1;30\", \"light purple\" => \"1;35\",\n \"white\" => \"1;37\", \"light cyan\" => \"1;36\"\n }\n color_code = colors[ActiveRecordQueryTrace.colorize] ||\n ActiveRecordQueryTrace.colorize.to_s\n unless /\\d+(;\\d+){0,1}/.match(color_code)\n raise \"Invalid color. Use one of #{ colors.keys } or a valid color code\"\n end\n \"\\e[#{ color_code }m#{ text }\\e[0m\"\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/ , '')\n end",
"def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def color(text, color, mode_options = {}) # :doc:\n return text unless colorize_logging\n color = self.class.const_get(color.upcase) if color.is_a?(Symbol)\n mode = mode_from(mode_options)\n clear = \"\\e[#{MODES[:clear]}m\"\n \"#{mode}#{color}#{text}#{clear}\"\n end",
"def uncolored(text = nil)\n if block_given?\n uncolorize(yield)\n elsif text\n uncolorize(text)\n elsif respond_to?(:to_str)\n uncolorize(to_str)\n else\n ''\n end\n end",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def red(text)\n colorize(text, 31)\nend",
"def getDefaultTextColors(windowskin)\n if !windowskin || windowskin.disposed? || \n windowskin.width!=128 || windowskin.height!=128\n if isDarkWindowskin(windowskin)\n return [MessageConfig::LIGHTTEXTBASE,MessageConfig::LIGHTTEXTSHADOW] # White\n else\n return [MessageConfig::DARKTEXTBASE,MessageConfig::DARKTEXTSHADOW] # Dark gray\n end\n else # VX windowskin\n color=windowskin.get_pixel(64, 96)\n shadow=nil\n isdark=(color.red+color.green+color.blue)/3 < 128\n if isdark\n shadow=Color.new(color.red+64,color.green+64,color.blue+64)\n else\n shadow=Color.new(color.red-64,color.green-64,color.blue-64)\n end\n return [color,shadow]\n end\nend",
"def to_s\n \"#{foreground}#{background}\"\n end",
"def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend",
"def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend",
"def color_top_text\n @attributes[:color_top_text]\n end",
"def default_color\n return translate_color(current_layout.default_color)\n end",
"def white\n colorize(37)\n end",
"def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"def colorize(text, *colors)\n sgr = \"\\e[%sm\"\n none = 0\n bold = 1\n fg = 30\n\n codes = colors.map do |k|\n if k == :bold\n bold\n else\n i = COLORS.index {|c| c == k }\n raise \"No such color: #{k}\" unless i\n fg + i\n end\n end\n\n [sgr % codes.join(';'), text, sgr % none].join\nend",
"def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end",
"def info(text)\n puts \"#{text}\".foreground(:cyan)\n end",
"def escape_text\n color.strip text.dup\n end",
"def to_s\n if self.color == :white\n \" ♜ \"\n else\n \" ♖ \"\n end\n end",
"def display_color\n if @deleted\n return '#FF0000' # Red\n elsif !@enabled\n return '#AAAAAA' # Gray\n end\n \n '#000000'\n end",
"def color\n\t\tif name == \"Broken\"\n\t\t\tcolor = \"red\"\n\t\telsif name == \"Needs Attention\"\n\t\t\tcolor = \"orange\"\n\t\telsif name == \"Working\"\n\t\t\tcolor = \"green\"\n\t\telse\n\t\t\tcolor = \"\"\n\t\tend\n\t\treturn color\n end",
"def format_color(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def colorize(text)\n Albino.new(text, self).colorize(:O => 'stripnl=false')\n end",
"def foreground(fgcolor)\n fgcolor.split(/\\s+/).collect { |fg| names_to_code(fg) }.join(\"\")\n end",
"def safe_colorize(text, color=nil)\n CLIColorize.safe_colorize(text, color)\n end",
"def colorNormal\n puts \"\\033[0m\"\n end",
"def puts_blue(string)\n puts \"\\033[34m\" + string + \"\\033[0m\"\nend",
"def SetTextColor(r, g=-1, b=-1, storeprev=false)\n\t\t#Set color for text\n\t\tif ((r==0 and :g==0 and :b==0) or :g==-1)\n\t\t\t@text_color=sprintf('%.3f g', r/255.0);\n\t\telse\n\t\t\t@text_color=sprintf('%.3f %.3f %.3f rg', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevtext_color = [r, g, b]\n\t\tend\n\tend"
] | [
"0.7381206",
"0.7094532",
"0.7089703",
"0.67523843",
"0.66624063",
"0.66569746",
"0.66373694",
"0.66124743",
"0.6592725",
"0.6588967",
"0.6587635",
"0.6557048",
"0.65375173",
"0.651355",
"0.65103924",
"0.6497696",
"0.64966834",
"0.6478376",
"0.6450603",
"0.6427067",
"0.6415527",
"0.64077866",
"0.6406645",
"0.6359343",
"0.63545775",
"0.63532877",
"0.63500917",
"0.6344324",
"0.633276",
"0.633276",
"0.63305014",
"0.63275284",
"0.6317427",
"0.63067645",
"0.63046575",
"0.62946594",
"0.62934214",
"0.62729853",
"0.62637526",
"0.6257757",
"0.6249962",
"0.6229645",
"0.62011385",
"0.619754",
"0.6195664",
"0.6194894",
"0.61943704",
"0.6184147",
"0.61830014",
"0.61760294",
"0.6168323",
"0.6149651",
"0.6144738",
"0.6144431",
"0.6139113",
"0.61191964",
"0.61191964",
"0.6118386",
"0.61182165",
"0.6116388",
"0.610735",
"0.610735",
"0.610735",
"0.6086295",
"0.60844266",
"0.608267",
"0.608267",
"0.605928",
"0.6050399",
"0.602846",
"0.6025865",
"0.6000998",
"0.59786856",
"0.59786856",
"0.59786856",
"0.59786856",
"0.5974525",
"0.59725624",
"0.5966615",
"0.5959561",
"0.5959561",
"0.59539294",
"0.5952165",
"0.5948026",
"0.59445405",
"0.59445405",
"0.594293",
"0.59406",
"0.59260374",
"0.5924463",
"0.59164286",
"0.59030193",
"0.58876556",
"0.5887159",
"0.5883623",
"0.5881751",
"0.5880383",
"0.5877431",
"0.58585525",
"0.5842836"
] | 0.6041813 | 69 |
GET /part_time_employees GET /part_time_employees.json | def index
if isAdmin
@part_time_employees = PartTimeEmployee.all
elsif isGeneral
@part_time_employees = PartTimeEmployee.where('dateofTermination >= ? OR dateofTermination is null', DateTime.now)
else
redirect_to :controller => 'sessions', :action => 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clock = @employee.clock_in_out\n render json: @clock\n end",
"def index\n @employees = @client.employees\n @events = fetch_events\n end",
"def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end",
"def employee(employee_id)\n get(\"employees/#{employee_id}\")\n end",
"def index\n @employee_workinghours = EmployeeWorkinghour.all\n end",
"def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def show\n @work_time = WorkTime.find(params[:id])\n # search for employee for the header of the work time view in show.html.erb\n # makes use of the employee ID present in the current work time being seen\n @employee = Employee.find(@work_time.employee_id)\n\n # renders the display according to what format the URL or request was in\n respond_to do |format|\n # HTML requests will render the show.html.erb present in app/views/work_times folder\n # displays the work time in show.html.erb\n format.html { render \"work_times/show\", status: :ok }\n # JSON requests will render the employee profile in json format\n format.json { render json: @work_times, status: :ok }\n # XML requests will render the employee profile in xml format\n format.xml { render xml: @work_times, status: :ok }\n end\n end",
"def show\n @officehour = Officehour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officehour }\n end\n end",
"def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def part_time_employee_params\n params.require(:part_time_employee).permit(:dateOfHire, :dateOfTermination, :hourlyRate)\n end",
"def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end",
"def index\n @handbook_place_employees = HandbookPlaceEmployee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @handbook_place_employees }\n end\n end",
"def employee_index\n timesheets = Timesheet.for_user(User.current)\n\n @not_submitted_ts = timesheets.is_not_submitted.paginate(:page => params[:not_submitted_ts_page], :per_page => 5)\n @submitted_ts = timesheets.is_submitted.is_not_paid.paginate(:page => params[:submitted_ts_page], :per_page => 5)\n @paid_ts = timesheets.is_paid.paginate(:page => params[:paid_ts_page], :per_page => 5)\n end",
"def index\n @timesheet_entries = TimesheetEntry.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheet_entries }\n end\n end",
"def index\r\n @officehours = Officehour.all\r\n end",
"def index\n @office_hour_details = OfficeHourDetail.all\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end",
"def index\n if !time_slot_params[:start].present? && !time_slot_params[:end].present?\n @appointments = Appointment.all\n else\n #time_slot_params[:start], time_slot_params[:end]\n @appointments = Appointment.in_time_slot_only(time_slot_params).all\n end\n render :json => @appointments, :status => :ok\n end",
"def index\n \n if can? :update, @user \n \n #Display all the user timesheets for the admin user \n @date = params[:month] ? Date.parse(params[:month]) : Date.today\n \n #Display only the timesheet of the employee who has logged in \n @timesheets = Timesheet.where(\"employee_id\" => params[:employee_id]).all \n \n else \n #Display all there timesheets for the proadmin and employee user\n @date = params[:month] ? Date.parse(params[:month]) : Date.today\n \n #Display only the timesheet of the employee who has logged in\n @timesheets = Timesheet.where(\"employee_id\" => current_user.employee.id).all \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheets }\n end\n end",
"def index\n\n if params[:meeting_id]\n @meeting = Meeting.find(params[:meeting_id])\n end\n\n respond_to do |f|\n f.json {\n @meetings = Meeting\n start_p = Time.parse(params[:start])\n end_p = Time.parse(params[:end])\n @meetings = @meetings.where(\"start_at > ?\", params[:start])\n if start_p and end_p\n duration = end_p - start_p\n @meetings = @meetings.where(\"duration < ?\", duration)\n end\n\n render :json => @meetings.map{|m|\n {\n :id => m.id,\n :title => m.label,\n :start => m.start_at,\n :end => m.end_at,\n :url => \"/reunions/#{m.id}.js\",\n color: '#D42700',\n textColor: 'white'\n }\n }\n }\n f.html\n end\n end",
"def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def employees\n title = \"#{@list.title}-employees\"\n partners = @list.partners\n\n respond_to do |format|\n format.csv { send_csv partners.as_csv(include: :employees), title }\n format.xlsx { send_xlsx partners.as_xlsx(include: :employees), title }\n end\n end",
"def index\n @program_employees = ProgramEmployee.all\n end",
"def index\n if params[:id]\n @time_cards = TimeCard.where('employee_id = ?', params[:id])\n @employee = Employee.find(params[:id])\n else\n redirect_to :controller => 'full_time_employees', :action => 'index'\n end\n end",
"def index\n @timesheets = Timesheet.all\n render json: @timesheets\n end",
"def index\n @work_times = WorkTime.all\n\n # below are filters for the employee list\n # header title is for the index views for each queries\n @header_title = \"All Employee\"\n # query for the work time ID\n # filter list according to a specific work time ID\n # id is usually given by default in rails andis used mainly in the show method\n if id = params[:id]\n @header_title = \"\"\n @work_times = @work_times.where(id: id)\n end\n # query for work time under a certain employee through their employee ID\n # filter list according to employee ID\n if employee_id = params[:employee_id]\n employee = Employee.find(employee_id)\n @header_title = \"#{employee.name}'s\"\n @work_times = @work_times.where(employee_id: employee_id)\n end\n # query for work time of a specific time of scan\n # filter list according to the time the work time had been scanned or made\n # must input until the last second\n # format: HH:MM:SS\n if time_of_scan = params[:time_of_scan]\n @header_title = \"All #{time_of_scan} timed\"\n @work_times = @work_times.where(employee_id: employee_id)\n end \n # query for time flag of work times\n # filter list according to what is logged in or what is logged out in the table\n # only two choices must be \"logged_in\" or \"logged_out\" else it will return nothing\n if time_flag = params[:time_flag]\n @header_title = \"All #{employee.name}'s\"\n @work_times = @work_times.where(employee_id: employee_id)\n end \n # query for the date of the work time\n # filter list according to the date of creation of the work time\n # format: YYYY-MM-DD\n if work_date = params[:work_date]\n if params[:work_date] = Date.current\n @header_title = \"Today's\"\n else\n @header_title = \"All #{params[:work_date]} Dated\"\n end\n @work_times = @work_times.where(work_date: work_date)\n end \n\n # renders the display according to what format the URL or request was in\n respond_to do |format|\n # HTML requests will render the index.html.erb present in app/views/work_times folder\n # displays the list of work times in index.html.erb\n format.html { render \"work_times/index\", status: :ok }\n # JSON requests will render the list of work times in json format\n format.json { render json: @work_times, status: :ok }\n # XML requests will render the list of work times in xml format\n format.xml { render xml: @work_times, status: :ok }\n end\n end",
"def list_employees_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n format.xls\n end\n end",
"def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end",
"def index\n @employes = Employe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employes }\n end\n end",
"def index\n if request.xhr?\n branch_id = Branch.find_by_id(params[:branch])\n lastname = params[:surname].mb_chars.downcase if params[:surname]\n @employees = Employee.with_lastname(lastname).with_branch(branch_id).all\n html_employees = render_to_string(partial: 'employees', layout: false,\n locals: { employees: @employees })\n unless @employees.blank?\n html_employee = render_to_string(partial: 'employee', layout: false,\n locals: { employee: @employees.first })\n end\n render json: { html_employees: html_employees, html_employee: html_employee }\n else\n @employees = Employee.all\n end\n end",
"def index\n @employments = Employment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employments }\n end\n end",
"def index\n @empolyees = Empolyee.all\n end",
"def show\n @timesheet_entry = TimesheetEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet_entry }\n end\n end",
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\n end\n end",
"def index\n @vhours = Vhour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vhours }\n end\n end",
"def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end",
"def show\n @timesheet = current_user.timesheets.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def index\n @employee_rooms = EmployeeRoom.all\n end",
"def all_employees\n self.workplace.employees\n end",
"def employee_all\n\t\trespond_to do |format|\n\t\t format.js\n\t\tend\n\tend",
"def show\n @program_employee = ProgramEmployee.find(params[:id])\n @employees = @program_employee.program_location.program_employees\n end",
"def get_part_by_company_part\n @parts = PartsController::PartService.get_part_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend",
"def index\n # Get all work days in the actual month\n currentTime = Time.now\n @user = current_user\n @work_days = @user.work_days.order(\"date\").where(date: currentTime.at_beginning_of_month..currentTime.at_end_of_month)\n \n # Gets sum of all the work hours\n @work_days_total_hours = @work_days.inject(0.0){|sum, item| sum+item.work_hours} || 0\n @work_days_extra_hours = @work_days_total_hours - (@work_days.count * @user.daily_hours)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_days }\n end\n end",
"def create\n @employee = Employee.new(employee_params)\n @employee.editor_id = current_user.id\n @part_time_employee = PartTimeEmployee.new(part_time_employee_params)\n if isAdmin\n @part_time_employee.verified = 1\n end\n respond_to do |format|\n @part_time_employee.valid?\n if @employee.valid? && @part_time_employee.valid?\n if @employee.save\n @part_time_employee.employee = Employee.find(@employee.id)\n format.json { render :show, status: :created, location: @employee }\n if @part_time_employee.save\n @logs = Log.new\n @logs.employeeInfo = @employee.to_json\n @logs.additionalInfo = @part_time_employee.to_json\n @logs.CRUD = \"Create\"\n @logs.table = \"Full Time Employee\"\n @logs.who = current_user.name\n @logs.save\n format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' }\n format.json { render :show, status: :created, location: @part_time_employee }\n end\n end\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n\n #format.html { render :new }\n format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def attendances\n # nothing here, everything is asked to JSON API\n # this action should render initial template only.\n end",
"def employee\n @employee = current_user.employee\n @past_shifts = Shift.past.for_employee(@employee.id).paginate(:page => params[:pasts_page]).per_page(10)\n @shifts = Shift.for_employee(@employee.id).for_next_days(14).paginate(:page => params[:shifts_page]).per_page(10)\n end",
"def index\n @employee_events = EmployeeEvent.all\n end",
"def list_employees(order: nil,\n begin_updated_at: nil,\n end_updated_at: nil,\n begin_created_at: nil,\n end_created_at: nil,\n status: nil,\n external_id: nil,\n limit: nil,\n batch_token: nil)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/employees'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'order' => order,\n 'begin_updated_at' => begin_updated_at,\n 'end_updated_at' => end_updated_at,\n 'begin_created_at' => begin_created_at,\n 'end_created_at' => end_created_at,\n 'status' => status,\n 'external_id' => external_id,\n 'limit' => limit,\n 'batch_token' => batch_token\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), status: :ok\n end",
"def all\n @timesheet_entries = TimesheetEntry.all\n\n respond_to do |format|\n format.html { render json: @timesheet_entries }\n format.json { render json: @timesheet_entries }\n end\n end",
"def get_employees\n @employees = User.find_user_not_admin_not_client(get_company_id)\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end",
"def index\n date_range = unix_date(params[:date])\n @timeslots = Timeslot.where('start_time >= ? and start_time <= ?', date_range[:beginning_of_day], date_range[:end_of_day])\n # render :json => @timeslots.as_json(only: [])\n end",
"def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end",
"def index\n @wing_employees = WingEmployee.all\n end",
"def show\n @hisd_employee = HisdEmployee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hisd_employee }\n end\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def index\n start_time = params[:start_time]\n end_time = params[:end_time]\n first_name = params[:first_name]\n last_name = params[:last_name]\n\n if start_time && end_time\n @appointments = Appointment.where(start_time: start_time, end_time: end_time)\n elsif start_time\n @appointments = Appointment.where(start_time: start_time)\n elsif end_time\n @appointments = Appointment.where(end_time: end_time)\n elsif first_name & last_name\n @appointments = Appointment.where(first_name: first_name, last_name: last_name)\n elsif first_name\n @appointments = Appointment.where(first_name: first_name)\n else last_name\n @appointments = Appointment.where(last_name: last_name)\n end\n\n render json: @appointments, status: 200\n end",
"def index\n respond_to do |format|\n format.html { # index.html.erb\n @work_times = WorkTime.page params[:page]\n }\n format.xml { # index.xml.builder\n @work_times = WorkTime.all\n }\n format.json { render json: WorkTime.all }\n end\n end",
"def v1_employees_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmployeesApi.v1_employees_get ...\"\n end\n # resource path\n local_var_path = \"/v1/employees\"\n\n # query parameters\n query_params = {}\n query_params[:'field'] = @api_client.build_collection_param(opts[:'field'], :multi) if !opts[:'field'].nil?\n query_params[:'filter'] = @api_client.build_collection_param(opts[:'filter'], :multi) if !opts[:'filter'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Employee>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmployeesApi#v1_employees_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @appointments = Appointment.all \n render json: @appointments\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def index\n ends = End.find_each\n render json: ends\n end",
"def index\n @timecard = Timecard.find(params[:timecard_id])\n render :json => Hour.timecard_hours(@timecard)\n end",
"def show\n @emp_date_detail = EmpDateDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_date_detail }\n end\n end",
"def get_appts\n @user = current_user\n @appointments = @user.appointments.actual.includes(:status, :address, :assignments, {:subscription => :subscriptionable}, :employees, :team)\n # filter by the datetime object via params from fullcalendar\n filter_show = ActiveSupport::JSON.decode(params[:filter_show])\n appointments_in_range = @appointments.where(\"appointments.start_time >= :start_time AND appointments.start_time <= :end_time\", {:start_time => Time.at(params['start'].to_i), :end_time => Time.at(params['end'].to_i)} )\n events = []\n appointments_in_range.each do |appointment|\n if appointment_is_allowed?(appointment, filter_show)\n customer = appointment.subscription.subscriptionable\n eventHash = {:id => appointment.id, :title => calendar_title(appointment, customer), :start => \"#{appointment.start_time.iso8601}\", :end => \"#{appointment.end_time.iso8601}\", :allDay => false, :recurring => appointment.subscription.repeat }\n\n eventHash[:backgroundColor] = event_background_color(appointment, params[:event_color])\n eventHash[:borderColor] = eventHash[:backgroundColor]\n\n events << eventHash\n # optional day view\n #events << {:id => event.id, :title => @customer_name, :url => \"/appointments/\"+event.id.to_s+\"/edit\", :description => \"Description here\", :start => \"#{event.start_time.iso8601}\", :end => \"#{event.end_time.iso8601}\", :allDay => true}\n end\n end\n render :json => events\n end",
"def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end",
"def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end",
"def index\n @employees = $Vendor.employees.scopied.order(\"created_at desc\").page(params[:page]).per(25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @employees }\n end\n end",
"def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end",
"def list_employees_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmployeesApi.list_employees ...\"\n end\n # resource path\n local_var_path = \"/v2/employees\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'location_id'] = opts[:'location_id'] if !opts[:'location_id'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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 header_params['Square-Version'] = \"2019-06-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(: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 => 'ListEmployeesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmployeesApi#list_employees\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_job }\n end\n end",
"def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end",
"def index\n @employing_units = EmployingUnit.page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employing_units }\n end\n end",
"def index\n @timesheets = Timesheet.all\n render :json => @timesheets,:include => {:project => {:only => :name}} \n end",
"def show\n #Find the employee with id supplied from the front-end and return direct subtree of that node including the parent node\n begin @employees = Employee.find(params[:id]).subtree.arrange_serializable(:order => :id)\n render json: @employees\n rescue => err \n render json: {error: err}\n end\n end",
"def appointments(params = {})\n scope 'user_schedule'\n get('schedule/appointments/', params)\n end",
"def show\n @employee = Employee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def index\n @estimated_hours = Estimated_hour.all\n end",
"def index\n @employee_tasks = current_user.employee_tasks.all\n end",
"def index\n #@part_names = PartName.find(:all, :order => 'name')\n\t@part_names = PartName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @part_names }\n end\n end",
"def show\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def show\n @timeclocks = @job.time_clocks\n @expenses = @job.expenses\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def index\n @time_punches = TimePunch.all\n end",
"def report_data\n @data[:employees].map do |id, employee_data|\n employee = Employee.new(employee_data)\n [employee.name, week_date_ranges.map { |range| \n employee.net_hours_for_date_range(range)} ]\n end\n end",
"def index\n render json: meeting.all\n end"
] | [
"0.6266729",
"0.61180156",
"0.61168337",
"0.60730165",
"0.60275364",
"0.60162544",
"0.60093045",
"0.5994406",
"0.59692645",
"0.5864218",
"0.58239114",
"0.5779323",
"0.57791513",
"0.57663125",
"0.5761973",
"0.57558423",
"0.5752165",
"0.5749141",
"0.57457954",
"0.57160527",
"0.5713827",
"0.5705951",
"0.56916624",
"0.5683168",
"0.5680863",
"0.5676101",
"0.5638741",
"0.5638295",
"0.5635809",
"0.5634719",
"0.5628522",
"0.56254995",
"0.56205046",
"0.56021136",
"0.55898124",
"0.5574291",
"0.5539847",
"0.55253077",
"0.5512346",
"0.5510351",
"0.5504057",
"0.55032736",
"0.549822",
"0.5496219",
"0.5488719",
"0.54831225",
"0.5474818",
"0.5467761",
"0.5463593",
"0.54552305",
"0.5452243",
"0.54510915",
"0.54507387",
"0.54464304",
"0.5445467",
"0.54426426",
"0.5434804",
"0.54300535",
"0.54290354",
"0.542701",
"0.542701",
"0.54208446",
"0.54187715",
"0.5417884",
"0.54055524",
"0.54029053",
"0.5401947",
"0.5397026",
"0.5376765",
"0.53753346",
"0.5369105",
"0.536538",
"0.536538",
"0.53622776",
"0.5361385",
"0.53602505",
"0.53556967",
"0.53544354",
"0.53510094",
"0.53460455",
"0.5343366",
"0.53408986",
"0.53332293",
"0.5332249",
"0.53251547",
"0.53152055",
"0.5310554",
"0.5305686",
"0.5304087",
"0.5302211",
"0.53013104",
"0.5301112",
"0.5300032",
"0.52961725",
"0.5286463",
"0.5282201",
"0.527967",
"0.527265",
"0.52713954",
"0.5270006"
] | 0.5528122 | 37 |
GET /part_time_employees/1 GET /part_time_employees/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clock = @employee.clock_in_out\n render json: @clock\n end",
"def employee(employee_id)\n get(\"employees/#{employee_id}\")\n end",
"def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end",
"def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def show\n @officehour = Officehour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officehour }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end",
"def index\n @employees = @client.employees\n @events = fetch_events\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end",
"def show\n @work_time = WorkTime.find(params[:id])\n # search for employee for the header of the work time view in show.html.erb\n # makes use of the employee ID present in the current work time being seen\n @employee = Employee.find(@work_time.employee_id)\n\n # renders the display according to what format the URL or request was in\n respond_to do |format|\n # HTML requests will render the show.html.erb present in app/views/work_times folder\n # displays the work time in show.html.erb\n format.html { render \"work_times/show\", status: :ok }\n # JSON requests will render the employee profile in json format\n format.json { render json: @work_times, status: :ok }\n # XML requests will render the employee profile in xml format\n format.xml { render xml: @work_times, status: :ok }\n end\n end",
"def index\n @employee_workinghours = EmployeeWorkinghour.all\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def show\n @hisd_employee = HisdEmployee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hisd_employee }\n end\n end",
"def show\n @emp_date_detail = EmpDateDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_date_detail }\n end\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end",
"def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end",
"def index\n @handbook_place_employees = HandbookPlaceEmployee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @handbook_place_employees }\n end\n end",
"def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end",
"def show\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_job }\n end\n end",
"def show\n @employee = Employee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def show\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def index\n @employes = Employe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employes }\n end\n end",
"def list_employees_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n format.xls\n end\n end",
"def show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\n end\n end",
"def show\n render json: Record.where(employee_id: params[:id])\n end",
"def show\n @timesheet_entry = TimesheetEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet_entry }\n end\n end",
"def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def index\n @timesheet_entries = TimesheetEntry.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheet_entries }\n end\n end",
"def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end",
"def index\n @employments = Employment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employments }\n end\n end",
"def show\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employe }\n end\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def show\n @user_hour_requirement = UserHourRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_hour_requirement }\n end\n end",
"def index\n \n if can? :update, @user \n \n #Display all the user timesheets for the admin user \n @date = params[:month] ? Date.parse(params[:month]) : Date.today\n \n #Display only the timesheet of the employee who has logged in \n @timesheets = Timesheet.where(\"employee_id\" => params[:employee_id]).all \n \n else \n #Display all there timesheets for the proadmin and employee user\n @date = params[:month] ? Date.parse(params[:month]) : Date.today\n \n #Display only the timesheet of the employee who has logged in\n @timesheets = Timesheet.where(\"employee_id\" => current_user.employee.id).all \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheets }\n end\n end",
"def show\n @timesheet = current_user.timesheets.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def index\n if params[:id]\n @time_cards = TimeCard.where('employee_id = ?', params[:id])\n @employee = Employee.find(params[:id])\n else\n redirect_to :controller => 'full_time_employees', :action => 'index'\n end\n end",
"def v1_employees_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmployeesApi.v1_employees_get ...\"\n end\n # resource path\n local_var_path = \"/v1/employees\"\n\n # query parameters\n query_params = {}\n query_params[:'field'] = @api_client.build_collection_param(opts[:'field'], :multi) if !opts[:'field'].nil?\n query_params[:'filter'] = @api_client.build_collection_param(opts[:'filter'], :multi) if !opts[:'filter'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Employee>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmployeesApi#v1_employees_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n\n if params[:meeting_id]\n @meeting = Meeting.find(params[:meeting_id])\n end\n\n respond_to do |f|\n f.json {\n @meetings = Meeting\n start_p = Time.parse(params[:start])\n end_p = Time.parse(params[:end])\n @meetings = @meetings.where(\"start_at > ?\", params[:start])\n if start_p and end_p\n duration = end_p - start_p\n @meetings = @meetings.where(\"duration < ?\", duration)\n end\n\n render :json => @meetings.map{|m|\n {\n :id => m.id,\n :title => m.label,\n :start => m.start_at,\n :end => m.end_at,\n :url => \"/reunions/#{m.id}.js\",\n color: '#D42700',\n textColor: 'white'\n }\n }\n }\n f.html\n end\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def index\n if request.xhr?\n branch_id = Branch.find_by_id(params[:branch])\n lastname = params[:surname].mb_chars.downcase if params[:surname]\n @employees = Employee.with_lastname(lastname).with_branch(branch_id).all\n html_employees = render_to_string(partial: 'employees', layout: false,\n locals: { employees: @employees })\n unless @employees.blank?\n html_employee = render_to_string(partial: 'employee', layout: false,\n locals: { employee: @employees.first })\n end\n render json: { html_employees: html_employees, html_employee: html_employee }\n else\n @employees = Employee.all\n end\n end",
"def employee_index\n @v1_employee = V1::Employee.find(params[:employee_id])\n\n if @current_user.admin? or @current_user.company_id === @v1_employee.company.id\n @v1_activity = V1::Activity.where( employee_id: @v1_employee.id )\n\n render json: @v1_activity\n else\n render json: {error: 'forbidden'}, status: :forbidden\n end\n end",
"def get_part_by_company_part\n @parts = PartsController::PartService.get_part_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend",
"def index\n @program_employees = ProgramEmployee.all\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @employment = Employment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employment }\n end\n end",
"def show\n @employ = Employ.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employ }\n end\n end",
"def index\n @office_hour_details = OfficeHourDetail.all\n end",
"def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end",
"def show\n @program_employee = ProgramEmployee.find(params[:id])\n @employees = @program_employee.program_location.program_employees\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n #Find the employee with id supplied from the front-end and return direct subtree of that node including the parent node\n begin @employees = Employee.find(params[:id]).subtree.arrange_serializable(:order => :id)\n render json: @employees\n rescue => err \n render json: {error: err}\n end\n end",
"def index\n @vhours = Vhour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vhours }\n end\n end",
"def part_time_employee_params\n params.require(:part_time_employee).permit(:dateOfHire, :dateOfTermination, :hourlyRate)\n end",
"def index\n @timesheets = Timesheet.all\n render json: @timesheets\n end",
"def create\n @employee = Employee.new(employee_params)\n @employee.editor_id = current_user.id\n @part_time_employee = PartTimeEmployee.new(part_time_employee_params)\n if isAdmin\n @part_time_employee.verified = 1\n end\n respond_to do |format|\n @part_time_employee.valid?\n if @employee.valid? && @part_time_employee.valid?\n if @employee.save\n @part_time_employee.employee = Employee.find(@employee.id)\n format.json { render :show, status: :created, location: @employee }\n if @part_time_employee.save\n @logs = Log.new\n @logs.employeeInfo = @employee.to_json\n @logs.additionalInfo = @part_time_employee.to_json\n @logs.CRUD = \"Create\"\n @logs.table = \"Full Time Employee\"\n @logs.who = current_user.name\n @logs.save\n format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' }\n format.json { render :show, status: :created, location: @part_time_employee }\n end\n end\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n\n #format.html { render :new }\n format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def index\r\n @officehours = Officehour.all\r\n end",
"def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end",
"def show\n @handbook_place_employee = HandbookPlaceEmployee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @handbook_place_employee }\n end\n end",
"def index\n @appointments = Appointment.all \n render json: @appointments\n end",
"def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end",
"def employees\n title = \"#{@list.title}-employees\"\n partners = @list.partners\n\n respond_to do |format|\n format.csv { send_csv partners.as_csv(include: :employees), title }\n format.xlsx { send_xlsx partners.as_xlsx(include: :employees), title }\n end\n end",
"def show\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer }\n end\n end",
"def show\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_list_child }\n end\n end",
"def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end",
"def index\n @empolyees = Empolyee.all\n end",
"def show\n @job = Job.find(params[:job_id])\n @part = @job.parts.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json {render json: @part}\n end\n end",
"def employee_index\n timesheets = Timesheet.for_user(User.current)\n\n @not_submitted_ts = timesheets.is_not_submitted.paginate(:page => params[:not_submitted_ts_page], :per_page => 5)\n @submitted_ts = timesheets.is_submitted.is_not_paid.paginate(:page => params[:submitted_ts_page], :per_page => 5)\n @paid_ts = timesheets.is_paid.paginate(:page => params[:paid_ts_page], :per_page => 5)\n end",
"def index\n if !time_slot_params[:start].present? && !time_slot_params[:end].present?\n @appointments = Appointment.all\n else\n #time_slot_params[:start], time_slot_params[:end]\n @appointments = Appointment.in_time_slot_only(time_slot_params).all\n end\n render :json => @appointments, :status => :ok\n end",
"def show\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def index\n @employing_units = EmployingUnit.page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employing_units }\n end\n end",
"def show\n @employee_department = EmployeeDepartment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee_department }\n end\n end",
"def index\n org = Organization.find(current_employee.organization_id)\n @alerts = org.alerts\n render \"index.json.jbuilder\", status: :ok\n end",
"def show\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_section }\n end\n end",
"def get_employees\n @employees = User.find_user_not_admin_not_client(get_company_id)\n end",
"def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end",
"def index\n # Get all work days in the actual month\n currentTime = Time.now\n @user = current_user\n @work_days = @user.work_days.order(\"date\").where(date: currentTime.at_beginning_of_month..currentTime.at_end_of_month)\n \n # Gets sum of all the work hours\n @work_days_total_hours = @work_days.inject(0.0){|sum, item| sum+item.work_hours} || 0\n @work_days_extra_hours = @work_days_total_hours - (@work_days.count * @user.daily_hours)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_days }\n end\n end",
"def index\n @timesheets = Timesheet.all\n render :json => @timesheets,:include => {:project => {:only => :name}} \n end",
"def index\n @work_times = WorkTime.all\n\n # below are filters for the employee list\n # header title is for the index views for each queries\n @header_title = \"All Employee\"\n # query for the work time ID\n # filter list according to a specific work time ID\n # id is usually given by default in rails andis used mainly in the show method\n if id = params[:id]\n @header_title = \"\"\n @work_times = @work_times.where(id: id)\n end\n # query for work time under a certain employee through their employee ID\n # filter list according to employee ID\n if employee_id = params[:employee_id]\n employee = Employee.find(employee_id)\n @header_title = \"#{employee.name}'s\"\n @work_times = @work_times.where(employee_id: employee_id)\n end\n # query for work time of a specific time of scan\n # filter list according to the time the work time had been scanned or made\n # must input until the last second\n # format: HH:MM:SS\n if time_of_scan = params[:time_of_scan]\n @header_title = \"All #{time_of_scan} timed\"\n @work_times = @work_times.where(employee_id: employee_id)\n end \n # query for time flag of work times\n # filter list according to what is logged in or what is logged out in the table\n # only two choices must be \"logged_in\" or \"logged_out\" else it will return nothing\n if time_flag = params[:time_flag]\n @header_title = \"All #{employee.name}'s\"\n @work_times = @work_times.where(employee_id: employee_id)\n end \n # query for the date of the work time\n # filter list according to the date of creation of the work time\n # format: YYYY-MM-DD\n if work_date = params[:work_date]\n if params[:work_date] = Date.current\n @header_title = \"Today's\"\n else\n @header_title = \"All #{params[:work_date]} Dated\"\n end\n @work_times = @work_times.where(work_date: work_date)\n end \n\n # renders the display according to what format the URL or request was in\n respond_to do |format|\n # HTML requests will render the index.html.erb present in app/views/work_times folder\n # displays the list of work times in index.html.erb\n format.html { render \"work_times/index\", status: :ok }\n # JSON requests will render the list of work times in json format\n format.json { render json: @work_times, status: :ok }\n # XML requests will render the list of work times in xml format\n format.xml { render xml: @work_times, status: :ok }\n end\n end",
"def index\n @employee_details = EmployeeDetail.all\n \n end",
"def show\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @theoretical_part }\r\n end\r\n end",
"def employee_all\n\t\trespond_to do |format|\n\t\t format.js\n\t\tend\n\tend",
"def index\n #@part_names = PartName.find(:all, :order => 'name')\n\t@part_names = PartName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @part_names }\n end\n end",
"def show\n @employee_terminal = EmployeeTerminal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee_terminal }\n end\n end",
"def show\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytime }\n end\n end",
"def new\n @scheduled_employee = ScheduledEmployee.new(params[:scheduled_employee])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_employee }\n end\n end",
"def show\n @employing_unit = EmployingUnit.find(params[:id])\n @job=Job.new\n @jobs=@employing_unit.jobs\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employing_unit }\n end\n end",
"def show\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @working_time }\n end\n end",
"def show\n @toyota_epc_part_number_application_to_models_child = ToyotaEpc::PartNumberApplicationToModelsChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_application_to_models_child }\n end\n end",
"def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end",
"def attendances\n # nothing here, everything is asked to JSON API\n # this action should render initial template only.\n end",
"def index\n if isAdmin\n @part_time_employees = PartTimeEmployee.all\n elsif isGeneral\n @part_time_employees = PartTimeEmployee.where('dateofTermination >= ? OR dateofTermination is null', DateTime.now)\n else\n redirect_to :controller => 'sessions', :action => 'new'\n end\n end",
"def show\n @planning_time = PlanningTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planning_time }\n end\n end",
"def list_employees(order: nil,\n begin_updated_at: nil,\n end_updated_at: nil,\n begin_created_at: nil,\n end_created_at: nil,\n status: nil,\n external_id: nil,\n limit: nil,\n batch_token: nil)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/employees'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'order' => order,\n 'begin_updated_at' => begin_updated_at,\n 'end_updated_at' => end_updated_at,\n 'begin_created_at' => begin_created_at,\n 'end_created_at' => end_created_at,\n 'status' => status,\n 'external_id' => external_id,\n 'limit' => limit,\n 'batch_token' => batch_token\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def index\n @employee_rooms = EmployeeRoom.all\n end",
"def show\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wait_time }\n end\n end",
"def list_employees_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmployeesApi.list_employees ...\"\n end\n # resource path\n local_var_path = \"/v2/employees\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'location_id'] = opts[:'location_id'] if !opts[:'location_id'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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 header_params['Square-Version'] = \"2019-06-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(: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 => 'ListEmployeesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmployeesApi#list_employees\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.6313151",
"0.62829584",
"0.6179917",
"0.61059195",
"0.60353774",
"0.602566",
"0.6008278",
"0.5951128",
"0.5935665",
"0.5908674",
"0.5893894",
"0.58767277",
"0.58426976",
"0.583289",
"0.58322173",
"0.58062303",
"0.5798063",
"0.5776785",
"0.57633984",
"0.5755999",
"0.57464755",
"0.5746391",
"0.57436323",
"0.5742727",
"0.5711501",
"0.5696078",
"0.569252",
"0.56905985",
"0.56873095",
"0.56807023",
"0.56798875",
"0.5675768",
"0.56686",
"0.56663406",
"0.5661485",
"0.56589186",
"0.5658048",
"0.5647784",
"0.5641458",
"0.5638135",
"0.5636601",
"0.5636601",
"0.5618558",
"0.56167907",
"0.56083345",
"0.5598374",
"0.5580076",
"0.5578364",
"0.5567003",
"0.5562848",
"0.5562759",
"0.5552843",
"0.55519974",
"0.55519974",
"0.55448246",
"0.55340433",
"0.5520473",
"0.5513462",
"0.5508102",
"0.54960877",
"0.54854757",
"0.5475174",
"0.5474559",
"0.54737633",
"0.5468122",
"0.5465818",
"0.5464007",
"0.5461114",
"0.54609185",
"0.5460263",
"0.54600376",
"0.54575956",
"0.544473",
"0.54392046",
"0.54336053",
"0.5423061",
"0.5422861",
"0.5419484",
"0.5417542",
"0.54088134",
"0.5405632",
"0.5404991",
"0.5403623",
"0.54004425",
"0.53991836",
"0.5397186",
"0.53963405",
"0.53960115",
"0.5395376",
"0.5388084",
"0.53864145",
"0.5383891",
"0.53782344",
"0.53754777",
"0.5374898",
"0.5373405",
"0.5373305",
"0.5371995",
"0.5365872",
"0.5363337",
"0.536283"
] | 0.0 | -1 |
POST /part_time_employees POST /part_time_employees.json | def create
@employee = Employee.new(employee_params)
@employee.editor_id = current_user.id
@part_time_employee = PartTimeEmployee.new(part_time_employee_params)
if isAdmin
@part_time_employee.verified = 1
end
respond_to do |format|
@part_time_employee.valid?
if @employee.valid? && @part_time_employee.valid?
if @employee.save
@part_time_employee.employee = Employee.find(@employee.id)
format.json { render :show, status: :created, location: @employee }
if @part_time_employee.save
@logs = Log.new
@logs.employeeInfo = @employee.to_json
@logs.additionalInfo = @part_time_employee.to_json
@logs.CRUD = "Create"
@logs.table = "Full Time Employee"
@logs.who = current_user.name
@logs.save
format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' }
format.json { render :show, status: :created, location: @part_time_employee }
end
end
else
format.html { render :new }
format.json { render json: @employee.errors, status: :unprocessable_entity }
#format.html { render :new }
format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def part_time_employee_params\n params.require(:part_time_employee).permit(:dateOfHire, :dateOfTermination, :hourlyRate)\n end",
"def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end",
"def timesheet_params\n params.require(:timesheet).permit(:employee_id, :company, :date, :start_time, :end_time)\n end",
"def create\n today = Date.today # Today's date %>\n days_from_this_week = (today.at_beginning_of_week..today.at_end_of_week).map\n\n employee = Employee.where(:id => params[\"work_duration\"][\"eid\"]).first\n\n # First iterate over all the vendors this employee has\n for vendor in employee.vendors\n # Project is the relationship between employee and vendor, also workDuration record is attached to this relationship so we need to fetch it first\n project = employee.projects.where(:vendor_id => vendor.id).first\n\n # Next iterate over all the hours each day has\n (today.at_beginning_of_week..today.at_end_of_week).map.each_with_index do |day, index|\n\n # extract the number of hours for each \n hours_worked = params[\"work_duration\"][[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\"][index]+vendor.id.to_s]\n\n\n # Try to fetch the work duration object for the day that we are iterating over\n @work_duration = project.work_durations.where(work_day:day).first\n\n # if we did not find a pre existing work duration create new one else update oldone\n if @work_duration == nil\n @work_duration = project.work_durations.create(hours:hours_worked, work_day:day)\n else\n @work_duration.update_attributes(:hours => hours_worked)\n end\n end\n end\n #@work_duration = WorkDuration.new(work_duration_params)\n\n respond_to do |format|\n if @work_duration.save\n format.html { redirect_to employee, notice: 'Work duration was successfully created.' }\n format.json { render :show, status: :created, location: @work_duration }\n else\n format.html { render :new }\n format.json { render json: @work_duration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_params\n params.require(:employee).permit(:firstname, :lastname, :email, :monstart, :monfinish, :tuestart, :tuefinish, :wedstart, :wedfinish, :thurstart, :thurfinish, :fristart, :frifinish, :satstart, :satfinish, :sunstart, :sunfinish, :desired, :monstart_human, :monfinish_human, :tuestart_human, :tuefinish_human, :wedstart_human, :wedfinish_human, :thurstart_human, :thurfinish_human, :fristart_human, :frifinish_human, :satstart_human, :satfinish_human, :sunstart_human, :sunfinish_human)\n end",
"def timesheet_params\n params.require(:timesheet).permit(:log_date, :hours_spent, :employee_id)\n end",
"def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n Cutofftotalsalary.create(cutoff_id: Cutoff.last.id, employee_name: @employee.name, sss: @employee.sss, philhealth: @employee.philhealth, pagibig: @employee.pagibig, withholding_tax: @employee.withholding_tax)\n ThirteenthMonthPay.create(thirteenth_month_id: Date.today.strftime(\"%Y\").to_i, employee_name: @employee.name)\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_off_instance = TimeOffInstance.new(time_off_instance_params)\n #@time_off_instance.employee.hours_left -= @time_off_instance.hours_used\n respond_to do |format|\n if @time_off_instance.save\n self.use_pto_hours\n #print \"HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE\"\n format.html { redirect_to @time_off_instance, notice: 'Time off instance was successfully created.' }\n format.json { render :show, status: :created, location: @time_off_instance }\n else\n format.html { render :new }\n format.json { render json: @time_off_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if isAdmin\n @part_time_employee = PartTimeEmployee.find(params[:id])\n @employee = @part_time_employee.employee\n\n @part_time_employee.assign_attributes(part_time_employee_params)\n @employee.assign_attributes(employee_params)\n respond_to do |format|\n @part_time_employee.valid?\n if @employee.valid? && @part_time_employee.valid?\n @employee.editor_id = current_user.id\n if @part_time_employee.part_time_employees_id != nil\n @realFulltime = PartTimeEmployee.find(@part_time_employee.part_time_employees_id)\n @realEmployee = Employee.find(@realFulltime.employee_id)\n\n @realFulltime.dateOfHire = @part_time_employee.dateOfHire\n @realFulltime.dateofTermination = @part_time_employee.dateofTermination\n @realFulltime.hourlyRate = @part_time_employee.hourlyRate\n @realFulltime.verified = 1\n\n @realEmployee.lastName = @employee.lastName\n @realEmployee.firstName = @employee.firstName\n @realEmployee.sin = @employee.sin\n @realEmployee.dateOfBirth = @employee.dateOfBirth\n @realEmployee.reasonForLeaving = @employee.reasonForLeaving\n @realEmployee.company_id = @employee.company_id\n @realEmployee.editor_id = current_user.id\n\n @realEmployee.save\n @realFulltime.save\n\n @part_time_employee.destroy\n @employee.destroy\n else\n @logs = Log.new\n @logs.employeeInfo = @employee.to_json\n @logs.additionalInfo = @part_time_employee.to_json\n @logs.CRUD = \"Update\"\n @logs.table = \"Full Time Employee\"\n @logs.who = current_user.name\n @logs.save\n @employee.save\n @part_time_employee.save\n end\n format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @part_time_employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n\n #format.html { render :new }\n format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }\n end\n end\n else\n @employee = Employee.new(employee_params)\n\n @employee.editor_id = current_user.id\n @part_time_employee = PartTimeEmployee.new(part_time_employee_params)\n @oldFullTime = PartTimeEmployee.find(params[:id])\n @oldFullTimeId = @oldFullTime.part_time_employees_id\n if @oldFullTimeId == nil\n @oldFullTimeId = @oldFullTime.id\n end\n @part_time_employee.part_time_employees_id = @oldFullTimeId\n @part_time_employee.hourlyRate = PartTimeEmployee.find(params[:id]).hourlyRate\n\n respond_to do |format|\n @part_time_employee.valid?\n if @employee.valid? && @part_time_employee.valid?\n if @employee.save\n @part_time_employee.employee = Employee.find(@employee.id)\n format.json { render :show, status: :created, location: @employee }\n @logs = Log.new\n @logs.employeeInfo = @employee.to_json\n @logs.additionalInfo = @part_time_employee.to_json\n @logs.CRUD = \"Update\"\n @logs.table = \"Full Time Employee\"\n @logs.who = current_user.name\n @logs.save\n if @part_time_employee.save\n format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' }\n format.json { render :show, status: :created, location: @part_time_employee }\n end\n end\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n\n #format.html { render :new }\n format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @timesheet = Timesheet.new(params[:timesheet])\n\n #Assign employee id of the user logged in\n @timesheet.employee_id = current_user.employee.id\n \n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully created.' }\n format.json { render json: @timesheet, status: :created, location: @timesheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timesheet = Incident.find(params[:incident_id]).timesheet\n\t@emt = @timesheet.emts.build(params[:emt])\n\n respond_to do |format|\n if @emt.save\n format.html { redirect_to(edit_incident_timesheet_path, :notice => 'EMT was successfully created.') }\n else\n format.html { render :new }\n end\n end\n end",
"def employee_params\n params.require(:employee).permit(:name, :title, :status, :employment_type, :attendance_type_id, :hourly_rate, :location, :capitalizable_group_id, :leave_days, :commencement_date, :termination_date)\n end",
"def time_off_instance_params\n params.require(:time_off_instance).permit(:employee_id, :hours_used, :reason)\n end",
"def work_day_params\n params.require(:work_day).permit(:start_time, :end_time, :employee_id)\n end",
"def create\n @employee_week_off = EmployeeWeekOff.new(employee_week_off_params)\n\n respond_to do |format|\n if @employee_week_off.save\n format.html { redirect_to @employee_week_off, notice: 'Employee week off was successfully created.' }\n format.json { render :show, status: :created, location: @employee_week_off }\n else\n format.html { render :new }\n format.json { render json: @employee_week_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_workinghour = EmployeeWorkinghour.new(employee_workinghour_params)\n\n respond_to do |format|\n if @employee_workinghour.save\n format.html { redirect_to @employee_workinghour, notice: 'Employee workinghour was successfully created.' }\n format.json { render :show, status: :created, location: @employee_workinghour }\n else\n format.html { render :new }\n format.json { render json: @employee_workinghour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @work_day = WorkDay.new(work_day_params)\n\t\t#delete for today everything else \n\t\tWorkDay.select{|wd| wd.employee_id == @work_day.employee_id}.each do |wd|\n\t\t\twd.destroy\n\t\tend\n\t\t\n respond_to do |format|\n\t\t\t#validation line, make sure that this employee doesnt already have a schedule for today\n if !(WorkDay.all.select{|work_day| work_day.start_time.day == @work_day.start_time.day && work_day.employee_id == @work_day.employee_id}.any?)\n\t\t\t\t@work_day.save\n format.html { redirect_to @work_day, notice: 'Work day was successfully created.' }\n format.json { render :show, status: :created, location: @work_day }\n else\n format.html { render :new }\n format.json { render json: @work_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def overtime_params\n params.require(:overtime).permit(:start_date, :end_date, :employee_id, :report_id, :hours)\n end",
"def create\n current_account.parties.create(params[:parties].values)\n @date = params[:parties].values.first[:created_at].to_time\n @parties = current_account.parties.by_month(@date.month, :year => @date.year)\n @daily = @parties.select{|p| p.created_at.to_date == @date.to_date}.group_by(&:game)\n @count = @parties.size\n find_yours(@parties)\n @games = compute_monthly_played(@parties, @date.beginning_of_month)\n respond_to do |format|\n format.js\n end\n end",
"def create\n @hour_bank_employee = HourBankEmployee.new(params[:hour_bank_employee])\n\n respond_to do |format|\n if @hour_bank_employee.save\n format.html { redirect_to employees_path, notice: 'Hour bank employee was successfully created.' }\n format.json { render json: @hour_bank_employees, status: :created, location: @hour_bank_employee }\n else\n\trender action:\"edit\"\n end\n end\n end",
"def add_timesheet_entry(login_id, project_id, task_id, entry_date, time_in, time_out, comment)\n [{ \"Action\" => \"Edit\",\n \"Type\" => \"Replicon.Suite.Domain.EntryTimesheet\",\n \"Identity\" => login_id,\n \"Operations\" => [\n { \"__operation\" => \"CollectionAdd\",\n \"Collection\" => \"TimeEntries\",\n \"Operations\" => [\n { \"__operation\" => \"SetProperties\",\n \"CalculationModeObject\" => { \"__type\" => \"Replicon.TimeSheet.Domain.CalculationModeObject\", \"Identity\" => \"CalculateDuration\" },\n \"EntryDate\" => { \"__type\" => \"Date\", \"Year\" => entry_date.year, \"Month\" => entry_date.month, \"Day\" => entry_date.day },\n \"TimeIn\" => { \"__type\" => \"Time\", \"Hour\" => time_in.hour, \"Minute\" => time_in.min },\n \"TimeOut\" => {\"__type\" => \"Time\", \"Hour\" => time_out.hour, \"Minute\" => time_out.min },\n \"Comments\" => comment,\n \"Task\" => { \"Identity\" => task_id },\n \"Activity\" => { \"Identity\" => \"1\" }\n },\n { \"__operation\" => \"SetTimeEntryBilling\",\n \"BillingType\" => { \"__type\" => \"Replicon.Project.Domain.Timesheets.TimesheetBillingType\", \"Identity\" => \"NonBillable\" },\n \"Project\" => { \"__type\" => \"Replicon.Project.Domain.Project\", \"Identity\" => project_id }\n }\n ]\n }\n ]\n }\n ]\nend",
"def water_history_params\n params.require(:water_history).permit(:start_time, :end_time, :quantity, :zone_id, :employee)\n end",
"def time_registration_params\n params.fetch(:time_registration, {}).permit(:employee_id, :prestation, :date, :work_order_id, :extra)\n end",
"def create\n # employee is searched to match the authentication used to make the work time\n # did so to ensure that only the permitted people make work times\n employee = Employee.find_by(id: params[:work_time][:employee_id])\n @work_time = WorkTime.new(work_time_params)\n\n # check if there is an employee logged in\n unless current_user.nil?\n # if there is, checks if the user is an admin\n if admin_mode?\n # if the user is an admin, check if the work time is saved\n if @work_time.save\n # if saved successfully, controller issues a response according to the format given\n respond_to do |format|\n # HTML, controller redirects user back to the work time index and makes a notice\n format.html { redirect_to api_work_times_path, notice: \"work time created!\" }\n # JSON renders the work time made and gives the created status response\n format.json { render json: @work_time, status: :created, location: [ :api, @work_time ] }\n # XML renders the work time made in XML and gives the created status response\n format.xml { render xml: @work_time, status: :created, location: [ :api, @work_time ] }\n end\n else\n # if errors occured like wrong information/wrong format and so on, issues a response according to format\n respond_to do |format|\n # HTML redirects back to the work time creation page and shows the errors encountered\n format.html { redirect_to new_api_work_time_path, notice: @work_time.errors.full_messages }\n # JSON renders the errors encountered in JSON and give a negative response\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n # XML renders the errors encountered in XML and give a negative response\n format.xml { render xml: @work_time.errors, status: :unprocessable_entity }\n end\n end\n else\n # if the user is not an admin, controller issues a response according to format\n respond_to do |format|\n # HTML redirects back to the work time creation page and show the notice\n format.html { redirect_to new_api_work_time_path, notice: \"Can't do that! Admins only\" }\n # JSON renders the errors encountered in JSON and give a negative response\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n # XML renders the errors encountered in XML and give a negative response\n format.xml { render xml: @work_time.errors, status: :unprocessable_entity }\n end\n end\n else\n # if no users are logged in, checks if entered employee ID and password match\n if (employee && employee.authenticate(params[:work_time][:password]))\n # checks if the work time is saved successfully\n if @work_time.save\n # if saved successfully, controller issues a response according to the format given\n respond_to do |format|\n # for HTML, checks if if the work time done is a time in/log in by the employee\n if params[:work_time][:time_flag] == \"logged_in\"\n # if it is a log in, it redirects back to the work time creation page and gives a welcome notice\n format.html { redirect_to root_path, notice: \"Work time created! Welcome #{employee.name}\" }\n else\n # else, it redirects back to the work time creation page and gives a goodbye notice\n format.html { redirect_to root_path, notice: \"Work time created! Goodbye #{employee.name}\" }\n end\n # JSON renders the work time made and gives the created status response\n format.json { render json: @work_time, status: :created, location: [ :api, @work_time ] }\n # XML renders the work time made and gives the created status response\n format.xml { render xml: @work_time, status: :created, location: [ :api, @work_time ] }\n end\n else\n # if errors occured like wrong information/wrong format and so on, issues a response according to format\n respond_to do |format|\n # HTML redirects back to the work time creation page and shows the errors encountered\n format.html { redirect_to root_path, notice: @work_time.errors.full_messages }\n # JSON renders the errors encountered in JSON and give a negative response\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n # XML renders the errors encountered in XML and give a negative response\n format.xml { render xml: @work_time.errors, status: :unprocessable_entity }\n end\n end\n else\n # if employee ID and password do not match, issues a response according to format\n respond_to do |format|\n # HTML redirects back to the work time creation page and shows the notice\n format.html { redirect_to root_path, notice: \"Invalid ID and Password combination!\" }\n # JSON renders the errors encountered in JSON and give a negative response\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n # XML renders the errors encountered in XML and give a negative response\n format.xml { render xml: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @officehour = Officehour.new(params[:officehour])\n\n respond_to do |format|\n if @officehour.save\n\tformat.html { redirect_to @officehour, notice: 'Officehour was successfully created.' }\n\tformat.json { render json: @officehour, status: :created, location: @officehour }\n else\n\tformat.html { render action: \"new\" }\n\tformat.json { render json: @officehour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_params\n params.require(:employee).permit(:worker_id, :run, :names, :lastnames, :email, :addres, :birthdate, :contract_type, :weekly_hours, :avatar, :branch_office_id)\n end",
"def time_management_sheet_params\n params.require(:time_management_sheet).permit(:year, :month, :employee_num, :company_name, :department_code, :instruction_id, :team_code, :work_task_id, :work_process_id, :man_hour)\n end",
"def create\n @timeslot = Timeslot.new(timeslot_params)\n @current_faculty = Faculty.where(email: current_user.email).first\n @timeslot.faculty_id = @current_faculty.id\n @timeslot.title = \"Timeslot Available for #{@current_faculty.full_name}\"\n @timeslot.end = (@timeslot.start.to_time + 1.hours).to_datetime\n @timeslot.save\n\n respond_to do |format|\n if @timeslot.save\n format.json {render :json => @timeslot}\n else\n format.json {render :status => 400}\n end\n end\n end",
"def elective_day_params\n params.require(:elective_day).permit(:num, :time, :elective_id)\n end",
"def create\n @worked_hour.save\n\n respond_with(@worked_hour)\n end",
"def employee_params\n params.require(:employee).permit(:full_name, :nid, :contact, :email, :location, :hourly_rate, :note)\n end",
"def build_enphase_energy_data(start_time, end_time, response)\n body_json = JSON.parse(response.body)\n eel = build_enphase_energy_lifetime(body_json) \n build_enphase_energy_lifetime_daily_readings(eel, body_json)\n build_data_harvest(start_time, end_time, response)\n \n total_end_time = Time.now.to_f\n build_job(start_time, total_end_time)\n end",
"def create\n @workSegment = @workday.workSegments.last\n puts @workSegment.workday.dayDate\n # if @workSegment.timePunches.count == 0\n # @currentStatus = false\n # else\n # @lastTimePunch = @workSegment.timePunches.last\n # @currentStatus = @lastTimePunch.status\n # end\n\n @time_punch = @workSegment.timePunches.new(punch: Time.current, status: true)\n\n respond_to do |format|\n if @time_punch.save\n format.html { redirect_to dashboard_path, notice: 'Time punch was successfully created.' }\n # format.json { render :show, status: :created, location: @time_punch }\n else\n format.html { redirect_to dashboard_path, notice: 'clock record was not created(from tp controller).' }\n # format.json { render json: @time_punch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_workinghour_params\n params.require(:employee_workinghour).permit(:employee_id, :working_hour_id)\n end",
"def employee_params\n params.require(:employee).permit(:enterprise_id, :name, :birthday, :age, :dni, :address, :way, :numb_depart_int, :sex, :assignment,:urbanization, :district, :province, :department, :resi_in_place_work, :time_place_work, :essalud, :eps, :sctr, :other, :email, :civil_status, :degree_instruction, :number_children, :number_dependents, :phone, :pathologicals_history => {}, :pathologicals_history_family => {}, occupational_histories_attributes: [OccupationalHistory.attribute_names.map(&:to_sym).push(:_destroy)], absenteeisms_attributes: [Absenteeism.attribute_names.map(&:to_sym).push(:_destroy)])\n end",
"def timesheet_task_params\n params.require(:timesheet_task).permit(:employee_id, :project_id, :activity, :date, :working_hours, :site_name, :project_region_id, :vehicle_number, :vehicle_owner_id, :holiday, :attachment_link)\n end",
"def create\n if :opr == 'edit'\n update\n else\n @employee = Employee.create({:name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end\n\n\n end",
"def create\n @time_entry = current_user.time_entries.build(params[:time_entry])\n @time_entry.entry_user_id = current_user.id\n\n if @time_entry.invoice_id.nil?\n # create from index page\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n else\n # create from edit invoice page\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to edit_firm_invoice_path(current_firm, @time_entry.invoice_id), notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { new_from_invoice }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n\n @paid_offdays = PaidOffday.all\n @paid_offday = PaidOffday.create(paid_offday_params)\n\n @employees = Employee.all.order(:first_name)\n @paid_offday_types = PaidOffdayType.all.order(:paid_offday_type_title)\n @orders = Order.all.order(:order_no)\n\n=begin\n @paid_offday = PaidOffday.new(paid_offday_params)\n\n respond_to do |format|\n if @paid_offday.save\n format.html { redirect_to @paid_offday, notice: 'Paid offday was successfully created.' }\n format.json { render :show, status: :created, location: @paid_offday }\n else\n format.html { render :new }\n format.json { render json: @paid_offday.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def create\n @scheduled_employee = ScheduledEmployee.new(params[:scheduled_employee])\n\n respond_to do |format|\n if @scheduled_employee.save\n format.html { redirect_to @scheduled_employee, notice: 'Scheduled employe was successfully created.' }\n format.json { render json: @scheduled_employee, status: :created, location: @scheduled_employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduled_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @repair_hours_entry = RepairHoursEntry.new(params[:repair_hours_entry])\n @eab_project = EabProject.find_by_id(params[:eab])\n\n if @eab_project.nil? || @eab_project.user != current_user || @eab_project.status >= 400\n flash[:error] = \"You do not have an active EAB Project with the given ID.\"\n redirect_to root_path and return\n end\n \n @bike = @eab_project.bike\n @repair_hours_entry.eab_project_id = @eab_project.id\n @repair_hours_entry.user_id = @eab_project.user_id\n @repair_hours_entry.bike_id = @eab_project.bike_id\n \n #Parsing the users String DateTime into acutal DateTime objects\n @repair_hours_entry.start_time = DateTime.strptime(params[:start_datetime],\"%m/%d/%Y %l:%M %p\")\n @repair_hours_entry.end_time = DateTime.strptime(params[:end_datetime],\"%m/%d/%Y %l:%M %p\")\n \n if @repair_hours_entry.end_time < @repair_hours_entry.start_time\n @repair_hours_entry.errors.add(:start_time, \"is past your End time\")\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @repair_hours_entry.errors, status: :unprocessable_entity }\n end\n return\n end\n \n if @repair_hours_entry.end_time.to_date != @repair_hours_entry.start_time.to_date\n @repair_hours_entry.errors.add(:end_time, \"is not in the same Day\")\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @repair_hours_entry.errors, status: :unprocessable_entity }\n end\n return\n end\n \n respond_to do |format|\n if @repair_hours_entry.save\n format.html { redirect_to @repair_hours_entry, notice: 'Repair hours entry was successfully created.' }\n format.json { render json: @repair_hours_entry, status: :created, location: @repair_hours_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repair_hours_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hour_type_params\n params.require(:hour_type).permit(:title, :price_factor, department_ids: [], job_type_ids: [])\n end",
"def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end",
"def create\n\n \t\t\t@teetime = Teetime.new teetime_params\n\n \t\t\tif @teetime.save\n\n \t\t\t\trender json: @teetime,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def entrant_params\n params.permit(:date, :name, :time, :email)\n end",
"def create\n\n params[:timesheet].each do |key,value|\n Timesheet.create(:project_id => value[:project_id],:description => value[:description],:hours => value[:hours])\n end\n redirect_to \"/timesheets\",notice: \"Timesheet created successfully\" \n end",
"def employee_params\n params.require(:employee).permit(:name, :address, :phone, :rfc, :email, :published)\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end",
"def new\n \n @timesheet = Timesheet.new\n \n 1.times do\n project_effort = @timesheet.project_efforts.build\n 1.times { project_effort.tasks.build }\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def create\n @entry = @time_sheet.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n # [@user, @time_sheet, @entry]\n # user_time_sheet_entries_path(@user, @time_sheet)\n format.html { redirect_to user_time_sheet_entries_path(@user, @time_sheet), notice: 'Hours were successfully added.' }\n format.json { render json: [@user, @time_sheet, @entry], status: :created, location: [@user, @time_sheet, @entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @unpaid_offdays = UnpaidOffday.all\n @unpaid_offday = UnpaidOffday.create(unpaid_offday_params)\n\n @employees = Employee.all.order(:first_name)\n @unpaid_offday_types = UnpaidOffdayType.all.order(:unpaid_offday_type_title)\n @orders = Order.all.order(:order_no)\n\n=begin\n @unpaid_offday = UnpaidOffday.new(unpaid_offday_params)\n\n respond_to do |format|\n if @unpaid_offday.save\n format.html { redirect_to @unpaid_offday, notice: 'Unpaid offday was successfully created.' }\n format.json { render :show, status: :created, location: @unpaid_offday }\n else\n format.html { render :new }\n format.json { render json: @unpaid_offday.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def create\n byebug\n @employee = Employee.new(employee_params)\n\n params[:skills][:skill_id].each do |skill|\n byebug\n if !skill.empty?\n @employee.empskill.build(:skill_id => skill)\n end\n end\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, :format => @user }\n format.json { render :show, status: :created, location: @employee, :format => @user }\n else\n flash[:notice] = \"Mandatory fields are empty\"\n format.html { render :employees }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @office_hour_detail = OfficeHourDetail.new(office_hour_detail_params)\n\n respond_to do |format|\n if @office_hour_detail.save\n format.html { redirect_to @office_hour_detail, notice: 'Office hour detail was successfully created.' }\n format.json { render :show, status: :created, location: @office_hour_detail }\n else\n format.html { render :new }\n format.json { render json: @office_hour_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def office_hour_detail_params\n params.require(:office_hour_detail).permit(:office_hour_id, :agent_id, :turno_hora, :lunes, :martes, :miercoles, :jueves, :viernes, :sabado, :domingo, :total_hours, :rest_hours)\n end",
"def poi_time_params\n params.require(:poi_time).permit(:start_time, :end_time, :itinerary_id, :poi_id)\n end",
"def work_time_params\n params.require(:work_time).permit(:employee_id, :time_of_scan, :time_flag, :work_date)\n end",
"def create\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.value = (@time_record.ended_at - @time_record.started_at) / 1.hour\n @time_record.recorded_on = @time_record.started_at.to_date\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to time_records_path, notice: 'Time record was successfully created.' }\n format.json { render json: @time_record.to_json, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_task = current_user.employee_tasks.build(employee_task_params)\n\n respond_to do |format|\n if @employee_task.save\n format.html { redirect_to @employee_task, notice: 'Employee task was successfully created.' }\n format.json { render :show, status: :created, location: @employee_task }\n else\n format.html { render :new }\n format.json { render json: @employee_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_record = WorkTimeRecord.new(time_record_params)\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to @time_record, notice: 'Time record was successfully created.' }\n format.json { render :show, status: :created, location: @time_record }\n else\n format.html { render :new }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_availability_params\n params.require(:employee_availability).permit(:employee_id, :start_date, :end_date)\n end",
"def timesheet_params\n params.require(:timesheet).permit(:week, :job_id, :reg_hours, :ot_hours, :gross_pay, \n :shifts_attributes => [:id, :state, :job_id, :needs_adj, :employee_id, :note, \n :time_in, :time_out, :break_out, :break_in, :break_duration, :in_ip, :out_ip, :_destroy])\n end",
"def destroy\n @part_time_employee.destroy\n respond_to do |format|\n format.html { redirect_to part_time_employees_url, notice: 'Part time employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def jobtime_shedule\n @jobtime = Jobtime.new(params[:jobtime])\n\n @qty = @jobtime.qty.to_i.hours\n @item = Item.find(@jobtime.service)\n\n #calculate end_time\n @jobtime.end_time = @jobtime.start_time+@qty\n\n #calculate cost\n @jobtime.cost = @item.unit_cost * @qty\n\n #calculate price\n if(@jobtime.billable.present?)\n @jobtime.price = @item.unit_price * @qty\n else\n @jobtime.price = 0\n end\n puts @jobtime.errors.inspect\n if @jobtime.save\n response_message = {:message => \"Time was scheduled successfully.\",:jobtime => @jobtime }\n else\n response_message = {:message => \"Please try again.\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{render :json => response_message }\n end\n end",
"def time_line_params\n params.require(:time_line).permit(:work_id, :remaing_hours, :stage_id, :task_id, :task_status_id)\n end",
"def create_employee(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/employees'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def create_HR_record employee\n \n processed_record = \".\" \n \n firstname = employee[0].split(\" \")[0]\n lastname = employee[0].split(\" \")[1]\n fullname = employee[0]\n dept = @managers.has_value?(fullname.to_s) ? @managers.key(fullname.to_s) : get_dept #check if employee fullname already exists in MANAGERS hash if so use dept\n job_title = @managers.has_value?(fullname.to_s) ? \"Manager\" : get_title(dept) #check if employee fullname already exists in MANAGERS hash is so = manager\n employeeid = get_employeeid firstname, lastname\n email = get_email firstname, lastname\n start_date = get_start_date\n end_date = get_end_date #not implemented\n manager = job_title == \"Manager\" ? \"CEO\" : @managers[dept.to_sym]\n mobile = get_phone\n location = get_continent\n\n @completed_users << \"#{employeeid},#{fullname},#{firstname},#{lastname},#{email},#{dept},#{job_title},#{manager},#{start_date},#{mobile},#{location}\"\n \n STDERR.print processed_record\nend",
"def create\n\n # binding.pry\n\n unless params[:name].nil?\n\n if Task.where(name: params[:name]).exists?\n\n task = Task.find_by_name(params[:name])\n else\n task = Task.create(name: params[\"name\"])\n end\n @time_record = TimeRecord.new(state: \"open\", task_id: task.id)\n\n else\n @time_record = TimeRecord.new(state: \"open\")\n\n end\n\n\n\n respond_to do |format|\n if @time_record.save\n if task\n task.time_records << @time_record\n end\n format.html { redirect_to edit_time_record_path(@time_record), notice: 'Time record was successfully created.' }\n format.json { render json: @time_record, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timeslot = Timeslot.new(timeslot_params)\n @timeslot.save!\n render :json => @timeslot.as_json\n end",
"def create\n @letter = Letter.new(letter_params)\n unless params[:month] == '' || params[:day] == '' \n @letter.appointment = DateTime.new(set_appointment_year(params[:year],params[:month]), params[:month].to_i, set_appointment_day(params[:month],params[:day],params[:year]), set_appointment_time(params[:time]))\n end\n \n\n\n respond_to do |format|\n if @letter.save\n\n GuestMailer.send_to_practice(@letter).deliver\n\n format.html { redirect_to @letter, notice: 'Letter was successfully created.' }\n format.json { render :show, status: :created, location: @letter }\n else\n @year_range = years\n @month_range = months\n @day_range = days\n @time_range = times\n format.html { render :new }\n format.json { render json: @letter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def timesheet_params\n params.require(:timesheet).permit(:week, :job_id, :reg_hours, :ot_hours, :gross_pay)\n end",
"def timesheet_params\n params.require(:timesheet).permit(:week, :job_id, :reg_hours, :ot_hours, :gross_pay)\n end",
"def employee_week_off_params\n params.require(:employee_week_off).permit(:week_off_master_id, :employee_id, :day, :date, :status, :is_confirm)\n end",
"def iot_datum_params\n params.require(:iot_datum).permit(:workbench_number, :part_number, :target, :lot_size, :employee_name, :employee_id, :shift, :device_id, :count, :status)\n end",
"def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end",
"def create\n params[:assignment].delete(:employee)\n @assignment = Assignment.new(params[:assignment])\n @assignment.start_date = Chronic.parse(params[:assignment][:start_date])\n @assignment.end_date = Chronic.parse(params[:assignment][:end_date])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_timesheet_row_with_billing_by_department\n [{\n \"Action\" => \"Edit\",\n \"Type\" => \"Replicon.TimeSheet.Domain.Timesheet\",\n \"Identity\" => \"46\",\n \"Operations\" => [{ \"__operation\" => \"CollectionAdd\",\n \"Collection\" => \"TimeRows\",\n \"Operations\" => [{ \"__operation\" => \"SetProperties\",\n \"Task\" => { \"__type\" => \"Replicon.Project.Domain.Task\",\n \"Identity\" => \"8\"},\n \"Client\" => { \"__type\" => \"Replicon.Project.Domain.Client\",\n \"Identity\" => \"2\"}\n },\n { \"__operation\" => \"SetTaskRowBilling\",\n \"BillingType\" => { \"__type\" => \"Replicon.Project.Domain.Timesheets.TimesheetBillingType\",\n \"Identity\" => \"DepartmentOverrideRate\"},\n \"BillingDepartment\" => { \"__type\" => \"Replicon.Domain.Department\",\n \"Identity\" => \"2\"},\n \"Project\" => { \"__type\" => \"Replicon.Project.Domain.Project\",\n \"Identity\" => \"1\"}\n }\n ]\n }\n ]\n }\n ]\nend",
"def create\n @time_slot = TimeSlot.new(params[:time_slot])\n @time_slot.user_id = current_identity.user_id\n\t@recurrence_array = []\n respond_to do |format|\n if @time_slot.save\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully created.' }\n format.json { render json: @time_slot, status: :created, location: @time_slot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submitted_timesheet_params\n params.require(:submitted_timesheet).permit(:name)\n end",
"def officehour_params\r\n params.require(:officehour).permit(:course_id, :ta_id, :start, :end, :online)\r\n end",
"def create\n @work_time = WorkTime.new(work_time_params)\n\n respond_to do |format|\n if @work_time.save\n format.html { redirect_to @work_time, notice: 'Work time was successfully created.' }\n format.json { render :show, status: :created, location: @work_time }\n else\n format.html { render :new }\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def daily_timesheet_params\n params.require(:daily_timesheet).permit(\n :facility_id,\n :employee_id,\n :date,\n :start_time,\n :end_time,\n :no_work,\n :salary_period_id,\n :rework,\n :penalty_id,\n :quality_penalty_id,\n :penalty_description,\n :probation_period,\n :payment_type_id,\n :ratio,\n :salary,\n :overtime,\n :description,\n :total_amount,\n :daily_timesheet_status_id,\n :additional_payment_value,\n :additional_payment_reason,\n daily_timesheet_work_types_attributes: [:id, :work_type_id, :amount, :_destroy],\n daily_timesheet_penalties_attributes: [:id, :penalty_id, :employee_id, :_destroy]\n )\n end",
"def create\n @workout_record = WorkoutRecord.new params[:workout_record]\n @workout_record.time = params[:time]\n if @workout_record.save\n current_user.workout_records << @workout_record\n current_user.events << @workout_record.event\n current_user.personal_records << PersonalRecord.get_record_for(current_user.id,@workout_record.workout_id)\n redirect_to :action => 'show', :id => @workout_record.id\n else\n flash[:error] = 'There was a problem saving your workout record'\n flash[:errors] = @workout_record.errors\n redirect_to :action => 'new'\n end\n end",
"def create\n @employee = current_owner.employees.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @work_order_time = WorkOrderTime.new(work_order_time_params)\n\n respond_to do |format|\n if @work_order_time.save\n format.html { redirect_to @work_order_time, notice: 'Work order time was successfully created.' }\n format.json { render :show, status: :created, location: @work_order_time }\n else\n format.html { render :new }\n format.json { render json: @work_order_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def week_schedule\n object.employees.uniq{|u| u.id}.map{|u|\n ::EmployeeSerializer.new(u, scope: scope, root: false, event: object)\n }\n end",
"def new\n @date = Date.new params[:y].to_i, params[:m].to_i, params[:d].to_i\n @title = \"Add time entry for #{@date}\"\n @timesheet = Timesheet.new :day => @date, :hours => 8\n @accounts = Account.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def create_employees\n ceo = Employee.new(name: 'CEO', emp_id: 1, salary: 100000, date_of_joining: Time.now)\n ceo.save(validate: false)\n vp = Employee.new(name: 'VP', emp_id: 1, salary: 10000, date_of_joining: Time.now, ceo_id: ceo.id)\n vp.save(validate: false)\n director = Employee.new(name: 'Director', emp_id: 1, salary: 1000, date_of_joining: Time.now, ceo_id: ceo.id, vp_id: vp.id)\n director.save(validate: false)\n manager = Employee.new(name: 'Manager', emp_id: 1, salary: 100, date_of_joining: Time.now, ceo_id: ceo.id, vp_id: vp.id, director_id: director.id)\n manager.save(validate: false)\n sde = Employee.new(name: 'SDE', emp_id: 1, salary: 100, date_of_joining: Time.now, ceo_id: ceo.id, vp_id: vp.id, director_id: director.id, manager_id: manager.id)\n sde.save(validate: false)\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 @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n format.html { render :new }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_params\n params.require(:employee).permit(:employee_fname, :employee_lname,:employee_left, :employee_started, :employee_contact_num, :employee_status_id, :employee_email, :religion_id, :user_id)\n end",
"def employee_params\n params.require(:employee).permit(:employee_email, :employee_phone, :employee_zipcode, :employee_first_name, :employee_last_name, :user_id, :employee_bages, :employee_description, :employee_experience_years, :employee_experience_months, :employee_lic_number, :employee_type, :employee_rating, :employee_punctuality, :employee_dependability, :employee_reliable_transportation, :employee_accurate_calendar, :employee_transportation, :employee_school, :employee_languages, :employee_qualifications, :employee_credentials, :employee_experience, :employee_phone_verified, :employee_email_verified, :employee_lic_verified)\n end",
"def time_table_params\n params.require(:time_table).permit(:id, :first_time, :first_timex, :last_time, :last_timex, :employee_id, :date, :row_order_position)\n end",
"def timesheet_params\n params.require(:timesheet).permit(:event, :event_time, :event_type, :user_id, :urgency, :notes)\n end",
"def new\n @scheduled_employee = ScheduledEmployee.new(params[:scheduled_employee])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_employee }\n end\n end",
"def empl_work_params\n params.require(:empl_work).permit(:farmer_id, :user_id, :work_id, :start_date, :end_date)\n end",
"def submit_events_api_call(date, begin_time, end_time, location, itinerary)\n preferences_request = current_user.supplemental_preferences\n designated_preference = preferences_request.sample\n category_request = designated_preference.events_categories.sample\n start_date_time = user_input_to_unix(date, begin_time)\n end_date_time = user_input_to_unix(date, end_time)\n y = YelpResponse.new\n response = y.get_events_response({location: location, categories: category_request, start_date: start_date_time, end_date: end_date_time})\n handle_events_response(response, y, itinerary)\n y.destroy\n end",
"def create\n @employee = Employee.new(employee_params)\n\n if @employee.save\n render :show, status: :created, location: @employee\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end",
"def create\n @start_time = params[:start_time].to_datetime.strftime(\"%Y-%m-%d %H:%M:%S\")\n @end_time = params[:end_time].to_datetime.strftime(\"%Y-%m-%d %H:%M:%S\")\n @service = params[:service_item_id]\n\n @hours = params[:hours]\n @minutes = params[:minutes]\n @seconds = params[:seconds]\n\n @quantity = @hours.to_s+':'[email protected]_s+':'[email protected]_s\n \n @jobtime = Jobtime.new(:start_time => @start_time, :end_time => @end_time,:qty => @quantity,:company_id => current_login.id,:job_id => params[:job_id],:jobsite_id => params[:jobsite_id],:customer_id => params[:customer_id],:user => current_login.name, :timetype => \"Actual Time\", :service => @service)\n \n if @jobtime.save(:validate => false)\n response_message = {:message => \"Jobtime successfully created.\", :jobtime => @jobtime}\n else\n response_message = {:message => \"Jobtime creation failed. Please try again.\"} \n end\n \n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end",
"def create\n\n @company = Company.find(1)\n @employee = Employee.new(employee_params)\n @categorias =Categorium.all \n @locations =Location.all\n @divisions =Division.all \n @ocupacions = Ocupacion.all \n @ccostos = Ccosto.all\n @employee[:company_id]=1\n @afps = Afp.all\n\n @dptos = Dpto.all \n @provins = Provin.all \n @distritos = Distrito.all \n\n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_work_period_params\n params.require(:employee_work_period).permit(:since, :until, :employee_id, :cancel_url, :redirect_url)\n end"
] | [
"0.6718057",
"0.62755406",
"0.6054807",
"0.5887762",
"0.58600324",
"0.5845948",
"0.58075005",
"0.5761829",
"0.5745959",
"0.57172805",
"0.5703387",
"0.569539",
"0.5673725",
"0.56725144",
"0.565754",
"0.5611794",
"0.5601707",
"0.55941486",
"0.5583448",
"0.5548034",
"0.5534706",
"0.5502405",
"0.5476485",
"0.54742646",
"0.54677004",
"0.5464005",
"0.5460878",
"0.5447094",
"0.5404033",
"0.5403637",
"0.5399973",
"0.5393176",
"0.53857064",
"0.5372395",
"0.5370193",
"0.53594166",
"0.5358248",
"0.53537536",
"0.5343547",
"0.5343173",
"0.5341732",
"0.53382957",
"0.53358316",
"0.5334088",
"0.5326768",
"0.5325095",
"0.53184134",
"0.53178006",
"0.5316226",
"0.53094214",
"0.5308946",
"0.52973455",
"0.5290584",
"0.52893263",
"0.52804625",
"0.52720416",
"0.5268261",
"0.526661",
"0.52666056",
"0.5265461",
"0.5262811",
"0.5252742",
"0.5246327",
"0.5238947",
"0.5235593",
"0.5233631",
"0.5232011",
"0.52311414",
"0.5217385",
"0.5213502",
"0.5213502",
"0.5207391",
"0.5204091",
"0.5193283",
"0.5192523",
"0.5188771",
"0.5188749",
"0.5183062",
"0.5181265",
"0.5180106",
"0.5171754",
"0.5170091",
"0.5167581",
"0.5164724",
"0.51641345",
"0.5163511",
"0.51602274",
"0.51599973",
"0.5159005",
"0.5157151",
"0.5149768",
"0.5146741",
"0.5146498",
"0.51452065",
"0.5143863",
"0.5143752",
"0.5138382",
"0.51282024",
"0.51254964",
"0.51245016"
] | 0.64913464 | 1 |
PATCH/PUT /part_time_employees/1 PATCH/PUT /part_time_employees/1.json | def update
if isAdmin
@part_time_employee = PartTimeEmployee.find(params[:id])
@employee = @part_time_employee.employee
@part_time_employee.assign_attributes(part_time_employee_params)
@employee.assign_attributes(employee_params)
respond_to do |format|
@part_time_employee.valid?
if @employee.valid? && @part_time_employee.valid?
@employee.editor_id = current_user.id
if @part_time_employee.part_time_employees_id != nil
@realFulltime = PartTimeEmployee.find(@part_time_employee.part_time_employees_id)
@realEmployee = Employee.find(@realFulltime.employee_id)
@realFulltime.dateOfHire = @part_time_employee.dateOfHire
@realFulltime.dateofTermination = @part_time_employee.dateofTermination
@realFulltime.hourlyRate = @part_time_employee.hourlyRate
@realFulltime.verified = 1
@realEmployee.lastName = @employee.lastName
@realEmployee.firstName = @employee.firstName
@realEmployee.sin = @employee.sin
@realEmployee.dateOfBirth = @employee.dateOfBirth
@realEmployee.reasonForLeaving = @employee.reasonForLeaving
@realEmployee.company_id = @employee.company_id
@realEmployee.editor_id = current_user.id
@realEmployee.save
@realFulltime.save
@part_time_employee.destroy
@employee.destroy
else
@logs = Log.new
@logs.employeeInfo = @employee.to_json
@logs.additionalInfo = @part_time_employee.to_json
@logs.CRUD = "Update"
@logs.table = "Full Time Employee"
@logs.who = current_user.name
@logs.save
@employee.save
@part_time_employee.save
end
format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully updated.' }
format.json { render :show, status: :ok, location: @part_time_employee }
else
format.html { render :new }
format.json { render json: @employee.errors, status: :unprocessable_entity }
#format.html { render :new }
format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }
end
end
else
@employee = Employee.new(employee_params)
@employee.editor_id = current_user.id
@part_time_employee = PartTimeEmployee.new(part_time_employee_params)
@oldFullTime = PartTimeEmployee.find(params[:id])
@oldFullTimeId = @oldFullTime.part_time_employees_id
if @oldFullTimeId == nil
@oldFullTimeId = @oldFullTime.id
end
@part_time_employee.part_time_employees_id = @oldFullTimeId
@part_time_employee.hourlyRate = PartTimeEmployee.find(params[:id]).hourlyRate
respond_to do |format|
@part_time_employee.valid?
if @employee.valid? && @part_time_employee.valid?
if @employee.save
@part_time_employee.employee = Employee.find(@employee.id)
format.json { render :show, status: :created, location: @employee }
@logs = Log.new
@logs.employeeInfo = @employee.to_json
@logs.additionalInfo = @part_time_employee.to_json
@logs.CRUD = "Update"
@logs.table = "Full Time Employee"
@logs.who = current_user.name
@logs.save
if @part_time_employee.save
format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' }
format.json { render :show, status: :created, location: @part_time_employee }
end
end
else
format.html { render :new }
format.json { render json: @employee.errors, status: :unprocessable_entity }
#format.html { render :new }
format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end",
"def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end",
"def update\n @scheduled_employee = ScheduledEmployee.find(params[:id])\n\n respond_to do |format|\n if @scheduled_employee.update_attributes(params[:scheduled_employe])\n format.html { redirect_to @scheduled_employee, notice: 'Scheduled employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n Cutofftotalsalary.find_by_employee_name(@employee.name).update_attributes(cutoff_id: Cutoff.last.id, employee_name: @employee.name, sss: @employee.sss, philhealth: @employee.philhealth, pagibig: @employee.pagibig, withholding_tax: @employee.withholding_tax)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_task.update(employee_task_params)\n format.html { redirect_to @employee_task, notice: 'Employee task was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_task }\n else\n format.html { render :edit }\n format.json { render json: @employee_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, Employee\n if responsibility_changes?\n new_employee = Employee.new_from_old(employee_params['responsibility'], @employee)\n @employee.destroy\n new_employee.save\n @employee = new_employee\n end\n\n respond_to do |format|\n if @employee.update(employee_attrs)\n format.html { redirect_to (@employee.try(:employee) || @employee), notice: t('action.update.succeed', entity: Employee.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:company_id])\n @employee = @company.employees.find(params[:id]) \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to company_employees_url(@company), notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_url, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n if @time_off_request.update_attributes(params[:time_off_request])\n format.html { redirect_to admin_time_off_requests_url, notice: 'Time off request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_off_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: @employee_user.errors unless @employee_user.update(employee_user_params)\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_workinghour.update(employee_workinghour_params)\n format.html { redirect_to @employee_workinghour, notice: 'Employee workinghour was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_workinghour }\n else\n format.html { render :edit }\n format.json { render json: @employee_workinghour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hour_bank_employee = HourBankEmployee.find(params[:id])\n\n respond_to do |format|\n if @hour_bank_employee.update_attributes(params[:hour_bank_employee])\n format.html { redirect_to employees_path, notice: 'Hour bank employee was successfully updated.' }\n format.json { head :no_content }\n else\n\trender action:\"edit\"\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n if @employe.update_attributes(params[:employe])\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employ = Employ.find(params[:id])\n\n respond_to do |format|\n if @employ.update_attributes(params[:employ])\n format.html { redirect_to @employ, notice: 'Employ was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n render action: 'edit'\n end\n end\n end",
"def update\n respond_to do |format|\n if @program_employee.update(program_employee_params)\n format.html { redirect_to @program_employee, notice: 'Program employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'El contacto a sido actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_week_off.update(employee_week_off_params)\n format.html { redirect_to @employee_week_off, notice: 'Employee week off was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_week_off }\n else\n format.html { render :edit }\n format.json { render json: @employee_week_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t respond_to do |format|\n\t\t\tparams[:timetable].each do |day, hours|\n\t\t\t\texisting = Timetable.first :conditions => {\n\t\t\t\t\t\t:employer_id => selected_employer_id,\n\t\t\t\t\t\t:user_id => current_user.id,\n\t\t\t\t :day => day\n\t\t\t\t}\n\n\t\t\t\tif (existing) then\n\t\t\t\t\tsuccess = existing.update :hours => hours unless hours.empty?\n\t\t\t\t\tsuccess = existing.delete if hours.empty?\n\t\t\t\telsif not hours.empty? then\n\t\t\t\t\tt = Timetable.new :employer_id => selected_employer_id,\n\t\t\t\t\t\t:user_id => current_user.id, :day => day, :hours => hours\n\t\t\t\t\tsuccess = t.save\n\t\t\t else\n\t\t\t\t\tsuccess = true\n\t\t\t\tend\n\n\t\t\t\tunless success then\n\t\t\t\t\tformat.html { render action: 'show', error: sprintf(\"%s has wrong format.\", I18n.t('date.day_names')[day]) }\n\t\t\t\t\tformat.json { render json: sprintf(\"%s has wrong format.\", I18n.t('date.day_names')[day]), status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\t\tformat.html { redirect_to timetable_path, notice: 'Timetable was successfully updated.' }\n\t\t\tformat.json { head :no_content }\n end\n end",
"def update\n @officehour = Officehour.find(params[:id])\n\n respond_to do |format|\n if @officehour.update_attributes(params[:officehour])\n\tformat.html { redirect_to @officehour, notice: 'Officehour was successfully updated.' }\n\tformat.json { head :no_content }\n else\n\tformat.html { render action: \"edit\" }\n\tformat.json { render json: @officehour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aga_employee.update(aga_employee_params)\n format.html { redirect_to @aga_employee, notice: 'Aga employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @aga_employee }\n else\n format.html { render :edit }\n format.json { render json: @aga_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:workout][:workout_date] = \"#{params[:workout][:workout_date]} #{params[:workout][:time]}\"\n params[:workout] = params[:workout].slice(:workout_date, :exercises_attributes)\n @lift_name = params[:workout][:exercises_attributes][\"0\"][:lift_id]\n params[:workout][:exercises_attributes][\"0\"][:lift_id] = Lift.find_by_lift_name(@lift_name).id\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n if @workout.update_attributes(params[:workout])\n format.html { redirect_to @workout, notice: 'Workout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n\n @paid_offdays = PaidOffday.all\n @paid_offday = PaidOffday.find(params[:id])\n\n @paid_offday.update_attributes(paid_offday_params)\n\n @employees = Employee.all.order(:first_name)\n @paid_offday_types = PaidOffdayType.all.order(:paid_offday_type_title)\n @orders = Order.all.order(:order_no)\n\n\n=begin\n respond_to do |format|\n if @paid_offday.update(paid_offday_params)\n format.html { redirect_to @paid_offday, notice: 'Paid offday was successfully updated.' }\n format.json { render :show, status: :ok, location: @paid_offday }\n else\n format.html { render :edit }\n format.json { render json: @paid_offday.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n # raise params.to_s\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Работник обновлен.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_hour_requirement = UserHourRequirement.find(params[:id])\n\n respond_to do |format|\n if @user_hour_requirement.update_attributes(params[:user_hour_requirement])\n format.html { redirect_to @user_hour_requirement, :notice => 'User hour requirement was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user_hour_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_personal.update(employee_personal_params)\n format.html { redirect_to @employee_personal, notice: 'Employee personal was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_personal }\n else\n format.html { render :edit }\n format.json { render json: @employee_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empolyee.update(empolyee_params)\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_model_with_form()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.update_model_with_form(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def update\n @hisd_employee = HisdEmployee.find(params[:id])\n\n respond_to do |format|\n if @hisd_employee.update_attributes(params[:hisd_employee])\n format.html { redirect_to @hisd_employee, notice: 'Hisd employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hisd_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.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 @employee_remunerative_concept = @employee.employee_emunerative_concept.find(params[:id])\n\n respond_to do |format|\n if @employee_remunerative_concept.update_attributes(params[:employee_remunerative_concept])\n format.html { redirect_to([@employee,@employee_remunerative_concept], :notice => 'Employee remunerative concept was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee_remunerative_concept.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n CustomLogger.info(\"Se actualiza empleado: #{@employee}, usuario: #{current_user.inspect}, #{Time.now}\")\n format.html { redirect_to new_employee_path, notice: 'Empleado Actualizado Exitosamente!' }\n format.json { head :no_content }\n else\n CustomLogger.error(\"Error al actualizar empleado: #{@employee}, usuario: #{current_user.inspect}, #{Time.now}\")\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_employee.update(admin_employee_params)\n format.html { redirect_to admin_employees_path, notice: 'Funcionário foi editado com sucesso.' }\n else\n format.html { render :edit }\n format.json { render json: @admin_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if not params[:pk].blank?\n params[:employment][:status] = params[:value]\n end\n respond_to do |format|\n if @employment.update(employment_params)\n format.js { @notice = 'Employment was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { @notice = 'Employment was successfully updated.' }\n format.json { render json: @employment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'El empleado ha sido actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_employee.update(contract_employee_params)\n format.html { redirect_to @contract_employee, notice: 'Contract employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_employee }\n else\n format.html { render :edit }\n format.json { render json: @contract_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_type.update(employee_type_params)\n format.html {redirect_to \"/projects/#{@project.id}/employee_types\", notice: 'Employee type was successfully updated.'}\n format.json {render :show, status: :ok, location: @employee_type}\n else\n format.html {render :edit}\n format.json {render json: @employee_type.errors, status: :unprocessable_entity}\n end\n end\n end",
"def employee_updates\n if params[\"employee_id\"] == \"new\"\n @employee = Employee.new\n @employee.florist_id = session[\"found_florist_id\"]\n @employee.view_pref = \"all\"\n else\n @employee = Employee.where(id: params[\"employee_id\"]).first\n end\n @employee.name = params[\"name\"]\n @employee.email = params[\"email\"]\n @employee.w_phone = params[\"phone_w\"]\n @employee.c_phone = params[\"phone_c\"]\n @employee.username = params[\"username\"]\n @employee.password = params[\"password\"] \n @employee.password_confirmation = params[\"password_confirmation\"]\n # This step is done to keep the POC from inadvertantly changing their rights... the POC should always have \"All Admin Rights\"\n if @employee.primary_poc == \"yes\"\n @employee.admin_rights = \"All Admin Rights\"\n @employee.status = \"Active\"\n else\n @employee.status = params[\"status\"]\n # if they are changing the \"status\" to Inactive, then go ahead and change the employees admin privielegs to \"none\".\n if params[\"status\"] == \"Inactive\"\n @employee.admin_rights = \"None\"\n else\n # if they have room for more active users (per their plan) or they are past the number but the change is to change someone's privileges to \"None, then let them set the userprivielegs. Otherwise default to \"None\". This will allow them to show up in the list but not access the system.\n if Florist.find(session[\"found_florist_id\"]).employees.where(status: \"Active\").where(\"admin_rights not like 'None'\").size < Florist.find(session[\"found_florist_id\"]).plan.number_of_users || (Florist.find(session[\"found_florist_id\"]).employees.where(status: \"Active\").where(\"admin_rights not like 'None'\").size >= Florist.find(session[\"found_florist_id\"]).plan.number_of_users && params[\"admin_rights\"] == \"None\")\n @employee.admin_rights = params[\"admin_rights\"]\n else\n @employee.admin_rights = \"None\"\n end\n end\n \n end\n if @employee.save\n if EMPLOYEES_VIEW_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n redirect_to \"/employees\" and return\n else\n redirect_to home_path and return\n end\n else\n @ADMIN_RIGHTS = ADMIN_RIGHTS\n @EMPLOYEES_VIEW_MUST_HAVE = EMPLOYEES_VIEW_MUST_HAVE \n render(:employee_edit) and return\n end\n end",
"def update\n respond_to do |format|\n if @wing_employee.update(wing_employee_params)\n format.html { redirect_to @wing_employee, notice: 'Wing employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @wing_employee }\n else\n format.html { render :edit }\n format.json { render json: @wing_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @office_hour_detail.update(office_hour_detail_params)\n format.html { redirect_to @office_hour_detail, notice: 'Office hour detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @office_hour_detail }\n else\n format.html { render :edit }\n format.json { render json: @office_hour_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n if @emp_job.update_attributes(params[:emp_job])\n format.html { redirect_to @emp_job, notice: 'Emp job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emp_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_model_with_body()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.update_model(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def update\n\n if @teetime.update(teetime_params)\n\n render json: @teetime,status: :ok\n\n else\n\n render json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n authorize @employee, :update?\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Funcionário atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empl.update(empl_params)\n format.html { redirect_to @empl, notice: 'Empl was successfully updated.' }\n format.json { render :show, status: :ok, location: @empl }\n else\n format.html { render :edit }\n format.json { render json: @empl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_event.update(employee_event_params)\n format.html { redirect_to @employee_event, notice: 'Employee event was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_event }\n else\n format.html { render :edit }\n format.json { render json: @employee_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @handbook_place_employee = HandbookPlaceEmployee.find(params[:id])\n\n respond_to do |format|\n if @handbook_place_employee.update_attributes(params[:handbook_place_employee])\n format.html { redirect_to @handbook_place_employee, notice: 'Handbook place employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @handbook_place_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @new_employee_request = NewEmployeeRequest.find(params[:id])\n\n respond_to do |format|\n if @new_employee_request.update_attributes(params[:new_employee_request])\n format.html { redirect_to(@new_employee_request, :notice => 'New employee request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @new_employee_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_staff(edit_employee)\n employee = Employee.find(edit_employee.id)\n employee.attributes = edit_employee.attributes\n employee.save!\n end",
"def update\n @company = Company.find(1)\n @trucks = @company.get_trucks()\n @employees = @company.get_employees()\n \n respond_to do |format|\n if @sheet_route_detail.update(sheet_route_detail_params)\n format.html { redirect_to @sheet_route, notice: 'Sheet route detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sheet_route_detail }\n else\n format.html { render :edit }\n format.json { render json: @sheet_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @work_duration.update(work_duration_params)\n format.html { redirect_to @work_duration.employee, notice: 'Work duration was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_duration }\n else\n format.html { render :edit }\n format.json { render json: @work_duration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employeedetail.update(employeedetail_params)\n format.html { redirect_to @employeedetail, notice: \"Employeedetail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employeedetail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employeedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @unpaid_offdays = UnpaidOffday.all\n @unpaid_offday = UnpaidOffday.find(params[:id])\n\n @unpaid_offday.update_attributes(unpaid_offday_params)\n\n @employees = Employee.all.order(:first_name)\n @unpaid_offday_types = UnpaidOffdayType.all.order(:unpaid_offday_type_title)\n @orders = Order.all.order(:order_no)\n\n=begin\n respond_to do |format|\n if @unpaid_offday.update(unpaid_offday_params)\n format.html { redirect_to @unpaid_offday, notice: 'Unpaid offday was successfully updated.' }\n format.json { render :show, status: :ok, location: @unpaid_offday }\n else\n format.html { render :edit }\n format.json { render json: @unpaid_offday.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n @emp_date_detail = EmpDateDetail.find(params[:id])\n\n respond_to do |format|\n if @emp_date_detail.update_attributes(params[:emp_date_detail])\n format.html { redirect_to @emp_date_detail, notice: 'Emp date detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emp_date_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n flash[:notice] = 'Employee was successfully updated.' if @employee.update_attributes(params[:employee])\n respond_with(@employee)\n end",
"def update\n respond_to do |format|\n if @employee_type.update(employee_type_params)\n format.html { redirect_to @employee_type, notice: 'Employee type was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_type }\n else\n format.html { render :edit }\n format.json { render json: @employee_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @worked_hour.update_attributes(params[:worked_hour])\n\n respond_with(@worked_hour)\n end",
"def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if(@employee==nil)\n format.html { redirect_to employees_path, notice: 'Employee id not found' }\n elsif @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Funcionario was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_email.update(employee_email_params)\n format.html { redirect_to @employee_email, notice: 'Employee email was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_email }\n else\n format.html { render :edit }\n format.json { render json: @employee_email.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @emp1.update(emp1_params)\n format.html { redirect_to @emp1, notice: 'Emp1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @emp1 }\n else\n format.html { render :edit }\n format.json { render json: @emp1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end",
"def update\n respond_to do |format|\n if @employe.update(employe_params)\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { render :show, status: :ok, location: @employe }\n else\n format.html { render :edit }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_room.update(employee_room_params)\n format.html { redirect_to @employee_room, notice: 'Employee room was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_room }\n else\n format.html { render :edit }\n format.json { render json: @employee_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:task][:time] = parse_task_time(params[:task][:time], params[:anytime][:anytime])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n self.unuse_pto_hours\n if @time_off_instance.update(time_off_instance_params)\n self.use_pto_hours\n format.html { redirect_to @time_off_instance, notice: 'Time off instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_off_instance }\n else\n format.html { render :edit }\n format.json { render json: @time_off_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attend_event.update(attend_event_params)\n format.html { redirect_to events_url, notice: 'Hours successfully updated.' }\n format.json { render :show, status: :ok, location: @attend_event }\n else\n format.html { render :edit }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n if @employer.update_attributes(params[:employer])\n format.html { redirect_to @employer, :flash => {notice: 'Employer was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.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 @employment = Employment.find(params[:id])\n\n respond_to do |format|\n if @employment.update_attributes(params[:employment])\n format.html { redirect_to @employment, notice: 'Employment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employees_project.update(employees_project_params)\n format.html { redirect_to @employees_project, notice: 'Employees project was successfully updated.' }\n format.json { render :show, status: :ok, location: @employees_project }\n else\n format.html { render :edit }\n format.json { render json: @employees_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timesheet = current_user.timesheets.find(params[:id])\n\n respond_to do |format|\n if @timesheet.update_attributes(params[:timesheet])\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n self.set_workflow\n \n if @hours_record.update(hours_record_params)\n format.html { redirect_to @hours_record, notice: 'Hours record was successfully updated.' }\n format.json { render :show, status: :ok, location: @hours_record }\n else\n format.html { render :edit }\n format.json { render json: @hours_record.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.66479033",
"0.6305728",
"0.6246564",
"0.62333786",
"0.6165545",
"0.6157546",
"0.61514604",
"0.61179614",
"0.6109723",
"0.6103555",
"0.60938615",
"0.60938615",
"0.60938615",
"0.60937333",
"0.60825497",
"0.60566914",
"0.60566914",
"0.60402614",
"0.60348994",
"0.6001229",
"0.5997646",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.59869945",
"0.5966794",
"0.59551275",
"0.595214",
"0.5938734",
"0.5928923",
"0.59274757",
"0.5921606",
"0.59126294",
"0.5891393",
"0.5886538",
"0.5883402",
"0.5875407",
"0.5871739",
"0.5865267",
"0.5864848",
"0.5855577",
"0.58486956",
"0.5836049",
"0.5831758",
"0.5826949",
"0.58196527",
"0.58138514",
"0.58017725",
"0.57976454",
"0.57950777",
"0.57917994",
"0.5782659",
"0.57825446",
"0.5781244",
"0.5779421",
"0.57729137",
"0.5768611",
"0.5755082",
"0.57515424",
"0.57430303",
"0.5738815",
"0.5721866",
"0.5720007",
"0.5719493",
"0.57167786",
"0.57156754",
"0.5715026",
"0.5714525",
"0.57140326",
"0.57098377",
"0.5708477",
"0.57075804",
"0.56981504",
"0.569485",
"0.5688452",
"0.5686286",
"0.5685239",
"0.5682779",
"0.566689",
"0.56637573",
"0.56633306",
"0.5662214",
"0.5655763",
"0.5654109",
"0.5645642",
"0.56448096",
"0.5644182",
"0.5639326",
"0.5638599",
"0.5635663",
"0.563476",
"0.56331915",
"0.563304"
] | 0.6653238 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.