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 |
---|---|---|---|---|---|---|
PUT /admin/shirt_colors/1 PUT /admin/shirt_colors/1.json | def update
@shirt_color = ShirtColor.find(params[:id])
respond_to do |format|
if @shirt_color.update_attributes(params[:shirt_color])
format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @shirt_color.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shirt_color = ShirtColor.new(params[:shirt_color])\n\n respond_to do |format|\n if @shirt_color.save\n format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }\n format.json { render json: @shirt_color, status: :created, location: @shirt_color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shirt_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_color\n @color = nil \n require 'rest-client'\n # admin irizREhyoG6Ejwr4AcjsQME9\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores/'+params[:id],\n headers: {Authorization: 'user vURjXbANsTEvaSf5vQ5GVg8h'})\n if response.code == 200\n # @color = JSON.parse(response.body).collect { |i| [i[\"name\"], i[\"id\"]] }\n @color = Color.new(JSON.parse(response.body))\n end\n end",
"def update\n if @color.update(color_params)\n render json: @color, status: :ok#, location: @color\n else\n render json: @color.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @admin_color.update(admin_color_params)\n format.html { redirect_to admin_colors_path, notice: 'Color was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_color }\n else\n format.html { render :edit }\n format.json { render json: @admin_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def colorupdate\n respond_to do |format|\n @location = params[:location]\n @index = params[:index].to_f\n @color = params[:color]\n @grid = Grid.find_by_location(@location)\n @newColorArray = @grid.colors\n @newColorArray[@index] = @color\n \n @grid.colors = @newColorArray\n @grid.save\n \n format.json {render json: @grid.colors, status: :ok, location: @grid}\n end\n end",
"def update\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n if @color_saturation.update_attributes(params[:color_saturation])\n format.html { redirect_to @color_saturation, notice: 'Color saturation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color_saturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @green = Green.find(params[:id])\n\n respond_to do |format|\n if @green.update_attributes(params[:green])\n format.html { redirect_to scaffold_green_url(@green), notice: 'Green was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @green.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @color_scheme.update(color_scheme_params)\n format.html { redirect_to [:admin, @color_scheme], notice: 'Color scheme was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @color_scheme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app_color\n\t\t# update the color values with params of color\n\t\tif setting.update(type_app_color: params[:color])\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Color Successfully Updated.\",response: {color: setting.type_app_color.as_json }},:status=>200\n\t else\n\t render :json=> { success: false, message: setting.errors },:status=> 203\n\t end\t\t\n\tend",
"def update\n respond_to do |format|\n if @palette.update(palette_params)\n\n @palette.colors.destroy_all\n\n params[:palette][:colors].each do |value|\n @palette.colors.create(hex_value: value)\n end\n\n format.html { redirect_to @palette, notice: 'Palette was successfully updated.' }\n format.json { render :show, status: :ok, location: @palette }\n else\n format.html { render :edit }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @color = Color.find(params[:id])\n\n respond_to do |format|\n if @color.update_attributes(params[:color])\n format.html { redirect_to params[:back_to], notice: 'Color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @color = Color.find(params[:id])\n\n respond_to do |format|\n if @color.update_attributes(params[:color])\n format.html { redirect_to @color, notice: 'Color has been updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_color.update(item_color_params)\n format.html { redirect_to @item_color, notice: 'Item color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shirt_style.update(shirt_style_params)\n format.html { redirect_to [@store,@customer,@order], notice: 'Shirt style was successfully updated.' }\n format.json { render :show, status: :ok, location: @shirt_style }\n else\n format.html { render :edit }\n format.json { render json: @shirt_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @primary_color.update(primary_color_params)\n format.html { redirect_to @primary_color, notice: 'Primary color was successfully updated.' }\n format.json { render :show, status: :ok, location: @primary_color }\n else\n format.html { render :edit }\n format.json { render json: @primary_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @five_color.update(five_color_params)\n format.html { redirect_to @five_color, notice: 'Five color was successfully updated.' }\n format.json { render :show, status: :ok, location: @five_color }\n else\n format.html { render :edit }\n format.json { render json: @five_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @shirt_color = ShirtColor.find(params[:id])\n @shirt_color.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_shirt_colors_url }\n format.json { head :no_content }\n end\n end",
"def update\n session[:app_id]=params[:theme_color][:app_id]\n respond_to do |format|\n if @theme_color.update(theme_color_params)\n @theme_color.color = @theme_color.color.gsub(\"#\", \"0x\")\n @theme_color.save\n format.html { redirect_to theme_colors_path(:app_id => @theme_color.app_id), notice: 'Theme color was successfully updated.' }\n format.json { render :show, status: :ok, location: @theme_color }\n else\n format.html { render :edit }\n format.json { render json: @theme_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def putColor(info, color)\r\n params = {\r\n :color_hue => color[0].to_s,\r\n :color_saturation => color[1].to_s,\r\n :color_value => color[2].to_s\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put color to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end",
"def set_admin_color\n @admin_color = Color.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @metal_color.update(metal_color_params)\n record_activity(@metal_color)\n format.html { redirect_to admin_metal_colors_path, notice: 'Цвет металла был успешно обновлен.' }\n format.json { render :show, status: :ok, location: @metal_color }\n else\n format.html { render :edit }\n format.json { render json: @metal_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_fuel_station\n @fuel_station = FuelStation.find(params[:id])\n @colors = [{'color' => 'Blue', 'class' => 'blue'}, {'color' => 'Green', 'class' => 'green'},\n {'color' => 'Yellow', 'class' => 'yellow'}, {'color' => 'Red', 'class' => 'red'},\n {'color' => 'Gray', 'class' => 'gray'}]\n end",
"def create\n @color = Admin::Color.new(color_params)\n\n if @color.save\n render json: @color, status: :created#, location: @color\n else\n render json: @color.errors, status: :unprocessable_entity\n end\n end",
"def update\n @product_color = ProductColor.find(params[:id])\n\n respond_to do |format|\n if @product_color.update_attributes(params[:product_color])\n format.html { redirect_to @product_color, notice: 'Product color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @color_vehi.update(color_vehi_params)\n format.html { redirect_to @color_vehi, notice: 'Color vehi was successfully updated.' }\n format.json { render :show, status: :ok, location: @color_vehi }\n else\n format.html { render :edit }\n format.json { render json: @color_vehi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suitcolor.update(suitcolor_params)\n format.html { redirect_to @suitcolor, notice: \"Suitcolor was successfully updated.\" }\n format.json { render :show, status: :ok, location: @suitcolor }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @suitcolor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_colors\n store.change_colors(@colors)\n end",
"def update\n respond_to do |format|\n if @reform_color.update(reform_color_params)\n format.html { redirect_to admin_reform_colors_path, notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.reform_color', count: 1)) }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @red.update(red_params)\n format.html { redirect_to @red, notice: 'Red was successfully updated.' }\n format.json { render :show, status: :ok, location: @red }\n else\n format.html { render :edit }\n format.json { render json: @red.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_pricing_paint_color.update(admin_pricing_paint_color_params)\n format.html { redirect_to admin_pricing_paint_colors_path, notice: mk_notice(@admin_pricing_paint_color, @admin_pricing_paint_color.brand.name, 'قیمت برای برند رنگ', :update) }\n format.json { render json: @admin_pricing_paint_color, status: :ok, location: admin_pricing_paint_colors_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_pricing_paint_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile_colors(colors)\n post('/account/update_profile_colors.json', colors)\n end",
"def update\n @color_type = ColorType.find(params[:id])\n\n respond_to do |format|\n if @color_type.update_attributes(params[:color_type])\n format.html { redirect_to(@color_type, :notice => 'Color type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @color_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_red\n @red = Red.find(params[:id])\n end",
"def set_red\n @red = Red.find(params[:id])\n end",
"def update_profile_colors(colors)\n return unless colors.is_a?(Hash)\n post_data = {}\n \n colors.each_pair do |key, value|\n post_data.store(\"profile_#{key}\", value.gsub(/#/, ''))\n end\n \n post \"account/update_profile_colors\", :post => post_data\n end",
"def update\n respond_to do |format|\n if @swatch.update(swatch_params)\n format.html { redirect_to @swatch, notice: 'Swatch was successfully updated.' }\n format.json { render :show, status: :ok, location: @swatch }\n else\n format.html { render :edit }\n format.json { render json: @swatch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @products_color\n respond_to do |format|\n if @products_color.update(products_color_params)\n format.html { redirect_to products_path, notice: 'Products color was successfully updated.' }\n format.json { render :show, status: :ok, location: @products_color }\n else\n format.html { render :edit }\n format.json { render json: @products_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interior_colour.update(interior_colour_params)\n format.html { redirect_to admin_interior_colours_path, notice: 'Interior colour was successfully updated.' }\n format.json { render :show, status: :ok, location: @interior_colour }\n else\n format.html { render :edit }\n format.json { render json: @interior_colour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_color\n @color = Color.find params[:id]\n end",
"def update\n @disc_color = DiscColor.find(params[:id])\n\n respond_to do |format|\n if @disc_color.update_attributes(params[:disc_color])\n format.html { redirect_to @disc_color, notice: 'Disc color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @disc_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @color = args[:color] if args.key?(:color)\n end",
"def update\n respond_to do |format|\n if @event.update(event_params) && @event.update(set_colors)\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 create\n @admin_color = Color.new(admin_color_params)\n\n respond_to do |format|\n if @admin_color.save\n format.html { redirect_to admin_colors_path, notice: 'Color was successfully created.' }\n format.json { render :show, status: :created, location: @admin_color }\n else\n format.html { render :new }\n format.json { render json: @admin_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lent_color.update(lent_color_params)\n format.html { \n redirect_to @lent_color\n flash[:success] = 'Se ha actualizado.' }\n format.json { render :show, status: :ok, location: @lent_color }\n else\n format.html { render :edit }\n format.json { render json: @lent_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bloom_color.update(bloom_color_params)\n format.html { redirect_to @bloom_color, notice: 'Bloom color was successfully updated.' }\n format.json { render :show, status: :ok, location: @bloom_color }\n else\n format.html { render :edit }\n format.json { render json: @bloom_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @body_color.update(body_color_params)\n format.html { redirect_to @body_color, notice: 'Body color was successfully updated.' }\n format.json { render :show, status: :ok, location: @body_color }\n else\n format.html { render :edit }\n format.json { render json: @body_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @color = args[:color] if args.key?(:color)\n @display_name = args[:display_name] if args.key?(:display_name)\n @id = args[:id] if args.key?(:id)\n end",
"def admin_color_params\n params.require(:color).permit(:name, :code)\n end",
"def update\n respond_to do |format|\n if @red.update(red_params)\n format.html { redirect_to @red, notice: \"La red #{@red.nombre} ha sido actualizada.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @red.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_plant_name(new_color, id)\n CONNECTION.execute(\"UPDATE backyard SET flower_color = '#{new_color}' WHERE id = #{id};\")\nend",
"def update\n respond_to do |format|\n if @plant_leaf_color.update(plant_leaf_color_params)\n format.html { redirect_to edit_plant_path(@plant_leaf_color.plant) , notice: 'Plant leaf color was successfully updated.' }\n format.json { render :show, status: :ok, location: @plant_leaf_color }\n else\n format.html { render :edit }\n format.json { render json: @plant_leaf_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def update\n @colour = Colour.find(params[:id])\n\n colour = params[:colour]\n #what's different? update what hasn't changed\n if @colour[:hex].eql?(colour[:hex]) # hex hasn't changed, so RGB did! Update it.\n # make sure '#' is the first character\n colour[:hex] = \"##{colour[:hex]}\" if !colour[:hex][0].eql?(\"#\")\n # convert to rgba\n colour[:red] = colour[:hex][1..2].hex\n colour[:green] = colour[:hex][3..4].hex\n colour[:blue] = colour[:hex][5..6].hex\n colour[:alpha] = 1\n else # hex changed. update it\n rhex = to_hex(colour[:red])\n ghex = to_hex(colour[:green])\n bhex = to_hex(colour[:blue])\n colour[:hex] = \"##{rhex}#{ghex}#{bhex}\"\n end\n \n params[:colour] = colour\n \n respond_to do |format|\n if @colour.update_attributes(params[:colour])\n format.html { redirect_to(@colour, :notice => \"Colour was successfully updated. #{params}\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @colour.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blue.update(blue_params)\n format.html { redirect_to @blue, notice: 'Blue was successfully updated.' }\n format.json { render :show, status: :ok, location: @blue }\n else\n format.html { render :edit }\n format.json { render json: @blue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shirt_color = ShirtColor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shirt_color }\n end\n end",
"def set_item_color\n @item_color = ItemColor.find(params[:id])\n end",
"def set_suitcolor\n @suitcolor = Suitcolor.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @beercolour.update(beercolour_params)\n format.html { redirect_to beercolours_path, notice: 'Colour was successfully updated.' }\n format.json { render :show, status: :ok, location: @beercolour }\n else\n format.html { render :edit }\n format.json { render json: @beercolour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shiva_params\n params.require(:shiva).permit(:color)\n end",
"def update\n\n if @product_color.update_attributes(params[:product_color])\n flash[:notice] = 'ProductColor was successfully updated.'\n render :partial => 'show', :object => @product_color\n else\n render :partial => 'edit', :object => @product_color, :status => 409\n end\n end",
"def update\n @hair_colour = HairColour.find(params[:id])\n\n respond_to do |format|\n if @hair_colour.update_attributes(params[:hair_colour])\n format.html { redirect_to @hair_colour, notice: 'Hair colour was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hair_colour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hair_color.update(hair_color_params)\n format.html { redirect_to @hair_color, notice: 'Hair color was successfully updated.' }\n format.json { render :show, status: :ok, location: @hair_color }\n else\n format.html { render :edit }\n format.json { render json: @hair_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shirt_size = ShirtSize.find(params[:id])\n\n respond_to do |format|\n if @shirt_size.update_attributes(params[:shirt_size])\n format.html { redirect_to @shirt_size, notice: 'Shirt size was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shirt_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_color_vehi\n @color_vehi = ColorVehi.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @colorizer.update(colorizer_params)\n format.html { redirect_to @colorizer, notice: 'Colorizer was successfully updated.' }\n format.json { render :show, status: :ok, location: @colorizer }\n else\n format.html { render :edit }\n format.json { render json: @colorizer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shirt_size.update(shirt_size_params)\n format.html { redirect_to @shirt_size, notice: 'Shirt size was successfully updated.' }\n format.json { render :show, status: :ok, location: @shirt_size }\n else\n format.html { render :edit }\n format.json { render json: @shirt_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @palette.update(palette_params)\n format.html { redirect_to '/palettes', notice: 'Palette was successfully updated.' }\n format.json { render :show, status: :ok, location: @palette }\n else\n format.html { render :edit }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def spray_paint(new_color)\n self.color = new_color\n end",
"def update\n @grid.squares[params[:x]][params[:y]] = params[:color]\n\n render json: { status: \"OK\" }\n end",
"def update\n respond_to do |format|\n if @bead_color.update(bead_color_params)\n format.html { redirect_to @bead_color, notice: 'Bead color was successfully updated.' }\n format.json { render :show, status: :ok, location: @bead_color }\n else\n format.html { render :edit }\n format.json { render json: @bead_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lbl_colour = LblColour.find(params[:id])\n\n respond_to do |format|\n if @lbl_colour.update_attributes(lbl_colour_params)\n format.html { redirect_to @lbl_colour, notice: 'Lbl colour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lbl_colour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n if @rainbow.update_attributes(params[:rainbow])\n format.html { redirect_to @rainbow, notice: 'Rainbow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rainbow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @color = args[:color] if args.key?(:color)\n @icon_url = args[:icon_url] if args.key?(:icon_url)\n @name = args[:name] if args.key?(:name)\n end",
"def update_profile_colors(options={})\n perform_post(\"account/update_profile_colors.#{Twitter.format}\", options)\n end",
"def update\n @internalcolor = Internalcolor.find(params[:id])\n\n respond_to do |format|\n if @internalcolor.update_attributes(params[:internalcolor])\n format.html { redirect_to(@internalcolor, :notice => 'Internalcolor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @internalcolor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @brand_color = BrandColor.find(params[:id])\n\n respond_to do |format|\n if @brand_color.update_attributes(params[:brand_color])\n flash[:notice] = 'BrandColor was successfully updated.'\n format.html { redirect_to(@brand_color) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @brand_color.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n parms = ski_params\n parms[:color] = parms[:color].split(', ') if parms[:color]\n respond_to do |format|\n if @ski.update(parms)\n if params[:images]\n @ski.gallery ||= Gallery.new\n params[:images].each do |image|\n @ski.gallery.images.create(image: image)\n end\n unless @ski.image_file_size\n @ski.update(image: @ski.gallery.images.first.image)\n end\n end\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { render :show, status: :ok, location: @ski }\n else\n format.html { render :edit }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @color_saturation = ColorSaturation.new(params[:color_saturation])\n\n respond_to do |format|\n if @color_saturation.save\n format.html { redirect_to @color_saturation, notice: 'Color saturation was successfully created.' }\n format.json { render json: @color_saturation, status: :created, location: @color_saturation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @color_saturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @car_interior_color = CarInteriorColor.find(params[:id])\n\n respond_to do |format|\n if @car_interior_color.update_attributes(params[:car_interior_color])\n format.html { redirect_to @car_interior_color, notice: 'Car interior color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @car_interior_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_five_color\n @five_color = FiveColor.find(params[:id])\n end",
"def create\n @color = Color.new(params[:color])\n new_sort = Configurations.get_sort('color')\n @color.sort = new_sort\n @color.deleted = 0\n\n respond_to do |format|\n if @color.save\n format.html { redirect_to :colors, notice: 'Color was successfully created.' }\n format.json { render json: @color, status: :created, location: @color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @manage_glow.update(manage_glow_params)\n format.html { redirect_to @manage_glow, notice: 'Manage glow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manage_glow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_colors = Color.all\n end",
"def set_reform_color\n @reform_color = ReformColor.find(params[:id])\n end",
"def set_products_color\n @products_color = ProductsColor.find(params[:id])\n end",
"def update\n @squawk = Squawk.find(params[:id])\n\n respond_to do |format|\n if @squawk.update_attributes(params[:squawk])\n format.html { redirect_to @squawk, notice: 'Squawk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squawk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suitcolor = Suitcolor.new(suitcolor_params)\n\n respond_to do |format|\n if @suitcolor.save\n format.html { redirect_to @suitcolor, notice: \"Suitcolor was successfully created.\" }\n format.json { render :show, status: :created, location: @suitcolor }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @suitcolor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fashion_style.update(fashion_style_params)\n format.html { redirect_to @fashion_style, notice: 'Fashion style was successfully updated.' }\n format.json { render :show, status: :ok, location: @fashion_style }\n else\n format.html { render :edit }\n format.json { render json: @fashion_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_metal_color\n @metal_color = MetalColor.find(params[:id])\n end",
"def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end",
"def update\n @car_color_type = CarColorType.find(params[:id])\n\n respond_to do |format|\n if @car_color_type.update_attributes(params[:car_color_type])\n format.html { redirect_to(@car_color_type, :notice => 'Car color type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @car_color_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def item_color_params\n params.require(:item_color).permit(:color_id, :item_id)\n end",
"def update\n @squish = Squish.find(params[:id])\n \n respond_to do |format|\n if @squish.update_attributes(params[:squish])\n format.html { redirect_to @squish, notice: 'Squish was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def theme_color_params\n params.require(:theme_color).permit(:app_id, :color, :name)\n end",
"def set_Color(value)\n set_input(\"Color\", value)\n end",
"def set_swatch\n @swatch = Swatch.find(params[:id])\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @description = args[:description] if args.key?(:description)\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.7418968",
"0.66204554",
"0.65830916",
"0.6535938",
"0.6498077",
"0.64291906",
"0.6320395",
"0.63089687",
"0.62797195",
"0.62597305",
"0.62443966",
"0.6231157",
"0.6229021",
"0.6221083",
"0.6210442",
"0.62048304",
"0.62031114",
"0.62004775",
"0.6181998",
"0.614203",
"0.6109068",
"0.609386",
"0.60791856",
"0.60681343",
"0.60616505",
"0.6033329",
"0.6030704",
"0.60283387",
"0.60192025",
"0.6017679",
"0.5985445",
"0.59818757",
"0.5953975",
"0.59143233",
"0.58944327",
"0.58944327",
"0.58890665",
"0.5888356",
"0.58856213",
"0.58775496",
"0.58494264",
"0.584924",
"0.58302647",
"0.5824017",
"0.5807395",
"0.5797762",
"0.5788483",
"0.57701117",
"0.5750013",
"0.5737371",
"0.5719032",
"0.5710491",
"0.5709083",
"0.5662401",
"0.5646914",
"0.5644556",
"0.56174546",
"0.5614915",
"0.56147665",
"0.55922234",
"0.55918",
"0.55870545",
"0.5582779",
"0.5581341",
"0.55794483",
"0.55740947",
"0.5556636",
"0.5550836",
"0.5549349",
"0.55457026",
"0.5538954",
"0.5538461",
"0.5520434",
"0.5499919",
"0.54996896",
"0.54708046",
"0.5464743",
"0.5451827",
"0.5450702",
"0.54416245",
"0.54364157",
"0.5418876",
"0.5413146",
"0.54078466",
"0.54013026",
"0.53862315",
"0.5382111",
"0.5373207",
"0.5354887",
"0.53546345",
"0.53502965",
"0.53442705",
"0.53414273",
"0.53394586",
"0.53372824",
"0.5330366",
"0.5329497",
"0.53227425",
"0.53104925",
"0.53060836"
] | 0.73742723 | 1 |
DELETE /admin/shirt_colors/1 DELETE /admin/shirt_colors/1.json | def destroy
@shirt_color = ShirtColor.find(params[:id])
@shirt_color.destroy
respond_to do |format|
format.html { redirect_to admins_shirt_colors_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_colors_url, notice: 'Color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_color.destroy\n respond_to do |format|\n format.html { redirect_to item_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color.destroy\n\n render json: @color, status: :ok#, location: @color\n end",
"def destroy\n @color = Color.find(params[:id])\n @color.destroy\n\n respond_to do |format|\n format.html { redirect_to colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color = Color.find(params[:id])\n @color.destroy\n\n respond_to do |format|\n format.html { redirect_to colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @primary_color.destroy\n respond_to do |format|\n format.html { redirect_to primary_colors_url, notice: 'Primary color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interior_colour.destroy\n respond_to do |format|\n format.html { redirect_to admin_interior_colours_url, notice: 'Interior colour was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @five_color.destroy\n respond_to do |format|\n format.html { redirect_to five_colors_url, notice: 'Five color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disc_color = DiscColor.find(params[:id])\n @disc_color.destroy\n\n respond_to do |format|\n format.html { redirect_to disc_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lent_color.destroy\n respond_to do |format|\n format.html { \n redirect_to lent_colors_url\n flash[:danger] = 'Se ha eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plant_leaf_color.destroy\n respond_to do |format|\n format.html { redirect_to :back , notice: 'Plant leaf color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lbl_colour = LblColour.find(params[:id])\n @lbl_colour.destroy\n\n respond_to do |format|\n format.html { redirect_to lbl_colours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_pricing_paint_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_pricing_paint_colors_path, notice: mk_notice(@admin_pricing_paint_color, @admin_pricing_paint_color.brand.name, 'قیمت برای برند رنگ', :destroy) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color_saturation = ColorSaturation.find(params[:id])\n @color_saturation.destroy\n\n respond_to do |format|\n format.html { redirect_to color_saturations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bloom_color.destroy\n respond_to do |format|\n format.html { redirect_to bloom_colors_url, notice: 'Bloom color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color_scheme.destroy\n respond_to do |format|\n format.html { redirect_to admin_color_schemes_url, notice: 'Color scheme was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url, notice: 'Red was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color_vehi.destroy\n respond_to do |format|\n format.html { redirect_to color_vehis_url, notice: 'Color vehi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bead_color.destroy\n respond_to do |format|\n format.html { redirect_to bead_colors_url, notice: 'Bead color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n app_id = @theme_color.app_id\n @theme_color.destroy\n respond_to do |format|\n format.html { redirect_to theme_colors_path(:app_id => app_id), notice: 'Theme color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_reform_colors_url, notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.reform_color', count: 1)) }\n end\n end",
"def destroy\n @suitcolor.destroy\n respond_to do |format|\n format.html { redirect_to suitcolors_url, notice: \"Suitcolor was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shirt_style.destroy\n respond_to do |format|\n format.html { redirect_to shirt_styles_url, notice: 'Shirt style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colour = Colour.find(params[:id])\n @colour.destroy\n\n respond_to do |format|\n format.html { redirect_to(colours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @color_type = ColorType.find(params[:id])\n @color_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(color_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_color = ProductColor.find(params[:id])\n @product_color.destroy\n\n respond_to do |format|\n format.html { redirect_to @product_color.product_type }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internalcolor = Internalcolor.find(params[:id])\n @internalcolor.destroy\n\n respond_to do |format|\n format.html { redirect_to(internalcolors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @metal_color.products.each do |product|\n product.metal_color = nil\n product.save\n end\n @metal_color_tmp = @metal_color.dup\n @metal_color.destroy\n record_activity(@metal_color_tmp)\n respond_to do |format|\n format.html { redirect_to admin_metal_colors_url, notice: 'Цвет металла был успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redpack = Redpack.find(params[:id])\n @redpack.destroy\n\n respond_to do |format|\n format.html { redirect_to redpacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hair_colour = HairColour.find(params[:id])\n @hair_colour.destroy\n\n respond_to do |format|\n format.html { redirect_to hair_colours_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize @products_color\n @products_color.destroy\n respond_to do |format|\n format.html { redirect_to products_colors_url, notice: 'Products color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brand_color = BrandColor.find(params[:id])\n @brand_color.destroy\n\n respond_to do |format|\n format.html { redirect_to(brand_colors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dish_style.destroy\n respond_to do |format|\n format.html { redirect_to dish_styles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blue.destroy\n respond_to do |format|\n format.html { redirect_to blues_url, notice: 'Blue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beercolour.destroy\n respond_to do |format|\n format.html { redirect_to beercolours_url, notice: 'Beercolour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redaction.destroy\n respond_to do |format|\n format.html { redirect_to redactions_url, notice: 'Redaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redaction.destroy\n respond_to do |format|\n format.html { redirect_to redactions_url, notice: 'Redaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_color.destroy\n\n render :nothing => true\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redacao.destroy\n respond_to do |format|\n format.html { redirect_to redacaos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @hair_color.destroy\n respond_to do |format|\n format.html { redirect_to hair_colors_url, notice: 'Hair color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shirt_size = ShirtSize.find(params[:id])\n @shirt_size.destroy\n\n respond_to do |format|\n format.html { redirect_to shirt_sizes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @car_interior_color = CarInteriorColor.find(params[:id])\n @car_interior_color.destroy\n\n respond_to do |format|\n format.html { redirect_to car_interior_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stadium.destroy\n respond_to do |format|\n format.html { redirect_to admin_stadiums_url, notice: 'Stadium успешно удален(о).' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @size.destroy\n\n render json: @size, status: :ok#, location: @size\n end",
"def destroy\n @color_reflection = ColorReflection.find(params[:id])\n @color_reflection.destroy\n\n respond_to do |format|\n format.html { redirect_to(color_reflections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rainbow = Rainbow.find(params[:id])\n @rainbow.destroy\n\n respond_to do |format|\n format.html { redirect_to rainbows_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @swatch.destroy\n respond_to do |format|\n format.html { redirect_to swatches_url, notice: 'Swatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colorizer.destroy\n respond_to do |format|\n format.html { redirect_to colorizers_url, notice: 'Colorizer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @palette.destroy\n respond_to do |format|\n format.html { redirect_to palettes_url, notice: 'Palette was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @palette.destroy\n respond_to do |format|\n format.html { redirect_to palettes_url, notice: 'Palette was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @heat_type = HeatType.find(params[:id])\n @heat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shirt_size.destroy\n respond_to do |format|\n format.html { redirect_to shirt_sizes_url, notice: 'Shirt size was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color_logo.destroy\n respond_to do |format|\n format.html { redirect_to color_logos_url, notice: 'Color logo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @squawk = Squawk.find(params[:id])\n @squawk.destroy\n\n respond_to do |format|\n format.html { redirect_to squawks_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 @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tgl_row = TglRow.find(params[:id])\n @tgl_row.destroy\n\n respond_to do |format|\n format.html { redirect_to tgl_rows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @drum_type.destroy\n respond_to do |format|\n format.html { redirect_to drum_types_url, notice: 'Drum type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @red_flag = RedFlag.find(params[:id])\n @red_flag.destroy\n\n respond_to do |format|\n format.html { redirect_to red_flags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stadium.destroy\n respond_to do |format|\n format.html { redirect_to stadia_url, notice: 'Stadium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skin_diet.destroy\n respond_to do |format|\n format.html { redirect_to admin_show_path, notice: 'Skin diet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clowd = Clowd.find(params[:id])\n @clowd.destroy\n\n respond_to do |format|\n format.html { redirect_to clowds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def destroy\n @bg_check.destroy\n respond_to do |format|\n format.html { redirect_to bg_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shirt_sub_option = ShirtSubOption.find(params[:id])\n @shirt_sub_option.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_shirt_sub_options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scrobble = Scrobble.find(params[:id])\n @scrobble.destroy\n\n respond_to do |format|\n format.html { redirect_to scrobbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_img_bg_setting = PageImgBgSetting.find(params[:id])\n @page_img_bg_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to page_img_bg_settings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @red_packet_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_red_packet_histories_url, notice: 'Red packet history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rest.destroy\n respond_to do |format|\n format.html { redirect_to rests_url, notice: 'Rest was successfully destroyed.' }\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 @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooking_style.destroy\n respond_to do |format|\n format.html { redirect_to cooking_styles_url, notice: 'Cooking style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_bg_images_url, notice: 'Bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resturant.destroy\n respond_to do |format|\n format.html { redirect_to resturants_url, notice: 'Resturant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7895721",
"0.7253408",
"0.72148347",
"0.7204698",
"0.7060551",
"0.7060551",
"0.7053655",
"0.7036212",
"0.69999903",
"0.6959335",
"0.69069874",
"0.6879896",
"0.6866158",
"0.6802698",
"0.67977387",
"0.6795793",
"0.6755527",
"0.67211616",
"0.6720177",
"0.6711934",
"0.6702769",
"0.6693186",
"0.66693556",
"0.6668531",
"0.6653019",
"0.6611558",
"0.6593971",
"0.6588089",
"0.6581148",
"0.65616494",
"0.6554972",
"0.65301305",
"0.65050894",
"0.6486494",
"0.64408094",
"0.64183533",
"0.63971853",
"0.63847446",
"0.63746905",
"0.6364832",
"0.6364832",
"0.6364022",
"0.6343375",
"0.634208",
"0.6330247",
"0.6323884",
"0.6321747",
"0.6297722",
"0.6297008",
"0.628856",
"0.6275621",
"0.62725675",
"0.6263407",
"0.62630284",
"0.6262313",
"0.6259931",
"0.6259931",
"0.6255345",
"0.62547314",
"0.6253771",
"0.6246388",
"0.6229066",
"0.622382",
"0.62232745",
"0.6220114",
"0.62118304",
"0.6210548",
"0.62056994",
"0.6203439",
"0.62033755",
"0.61830515",
"0.61828107",
"0.6174536",
"0.61572254",
"0.61412996",
"0.61385256",
"0.61327845",
"0.6127294",
"0.61264056",
"0.61252207",
"0.61227",
"0.6122025",
"0.6110255",
"0.6109266",
"0.61071146",
"0.610657",
"0.6103402",
"0.6098895",
"0.60929185",
"0.60798806",
"0.6079585",
"0.60757303",
"0.60752285",
"0.60718155",
"0.6071726",
"0.6071114",
"0.6070156",
"0.6069431",
"0.60690457",
"0.60676414"
] | 0.78010786 | 1 |
before_action :new, :check_if_student GET /books GET /books.json | def index
check_if_student
@books = Book.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @student = Student.find(params[:student_id])\n @student_book = @student.student_books.new(student_book_params)\n authorize! :create, @student_book\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to student_student_books_path(@student), notice: 'Student book was successfully created.' }\n format.json { render :show, status: :created, location: @student_book }\n else\n format.html { render :new }\n format.json { render json: @student_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n authorize! :read, @student_book\n @student = @student_book.student\n end",
"def student\n unless logged_user.student? then\n render_403 and return\n end\n\n if request.get? then\n @student = logged_user.student\n elsif request.put? then\n student = Student.find(logged_user.student.id)\n student.specialty_id = params[:specialty]\n student.course = params[:course]\n if student.save then\n if params[:reg] then\n redirect_to :root\n else\n redirect_to :settings_student, alert: t('settings.save_suc')\n end\n else\n redirect_to :settings_student, notice: t('settings.save_fail')\n end\n end\n end",
"def set_student\n @student = Student.find params[:id]\n authorize @student\n end",
"def require_student\n redirect_to root_path unless @auth_user && @auth_user.type == 'Student'\n end",
"def set_student\n @student = Student.find(params[:id])\n authorize @student\n end",
"def create\n @student = Student.new(student_params)\n @student.set_book_limit\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize Student\n if User.find_by_email(current_user.email).provider == 'facebook' and Student.find_by_email(current_user.email).education == 'DUMMY'\n redirect_to edit_student_path(Student.find_by_email(current_user.email)), notice: 'Please fill out details first !'\n end\n\n @students = Student.all\n # authorize Student\n end",
"def check_student\n if !current_student\n redirect_to :root, notice: \"You are not logged in as student\"\n end \n end",
"def must_be_current_student\n # Need to match current user to current student id\n unless current_user.id == params[:id]\n redirect_to root_path, notice: \"This is not you!\"\n end\n end",
"def index\n @current_user = current_user\n @books = []\n if !@current_user.student?\n @books = Book.all\n end\n end",
"def former_student\n @batch = Batch.shod(params[:graduate][:batch_id])\n @batch.graduate(params[:students], params[:graduate][:status_description])\n former_student2\n authorize! :create, @batch\n end",
"def show\n user_type = session[:user_type]\n case user_type\n when ApplicationController::TYPE_STUDENT\n check = BookRequest.check_if_authorised?(user_type, current_user.id, params[:id])\n if (check == false)\n flash[:notice] = \"You are not authorised to perform this action\"\n redirect_to root_path\n end\n when ApplicationController::TYPE_LIBRARIAN\n check = BookRequest.check_if_authorised?(user_type, current_user.library_id, params[:id])\n if (check == false)\n flash[:notice] = \"You are not authorised to perform this action\"\n redirect_to root_path\n end\n when ApplicationController::TYPE_ADMIN\n # admin can see any book request\n end\n end",
"def new\n @robots=\"noindex,nofollow\"\n authorize! :create, Roxiware::BookSeries\n \n\n @series = Roxiware::BookSeries.new\n if params[:goodreads_id]\n goodreads = Roxiware::Goodreads::Book.new(:goodreads_user=>@goodreads_user)\n @series.from_goodreads_series(goodreads.get_series(params[:goodreads_id]))\n end\n @books = Roxiware::Book.all\n\n respond_to do |format|\n format.html { render :partial =>\"roxiware/books/series/editform\" }\n format.json { render :json => @series.ajax_attrs(@role) }\n end\n end",
"def new\n @book = current_user.books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def set_student_book\n @student_book = StudentBook.find(params[:id])\n end",
"def before_action \n end",
"def new\n # Don't want to be able to select student here, but not sure how to disable it\n @students = Student.where(:name => \"xxxx\")\n @subject = Subject.new\n @b_id = @subject.id\n\n respond_with(@resources, @students, @subject, @b_id)\n end",
"def create\n # @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def create\n @manage_student = Manage::Student.new(manage_student_params)\n\n respond_to do |format|\n if @manage_student.save\n format.html { redirect_to @manage_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @manage_student }\n else\n format.html { render :new }\n format.json { render json: @manage_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if check_if_admin\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_path, notice: 'Student details were successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if is_admin?\n @book = get_book\n else\n go_home\n end\n\n go_home if !@book\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente creado.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def required_student\n require_user_type(:student)\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def create\n @student = current_user.build_student(student_params) #When createing the student, it connects the current logged in user to the student in the database. \n authorize @student\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n authorize! :create, @student\n respond_to do |format|\n if @student.save\n flash[:notice] = \"Record mahasiswa berhasil dibuat, #{undo_link(@student)}\"\n format.js\n # format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.js {render action: 'new'}\n # format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_resource\n\t\t\tif student_signed_in?\n\t\t\t\tif \"#{resource_name}\" == \"lecturer\" or \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\t\tredirect_to :root\n\t\t\t\tend\n\t\t\telsif lecturer_signed_in?\n\t\t\t\tif \"#{resource_name}\" == \"student\" or \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\t\tredirect_to :root\n\t\t\t\tend\n\t\t\telsif teaching_assistant_signed_in?\n\t\t\t\tif \"#{resource_name}\" == \"lecturer\" or \"#{resource_name}\" == \"student\"\n\t\t\t\t\tredirect_to :root\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def new\n @supervision.student = Student.find(params[:student_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @supervision }\n end\n end",
"def create\n byebug\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n load_data\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam_student = ExamStudent.new\n if params[:user_id]\n @exam_student.user_id = params[:user_id]\n end\n if params[:exam_id]\n @exam_student.exam_id = params[:exam_id]\n end\n if params[:status]\n @exam_student.status = params[:status]\n end\n\n respond_to do |format|\n if @exam_student.save\n format.html { redirect_to exams_url, notice: 'Prijavili ste ispit.' }\n format.json { render :show, status: :created, location: @exam_student }\n else\n format.html { render :new }\n format.json { render json: @exam_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @checkin = \"true\"\n @student = Student.new(email: flash[:email])\n end",
"def correct_student\n @student = Student.find(params[:id])\n redirect_to(root_url) unless current_student?(@student)\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student Info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n respond_to do |format|\n @student.activated = true\n if @student.save\n # @student.activated = true\n log_in(@student, \"student\")\n \n format.html { redirect_to root_url}\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render :show, status: :created, location: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new\n @student.name = params[:student][:name]\n @student.registration = params[:student][:registration]\n @student.admission = params[:student][:admission]\n respond_to do |format|\n if @student.save\n if params[:student][:pc] == 0\n format.html { redirect_to students_path}\n else\n format.html { redirect_to complete_new_user_path(params[:student][:registration], params[:student][:pc]), method: 'post'}\n format.json { render :show, status: :created, location: @student }\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_non_author\n book = Book.find(params[:id])\n if book.user_id != current_user.id\n redirect_to books_path, alert: \"You are not main author of this book. Access denied\"\n end\n end",
"def new\n\n @user = User.find(current_user.id)\n @book = Book.new\n @book.user_id = @user.id\n\n @book = Book.new(:title => params[:rtitle],:author => params[:rauthor], :isbn => params[:risbn])\n # @book = Book.find_by_user_id(@user.id)\n\n isbn = @book.isbn\n user_id = @user.id\n books = Book.find_by_isbn_and_user_id(isbn,user_id)\n if books.nil?\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n else\n redirect_to \"/books/search\"\n flash[:alert] = \"the book '#{@book.title}' already exist - please search for another book!!!\"\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @student = Student.new\n session[:is_tutor] = false\n redirect_to '/auth/github'\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @college.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n #redirect_if_not_logged_in\n @books = Book.all\n end",
"def create\n @user = current_user\n @book = current_user.books.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_books\n\n end",
"def create\n\t\tp = params[:student]\n\t\thash = { :original_name => p['original_name'], :sort_name => Student.make_sort_name(p['original_name']), :other_name => p['other_name'],\n\t\t\t:gender => p['gender'] == 'Male' ? 'M' : 'F', :born => VagueDate.factory(p['born']).to_s, :died => VagueDate.factory(p['died']).to_s,\n\t\t\t:home_town => p['home_town']['town'], :home_state => p['home_town']['state'], :home_country => p['home_town']['country'],\n\t\t\t:biographical_notes => p['biographical_notes'], :quotes => p['quotes'], :additional_notes => p['additional_notes'], :private_notes => p['private_notes'], :is_stub => 0\n\t\t}\n\n\t\t@student = Student.new(hash)\n\t\t@student.generate_unique_name()\n\n\t\trespond_to do |format|\n\t\t\tif @student.save\n\t\t\t\tmarriages = parse_array(p['marriage'])\n\t\t\t\tmarriages.each {|marriage|\n\t\t\t\t\tif !marriage['name'].blank?\n\t\t\t\t\t\tMarriage.create_marriage(@student, { :name => marriage['name'] }, marriage['date'])\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tresidences = parse_array(p['residence'])\n\t\t\t\tresidences.each {|residence|\n\t\t\t\t\tif !residence.blank?\n\t\t\t\t\t\tStudentResidence.create_residence(@student, residence)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tBrowse.student_changed(@student, nil)\n\t\t\t\tsolr().add_object(@student.to_solr())\n\n\t\t\t\tformat.html { redirect_to(@student, :notice => 'The student was successfully created.') }\n\t\t\telse\n\t\t\t\tformat.html {\n\t\t\t\t\t@page_title = 'Student'\n\t\t\t\t\tnew_setup()\n\t\t\t\t\trender :action => \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def new\n @enrolled_student = EnrolledStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrolled_student }\n end\n end",
"def not_present\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.add_to_set(:absences, today_absence)\n format.html { redirect_to students_url, notice: 'Student absences were successfully updated.' }\n format.json { render :json => { value: bullets(@student.absences) }.to_json }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end",
"def check_for_students\n # TODO: set a message.\n # TODO: handle on a per section basis?\n if (!Student.exists?)\n # First we need students, so when the students table is empty\n # go to the import page.\n redirect_to students_path\n end\n end",
"def create\n authorize Student\n student_params[:fines]=0\n @student = Student.new(student_params)\n @user = User.new({email:@student.email,password:@student.password,password_confirmation:@student.password})\n respond_to do |format|\n if @student.save\n if(@student[:education]==\"Masters\")\n @student.update({max_books:4})\n elsif (@student[:education]==\"PhD\")\n @student.update({max_books:6})\n else\n @student.update({max_books:2})\n end\n @user.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.kundenstatus = 1\n @student.percentage = 1\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def load_controller_object context\n if action_name == 'edit' || action_name == 'destroy' || action_name == 'update'\n super\n else\n @student ||= begin\n id = params[find_first_parent.is_a?(Student) ? :student_id : :id ]\n Student.find(id)\n end\n @test_score = TestScore.new({student_id: @student.id}, as: current_role)\n end\n end",
"def current_user_is_student?\n if current_user.user_type == \"student\"\n true\n else\n redirect_to user_path(@current_user)\n end\n end",
"def create\n \tredirect_to \"/book/index\"\n end",
"def new\n user = User.find(session[:user_id])\n if user.usertype != 'student'\n redirect_to :action => 'edit', :id=> user.tutor.id\n return\n end\n @tutor = Tutor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutor }\n end\n end",
"def checkin\n @book = Book.find_by_id(params[:id])\n if( @book.nil?)\n redirect_to root_path , notice:\"Book not found\"\n return\n end\n @book_transaction = BookTransaction.new\n\n end",
"def create\n @book_lend = BookLend.new(book_lend_params)\n\n respond_to do |format|\n if @book_lend.save\n\n if (!params[:book_lend][:student_id].blank?)\n @book_lend.student_id = params[:book_lend][:student_id]\n @book_lend.save\n end\n\n format.html { redirect_to @book_lend, notice: 'Book lend was successfully created.' }\n format.json { render :show, status: :created, location: @book_lend }\n else\n format.html { render :new }\n format.json { render json: @book_lend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def must_be_student\n unless current_user.role.name.eql?('Student')\n flash[:error] = \"Access denied.\"\n redirect_to root_url\n end\n end",
"def new\n @journal = Journal.new\n @student = Student.find( params[\"student\"])\n end",
"def set_books\n @student_library = StudentLibrary.find(params[:student_library_id])\n end",
"def new\n\t\t@student = Student.new\n\t\tnew_setup()\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\tend\n end",
"def show\n\t\t#show now run by find_book and before_action\n\t\t#keeps code dry\n\tend",
"def create\n @book = current_user.books.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n authorize Student\n if(current_user.user?)\n @stud = Student.find_by_email(current_user.email)\n @stud2 = Student.find(params[:id])\n if(@stud.id!=@stud2[:id])\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '生徒情報が追加されました' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\r\n @book = Book.find(params[:id])\r\n lookup_permission @book.id\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def create\n\n @student = Student.new(params[:student])\n\n respond_to do |format|\n\n if @student.save\n format.html { redirect_to(:action=> \"index\")}#@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end #end if else\n\n end #end do\n\n end"
] | [
"0.68464494",
"0.65687937",
"0.6554601",
"0.6502732",
"0.6370361",
"0.6274324",
"0.62663233",
"0.61579055",
"0.6149347",
"0.61476344",
"0.61146224",
"0.61006683",
"0.60970044",
"0.60884786",
"0.60394114",
"0.6039122",
"0.6036817",
"0.60239",
"0.60199237",
"0.59859014",
"0.5976397",
"0.59738755",
"0.5965081",
"0.5963812",
"0.5937962",
"0.5926352",
"0.5908736",
"0.58930904",
"0.5892078",
"0.5887264",
"0.58852243",
"0.58743817",
"0.5867432",
"0.5866214",
"0.5864226",
"0.58589846",
"0.5846839",
"0.5846839",
"0.5846441",
"0.58458686",
"0.5843367",
"0.5839045",
"0.58386767",
"0.58342934",
"0.5832389",
"0.58292305",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5827473",
"0.5826251",
"0.5826251",
"0.5826251",
"0.5826251",
"0.5826251",
"0.5826251",
"0.5826251",
"0.58208555",
"0.5820698",
"0.5820389",
"0.5816785",
"0.5816058",
"0.5816035",
"0.5815423",
"0.5806364",
"0.5802847",
"0.5802847",
"0.5800532",
"0.5798074",
"0.5794847",
"0.5792356",
"0.5792356",
"0.5792356",
"0.5792356",
"0.5792356",
"0.5792356",
"0.5792356",
"0.578872",
"0.57870954",
"0.57791364",
"0.57790786",
"0.57775426",
"0.5777224",
"0.57767594",
"0.577616",
"0.5773846",
"0.5766923",
"0.57633716",
"0.57595927",
"0.5748837",
"0.5746692",
"0.5744546",
"0.57443255"
] | 0.701106 | 0 |
GET /books/1 GET /books/1.json | def show
@library = Library.find(Book.find(params[:id]).library_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end",
"def index\n @books = Book.all\n render json: @books\n end",
"def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end",
"def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def show\n render json: @book\n end",
"def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end",
"def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end",
"def show\n @title = \"Show Book\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end",
"def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def index\n books = current_user.books.all\n render json: { books: books }\n end",
"def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end",
"def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end",
"def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def index\n if current_user\n @books = current_user.books\n render json: @books, status: 201\n end\n end",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\n end\n end",
"def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend",
"def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end",
"def show\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n render json: @api_book\n end",
"def show\n @book = Book.find_by_id(params[:id])\n if @book.present?\n render json: {\n type: 'success',\n result: @book\n }, status: :ok\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def show\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cookbook }\n end\n end",
"def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end",
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def get_books(response)\n response[\"items\"]\nend",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def index\n @books = Book.all\n do_response @books\n #\n #respond_to do |format|\n # format.html # index.html.erb\n #format.json { render :json => @books }\n #end\n end",
"def show\n @user = User.find(params[:id])\n @books = Book.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @book = Book.find(params[:book_id])\n end",
"def books_author\n \t@books = Book.where(\"author = '#{params[:author]}'\")\n\n \trespond_to do |format|\n format.html # list_authors.html.erb\n format.json { render json: @books }\n end\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @books = Book.get_avaible_books\n end",
"def index\n render jsonapi: Book.search(params), include: [:genre, :author, :libraries]\n end",
"def book\n fetch('harry_potter.books')\n end",
"def show\n @usersbook = Usersbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usersbook }\n end\n end",
"def show\n @books = Book.find(params[:id])\n puts @book\n end",
"def book(id)\n\t\t\tresponse = request('/book/show', :id => id)\n\t\t\tHashie::Mash.new(response['book'])\n\t\tend",
"def show\n @book_shelf = BookShelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def get_book\n @book = Book.where(id: params[:book_id]).first\n end",
"def show\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_chapters_url(@book_series, @collection, @book) }\n format.json { head :no_content }\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n books_with_isbn = Book.where(isbn: params[:search])\n if books_with_isbn.any? and not request.format.json?\n redirect_to books_with_isbn.first\n return\n else\n search\n @books = @books.first(params[:limit].to_i) if params[:limit]\n @query = params[:search]\n unless request.format.json?\n @books = @books.paginate(page: params['page'])\n end\n end\n respond_to do |format|\n format.html\n format.json { 'show' }\n end\n end",
"def index\n @book_genres = BookGenre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_genres }\n end\n end",
"def get_book_with_api(title)\n uri = URI.parse(URI.encode(\"https://www.googleapis.com/books/v1/volumes?q=#{title}\"))\n service = Books::ApiConnectService.new(uri)\n book_response = service.execute[\"items\"].first[\"volumeInfo\"]\n .select{ |key, value| key == \"title\" || key == \"description\" || key == \"publisher\" || key == \"publishedDate\" || key == \"imageLinks\"}\n @book_info_hash = book_response.inject({}) do |hash, (key, value)|\n if key.underscore == \"image_links\"\n hash[key.underscore] = book_response[\"imageLinks\"][\"smallThumbnail\"]\n else\n hash[key.underscore] = value\n end\n hash\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def index\n\t\tif (params[:data] != nil)\n\t\t\t@book = Book.new\n\t\t\t@client = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\t@search = @client.search_books(params[:data])\n\t\t\t#@search = @client.search_books(\"the lord of the rings\")\n\t\t\t@results = @search.results.work\n\t\t\t#https://image.tmdb.org/t/p/w300_and_h450_bestv2\n\t\tend\n\n @books = Book.all\n end",
"def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end",
"def retrieve_book\n @book = Book.find(params[:book_id])\n end",
"def index\n @notebooks = Notebook.all\n render json: @notebooks\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def show\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ebook }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def book\n @books=Book.all\n @book=Book.find(params[:id])\n end",
"def new\n @book = Book.new\n @people = Person.find_by_sql(\"SELECT * FROM People\")\n @authors = Author.find_by_sql(\"SELECT * FROM Authors\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end"
] | [
"0.7638282",
"0.7442742",
"0.7441457",
"0.73351127",
"0.73137444",
"0.7297435",
"0.72266304",
"0.72266304",
"0.7222271",
"0.72091204",
"0.72091204",
"0.72091204",
"0.72091204",
"0.72091204",
"0.72091204",
"0.72091204",
"0.72091204",
"0.72091204",
"0.71578825",
"0.71435905",
"0.71385443",
"0.71119267",
"0.698707",
"0.6968095",
"0.6964154",
"0.6950159",
"0.69122875",
"0.69062436",
"0.6905824",
"0.68929166",
"0.6892874",
"0.6870658",
"0.68617964",
"0.6858213",
"0.6852379",
"0.68409014",
"0.68338984",
"0.68136066",
"0.6813213",
"0.6807688",
"0.6806124",
"0.67877644",
"0.6779045",
"0.6758999",
"0.67475134",
"0.67083323",
"0.66705483",
"0.6668617",
"0.66409326",
"0.66333747",
"0.6620008",
"0.6615366",
"0.66091317",
"0.66063374",
"0.6605951",
"0.6605951",
"0.65827847",
"0.6579896",
"0.65401727",
"0.65259695",
"0.6510574",
"0.650876",
"0.6497579",
"0.64764214",
"0.64671195",
"0.64489347",
"0.6448796",
"0.64437",
"0.6433751",
"0.6432552",
"0.6421159",
"0.6420847",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6419523",
"0.6416176",
"0.64159715",
"0.64157486",
"0.6408057",
"0.640324",
"0.639981",
"0.6391858",
"0.63782",
"0.63782",
"0.63753927",
"0.6369383",
"0.6365847",
"0.6365847",
"0.6365847",
"0.63636255",
"0.63636255",
"0.6357503",
"0.6357503"
] | 0.0 | -1 |
POST /books POST /books.json | def create
@book = Book.new(book_params)
respond_to do |format|
if @book.save
format.html { redirect_to @book, notice: 'Book was successfully created.' }
format.json { render :show, status: :created, location: @book }
else
format.html { render :new }
format.json { render json: @book.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def create\n @book = Book.new(params[:book])\n \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n puts @book.as_json \n format.json { render :show, status: :created, location: @book }\n else\n \n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"#{book_params}\"\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(get_book_with_api(book_params[:title]))\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '本を新規登録しました。' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @book = Book.new(book_params)\r\n\r\n respond_to do |format|\r\n if @book.save\r\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\r\n format.json { render :show, status: :created, location: @book }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @book = params[:book]\n add(@book)\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book}\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.xml { head :ok }\n format.json { render json: @book, status: :created, location: @book }\n\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@book = Book.new(params[:book])\n\t\t@book.user = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @book.save\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully created.' }\n\t\t\t\tformat.json { render :json => @book, :status => :created, :location => @book }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def store\n @book = Book.new(book_params)\n if @book.save\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {},\n }, status: :bad_request\n end\n end",
"def create\n @title = \"Create New Book\"\n\n process_publisher\n\n all_book_params= params[:book]\n\n @book = Book.new(params[:book])\n\n process_authors\n\n process_subjects\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to edit_book_path(@book), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = current_user.books.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n @book.user = current_user\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n render_error_response(\"\", \"new\", @book)\n end\n end\n end",
"def create\n @user = current_user\n @book = current_user.books.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n puts \"*** From create: \" \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n decoded_token = JWT.decode book_params[:swipeChefToken], \"spaghetti\", true, { algorithm: 'HS256' }\n\n if decoded_token\n\n user_id = decoded_token[0]['id'].to_i\n\n @book = Book.find_or_create_by(user_id: user_id, recipe_id: params[:recipe_id])\n\n respond_to do |format|\n format.json { render json: @book}\n end\n end\n end",
"def create\n @book = current_user.books.build(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params.merge(user_id:current_user.id))\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book = current_user.books.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @authors_book = AuthorsBook.new(params[:authors_book])\n\n respond_to do |format|\n if @authors_book.save\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully created.' }\n format.json { render json: @authors_book, status: :created, location: @authors_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cook_book = CookBook.new(params[:cook_book])\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render json: @cook_book, status: :created, location: @cook_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params_create)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '添加成功!' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @booktitle = Book.find_by_title(book_params[:title])\n if Book.where(:title => book_params[:title]).present?\n @book = Book.find(@booktitle.id)\n @book.count = @book.count + book_params[:count].to_i\n else\n if !(Author.where(:name => book_params[:author_name]).present?)\n @author = Author.create(:name => book_params[:author_name],\n :category => book_params[:category])\n end\n @book = Book.new(book_params)\n @book.author_id = Author.find_by_name(book_params[:author_name]).id\n end\n\n \n respond_to do |format|\n if @book.save\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_book = MyBook.new(my_book_params)\n\n respond_to do |format|\n if @my_book.save\n format.html { redirect_to @my_book, notice: 'My book was successfully created.' }\n format.json { render :show, status: :created, location: @my_book }\n else\n format.html { render :new }\n format.json { render json: @my_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n #flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n load_data\n\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n @book.user = current_user\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n resort_orders\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n @book.user = current_user\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n @categories = Category.all.order('name asc')\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_url, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n user_session = UserSession.new\n user_session.current_user.books << @book\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tags_book = TagsBook.new(tags_book_params)\n\n @books = Book.all\n @tags = Tag.all\n\n respond_to do |format|\n if @tags_book.save\n format.html { redirect_to @tags_book, notice: \"Tags book was successfully created.\" }\n format.json { render :show, status: :created, location: @tags_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tags_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usersbook = Usersbook.new(params[:usersbook])\n\n respond_to do |format|\n if @usersbook.save\n format.html { redirect_to @usersbook, notice: 'Registro criado com sucesso!' }\n format.json { render json: @usersbook, status: :created, location: @usersbook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usersbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author_book = AuthorBook.new(author_book_params)\n\n respond_to do |format|\n if @author_book.save\n format.html { redirect_to @author_book, notice: 'Author book was successfully created.' }\n format.json { render :show, status: :created, location: @author_book }\n else\n format.html { render :new }\n format.json { render json: @author_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n Book.create(\n title: params[:book][:title],\n author: params[:book][:author],\n description: params[:book][:description],\n image_url: params[:book][:image_url]\n )\n\n redirect_to books_path\n end",
"def create\n @books_author = BooksAuthor.new(books_author_params)\n\n respond_to do |format|\n if @books_author.save\n format.html { redirect_to @books_author, notice: 'Books author was successfully created.' }\n format.json { render :show, status: :created, location: @books_author }\n else\n format.html { render :new }\n format.json { render json: @books_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book = LibraryBook.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def call(params)\n @books = BookRepository.all\n self.body = JSON.dump(@books)\n end",
"def create\n @cook_book = CookBook.new(cook_book_params)\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render :show, status: :created, location: @cook_book }\n else\n format.html { render :new }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n #for author_id in params[:authors_ids]\n # @book.authors << Author.find(author_id)\n #end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @authors_book = AuthorsBook.new(authors_book_params)\n\n respond_to do |format|\n if @authors_book.save\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully created.' }\n format.json { render :show, status: :created, location: @authors_book }\n else\n format.html { render :new }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n rewriteParams\n @book = Book.new(params[:book])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n book = Book.create(params[:book])\n redirect_to(book)\n end",
"def create\n @book = Book.new(book_params)\n\n # 書籍情報を取得\n get_info\n\n if @res.present? && !@res.has_error? && @res.total_results != 0\n @book.isbn = @res.first_item.get('ItemAttributes/ISBN')\n @book.asin = @res.first_item.get('ASIN')\n @book.title = @res.first_item.get('ItemAttributes/Title')\n @book.publisher = @res.first_item.get('ItemAttributes/Manufacturer')\n @book.author = @res.first_item.get('ItemAttributes/Author')\n @book.description = @res.first_item.get('EditorialReviews/EditorialReview/Content')\n @book.image = @res.first_item.get('MediumImage/URL')\n @book.publish_date = @res.first_item.get('ItemAttributes/PublicationDate')\n @book.number_of_pages = @res.first_item.get('ItemAttributes/NumberOfPages')\n @book.price = @res.first_item.get('ItemAttributes/ListPrice/Amount')\n\n # 取得したISBNが登録されてない場合のみ、取得した書籍を登録する\n @find_book = Book.find_by(isbn: @book.isbn)\n if @find_book.nil?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: @book.title + ' を新規登録しました。' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @find_book, notice: @book.title + ' は既に登録されています。' }\n format.json { render :show, status: :created, location: @find_book }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to books_url, notice: '本が見つかりませんでした。' }\n format.json { head :no_content }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to root_path, notice: 'Book was successfully created.'\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def create\n # @book = Book.new(params[:book])\n\n @user = User.find(current_user.id)\n @book = Book.new(params[:book])\n @book.user_id = @user.id\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stuk_book = current_user.stuk_books.new(stuk_book_params)\n\n respond_to do |format|\n if @stuk_book.save\n format.html { redirect_to @stuk_book, notice: 'Stuk book was successfully created.' }\n format.json { render :show, status: :created, location: @stuk_book }\n else\n format.html { render :new }\n format.json { render json: @stuk_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n @book.save\n redirect_to root_path\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def create\n @lib_book = LibBook.new(lib_book_params)\n\n respond_to do |format|\n if @lib_book.save\n format.html { redirect_to university_library_lib_books_path, notice: 'Lib book was successfully created.' }\n format.json { render :show, status: :created, location: @lib_book }\n else\n format.html { render :new }\n format.json { render json: @lib_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n booking = Booking.create(booking_params)\n render json: booking\n end",
"def create\n @order_book = OrderBook.new(order_book_params)\n\n respond_to do |format|\n if @order_book.save\n format.html { redirect_to @order_book, notice: 'Order book was successfully created.' }\n format.json { render :show, status: :created, location: @order_book }\n else\n format.html { render :new }\n format.json { render json: @order_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book_request = BookRequest.new(book_request_params)\n\n respond_to do |format|\n if @book_request.save\n format.html { redirect_to @book_request, notice: 'Book request was successfully created.' }\n format.json { render :show, status: :created, location: @book_request }\n else\n format.html { render :new }\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booksinlist = Booksinlist.new(booksinlist_params)\n\n respond_to do |format|\n if @booksinlist.save\n format.html { redirect_to @booksinlist, notice: 'Booksinlist was successfully created.' }\n format.json { render :show, status: :created, location: @booksinlist }\n else\n format.html { render :new }\n format.json { render json: @booksinlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def create\r\n @book = Book.new(params[:book])\r\n p current_user.id\r\n @book.user_id = current_user._id\r\n\r\n respond_to do |format|\r\n if @book.save\r\n format.html { redirect_to books_url }\r\n format.json { render json: @book, status: :created, location: @book }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @bookitem = Bookitem.new(bookitem_params)\n\n respond_to do |format|\n if @bookitem.save\n format.html { redirect_to @bookitem, notice: \"Bookitem was successfully created.\" }\n format.json { render :show, status: :created, location: @bookitem }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bookitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n params[:books].each{\n |id|\n StoreBook.create(:store_id=>@store.id,:book_id=>id)\n }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:success] = 'Added new Book...!'\n redirect_to :new_user_book, {user_id: @current_user}\n # @book = Book.new(book_params)\n #\n # respond_to do |format|\n # if @book.save\n # format.html { redirect_to @book, notice: 'Book was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @book }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @book.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @read_book = ReadBook.new(read_book_params)\n\n respond_to do |format|\n if @read_book.save\n flash[:notice] = 'Read book was successfully created.'\n format.html { redirect_to read_books_url }\n format.json { render :show, status: :created, location: @read_book }\n else\n flash[:warning] = 'Failed'\n format.html { redirect_to read_books_url }\n format.json { render json: @read_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n \n respond_to do |format|\n if @book.save_and_index\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end"
] | [
"0.7260979",
"0.7052168",
"0.6990385",
"0.69234765",
"0.6920176",
"0.68718755",
"0.68718755",
"0.68718755",
"0.68718755",
"0.68718755",
"0.685515",
"0.6847371",
"0.67841905",
"0.6777309",
"0.67586553",
"0.67586553",
"0.6756703",
"0.6698212",
"0.66888076",
"0.6679647",
"0.6679547",
"0.66673017",
"0.6641737",
"0.6633944",
"0.6629614",
"0.6628435",
"0.66133195",
"0.6607367",
"0.6591523",
"0.6540206",
"0.6504365",
"0.64937586",
"0.64928734",
"0.646501",
"0.6464641",
"0.6447995",
"0.6443829",
"0.64393216",
"0.6428988",
"0.6425766",
"0.6424515",
"0.638669",
"0.6382281",
"0.638196",
"0.63780767",
"0.63750756",
"0.6370779",
"0.6370229",
"0.63699603",
"0.6349182",
"0.6345612",
"0.6334372",
"0.6318645",
"0.6312265",
"0.6310267",
"0.6304289",
"0.6293593",
"0.6275266",
"0.6264814",
"0.6264769",
"0.6257652",
"0.6256603",
"0.62273383",
"0.62209564",
"0.62131244",
"0.6208884",
"0.6202378",
"0.6202378",
"0.6188388",
"0.61754453",
"0.6168806",
"0.6163953",
"0.61623055",
"0.6160648",
"0.61594677",
"0.61576056",
"0.6157007",
"0.6154997",
"0.6150714",
"0.6148583",
"0.6147838",
"0.6145559",
"0.6144584",
"0.6142159",
"0.6141694",
"0.6141694",
"0.6141694",
"0.6141694"
] | 0.67478836 | 26 |
PATCH/PUT /books/1 PATCH/PUT /books/1.json | def update
respond_to do |format|
if @book.update(book_params)
format.html { redirect_to @book, notice: 'Book was successfully updated.' }
format.json { render :show, status: :ok, location: @book }
else
format.html { render :edit }
format.json { render json: @book.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = current_user.books.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\t@book.titlelong = book.title\n\t\t\t@book.description = strip_tags(book.description)\n\t\t\t@book.title = book.work.original_title\n\t\t\t@book.pages = book.num_pages\n\t\t\t@book.bookrating = book.average_rating\n\t\t\t@book.author = book.authors.author.name\n\t\t\t@book.publisher = book.publisher\n\t\t\t@book.save\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def update\n\t\t@book = Book.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book.update_attributes(params[:book])\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n rewriteParams\n @book = Book.find(params[:id])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to current_user_path, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book1.update(book1_params)\n format.html { redirect_to @book1, notice: \"Book1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book1.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 @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n book_updater = UpdateBook.new(current_user, params[:id], book_params)\n book_updated = book_updater.update\n @book = book_updater.book\n\n if book_updated\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n respond_to do |format|\n if @my_book.update(my_book_params)\n format.html { redirect_to @my_book, notice: 'My book was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_book }\n else\n format.html { render :edit }\n format.json { render json: @my_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_book = UserBook.find(params[:id])\n\n respond_to do |format|\n if @user_book.update_attributes(params[:user_book])\n format.html { redirect_to new_user_book_path, notice: 'Your book was successfully updated. You can add more or go back to your shelf' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @book_request.update(book_request_params)\n format.html { redirect_to @book_request, notice: 'Book request was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_request }\n else\n format.html { render :edit }\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_path }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end",
"def update\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n if @cook_book.update_attributes(params[:cook_book])\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: '本の情報を更新しました。' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @object_book.update(object_book_params)\n format.html { redirect_to @object_book, notice: 'Object book was successfully updated.' }\n format.json { render :show, status: :ok, location: @object_book }\n else\n format.html { render :edit }\n format.json { render json: @object_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to '/books', notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: @book.title + ' の更新に成功しました。' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n\n respond_to do |format|\n if _create_or_update()\n\tformat.xml { render :xml => {:success=>true} }\n format.html { redirect_to @book_series, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n\tformat.xml { head :fail }\n format.json { render :json => @book_series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @note_book.update(note_book_params)\n format.html { redirect_to @note_book, notice: 'Note book was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_book }\n else\n format.html { render :edit }\n format.json { render json: @note_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n if @library_book.update_attributes(params[:library_book])\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params_update)\n format.html { redirect_to @book, notice: '保存的信息!' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book]) and @book.update_tags(params[:tag_ids])\r\n update_permission\r\n\r\n format.html {redirect_to books_url, notice: '信息已更新'}\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7048773",
"0.688817",
"0.68527925",
"0.68271405",
"0.6824262",
"0.6821144",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6802083",
"0.6800069",
"0.67871505",
"0.67303824",
"0.67264384",
"0.6724246",
"0.67084",
"0.67084",
"0.67084",
"0.67084",
"0.66770875",
"0.66587657",
"0.66437703",
"0.6582422",
"0.6577711",
"0.6545875",
"0.6542927",
"0.65420425",
"0.6529912",
"0.6523184",
"0.65064865",
"0.65064865",
"0.6489051",
"0.64870375",
"0.64866006",
"0.64755976",
"0.6462159",
"0.6453886",
"0.64341426",
"0.64308304",
"0.6428212",
"0.64138156",
"0.6401034",
"0.6387336",
"0.63720804",
"0.63644606",
"0.63644606",
"0.6363426",
"0.6358452",
"0.63347906",
"0.63347906",
"0.63347906",
"0.6332761",
"0.63214034",
"0.6316529",
"0.6315461",
"0.62972105",
"0.6294299",
"0.627291",
"0.6261264",
"0.6247757",
"0.6245476",
"0.62428814",
"0.624188",
"0.62307787",
"0.6229727",
"0.6227182",
"0.62183",
"0.62139195",
"0.62080127",
"0.6206921"
] | 0.65435743 | 47 |
DELETE /books/1 DELETE /books/1.json | def destroy
@book.destroy
respond_to do |format|
format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end \n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to user_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n render json { head :no_content }\n end",
"def destroy\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/books\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ebooks.destroy :id\n respond_to do |format|\n format.html { redirect_to ebooks_url, notice: 'Ebook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_uri, notice: '本を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book1.destroy\n respond_to do |format|\n format.html { redirect_to book1s_url, notice: \"Book1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_path, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to book_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '書籍が削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: @book.title + ' の削除に成功しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @book.destroy\r\n respond_to do |format|\r\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@book = Book.find(params[:id])\n @book = current_user.books.find(params[:id])\n book2delete = @book.title\n @book.destroy\n flash[:notice] = \"Removed: #{book2delete}\"\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to current_user_path, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @readbook.destroy\n respond_to do |format|\n format.html { redirect_to readbooks_url, notice: 'Readbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cook_book = CookBook.find(params[:id])\n @cook_book.destroy\n\n respond_to do |format|\n format.html { redirect_to cook_books_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.74842304",
"0.74440986",
"0.74440986",
"0.7437947",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.74340576",
"0.7420059",
"0.7401971",
"0.7401971",
"0.7401971",
"0.7401971",
"0.7401971",
"0.7401971",
"0.7401971",
"0.73946655",
"0.737975",
"0.7376375",
"0.7371",
"0.73495275",
"0.7299783",
"0.7299783",
"0.7298803",
"0.7281096",
"0.7274377",
"0.7217677",
"0.71927106",
"0.7172687",
"0.71706635",
"0.71669126",
"0.71478796",
"0.7146612",
"0.7146612",
"0.7146612",
"0.71421784",
"0.7140924",
"0.7138018",
"0.71299356",
"0.71286625",
"0.71282387",
"0.7117346",
"0.71054584",
"0.7092789",
"0.70854264",
"0.7084391",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70793253",
"0.70636743",
"0.70636743",
"0.7055893",
"0.704965",
"0.7044589",
"0.7036905",
"0.70293736"
] | 0.714886 | 58 |
Use callbacks to share common setup or constraints between actions. | def set_book
@book = Book.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 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 action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 _handle_action_missing(*args); 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 call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def book_params
params.require(:book).permit(:title,:isbn,:author,:language,:published,:edition,:cover_image,:subject,
:library_id,:summary,:quantity,:special_collection)
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 |
Use callbacks to share common setup or constraints between actions. | def set_interest
@interest = Interest.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def create_interest_params
params.permit(:yelp_id, :interests => [:min_seats, :max_seats, :datetime])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def 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 params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def parameters\n nil\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] | [
"0.7120904",
"0.70538116",
"0.69469863",
"0.6901261",
"0.67348766",
"0.6717708",
"0.66874576",
"0.6676195",
"0.66601187",
"0.65563625",
"0.6525127",
"0.64565873",
"0.64494514",
"0.644928",
"0.64452374",
"0.6433947",
"0.6412815",
"0.6412815",
"0.6391939",
"0.63792473",
"0.63792473",
"0.63738",
"0.6360176",
"0.6354222",
"0.6284756",
"0.6277987",
"0.6245304",
"0.62259704",
"0.62243503",
"0.6223834",
"0.62104595",
"0.62081766",
"0.61759263",
"0.61721593",
"0.6168236",
"0.61587787",
"0.6143901",
"0.6135065",
"0.61204714",
"0.61065775",
"0.60983306",
"0.6073666",
"0.6051939",
"0.6040974",
"0.6036216",
"0.60291374",
"0.6020614",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.6017416",
"0.60161096",
"0.6006702",
"0.6002367",
"0.600212",
"0.5996321",
"0.59943277",
"0.59942585",
"0.59858114",
"0.5982845",
"0.59766084",
"0.5973769",
"0.5968758",
"0.59653395",
"0.5964966",
"0.5964966",
"0.5957481",
"0.59511584",
"0.5951042",
"0.5948871",
"0.59427315",
"0.5930573",
"0.5930121",
"0.5926885",
"0.5923959",
"0.59182686",
"0.5916637",
"0.5913613",
"0.5912174",
"0.5906678",
"0.59059656",
"0.5904252",
"0.5901623",
"0.58983696",
"0.58962476",
"0.589576",
"0.5893608"
] | 0.0 | -1 |
Good to know: Ruby's array sort method more or less uses quick sort. Time complexity O(nlog(n)) Space complexity ? | def quick_sort(array)
# Base case
return array if array.length <= 1
left = []
right = []
# Uses random to select a pivot in case the array is already sorted
# to avoid running in quadriatic time
pivot_idx = rand(array.length)
pivot = array[pivot_idx]
array.each_with_index do |n, i|
next if i == pivot_idx
# If n < pivot, put it in the left array, else put it in the right array
n < pivot ? left << n : right << n
end
# Concats the sorted left array with the pivot and the sorted right array
quick_sort(left).concat([pivot]).concat(quick_sort(right))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quick_sort(array)\nend",
"def quick_sort(array)\n return array if array.size <= 1\n pivot = array.shift\n left = array.select { |el| el < pivot }\n right = array.select { |el| el >= pivot }\n\n quick_sort(left) + [pivot] + quick_sort(right)\nend",
"def quick_sort(arr, low = 0, high = arr.size - 1)\n return unless low < high\n\n partition_index = partition(arr, low, high)\n quick_sort(arr, low, partition_index - 1)\n quick_sort(arr, partition_index + 1, high)\n end",
"def quick_sort(arr)\n return [] if arr.empty?\n first, *remaining = arr\n left, right = remaining.partition{ |x| x < first }\n quick_sort(left) + [first] + quick_sort(right)\nend",
"def quick_sort(array=@base)\n return [] if array.empty?\n pivot = array.pop\n left, right = array.partition {|e| e < pivot}\n quick_sort(left) + [pivot] + quick_sort(right)\n end",
"def quicksort (a)\n return [] if a.empty? || a.nil?\n p = a.shift\n quicksort(a.select { |n| n < p }) + [p] + quicksort(a.select { |n| n >= p })\nend",
"def quick_sort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select { |el| el < arr.first } # one of these needs = for\n right_side = arr[1..-1].select { |el| el >= arr.first } # duplicates of base case\n\n quick_sort(left_side) + piviot_arr + quick_sort(right_side)\nend",
"def qsort(arr)\nend",
"def quick_sort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select{ |el| el < pivot_arr[0] }\n right_side = arr[1..-1].select{ |el| el >= pivot_arr[0] }\n quick_sort(left_side) + pivot_arr + quick_sort(right_side)\nend",
"def quick_sort(arr)\n return arr if arr.length <= 1\n\n ref = arr.shift\n left = quick_sort(arr.select{|x| x.length <= ref.length})\n right = quick_sort(arr.select{|x| x.length > ref.length})\n\n left + [ref] + right\nend",
"def quick_sort(array, p, r)\n return array if p >= r\n q = partition(array, p, r)\n quick_sort(array, p, q - 1)\n quick_sort(array, q + 1, r)\nend",
"def quicksort(arr, low, high)\n if low < high\n pivot_index = partition(arr, low, high)\n\n quicksort(arr, low, pivot_index - 1)\n quicksort(arr, pivot_index + 1, high)\n end\nend",
"def use_quick_sort(arr)\r\n if arr.length < 2\r\n return arr #Base case: arrays with 0 or 1 element are already “sorted.”\r\n else\r\n pivot = arr[0] #Recursive case\r\n less = arr[(1...arr.length)].select{|x| x <= pivot} #Sub-array of all the elements less than the pivot\r\n greater = arr[(1...arr.length)].select{|x| x > pivot} #Sub-array of all the elements greater than the pivot\r\n return use_quick_sort(less) + [pivot] + use_quick_sort(greater)\r\n end\r\nend",
"def quicksort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select {|num| num < arr.first}\n right_side = arr[1..-1].select {|num| num > arr.first}\n left_side + pivot_arr + right_side\nend",
"def quick_sort(array)\n return array if array.length <= 1\n\n pivot = array[0]\n left = []\n right = []\n\n array[1..-1].each do |el|\n if el.length < pivot.length\n left << el\n else\n right << el\n end\n end\n\n dom_oct(left) + [pivot] + dom_oct(right)\n\nend",
"def quick_sort(a)\n array = a\n \n # already sorted!\n return array if array.length <= 1\n \n pivot = array.length / 2\n \n lower = []\n higher = []\n array.length.times do |i|\n next if i == pivot\n \n if array[i] >= array[pivot]\n higher << array[i]\n else\n lower << array[i]\n end\n end\n \n return quick_sort(lower) + [array[pivot]] + quick_sort(higher)\nend",
"def quick_sort(array)\n if array.length < 3\n if array.length == 2\n if array[0] > array[1]\n array[0], array[1] = array[1], array[0]\n end\n end\n return array\n else\n pivot = array[array.length-1]\n left_arr = []\n right_arr = []\n array.each do |element|\n if element < pivot\n left_arr << element\n elsif element > pivot\n right_arr << element\n end\n end\n x = quick_sort(left_arr)\n y = quick_sort(right_arr)\n final = []\n final << x\n final << pivot\n final << y\n return final\n end\nend",
"def quicksort(ary)\n qsort_help(ary, 0, ary.length - 1)\n ary\n end",
"def quick_sort arr, first, last\n return arr if last <= first\n pivot = arr[last]\n j = first\n\n for i in first..last-1 do\n if pivot > arr[i]\n arr[i], arr[j] = arr[j], arr[i]\n j+= 1\n end\n end\n arr[j], arr[last] = arr[last], arr[j]\n quick_sort(arr, first, j-1)\n quick_sort(arr, j+1, last)\nend",
"def quicksort(array, low=0, high=nil)\n # Sort the whole array, by default\n if high == nil\n high = array.count - 1\n end\n\n if low < high\n p = partition array, low, high\n quicksort array, low, p-1\n quicksort array, p+1, high\n end\n\n return array\nend",
"def quicksort(arr)\n return arr if arr.length <= 1\n\n pivot, left, right = arr[0], [], []\n\n arr[1..-1].each do |el|\n el < pivot ? left << el : right << el\n end\n quicksort(left).concat([pivot]).concat(right)\nend",
"def quicksort(array)\n return array if array.length <= 1\n\n pivot = array.shift\n equal = [pivot]\n less = []\n greater = []\n\n while (array.length > 0)\n e = array.shift\n\n less << e if e < pivot\n greater << e if e > pivot\n equal << e if e == pivot\n end\n\n quicksort(less) + equal + quicksort(greater)\nend",
"def quicksort(array)\n # debugger\n return [] if array.empty?\n smaller = []\n larger = []\n array.each do |item|\n if item < array.last\n smaller << item\n elsif item > array.last\n larger << item\n end\n end\n\n quicksort(smaller) + [array.last] + quicksort(larger)\nend",
"def qsort(arr)\n\treturn arr if arr.length <= 1\n\n\tpivot = arr.first\n\n\t# split_i = index between < pivot and > pivot\n\tsplit_i = 1\n\t\n\t# Actual partitioning\n\tarr.each_with_index do |el, index|\n\t\tnext if index == 0\n\t\tif el < pivot\n\t\t\tarr[split_i], arr[index] = el, arr[split_i]\n\t\t\tsplit_i += 1\n\t\tend\n\tend\n\n\tarr[0], arr[split_i - 1] = arr[split_i - 1], arr[0]\n\n\treturn qsort(arr[0...split_i - 1]) + [pivot] + qsort(arr[split_i..-1])\nend",
"def quicksort(arr)\n\n return arr if arr.length == 1\n\n pivot_arr = arr.first\n\n first_half = arr[1..-1].select { |val| val < arr.first }\n second_half = arr[1..-1].select { |val| val >= arr.first }\n\n return quicksort(first_half) + [pivot_arr] + quicksort(second_half)\n\nend",
"def quickSort(arr,low,high)\n if low < high then\n # pi is partitioning index, arr[p] is now\n # at right place\n pivot = partition(arr,low,high)\n\n # Separately sort elements before\n # partition and after partition\n quickSort(arr, low, pivot-1)\n quickSort(arr, pivot+1, high)\n end\n return arr\n end",
"def quicksort(arr)\n return arr if arr.length <= 1\n\n pivot = arr.pop\n smaller = arr.map{|x| x if x <= pivot}.compact\n bigger = arr.map{|x| x if x > pivot}.compact\n\n return quicksort(smaller) + [pivot] + quicksort(bigger)\nend",
"def quick_sort(arr, start_index=0, end_index=nil)\n # default the end_index to the array size - 1 ==)) zero based indexing\n end_index ||= (arr.size - 1)\n # base case to stop our recursion\n return unless start_index < end_index\n pivot_index = partition(arr, start_index, end_index)\n quick_sort(arr, start_index, pivot_index - 1)\n quick_sort(arr, pivot_index + 1, end_index)\n arr\nend",
"def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend",
"def quick_sort(arr)\n \n if arr.length <= 1\n return arr\n end \n\n pivot = arr[0]\n left = []\n right = []\n\n #seperate into left and right \n arr[1..-1].each do |num|\n if num < pivot\n left.push(num)\n else\n right.push(num)\n end \n end \n\n result = quick_sort(left) + [pivot] + quick_sort(right)\n\n return result \n\nend",
"def quick_sort(arr, left = 0, right = arr.length - 1)\n if left < right\n pivot_index = pivot_helper(arr, left, right)\n\n quick_sort(arr, left, pivot_index - 1)\n quick_sort(arr, pivot_index + 1, right)\n end\n return arr\nend",
"def qqsort(arr)\n # returns array if it's empty or contains only one item\n return arr if arr.length <= 1\n\n # sets a pivot to the first element of the array\n pivot = arr.pop\n\n # defines two empty arrays to store\n # greater than and less than the pivot\n lessThan, greaterThan = [], []\n\n # push to left if i is less than pivot\n # push to right if i is greater than pivot\n # using a ternary operator\n arr.each do |i|\n i < pivot ? lessThan.push(i) : greaterThan.push(i)\n end\n\n # recursively calls quick sort on left and right arrays\n sortedLeft = qqsort(lessThan)\n sortedRight = qqsort(greaterThan)\n\n # concatenates left array, pivot, and right array \n sortedLeft + [pivot] + sortedRight\nend",
"def quick_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n part_idx = array.length / 2\n part_val = array[part_idx]\n\n left = []\n right = []\n\n array.each_with_index do |el, idx|\n next if idx == part_idx\n prc.call(el, part_val) <= 0 ? left << el : right << el\n end\n\n quick_sort(left, &prc) + [part_val] + quick_sort(right, &prc)\nend",
"def perform_quick_sort(low, high)\n return if low >= high\n pivot = @array[rand(low..high)]\n i = low\n j = high\n while (i<=j)\n i += 1 while i<=j && @array[i] < pivot\n j -= 1 while i<=j && @array[j] > pivot\n break if i>j\n swap(@array, i, j)\n i += 1\n j -= 1\n end\n perform_quick_sort(low, j) if low < j\n perform_quick_sort(i, high) if i < high\n end",
"def quicksort(array)\n return array if array.size < 2\n\n left = []\n equal = []\n right = []\n pivot = array[0]\n\n array.each do |i|\n if i < pivot\n left << i\n elsif i == pivot\n equal << i\n else\n right << i\n end\n end\n return quicksort(left) + equal + quicksort(right)\nend",
"def quicksort(arr, p, r, ord)\n\tif p < r\n\t\tq = partition(arr, p, r, ord)\n\t\tquicksort(arr, p, q - 1, ord)\n\t\tquicksort(arr, q + 1, r, ord)\n\tend\n\tarr\nend",
"def quicksort(arr)\n return arr if length < 2\n\n rand_idx = rand(arr.length)\n until rand_idx != 0\n rand_idx = rand(arr.length)\n end\n arr[0], arr[rand_idx] = arr[rand_idx], arr[0]\n\n pivot = arr.shift\n left, right = [], []\n\n arr.each do |num|\n if num < pivot\n left.push(num)\n else\n right.push(num)\n end\n end\n\n return quicksort(left) + [pivot] + quicksort(right)\nend",
"def quick_sort(&prc)\n end",
"def quick(array, low_index, high_index)\n return unless low_index < high_index\n\n # partition array\n i = (low_index - 1) # index of smallest element\n pivot = array[high_index] # pivot from highest element\n\n # go through all array elements from\n # lowest to highest index provided\n # if current value is less than pivot\n # move value to the left of pivot\n (low_index..high_index).each do |j|\n next unless array[j] < pivot\n\n i += 1 # increase index of smallest element\n\n # swap positions of elements\n array[i], array[j] = array[j], array[i]\n end\n\n partition = (i + 1)\n array[partition], array[high_index] =\n array[high_index], array[partition]\n\n # recursive sorting of split array\n quick(array, low_index, partition - 1)\n quick(array, partition + 1, high_index)\n\n array\nend",
"def quicksort arr, lo, hi\n if lo < hi\n p = partition(arr, lo, hi);\n quicksort(arr, lo, p);\n quicksort(arr, p+1, hi);\n end\n end",
"def quick_sort (arr, left, right)\n arr_index = partition(arr, left, right)\n if left < arr_index - 1 # sort left half\n quick_sort(arr, left, arr_index - 1)\n end\n\n if arr_index < right # sort right half\n quick_sort(arr, arr_index, right)\n end\n\n # if left < arr_index && arr_index < right\n # puts \"arr: #{arr}\"\n # arr\n # end\n\nend",
"def quicksort(arr, p, r)\n\tif p < r\n\t\tq = partition(arr, p, r)\n\t\tquicksort(arr,p, q - 1)\n\t\tquicksort(arr, q + 1, r)\n\tend\n\tarr\nend",
"def quick_sort(array)\n\n # base case\n if array.length <= 1\n return array\n end\n\n pivot = array.delete_at(array.length - 1) # remove the pivot\n left = []\n right = []\n\n #Loop through the array, comparing items to pivot and collecting them into left and right arrays\n # array.each do |x|\n # if x <= pivot\n # left << x\n # else\n # right << x\n # end\n # end\n\n left, right = array.partition {|num| num < pivot}\n\n # recursively call \"quicksort\" on your left and right arrays.\n sorted_array = []\n sorted_array << quick_sort(left)\n sorted_array << pivot\n sorted_array << quick_sort(right)\n\n # using Array.flatten to remove sub-arrays\n sorted_array.flatten!\nend",
"def quick_sort(s_arr, first, last)\n i = first\n j = last\n tmp = 0\n x = s_arr[first + (last - first) / 2]\n while (i <= j)\n\n while (s_arr[i].created_at > x.created_at)\n i+=1\n end\n while (s_arr[j].created_at < x.created_at)\n j-=1\n end\n\n if(i <= j)\n if (s_arr[i].created_at < s_arr[j].created_at)\n tmp = s_arr[i]\n s_arr[i] = s_arr[j]\n s_arr[j] = tmp\n end\n i+=1\n j-=1\n end\n end\n quick_sort(s_arr, i, last) if (i < last)\n quick_sort(s_arr, first, j) if (first < j)\n\n end",
"def quick_sort(array, from = 0, to = nil)\n\n #By default we start by sorting the entire\n #array.\n if to == nil\n to = array.count - 1\n end\n\n #Because this sort is in place, we don't need\n #to return anything. This is the guard check\n #for sorting being complete.\n if from >= to\n return\n end\n\n #Quick sort uses the key word 'pivot' to indicate\n #the current array element being used to compare.\n #It starts at the far left of the array.\n pivot = array[from]\n\n #Min and Max pointers to be used in algorithm\n min = from\n max = to\n\n #Free represents the current free slot in the array\n #or wall that is used to separate the sorted part\n #of the array from the unsorted part.\n free = min\n\n while min < max\n if free == min #Evaluate array[max]\n if array[max] <= pivot #Smaller than pivot must move\n array[free] = array[max]\n min += 1\n free = max\n else\n max -= 1\n end\n elsif free == max #Evaluate array[min]\n if array[min] >= pivot #Bigger than pivot must move\n array[free] = array[min]\n max -= 1\n free = min\n else\n min += 1\n end\n else\n raise \"Inconsistent State\"\n end\n end\n\n array[free] = pivot\n\n quick_sort(array, from, free - 1)\n quick_sort(array, free + 1, to)\nend",
"def my_quick_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b}\n return self if self.length <= 1\n mdix = self.length()/2\n left = []\n right = []\n # debugger\n self.each_with_index do |item, idx|\n case prc.call(item,self[mdix])\n when -1 #a smaller\n left << item\n when 0\n left << item if idx != mdix\n when 1\n right << item\n end\n end\n # debugger\n left.my_quick_sort(&prc) + [self[mdix]] + right.my_quick_sort(&prc)\n end",
"def quick_sort(array)\n return [] if array.empty?\n\n pivot = array.delete_at(0)\n # partition -> [2, 9, 7, 1, 4, 8] with pivot 6 -> [[2, 1, 4], [9, 7, 8]]\n left_array, right_array = array.partition { |element| pivot > element }\n\n quick_sort(left_array) + [pivot] + quick_sort(right_array)\n end",
"def quick_sort(low_index = @low_index, high_index = @high_index)\n if(low_index < high_index)\n pivot_position = process_pivot(low_index, high_index)\n quick_sort(low_index, pivot_position - 1)\n quick_sort(pivot_position + 1, high_index)\n end\n end",
"def alternate_quicksort(array)\n return array if array.size < 2\n\n left = []\n right = []\n\n pivot_index = array.size - 1\n pivot_value = array[pivot_index]\n\n array.pop\n\n array.each do |item|\n item < pivot_value ? left.push(item) : right.push(item)\n end\n\n quicksort(left) + [pivot_value] + quicksort(right)\nend",
"def qsort(a, lower, upper)\r\n if lower < upper\r\n mid = partition(a, lower, upper)\r\n qsort(a, lower, mid)\r\n qsort(a, mid+1, upper)\r\n end\r\n return a\r\nend",
"def quicksort_r(arr)\n\treturn arr if arr.size <= 1\n\tpivot = arr.shift\n\tleft, right = arr.partition{|el| el <= pivot}\n\tquicksort_r(left) + [pivot] + quicksort_r(right)\nend",
"def quick_sort(arr, s, e)\n return if s >= e\n pIndex = partition(arr, s, e)\n quick_sort(arr,s,pIndex-1)\n quick_sort(arr,pIndex+1, e)\nend",
"def quick_sort(lst)\n return lst if lst.length <= 1\n pivot = lst.shuffle.shift\n left, right = lst.partition {|val| val < pivot}\n quick_sort(left) + quick_sort(right)\nend",
"def quick_sort(array)\n return array if array.length <= 1\n pivot = array.delete_at(rand(array.length)) \n # Pick a pivot at random. Ruby’s delete_at method will delete the item at \n # the specified index, which in this case would be a rand index in the range of array.length. \n # We’re saving the value of that item to pivot.\n \n left = Array.new # Create a new left and right subarray.\n right = Array.new\n \n array.each do |x| \n # Loop through every element in the array and compare it to the pivot. If the value is less than pivot, \n # add element to the left subarray. If value is greater than pivot, add element to the right subarray.\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n \n return *quick_sort(left), pivot ,*quick_sort(right) \n # After the first pass when every value less than the pivot is on \n # the left hand side and every value greater than the pivot is on the right hand side, we break into two subarrays \n # and apply quick sort to each half (pick a new pivot, compare elements, break into two subarrays).\n \n end",
"def quicksort array\n len = array.length \n #base case\n return array if len <= 1\n\n $numOfcomparisons += len - 1 \n\n #set pivot value to last element and move it to first element in the array\n pivot, array[len-1], array[0] = array[len-1], array[0], pivot\n #initialize counters\n # i = boundary in array for which all elements are less then pivot\n # j = boundary in array for which all elements are greater than pivot\n i, j = 1, 1\n\n #partition the array according to the definitions of i and j\n (len-1).times do\n if array[j] < pivot\n# array[j], array[i] = array[j], array[i]\n temp = array[j]\n array[j] = array[i]\n array[i] = temp\n i += 1\n end\n j += 1\n end\n \n #insert pivot into sorted position before recursing\n array[0], array[i-1] = array[i-1], pivot\n \n #recurse on the array around the pivot\n return (quicksort(array[0,i-1]) << pivot << quicksort(array[i,len]))\nend",
"def my_quick_sort(&prc)\n end",
"def fast_sort(array, left_index, right_index)\n if left_index < right_index\n key = array[left_index]\n key_index = left_index\n (left_index + 1..right_index).each do |index|\n if array[index] < key\n temp = array[index]\n array.delete_at(index)\n array.insert(key_index, temp)\n key_index += 1\n end\n end\n fast_sort(array, left_index, key_index-1)\n fast_sort(array, key_index + 1, right_index)\n end\nend",
"def quicksort(list, left, right)\n # Checks if the left array item is bigger than the right array item\n if left < right\n # Sends the items for inspection and splitting them up in 2 arrays\n switch = partition(list, left, right)\n # Recursive function to make sure it does all the elements\n quicksort(list, left, switch-1)\n quicksort(list, switch+1, right)\n end\nend",
"def my_quick_sort(&prc)\n\n end",
"def sort(arr)\n return arr if arr.length < 1\n\n pivot = arr.pop\n less = arr.select { |item| item < pivot}\n more = arr.select { |item| item >= pivot}\n\n sort(less) + [pivot] + sort(more)\nend",
"def quick_sort(list)\n sl = list.clone\n return sl if sl.size <= 1\n pivot = sl.pop\n left, right = sl.partition { |e| e < pivot }\n quick_sort(left) + [pivot] + quick_sort(right)\nend",
"def quick_sort_non_ip(array) #takes an array of integers as an argument\n if array.length <= 1\n return array\n else\n pivot = array.sample\n array.delete_at(array.index(pivot)) # remove the pivot\n #puts \"Picked pivot of: #{pivot}\"\n less = []\n greater = []\n\n array.each do |x|\n if x <= pivot\n less << x\n else\n greater << x\n end\n end\n\n sorted_array = []\n sorted_array << quick_sort_non_ip(less)\n sorted_array << pivot\n sorted_array << quick_sort_non_ip(greater)\n\n # using Array.flatten to remove subarrays\n sorted_array.flatten!\n end\nend",
"def quicksort(a)\n\n\tdo_quick_sort(a, 0, a.length-1)\n\tputs a.to_s\nend",
"def quicksort(a)\n return a if a.length <= 1\n pivot = a.delete_at(rand(a.length))\n l, g, sorted_a = [], [], []\n a.each { |el| el <= pivot ? l << el : g << el }\n sorted_a << quicksort(l) << pivot << quicksort(g)\nend",
"def quicksort!(left_index, right_index)\r\n # Base case: the subarray has 0 or 1 elements:\r\n if right_index - left_index <= 0\r\n return\r\n end\r\n\r\n # Partition the range of elements and grab the index of the pivot:\r\n pivot_index = partition!(left_index, right_index)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the left of the pivot:\r\n quicksort!(left_index, pivot_index - 1)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the right of the pivot:\r\n quicksort!(pivot_index + 1, right_index)\r\nend",
"def quickSort(arr,from,to)\n return if from >= to \n pivot = arr[from]\n i = from\n for j in (1+from)..to\n if arr[j] < pivot\n i = i + 1\n temp = arr[i]\n arr[i] = arr[j]\n arr[j] = temp\n end \n end\n quickSort(arr,from,i-1);\n quickSort(arr,i+1,to);\nend",
"def sort arr \n\trec_sort arr, []\nend",
"def bigSorting(unsorted)\n\nend",
"def sort\n limit = array.size - 1\n (0..limit).each do |index|\n min = index\n (index..limit).each do |target|\n min = target if array[min] > array[target]\n end\n array[index], array[min] = array[min], array[index]\n end\n array\n end",
"def quicksort(xs, &prc)\n return [] unless xs\n\n pivot = MaglevUndefined\n xs.each { |o| pivot = o; break }\n return xs if pivot._equal?( MaglevUndefined)\n\n lmr = xs.group_by do |o|\n if o._equal?(pivot)\n 0\n else\n yield(o, pivot)\n end\n end\n quicksort(lmr[-1], &prc) + lmr[0] + quicksort(lmr[1], &prc)\n end",
"def using_sort(array)\narray.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def my_quick_sort(&prc)\n return self if length <=1\n\n prc ||= Proc.new {|a,b| a <=> b}\n\n pivot = shift\n left = my_select {|el| prc.call(el, pivot) < 0}\n right = my_select {|el| prc.call(el, pivot) >= 0}\n\n left.my_quick_sort(&prc) + [pivot] + right.my_quick_sort(&prc)\n end",
"def simple_quicksort(array)\n left = []\n right = []\n pivot = [array.first]\n\n return [] if array.empty?\n\n quick_sort_partition(array, left, right)\n return pivot if (left + right).empty?\n\n result = simple_quicksort(left) + pivot + simple_quicksort(right)\n puts result.join(' ') unless result.empty?\n result\nend",
"def sort arr\r\n\trec_sort arr, []\r\nend",
"def do_qsort(ary, left = 0, right = ary.length - 1, min_size)\n\n return ary if right <= left\n\n tmp_pi = select_pivot_index(ary, left, right)\n pivot_i = partition(ary, left, right, tmp_pi)\n\n if (pivot_i - 1 - left) <= min_size\n insertion(ary, left, pivot_i - 1)\n else\n do_qsort(ary, left, pivot_i -1 )\n end\n\n if (right - pivot_i - 1) <= min_size\n insertion(ary, pivot_i + 1, right)\n else\n do_qsort(ary, pivot_i + 1, right)\n end\n end",
"def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend",
"def poorly_written_ruby(*arrays)\n combined_array = []\n\n arrays.each do |array|\n combined_array.concat(array)\n end\n \n def quick_sort(collection)\n return collection if collection.length <= 1\n pivot = collection.sample\n\n left = Array.new\n right = Array.new\n\n collection.each do |x|\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n\n quick_sort(left) + quick_sort(right)\n\n end\n\n def buckethash_sort(collection)\n\n buckets = Hash.new\n\n (\"A\"..\"Z\").each do |x|\n buckets[x] = Array.new\n end\n\n collection.each do |x|\n if buckets.key?(x[0])\n buckets[x[0]] << x\n end\n end\n\n buckets.each_key do |key|\n buckets[key] = quick_sort(buckets[key])\n end\n\n buckets.values.flatten\n\n end\n\n buckethash_sort(combined_array)\n\nend",
"def partial_quick_sort(arr, i, j, k)\n if i < j\n index_pivot = rand(i..j)\n pivot = arr[index_pivot]\n arr.delete_at(index_pivot)\n left, right = arr[i..j].partition { |e| e.size > pivot.size }\n arr[i..j] = left + [pivot] + right\n index = left.size + i\n partial_quick_sort(arr, i, index - 1, k)\n partial_quick_sort(arr, index + 1, j, k) if index < k - 1\n end\nend",
"def quicksort(to_sort, left_bound = 0, right_bound = to_sort.length - 1)\n\treturn to_sort if right_bound - left_bound < 1\n\t# Choose a random pivot between left_bound and right_bound and set pivot\n\tpivot_idx = choose_pivot_idx(left_bound, right_bound)\n\tpivot = to_sort[pivot_idx]\n\n\t# Swap pivot with lower bound of array (first element of subarray to sort)\n\tto_sort[left_bound], to_sort[pivot_idx] = to_sort[pivot_idx], to_sort[left_bound]\n\n\t# i is the index of the split between < pivot and > pivot\n\ti = left_bound + 1\n\n\t(left_bound + 1).upto(right_bound) do |idx|\n\t\tif to_sort[idx] < pivot\n\t\t\t# Swap the last element that is < pivot with to_sort[idx]\n\t\t\tto_sort[i], to_sort[idx] = to_sort[idx], to_sort[i]\n\t\t\ti += 1\n\t\tend\n\tend\n\n\t# Put the pivot in its correct place by swapping\n\tto_sort[left_bound], to_sort[i - 1] = to_sort[i - 1], to_sort[left_bound]\n\n\tquicksort(to_sort, i, right_bound)\n\tquicksort(to_sort, left_bound, i - 2)\n\n\treturn to_sort\nend",
"def using_sort(array)\n array.sort\nend",
"def using_sort(array)\n array.sort\nend",
"def using_sort(array)\n array.sort\nend",
"def quickSort(array, k, r)\n if k < r\n pivot = partition(array, k, r)\n quickSort(array, k, pivot - 1)\n quickSort(array, pivot + 1, r)\n end\nend",
"def improved_poorly_written_ruby(*arrays)\n sorted = []\n arrays.flatten.each do |v|\n size = sorted.size\n if sorted.empty?\n sorted.push(v)\n else\n i = 0\n while i < size\n item = sorted[i]\n if item > v\n sorted.insert(i, v)\n break\n elsif i == size - 1\n sorted.push(v)\n break\n end\n i += 1\n end\n end\n end\n sorted\nend",
"def sort(array)\n return array if array.length <= 1\n less, more = [], []\n # first element as pivot value\n pivot = array.delete_at(0)\n\n array.each { |el| el < pivot ? less << el : more << el}\n\n sort(less) + [pivot] + sort(more)\n end",
"def sort2(num_array)\n return num_array if num_array.empty?\n pivot = num_array.pop\n left = []\n right = []\n\n num_array.each do |x|\n if x < pivot\n left << x\n else\n right << x\n end\n end\n return (sort(left) << pivot << sort(right)).flatten\nend",
"def using_sort(array)\n sorted_array=array.sort\nend",
"def quicksort(list)\n bottom, top = [], []\n top[0] = 0\n bottom[0] = list.size\n i = 0\n while i >= 0 do\n l = top[i]\n r = bottom[i] - 1;\n if l < r\n pivot = list[l]\n while l < r do\n r -= 1 while (list[r] >= pivot && l < r)\n if (l < r)\n list[l] = list[r]\n l += 1\n end\n l += 1 while (list[l] <= pivot && l < r)\n if (l < r)\n list[r] = list[l]\n r -= 1\n end\n end\n list[l] = pivot\n top[i+1] = l + 1\n bottom[i+1] = bottom[i]\n bottom[i] = l\n i += 1\n else\n i -= 1\n end\n end\n list \nend",
"def mysort(arr)\n # The computational complexity of this algorithm is O(n^^2), and is similar\n # to selection sort. This is not idiomatically ideal Ruby - I've tried to\n # mostly use language constructs common to many languages.\n\n sorted = []\n\n smallest_index = 0\n while (arr.length > 0) do\n for i in (0..(arr.length - 1))\n if arr[i] < arr[smallest_index]\n smallest_index = i\n end\n end\n sorted.push arr.delete_at(smallest_index) \n smallest_index = 0\n end\n\n return sorted \n\nend",
"def quicksort_pivot\n (self[0] + self[-1] + self.sample)/3.0\n end",
"def dual_pivot_quicksort(arr)\n return [] if arr.empty?\n return arr if arr.size == 1\n\n # this check is necessary if the left pivot is larger than the right pivot\n arr[0], arr[-1] = arr[-1], arr[0] if arr[0] > arr[-1]\n\n l_pivot = arr.shift\n r_pivot = arr.pop\n left, mid, right = Array.new(3) { [] }\n\n # partitions the array\n arr.each do |num|\n left << num if num <= l_pivot\n mid << num if num > l_pivot && num < r_pivot\n right << num if num >= r_pivot\n end\n\n [*dual_pivot_quicksort(left), l_pivot,\n *dual_pivot_quicksort(mid), r_pivot,\n *dual_pivot_quicksort(right)]\nend",
"def quick_sort(a, l, r)\n return a if l >= r\n\n p_index = choose_pivot(0, a, l, r)\n\n# swap pivot with the first element\n\n p_index = partition(a, p_index, l ,r)\n\n quick_sort(a, l, (p_index - 1))\n quick_sort(a, (p_index + 1), r)\n end",
"def sort arr\n rec_sort arr, []\nend",
"def sort arr\r\n\treturn arr if arr.length <= 1\r\n\r\n\tmiddle = arr.pop\r\n\tless = arr.select{|x| x < middle}\r\n\tmore = arr.select{|x| x >= middle}\r\n\r\n\tsort(less) + [middle] + sort(more)\r\nend",
"def sorted_arr_sort(*arrs)\n h = Heap.new {|a, b| a[:val] <=> b[:val]}\n count = 0\n res = [] \n\n arrs.each_with_index do |arr, idx|\n count += arr.length\n h.insert({val: arr.shift, idx: idx}) unless arr.empty?\n end\n \n until res.length == count \n min_left = h.remove\n res << min_left[:val]\n h.insert({ val: arrs[min_left[:idx]].shift, idx: min_left[:idx] }) if arrs[min_left[:idx]].length > 0\n end \n\n res\nend",
"def quickSort(ia)\n quickSortHelper(ia, 0, ia.length-1) #sort the whole thing\nend",
"def quicksort(xs, &prc)\n return [] unless xs\n\n pivot = Undefined\n xs.each { |o| pivot = o; break }\n return xs if pivot.equal? Undefined\n\n lmr = Hash.new { |hash, key|\n # if ever the result of the block is not simply -1, 0 or 1, compare it with 0\n cmp = (key <=> 0) || raise(ArgumentError, \"Comparison of #{key.class} with 0 failed.\")\n hash.fetch(cmp, [])\n }.merge(-1 => [], 0 => [], 1 => [])\n xs.each do |o|\n comparison = if o.equal?(pivot)\n 0\n else\n yield(o, pivot)\n end\n lmr[comparison] << o\n end\n\n quicksort(lmr[-1], &prc) + lmr[0] + quicksort(lmr[1], &prc)\n end",
"def sort1(array)\n\nend",
"def quicksort(list) \n aid = list.dup\n quicksort!(aid)\n return aid\n end"
] | [
"0.83448756",
"0.7830855",
"0.78072894",
"0.77814233",
"0.77813566",
"0.7762061",
"0.7749257",
"0.7737508",
"0.77335906",
"0.77187526",
"0.7673464",
"0.7667501",
"0.7650058",
"0.7632176",
"0.7603435",
"0.7585873",
"0.7570686",
"0.7564733",
"0.7559527",
"0.7536383",
"0.7533662",
"0.7519985",
"0.7519755",
"0.74778414",
"0.7468497",
"0.74680084",
"0.7462069",
"0.7444237",
"0.7416344",
"0.7410678",
"0.7400187",
"0.73871547",
"0.73849136",
"0.7381987",
"0.73772484",
"0.73678815",
"0.7365206",
"0.7357889",
"0.7355558",
"0.7354986",
"0.7351842",
"0.73164046",
"0.73127276",
"0.7288543",
"0.72851974",
"0.72836155",
"0.72790295",
"0.72738385",
"0.7267302",
"0.7251401",
"0.7238635",
"0.72207266",
"0.7205254",
"0.72034127",
"0.7196144",
"0.7178931",
"0.71639043",
"0.7159168",
"0.7121195",
"0.71210766",
"0.71149474",
"0.70689934",
"0.70358986",
"0.70148486",
"0.7013955",
"0.69775265",
"0.696359",
"0.695907",
"0.6953711",
"0.69482344",
"0.6943927",
"0.6943927",
"0.693072",
"0.6921533",
"0.6916257",
"0.68773514",
"0.68734926",
"0.6869802",
"0.6861252",
"0.68224585",
"0.6819813",
"0.6819813",
"0.6819813",
"0.68163896",
"0.68094814",
"0.6785276",
"0.6768939",
"0.6763894",
"0.67633635",
"0.67628974",
"0.6757944",
"0.67544687",
"0.6752471",
"0.67402154",
"0.67395616",
"0.6729338",
"0.6717563",
"0.67056555",
"0.66752297",
"0.66671664"
] | 0.75749403 | 16 |
GET /brevis GET /brevis.json | def index
@brevi = Brevi.new
@brevis = Brevi.limit(100).order(clicks: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def show\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registro_bovino }\n end\n end",
"def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end",
"def show\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brag }\n end\n end",
"def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def show\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vrabat }\n end\n end",
"def show\n render json: @bike_type\n end",
"def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end",
"def show\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilhete }\n end\n end",
"def show\n @bergain = Bergain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bergain }\n end\n end",
"def show\n @bergain = Bergain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bergain }\n end\n end",
"def show\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @borad }\n end\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @belief }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def index\n @birds = Bird.where(visible: true)\n render json: @birds, status: 200\n end",
"def show\n @b = B.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b }\n end\n end",
"def show\n render json: @lob\n end",
"def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def show\n @vnic = Vnic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vnic }\n end\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end",
"def show\n @nabe = Nabe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nabe }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def show\n @breed = Breed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @breed }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def show\n render json: @banner\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end",
"def show\n @brain = Brain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brain }\n end\n end",
"def show\n @begivenhed = Begivenhed.find(params[:id])\n @bruger = Bruger.find_by_id(current_user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @begivenhed }\n end\n end",
"def index\n @my_visas = MyVisa.all\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def show\n @bruschettum = Bruschettum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bruschettum }\n end\n end",
"def show\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bl }\n end\n end",
"def show\n if @bird\n respond_to do |format|\n format.json { render json: {required: @bird, properties: @bird.properties, families: @bird.families, title: \"POST /birds [request]\", description: \"Get bird by id\",:status => OK }}\n end\n else\n respond_to do |format|\n format.json { render json: {:status => NOT_FOUND} }\n end\n end\n end",
"def show\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end",
"def show\n @borc = Borc.where(:UyeId => current_user.uid).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borc }\n end\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n @climb_datum = ClimbDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb_datum }\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def show\n @banda = Banda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banda }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def show\n\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @renglon_recdetalle }\n end\n end",
"def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end",
"def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end",
"def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def index\n begin\n # Beers of current user\n beers = @current_user.beers\n\n #Filter by name\n if params[:name].present?\n beers = beers.where(name: params[:name])\n end\n\n #Filter by abv\n if params[:abv].present?\n beers = beers.where(abv: params[:abv])\n end\n render json: BeerSerializer.new(beers).collection_attr_array\n rescue StandardError => e\n message = e.message\n end\n end",
"def show\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bahan }\n end\n end",
"def index \n ip_addr = request.env['REMOTE_ADDR'] \n @browse_by = [[\"Browse By\",''],[\"Guides\",'1'],[\"Places\",'2']]\n @characteristics = [\"Latest\",'1'],[\"Most Popular\",'2'],[\"Highest Rated\",'3'],[\"Stress Factor\",'4']\n @notice = notice\n @guides = Guide.where(\"publish=?\",true).order(\"CREATED_AT DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end",
"def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end",
"def show\n @rebate = Rebate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rebate }\n end\n end",
"def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end",
"def show\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brochure }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def show\n @compte_bancaire = CompteBancaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@compte_bancaire }\n end\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def show\n render json: @bid\n end",
"def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill_cargo }\n end\n end",
"def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end",
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def show\n render json: @hero\n end"
] | [
"0.6640117",
"0.65098894",
"0.64953256",
"0.6468548",
"0.6444701",
"0.6413933",
"0.6412369",
"0.6403215",
"0.63330984",
"0.63242215",
"0.6321689",
"0.6319305",
"0.63037753",
"0.62918055",
"0.62918055",
"0.6269501",
"0.62681985",
"0.6258365",
"0.6253375",
"0.6251128",
"0.6250786",
"0.62369955",
"0.6235495",
"0.62286216",
"0.622318",
"0.6218785",
"0.62074745",
"0.61906004",
"0.61891806",
"0.6183642",
"0.6175273",
"0.6173737",
"0.61677366",
"0.6165996",
"0.6163731",
"0.61584914",
"0.6151607",
"0.614948",
"0.61486745",
"0.61481047",
"0.6146962",
"0.61335",
"0.6132971",
"0.61327606",
"0.6132446",
"0.6131534",
"0.612426",
"0.61212933",
"0.6118899",
"0.6113348",
"0.6112093",
"0.61052865",
"0.61038136",
"0.61014766",
"0.6099851",
"0.6094445",
"0.6087807",
"0.6085731",
"0.60827476",
"0.60421634",
"0.6040242",
"0.60395074",
"0.60345423",
"0.6033249",
"0.6031013",
"0.603055",
"0.6028597",
"0.60213333",
"0.60190445",
"0.6008459",
"0.60079455",
"0.60068244",
"0.6006589",
"0.59952307",
"0.59924585",
"0.59921825",
"0.59919685",
"0.59906656",
"0.59740615",
"0.5970717",
"0.5970469",
"0.5959895",
"0.5956879",
"0.5956081",
"0.5954336",
"0.5952053",
"0.594932",
"0.59421927",
"0.5938537",
"0.5934489",
"0.5934483",
"0.59333926",
"0.59325117",
"0.5927359",
"0.5925167",
"0.59148866",
"0.5913411",
"0.59120953",
"0.59119856",
"0.5908438",
"0.5907476"
] | 0.0 | -1 |
GET /brevis/1 GET /brevis/1.json | def show
@brevi = Brevi.find_by_slug params[:slug]
if @brevi
@brevi.increment! :clicks
redirect_to @brevi.original_url
else
redirect_to brevis_url, notice: 'There was an error redirecting.'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def show\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brag }\n end\n end",
"def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end",
"def show\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registro_bovino }\n end\n end",
"def show\n @b = B.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b }\n end\n end",
"def show\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilhete }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def show\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vrabat }\n end\n end",
"def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end",
"def show\n render json: @bike_type\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def show\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @borad }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def show\n @bergain = Bergain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bergain }\n end\n end",
"def show\n @bergain = Bergain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bergain }\n end\n end",
"def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end",
"def show\n @bruschettum = Bruschettum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bruschettum }\n end\n end",
"def show\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bl }\n end\n end",
"def show\n @brain = Brain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brain }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n render json: @lob\n end",
"def show\n if @bird\n respond_to do |format|\n format.json { render json: {required: @bird, properties: @bird.properties, families: @bird.families, title: \"POST /birds [request]\", description: \"Get bird by id\",:status => OK }}\n end\n else\n respond_to do |format|\n format.json { render json: {:status => NOT_FOUND} }\n end\n end\n end",
"def show\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @belief }\n end\n end",
"def show\n @basis = Base.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basis }\n end\n end",
"def show\n @climb_datum = ClimbDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb_datum }\n end\n end",
"def index\n @birds = Bird.where(visible: true)\n render json: @birds, status: 200\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def show\n @breed = Breed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @breed }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end",
"def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end",
"def show\n @borc = Borc.where(:UyeId => current_user.uid).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borc }\n end\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end",
"def show\n @vnic = Vnic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vnic }\n end\n end",
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end",
"def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end",
"def show\n @banda = Banda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banda }\n end\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n @begivenhed = Begivenhed.find(params[:id])\n @bruger = Bruger.find_by_id(current_user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @begivenhed }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def show\n\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @renglon_recdetalle }\n end\n end",
"def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end",
"def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end",
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def show\n @nabe = Nabe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nabe }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end",
"def show\n @bagtype = Bagtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bagtype }\n end\n end",
"def show\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bwimage }\n end\n end",
"def show\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brochure }\n end\n end",
"def show\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bahan }\n end\n end",
"def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end",
"def show\n render json: @banner\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @scribble }\n end\n end",
"def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end",
"def show\n @rebate = Rebate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rebate }\n end\n end",
"def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end",
"def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end",
"def show\n add_breadcrumb :details\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visit }\n end\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def index\n @bourbons = Bourbon.all\n\n @bourbons.each do |bourbon|\n bourbon.find_similar\n end\n\n respond_to do |format|\n format.html \n format.json { render json: @bourbons, :include => [:ratings, :similar], :methods => [:similar_id, :similarity, :all_similar] }\n end\n end",
"def show\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kb }\n end\n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrio }\n end\n end",
"def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end"
] | [
"0.6656918",
"0.65922934",
"0.6580305",
"0.6530296",
"0.649651",
"0.6450551",
"0.64009273",
"0.6374918",
"0.63541543",
"0.633254",
"0.633223",
"0.63307136",
"0.6313404",
"0.630367",
"0.63033855",
"0.62830514",
"0.6281329",
"0.6280386",
"0.627854",
"0.6275999",
"0.62746304",
"0.6271773",
"0.6265388",
"0.62546915",
"0.6254516",
"0.6254516",
"0.62521666",
"0.6245476",
"0.6244254",
"0.6231792",
"0.62207425",
"0.62055695",
"0.61936843",
"0.6193605",
"0.61765957",
"0.61710036",
"0.6167866",
"0.61640036",
"0.6160342",
"0.61592203",
"0.6158623",
"0.61569893",
"0.6150971",
"0.61474955",
"0.6144429",
"0.6141105",
"0.61394984",
"0.613166",
"0.61275786",
"0.61267316",
"0.6125329",
"0.61252195",
"0.61135256",
"0.61055446",
"0.6100807",
"0.6077873",
"0.60747284",
"0.60491306",
"0.6038579",
"0.6030898",
"0.6028934",
"0.60224265",
"0.6019051",
"0.6014063",
"0.6008071",
"0.6001705",
"0.59972894",
"0.5996102",
"0.5992918",
"0.5991247",
"0.59867644",
"0.5981331",
"0.59796494",
"0.5976889",
"0.5975965",
"0.5969066",
"0.59608084",
"0.5957838",
"0.5956742",
"0.5955657",
"0.5954438",
"0.5953542",
"0.5944265",
"0.5943622",
"0.5940281",
"0.5939137",
"0.5937655",
"0.5936941",
"0.5935929",
"0.5935734",
"0.59339267",
"0.5926777",
"0.5921826",
"0.5919722",
"0.5919049",
"0.5918179",
"0.5911053",
"0.59100825",
"0.59057456",
"0.5904556",
"0.59025836"
] | 0.0 | -1 |
POST /brevis POST /brevis.json | def create
@brevi = Brevi.new(brevi_params)
respond_to do |format|
if @brevi.save
format.html { redirect_to brevis_url, notice: "Your short link is <a href='#{root_url}#{@brevi.slug}'>#{root_url}#{@brevi.slug}</a>"}
else
format.html { render :new }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @my_visa = MyVisa.new(my_visa_params)\n\n respond_to do |format|\n if @my_visa.save\n format.html { redirect_to @my_visa, notice: 'My visa was successfully created.' }\n format.json { render :show, status: :created, location: @my_visa }\n else\n format.html { render :new }\n format.json { render json: @my_visa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visiter = Visiter.new(visiter_params)\n\n respond_to do |format|\n if @visiter.save\n format.html { redirect_to @visiter, notice: 'Visiter was successfully created.' }\n format.json { render :show, status: :created, location: @visiter }\n else\n format.html { render :new }\n format.json { render json: @visiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brend = Brend.new(params[:brend])\n\n respond_to do |format|\n if @brend.save\n format.html { redirect_to @brend, notice: 'Brend was successfully created.' }\n format.json { render json: @brend, status: :created, location: @brend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@visa = Visa.new(visa_params)\n\n\t\trespond_to do |format|\n\t\t\tif @visa.save\n\t\t\t\tformat.html { redirect_to @visa, notice: 'Visa was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @visa }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @visa.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @bienvenido = Bienvenido.new(bienvenido_params)\n\n respond_to do |format|\n if @bienvenido.save\n format.html { redirect_to @bienvenido, notice: 'Bienvenido was successfully created.' }\n format.json { render :show, status: :created, location: @bienvenido }\n else\n format.html { render :new }\n format.json { render json: @bienvenido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bloque = Bloque.new(params[:bloque])\n\n if @bloque.save\n render json: @bloque, status: :created, location: @bloque\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n @razdel = Razdel.new(razdel_params)\n\n respond_to do |format|\n if @razdel.save\n format.html { redirect_to @razdel, notice: 'Razdel was successfully created.' }\n format.json { render :show, status: :created, location: @razdel }\n else\n format.html { render :new }\n format.json { render json: @razdel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @basin = Basin.new(params[:basin])\n\n respond_to do |format|\n if @basin.save\n format.html { redirect_to @basin, notice: 'Basin was successfully created.' }\n format.json { render json: @basin, status: :created, location: @basin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my_visa_params\n params.require(:my_visa).permit(:title, :body)\n end",
"def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n actualizar\n format.html { redirect_to @bodega, notice: 'Bodega fue creada exitosamente' }\n format.json { render :show, status: :created, location: @bodega }\n else\n format.html { render :new }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n format.html { redirect_to @bodega, notice: 'Se creo correctamemte la Bodega.' }\n format.json { render action: 'show', status: :created, location: @bodega }\n else\n format.html { render action: 'new' }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bonificacion = Bonificacion.new(bonificacion_params)\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to @bonificacion, notice: 'Bonificacion was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacion }\n else\n format.html { render :new }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bonificacion = Bonificacion.new(bonificacion_params)\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to @bonificacion, notice: 'Bonificacion was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacion }\n else\n format.html { render :new }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breed = Breed.new(breed_params)\n @user = User.find(params[:user_id])\n @breed.user_id = @user.id\n# puts @breed\nlogger.info(@breed)\n\n if @breed.save!\n render json: @breed, status: :created\n else\n render json: @breed.errors, status: :unprocessable_entity\n end\n # render json: {breed: :breed_params}\n end",
"def create\n @baton = Baton.new(params[:baton])\n\n respond_to do |format|\n if @baton.save\n format.html { redirect_to @baton, notice: 'Baton was successfully created.' }\n format.json { render json: @baton, status: :created, location: @baton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(bin_params)\n @rest.post('save', bin_params)\n end",
"def create\n @brodo = Brodo.new(brodo_params)\n\n respond_to do |format|\n if @brodo.save\n format.html { redirect_to @brodo, notice: 'Brodo was successfully created.' }\n format.json { render :show, status: :created, location: @brodo }\n else\n format.html { render :new }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bacterium = Bacterium.new(bacterium_params)\n\n respond_to do |format|\n if @bacterium.save\n format.html { redirect_to @bacterium, notice: 'Bacteria creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @bacterium }\n else\n format.html { render :new }\n format.json { render json: @bacterium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brag = Brag.new(params[:brag])\n\n respond_to do |format|\n if @brag.save\n format.html { redirect_to @brag, notice: 'Brag was successfully created.' }\n format.json { render json: @brag, status: :created, location: @brag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @brend = Brend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brend }\n end\n end",
"def create\n @bonificacion = Bonificacion.new(bonificacion_params)\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to @bonificacion, notice: 'Bonificación fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @bonificacion }\n else\n format.html { render :new }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @verbo = Verbo.new(params[:verbo])\n\n respond_to do |format|\n if @verbo.save\n format.html { redirect_to @verbo, notice: 'Verbo was successfully created.' }\n format.json { render json: @verbo, status: :created, location: @verbo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verbo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vrabat = Vrabat.new(params[:vrabat])\n\n respond_to do |format|\n if @vrabat.save\n format.html { redirect_to @vrabat, notice: 'Vrabat was successfully created.' }\n format.json { render json: @vrabat, status: :created, location: @vrabat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vrabat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bien = Bien.new(bien_params)\n\n respond_to do |format|\n if @bien.save\n format.html { redirect_to @bien, notice: 'Bien was successfully created.' }\n format.json { render :show, status: :created, location: @bien }\n else\n format.html { render :new }\n format.json { render json: @bien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @registro_bovino = RegistroBovino.new(params[:registro_bovino])\n\n respond_to do |format|\n if @registro_bovino.save\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully created.' }\n format.html { redirect_to action: \"index\" }\n format.json { render json: @registro_bovino, status: :created, location: @registro_bovino }\n else\n format.html { render action: \"new\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end \n end\n end",
"def create\n @bordado = Bordado.new(params[:bordado])\n\n respond_to do |format|\n if @bordado.save\n format.html { redirect_to @bordado, notice: 'Bordado was successfully created.' }\n format.json { render json: @bordado, status: :created, location: @bordado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bordado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bonificacionfact = Bonificacionfact.new(bonificacionfact_params)\n\n respond_to do |format|\n if @bonificacionfact.save\n format.html { redirect_to @bonificacionfact, notice: 'Bonificacionfact was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacionfact }\n else\n format.html { render :new }\n format.json { render json: @bonificacionfact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bourbon = Bourbon.new(bourbon_params)\n\n respond_to do |format|\n if @bourbon.save\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bourbon }\n else\n format.html { render action: 'new' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boc = Boc.new(boc_params)\n\n respond_to do |format|\n if @boc.save\n format.html { redirect_to new_boc_path, notice: 'Boc was successfully created.' }\n format.json { render :show, status: :created, location: @boc }\n else\n format.html { render :new }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.new(params[:status_del_tramite_de_beca])\n\n respond_to do |format|\n if @status_del_tramite_de_beca.save\n format.html { redirect_to @status_del_tramite_de_beca, notice: 'Status del tramite de beca was successfully created.' }\n format.json { render json: @status_del_tramite_de_beca, status: :created, location: @status_del_tramite_de_beca }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_del_tramite_de_beca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bnpb = Bnpb.new(bnpb_params)\n\n respond_to do |format|\n if @bnpb.save\n format.html { redirect_to @bnpb, notice: 'Bnpb was successfully created.' }\n format.json { render :show, status: :created, location: @bnpb }\n else\n format.html { render :new }\n format.json { render json: @bnpb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vitabus = Vitabu.new(vitabus_params)\n\n respond_to do |format|\n if @vitabus.save\n format.html { redirect_to @vitabus, notice: 'Vitabu was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vitabus }\n else\n format.html { render action: 'new' }\n format.json { render json: @vitabus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @borad = Borad.new(params[:borad])\n\n respond_to do |format|\n if @borad.save\n format.html { redirect_to @borad, :notice => 'Borad was successfully created.' }\n format.json { render :json => @borad, :status => :created, :location => @borad }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @borad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n @ba = Ba.new(ba_params)\n respond_to do |format|\n if @ba.save\n format.html { redirect_to :back, notice: 'ベストアンサーを選択しました' }\n format.json { render :show, status: :created, location: @ba }\n else\n format.html { render :new }\n format.json { render json: @ba.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n # raise = true //เผื่ออยากเอาไว้ลองใช้\n @betum = Betum.new(betum_params)\n\n respond_to do |format|\n if @betum.save\n format.html { redirect_to @betum, notice: 'Betum was successfully created.' }\n format.json { render :show, status: :created, location: @betum }\n else\n format.html { render :new }\n format.json { render json: @betum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def visa_params\n\t\tparams.require(:visa).permit(:passport, :due, :remark)\n\tend",
"def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def CreateView params = {}\n \n APICall(path: 'views.json',method: 'POST',payload: params.to_json)\n \n end",
"def POST; end",
"def create\n @nnb = Nnb.new(nnb_params)\n respond_to do |format|\n if @nnb.save\n format.html { redirect_to @nnb, notice: 'Nnb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nnb }\n else\n format.html { render action: 'new' }\n format.json { render json: @nnb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ballot_nominee = BallotNominee.new(ballot_nominee_params)\n\n respond_to do |format|\n if @ballot_nominee.save\n format.html { redirect_to @ballot_nominee, notice: 'Ballot nominee was successfully created.' }\n format.json { render :show, status: :created, location: @ballot_nominee }\n else\n format.html { render :new }\n format.json { render json: @ballot_nominee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.create(params[:renglon_recdetalle])\n\n respond_to do |format|\n if @renglon_recdetalle.save\n format.html { redirect_to @recibo, notice: 'Renglon recdetalle was successfully created.' }\n format.json { render json: @renglon_recdetalle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @renglon_recdetalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bico = Bico.new(params[:bico])\n\n respond_to do |format|\n if @bico.save\n format.html { redirect_to @bico, notice: 'Bico was successfully created.' }\n format.json { render json: @bico, status: :created, location: @bico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bones_segment = BonesSegment.new(bones_segment_params)\n\n respond_to do |format|\n if @bones_segment.save\n format.html { redirect_to @bones_segment, notice: 'Bones segment was successfully created.' }\n format.json { render :show, status: :created, location: @bones_segment }\n else\n format.html { render :new }\n format.json { render json: @bones_segment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bike = Bike.new(bike_params)\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.save\n audit(@bike, current_user)\n render json: @bike, status: :created #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end",
"def create\n @current_bijou = current_rockhound;\n # @bijou = Bijou.new(bijou_params)\n\n @new_bijou = @current_bijou.bijous.build(bijou_params)\n\n respond_to do |format|\n if @new_bijou.save\n format.html { redirect_to @bijou, notice: 'Bijou was successfully created.' }\n format.json { render :show, status: :created, location: @bijou }\n else\n format.html { render :new }\n format.json { render json: @bijou.errors, status: :unprocessable_entity }\n end\n end\n end",
"def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def create\n @blivot = Blivot.new(blivot_params)\n\n respond_to do |format|\n if @blivot.save\n format.html { redirect_to @blivot, notice: 'Blivot was successfully created.' }\n format.json { render :show, status: :created, location: @blivot }\n else\n format.html { render :new }\n format.json { render json: @blivot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @balada = Balada.new(balada_params)\n\n respond_to do |format|\n if @balada.save\n format.html { redirect_to @balada, notice: 'Balada was successfully created.' }\n format.json { render :show, status: :created, location: @balada }\n else\n format.html { render :new }\n format.json { render json: @balada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bike_type = BikeType.new(bike_type_params)\n\n if @bike_type.save\n audit(@bike_type, current_user)\n render json: @bike_type, status: :created\n else\n render json: @bike_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @nabe = Nabe.new(params[:nabe])\n\n respond_to do |format|\n if @nabe.save\n format.html { redirect_to @nabe, notice: 'Nabe was successfully created.' }\n format.json { render json: @nabe, status: :created, location: @nabe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nabe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bike_rack = BikeRack.new(bike_rack_params)\n\n respond_to do |format|\n if @bike_rack.save\n flash[:success] = 'Bike rack was successfully created.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :created, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem with creating Bike rack.'\n format.html { render :new }\n format.json { render json: @bike_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @basin = Basin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basin }\n end\n end",
"def create\n @vano = Vano.new(params[:vano])\n\n respond_to do |format|\n if @vano.save\n format.html { redirect_to @vano, notice: 'Vano was successfully created.' }\n format.json { render json: @vano, status: :created, location: @vano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vano = Vano.new(vano_params)\n\n respond_to do |format|\n if @vano.save\n format.html { redirect_to @vano, notice: 'Vano was successfully created.' }\n format.json { render :show, status: :created, location: @vano }\n else\n format.html { render :new }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bairro = Bairro.new(bairro_params)\n\n respond_to do |format|\n if @bairro.save\n format.html { redirect_to @bairro, notice: 'Bairro criado com sucesso.' }\n format.json { render :show, status: :created, location: @bairro }\n else\n format.html { render :new }\n format.json { render json: @bairro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @at_bat.attributes = params[:at_bat]\n\n respond_to do |format|\n format.js do \n render :update do |page|\n # use transaction to rollback any changes in the event of an exception with redis\n AtBat.transaction do\n # assumes everything is going to be saved correctly because there are no validations\n @at_bat.save\n page.insert_html :top, \"at_bats\", :partial => 'at_bats/at_bat', :locals => { :at_bat => @at_bat }\n end\n end\n end\n end\n end",
"def create\n @boat_series = BoatSeries.new(boat_series_params)\n #@title = @header = \"Новая торговая марка\"\n respond_to do |format|\n if @boat_series.save\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно добавлена' }\n format.json { render json: @boat_series}\n else\n #format.html { render :new }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bokin = Bokin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bokin }\n end\n end",
"def new\n @registro_bovino = RegistroBovino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registro_bovino }\n end\n end",
"def create\n @boite = Boite.new(boite_params)\n\n respond_to do |format|\n if @boite.save\n format.html { redirect_to @boite, notice: 'Boite was successfully created.' }\n format.json { render :show, status: :created, location: @boite }\n else\n format.html { render :new }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @razmer_go = RazmerGo.new(params[:razmer_go])\n\n respond_to do |format|\n if @razmer_go.save\n format.html { redirect_to @razmer_go, notice: 'Razmer go was successfully created.' }\n format.json { render json: @razmer_go, status: :created, location: @razmer_go }\n else\n format.html { render action: \"new\" }\n format.json { render json: @razmer_go.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zf_bjietu = ZfBjietu.new(zf_bjietu_params)\n\n respond_to do |format|\n if @zf_bjietu.save\n format.html { redirect_to @zf_bjietu, notice: 'Zf bjietu was successfully created.' }\n format.json { render :show, status: :created, location: @zf_bjietu }\n else\n format.html { render :new }\n format.json { render json: @zf_bjietu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nave = Nave.new(params[:nave])\n\n respond_to do |format|\n if @nave.save\n format.html { redirect_to @nave, notice: 'Nave was successfully created.' }\n format.json { render json: @nave, status: :created, location: @nave }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nave.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bb = Bb.new(params[:bb])\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render json: @bb, status: :created, location: @bb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bay =Bay.new(bay_params)\n\n respond_to do |format|\n if @bay.save\n format.html { redirect_to ['control',@bay], notice: 'La bahía fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @bay }\n else\n format.html { render :new }\n format.json { render json: @bay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bilhete = Bilhete.new(params[:bilhete])\n\n respond_to do |format|\n if @bilhete.save\n format.html { redirect_to @bilhete, notice: 'Bilhete was successfully created.' }\n format.json { render json: @bilhete, status: :created, location: @bilhete }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bilhete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boredom = Boredom.new(boredom_params)\n\n respond_to do |format|\n if @boredom.save\n format.html { redirect_to @boredom, notice: 'Boredom was successfully created.' }\n format.json { render :show, status: :created, location: @boredom }\n else\n format.html { render :new }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bahan = Bahan.new(params[:bahan])\n\n respond_to do |format|\n if @bahan.save\n format.html { redirect_to @bahan, notice: 'Bahan was successfully created.' }\n format.json { render json: @bahan, status: :created, location: @bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def create\n @vnic = Vnic.new(params[:vnic])\n\n respond_to do |format|\n if @vnic.save\n format.html { redirect_to @vnic, notice: 'Vnic was successfully created.' }\n format.json { render json: @vnic, status: :created, location: @vnic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vnic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nhaxuatban = Nhaxuatban.new(nhaxuatban_params)\n\n respond_to do |format|\n if @nhaxuatban.save\n format.html { redirect_to @nhaxuatban, notice: \"Nhaxuatban was successfully created.\" }\n format.json { render :show, status: :created, location: @nhaxuatban }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @nhaxuatban.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_breeder = TypeBreeder.new(type_breeder_params)\n respond_to do |format|\n if @type_breeder.save\n format.html { redirect_to admin_type_breeders_url, notice: 'El tipo criador fue creador' }\n format.json { render :show, status: :created, location: @type_breeder }\n else\n format.html { render :new }\n format.js\n format.json { render json: @type_breeder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @borc = Borc.new(params[:borc])\n\n respond_to do |format|\n if @borc.save\n format.html { redirect_to @borc, notice: 'Borc was successfully created.' }\n format.json { render json: @borc, status: :created, location: @borc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bunny = Bunny.new(bunny_params)\n\n respond_to do |format|\n if @bunny.save\n format.html { redirect_to @bunny, notice: 'Bunny was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bunny }\n else\n format.html { render action: 'new' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.created', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end",
"def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end",
"def new\n @binh_bau = BinhBau.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @binh_bau }\n end\n end",
"def create\n # Loggin data from POST\n logger.debug \"--\" * 50\n logger.debug \"Data from POST: #{params.inspect}\"\n logger.debug \"--\" * 50\n\n @nasp_rail = NaspRail.new(params.keep_if { |key, value| NaspRail.column_names.include? key })\n\n respond_to do |format|\n if @nasp_rail.save\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @nasp_rail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @palabra_bolsa = PalabraBolsa.new(palabra_bolsa_params)\n\n respond_to do |format|\n if @palabra_bolsa.save\n format.html { redirect_to @palabra_bolsa, notice: 'Palabra bolsa was successfully created.' }\n format.json { render :show, status: :created, location: @palabra_bolsa }\n else\n format.html { render :new }\n format.json { render json: @palabra_bolsa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bok = Bok.new(bok_params)\n\n respond_to do |format|\n if @bok.save\n format.html { redirect_to @bok, notice: 'Bok was successfully created.' }\n format.json { render :show, status: :created, location: @bok }\n else\n format.html { render :new }\n format.json { render json: @bok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @verbo = Verbo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verbo }\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def create\n @bin = Bin.new(bin_params)\n\n respond_to do |format|\n if save_bin(@bin)\n format.html { redirect_to @bin, notice: 'Bin was successfully created.' }\n format.json { render json: { ok: true, bin: @bin } }\n else\n format.html { render :new }\n format.json {\n bin = Bin.find_by(id: @bin.id) || {}\n render json:\n { ok: false, errors: @bin.errors.full_messages, bin: bin }\n }\n end\n end\n end",
"def create\n @android_ng_bayan = AndroidNgBayan.new(android_ng_bayan_params)\n\n respond_to do |format|\n if @android_ng_bayan.save\n format.html { redirect_to @android_ng_bayan, notice: 'Android ng bayan was successfully created.' }\n format.json { render :show, status: :created, location: @android_ng_bayan }\n else\n format.html { render :new }\n format.json { render json: @android_ng_bayan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bb = Bb.new(bb_params)\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render :show, status: :created, location: @bb }\n else\n format.html { render :new }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end",
"def create\n valor = params[:bebida][:valor]\n params[:bebida][:valor] = valor.split( ',').join('.')\n\n @bebida = Bebida.new(bebida_params)\n\n respond_to do |format|\n if @bebida.save\n format.html { redirect_to @bebida, notice: 'Bebida cadastrada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @bebida }\n else\n format.html { render action: 'new' }\n format.json { render json: @bebida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @brewhouse = Brewhouse.new(params[:brewhouse])\n\n respond_to do |format|\n if @brewhouse.save\n format.html { redirect_to @brewhouse, notice: 'Brewhouse was successfully created.' }\n format.json { render json: @brewhouse, status: :created, location: @brewhouse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brewhouse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end"
] | [
"0.63501275",
"0.61068016",
"0.60103196",
"0.6000841",
"0.5935757",
"0.5807656",
"0.5790341",
"0.5749002",
"0.5742203",
"0.5741611",
"0.5736204",
"0.57244253",
"0.5722468",
"0.5719426",
"0.56738275",
"0.56738275",
"0.56736964",
"0.567326",
"0.5643534",
"0.5642834",
"0.5639025",
"0.5632963",
"0.5630055",
"0.56291175",
"0.5624944",
"0.5599029",
"0.5585203",
"0.55711174",
"0.55707467",
"0.55650264",
"0.5561153",
"0.5553102",
"0.5553019",
"0.55239826",
"0.5518126",
"0.551615",
"0.54986084",
"0.54943645",
"0.5486604",
"0.54847294",
"0.5477179",
"0.5471951",
"0.5469487",
"0.54671013",
"0.5461826",
"0.54595596",
"0.5459148",
"0.54586303",
"0.5456188",
"0.5455818",
"0.54548025",
"0.54523635",
"0.5450263",
"0.54499036",
"0.5446967",
"0.54428655",
"0.54427534",
"0.54413456",
"0.54395384",
"0.5428673",
"0.54259115",
"0.54224414",
"0.54052114",
"0.54019713",
"0.5398596",
"0.5394203",
"0.53888667",
"0.53857344",
"0.53856647",
"0.5385334",
"0.5384591",
"0.5380356",
"0.53784686",
"0.5376138",
"0.53753805",
"0.5371572",
"0.5371496",
"0.53691024",
"0.5367762",
"0.53665245",
"0.53645504",
"0.5360834",
"0.53598666",
"0.53593004",
"0.53591704",
"0.53589004",
"0.53542876",
"0.53495055",
"0.534931",
"0.5345084",
"0.534359",
"0.5342071",
"0.5341539",
"0.53391016",
"0.533728",
"0.5335027",
"0.5331548",
"0.53303045",
"0.53293353",
"0.53282833",
"0.5326884"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_brevi
@brevi = Brevi.find_by_slug(params[:slug])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 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 action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 _handle_action_missing(*args); 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 call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def brevi_params
params.require(:brevi).permit(:original_url, :slug, :clicks)
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 |
TODO use multithread uncompressing tool | def perform
@extracted_files = Array.new
@files_to_extract.each do |f|
@extracted_files.push File.basename(@filename, '.tbz') + '/' + f
end
extract = extract_command(@basename, @extracted_files.join(' '))
result = system "cd #{@dirname} && #{extract}"
if result
_extracted_files = @extracted_files.map{|f| File.join(@dirname, f)}
@file_entry = FileEntry.new(@filename, Hash[@files_to_extract.zip(_extracted_files)])
FileUtils.remove_file(@filename, true) unless keep_tbz_after_extract?
else
raise "Unable to extract files '#{@files_to_extract.join(' ')}' from #{@filename}"
end
@file_entry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decompressor; end",
"def compressor; end",
"def compress!; end",
"def decompress(data); end",
"def compression; end",
"def compress(data); end",
"def uncompress_files(oConfig)\n\n #Just uncompress the files now directly...\n Dir.glob(oConfig.data_dir + \"/*.gz\") do |file_name|\n\n #This code throws no errors, but does nothing.\n Zlib::GzipReader.open(file_name) { |gz|\n new_name = File.dirname(file_name) + \"/\" + File.basename(file_name, \".*\")\n g = File.new(new_name, \"w\")\n g.write(gz.read)\n g.close\n }\n File.delete(file_name)\n end\nend",
"def extract src_path, dst_path = File.dirname(src_path)\n src_path = File.expand_path(src_path)\n src_name = File.basename(src_path)\n src_suffix = File.extname(src_name)\n src_prefix = File.basename(src_name, src_suffix)\n\n Dir.mktmpdir(nil, dst_path) do |tmp_dir|\n # decompress the archive\n cd tmp_dir do\n case src_name.sub(/\\.part$/, '')\n when /\\.(tar\\.gz|tar\\.Z|tgz|taz)$/i\n system 'tar', '-zxf', src_path\n\n when /\\.(tar\\.bz|tar\\.bz2|tbz|tbz2)$/i\n system 'tar', '-jxf', src_path\n\n when /\\.(tar\\.xz|txz)$/i\n system 'tar', '-Jxf', src_path\n\n when /\\.(tar|cpio|gem)$/i\n system 'tar', '-xf', src_path\n\n when /\\.(tar.lzo|tzo)$/i\n system \"lzop -xc #{src_path.inspect} | tar -xf -\"\n\n when /\\.(lzo)$/i\n system 'lzop', '-x', src_path\n\n when /\\.(gz)$/i\n system \"gunzip -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(bz|bz2)$/i\n system \"bunzip2 -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(shar)$/i\n system 'sh', src_path\n\n when /\\.(7z)$/i\n system '7zr', 'x', src_path\n\n when /\\.(zip)$/i\n system 'unzip', src_path\n\n when /\\.(jar)$/i\n system 'jar', 'xf', src_path\n\n when /\\.(rz)$/i\n ln src_path, src_name # rzip removes the archive after extraction\n system 'rzip', '-d', src_name\n\n when /\\.(rar)$/i\n system 'unrar', 'x', src_path\n\n when /\\.(ace)$/i\n system 'unace', 'x', src_path\n\n when /\\.(arj)$/i\n system 'arj', 'x', src_path\n\n when /\\.(arc)$/i\n system 'arc', 'x', src_path\n\n when /\\.(lhz|lha)$/i\n system 'lha', 'x', src_path\n\n when /\\.(a|ar)$/i\n system 'ar', '-x', src_path\n\n when /\\.(Z)$/\n system \"uncompress -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(z)$/\n system \"pcat #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(zoo)$/i\n system 'zoo', 'x//', src_path\n\n when /\\.(cab)$/i\n system 'cabextract', src_path\n\n when /\\.(deb)$/i\n system 'ar', 'x', src_path\n\n when /\\.(rpm)$/i\n system \"rpm2cpio #{src_path.inspect} | cpio -i --make-directories\"\n\n else\n warn \"I do not know how to extract #{src_path.inspect}\"\n end\n end\n\n # clean any mess made by decompression\n manifest = Dir.new(tmp_dir).entries - %w[ . .. ]\n\n if manifest.length == 1 # there was no mess!\n adj_dst = File.join(dst_path, manifest.first)\n adj_src = File.join(tmp_dir, manifest.first)\n else\n adj_src = tmp_dir\n adj_dst = File.join(dst_path, src_name[/.*(?=\\..*?)/])\n end\n\n adj_dst << \"+#{Time.now.to_i}\" until\n not File.exist? adj_dst and\n mv(adj_src, adj_dst, :force => true)\n\n touch tmp_dir # give Dir.mktmpdir() something to remove\n\n adj_dst\n end\nend",
"def decompress(infile)\n compressed_data = File.binread(infile)\n ii = 5\n uncompressed_data = ''\n\n while ii < compressed_data.length - 5 and uncompressed_data.length < 24576\n c = compressed_data[ii]\n ii = ii + 1\n\n # Run Length Encoded data\n if c.ord == 0xff \n # Get the length\n count_hi = compressed_data[ii].ord\n ii = ii + 1\n count_lo = compressed_data[ii].ord\n ii = ii + 1\n count = (count_hi << 8) + count_lo\n\n # Get the repeating byte\n c = compressed_data[ii]\n ii = ii + 1\n\n # Write out the repeating character\n while count > 0\n count = count - 1\n uncompressed_data << c\n end\n\n # Uncompressed data\n else\n uncompressed_data << c\n end\n end\n\n return uncompressed_data\nend",
"def compression; @store.compression; end",
"def recompress( unprocessed )\n emitted, residue=recompress_with_remainder( unprocessed )\n # There are a few cases where the buffer in the recompress method\n # still holds data that can be compressed, so we have to recurse \n # on the residue.\n until residue.empty?\n extra, residue=recompress_with_remainder( residue )\n emitted.push *extra\n emitted.push residue.shift unless residue.empty?\n end\n emitted\n end",
"def compression?; end",
"def compression_method; end",
"def decompressed_size; end",
"def inflate2(data)\n zlib = Zlib::Inflate.new(15)\n buff = zlib.inflate(data)\n zlib.finish\n zlib.close\n buff\nend",
"def ungzip(tarfile)\n z = Zlib::GzipReader.new(tarfile)\n unzipped = StringIO.new(z.read)\n z.close\n unzipped\n end",
"def extract\n zip_file_path = \"#{Rails.root}/public/tmp/#{self.id}/#{self.zip_file_name}\"\n # 100.times { p File.exist?(zip_file_path) }\n\n Zip::ZipFile.open(zip_file_path) do |zipfile|\n zipfile.each do |file|\n export_path = \"#{Rails.root}/public/tmp/#{self.id}_2/\"\n zip_path = File.join(export_path, zip_file_name)\n\n 100.times do\n p zip_path\n end\n\n # export_path = \"#{Rails.root}/public/tmp/#{self.id}_2/\"\n # zip_path = File.join(export_path, zip_file_name)\n # FileUtils.mkdir_p(File.dirname(export_path))\n\n # unless File.exist?(zip_file_path)\n # zipfile.extract(file, zip_path)\n # # # ..stuff that it does..\n # end\n # 100.times do\n # p image_path\n # end\n # FileUtils.mkdir_p(File.dirname(image_path))\n # unless File.exist?(image_path)\n # zip_file.extract(image, image_path)\n # # ..stuff that it does..\n # end\n end\n end\n end",
"def inflate(data); end",
"def unzip(file)\n new_data = ''\n f = File.open(file, 'r')\n gz_reader = Zlib::GzipReader.new(f)\n new_data = gz_reader.read\n gz_reader.close\n new_data\n # MRI GzipReader closes f TOOD: test f is closed...\nend",
"def unzip(file)\n new_data = ''\n f = File.open(file, 'r')\n gz_reader = Zlib::GzipReader.new(f)\n new_data = gz_reader.read\n gz_reader.close\n new_data\n # MRI GzipReader closes f TOOD: test f is closed...\nend",
"def unarchive\n unless in_zip?\n zips, gzs = selected_items.partition(&:zip?).tap {|z, others| break [z, *others.partition(&:gz?)]}\n zips.each do |item|\n FileUtils.mkdir_p current_dir.join(item.basename)\n Zip::File.open(item) do |zip|\n zip.each do |entry|\n FileUtils.mkdir_p File.join(item.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(item.basename, entry.to_s)) { true }\n end\n end\n end\n gzs.each do |item|\n Zlib::GzipReader.open(item) do |gz|\n Gem::Package::TarReader.new(gz) do |tar|\n dest_dir = current_dir.join (gz.orig_name || item.basename).sub(/\\.tar$/, '')\n tar.each do |entry|\n dest = nil\n if entry.full_name == '././@LongLink'\n dest = File.join dest_dir, entry.read.strip\n next\n end\n dest ||= File.join dest_dir, entry.full_name\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n FileUtils.mkdir_p dest_dir\n File.open(dest, 'wb') {|f| f.print entry.read}\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n unless Dir.exist? dest_dir\n FileUtils.mkdir_p dest_dir\n File.open(File.join(dest_dir, gz.orig_name || item.basename), 'wb') {|f| f.print gz.read}\n end\n end\n end\n end\n end\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n FileUtils.mkdir_p File.join(current_zip.dir, current_zip.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(current_zip.dir, current_zip.basename, entry.to_s)) { true }\n end\n end\n end\n ls\n end",
"def tgz___( directory, filename )\r\n raise StandardError, \"Under investigation\" \r\n got = @ndev.rpc.file_archive( :destination => filename, :source => directory, :compress => true )\r\n end",
"def compress\n return :input_too_short if buf.size < 2\n return :input_too_large if buf.size > 0xFFFFFF\n\n outstream = ArrayOStream.new\n .u8(0x11).u16(buf.size).u8(buf.size >> 16)\n\n outbuffer = [8 * 4 + 1] * 33\n outbuffer[0] = 0\n bufferlength = 1\n bufferedBlocks = 0\n readBytes = 0\n while readBytes < buf.size\n if bufferedBlocks == 8\n outstream.write(outbuffer[0, bufferlength])\n outbuffer[0] = 0\n bufferlength = 1\n bufferedBlocks = 0\n end\n\n oldLength = [readBytes, 0x1000].min\n disp, length = occurrence_length(readBytes,\n [buf.size - readBytes, 0x10110].min, readBytes - oldLength, oldLength)\n if length < 3\n outbuffer[bufferlength] = buf[readBytes]\n readBytes += 1\n bufferlength += 1\n else\n readBytes += length\n outbuffer[0] |= (1 << (7 - bufferedBlocks)) & 0xFF\n case\n when length > 0x110\n outbuffer[bufferlength] = 0x10\n outbuffer[bufferlength] |= ((length - 0x111) >> 12) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) >> 4) & 0xFF\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) << 4) & 0xF0\n when length > 0x10\n outbuffer[bufferlength] = 0x00\n outbuffer[bufferlength] |= ((length - 0x111) >> 4) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) << 4) & 0xF0\n else\n outbuffer[bufferlength] = ((length - 1) << 4) & 0xF0\n end\n outbuffer[bufferlength] |= ((disp - 1) >> 8) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = (disp - 1) & 0xFF\n bufferlength += 1\n end\n\n bufferedBlocks += 1\n end\n\n if bufferedBlocks > 0\n outstream.write(outbuffer[0, bufferlength])\n end\n\n outstream.buf\n end",
"def unsafe_zlib_unzip\n Zip::File.open_buffer(params[:file])\n end",
"def delete_uncompressed_backups\n end",
"def partially_decompress(compressed)\n # Keep regex bracketed because of Lint/AmbiguousRegexpLiteral\n if (parsed = compressed.match(/(.*?)\\((\\d+)x(\\d+)\\)(.*)/))\n safe, length, times, rest = parsed.captures\n length = length.to_i\n times = times.to_i\n\n left, right = rest.split_at length\n safe + left * times + partially_decompress(right)\n else\n compressed\n end\n end",
"def ungzip(tarfile)\n z = Zlib::GzipReader.new(tarfile)\n unzipped = StringIO.new(z.read)\n z.close\n unzipped\n end",
"def safe_zlib_unzip\n Zip::File.open_buffer(file)\n end",
"def demarshal\n Marshal.load(decompress)\n end",
"def extract_pack\n io = Zlib::GzipReader.new(DataDragon.data_pack_path.open)\n\n Gem::Package::TarReader.new(io) do |tar|\n tar.each do |tarfile|\n destination_file = (DataDragon.data_unpacked_path + tarfile.full_name)\n\n if tarfile.directory?\n destination_file.mkpath\n else\n destination_directory = destination_file.dirname\n destination_directory.mkpath unless destination_directory.directory?\n destination_file.write(tarfile.read)\n end\n end\n end\n end",
"def safe_zlib_unzip\n Zlib::Inflate.inflate(file)\n end",
"def unszip_file(f, to)\n line(\"7z\", \"x -y {archive} -o{dest} * -r\").pass(archive: f, dest: to)\n end",
"def decompress_file(file, to)\n end",
"def unpack(target_dir)\n file = File.open(cache_path, 'rb')\n reader = Zlib::GzipReader.new(file)\n begin\n Minitar.unpack(reader, target_dir)\n ensure\n reader.close\n end\n end",
"def extract\n # Only used by tar\n compression_switch = \"\"\n compression_switch = \"z\" if downloaded_file.end_with?(\"gz\")\n compression_switch = \"--lzma -\" if downloaded_file.end_with?(\"lzma\")\n compression_switch = \"j\" if downloaded_file.end_with?(\"bz2\")\n compression_switch = \"J\" if downloaded_file.end_with?(\"xz\")\n\n if Ohai[\"platform\"] == \"windows\"\n if downloaded_file.end_with?(*TAR_EXTENSIONS) && source[:extract] != :seven_zip\n returns = [0]\n returns << 1 if source[:extract] == :lax_tar\n\n shellout!(\"tar #{compression_switch}xf #{downloaded_file} --force-local -C#{project_dir}\", returns: returns)\n elsif downloaded_file.end_with?(*COMPRESSED_TAR_EXTENSIONS)\n Dir.mktmpdir do |temp_dir|\n log.debug(log_key) { \"Temporarily extracting `#{safe_downloaded_file}' to `#{temp_dir}'\" }\n\n shellout!(\"7z.exe x #{safe_downloaded_file} -o#{windows_safe_path(temp_dir)} -r -y\")\n\n fname = File.basename(downloaded_file, File.extname(downloaded_file))\n fname << \".tar\" if downloaded_file.end_with?(\"tgz\", \"txz\")\n next_file = windows_safe_path(File.join(temp_dir, fname))\n\n log.debug(log_key) { \"Temporarily extracting `#{next_file}' to `#{safe_project_dir}'\" }\n shellout!(\"7z.exe x #{next_file} -o#{safe_project_dir} -r -y\")\n end\n else\n shellout!(\"7z.exe x #{safe_downloaded_file} -o#{safe_project_dir} -r -y\")\n end\n elsif downloaded_file.end_with?(\".7z\")\n shellout!(\"7z x #{safe_downloaded_file} -o#{safe_project_dir} -r -y\")\n elsif downloaded_file.end_with?(\".zip\")\n shellout!(\"unzip #{safe_downloaded_file} -d #{safe_project_dir}\")\n else\n shellout!(\"#{tar} #{compression_switch}xf #{safe_downloaded_file} -C#{safe_project_dir}\")\n end\n end",
"def compression_client; end",
"def decompress(file)\n compression.decompress_command + [file]\n end",
"def recombinate_files_for_multiple_transfers_possibly\r\n got_end_big_transfer = false\r\n \tif @current_transfer_file =~ /recombinate_ok/\r\n\t recombinate_files_split_piece_wise @copied_files\r\n\t @copied_files = []\r\n\t got_end_big_transfer = true\r\n\tend\r\n\t@current_transfer_file = nil\r\n\tgot_end_big_transfer\r\n end",
"def action_compress\n end",
"def unpack\n trace :debug, \"Build: apktool extract: #{@tmpdir}/apk\"\n\n apktool = path('apktool.jar')\n\n Dir[path('core.*.apk')].each do |d|\n version = d.scan(/core.android.(.*).apk/).flatten.first\n\n if version == \"melt\" then\n trace :debug, \"-jar #{apktool} d -f #{d} -o #{@tmpdir}/apk.#{version}\"\n #CrossPlatform.exec \"java\", \"-jar #{apktool} if #{@tmpdir}/jelly.apk jelly\"\n CrossPlatform.exec \"java\", \"-jar #{apktool} d -f #{d} -o #{@tmpdir}/apk.#{version}\"\n else\n trace :debug, \"-jar #{apktool} d -f -s -r #{d} -o #{@tmpdir}/apk.#{version}\"\n CrossPlatform.exec \"java\", \"-jar #{apktool} d -f -s -r #{d} -o #{@tmpdir}/apk.#{version}\"\n end\n\n [\"rb.data\", \"cb.data\"].each do |asset|\n CrossPlatform.exec \"pwd\",\"\"\n exists = File.exist?(path(\"apk.#{version}/assets/#{asset}\"))\n trace :debug, \"check #{@tmpdir}/apk.#{version}/assets/#{asset} #{exists}\" \n\n raise \"unpack failed. needed asset #{asset} not found\" unless File.exist?(path(\"apk.#{version}/assets/#{asset}\"))\n end\n\n end\nend",
"def decompress(compressed)\n nil\n end",
"def make_bitmap_data0\r\n gz = Zlib::GzipWriter.open('hoge.gz')\r\n t_Fx = 0\r\n w = @bitmap.width\r\n h = @bitmap.height\r\n data = []\r\n for y in 0...h\r\n data.push(0)\r\n for x in 0...w\r\n t_Fx += 1\r\n if t_Fx % 10000 == 0\r\n Graphics.update\r\n end\r\n if t_Fx % 100000 == 0\r\n s = data.pack(\"C*\")\r\n gz.write(s)\r\n data.clear\r\n end\r\n color = @bitmap.get_pixel(x, y)\r\n red = color.red\r\n green = color.green\r\n blue = color.blue\r\n alpha = color.alpha\r\n data.push(red)\r\n data.push(green)\r\n data.push(blue)\r\n data.push(alpha)\r\n end\r\n end\r\n s = data.pack(\"C*\")\r\n gz.write(s)\r\n gz.close \r\n data.clear\r\n gz = Zlib::GzipReader.open('hoge.gz')\r\n data = gz.read\r\n gz.close\r\n File.delete('hoge.gz')\r\n return data\r\n end",
"def rtfdecompr data\n\t\t\tio = StringIO.new data\n\t\t\tbuf = RTF_PREBUF + \"\\x00\" * (4096 - RTF_PREBUF.length)\n\t\t\twp = RTF_PREBUF.length\n\t\t\trtf = ''\n\n\t\t\t# get header fields (as defined in RTFLIB.H)\n\t\t\tcompr_size, uncompr_size, magic, crc32 = io.read(16).unpack 'V*'\n\t\t\t#warn \"compressed-RTF data size mismatch\" unless io.size == data.compr_size + 4\n\n\t\t\t# process the data\n\t\t\tcase magic\n\t\t\twhen 0x414c454d # \"MELA\" magic number that identifies the stream as a uncompressed stream\n\t\t\t\trtf = io.read uncompr_size\n\t\t\twhen 0x75465a4c # \"LZFu\" magic number that identifies the stream as a compressed stream\n\t\t\t\tflag_count = -1\n\t\t\t\tflags = nil\n\t\t\t\twhile rtf.length < uncompr_size and !io.eof?\n\t\t\t\t\t# each flag byte flags 8 literals/references, 1 per bit\n\t\t\t\t\tflags = ((flag_count += 1) % 8 == 0) ? io.getbyte : flags >> 1\n\t\t\t\t\tif 1 == (flags & 1) # each flag bit is 1 for reference, 0 for literal\n\t\t\t\t\t\trp, l = io.getbyte, io.getbyte\n\t\t\t\t\t\t# offset is a 12 byte number. 2^12 is 4096, so thats fine\n\t\t\t\t\t\trp = (rp << 4) | (l >> 4) # the offset relative to block start\n\t\t\t\t\t\tl = (l & 0xf) + 2 # the number of bytes to copy\n\t\t\t\t\t\tl.times do\n\t\t\t\t\t\t\trtf << buf[wp] = buf[rp]\n\t\t\t\t\t\t\twp = (wp + 1) % 4096\n\t\t\t\t\t\t\trp = (rp + 1) % 4096\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\trtf << buf[wp] = io.getbyte.chr\n\t\t\t\t\t\twp = (wp + 1) % 4096\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # unknown magic number\n\t\t\t\traise \"Unknown compression type (magic number 0x%08x)\" % magic\n\t\t\tend\n\t\t\t\n\t\t\t# not sure if its due to a bug in the above code. doesn't seem to be\n\t\t\t# in my tests, but sometimes there's a trailing null. we chomp it here,\n\t\t\t# which actually makes the resultant rtf smaller than its advertised\n\t\t\t# size (+uncompr_size+).\n\t\t\trtf.chomp! 0.chr\n\t\t\trtf\n\t\tend",
"def compression_server; end",
"def compression_method=(_arg0); end",
"def extract_tar_gz\n Gem::Package::TarReader.new(Zlib::GzipReader.open(base.package)) do |tar|\n\n # Progressbar\n progressbar = ProgressBar.create(format: PROGRESSBAR_FORMAT, total: tar.count)\n\n # tar.count move position pointer to end\n tar.rewind\n\n dest_file = nil\n tar.each do |entry|\n if entry.full_name == TAR_LONGLINK\n dest_file = File.join(@tmpdir, entry.read.strip)\n next\n end\n dest_file ||= File.join(@tmpdir, entry.full_name)\n if entry.directory?\n FileUtils.rm_rf(dest_file) unless File.directory?(dest_file)\n FileUtils.mkdir_p(dest_file, mode: entry.header.mode, verbose: false)\n elsif entry.file?\n FileUtils.rm_rf(dest_file) unless File.file?(dest_file)\n File.open(dest_file, 'wb') do |f|\n f.write(entry.read)\n end\n FileUtils.chmod(entry.header.mode, dest_file, verbose: false)\n elsif entry.header.typeflag == '2' # symlink\n File.symlink(entry.header.linkname, dest_file)\n end\n\n dest_file = nil\n progressbar.increment\n end\n end\n end",
"def decompress\n Zlib::Inflate.inflate(decode64)\n end",
"def prepare_reads(base, map, fqgz0, *fqgzs0)\n\n fqgzs = [fqgz0] + fqgzs0\n\n bcs = Hash.new\n open(map, 'r').each do |line|\n bc, well = line.rstrip.split(',')\n bcs[bc] = well\n end\n \n bcl = bcs.keys.map!{|key| key.length}.sort.uniq[0]\n\n tso_pattern = '.'*options.umi_length + '.'*bcl + 'GG'\n\n #\n \n STDERR.puts \"#{`date`.strip}: Demultiplexing each raw sequence files...\"\n \n fqgz2csv0 = Hash.new\n fqgz2csv1 = Hash.new\n fqgz2base = Hash.new\n fqgzs.each do |fqgz|\n fqgz2csv0[fqgz] = get_temporary_path('strt.preprocess', 'csv', false)\n fqgz2csv1[fqgz] = get_temporary_path('strt.preprocess', 'csv', false)\n fqgz2base[fqgz] = get_temporary_path('strt.preprocess', 'base', false)\n end\n\n Parallel.map(fqgz2csv0.keys, in_processes: options.parallel) do |fqgz|\n cmds = [\n \"unpigz -c #{fqgz}\",\n \"#{fq1l_convert_command(options)}\",\n \"#{fq1l_count_command(options)} #{fqgz2csv0[fqgz]}\",\n \"fq1l match_5end#{grep_prefix_option(options)} #{tso_pattern}\",\n \"#{fq1l_count_command(options)} #{fqgz2csv1[fqgz]}\",\n \"fq1l annotate_index --first-cycle=#{options.umi_length+1} --last-cycle=#{options.umi_length+bcl}\",\n \"fq1l annotate_umi --first-cycle=1 --last-cycle=#{options.umi_length}\",\n \"fq1l sort_index#{coreutils_prefix_option}#{parallel_option(options)} --buffer-size=#{(options.maximum_memory/(fqgz2csv0.keys.size+1)).to_i}%\",\n \"fq1l demultiplex #{fqgz2base[fqgz]} #{map}\"\n ]\n cmds.insert(2, \"#{head_command(options)} -n #{options.reads}\") unless options.reads.nil?\n stats = Open3.pipeline(*cmds)\n stats.each_index do |i|\n raise \"Fail at process #{i}; #{stats[i]}; #{cmds[i]}\" unless stats[i].success? || (stats[i].signaled? && stats[i].termsig == 13)\n end\n end\n\n system \"fq1l sum_counts #{fqgz2csv0.values.join(' ')} > #{base}.count.step1.csv\"\n unlink_files(fqgz2csv0.values)\n \n system \"fq1l sum_counts #{fqgz2csv1.values.join(' ')} > #{base}.count.step2.csv\"\n unlink_files(fqgz2csv1.values)\n\n #\n \n (bcs.values + ['NA']).each do |well|\n\n STDERR.puts \"#{`date`.strip}: Finishing well #{well}...\"\n \n tmpfqgzs = fqgz2base.values.map {|base| \"#{base}.#{well}.fq.gz\"}\n csvs = Array.new(6) {|i| \"#{base}.#{well}.count.step#{i+3}.csv\"}\n \n pipeline(\"unpigz -c #{tmpfqgzs.join(' ')}\",\n \"#{fq1l_convert_command(options)}\",\n \"#{fq1l_count_command(options)} #{csvs[0]}\",\n \"#{fq1l_sort_command} --buffer-size=#{(options.maximum_memory/2).to_i}%\",\n \"fq1l exclude_duplicate\",\n \"#{fq1l_count_command(options)} #{csvs[1]}\",\n \"fq1l trim_3end_quality\",\n \"#{fq1l_count_command(options)} #{csvs[2]}\",\n \"fq1l trim_3end_primer#{coreutils_prefix_option}#{grep_prefix_option(options)}#{parallel_option(options)}\",\n \"#{fq1l_count_command(options)} #{csvs[3]}\",\n \"#{fq1l_sort_command} --buffer-size=#{(options.maximum_memory/2).to_i}%\",\n \"fq1l exclude_degenerate\",\n \"#{fq1l_count_command(options)} #{csvs[4]}\",\n \"fq1l trim_5end --minimum-length=#{options.minimum_length} #{tso_pattern}+\",\n \"#{fq1l_count_command(options)} #{csvs[5]}\",\n \"fq1l restore#{coreutils_prefix_option}\",\n \"pigz -c > #{base}.#{well}.fq.gz\")\n \n unlink_files(tmpfqgzs)\n \n end\n \n end",
"def compressFiles\n Dir.chdir(\"#{@outputDir}/RDPsummary\")\n #system(\"tar -zcf #{@sampleSetName1}.tar.gz * --exclude=*.log --exclude=*.sra --exclude=*.sff --exclude=*.local.metadata\")\n system(\"tar czf class.result.tar.gz class\")\n system(\"tar czf domain.result.tar.gz domain\")\n system(\"tar czf family.result.tar.gz family\")\n system(\"tar czf genus.result.tar.gz genus\")\n system(\"tar czf order.result.tar.gz order\")\n system(\"tar czf phyla.result.tar.gz phyla\")\n system(\"tar czf species.result.tar.gz species\")\n system(\"tar czf pdf.result.tar.gz 'find . -name `*.pdf`'\")\n Dir.chdir(@scratch)\n end",
"def decompress_files(compressed_files=[], dir = decompressed_spool_dir )\n\n files = []\n\n compressed_files.each do |file|\n Zip::Archive.open(file) do |ar|\n ar.each do |zf|\n if zf.directory?\n FileUtils.mkdir_p(zf.name)\n else\n dirname = File.dirname(zf.name)\n FileUtils.mkdir_p(dirname) unless File.exist?(dirname)\n output_file = File.join(dir, zf.name)\n open(output_file, 'wb') do |f|\n f << zf.read\n end\n files << output_file\n end\n end\n end\n # TODO: Delete processed file\n end\n\n files\n end",
"def unpack(data); end",
"def unzip_file(file)\n end",
"def compressed_size; end",
"def compressed_size; end",
"def finalize(stream)\n ->(id) do\n Libbz2::BZ2_bzDecompressEnd(stream)\n end\n end",
"def decompress\n header = buf.u32\n return :invalid_data if (header & 0xFF) != 0x11\n decompressedSize = header >> 8\n decompressedSize = buf.u32 if decompressedSize == 0\n\n bufferLength = 0x1000\n buffer = Array.new(bufferLength)\n bufferOffset = 0\n\n flags = 0\n mask = 1\n\n outbuf = []\n until outbuf.size >= decompressedSize\n if mask == 1\n flags = buf.u8\n return :stream_too_short if flags.nil?\n mask = 0x80\n else\n mask >>= 1\n end\n\n if (flags & mask) > 0\n byte1 = buf.u8\n return :stream_too_short if byte1.nil?\n\n length = byte1 >> 4\n disp = -1\n case length\n when 0\n byte2 = buf.u8\n byte3 = buf.u8\n return :stream_too_short if byte3.nil?\n length = (((byte1 & 0x0F) << 4) | (byte2 >> 4)) + 0x11\n disp = (((byte2 & 0x0F) << 8) | byte3) + 0x1\n when 1\n byte2 = buf.u8\n byte3 = buf.u8\n byte4 = buf.u8\n return :stream_too_short if byte4.nil?\n length = (((byte1 & 0x0F) << 12) | (byte2 << 4) | (byte3 >> 4)) + 0x111\n disp = (((byte3 & 0x0F) << 8) | byte4) + 0x1\n else\n byte2 = buf.u8\n return :stream_too_short if byte2.nil?\n length = ((byte1 & 0xF0) >> 4) + 0x1\n disp = (((byte1 & 0x0F) << 8) | byte2) + 0x1\n end\n\n return :invalid_data if disp > outbuf.size\n\n bufIdx = bufferOffset + bufferLength - disp\n length.times do\n next_byte = buffer[bufIdx % bufferLength]\n bufIdx += 1\n outbuf << next_byte\n buffer[bufferOffset] = next_byte\n bufferOffset = (bufferOffset + 1) % bufferLength\n end\n else\n next_byte = buf.u8\n return :stream_too_short if next_byte.nil?\n outbuf << next_byte\n buffer[bufferOffset] = next_byte\n bufferOffset = (bufferOffset + 1) % bufferLength\n end\n end\n\n outbuf\n end",
"def zopfli_compress(source, source_file_name, iterations=nil)\n output_file_name = \"#{source_file_name}.zopf.gz\"\n IO.binwrite(\n output_file_name,\n Zopfli.deflate(source, format: :gzip, num_iterations: iterations)\n )\n output_file_name\nend",
"def _safe_inflate data\n zi = Zlib::Inflate.new\n pos = 0; r = String.new\n begin\n # save some memory by not using String#[] when not necessary\n r << zi.inflate(pos==0 ? data : data[pos..-1])\n if zi.total_in < data.size\n @extradata << data[zi.total_in..-1]\n STDERR.puts \"[?] #{@extradata.last.size} bytes of extra data after zlib stream\".red if @verbose >= 1\n end\n # decompress OK\n rescue Zlib::BufError\n # tried to decompress, but got EOF - need more data\n STDERR.puts \"[!] #{$!.inspect}\".red if @verbose >= -1\n # collect any remaining data in decompress buffer\n r << zi.flush_next_out\n rescue Zlib::DataError\n STDERR.puts \"[!] #{$!.inspect}\".red if @verbose >= -1\n #p [pos, zi.total_in, zi.total_out, data.size, r.size]\n r << zi.flush_next_out\n # XXX TODO try to skip error and continue\n# printf \"[d] pos=%d/%d t_in=%d t_out=%d bytes_ok=%d\\n\".gray, pos, data.size,\n# zi.total_in, zi.total_out, r.size\n# if pos < zi.total_in\n# pos = zi.total_in\n# else\n# pos += 1\n# end\n# pos = 0\n# retry if pos < data.size\n rescue Zlib::NeedDict\n STDERR.puts \"[!] #{$!.inspect}\".red if @verbose >= -1\n # collect any remaining data in decompress buffer\n r << zi.flush_next_out\n end\n\n r == \"\" ? nil : r\n ensure\n zi.close if zi && !zi.closed?\n end",
"def decompress_package(package)\n @logger.info \"Decompressing #{package.path}\\nto #{@target_location}\"\n FileUtils.mkdir_p(@target_location)\n Dir.chdir(@target_location) do\n # Clear out existing package\n FileUtils.rm_rf Dir.glob(\"#{@target_location}/*\")\n RakeUtils.system \"tar -zxf #{package.path}\"\n end\n @logger.info \"Decompressed\"\n end",
"def uncompress(str)\n uncompressed = ''\n (0...str.length - 1).each do |i|\n letter = str[i]\n num = str[i + 1].to_i\n uncompressed += letter * num\n end\n uncompressed\nend",
"def test_tar\n\tx = \"test_tar\"\n\t@output = @s.archive({ 'files'=> [@test_directory_1_Path], 'format'=>'tar' , 'recurse'=>false } )\n\t#puts @output['archiveFile']\n\t\n\t@testid= 1\n\tTar.open(@output['archiveFile'], File::RDONLY, 0644, Tar::GNU | Tar::VERBOSE) do |tar|\n while tar.read # or 'tar.each do ...'\n #puts tar.pathname\n\t\t\n\t\t\n # tar.print_long_ls\n\n if tar.reg? && tar.pathname!=\"test_directory_1/.DS_Store\" # regular file\n tar.extract_file('test')\n\t\t want = File.read(File.join(@testdir, tar.pathname))\n\t\t puts tar.pathname\n\t\t #asserting bar1,2,3 from tar file is same as original bar1,2,3\n\t\t assert_log( want, File.read('test'), $log, x, @testid)\n end\n end\n\n ##if extract all files\n #tar.extract_all\n end\n\n\n ##for gzip archive\n #Tar.gzopen('foo.tar.gz', ...\n\n ##for bzip2 archive\n #Tar.bzopen('foo.tar.bz2', ...\n \n \n \n end",
"def to_compress\n a = lx.dup\n b = rx.dup\n ts = transcript.dup\n w = ts.challenge_scalar(\"w\")\n q = GENERATOR_BJ * w\n\n a_sum = a.dup\n b_sum = b.dup\n g_sum = vec_g.dup\n h_sum = vec_h2.dup\n\n terms = []\n until a_sum.length == 1\n a_lo = []\n b_lo = []\n g_lo = []\n h_lo = []\n a_hi = []\n b_hi = []\n g_hi = []\n h_hi = []\n half = a_sum.length / 2\n a_sum.each.with_index do |_, i|\n if i < half\n a_lo << a_sum[i]\n b_lo << b_sum[i]\n g_lo << g_sum[i]\n h_lo << h_sum[i]\n else\n a_hi << a_sum[i]\n b_hi << b_sum[i]\n g_hi << g_sum[i]\n h_hi << h_sum[i]\n end\n end\n alo_bhi = a_lo.zip(b_hi).map { |x, y| FIELD.mod(x * y) }.sum\n ahi_blo = a_hi.zip(b_lo).map { |x, y| FIELD.mod(x * y) }.sum\n\n l_k =\n g_hi.zip(a_lo).map { |x, y| x * y }.sum(INFINITY_J) +\n h_lo.zip(b_hi).map { |x, y| x * y }.sum(INFINITY_J) + q * alo_bhi\n r_k =\n g_lo.zip(a_hi).map { |x, y| x * y }.sum(INFINITY_J) +\n h_hi.zip(b_lo).map { |x, y| x * y }.sum(INFINITY_J) + q * ahi_blo\n\n ts.points << l_k\n ts.points << r_k\n uk = ts.challenge_scalar(\"uk\")\n uk_inv = FIELD.inverse(uk)\n terms << { L: l_k, R: r_k }\n\n a_sum = []\n b_sum = []\n g_sum = []\n h_sum = []\n a_lo.each.with_index do |_, i|\n a_sum << (a_lo[i] * uk + a_hi[i] * uk_inv)\n b_sum << (b_lo[i] * uk_inv + b_hi[i] * uk)\n g_sum << (g_lo[i] * uk_inv + g_hi[i] * uk)\n h_sum << (h_lo[i] * uk + h_hi[i] * uk_inv)\n end\n end\n\n a0 = a_sum.first\n b0 = b_sum.first\n\n Compressed.new(v, p_a, p_s, p_t1, p_t2, tx, tx_bf, e, a0, b0, terms)\n end",
"def inflate\n if @path.to_s =~ /\\.gz$/ then\n unzipped_fn = @path.to_s.gsub(/\\.gz$/, '');\n unzipped_f = File.open(unzipped_fn, 'w');\n @@log.d(\"inflate #{@path} to #{unzipped_fn}\");\n Zlib::GzipReader.open(@path) do |gzr|\n gzr.each_line do |line|\n unzipped_f.write(line);\n end\n end\n unzipped_f.close();\n @@log.d(\"Deleting #{@path}\");\n File.delete(@path);\n @path = Pathname.new(unzipped_fn);\n @@log.d(\"New path #{@path}\");\n else\n STDERR.puts \"#{@path} not a .gz file.\";\n end\n\n self;\n end",
"def inflate zstring=nil\n\t\t@zstring = zstring unless zstring.nil?\n\t\t#We can't use unpack, IronRuby doesn't have it yet.\n\t\t@zstring.each_byte {|b| @input_buffer << b}\n\t\t\n\t \tunless @rawdeflate then\n\n\t\tcompression_method_and_flags = @input_buffer[@in_pos+=1]\n\t\tflags = @input_buffer[@in_pos+=1]\n\t\t\n\t\t#CMF and FLG, when viewed as a 16-bit unsigned integer stored inMSB order (CMF*256 + FLG), is a multiple of 31\n\t\tif ((compression_method_and_flags << 0x08) + flags) % 31 != 0 then raise Zlib::DataError.new(\"incorrect header check\") end\n\t\t\n\t\t#CM = 8 denotes the “deflate” compression method with a window size up to 32K. (RFC's only specify CM 8)\n\t\tcompression_method = compression_method_and_flags & 0x0F \n\t\t\n\t\tif compression_method != Z_DEFLATED then raise Zlib::DataError.new(\"unknown compression method\") end\n\t\t\n\t\t#For CM = 8, CINFO is the base-2 logarithm of the LZ77 window size,minus eight (CINFO=7 indicates a 32K window size)\n\t\tcompression_info = compression_method_and_flags >> 0x04 \n\t\t\n\t\tif (compression_info + 8) > @w_bits then raise Zlib::DataError.new(\"invalid window size\") end\n\t\t\n\t\tpreset_dictionary_flag = ((flags & 0x20) >> 0x05) == 1\n\t\tcompression_level = (flags & 0xC0) >> 0x06\n\t\t\n\t\tif preset_dictionary_flag and @dict.nil? then raise Zlib::NeedDict.new \"Preset dictionary needed!\" end\n\t\t\n\t\t#TODO: Add Preset dictionary support\n\t\tif preset_dictionary_flag then \n\t\t\t@dict_crc = @input_buffer[@in_pos+=1] << 24 | @input_buffer[@in_pos+=1] << 16 | @input_buffer[@in_pos+=1] << 8 | @input_buffer[@in_pos+=1]\n\t\t end\n\t\t\n\t\tend\n\t\tlast_block = false\n\t\t#Begin processing DEFLATE stream\n\t\tuntil last_block\n\t\t\tlast_block = (get_bits(1) == 1)\n\t\t\tblock_type = get_bits(2)\n\t\t\tcase block_type\n\t\t\t\twhen 0 then no_compression\n\t\t\t\twhen 1 then fixed_codes\n\t\t\t\twhen 2 then dynamic_codes\n \t\t\t\twhen 3 then raise Zlib::DataError.new(\"invalid block type\")\t \n\t\t\tend\t\n\t\tend\n\t\tfinish\n\tend",
"def get_compression()\n return(get_cmd('CP;',0.1,0.5,3).gsub(/^CP/,'').gsub(/;$/,'').to_i)\nend",
"def uncompress_local_tarball(onhost_tar_file, onhost_base_dir, download_file)\n variant, version, arch, codename = self['platform'].to_array\n case variant\n when /^(fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/\n execute(\"tar -zxvf #{onhost_tar_file} -C #{onhost_base_dir}\")\n when /^solaris$/\n # uncompress PE puppet-agent tarball\n if version == '10'\n execute(\"gunzip #{onhost_tar_file}\")\n tar_file_name = File.basename(download_file, '.gz')\n execute(\"tar -xvf #{tar_file_name}\")\n elsif version == '11'\n execute(\"tar -zxvf #{onhost_tar_file}\")\n else\n msg = \"Solaris #{version} is not supported by the method \"\n msg << 'uncompress_local_tarball'\n raise ArgumentError, msg\n end\n else\n msg = \"Platform #{variant} is not supported by the method \"\n msg << 'uncompress_local_tarball'\n raise ArgumentError, msg\n end\n end",
"def stage_unzipped(zipfile, stage_dir)\n # Unzip file to a specified directory\n Dir.mkdir stage_dir unless Dir.exist?(stage_dir)\n Zip::File.open(zipfile) do |z|\n z.each do |f|\n extract_path = File.join(stage_dir, f.name)\n z.extract(f, extract_path) unless File.exist?(extract_path)\n end\n end\nend",
"def decompress(gz, outfile)\n unzipped = Zlib::Inflate.inflate(gz)\n out = File.open(outfile, 'w')\n out.write unzipped\n out.close\n return true\n end",
"def string_compression(str)\n\nend",
"def decode_file(encoders, filename)\n code = File.read(filename).gsub(/^.*require\\s*['\"]whiteout['\"]/m, '')\n encoders.each do | mod | \n if mod::HEADER == code[0,mod::HEADER.length]\n\treturn mod.decode(code[mod::HEADER.length..-1])\n end\n if mod::HEADER_COMPRESSED == code[0,mod::HEADER_COMPRESSED.length]\n\treturn mod.decode_compressed(code[mod::HEADER_COMPRESSED.length..-1])\n end\n end\n throw \"No matching decompression module found\"\n end",
"def decompress(data)\n data_by_name = {}\n io = StringIO.new(data)\n\n Zip::InputStream.open(io) do |zip_io|\n while (entry = zip_io.get_next_entry)\n name = entry.name\n data = zip_io.read\n\n data_by_name[name] = data\n end\n end\n\n data_by_name\nend",
"def start_compressing\n %Q{Start compressing of dump ... }\n end",
"def compression\n \n ##Preparing directory structure for \"project\" area to display html\n system(\"mkdir -p #{@outputDir}/htmlPages/#{@studyName1}/QIIME/#{@jobName1}\")\n system(\"cp -r #{@outputDir}/QIIME_result/plots #{@outputDir}/htmlPages/#{@studyName1}/QIIME/#{@jobName1}\")\n \n Dir.chdir(\"#{@outputDir}/QIIME_result\")\n #system(\"tar -zcf #{@sampleSetName1}.tar.gz * --exclude=*.log --exclude=*.sra --exclude=*.sff --exclude=*.local.metadata\")\n system(\"tar czf raw.results.tar.gz * --exclude=filtered_aln --exclude=taxa --exclude=aln --exclude=plots\")\n system(\"tar czf phylogenetic.result.tar.gz filtered_aln\")\n system(\"tar czf taxanomy.result.tar.gz taxa\")\n system(\"tar czf fasta.result.tar.gz aln\")\n system(\"tar czf plots.result.tar.gz plots\")\n \n Dir.chdir(@scratch)\n \n end",
"def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end",
"def gunzip(filename)\n\treturn Zlib::GzipReader.new(StringIO.new(File.read(filename))).read\nend",
"def download_from_blobstore\n Thread.new do\n blobstore_client = Product.get_blobstore_client\n blobstore_id = @location['object_id']\n\n FileUtils.mkdir_p version_dir\n\n if blobstore_client.exists?(blobstore_id)\n retry_count = 0\n done = false\n\n while !done && retry_count < 5\n File.open(bits_full_local_path_dl, \"wb\") do |file|\n begin\n blobstore_client.get(blobstore_id, file)\n location_size_value = @location['size']\n raise \"Download interrupted for #{blobstore_id} at #{file.size} bytes out of #{location_size_value} bytes.\" if file.size < location_size_value\n\n done = true\n rescue => ex\n retry_count += 1\n $logger.warn \"There was an error while downloading #{product.name} v#{version}. Retrying... ##{retry_count}. Error was #{ex.to_s}\"\n sleep 5\n end\n end\n end\n\n unless done\n $logger.error \"Could not download #{product.name} v#{version}.\"\n FileUtils.rm_f bits_full_local_path_dl\n end\n else\n $logger.warn \"Could not find bits for #{product.name} v#{version}.\"\n end\n\n if @location['sha'] != Digest::SHA1.file(bits_full_local_path_dl).hexdigest\n $logger.error \"Download of #{product.name} v#{version} failed signature check.\"\n FileUtils.rm_f bits_full_local_path_dl\n else\n begin\n if @product.type != Product::TYPE_STEMCELL\n FileUtils.mkdir_p bits_full_local_path_unpacked\n tgz = Zlib::GzipReader.new(File.open(bits_full_local_path_dl, 'rb'))\n Minitar.unpack(tgz, bits_full_local_path_unpacked)\n FileUtils.mv bits_full_local_path_unpacked, bits_full_local_path, :force => true\n FileUtils.rm_f bits_full_local_path_dl\n else\n FileUtils.mv bits_full_local_path_dl, bits_full_local_path, :force => true\n end\n rescue => ex\n $logger.error \"Could not unpack #{product.name} v#{version}: #{ex.message} - #{ex.backtrace}.\"\n FileUtils.rm_f bits_full_local_path_unpacked\n FileUtils.rm_f bits_full_local_path\n FileUtils.rm_f bits_full_local_path_dl\n end\n end\n end\n end",
"def decode\n\t\t\n\t\t# go through all of the encoded blocks and fund new singles\n\t\t@encoded.each do |enc|\n\t\t\t@encoded.delete(enc)\n\t \t\tenc = decode_new_multi(enc)\n\t\t\tnd = enc.blocks.length\n\t\t\tif nd == 0\n\t\t\t\t# Got them all, discard\n\t\t\telsif nd == 1\n\t\t\t\t# new single block\n\t\t\t\tadd_single_block(enc)\n\t\t\telse\n\t\t\t\t# add to the pile of unknowns\n\t\t\t\t@encoded << enc\n\t\t\tend\n\t\tend\n\tend",
"def save_single_zip_to_redis(zip_url,redis)\n file = open(zip_url)\n Zip::File.open(file) do |zip_file|\n zip_file.each do |entry|\n #looks like there are duplicates with slight differences in username, posts, comments etc\n #I can make them unique by cutting out by discussion title, discussion title+forum, etc as key.\n #otherwise, if I can assume each unique xml filename is a unique instance that we want I can just use that as key\n redis.set(entry.name, entry.get_input_stream.read)\n p entry.name\n p entry.get_input_stream.read\n p entry\n puts \"\"\n end\n end\nend",
"def extract\n for file_path in @files\n if !File.directory?(file_path)\n if file_path.downcase.index('.7zip') || file_path.downcase.index('.7z') || file_path.downcase.index('.zip')\n extension = '7zip' if file_path.downcase.index('.7zip')\n extension = '7z' if file_path.downcase.index('.7z')\n extension = 'zip' if file_path.downcase.index('.zip')\n cmd = \"7za e -o#{@dir} #{file_path}\"\n #puts \"Extracting #{file_path}: #{cmd}\"\n system(cmd)\n if cmd\n if file_path.downcase.index('att')\n file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n elsif file_path.downcase.index('enroll')\n file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n elsif file_path.downcase.index('ili') || file_path.downcase.index('h1n1')\n file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n else\n file_name = File.join(@dir, \"ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n end\n File.rename(file_path, file_name)\n FileUtils.mv(file_name, File.join(@dir, \"archive\"))\n end\n end\n end\n end\n\n end",
"def ignore_bad_chunking; end",
"def ignore_bad_chunking; end",
"def download_and_uncompress(host, source_link, uncompress_to)\n # ERB Template\n installer_url = source_link\n dest_directory = uncompress_to\n directory_path = \"#{uncompress_to}/IBM\"\n\n # getting compress type\n if source_link.include? 'zip'\n compress_type = 'zip'\n elsif source_link.include? 'tar.gz'\n compress_type = 'tar.gz'\n else\n fail_test 'Only zip or tar.gz are is valid compressed file'\n end\n\n # getting group:\n if host['platform'] =~ %r{aix}\n user_group = 'system'\n elsif host['platform'] =~ %r{linux}\n user_group = 'root'\n end\n\n local_files_root_path = ENV['FILES'] || 'tests/files'\n manifest_template = File.join(local_files_root_path, 'download_uncompress_manifest.erb')\n manifest_erb = ERB.new(File.read(manifest_template)).result(binding)\n\n on(host, puppet('apply'), stdin: manifest_erb, exceptable_exit_codes: [0, 2]) do |result|\n assert_no_match(%r{Error}, result.output, 'Failed to download and/or uncompress')\n end\nend",
"def unpack(filename)\n @destination = Dir.mktmpdir\n Zip::File.open(filename){ |zip_file|\n zip_file.each{ |f|\n f_path=File.join(@destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exists?(f_path)\n }\n }\n end",
"def content_encoding_gunzip(body_io); end",
"def load_compressed\n Ingestor::LOG.debug(\"Compressed file detected #{file}...\")\n @tempfile = @document\n @document = Tempfile.new(\"decompressed\", working_directory)\n @document.binmode\n \n Zip::ZipFile.open(@tempfile.path) do |zipfile|\n zipfile.each do |entry|\n istream = entry.get_input_stream\n @document.write istream.read\n end\n end\n @document.rewind\n end",
"def zip(data)\n zipfile = \"rubyzip-#{rand 32768}\" \n Zip::ZipOutputStream::open(zipfile) do |io|\n count = 0\n data.each do |d, n|\n io.put_next_entry((\"#{n}\" or \"#{count += 1}.txt\"))\n io.write d\n end\n end\n zippy = File.open(zipfile).read\n #File.delete(zipfile)\n zippy \n end",
"def compressed_size=(_arg0); end",
"def untargz(targzfile, destdir)\n raise \"invalid tar.gz file #{targzfile}\" unless File.file? targzfile\n Zlib::GzipReader.open targzfile do |otarfile|\n untar0(otarfile, destdir)\n end\n end",
"def unzip(x)\r\n outdir = x.sub(/.*\\//, '')\r\n outdir = '.' if outdir == \"\"\r\n Zip::ZipFile::open(x) { |zf|\r\n zf.each { |e|\r\n fpath = File.join(outdir, e.name)\r\n FileUtils.mkdir_p(File.dirname(fpath))\r\n zf.extract(e, fpath)\r\n }\r\n }\r\nend",
"def zip_contents; end",
"def gzfix(file, dest)\n gzip_header = \"\\x1f\\x8b\".force_encoding(Encoding::ASCII_8BIT)\n limit = 1024\n\n # Read a few lines, looking for gzip header\n file.rewind\n 10.times do |i|\n line = file.readline(limit).force_encoding(Encoding::ASCII_8BIT)\n if line[0,2] == gzip_header # Found gzip!\n if i == 0\n File.rename(file, dest) # Whole file is ok\n else # Use the file from this line on\n IO.copy_stream(file, dest, -1, file.pos - line.size)\n end\n return\n end\n break unless line.ascii_only? # Doesn't look like header lines\n end\n raise \"sqldump didn't seem to give us gzip data\"\n end",
"def fuse(_following_chunk)\n nil\n end",
"def gzip_requests; end",
"def deflate(s)\n Snappy.compress(s)\n end",
"def unpack( archive, into = Dir.pwd )\n Dir.chdir( into ) do \n if archive.match( /\\.tar\\.gz\\Z/ ) or archive.match(/\\.tgz\\Z/) then\n tgz = ::Zlib::GzipReader.new( File.open( local_source, 'rb') )\n ::Archive::Tar::Minitar.unpack( tgz, into )\n elsif archive.match( /\\.gem\\Z/ ) then\n subdir = File.basename( archive, \".gem\" )\n Gem::Installer.new( archive ).unpack( subdir )\n else\n raise \"Unable to extract files from #{File.basename( local_source)} -- unknown format\"\n end\n end\n end",
"def sync_archive_resource(resource, version)\n fetch_resource(resource, version) do |archive|\n dest_dir = %W(#{@datadir} #{resource} #{version}).join('/')\n log.debug \"exploding fetched archive #{archive} into data dir: #{dest_dir}\"\n # process the tar.gz\n Gem::Package::TarReader.new(Zlib::GzipReader.open(archive)) do |targz|\n dest = nil\n targz.each do |entry|\n dest = File.join dest_dir, entry.full_name\n # check if any old data exists, could happen if same resource name reused with different format\n if File.directory? dest\n log.debug \"removing existing directory (#{dest} before extracting archive there\"\n FileUtils.rm_rf dest\n elsif File.file? dest.chomp('/')\n log.debug \"removing existing file (#{dest.chomp}) before extracting archive there\"\n File.delete dest.chomp('/')\n end\n # extract\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n # ensure extraction directory exists\n d_dir = File.dirname(dest)\n FileUtils.mkdir_p d_dir unless File.exist? d_dir\n\n File.open dest, 'wb' do |f|\n f.print entry.read\n end\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n dest = nil\n end\n end\n end\n end",
"def compress(stream_or_string)\n streamify(stream_or_string) do |stream|\n output = true\n status = POpen4.popen4(command, \"b\") do |stdout, stderr, stdin, pid|\n begin\n stdin.binmode\n transfer(stream, stdin)\n\n if block_given?\n yield stdout\n else\n output = stdout.read\n end\n\n rescue Exception => e\n raise RuntimeError, \"compression failed\"\n end\n end\n\n if status.exitstatus.zero?\n output\n else\n raise RuntimeError, \"compression failed\"\n end\n end\n end",
"def compress(data)\n compressed = \"\\x10\"\n compressed <<\n Bytestream.from_hex(format('%06X', data.length)).to_b.reverse\n\n index = 0\n w = 0xFFF\n window = ''\n lookahead = ''\n\n loop do\n bits = ''\n check = nil\n current_chunk = ''\n\n 8.times do\n window = (index < w ? data[0, index] : data[(index % w)..index])\n lookahead = data[index..-1]\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n check = window.index(lookahead[0..2])\n if check\n bits << '1'\n length = 2\n store_length = 0\n store_check = 0\n while check && length < 18\n store_length = length\n length += 1\n store_check = check\n check = window.index(lookahead[0, length])\n end\n index += store_length\n store_length -= 3\n position = window.length - 1 - store_check\n store_length = store_length << 12\n current_chunk <<\n Bytestream.from_hex(format('%04X', (store_length | position))).to_b\n else\n index += 1\n bits << '0'\n current_chunk << lookahead[0]\n end\n end # 8.times\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end # loop\n\n compressed << \"\\x00\" until compressed.length % 4 == 0\n compressed\n end",
"def default_compression; end",
"def decompressGifs\n destination=\"./Convert/\"\n search_for=[\"*.gif\"]\n \n @files=readDirectoryFiles(destination,search_for)\n @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)\n @viewport.z=999999\n \n @bar=Sprite.new(@viewport)\n @bar.bitmap=Bitmap.new(Graphics.width,34)\n pbSetSystemFont(@bar.bitmap)\n \n for i in 0...@files.length\n @files[i]=@files[i].gsub(/.gif/) {\"\"}\n end\n \n return false if !Kernel.pbConfirmMessage(_INTL(\"There is a total of #{@files.length} GIF(s) available for conversion. Would you like to begin the process?\"))\n \n for i in 0...@files.length\n file=@files[i]\n \n width=((i*1.000)/@files.length)*Graphics.width\n @bar.bitmap.clear\n @bar.bitmap.fill_rect(0,0,Graphics.width,34,Color.new(255,255,255))\n @bar.bitmap.fill_rect(0,0,Graphics.width,32,Color.new(0,0,0))\n @bar.bitmap.fill_rect(0,0,width,32,Color.new(25*4,90*2,25*4))\n text=[[\"#{i}/#{@files.length}\",Graphics.width/2,2,2,Color.new(255,255,255),nil]]\n pbDrawTextPositions(@bar.bitmap,text)\n \n next if RTP.exists?(\"#{destination}#{file}.png\")\n \n sprite=GifExtra.new(\"#{destination}#{file}.gif\")\n frames=sprite.totalFrames\n width=sprite.bitmap.width\n height=sprite.bitmap.height\n sprite.visible=false \n \n if width < height\n size=height\n elsif height < width\n size=width\n else\n size=width\n end\n \n bitmap=Bitmap.new(size*frames,size)\n x=0\n ox=((size-width)/2)\n oy=((size-height)/2)\n rect=Rect.new(0,0,width,height)\n frames.times do\n bitmap.blt((x*size)+ox,0+oy,sprite.bitmap,rect)\n sprite.update\n x+=1\n end\n bitmap.saveToPng(\"#{destination}#{file}.png\")\n sprite.dispose\n pbWait(1)\n RPG::Cache.clear\n end\n @bar.dispose\n @viewport.dispose\n Kernel.pbMessage(_INTL(\"Done!\"))\nend",
"def unpack file_path\n name = file_path.split(@fs).last\n Dir.chdir Dir.tmpdir\n Dir.mkdir name\n Minitar.unpack(file_path, name)\n Dir.chdir name\n @temp_dir = Dir.pwd\n end"
] | [
"0.7671836",
"0.6596917",
"0.6560826",
"0.65423965",
"0.6363955",
"0.6312613",
"0.6308213",
"0.5971433",
"0.593914",
"0.58782595",
"0.58758765",
"0.58283037",
"0.5741421",
"0.57403594",
"0.57348984",
"0.57114273",
"0.5708162",
"0.5707759",
"0.5696128",
"0.5696128",
"0.56956154",
"0.5656174",
"0.5643393",
"0.563432",
"0.5627637",
"0.5621489",
"0.55848217",
"0.55726784",
"0.5567676",
"0.5563659",
"0.5515849",
"0.5479938",
"0.5457312",
"0.54504895",
"0.5449182",
"0.54350424",
"0.5425033",
"0.5421361",
"0.5417754",
"0.54066455",
"0.53641886",
"0.5361131",
"0.5341429",
"0.5329051",
"0.5320485",
"0.53022856",
"0.5300001",
"0.52997565",
"0.52956855",
"0.52714753",
"0.5265556",
"0.52650344",
"0.5243431",
"0.5243431",
"0.5242335",
"0.52400744",
"0.52272683",
"0.5226676",
"0.5201048",
"0.5194396",
"0.5180796",
"0.51698774",
"0.51627046",
"0.5155189",
"0.51511514",
"0.51500547",
"0.5133093",
"0.5110176",
"0.5107804",
"0.51076967",
"0.51047236",
"0.5098026",
"0.5095802",
"0.5095715",
"0.509383",
"0.50780684",
"0.5072963",
"0.5071955",
"0.5059454",
"0.5056577",
"0.5056577",
"0.5048039",
"0.5045022",
"0.5042394",
"0.5041707",
"0.5033727",
"0.5018606",
"0.5015847",
"0.5012662",
"0.5008263",
"0.50072414",
"0.4999807",
"0.4991428",
"0.49852198",
"0.4984554",
"0.49779335",
"0.49741048",
"0.49740034",
"0.49673745",
"0.49637726",
"0.49575627"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def 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 params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def parameters\n nil\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] | [
"0.7120904",
"0.70538116",
"0.69469863",
"0.6901261",
"0.67348766",
"0.6717708",
"0.66874576",
"0.6676195",
"0.66601187",
"0.65563625",
"0.6525127",
"0.64565873",
"0.64494514",
"0.644928",
"0.64452374",
"0.6433947",
"0.6412815",
"0.6412815",
"0.6391939",
"0.63792473",
"0.63792473",
"0.63738",
"0.6360176",
"0.6354222",
"0.6284756",
"0.6277987",
"0.6245304",
"0.62259704",
"0.62243503",
"0.6223834",
"0.62104595",
"0.62081766",
"0.61759263",
"0.61721593",
"0.6168236",
"0.61587787",
"0.6143901",
"0.6135065",
"0.61204714",
"0.61065775",
"0.60983306",
"0.6073666",
"0.6051939",
"0.6040974",
"0.6036216",
"0.60291374",
"0.6020614",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.6017416",
"0.60161096",
"0.6006702",
"0.6002367",
"0.600212",
"0.5996321",
"0.59943277",
"0.59942585",
"0.59858114",
"0.5982845",
"0.59766084",
"0.5973769",
"0.5968758",
"0.59653395",
"0.5964966",
"0.5964966",
"0.5957481",
"0.59511584",
"0.5951042",
"0.5948871",
"0.59427315",
"0.5930573",
"0.5930121",
"0.5926885",
"0.5923959",
"0.59182686",
"0.5916637",
"0.5913613",
"0.5912174",
"0.5906678",
"0.59059656",
"0.5904252",
"0.5901623",
"0.58983696",
"0.58962476",
"0.589576",
"0.5893608"
] | 0.0 | -1 |
Get a SoftLayer server. | def get(identifier)
return nil if identifier.nil? || identifier == ""
response = service.get_vm(identifier)
bare_metal = false
if response.status == 404 # we didn't find it as a VM, look for a BMC server
response = service.get_bare_metal_server(identifier)
bare_metal = true
end
data = response.body
data['bare_metal'] = bare_metal
new.merge_attributes(data)
rescue Excon::Errors::NotFound
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server\n servers[0]\n end",
"def get_server(id)\n OpenStack::Compute::Server.new(self,id)\n end",
"def get_server(id)\n OpenStack::Compute::Server.new(self,id)\n end",
"def server\n\t\treturn @server ||= self.create_server\n\tend",
"def get_server(id)\n CloudServers::Server.new(self,id)\n end",
"def get_server\n get_general['server']\n end",
"def server\n @server ||= Shelf::Handler.get(options[:server]) || Shelf::Handler.default\n end",
"def server\n @servers.first\n end",
"def server\n @server ||= ScoutScout::Server.first(client_id)\n end",
"def server\n platform.server\n end",
"def current_server\n drb = Thread.current['DRb']\n server = (drb && drb['server']) ? drb['server'] : @primary_server\n raise DRbServerNotFound unless server\n return server\n end",
"def fetch_server(uri)\n @server[uri]\n end",
"def get_server( host, port )\n server_list = servers\n server_list.select{ |s| s[:addr] == host and s[:port] == port.to_i}[0] or raise ArgumentError.new(\"Could not find #{host}:#{port} in #{server_list.inspect}\")\n end",
"def server(service_id, server_id)\n request :get, \"/services/#{service_id}/servers/#{server_id}\"\n end",
"def server\n @@server ||= Server::Cli.new\n #@@server ||= Server::SkypeBot.new\n end",
"def ring_server\n return @ring_server ||= @ring_finger.lookup_ring_any\n end",
"def server\n node.server\n end",
"def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(data)['server']\n end",
"def server(token, server_id)\n request(\n __method__,\n :get,\n \"#{api_base}/guilds/#{server_id}\",\n Authorization: token\n )\n end",
"def find(options = {})\n # FIXME\n #if options[:name]\n # dc = PB::Server.all().select { |d| d.name == options[:name] }.first\n # options[:id] = dc.id if dc\n #end\n raise \"Unable to locate the server named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_server, server_id: options[:id]\n PB::Server.new(response)\n end",
"def this_server\n if (s = @server)\n s\n elsif (t = @this)\n t.opts[:server] || :default\n else\n model.dataset.opts[:server] || :default\n end\n end",
"def this_server\n if (s = @server)\n s\n elsif (t = @this)\n t.opts[:server] || :default\n else\n model.dataset.opts[:server] || :default\n end\n end",
"def available_server\n @context.server.each do |server_name|\n begin\n return Rack::Handler.get(server_name.downcase)\n rescue LoadError\n rescue NameError\n end\n end\n raise \"servers #{@context.server.join(', ')} not found\"\n end",
"def server\r\n\t\t@usr_server\r\n\tend",
"def server\n self\n end",
"def server_info\n return @server_info if @server_info.present?\n response = request :get, SERVER_INFO_PATH\n @server_info = response.error? ? nil :\n response.result.with_indifferent_access\n end",
"def current_server\n @_current_server\n end",
"def current_server\n @_current_server\n end",
"def conn(server=:default)\n @conns[@servers[server]]\n end",
"def get_server(target_type)\n return api_call('get-queue',{'apiKey' => @@_api_key,'targetType' => target_type});\n end",
"def ring_server\n return @ring_server unless @ring_server.nil?\n @ring_server = @ring_finger.lookup_ring_any\n end",
"def http_servers\r\n HTTPServersController.instance\r\n end",
"def server\n @database.server\n end",
"def server\n @database.server\n end",
"def server\n @_server ||= case options.fetch(:type, :tcp)\n when :tcp\n TCPServer.new options.fetch(:host, \"127.0.0.1\"),\n options.fetch(:port, 2010)\n when :unix\n UNIXServer.new options.fetch(:path)\n when :pipe\n FakeServer.new options.fetch(:pipe)\n end\n end",
"def create_server\n\t\treturn Hglib::Server.new( self.path.to_s )\n\tend",
"def server(id)\n id = id.resolve_id\n return @servers[id] if @servers[id]\n\n LOGGER.out(\"Resolving server #{id}\")\n begin\n response = API::Server.resolve(token, id)\n rescue Discordrb::Errors::NoPermission\n return nil\n end\n server = Server.new(JSON.parse(response), self)\n @servers[id] = server\n end",
"def get_server(name=nil)\n if name\n begin\n selected_server = get_server_by_algorithm { |l| name }\n return selected_server == name\n rescue\n return false\n end\n else\n # Mark a random server in-use.\n return get_server_by_algorithm { |l| l[rand(l.length)] }\n end\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def vcap_dt_server\n @services.find_service(DT_SERVICE_NAME)[CREDENTIALS_KEY][SERVER_KEY]\n end",
"def server\n @server.to_s\n end",
"def srvhost\n datastore['SRVHOST']\n end",
"def find_server( serverspec=nil )\n\t\tserver = nil\n\t\tservers = Mongrel2::Config.servers\n\n\t\traise \"No servers are configured.\" if servers.empty?\n\n\t\t# If there's only one configured server, just make sure if a serverspec was given\n\t\t# that it would have matched.\n\t\tif servers.length == 1\n\t\t\tserver = servers.first if !serverspec ||\n\t\t\t\tservers.first.values_at( :uuid, :default_host, :name ).include?( serverspec )\n\n\t\t# Otherwise, require an argument and search for the desired server if there is one\n\t\telse\n\t\t\traise \"You must specify a server uuid/hostname/name when more \" +\n\t\t\t \"than one server is configured.\" if servers.length > 1 && !serverspec\n\n\t\t\tserver = servers.find {|s| s.uuid == serverspec } ||\n\t\t\t servers.find {|s| s.default_host == serverspec } ||\n\t\t\t servers.find {|s| s.name == serverspec }\n\t\tend\n\n\t\traise \"No servers match '#{serverspec}'\" unless server\n\n\t\treturn server\n\tend",
"def get_zapp_server\n return self.plant_attributes[self.plant.intern][self.env.intern][:host], self.plant_attributes[self.plant.intern][self.env.intern][:soap_port]\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def use_server(ds)\n @server ? ds.server(@server) : ds\n end",
"def use_server(ds)\n @server ? ds.server(@server) : ds\n end",
"def test_server\n TEST_SERVER\n end",
"def get_incoming_server\n @incoming_server\n end",
"def get_devserver\n devserver = all_info[:devserver]\n if devserver!=nil\n return devserver.split(':').last\n end\n end",
"def servers_detailed()\n return get_request(address(\"/servers/detail\"), @token)\n end",
"def find_server\n # we assume that guest process and owner process without a InProc server\n # have to start DRb service. so we call it first\n if !(@is_owner_process && @is_in_proc_server)\n DRb.start_service \n end\n\n finger = Rinda::RingFinger.new nil, DiscoverableServer::DEFAULT_PORT\n ring_server = finger.lookup_ring_any\n @server_uri = ring_server.__drburi\n end",
"def server(config = nil)\n if config.nil?\n @server || try_ancestor(:server)\n else\n @server =\n if config.is_a?(Hash)\n Server.new(config)\n else\n config\n end\n end\n end",
"def server_host\n Socket.gethostname\n end",
"def [](key)\r\n return @servers[key]\r\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\r\n @server = Server.find(params[:id])\r\n end",
"def server_url\n \"http://#{server_host}:#{server_port}\"\n end",
"def set_server\n @gameserver = Gameserver.find(params[:id])\n end",
"def set_server\n @gameserver = Gameserver.find(params[:id])\n end",
"def servers # Only in Ruby API (1.3 compatible)\n\t\t@settings.servers\n\tend",
"def this_server\n @this_server ||= db[self.class.schema_and_table(finder_result)]\n end",
"def server\n '127.0.0.1'\n end",
"def endpoint\n ENDPOINT[server]\n end",
"def select\n sockets = @servers.map {|x| x.socket}.compact\n socket = Kernel.select(sockets, nil, nil, 1)\n \n if socket == nil\n return nil\n else\n socket = socket[0][0]\n return @servers.find {|x| x.socket.__id__ == socket.__id__}\n end\n end",
"def server_name\n return @server_name\n end",
"def get_server_id\n return nil\n end",
"def server\n uri = \"#{options[:use_ssl] ? \"https\" : \"http\"}://#{Blupee.config.api_server}\"\n end",
"def get_server_version\n server_info[:server_version]\n end",
"def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end",
"def listserv\n listservs.first\n end",
"def live_server\n live_server? and @@live_server\n end",
"def prod_server\n PROD_SERVER\n end",
"def get_outgoing_server\n @outgoing_server\n end",
"def srvport\n datastore['SRVPORT']\n end",
"def get_last_server\n return get_server_by_algorithm { |l| l.last }\n end",
"def server_one\n\t\tServerOne.find(server_one_id)\n\tend",
"def dns_get_srv(name)\n addr, port = '.', 0\n\n DNSRuby::DNS.open do |dns|\n srv = dns.getresource(name, DNSRuby::Types.SRV)\n addr, port = srv.target.to_s, srv.port\n end\n\n (addr == '.' || port == 0) ? [nil, nil] : [addr, port]\nend",
"def default_server\n server?(:default)\n end",
"def client\n Dalli::Client.new(servers, options)\n end",
"def server\n @bot.server\n end",
"def server\n @server ||= DATPages::Appium::AppiumServer.new\n end",
"def server_selector\n @server_selector ||= ServerSelector.get(read_preference || database.server_selector)\n end",
"def server(api_method=nil)\n server = BigbluebuttonRails.configuration.select_server.call(self, api_method)\n end",
"def server_info\n check_connection\n @protocol.server_info\n end",
"def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end",
"def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end",
"def srv\n @service_finder\n end",
"def get_servers\n\t\t\tbegin\n\t\t\t\tresp = @rs_conn.get('/servers')\n\n\t\t\t\t# 200 Success :: anything else is failure\n\t\t\t\tunless resp.code == \"200\"\n\t\t\t\t\traise \"Error requesting server list. Error code #{resp.code}\"\n\t\t\t\tend\n\t\t\t\t# Convert the output to json\n\t\t\t\tserver_list = JSON.parse(resp.body)\n\t\t\t\treturn server_list\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend",
"def server_name\n return @forwarded_server || @config[:ServerName]\n end",
"def server_ipv4\n ipv4_list = YAML::load_file(File.dirname(__FILE__) + '/whois/data/ipv4.yaml')\n server = server_with_hash(ipv4_list)\n unless server.kind_of? Server::Server\n raise WhoisException.new(\"no server found for this IPv4 : #{self.ip}\")\n else\n return server\n end\n end",
"def getserverurl\r\n return getvalue(@@SERVER_URL)\r\n end",
"def servers\n Vultr::Resource::Server.new(@faraday)\n end",
"def getServerName(servers, hostname, port)\n servername = nil\n upperCaseHostname = hostname.upcase;\n for server in servers\n hostFromServerName, portFromServerName = getHostPortFromServerName(server)\n hostFromServerName = hostFromServerName.upcase\n if hostFromServerName == upperCaseHostname and portFromServerName == port\n servername = server\n break\n end\n end\n raise ArgumentError, \"Server %s:%d not online\" % [hostname, port] unless servername\n return servername\nend",
"def first_db_host\n @db_host ||= find_servers(:roles => :db).map(&:to_s).first\nend",
"def view\n @server = Server.find(params[:id])\n end"
] | [
"0.72764385",
"0.726068",
"0.726068",
"0.71155316",
"0.7094219",
"0.70935243",
"0.7043799",
"0.6905586",
"0.6757211",
"0.6651028",
"0.659919",
"0.65268624",
"0.65133137",
"0.6488324",
"0.6394069",
"0.6328231",
"0.6255257",
"0.62434775",
"0.61879516",
"0.61154723",
"0.60722744",
"0.60722744",
"0.6069733",
"0.60617375",
"0.604841",
"0.5993825",
"0.5989968",
"0.5989968",
"0.5987987",
"0.5959294",
"0.5925516",
"0.59202236",
"0.5908512",
"0.5908512",
"0.5905119",
"0.58885574",
"0.5883164",
"0.5878954",
"0.587865",
"0.587865",
"0.5858246",
"0.5847932",
"0.58462864",
"0.5846097",
"0.5817098",
"0.58077854",
"0.58077854",
"0.58077854",
"0.58077854",
"0.58077854",
"0.5790413",
"0.5790413",
"0.5788223",
"0.5774751",
"0.5772125",
"0.57624507",
"0.57496107",
"0.57470286",
"0.5736698",
"0.57285005",
"0.57056546",
"0.569697",
"0.5696262",
"0.5693908",
"0.5693908",
"0.569379",
"0.5683609",
"0.567514",
"0.56723696",
"0.5672259",
"0.56636655",
"0.5656673",
"0.5651268",
"0.563893",
"0.5638871",
"0.5623576",
"0.5608909",
"0.5580058",
"0.5579764",
"0.5577823",
"0.55738026",
"0.5569832",
"0.5557925",
"0.5552865",
"0.5543684",
"0.55394816",
"0.55311704",
"0.5530228",
"0.55288404",
"0.552751",
"0.5525528",
"0.5525528",
"0.55078256",
"0.55054104",
"0.5503099",
"0.5496113",
"0.5494138",
"0.54819787",
"0.54802406",
"0.54730874",
"0.54700285"
] | 0.0 | -1 |
Get a SoftLayer server by ip. | def get_by_ip(ip)
return nil if ip.blank?
response = service.get_virtual_guest_by_ip(ip)
bare_metal = false
if response.status == 404 # we didn't find it as a VM, look for a BMC server
response = service.get_bare_metal_server_by_ip(ip)
bare_metal = true
end
data = response.body
data['bare_metal'] = bare_metal
new.merge_attributes(data)
rescue Excon::Errors::NotFound
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_server( host, port )\n server_list = servers\n server_list.select{ |s| s[:addr] == host and s[:port] == port.to_i}[0] or raise ArgumentError.new(\"Could not find #{host}:#{port} in #{server_list.inspect}\")\n end",
"def get_server(id)\n OpenStack::Compute::Server.new(self,id)\n end",
"def get_server(id)\n OpenStack::Compute::Server.new(self,id)\n end",
"def get_server(id)\n CloudServers::Server.new(self,id)\n end",
"def server\n servers[0]\n end",
"def get(ip)\n return @cache[ip] if @cache.key?(ip)\n url = format(URL_FORMAT, ip)\n response = Curl.get(url).body_str\n ipapi = SimpleGeolocator::IPAPIResponse.new(Oj.load(response))\n @cache[ip] = ipapi\n end",
"def fetch_server(uri)\n @server[uri]\n end",
"def server\n @servers.first\n end",
"def server(service_id, server_id)\n request :get, \"/services/#{service_id}/servers/#{server_id}\"\n end",
"def find_host_by_id(id)\n begin\n json_response = servers_interface.get(id.to_i)\n return json_response['server']\n rescue RestClient::Exception => e\n if e.response && e.response.code == 404\n print_red_alert \"Host not found by id #{id}\"\n exit 1\n else\n raise e\n end\n end\n end",
"def server_ipv4\n ipv4_list = YAML::load_file(File.dirname(__FILE__) + '/whois/data/ipv4.yaml')\n server = server_with_hash(ipv4_list)\n unless server.kind_of? Server::Server\n raise WhoisException.new(\"no server found for this IPv4 : #{self.ip}\")\n else\n return server\n end\n end",
"def private_ip_of(server)\n server[:cloud][:private_ips].first rescue server[:ipaddress]\n end",
"def my_ip\n get(\"/tools/myip\")\n end",
"def dns_get_srv(name)\n addr, port = '.', 0\n\n DNSRuby::DNS.open do |dns|\n srv = dns.getresource(name, DNSRuby::Types.SRV)\n addr, port = srv.target.to_s, srv.port\n end\n\n (addr == '.' || port == 0) ? [nil, nil] : [addr, port]\nend",
"def [](key)\r\n return @servers[key]\r\n end",
"def local_ip_2_host (ip)\n\t\tputs \"Reverse DNS lookup from the local host repository\" if @verbose\n\t\tip=ip.strip unless ip.nil?\n\t\tif @known_hosts.key?(ip)\n\t\t\treturn @known_hosts[ip]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend",
"def public_ip_of(server)\n server[:cloud][:public_ips].first rescue server[:ipaddress]\n end",
"def ise_host_get(ip_address)\n post_data = {:ip_address => ip_address}\n nessus_rest_post(\"connectors/cisco-ise/#{ip_address}\")\n end",
"def get_server\n get_general['server']\n end",
"def server_ipv6\n ipv6_list = YAML::load_file(File.dirname(__FILE__) + '/whois/data/ipv6.yaml')\n server = server_with_hash(ipv6_list)\n unless server.kind_of? Server::Server\n raise WhoisException.new(\"no server found for this IPv6 : #{self.ip}\")\n else\n return server\n end\n end",
"def find(options = {})\n # FIXME\n #if options[:name]\n # dc = PB::Server.all().select { |d| d.name == options[:name] }.first\n # options[:id] = dc.id if dc\n #end\n raise \"Unable to locate the server named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_server, server_id: options[:id]\n PB::Server.new(response)\n end",
"def get_server_id_by_private_ip(private_ip)\n @compute.servers.each do |server|\n network_name = server.addresses.keys.reduce\n server.addresses.each do |address|\n if (address.include? network_name and address.length == 2)\n if address[1].length >= 1\n return server.id if address[1][0].addr == private_ip\n end\n end\n end\n end\n return String.new\n end",
"def lookup_device(ip)\n\t\t@map[ip]\n\tend",
"def server_by_key(key)\n ret = Lib.memcached_server_by_key(@struct, key)\n if ret.is_a?(Array)\n check_return_code(ret.last)\n inspect_server(ret.first)\n else\n check_return_code(ret)\n end\n rescue ABadKeyWasProvidedOrCharactersOutOfRange\n end",
"def read_host_ip(ip)\n\t UDPSocket.open do |s|\n\t if(ip.kind_of?(Array))\n\t s.connect(ip.last, 1)\n\t else\n\t s.connect(ip, 1)\n\t end\n\t s.addr.last\n\t end\n\tend",
"def get_server(name=nil)\n if name\n begin\n selected_server = get_server_by_algorithm { |l| name }\n return selected_server == name\n rescue\n return false\n end\n else\n # Mark a random server in-use.\n return get_server_by_algorithm { |l| l[rand(l.length)] }\n end\n end",
"def select\n sockets = @servers.map {|x| x.socket}.compact\n socket = Kernel.select(sockets, nil, nil, 1)\n \n if socket == nil\n return nil\n else\n socket = socket[0][0]\n return @servers.find {|x| x.socket.__id__ == socket.__id__}\n end\n end",
"def GetIpFromId(id)\n #puts \"Error. GetIpFromId not defined\"\n #exit 1\n return @rstack.GetIpFromId(id)\n end",
"def hostip(ip)\n if GeoLocation::dev.nil? || GeoLocation::dev.empty?\n url = \"http://api.hostip.info/?ip=#{ip}\"\n uri = URI.parse(url) \n data_from_hostip_http_response(ip, Net::HTTP.get_response(uri).body)\n else\n data_from_maxmind_http_response(ip, GeoLocation::dev)\n end\n end",
"def ip\n ssh.exec!(\"/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'\").chomp\n end",
"def lookup(ip)\n uri = Addressable::URI.parse(\"https://ip-api.com/xml/#{ip}\")\n res = Net::HTTP.get_response(uri.normalize)\n MetaData.parse(res.body, single: true).freeze\n end",
"def server_with_hash(ip_hash)\n # Sort by mask of Ip Range\n arr_tmp = ip_hash.sort{|b,c| c[0][/\\/(.+)/, 1].to_i <=> b[0][/\\/(.+)/, 1].to_i}\n arr_tmp.each do |l|\n ip_range = IPAddr.new l[0]\n if ip_range.include? self.ip\n if l[1].nil? or l[1].empty?\n raise WhoisException.new(\"no server of Whois is define for the IP #{self.ip}. Sorry\")\n end\n return Object.instance_eval(\"Server::#{l[1]}.new\")\n end\n end\n end",
"def getServerName(servers, hostname, port)\n servername = nil\n upperCaseHostname = hostname.upcase;\n for server in servers\n hostFromServerName, portFromServerName = getHostPortFromServerName(server)\n hostFromServerName = hostFromServerName.upcase\n if hostFromServerName == upperCaseHostname and portFromServerName == port\n servername = server\n break\n end\n end\n raise ArgumentError, \"Server %s:%d not online\" % [hostname, port] unless servername\n return servername\nend",
"def server_ip_address\n $tracer.trace(__method__)\n begin\n return meta.name(\"WT.sv\").content.strip\n rescue\n return \"Unknown IP Address\"\n end\n end",
"def server\n\t\treturn @server ||= self.create_server\n\tend",
"def server\n @server ||= ScoutScout::Server.first(client_id)\n end",
"def ip\n @ip ||= Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address\n end",
"def srvhost\n datastore['SRVHOST']\n end",
"def find_server(id: nil, name: nil)\n if id\n $bot.servers[id]\n elsif name\n $bot.servers.values.find{ |s| s.name.downcase.include?(name.downcase) } \n else\n nil\n end\nrescue\n nil\nend",
"def find_private_ip\n ip_addresses = interface_addresses\n ip_addresses.each do |ip|\n if ip.start_with?(\"192\") || ip.start_with?(\"10\")\n return ip\n end\n end\n return nil\n end",
"def server(id)\n id = id.resolve_id\n return @servers[id] if @servers[id]\n\n LOGGER.out(\"Resolving server #{id}\")\n begin\n response = API::Server.resolve(token, id)\n rescue Discordrb::Errors::NoPermission\n return nil\n end\n server = Server.new(JSON.parse(response), self)\n @servers[id] = server\n end",
"def boot_server\n # if we don't manage tftp at all, we dont create a next-server entry.\n return unless tftp?\n\n # first try to ask our TFTP server for its boot server\n bs = tftp.bootServer\n # if that failed, trying to guess out tftp next server based on the smart proxy hostname\n bs ||= URI.parse(subnet.tftp.url).host\n # now convert it into an ip address (see http://theforeman.org/issues/show/1381)\n ip = to_ip_address(bs) if bs.present?\n return ip unless ip.nil?\n\n failure _(\"Unable to determine the host's boot server. The DHCP Capsule failed to provide this information and this subnet is not provided with TFTP services.\")\n rescue => e\n failure _(\"failed to detect boot server: %s\") % e\n end",
"def conn(server=:default)\n @conns[@servers[server]]\n end",
"def server_get_private_ip(server_name)\n private_ip = ''\n if server_exist?(server_name)\n server = find_match(@compute.servers, server_name)\n network_name = server.addresses.keys.reduce\n server.addresses.each do |address|\n if (address.include? network_name and address.length == 2)\n if address[1].length >= 1\n Puppet.debug \"found private ip = #{address[1][0].inspect}\"\n private_ip = address[1][0].addr\n end\n end\n end\n end\n return private_ip\n end",
"def get_host(fqdn)\n foreman('GET', \"/api/hosts/#{fqdn}\")\n end",
"def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end",
"def get_server_ip(boxes, hostname='')\n default_server_ip = nil\n boxes.each_with_index do |box, i|\n if not box['role'].nil? and box['role'] == 'server'\n ip = box['ip'] ? box['ip'] : \"#{$ip_prefix}.#{i+1}#{i+1}\"\n default_server_ip = ip if default_server_ip.nil?\n if hostname == \"#{box['name']}-%02d\" % i\n return ip\n end\n end\n end\n return default_server_ip\nend",
"def server_get_public_ip(server_name)\n public_ip = ''\n if server_exist?(server_name)\n server = find_match(@compute.servers, server_name)\n network_name = server.addresses.keys.reduce\n server.addresses.each do |address|\n if (address.include? network_name and address.length == 2) #TODO: research why is this 'private' for a public ip?\n if address[1].length >= 2\n Puppet.debug \"found floating ip = #{address[1][1].inspect}\"\n public_ip = address[1][1].addr\n end\n end\n end\n end\n return public_ip\n end",
"def interface_by_ip(ip)\n return `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n end",
"def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend",
"def get(ip)\n client = TCPSocket.new(\"#{ip}\", 1174)\n Signal.trap(\"INT\") {\n puts \"\\nCaught interupt signal, client quit\"\n exit\n }\n return client.read\n end",
"def search_host\n begin\n if @host_search\n @host = Resolv.getname self.ip.to_s\n else\n @host = nil\n end\n rescue Resolv::ResolvError\n @host = nil\n end\n end",
"def server\n @server ||= Shelf::Handler.get(options[:server]) || Shelf::Handler.default\n end",
"def primary_institution_from_ip\n Institutions.with_ip(request.remote_ip).first unless request.nil?\n end",
"def view\n @server = Server.find(params[:id])\n end",
"def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend",
"def server_port(id = '__default__')\n @servers[id].port\n end",
"def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end",
"def get_server_public_ip(server, cached_rules=nil)\n return nil unless server\n\n # find the public ip\n nic = get_server_default_nic(server) || {}\n if nic['type'] == 'Virtual'\n ssh_rule = get_ssh_port_forwarding_rule(server, cached_rules)\n ssh_rule ? ssh_rule['ipaddress'] : nil\n else\n nic['ipaddress']\n end\n end",
"def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\"\r\n end",
"def vserver(name)\n begin\n @name=name\n @vserver_hash=get_endpoint(\"vservers/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end",
"def locate\n @result ||= self.class.get(\n \"/\",\n :query => {:ip => @ip},\n :format => :xml\n )['HostipLookupResultSet']['gml:featureMember']\n end",
"def set_nameserver(domain, ip)\n adminrun(\"netsh\", \"interface ip set dns \\\"VMware Network Adapter VMnet8\\\" static #{ip}\")\n end",
"def ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end",
"def findByAddr(ip, port)\n @peersByAddr[ip + port.to_s]\n end",
"def server_host\n Socket.gethostname\n end",
"def ip\n self.IP\n end",
"def get_nameserver (host)\n\t\tputs \"Retrieve the first authoritative name server for: #{host}\" if @verbose\n\t\tbegin\n\t\t\tdomain=get_domain_root(host)\n\t\t\tw=Wmap::Whois.new\n\t\t\tns = w.query(domain).nameservers.map! { |x| x.name }\n\t\t\tif ns.empty?\n\t\t\t\tputs \"No name server found for domain root: #{domain}\" if @verbose\n\t\t\t\treturn nil\n\t\t\telse\n\t\t\t\treturn ns.first\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method get_nameservers for #{host}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def private_ip_address\n private_ip_addresses.first\n end",
"def decrypt_server_ip(serverip)\n ipkey = 0x03081e11\n decodedip = (serverip ^ ipkey).to_s(16).rjust(8, '0')\n IPAddr.new(decodedip.hex, Socket::AF_INET).to_s\nend",
"def current_server\n drb = Thread.current['DRb']\n server = (drb && drb['server']) ? drb['server'] : @primary_server\n raise DRbServerNotFound unless server\n return server\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def ip\n unless @vm\n warn 'No Vm assigned to locate IP'\n return\n end\n @ip ||= detect_ip\n end",
"def show\n @ip = Ip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end",
"def vcap_dt_server\n @services.find_service(DT_SERVICE_NAME)[CREDENTIALS_KEY][SERVER_KEY]\n end",
"def host_ip\n Socket.gethostbyname(@backend.host)[3].unpack('CCCC') rescue [0, 0, 0, 0]\n end",
"def serverup?(ip, port)\n http = Net::HTTP.start(ip, port, {open_timeout:3, read_timeout:3})\n response = http.send_request('GET', '/')\n JSON.parse(response.body)\nrescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n nil\nend",
"def get_ip_address\n rpc_get_fact_direct('host_ip')\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def get_ip_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /inet addr:([\\d\\.]+)/ and $1 != '127.0.0.1')\n end\n end\n return nil\nend",
"def listIPs\n MU::Cloud::AWS::Server.getAddresses(cloud_desc).first\n end",
"def ip\n nil\n end",
"def find_host_only_adapter\n @machine.provider.driver.read_network_interfaces.each do |adapter, opts|\n if opts[:type] == :hostonly\n @machine.provider.driver.read_host_only_interfaces.each do |interface|\n if interface[:name] == opts[:hostonly]\n return adapter, interface[:ip]\n end\n end\n end\n end\n\n nil\n end",
"def server(api_method=nil)\n server = BigbluebuttonRails.configuration.select_server.call(self, api_method)\n end",
"def member_get_ip(pool_member)\n server_ip = begin\n if pool_member.attribute?('cloud')\n if node.attribute?('cloud') && (pool_member['cloud']['provider'] == node['cloud']['provider'])\n pool_member['cloud']['local_ipv4']\n else\n pool_member['cloud']['public_ipv4']\n end\n else\n pool_member['ipaddress']\n end\n end\n server_ip\nend",
"def query_server_details(server, port = 3979)\n packet = @udp.query(:udp_client_find_server, server, port)\n packet.payload\n end",
"def get_country(ip=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'ip', ip)\n\t\t\tclient.queue_service_action_call('system', 'getCountry', 'KalturaCountry', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def lookup_server_uri\n server_lookup_attempts.times do\n first_alive_listing = service_directory.all_listings_for(service).find do |listing|\n host_alive?(listing.try(:address))\n end\n\n if first_alive_listing\n host = first_alive_listing.try(:address)\n port = first_alive_listing.try(:port)\n @stats.server = [port, host]\n return \"tcp://#{host}:#{port}\"\n end\n\n host = options[:host]\n port = options[:port]\n\n if host_alive?(host)\n @stats.server = [port, host]\n return \"tcp://#{host}:#{port}\"\n end\n\n sleep(1.0 / 100.0)\n end\n\n fail \"Host not found for service #{service}\"\n end",
"def ip\n if (ip = @host.at('tag[name=host-ip]'))\n ip.inner_text\n end\n end",
"def get_host(opts)\n if opts.kind_of? ::Mdm::Host\n return opts\n elsif opts.kind_of? String\n raise RuntimeError, \"This invocation of get_host is no longer supported: #{caller}\"\n else\n address = opts[:addr] || opts[:address] || opts[:host] || return\n return address if address.kind_of? ::Mdm::Host\n end\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n\n address = Msf::Util::Host.normalize_host(address)\n return wspace.hosts.find_by_address(address)\n }\n end",
"def local_ip\n UDPSocket.open {|s| s.connect(\"64.233.187.99\", 1); s.addr.last}\n end",
"def getIp()\n return @ip\n\tend",
"def get_server(target_type)\n return api_call('get-queue',{'apiKey' => @@_api_key,'targetType' => target_type});\n end",
"def local_host_2_ip (host)\n\t\tputs \"DNS lookup from the local host repository\" if @verbose\n\t\thost=host.strip unless host.nil?\n\t\tif @known_hosts.key?(host)\n\t\t\treturn @known_hosts[host]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def set_server\r\n @server = Server.find(params[:id])\r\n end"
] | [
"0.67086923",
"0.65305895",
"0.65305895",
"0.630614",
"0.6266668",
"0.61623293",
"0.603519",
"0.60301644",
"0.5928978",
"0.591991",
"0.58517724",
"0.5834359",
"0.5834293",
"0.5831503",
"0.5737879",
"0.57264936",
"0.5725896",
"0.57012063",
"0.5679588",
"0.56718856",
"0.5648056",
"0.56257534",
"0.5620542",
"0.5614522",
"0.5582443",
"0.5577699",
"0.5572156",
"0.5569514",
"0.55669224",
"0.55438817",
"0.5485643",
"0.5480536",
"0.5469388",
"0.5465606",
"0.5463875",
"0.54580504",
"0.5451239",
"0.5437865",
"0.5427074",
"0.5422225",
"0.54158497",
"0.5412477",
"0.5407629",
"0.54053694",
"0.5400215",
"0.5391246",
"0.53871304",
"0.535471",
"0.53515255",
"0.5332782",
"0.53284657",
"0.5324179",
"0.53219885",
"0.5313775",
"0.5313723",
"0.53063935",
"0.530168",
"0.5300664",
"0.5264375",
"0.52571636",
"0.5251659",
"0.52488536",
"0.52377504",
"0.52234226",
"0.5208934",
"0.5199679",
"0.5196658",
"0.51886964",
"0.5178725",
"0.51775676",
"0.5166903",
"0.5163563",
"0.5148735",
"0.514621",
"0.5142977",
"0.51403785",
"0.51295775",
"0.5128957",
"0.5128777",
"0.5128777",
"0.5128777",
"0.5128777",
"0.5128777",
"0.512487",
"0.5117786",
"0.5116377",
"0.51077974",
"0.5106801",
"0.5106176",
"0.5105704",
"0.5103417",
"0.5102985",
"0.5100632",
"0.51005834",
"0.50964254",
"0.50934976",
"0.50902194",
"0.50883526",
"0.5084303",
"0.5081166"
] | 0.64933115 | 3 |
done == success or failure | def fetch_done(task)
@fetch_worker_queue.remove_from_input(task)
@current_connections.delete(task.ip)
if task.failure
@node_manager.log_error task.failure, task.http_url.to_s.inspect
else
@node_manager.log :success, task.http_url.to_s.inspect
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done?; true end",
"def done?; end",
"def done; end",
"def do_success; end",
"def done\n end",
"def done\n end",
"def done\r\n @done = true\r\n end",
"def done\n @done = true\n end",
"def done!\n @done = true\n end",
"def finished?\n failed? or successful? or skipped?\n end",
"def success; end",
"def success; end",
"def done\nend",
"def done?\n @done \n end",
"def success?() end",
"def done\n @status = true\n end",
"def done?\r\n @done\r\n end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def done\n @done\n end",
"def done?\n self.done\n end",
"def success?\n finished? and !exception\n end",
"def finish(_result)\n end",
"def done?\n waiting || verified || rejected\n end",
"def failed?; failed_to_start? || (@success == false) end",
"def finish\n @Done = true \n end",
"def done?\n @done\n end",
"def done?\n @done\n end",
"def done?\n false\n end",
"def success?\n completed? && !error?\n end",
"def done?\n\t\tstatus == DONE\n\tend",
"def set_done\n @done = true\n end",
"def finished?; @finished; end",
"def success?(*) end",
"def finished; end",
"def done?\n @done\n end",
"def done?\n @done\n end",
"def done!\n # Do nothing\n end",
"def done!\n # Do nothing\n end",
"def done?\n !!status && (!immediate || called)\n end",
"def action_complete() self.finished = true; end",
"def succeed\n # no-op\n end",
"def done?\n # Fill this in\n end",
"def succeeded?; state == 'succeeded'; end",
"def succeeded?; state == 'succeeded'; end",
"def done\n @done.each &:call\n end",
"def done\n # Do nothing.\n end",
"def failed!\n @success = false\n end",
"def finished=(_arg0); end",
"def failed?\n not @ok\n end",
"def done?\n return false if status.nil?\n \"done\".casecmp(status).zero?\n end",
"def success!\n end",
"def record result; @success = true; end",
"def finished?\n self.completed? || self.failed?\n end",
"def failed?; state == 'failed'; end",
"def failed?; state == 'failed'; end",
"def success(*args); end",
"def pass(_)\n @passed = true\n @done = true\n end",
"def done?\n return status if [true, false].include? status\n\n status == :DONE\n end",
"def do_failure; end",
"def success\n end",
"def complete?\n result? || error?\n end",
"def done?\n @state == :done\n end",
"def success?\n end",
"def success(job)\n complete()\n end",
"def done?\n !!@exitstatus\n end",
"def run_succeeded; end",
"def done?\n return @done\n end",
"def finished?\n ['success', 'failed'].include? status\n end",
"def check_ending(_result)\n end",
"def ok?\n run unless ran?\n\n @status.success?\n end",
"def success?\n got.equal?(true)\n end",
"def successful\n count(&:ok?)\n end",
"def succeeded?\n finished? && !discarded?\n end",
"def success?\n got.equal?(true)\n end",
"def failed?\n !success?\n end",
"def success!\n @success = true\n end",
"def finish\n true\n end",
"def completed()\n end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def success?\n false\n end",
"def success?\n false\n end",
"def wait_done\n sleep 0.01 until done?\n end",
"def done?(_syncP = false, _nth = :all, _mode = :and)\n return checkRunStatus([:finished, :failed], _syncP, _nth, _mode) ;\n end",
"def success?; terminal_flag == :success end",
"def success?; terminal_flag == :success end",
"def fail!\n @success = false\n end",
"def fail!\n @success = false\n end",
"def done?\n done == 'Y'\n end",
"def done\n puts \"Done\"\n end"
] | [
"0.8262399",
"0.79952",
"0.78558743",
"0.7292884",
"0.7274515",
"0.7274515",
"0.7247886",
"0.724128",
"0.72387046",
"0.7153625",
"0.70842814",
"0.70842814",
"0.7056095",
"0.7053715",
"0.7041289",
"0.7020785",
"0.70106906",
"0.69784766",
"0.69784766",
"0.69784766",
"0.69784766",
"0.69784766",
"0.69784766",
"0.6966079",
"0.69407225",
"0.69288534",
"0.6914167",
"0.69027656",
"0.68840796",
"0.68778026",
"0.6868419",
"0.6868419",
"0.6845234",
"0.68363154",
"0.68046695",
"0.67884666",
"0.67769754",
"0.67375433",
"0.6730878",
"0.6719326",
"0.6719326",
"0.66939604",
"0.66939604",
"0.66805595",
"0.6679697",
"0.6660391",
"0.6618109",
"0.66145194",
"0.66145194",
"0.6600999",
"0.6598565",
"0.6594572",
"0.65740955",
"0.6566223",
"0.65638995",
"0.6562583",
"0.65572613",
"0.655461",
"0.6549201",
"0.6549201",
"0.65488",
"0.65455955",
"0.6538741",
"0.6531396",
"0.6527632",
"0.65089077",
"0.6505042",
"0.6479403",
"0.64531904",
"0.6445731",
"0.64392763",
"0.64285344",
"0.64284086",
"0.63939506",
"0.639356",
"0.6390217",
"0.63782275",
"0.6377082",
"0.6371657",
"0.63703835",
"0.63605267",
"0.6356884",
"0.63508976",
"0.63395214",
"0.63395214",
"0.63395214",
"0.63395214",
"0.63395214",
"0.63395214",
"0.63395214",
"0.63395214",
"0.6332065",
"0.6332065",
"0.63284737",
"0.63246846",
"0.6317568",
"0.6317568",
"0.6303033",
"0.6303033",
"0.6289288",
"0.6283214"
] | 0.0 | -1 |
Returns the next HttpUrl that is neither invalid nor already fetched. If there are no more URLs, it returns +nil+. | def get_next_url
while true
unless url = @node_manager.dequeue_url
# there are currently no further URLs in the queue
return nil
end
unless http_url = HttpUrl.parse(url)
@node_manager.log_error :invalid_url, url.inspect
next
end
if @node_manager.has_file?(http_url.to_filename)
@node_manager.log :skip_url__already_fetched, url.inspect
next
end
return http_url
end # while
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_url\n while true\n unless url = dequeue_url()\n # there are currently no further URLs in the queue\n return nil\n end\n\n unless http_url = HttpUrl.parse(url)\n log_error :invalid_url, url.inspect \n next\n end\n\n if has_file?(http_url.to_filename) \n log :skip_url__already_fetched, url.inspect\n next\n end\n\n return http_url\n end # while\n end",
"def next\n perform_get(links.next, self.class)\n end",
"def next_link(headers)\n key = 'link' # todo: can be 'Link' as well\n return nil unless headers.member? key\n link_tuple = LinkHeader.parse(headers[key]).links.select { |l| l.attr_pairs[0][1] == 'next' }\n link_tuple.size.zero? ? nil : link_tuple[0].href\n end",
"def next\n return nil unless has_next?\n perform_request(next_page_uri)\n end",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape(page)\n next_link = page.at_css('a.next')\n if next_link \n p next_link\n next_url = BASE_URL + next_link['href']\n p next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape(page)\n next_link = page.at_css('a.next')\n if next_link \n p next_link\n next_url = BASE_URL + next_link['href']\n p next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def next_list\n @_next ? @resource.list(abs_url: @_next) : nil\n end",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n p next_link\n next_url = BASE_URL + next_link['href']\n p next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n if page.css(\"p.stdPager a\").last.content.include? \"Succ\"\n next_link = page.css(\"p.stdPager a\").last[\"href\"]\n end\n if next_link \n puts \"next link= \" + next_link\n next_url = DOMAIN + next_link\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n if page.css(\"p.stdPager a\").last.content.include? \"Succ\"\n next_link = page.css(\"p.stdPager a\").last[\"href\"]\n end\n if next_link \n puts \"next link= \" + next_link\n next_url = DOMAIN + next_link\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n if page.css(\"p.stdPager a\").last.content.include? \"Succ\"\n next_link = page.css(\"p.stdPager a\").last[\"href\"]\n end\n if next_link \n puts \"next link= \" + next_link\n next_url = DOMAIN + next_link\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n if page.css(\"p.stdPager a\").last.content.include? \"Succ\"\n next_link = page.css(\"p.stdPager a\").last[\"href\"]\n end\n if next_link \n puts \"next link= \" + next_link\n next_url = DOMAIN + next_link\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def resolve_url url_array\n url_array.each do |url_str|\n url = URI.parse(url_str)\n req = Net::HTTP.new(url.host, url.port)\n\n begin\n Timeout.timeout(5) do\n res = req.request_head(url.path)\n\n if res.code == \"200\"\n return url_str\n end\n end\n rescue Timeout::Error\n puts \"URL #{url_str} did not respond in 5 seconds.\"\n next\n end\n end\n return \"\"\nend",
"def next\n @links.key?(:next) ? Page.new(@links[:next], {}, @headers) : nil\n end",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n\n ## debugging note to the console\n puts 'scraping: '+url\n\n scrape_table(page)\n next_link = page.at_css('li.next')\n if next_link\n next_url = BASE_URL + next_link.at_css('a').attribute(\"href\")\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n\n ## debugging note to the console\n puts 'scraping: '+url\n\n scrape_table(page)\n next_link = page.at_css('li.next')\n if next_link\n next_url = BASE_URL + next_link.at_css('a').attribute(\"href\")\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end",
"def next\n if (r = @lastresult[\"queries\"][\"nextPage\"])\n @previous = @lastresult.clone\n\n return search_by_query_hash(r.first)\n else\n return nil\n end\n end",
"def get_next\n _info = self.get_next_list_entry!\n unless _info.nil?\n _url = _info[0]\n _imgurl = self.get_image_url _url\n unless _imgurl.nil?\n _filename = self.dl_image _imgurl\n return {\n 'filename' => _filename,\n 'author' => _info[1],\n 'title' => _info[2],\n 'origin' => _url\n }\n end\n end\n return nil\n end",
"def has_next?\n !!@links['next']\n end",
"def next\n perform_request(next_page_uri) if next?\n end",
"def fetch starter=nil\n def get_response url\n self.errcode = response = nil\n begin\n uri = URI.parse url\n if uri.host &&\n uri.port &&\n (http = Net::HTTP.new(uri.host, uri.port)) &&\n (uri.scheme != 'https' || (http.use_ssl = true && http.verify_mode = OpenSSL::SSL::VERIFY_NONE)) # read into this\n (request = Net::HTTP::Get.new(uri.request_uri, 'upgrade-insecure-requests' => '1'))\n response = http.request request\n self.errcode = response.code.to_i\n else # Invalid URL\n self.errcode = 400\n end\n rescue Exception => e\n # If the server doesn't want to talk, we assume that the URL is okay, at least\n case e\n when Errno::ECONNRESET\n self.errcode = 401\n else\n self.errcode = -1 # Undifferentiated error during fetch, possibly a parsing problem\n end\n end\n response\n end\n\n # get_response records the errcode of the last HTTP access in self.errcode\n tried = {}\n next_try = starter || url\n until tried[next_try]\n tried[next_try] = true\n response = get_response next_try\n case errcode\n when 200\n return response.body\n when 301, 302 # Redirection\n next_try = response.header['location']\n when 401 # Unauthorized\n next_try.sub! /^https/, 'http'\n end\n end\n # Failure to access the image\n err_msg = \"Error #{errcode} reading image at #{url} on ImageReference ##{id}\"\n errors.add :url, 'doesn\\'t work: ' + err_msg\n raise err_msg unless errcode == 404\n end",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next()\n\t\t\treturn @next\n\t\tend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape(url)\n next_link = page.xpath(\".//a[@title='Go to next page']\")\n puts next_link\n if next_link && next_link[0]\n puts next_link[0]['href']\n next_url = BASE_URL + next_link[0]['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape(url)\n next_link = page.xpath(\".//a[@title='Go to next page']\")\n puts next_link\n if next_link && next_link[0]\n puts next_link[0]['href']\n next_url = BASE_URL + next_link[0]['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def get_real_url(url)\n begin\n puts \"Getting real URL for: #{url}\"\n doc = Nokogiri::HTML(open(url))\n rescue OpenURI::HTTPError\n puts 'Too many requests, waiting 2 min then retrying...'\n sleep(120)\n doc = Nokogiri::HTML(open(url))\n end\n real_url = 'https://untappd.com' + doc.search('.details').search('a').first['href']\n puts \"Real URL is: #{real_url}\"\n real_url\nend",
"def next\n @next ||=\n if next_uri\n node_cache.fetch(next_uri) do\n node = self.class.new(node_cache, next_uri, adapter, graph)\n node.prev = self\n node\n end\n end\n end",
"def get_next_uri\n @is_getting_uri.lock\n uri = URI(\"https://admission.umontreal.ca/programmes-detudes/?type=888&tx_solr[page]=#{@i}&_=1482177335727\")\n @i += 1\n @is_getting_uri.unlock\n return uri\nend",
"def get_final_url(url_string)\n url = URI.parse(url_string)\n found = false\n until found\n req = Net::HTTP::Get.new(url.path)\n res = Net::HTTP.start(url.host, url.port){|h| h.request(req)}\n res_header_location = res.header['location']\n res_header_location ? url = URI.parse(res_header_location) : found = true\n break unless url.to_s.match('^http')\n end\n url.to_s\nend",
"def next_item\n return nil if @link == nil\n link.kernel.select {|item| item.rule == @rule}.first\n end",
"def get_next_page\n response = @next_method.call(@next_link).value! unless @next_method.nil?\n unless response.nil?\n @next_link = response.body.next_link\n @value = response.body.value\n self\n end\n end",
"def next\n (successors.length == 1) ? successors.first : nil\n end",
"def check_html(url, refs)\n file = get_internal_file(url)\n html = file ? Fs.read(file) : get_http(url)\n\n if html.nil?\n add_invalid_url(url, refs)\n return\n end\n\n add_valid_url(url, refs)\n return if url[0] != \"/\"\n\n # self site path\n if !same_domain_site_path?(url)\n return\n end\n\n # self site and mobile path\n if !@check_mobile && mobile_url?(url)\n return\n end\n\n begin\n html = NKF.nkf \"-w\", html\n\n # scan layout_yield offset\n html.scan(/<!-- layout_yield -->(.*?)<!-- \\/layout_yield -->/m)\n yield_start, yield_end = Regexp.last_match.offset(0) if Regexp.last_match\n yield_start ||= html.size\n yield_end ||= 0\n\n # remove href in comment\n html.gsub!(/<!--.*?-->/m) { |m| \" \" * m.size }\n\n html.scan(/\\shref=\"([^\"]+)\"/i) do |m|\n offset = Regexp.last_match.offset(0)\n href_start, href_end = offset\n inner_yield = (href_start > yield_start && href_end < yield_end)\n\n next_url = m[0]\n next_url = next_url.sub(/^#{::Regexp.escape(@base_url)}/, \"/\")\n next_url = next_url.sub(/#.*/, \"\")\n\n next unless valid_url(next_url)\n\n internal = (next_url[0] != \"/\" && next_url !~ /^https?:/)\n next_url = File.expand_path next_url, url.sub(/[^\\/]*?$/, \"\") if internal\n next_url = Addressable::URI.encode(next_url) if next_url.match?(/[^-_.!~*'()\\w;\\/?:@&=+$,%#]/)\n\n next_url = @ref_string.new(next_url, offset: offset, inner_yield: inner_yield)\n\n if @results[next_url] == 1\n next\n elsif @results[next_url] == 0\n add_invalid_url(next_url, [url])\n else\n @urls[next_url] ||= []\n @urls[next_url] << url\n end\n end\n rescue => e\n Rails.logger.error(e.message)\n add_invalid_url(url, refs)\n end\n end",
"def fetch\n def get_response url\n self.status = response = nil\n begin\n uri = URI.parse(url)\n if uri.host &&\n uri.port &&\n (http = Net::HTTP.new(uri.host, uri.port)) &&\n (request = Net::HTTP::Get.new(uri.request_uri))\n response = http.request(request)\n self.status = response.code.to_i\n else # Invalid URL\n self.status = 400\n end\n rescue Exception => e\n # If the server doesn't want to talk, we assume that the URL is okay, at least\n case e\n when Errno::ECONNRESET\n self.status = 401\n else\n self.status = -1 # Undifferentiated error during fetch, possibly a parsing problem\n end\n end\n response\n end\n\n # get_response records the status of the last HTTP access in self.status\n tried = {}\n next_try = url\n until tried[next_try]\n tried[next_try] = true\n response = get_response next_try\n case status\n when 200\n return response.body\n when 301, 302 # Redirection\n next_try = response.header[\"location\"]\n when 401 # Unauthorized\n next_try.sub! /^https/, 'http'\n end\n end\n end",
"def next\n @next && @next.value\n end",
"def get_next\n while next_item = @queue.peek\n if next_item.cancelled?\n @queue.shift\n else\n return next_item\n end\n end\n\n return nil\n end",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def fetch\n headers = {\n \"User-Agent\" => \"#{HTTP::Request::USER_AGENT} (rubyland aggregator)\"\n }\n\n unless refresh == :hard\n if db_feed.http_etag\n headers[\"If-None-Match\"] = db_feed.http_etag\n end\n if db_feed.http_last_modified\n headers['If-Modified-Since'] = db_feed.http_last_modified\n end\n end\n\n # Loop redirects, marking new permanent url if all 304s\n tries = 0\n fetch_url = feed_url\n new_url = nil\n response = nil\n permanent_new_url = nil\n all_301s = true\n\n while tries < max_redirects\n tries += 1\n response = HTTP.use(:auto_inflate).headers(headers).get(fetch_url)\n\n if HTTP::Redirector::REDIRECT_CODES.include? response.status\n if response.status != 301\n all_301s = false\n end\n fetch_url = response.headers[\"Location\"]\n else\n break\n end\n end\n\n return response, (tries > 1 && all_301s ? fetch_url : nil)\n end",
"def next_page\n return nil if @query_str_next_page.empty?\n @url_str = next_url_str\n @page = InWebPage.new(@url_str)\n @page_count += 1\n\n # Prepare for getting the page which follows.\n @doc = REXML::Document.new(@page.to_s)\n @query_str_next_page = ''\n @doc.root.elements.each(XPATH_NEXT_PAGE){|e| @query_str_next_page = \"resumptionToken=#{e.text}\"}\n true\n end",
"def get_single_url(url)\n\n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url \n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n begin \n res2 = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n end\n\n r = \"\"\n begin\n r = res2.body\n rescue OpenURI::HTTPError=>e\n case e.to_s \n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return r\n end",
"def scrape_and_look_for_next_link(url)\n puts url\n page = Nokogiri::HTML(open(url))\n @thr_pages << Thread.new{\n scrape_table(page)\n }\n next_link = page.css('a.pager').each do |pager|\n if pager.inner_text.include? 'Next'\n #puts pager\n next_url = pager['href']\n #puts next_url\n #puts 'NEXT PAGE: Waiting 60 secs to avoid IP banning'\n #sleep(60)\n\n nb_thr_alive = 0\n @thr_pages.each do |thr_page|\n if (thr_page.alive?)\n nb_thr_alive+=1\n end\n end\n if(nb_thr_alive>NB_THREADS_MAX)\n puts 'too many threads, wait for the last one to exit'\n @thr_pages.last.join\n end\n\n begin\n scrape_and_look_for_next_link(next_url)\n rescue Timeout::Error, Errno::ECONNABORTED\n puts 'Timeout was detected. Trying again...'\n retry\n end\n end\n end\nend",
"def nextResult\n result = nil\n @mutex.synchronize do\n result = @results.shift\n @progressMutex.synchronize{ @requestProgress.delete result.requestId } if result\n end\n result\n end",
"def first\n # Modify the @next url to set the :limit to 1\n original_next = @next\n @next = @path\n fetch_next!(@options.merge(params: @options.fetch(:params, {}).merge({ limit: 1 })))\n # Restore the @next url to the original\n @next = original_next\n @data.first\n end",
"def has_next?; end",
"def get_next_article(url)\n uri = URI(URI::Parser.new.escape(url))\n response = Net::HTTP.get(uri)\n\n doc = Nokogiri::HTML.parse(response)\n\n #article = doc.at('a:contains(\"Article suivant\")')\n article = doc.at('a:contains(\"Nächster Artikel\")')\n article['href']\nend",
"def get_next_url\n @index = @index + 1\n link = @url.to_s + \"?PageNumber=\"\n link = link + @index.to_s\n \n return link\nend",
"def get_next_url\n @index = @index + 1\n link = @url.to_s + \"?PageNumber=\"\n link = link + @index.to_s\n \n return link\nend",
"def url_exist?\n\t\tbegin\n\t\t\turi = URI.parse(valid_url?)\n\t\t\tresponse = Net::HTTP.get_response(uri)\n\t\trescue \n\t\t\terrors.add(:long_url,\"is invalid url\")\n\t\t\t# in AR, error is a class by itself already \n\t\t\t# go to static.rb to check the errors\n\t\tend\n\tend",
"def http\n @http ||= all.select { |link| link =~ /^http(s)?:\\/\\//i}\n end",
"def next()\n if @limit != nil && @offset >= @limit\n return nil\n end\n\n if @data == nil || (@pos >= @data.length && @truncated)\n load_next_page()\n end\n\n if @pos < @data.length\n item_data = @data[@pos]\n @pos += 1\n @offset += 1\n cls = @item_cls\n if cls\n return cls.new(@api, item_data, true)\n else\n return item_data\n end\n else\n return nil\n end\n end",
"def next?\n not self.next.nil?\n end",
"def check_html(url, refs)\n file = get_internal_file(url)\n html = file ? Fs.read(file) : get_http(url)\n\n if html.nil?\n add_invalid_url(url, refs)\n return\n end\n\n add_valid_url(url, refs)\n return if url[0] != \"/\"\n\n begin\n html = NKF.nkf \"-w\", html\n html = html.gsub(/<!--.*?-->/m, \"\")\n html.scan(/\\shref=\"([^\"]+)\"/i) do |m|\n next_url = m[0]\n next_url = next_url.sub(/^#{::Regexp.escape(@base_url)}/, \"/\")\n next_url = next_url.sub(/#.*/, \"\")\n\n next unless valid_url(next_url)\n\n internal = (next_url[0] != \"/\" && next_url !~ /^https?:/)\n next_url = File.expand_path next_url, url.sub(/[^\\/]*?$/, \"\") if internal\n next_url = URI.encode(next_url) if next_url.match?(/[^-_.!~*'()\\w;\\/\\?:@&=+$,%#]/)\n next if @results[next_url]\n\n @urls[next_url] ||= []\n @urls[next_url] << url\n end\n rescue\n add_invalid_url(url, refs)\n end\n end",
"def next_failed_check\n self.failed_checks.first\n end",
"def next_page\n sync.get(next_page_url) if next_page?\n end",
"def crawl_url(\n url = @urls.first,\n follow_external_redirects: true,\n host: nil\n )\n assert_type(url, Wgit::Url)\n if !follow_external_redirects && host.nil?\n raise 'host cannot be nil if follow_external_redirects is false'\n end\n\n html = fetch(\n url,\n follow_external_redirects: follow_external_redirects,\n host: host\n )\n url.crawled = true\n\n doc = Wgit::Document.new(url, html)\n yield(doc) if block_given?\n\n doc.empty? ? nil : doc\n end",
"def next_host\n @mutex.synchronize do\n break if @hosts.empty?\n\n started_at = @index\n\n loop do\n host = @hosts[@index]\n @index = (@index + 1) % @hosts.length\n\n break host if host.online?\n\n # Return nil once we have cycled through all hosts and none were\n # available.\n break if @index == started_at\n end\n end\n end",
"def add_next ret\n return if @next.nil?\n return if ret.include? @next\n ret << @next\n @next.reachable ret\n end",
"def urls_failed\n\t\t\t@urls.select{|u| not u.success}\n\t\tend",
"def has_next_page?\n !@raw_page['nextRecordsUrl'].nil?\n end",
"def next\n self.next_id == -1 ? nil : self.story.cards.find(self.next_id)\n end",
"def queue_next\n begin\n link = to_validate.shift\n return if not link\n\n queued[link[0]] = link[1]\n\n link[1].validate(@hydra) { |error: nil|\n queued.delete(link[0])\n\n if error then invalidate(link[1], error[:type], error[:msg])\n else validated[link[0]] = link[1]\n end\n }\n link\n rescue Exception\n unshift(link)\n raise $!\n end\n end",
"def last_page?\n response['next'].nil?\n end",
"def external\n @external ||= http.select { |link| URL.new(link).host != host }\n end",
"def next\n\n if (@local_iterator && @local_iterator.has_next?)\n @local_iterator.get_next\n else\n nil\n end\n\n end",
"def check_next(products_page)\n xnext = \"//td[@align='right']/strong/a[contains(text(), 'Следующие')]/@href\"\n next_url = products_page.xpath(xnext).text\n next_products_page_url = if next_url != ''\n URL + '/' + next_url\n end || false\n next_products_page_url\n end",
"def non_http\n @non_http ||= all.select { |link| link !~ /^http(s)?:\\/\\//i}\n end",
"def fetch_from_url(url)\n codes = extract_codes(url)\n\n return false if codes.none?\n fetch_from_code(codes.last)\n end",
"def next\n Photo.find_by_id(next_id) if next?\n end",
"def get_next_set\n hash,url = perform_next_page_request\n Answers.new hash,url\n end",
"def get_next_target(page)\n start_link = page.index('<a href=')#found position 10\n\n if start_link == nil\n return nil, -1\n else\n start_link\n\n start_quote = page.index('\"', start_link)#found position 18\n end_quote = page.index('\"', start_quote + 1)#found position 37\n url = page[start_quote +1...end_quote]\n return url, end_quote\n end\nend",
"def fetch\n endpoint = URI(uri)\n Net::HTTP.get(endpoint)\n rescue *@errors => e\n pp e\n nil\n end",
"def next\n @next\n end",
"def next\n next? ? @current + 1 : nil\n end",
"def valid_url?\n # Not sure if we should make a change in the user initial data, we could just return as invalid.\n my_target_url = target_url.match(/http/) ? target_url : target_url.prepend(\"http://\")\n\n response = HTTParty.get(my_target_url) rescue nil\n\n return if response&.code == 200\n\n errors.add(:short_url)\n end",
"def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend",
"def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend",
"def get_url(data_name, next_data_indices = {})\n if next_data_indices.empty?\n next_data_indices = { nextStartIndex: 0, nextLikeStartIndex: 0, nextThumbStartIndex: 0 }\n else\n next_data_indices = next_data_indices.dup\n end\n\n next_data_indices[:webname] = @webname\n next_data_indices[:pat] = Downloader.get_pat\n\n DATA_FEED_URLS[data_name] % next_data_indices\n end",
"def get_next()\n return @next_node\n end",
"def next_page\n\t\t\tFeed.parse_url(next_page_url,@browser)\n\t\tend",
"def _AutoLink\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_AutoLinkUrl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_AutoLinkEmail)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_AutoLink unless _tmp\n return _tmp\n end",
"def get_next_page_url(first_page_doc)\n first_page_doc.css('span.paging:first-of-type a:last-of-type').first['href']\nend",
"def fetch_page\n Varnisher.log.info \"Looking for external resources on #{@url}...\"\n\n begin\n @html = Net::HTTP.get_response(@uri).body\n rescue\n Varnisher.log.info \"Hmm, I couldn't fetch that URL. Sure it's right?\\n\"\n return\n end\n end",
"def openUrl(url)\n i = 0\n data = nil\n while i < 3 do\n begin\n data = open(url).read\n i = 3\n rescue\n sleep(1)\n i += 1\n end\n end\n return data\nend",
"def next\n last? ? nil : @collection[index + 1]\n end",
"def next\n if lesson_number < Lesson.all.last.lesson_number\n Lesson.all.detect {|lesson| lesson.lesson_number < lesson_number}\n else\n Lesson.find_by(lesson_number: lesson_number)\n end\n end",
"def fetch(uri_str, limit = 10)\n raise TooManyRedirectsError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n fetch(response['location'], limit - 1)\n else\n response.value\n end\nend",
"def fetch(uri_str, limit = 10)\n raise TooManyRedirectsError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n fetch(response['location'], limit - 1)\n else\n response.value\n end\nend",
"def crawlNext(&blk)\r\n if @toCrawl.empty?\r\n return false\r\n end\r\n crawlThis=@toCrawl.pop()\r\n crawlOne(crawlThis,&blk)\r\n return true\r\n end",
"def next\n raise NotImplemetedError\n end",
"def fetch\n return to_enum.next\n rescue StopIteration\n return false\n end",
"def get_next_url\n\n @index = @index + 1\n\n link = @url.to_s + \"?PageNumber=\"\n\n link = link + @index.to_s\n\n return link\n\nend"
] | [
"0.8423655",
"0.6022834",
"0.59125125",
"0.58111787",
"0.577472",
"0.577472",
"0.57190794",
"0.5705838",
"0.5705838",
"0.5705838",
"0.5705838",
"0.5698161",
"0.56560874",
"0.5654704",
"0.5654704",
"0.5654704",
"0.5639774",
"0.5629583",
"0.5570565",
"0.5570565",
"0.55143726",
"0.5421785",
"0.5421421",
"0.54187655",
"0.5402484",
"0.5397394",
"0.53912807",
"0.53912807",
"0.53912807",
"0.53912807",
"0.5385831",
"0.5367227",
"0.5367227",
"0.53610784",
"0.5346885",
"0.5265488",
"0.5255979",
"0.52439076",
"0.5220725",
"0.5202541",
"0.51799667",
"0.5173874",
"0.5163663",
"0.51060766",
"0.5088157",
"0.5088157",
"0.50717753",
"0.5042637",
"0.50335157",
"0.5033071",
"0.5026072",
"0.5008163",
"0.5003335",
"0.499907",
"0.49983484",
"0.49983484",
"0.49970746",
"0.49737355",
"0.49667194",
"0.496135",
"0.4953847",
"0.49501657",
"0.49332893",
"0.49104115",
"0.49048948",
"0.48968357",
"0.48956144",
"0.48907062",
"0.48905602",
"0.4889144",
"0.48873106",
"0.488353",
"0.48825437",
"0.48696145",
"0.48639792",
"0.4863578",
"0.485621",
"0.48534742",
"0.48529273",
"0.48518816",
"0.48402718",
"0.48383996",
"0.48354387",
"0.4830844",
"0.4830844",
"0.4829128",
"0.48246807",
"0.4818437",
"0.48161706",
"0.4813668",
"0.4803097",
"0.47997078",
"0.47981143",
"0.47972026",
"0.47963274",
"0.47963274",
"0.47944707",
"0.47905082",
"0.47857457",
"0.47848704"
] | 0.82380056 | 1 |
Find the group with the most actions and return an int h where: h = (max_actions + pad) factor the pad represents the top two header lines in the rendered post it the factor represents the line height of the action list | def compute_height(pad = 2, factor = 13)
(max_actions + pad) * factor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def highest_match_count\n match_count = Hash.new(0)\n\n @hand.each { |dice| match_count[dice] += 1 }\n\n match_count.values.max\n end",
"def max_hops; end",
"def top_id\r\n (index - (index < @switch_max ? 0 : @switch_max)) * 10 + 1\r\n end",
"def max_possible_acts(sym)\n act_lmt = nil\n case sym\n when :move; act_lmt = move_action_lmt;\n when :skill; act_lmt = skill_action_lmt;\n when :atk; act_lmt = atk_action_lmt;\n when :item; act_lmt = item_action_lmt;\n end\n [act_lmt, all_action_lmt].max\n end",
"def max_children_count(k)\n check_val(k)\n @stats[:nodes_with_max_children] = PriorityQueue.new(k)\n get_max_children(@xmldoc,k)\n puts \"the text of the #{k} most branching nodes, with its number of children:\"\n @stats[:nodes_with_max_children].each() {|count,ele| puts \"#{count}\\t#{ele}\"}\n end",
"def max_index\n blocks.max(:index) || 0\n end",
"def get_max_haplotype_size\n max_haplotype = 0\n @blocks.values.each do |block|\n if block.haplotypes.length > max_haplotype\n max_haplotype = block.haplotypes.length\n end\n end\n return max_haplotype\n end",
"def high_card \n\t\tcards.max\n\tend",
"def h(n)\n font_sizes.percentile ((HEADING_DEPTH-1)-n) * HEADING_STEP\n end",
"def highest_height\n i = acc.reverse.find_index{|i|!i.nil?}\n i ||= 0\n acc.length - i\n end",
"def max_blocks; end",
"def new\n @actionitem = Actionitem.new\n @actionitems_max_sort = Actionitem.find(:all , :conditions => { :action_id => params[:action_id] }).map(&:sort).max + 1\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actionitem }\n end\n end",
"def item_max() SES::Bestiary.get_enemy_list.size end",
"def draw_basic_actions\n y = line_height\n enemy.actions.each do |action|\n next unless action.kind == 0\n draw_basic_action(y, action)\n y += line_height\n end\n y\n end",
"def largest\n divisors = counts(@max)\n result = ''\n divisors.each_with_index do |total, index|\n if total == divisors.max\n result << \"#{index+1}:#{total} \"\n end\n end\n result.strip\n end",
"def flow_completion_count\n last = children_nodes_in_flow_order.last\n return last.flow_completion_count if last\n flow_entry_count\n end",
"def calculate_line_with_highest_frequency\n @highest_count_across_lines = @analyzers.max_by(&:highest_wf_count).highest_wf_count\n @highest_count_words_across_lines = []\n @analyzers.each do |word|\n @highest_count_words_across_lines << word if word.highest_wf_count == @highest_count_across_lines\n end\n end",
"def guest_with_most_appearances\n sql = <<-SQL\n SELECT guest_name,\n \tCOUNT(id) as appearance_count\n FROM guest_appearances\n GROUP BY guest_name\n ORDER BY appearance_count DESC\n LIMIT 1;\n SQL\n fg = DB[:conn].execute(sql)[0]\n puts \"#{fg[0]}: #{fg[1]} appearances.\"\nend",
"def max_story; CPanel::MAX_STORY; end",
"def top_5\n count = @sentence.blips.group(:body).distinct.count\n percent = count.each {|k, v| count[k] = v / @sentence.blips_count.to_f }\n statistics = percent.sort_by { |k, v| v }.reverse[0..4].flatten.each { |k, v| puts \"#{k}: #{v}\" }\n end",
"def calculate_line_with_highest_frequency()\n maximo = @analyzers.max_by(&:highest_wf_count)\n @highest_count_across_lines = maximo.highest_wf_count\n @highest_count_words_across_lines = []\n @analyzers.each do |linha|\n if linha.highest_wf_count == @highest_count_across_lines\n @highest_count_words_across_lines << linha\n end\n end\n #puts \"maximo dos maximos: #{@highest_count_across_lines}#{highest_count_words_across_lines.flatten}\"\n #@highest_count_words_across_lines = Array.new\n #@analyzers.each do |analyzed| \n # @highest_count_words_across_lines << analyzed.highest_wf_words\n #end\n end",
"def max(types)\n max = 0\n types.each{ |t| v = [lmt(t), @tbu.all_action_lmt].max; max = v if v > max }\n max\n end",
"def calculate_line_with_highest_frequency()\n @highest_count_across_lines = 0\n @highest_count_words_across_lines = []\n for line in @@analyzers\n if line.highest_wf_count >= @highest_count_across_lines\n\n @highest_count_across_lines = line.highest_wf_count\n @highest_count_words_across_lines.push(line)\n \n end\n \n end\n end",
"def get_max_interactions\n return @snps.length-1\n end",
"def highest_match_value\n values = @hand.select { |dice| @hand.count(dice) == highest_match_count }\n values.max\n end",
"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 most_views\n @content.sort_by { |address| address[1].length }.reverse.each do |values|\n @output << \"#{values.first} #{values.last.count} visits\"\n end\n end",
"def visible_scrapers(heights)\n max = 0\n r = 0\n heights.each do |item|\n if item > max\n r += 1\n max = item\n end\n end\n r\nend",
"def visible_scrapers(heights)\n max = 0\n r = 0\n heights.each do |item|\n if item > max\n r += 1\n max = item\n end\n end\n r\nend",
"def hp_on_kill\n (maxhp * features_sum(:hp_on_kill)).to_i\n end",
"def max_snapshot_groups; end",
"def max_number_confirm_button\n\t\t$tracer.trace(format_method(__method__))\n\t\treturn ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-maxnumconfirmbtn\")), format_method(__method__))\n\tend",
"def max_rows\n Curses.lines - @status_bar_cols - 1 - @header.size - 5 - 1\n end",
"def get_top_order\n cards.maximum('card_order') || 0\n end",
"def display_top(n: 3)\n draw \"Top #{n} sections:\"\n draw \"Top #{n} HTTP status:\"\n draw \"Top #{n} IPs:\"\n draw_eol\n clear_line\n\n sections = @queue.top_sections.first(n)\n statuses = @queue.top_status.first(n)\n ips = @queue.top_ips.first(n)\n\n n.times do |index|\n clear_line\n\n section, section_hits = sections[index]\n status, status_hits = statuses[index]\n ip, ip_hits = ips[index]\n\n draw \" %-19s %-10s\" % [section.to_s.empty? ? '/' : section, section_hits]\n status.nil? ? (draw '') : (draw \" #{status} #{status_hits}\" % [status, status_hits])\n ip.nil? ? (draw '') : (draw \" %-16s %s\" % [ip, ip_hits])\n\n draw_eol\n end\n end",
"def h(num)\n font_sizes.percentile(((HEADING_DEPTH - 1) - num) * HEADING_STEP)\n end",
"def most_hit(since = nil, limit = 5)\n query = joins(:punches).group(Punch.arel_table[:punchable_type], Punch.arel_table[:punchable_id], arel_table[primary_key])\n query = query.where('punches.average_time >= ?', since) unless since.nil?\n query.reorder(Arel.sql('SUM(punches.hits) DESC')).limit(limit)\n end",
"def max_sets_to_play\n case scoring.to_sym\n when :two_six_game_ten_point\n 3\n when :one_eight_game\n 1\n else # :three_six_game\n 3\n end\n end",
"def visible_line_number\r\n item_max\r\n end",
"def max_level\r\n # パーティ人数が 0 人の場合\r\n if @actors.size == 0\r\n return 0\r\n end\r\n # ローカル変数 level を初期化\r\n level = 0\r\n # パーティメンバーの最大レベルを求める\r\n for actor in @actors\r\n if level < actor.level\r\n level = actor.level\r\n end\r\n end\r\n return level\r\n end",
"def most_games\n options = {\n :select => 'count(*) as field',\n :order => 'field DESC'\n }\n\n render_users params[:name], options\n end",
"def page_count\n file_groups\n @highest_page_count\n end",
"def largestsize\n self.optimize\n sizes = Hash.new(0)\n @h.each { |_,v| sizes[v] += 1 }\n result = sizes.sort{ |a,b| a[1] <=> b[1] }.reverse\n s = \"\"\n result.each { |_,v| s += v.to_s + \" \" }\n s\n end",
"def print_highest_word_frequency_across_lines\n puts 'The following words have the highest word frequency per line:'\n @analyzers.each do |word|\n if word.highest_wf_count == @highest_count_across_lines\n puts \"#{word.highest_wf_words} (appears in line #{word.line_number})\"\n end\n end\n end",
"def find_most_common_section\n return @section_counter.max_by{|k, v| v}\n end",
"def max(hill)\n (2 * (hill.size - 1)).to_s\n end",
"def depth_max; depths.max end",
"def ListView_GetGroupCount(hwnd) send_listview_message(hwnd, :GETGROUPCOUNT) end",
"def select_series_title_with_most_human_characters\n \"SELECT series.title FROM characters INNER JOIN series ON series.id = characters.series_id GROUP BY(characters.species) ORDER BY(COUNT(characters.species)) LIMIT 1;\"\nend",
"def highest_relative_content(max_chunks = 10)\n return [] if needs_rebuild?\n\n avg_density = {}\n @items.each_key { |item| avg_density[item] = proximity_array_for_content(item).inject(0.0) { |x, y| x + y[1] } }\n\n avg_density.keys.sort_by { |x| avg_density[x] }.reverse[0..max_chunks - 1].map\n end",
"def max_gfooter(*cols)\n hsh = {}\n cols.each do |c|\n hsh[c] = :max\n end\n gfooter('Group Maximum', **hsh)\n end",
"def max_gfooter(*cols)\n hsh = {}\n cols.each do |c|\n hsh[c] = :max\n end\n gfooter('Group Maximum', **hsh)\n end",
"def hunt_with_top_n(number_of_hunts, other_player_reputations)\n\t\t\tif number_of_hunts >= other_player_reputations.length\n\t\t\t\thunts = other_player_reputations.map { |r| 'h' }\n\t\t\t\treturn hunts\n\t\t\tend\n\n\t\t\tif number_of_hunts <= 0\n\t\t\t\thunts = other_player_reputations.map { |r| 's' }\n\t\t\t\treturn hunts\n\t\t\tend\n\n\t\t\tsorted = other_player_reputations.sort\n\t\t\tcutoff = sorted[sorted.length - number_of_hunts]\n\t\t\thunts = []\n\t\t\thunt_count = 0\n\t\t\tother_player_reputations.each_with_index do |r, index|\n\t\t\t\thunts[index] = (r > cutoff ? 'h' : 's')\n\t\t\t\thunt_count += 1 if r > cutoff\n\t\t\tend\n\t\t\tother_player_reputations.each_with_index do |r, index|\n\t\t\t\tif r == cutoff && hunt_count < number_of_hunts\n\t\t\t\t\thunts[index] = 'h'\n\t\t\t\t\thunt_count += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\thunts\n\t\tend",
"def output_details_grouped io, max = nil\n scores = Hash.new 0\n methods = Hash.new { |h,k| h[k] = [] }\n\n each_by_score max do |class_method, score, call_list|\n klass = class_method.split(/#|::/).first\n\n methods[klass] << [class_method, score]\n scores[klass] += score\n end\n\n scores.sort_by { |_, n| -n }.each do |klass, total|\n io.puts\n\n io.puts \"%8.1f: %s\" % [total, \"#{klass} total\"]\n methods[klass].each do |name, score|\n self.print_score io, name, score\n end\n end\n end",
"def item_max(cat = current_category)\n @list[cat].size\n end",
"def guest_with_most_appearances\n \"SELECT\n name,\n count(*) AS total\n FROM guests\n GROUP BY name\n ORDER BY total\n DESC\n LIMIT 1;\"\nend",
"def poster_level(poster_count, max_count)\n levels = %w(Blanche Jaune Verte Bleue Rouge Noire)\n step = max_count / ( levels.length - 1 )\n step = 1 if step == 0\n level = poster_count / step\n 'Pagaie ' + levels[level]\n end",
"def high_card\n @hand.max_by{|card| card.point}.point.to_i\n end",
"def calculate_header\n headers = []\n height = 0\n @current_groups.each do |field, current_value|\n identifier_field = @sections[:groups][field.to_sym][:settings][:identifier_field] || nil\n value = (!@record.class.reflect_on_association(field).nil? and !identifier_field.nil?) ? @record.send(field.to_sym).send(identifier_field) : @record.send(field)\n\n if value != current_value\n reset_groups_values field\n\n headers << field.to_sym\n height += @sections[:groups][field.to_sym][:settings][:height] + @sections[:groups][field.to_sym][:settings][:posY]\n\n @current_groups[field] = value\n end\n end unless @current_groups.empty?\n\n [headers, height]\n end",
"def native_maxhp\n actor.parameters[0, @level] + @maxhp_plus\n end",
"def largest_property_name(properties)\n if properties.empty?\n 6 # we'll include \"action\" even without properties and it's 6 chars long\n else\n properties.max_by { |x| x[\"name\"].size }[\"name\"].size\n end\n end",
"def get_highest_for(turn)\n\t\tif @highs[1][turn] > @highs[2][turn] then 1 else 2 end\n\tend",
"def visible_line_number\n item_max\n end",
"def visible_line_number\n item_max\n end",
"def visible_line_number\n item_max\n end",
"def visible_line_number\n item_max\n end",
"def calculate_stats\n # this one gets the anaylyzer\n analyzer_w_most_repeated_word = @analyzers.max_by { |analyzer| analyzer.highest_wf_count }\n #this one gets its highest word count\n @highest_count_across_lines = analyzer_w_most_repeated_word.highest_wf_count\n\n # this one gets all lines that match that highest word count - it will be an array of objects\n # containing one or more objects\n @highest_count_words_across_lines = @analyzers.select { |e| e.highest_wf_count == @highest_count_across_lines }\n\n # return a hash with some useful info\n { top_line: analyzer_w_most_repeated_word, repeat_word_count: @highest_count_across_lines,\n top_line_and_ties: @highest_count_words_across_lines }\n end",
"def max_blocks=(_arg0); end",
"def highest_hexagon_number\n return hn_from_hcl(maxcol - 1, maxlin - 1)\n end",
"def most_popular_screening_film\n most_popular = nil\n unsold_tickets = 2 #max capacity of the cinema\n screenings = return_film_screenings\n screenings.each do |screening|\n if screening.tickets_left.to_i < unsold_tickets\n most_popular = screening\n end\n end\n return most_popular\n end",
"def top_largest_houses\n# user selects how many houses they want to see\n# method outputs top x number of houses (by size)\n start_and_end_of_output\n prompt = TTY::Prompt.new\n puts \" How many houses do you want to see?\"\n puts \" \"\n input = prompt.ask(\" Input a number between 1 and 50:\").to_i\n\n ordered_houses = House.all.sort_by do |house|\n split_string_array(house.swornMembers).count\n end.reverse\n\n start_and_end_of_output\n puts \" Top #{input} Largest Houses:\"\n puts \" \"\n i = 1\n ordered_houses[0..input-1].map do |house|\n puts \" #{i}. #{house.name} - #{split_string_array(house.swornMembers).count} members\"\n i += 1\n end\n start_and_end_of_output\n\n input = see_more_house_details?\n if input.include?(\"Y\")\n find_info_of_house\n elsif input.include?(\"N\")\n\n input = return_menu?\n if input.include?(\"1\")\n top_largest_houses\n elsif input.include?(\"2\")\n character_menu_select\n elsif input.include?(\"3\")\n house_menu_select\n end\n\n end\nend",
"def max_items\n main.max_items\n end",
"def max_level\n\t\t\t[to_level(@raw_width), to_level(@raw_height)].max\n\t\tend",
"def render_score_limit; end",
"def high_card\n @cards.sort[-1]\n end",
"def compute_child_mod_count\n target_child_count = case self.grid_type\n when FULL\n 1\n when HALVES, LEFT, RIGHT\n 2\n when THIRDS\n 3\n else\n 0\n end\n (target_child_count - self.columns.size)\n end",
"def most_explored_tags(topic, tag_groups = [], limit = 5)\n # Take 5 mostly visited places\n most_visited = self.checkins.by_topic(topic.id).most.all(:limit => 5)\n most_visited_tags = sort_tags(tag_groups, most_visited.collect(&:restaurant)) \n\n # Take 5 mostly reviewed and loved places\n most_loved = self.reviews.by_topic(topic.id).most.all(:limit => 5) \n most_loved_tags = sort_tags(tag_groups, most_loved.collect(&:restaurant))\n \n # Take 5 recently explored places\n recent_explored = self.restaurants.by_topic(topic.id).recent.all(:limit => 5) \n recent_explored_tags = sort_tags(tag_groups, recent_explored)\n \n # Merge all tags (5 + 5 + 5) = 15 (At most)\n # Remove duplicates and pick 5 based on their frequencies\n (most_visited_tags + most_loved_tags + recent_explored_tags).sort_by{|a| a.last}.reverse.collect{|a| a.first}.uniq[0..4]\n end",
"def length\n group.length\n end",
"def max_snapshots_per_group; end",
"def guest_with_most_appearances(db)\n db.execute(\n \"SELECT guest_name, COUNT(appearance_date) \n FROM guests \n GROUP BY guest_name \n ORDER BY COUNT(appearance_date) DESC \n LIMIT 1\")\nend",
"def load_remaining_groups(y)\n x = 0\n name_format = PFM::Pokemon::MALE_NAME\n $wild_battle.remaining_pokemons.each_with_index do |arr, zone|\n break if y >= @height\n arr.each_with_index do |group, tag|\n next unless group\n @stack.add_text(x, y, 320, 16, format(ZONE_TYPE_NAMES[zone], tag), color: 9)\n group.ids.each do |id|\n @stack.push(x, y, format(name_format, id))\n x += 32\n if x >= @width\n y += 32\n x = 0\n end\n end\n y += 32\n x = 0\n break if y >= @height\n end\n end\n return y\n end",
"def find_guard_with_most_sleep\n @guard_map.max_by { |_k, v| v[:total_sleep] }[0]\n end",
"def no_of_blocks\n @highlighted_blocks = \"\"\n blocks = Random.rand(5) + 1\n blocks.times {|count|\n row = Random.rand(5)\n column = Random.rand(5)\n @highlighted_blocks << \"#button_#{row}_#{column} \"\n }\n end",
"def largest_operation_info(highest_ops)\n \t\"##{highest_ops.id} - #{highest_ops.invoice_num} - $ #{highest_ops.amount}\"\n end",
"def num_groups\n\t\t\t@groups.length\n\t\tend",
"def max_number_of_a_level(level)\n 4 * level * level + 4 * level + 1\n end",
"def high(x)\n x.scan(/\\w+/).max_by{ |x| x.sum - x.size * 96 }\nend",
"def max_size\n @group.max_size\n end",
"def visible_line_number\n return ROWS_MAX\n end",
"def height(key, count = 0, child = level_order(key).pop)\n count += 1\n if child == key\n return count - 1\n else\n parent = find_parent(child).data\n height(key, count, parent)\n end\n end",
"def item_max() @item_max end",
"def num_hidden\n @hidden_cards.size\n end",
"def item_max\r\n $game_troop.alive_members.size\r\n end",
"def count_variations(focus, focus_header)\ncontent_array = Sentence.where(focus_header.to_sym => focus)\ncontent_array.maximum(\"order\")\nend",
"def find_max_index\n return @node_names.length unless @node_names.empty?\n\n max_index = -1\n unless @nodes.empty?\n @nodes.each do |node|\n max_index = node.value if node.value > max_index\n end\n end\n max_index >= 0 ? (return max_index + 1) : (return -1)\n end",
"def find_max_descriptors(max_descripors)\n i = max_descripors\n max_size = 1024\n while i != max_size && i > 1024\n max_size = EM.set_descriptor_table_size i\n i /= 2 if max_size < i\n end\n max_size\nend",
"def guest_with_most_appearances\n puts \"Q: Who did Jon Stewart have on the Daily Show the most?\"\n most_guest = @db.execute( \"SELECT COUNT(guests), guests FROM daily_show_guests GROUP BY guests ORDER BY COUNT(guests) DESC LIMIT 1\" )[0]\n puts \"A: #{most_guest[1]}, with #{most_guest[0]} appearances.\"\n puts \"\"\nend"
] | [
"0.5806632",
"0.5806632",
"0.57885504",
"0.5447509",
"0.5403133",
"0.5402194",
"0.51390976",
"0.5093184",
"0.5090375",
"0.5083449",
"0.508129",
"0.50665444",
"0.50417334",
"0.5037443",
"0.5007906",
"0.500024",
"0.4975096",
"0.49619475",
"0.49557513",
"0.49306992",
"0.49247235",
"0.49036294",
"0.48998478",
"0.48993117",
"0.4886706",
"0.48753136",
"0.48682544",
"0.4822063",
"0.48214403",
"0.48185447",
"0.48165667",
"0.48165667",
"0.47967112",
"0.47958556",
"0.47873476",
"0.47746292",
"0.47720724",
"0.47530398",
"0.47390866",
"0.47339717",
"0.4721411",
"0.47198305",
"0.47138625",
"0.47054887",
"0.4698835",
"0.46943468",
"0.46909803",
"0.46905237",
"0.46888417",
"0.4687337",
"0.4680123",
"0.46751878",
"0.46737763",
"0.46720695",
"0.46720695",
"0.46718046",
"0.46599683",
"0.4654801",
"0.46391645",
"0.4638685",
"0.46235475",
"0.4622758",
"0.4619813",
"0.4619458",
"0.4616674",
"0.46153042",
"0.46153042",
"0.46153042",
"0.46153042",
"0.46122527",
"0.4611971",
"0.4604512",
"0.45972866",
"0.45956126",
"0.4586798",
"0.45849806",
"0.45767468",
"0.4566248",
"0.45495957",
"0.45454928",
"0.4544632",
"0.45339203",
"0.45335704",
"0.4532626",
"0.45285642",
"0.45280436",
"0.4527858",
"0.4526154",
"0.45258856",
"0.45227048",
"0.45206508",
"0.45200166",
"0.4519895",
"0.45161948",
"0.4514683",
"0.4513691",
"0.45110244",
"0.45108002",
"0.45102835",
"0.4507718"
] | 0.62843657 | 0 |
Make the groups with the least lines of code green and gradually go to red return a string that will be parameters to the css rgb rule | def compute_color(loc, resolution = 50)
min_loc = total_loc grouping_sorted_by_total_loc.first.last
max_loc = total_loc grouping_sorted_by_total_loc.reverse.first.last
range = max_loc - min_loc
progress = loc - min_loc
percent = progress.to_f / range.to_f * 100.0
gradient = ColorFun::Gradient.new "00ff00", "FF9100", "ff0000" # green, orange, red
gradient.resolution = resolution
rgb = gradient.at [percent, resolution].min
[rgb.red, rgb.green, rgb.blue]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def red\n colorize(31)\n end",
"def get_green_to_red_scala n\n colors = []\n r = 0; g = 150; b = 0\n max = 255\n\n #se empieza en un g oscuro en 150 y se aclarece añadiendo g hasta 255\n #ni = numero iteraciones\n ni = (1*n/3)\n for i in 1..(1*n/3.to_f).floor\n g = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g esta en 255 se añade r desde 150 hasta 255 hasta llegar a amarillo\n #ni = numero iteraciones\n g = 255\n ni = 1 + (2*n/3.to_f).floor - (1*n/3.to_f).ceil\n for j in (1*n/3.to_f).ceil..(2*n/3.to_f).floor\n i = j - (1*n/3.to_f).ceil + 1\n r = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g y r estan en 255 se quita g hasta 0 hasta llegar a rojo\n #ni = numero iteraciones\n g = r = 255\n ni = 1 + n - (2*n/3.to_f).ceil\n for i in (2*n/3.to_f).ceil..n\n g = ((n - i)*(max/ni.to_f)).floor\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de verde a rojo\n colors\n end",
"def green\n colorize(32)\n end",
"def colorized?; end",
"def as_red\n @red += 1\n end",
"def green(text)\n colorize(text, 32)\nend",
"def red(text)\n colorize(text, 31)\nend",
"def get_red_green_color current = 0, total = 0, offset = 0, size = 0\n red = 0\n green = 0\n\n if total <= 0\n red = offset + size / 2\n green = offset + size / 2\n else\n itmd = current * 1.0 / total\n green = itmd * size + offset\n red = (1 - itmd) * size + offset\n end\n\n {\n red: red.ceil.to_s,\n green: green.ceil.to_s\n }\n end",
"def scan_for_colors; end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n\n end",
"def see_color(str)\n return 'red' if str.start_with?('red')\n return 'blue' if str.start_with?('blue')\n\n ''\n end",
"def bg_red; use_code(41) end",
"def red\n colorize(:red)\nend",
"def colorize!; @colors = true; end",
"def much_green?(colors) ; colors[1] > 200 ; end",
"def purple\n colorize(35)\n end",
"def get_red_scala n\n colors = []\n r = 255; g = 0; b = 0\n max = 255\n\n # se inicia la escala con el r mas fuerte y se añade g y b por igual cantidad hasta llegar al blanco\n for i in 1..n\n g = b = (i*(max/n)).round\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de blanco a rojo\n colors.reverse\n end",
"def colors; end",
"def red(output)\n color(31, output)\n end",
"def rgb\n value = if successes < current\n 0\n else\n (255.0 * (@current.to_f / (successes.to_f + 1.0))).round\n end\n red = (255 - value).to_s(16).ljust(2, \"0\")\n green = value.to_s(16).rjust(2, \"0\")\n blue = 0.to_s(16).rjust(2, \"0\")\n \"\" << red << green << blue\n end",
"def green; end",
"def green; end",
"def code\n index = 16 +\n RGB.to_ansi_domain(@red) * 36 +\n RGB.to_ansi_domain(@green) * 6 +\n RGB.to_ansi_domain(@blue)\n\n \"#{@ground_code};5;#{index}\"\n end",
"def yellow\n colorize(33)\n end",
"def fast_green_typer(string)\n string.chars.each do |x|\n print x.colorize(@@colours[0])\n sleep(0.003)\n end\n br\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def numColor(number)\n if(number > 0)\n return 'green'\n elsif(number < 0)\n return 'red'\n else\n return ''\n end\n end",
"def bold_red(output)\n color('1;31', output)\n end",
"def green=(_); end",
"def green(string)\n colorize(string, 32)\n end",
"def red(string)\n colorize(string, 31)\n end",
"def green(output)\n color(32, output)\n end",
"def highlight_gap_marks_in_red!(lb)\n # gap_marks: Skip certain characters and find characters to highlight in red\n gap_mark_complete_regex = Regexp.new(Regexp.escape(tmp_gap_mark_complete))\n l_ch = @options[:language].chars\n chars_to_skip = [\n l_ch[:d_quote_open],\n l_ch[:em_dash],\n l_ch[:s_quote_open],\n ' ',\n '(',\n '[',\n '\"',\n \"'\",\n '}',\n '*',\n '[', # chinese bracket\n '(', # chinese parens\n '一', # chinese dash\n '《', # chinese left double angle bracket\n ].join\n lb.gsub!(\n /\n #{ gap_mark_complete_regex } # find tmp gap mark number and text\n ( # capturing group for first group of characters to be colored red\n (?: # non capturing group\n #{ l_ch[:elipsis] } # elipsis\n (?!#{ l_ch[:elipsis] }) # not followed by another elipsis so we exclude chinese double elipsis\n )? # optional\n )\n ( # capturing group for characters that are not to be colored red\n (?: # find one of the following, use non-capturing group for grouping only\n [#{ Regexp.escape(chars_to_skip) }]+ # special chars or delimiters\n | # or\n …… # chinese double elipsis\n | # or\n \\\\[[:alnum:]]+\\{ # latex command with opening {\n | # or\n \\s+ # eagle followed by whitespace\n )* # any of these zero or more times to match nested latex commands\n )\n ( # capturing group for second group of characters to be colored red\n #{ l_ch[:elipsis] }? # optional elipsis\n [[:alpha:][:digit:]#{ l_ch[:apostrophe] }\\-\\?,]* # words and some punctuation\n )\n /x,\n # we move the tmp_gap_mark_number to the very beginning so that if we\n # have an ellipsis before a latex command, the gap_mark_number will be\n # in front of the entire section that is colored red.\n # \\1: an optional ellipsis (colored red)\n # \\2: an optional latex command or characters not to be colored red\n # \\3: the text to be colored red\n # OPTIMIZATION: We could skip the first \\RtGapMarkText if \\1 is blank\n tmp_gap_mark_number + \"\\\\RtGapMarkText\" + '{\\1}' + '\\2' + \"\\\\RtGapMarkText\" + '{\\3}'\n )\n # If in the gap_mark processing above regex ref \\1 is empty, we end up\n # with empty `\\RtGapMarkText{}` fragments. We remove them in this step:\n lb.gsub!(\"\\\\RtGapMarkText{}\", '')\n # Move tmp_gap_mark_number to outside of quotes, parentheses and brackets\n if !['', nil].include?(tmp_gap_mark_number)\n gap_mark_number_regex = Regexp.new(Regexp.escape(tmp_gap_mark_number))\n chars_to_move_outside_of = [\n l_ch[:apostrophe],\n l_ch[:d_quote_open],\n l_ch[:s_quote_open],\n '(',\n '[',\n ].join\n lb.gsub!(\n /\n ( # capturing group for characters to move outside of\n [#{ Regexp.escape(chars_to_move_outside_of) }]*\n )\n #{ gap_mark_number_regex } # find tmp gap mark number\n /x,\n tmp_gap_mark_number + '\\1' # Reverse order\n )\n # Move tmp_gap_mark_number to after leading eagle\n lb.gsub!(\n /\n (#{ gap_mark_number_regex }) # capture group for tmp gap mark number\n \\s? # followed by eagle and optional space\n /x,\n '\\1' # Reverse order\n )\n # Convert tmp_gap_mark_number to latex command\n lb.gsub!(gap_mark_number_regex, \"\\\\RtGapMarkNumber{}\")\n end\n # Make sure no tmp_gap_marks are left\n if(ltgm = lb.match(/.{0,20}#{ Regexp.escape(tmp_gap_mark_text) }.{0,20}/))\n raise(LeftoverTempGapMarkError.new(\"Leftover temp gap mark: #{ ltgm.to_s.inspect }\"))\n end\n if !['', nil].include?(tmp_gap_mark_number)\n if(ltgmn = lb.match(/.{0,10}#{ Regexp.escape(tmp_gap_mark_number) }.{0,10}/))\n raise(LeftoverTempGapMarkNumberError.new(\"Leftover temp gap mark number: #{ ltgmn.to_s.inspect }\"))\n end\n end\n end",
"def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end",
"def pruning_roses(max)\n roses = \"(@)(@)(@)(@)(@)\"\n roses[0...max].colorize(:red)\nend",
"def g(value)\n value.to_s.color(:green)\n end",
"def bash_color_codes(string)\n string.gsub(\"\\e[0m\", '</span>').\n gsub(\"\\e[31m\", '<span class=\"color31\">').\n gsub(\"\\e[32m\", '<span class=\"color32\">').\n gsub(\"\\e[33m\", '<span class=\"color33\">').\n gsub(\"\\e[34m\", '<span class=\"color34\">').\n gsub(\"\\e[35m\", '<span class=\"color35\">').\n gsub(\"\\e[36m\", '<span class=\"color36\">').\n gsub(\"\\e[37m\", '<span class=\"color37\">')\n end",
"def rgb_style(string)\n pastel = Pastel.new\n styled_rgb = pastel.red(\"#{string[0]}\") + pastel.green(\"#{string[1]}\") + pastel.blue(\"#{string[2]}\")\n return styled_rgb\nend",
"def start_style(name)\n case name\n when \"negative\"\n \"<span style=\\\"color: white; background-color: black\\\">\"\n when /on_(\\w+)/\n colval = color_value($1)\n \"<span style=\\\"background-color: #{colval}\\\">\"\n else\n colval = color_value(name)\n \"<span style=\\\"color: #{colval}\\\">\"\n end\n end",
"def colored\n reparse\n parsed_colors[:string].apply_colors(parsed_colors[:colors])\n end",
"def color\n case (@code.to_i / 100)\n when 2\n color = :green\n when 3\n color = :yellow\n when 4, 5\n color = :red\n else\n color = :blue\n end\n color\n end",
"def green\n hsl_to_rgb!\n @attrs[:green]\n end",
"def green\n hsl_to_rgb!\n @attrs[:green]\n end",
"def to_color_log\n @lines.map.with_index do |val, i|\n case val[0][:status] \n when \" \"\n \"\\033[90m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"+\"\n \"\\033[32m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"-\"\n \"\\033[31m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"*\"\n \"\\033[36m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n end\n end.join(\"\\n\") + \"\\n\"\n end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def colorize(s, c = :green)\n %{\\e[#{c == :green ? 33 : 31}m#{s}\\e[0m}\n end",
"def blanket_patterns(colors, lines)\n lines.times do |i|\n first = colors[0]\n rest = colors[1..-1]\n colors = rest + first\n puts colors\n end\nend",
"def color\n @red ? \"R\" : \"B\"\n end",
"def colorsPrimary\n @color_rgb_strings_primary = []\n @color_rgb.each do |rgb|\n r = rgb[\"red\"]\n g = rgb[\"green\"]\n b = rgb[\"blue\"]\n @color_rgb_strings_primary << \"rgb(#{r},#{g},#{b})\"\n end\n end",
"def green(g1)\n Rubyvis.rgb(r,g1,b,a)\n end",
"def colorize(string, level)\n case level\n when 1\n string\n when 2\n string.color(:green)\n when 3\n string.color(:yellow)\n when 4\n string.color(:red)\n end\n end",
"def rgb_true(red, green, blue)\n \";2;#{red};#{green};#{blue}\"\n end",
"def aqi_range_colors\n { 0..50 => :green,\n 51..100 => :yellow,\n 101..150 => :orange,\n 151..200 => :red,\n 201..300 => :purple,\n 301..999 => :pink }\n end",
"def blue(text)\n colorize(text, 34)\nend",
"def colorized_diff(&block); end",
"def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend",
"def red_(string)\n print $color.wrap(\"#{string}\").red\nend",
"def get_topic_bg_color(topic)\n rgb = 'rgb(' + (400*(1-(Math.tanh(2*[@max_team_size.to_f/Bid.where(topic_id:topic.id).count,1].min-1)+1)/2))\n .to_i.to_s + ',' + (400*(Math.tanh(2*[@max_team_size.to_f/Bid.where(topic_id:topic.id).\n count,1].min-1)+1)/2).to_i.to_s + ',0)'\n puts rgb\n rgb\n end",
"def process(line)\n line.gsub!(/^#.*/, '') # remove comments\n return if line.match?(/^\\s*$/) # skip blank lines\n color = Color.new line\n color.to_html\nend",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def green\n ((hex_color & GREEN) >> 8) / MAX_RGB_VALUE * 100\n end",
"def green\n end",
"def start_color color\n \"\\e[#{COLORS[color]}m\"\n end",
"def color(color); end",
"def green\n\t\tlight COLOR_KEY_GREEN\n\tend",
"def stopped_failed_colors\n { :light => \"F5D9C9\".to_color, :medium => \"F2F2E9\".to_color, :strong => \"AF3A00\".to_color }\n end",
"def shades_of_grey(n)\n 1.upto([254,n].min).map {|i| p format '#%02x%02x%02x', i, i, i}\nend",
"def generate_color(status)\n if status == :completed\n :green\n elsif status == :failed\n :red\n else\n :yellow\n end\n end",
"def success_style(success)\n green_style(success)\nend",
"def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #008B8B #006400\n ).sample\n end\n end",
"def as_blue\n @blue += 1\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 split_colors\n array = []\n remainder = @sha.split('') # Yes, it's not the remainder now, but it will be at the return statement.\n 6.times { array << remainder.slice!(0, 6).to_s }\n return array, remainder.to_s\n end",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(string)\n puts $color.wrap(\"#{string}\").red\nend",
"def colorize(* colors)\n buff = []\n colors.each{|color| buff << color_code(color)}\n buff << self << color_code(:off)\n buff.join\n end",
"def bg_dark_grey; use_code(100) end",
"def red; end",
"def red; end",
"def green=(num)\n @green = constrain num, 0..255\n end",
"def rgb_color; end",
"def colors\n return\n end",
"def green_style(string)\n pastel = Pastel.new\n green_string = pastel.green(\"#{string}\")\n return green_string\nend",
"def r(value)\n value.to_s.color(:red)\n end",
"def status_color\n if skipped?\n :yellow\n elsif error?\n :red\n else\n :green\n end\n end",
"def red_style(string)\n pastel = Pastel.new\n red_string = pastel.red(\"#{string}\")\n return red_string\nend",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def to_css\n styles = []\n %w( chessboard mini-chessboard ).each do |board_class|\n if light_square_color\n styles << \"\n .#{board_class} .square.light {\n background: #{light_square_color} !important;\n }\n .#{board_class} .square .square-label.dark {\n color: #{light_square_color} !important;\n }\n .cg-wrap.orientation-white coords.ranks coord:nth-child(2n + 1) {\n color: #{light_square_color} !important;\n }\n .cg-wrap.orientation-white coords.files coord:nth-child(2n + 1) {\n color: #{light_square_color} !important;\n }\n .cg-wrap.orientation-black coords.ranks coord:nth-child(2n) {\n color: #{light_square_color} !important;\n }\n .cg-wrap.orientation-black coords.files coord:nth-child(2n) {\n color: #{light_square_color} !important;\n }\n \"\n end\n if dark_square_color\n styles << \"\n .#{board_class} .square.dark {\n background: #{dark_square_color} !important;\n }\n .#{board_class} .square .square-label.light {\n color: #{dark_square_color} !important;\n }\n .cg-wrap.orientation-white coords.ranks coord:nth-child(2n) {\n color: #{dark_square_color} !important;\n }\n .cg-wrap.orientation-white coords.files coord:nth-child(2n) {\n color: #{dark_square_color} !important;\n }\n .cg-wrap.orientation-black coords.ranks coord:nth-child(2n + 1) {\n color: #{dark_square_color} !important;\n }\n .cg-wrap.orientation-black coords.files coord:nth-child(2n + 1) {\n color: #{dark_square_color} !important;\n }\n \"\n end\n if light_square_color || dark_square_color\n board_svg = %(\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:x=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 8 8\" shape-rendering=\"crispEdges\">\n <g id=\"a\">\n <g id=\"b\">\n <g id=\"c\">\n <g id=\"d\">\n <rect width=\"1\" height=\"1\" fill=\"#{light_square_color || \"#F3E4CF\"}\" id=\"e\"/>\n <use x=\"1\" y=\"1\" href=\"#e\" x:href=\"#e\"/>\n <rect y=\"1\" width=\"1\" height=\"1\" fill=\"#{dark_square_color || \"#CEB3A2\"}\" id=\"f\"/>\n <use x=\"1\" y=\"-1\" href=\"#f\" x:href=\"#f\"/>\n </g>\n <use x=\"2\" href=\"#d\" x:href=\"#d\"/>\n </g>\n <use x=\"4\" href=\"#c\" x:href=\"#c\"/>\n </g>\n <use y=\"2\" href=\"#b\" x:href=\"#b\"/>\n </g>\n <use y=\"4\" href=\"#a\" x:href=\"#a\"/>\n </svg>\n ).strip\n base64_board_svg = Base64.encode64(board_svg).gsub(/\\n/, '').strip\n styles << \"\n cg-board {\n background-image: url('data:image/svg+xml;base64,#{base64_board_svg}');\n }\n \"\n end\n if selected_square_color\n styles << \"\n .#{board_class} .square[data-selected] {\n background: #{selected_square_color} !important;\n }\n cg-board square.selected {\n background: #{selected_square_color} !important;\n }\n \"\n end\n if opponent_from_square_color\n styles << \"\n .#{board_class} .square[data-from] {\n background: #{opponent_from_square_color} !important;\n }\n .#{board_class} .square.move-from {\n background: #{opponent_from_square_color} !important;\n }\n cg-board square.last-move.move-from {\n background-color: #{opponent_from_square_color} !important;\n }\n \"\n end\n if opponent_to_square_color\n styles << \"\n .#{board_class} .square[data-to] {\n background: #{opponent_to_square_color} !important;\n }\n .#{board_class} .square.move-to {\n background: #{opponent_to_square_color} !important;\n }\n cg-board square.last-move.move-to {\n background-color: #{opponent_to_square_color} !important;\n }\n \"\n end\n end\n return unless styles.length > 0\n styles.join(\"\\n\").html_safe\n end",
"def shades_of_green value\n #Bunch of shades\n shades = %w( 00FF00 00F800 00F000 00E800 00E000 00D800 00D000 00C800 00C000 00B800 00B000 00A800 00A000 009800 009000 008800 008000 007800 007000 006800 006000 005800 005000 004800 004000 003800 003000 002800 002000 )\n\n #Fewer of shades\n #shades = %w( 00FF00 00D800 00B000 008800 006000 003800 )\n\n #scale the 'value' to an index in the array and display the color\n #the min/max ensure the value is within the range\n index = [ [shades.length * value / 100, 0].max, shades.length - 1].min\n return shades[index]\n end",
"def red\n hsl_to_rgb!\n @attrs[:red]\n end",
"def red\n hsl_to_rgb!\n @attrs[:red]\n end"
] | [
"0.66967916",
"0.6665774",
"0.65976214",
"0.64546555",
"0.6360181",
"0.62740016",
"0.626505",
"0.62432027",
"0.62268454",
"0.6225492",
"0.6225492",
"0.6225492",
"0.6225492",
"0.6225492",
"0.6225492",
"0.6221012",
"0.62087804",
"0.61889887",
"0.61612266",
"0.6156814",
"0.6134154",
"0.61032397",
"0.6090645",
"0.60732937",
"0.6072604",
"0.6057753",
"0.6055912",
"0.6055912",
"0.6047861",
"0.602452",
"0.6022908",
"0.6006842",
"0.60003483",
"0.59842515",
"0.59721476",
"0.59571713",
"0.5955784",
"0.5934377",
"0.59334075",
"0.59266",
"0.59177685",
"0.5917353",
"0.59146976",
"0.5902334",
"0.5897314",
"0.58911264",
"0.5887968",
"0.58751595",
"0.58751595",
"0.5868551",
"0.58667177",
"0.5862436",
"0.58551854",
"0.58407235",
"0.5826755",
"0.5803505",
"0.5803083",
"0.57836014",
"0.5779607",
"0.5774771",
"0.57743055",
"0.5765936",
"0.5763503",
"0.5752455",
"0.5746097",
"0.57429504",
"0.5732263",
"0.5718158",
"0.57153654",
"0.571308",
"0.57125705",
"0.5711271",
"0.5707097",
"0.5700111",
"0.56798106",
"0.5674492",
"0.56728303",
"0.5670211",
"0.5665371",
"0.5657592",
"0.5657592",
"0.5657592",
"0.5657592",
"0.5657592",
"0.56550825",
"0.5649692",
"0.5645856",
"0.5643821",
"0.5643821",
"0.56428385",
"0.56354386",
"0.56302077",
"0.5630129",
"0.56298095",
"0.5620848",
"0.56170356",
"0.5616631",
"0.5616282",
"0.5615912",
"0.5614086",
"0.5614086"
] | 0.0 | -1 |
wraps xml in version header | def wrap_in_version(xml_rq)
if QBWC.api == :qbpos
%Q( <?qbposxml version="#{QBWC.min_version}"?> ) + xml_rq
else
%Q( <?qbxml version="#{QBWC.min_version}"?> ) + xml_rq
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmldecl(version, encoding, standalone); end",
"def xmldecl(version, encoding, standalone); end",
"def xmldecl(version, encoding, standalone); end",
"def xmldecl(version, encoding, standalone); end",
"def add_version(xml)\n\t\t\t\txml.Version{\n\t\t\t\t\txml.ServiceId service[:id]\n\t\t\t\t\txml.Major service[:version]\n\t\t\t\t\txml.Intermediate 0\n\t\t\t\t\txml.Minor 0\n\t\t\t\t}\n\t\t\tend",
"def version_tag(text); end",
"def xmldecl version, encoding, standalone\n end",
"def head\n %Q[<?xml version=\"1.0\" encoding=\"UTF-8\"?>]\n end",
"def xmldecl ver, enc, stand\n # ignore xml declaration\n end",
"def xmldecl(version, encoding, standalone) # :nodoc:\n end",
"def ie_version_tag(content)\n tag :meta, :'http-equiv' => 'X-UA-Compatible', :content => content\n end",
"def version_meta_tag\n \"<meta name='version' content='#{CONFIG[:version]}'/>\"\n end",
"def xml_decl; end",
"def generate_ofx2_header\n return <<-EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?OFX OFXHEADER=\"200\" SECURITY=\"NONE\" OLDFILEUID=\"NONE\" NEWFILEUID=\"NONE\" VERSION=\"200\"?>\n EOF\n end",
"def version\n root.attribute('version').value.split('.').map { |n| n.to_i }\n end",
"def def_version; end",
"def version_tag\n version_composition.join(\".\")\n end",
"def create_xml_header(xml,options)\n xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')\n xml.instruct!(:qbmsxml, :version => API_VERSION)\n end",
"def xml_doc version = nil\n Nokogiri::XML::Document.new version\n end",
"def version\n @version ||= @doc.at('/document/@SSLyzeVersion').value.split(' ',2).last\n end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def xml; end",
"def xml(*args)\n attrs = { :version => '1.0' }\n attrs.merge!(args.pop) if args.last.respond_to?(:fetch) \n args.push(lambda{|*x| yield(*x) }) if block_given?\n new(\"<?xml\", attrs, \" ?>\\n\", *args)\n end",
"def export_xml(version)\n \n # Make sure all of the dates are in the right format\n @item['date'] = Time.now.utc.iso8601\n for section in ['offer', 'programme', 'trailer']\n case section\n when 'offer'\n label = 'window'\n else\n label = 'license'\n end\n if @item.has_key?(section)\n for period in ['start', 'end']\n @item[section][label][period] = @item[section][label][period].utc.iso8601\n end\n end\n end\n\n case version\n when :fpe2_5 \n template = ERB.new(Vpi2_5.get_xml_template(), nil, '-')\n when :fpe3_0\n template = ERB.new(Vpi3_0.get_xml_template(), nil, '-')\n else\n exit(\"Feature Package version \" + version.to_s + \" not supported\")\n end\n \n template.result(binding) \n end",
"def oo_version\n doc.xpath(\"//*[local-name()='document-content']\").each do |office|\n @officeversion = attribute(office, 'version')\n end\n end",
"def add_mime_version(ver_val = '')\n header['mime-version'] = ver_val\n end",
"def version(nil_on_mismatch: false, return_tag_version: false)\n tag_v = [@headers.map { | t | t.version }.max || 1 ,\n @playlist.map { | t | t.kind_of?(Tag) ? t.version : 1 }.max || 1\n ].max\n\n specified_v = @headers['EXT-X-VERSION'][0]\n header_v = specified_v ? Integer(specified_v.value) : tag_v\n\n if tag_v > header_v\n handle_error 'WARNING! Version mismatch. Tags indicated that the file'\\\n \" should have a version header with a value of #{tag_v},however \"\\\n \"the EXT-X-VERSION header has a value of only #{header_v}\"\n return nil if nil_on_mismatch\n end\n\n return tag_v if return_tag_version\n\n specified_v ? header_v : tag_v\n end",
"def build_header_footer( interchange_name )\n\n header = <<-HEADER\n<?xml version=\"1.0\"?>\n<Interchange#{interchange_name} xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://ed-fi.org/0100\"\nxsi:schemaLocation=\"http://ed-fi.org/0100 ../../sli/edfi-schema/src/main/resources/edfiXsd-SLI/SLI-Interchange-#{interchange_name}.xsd\">\nHEADER\n\n footer = \"</Interchange#{interchange_name}>\"\n\n return header, footer\nend",
"def msg_version; @msg_version ||= PackedHeader.new(1, 'C').encode(VERSION); end",
"def head\n\tversion\n end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def remove_header_declaration( xml )\r\n if xml.strip.start_with?( '<?xml')\r\n i = xml.index( '?>', 3 )\r\n xml[ i+2, xml.length-i ]\r\n else\r\n xml \r\n end\r\nend",
"def major_version; end",
"def default_version; end",
"def basic_data_xml\n headers[\"content-type\"]=\"text/html\";\n end",
"def xml?; end",
"def xml?; end",
"def version_translator\n unless swagger['swaggerVersion']\n swagger['swaggerVersion'] = \"1.2\"\n swagger[\"__notifications\"] << \"002: missing `swaggerVersion'\"\n end\n end",
"def version\n build_string\n end",
"def header\n MAGIC + [VERSION].pack('n')\n end",
"def additional_information_xml(xml)\n\n end",
"def get_version\n\t\tend",
"def version\n @doc.css('map').attr('version').value\n end",
"def inspect\n\t\t\trval = super\n\t\t\treturn rval unless self.structure_version\n\t\t\tvstring = \"%d.%d\" % [ self.structure_version, self.data_version ]\n\t\t\treturn rval.sub( />$/, \"; version: #{vstring}>\" )\n\t\tend",
"def version(sender)\n v = ::Vdoc2Org::VERSION\n puts \"version: #{v}\"\n v\n end",
"def version_info\n return @children['version-info'][:value]\n end",
"def get_version()\n\t\tend",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def data_xml\n headers[\"content-type\"]=\"text/html\";\n end",
"def xml\n\t\theaders[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\t\trender :layout => false\n\tend",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version_config version, data\n end",
"def indent_xml(doc = @xdoc || assert_xml)\n if doc.kind_of?(Hpricot::Elem) or doc.kind_of?(Hpricot::Doc)\n zdoc = doc\n doc = REXML::Document.new(doc.to_s.strip) rescue nil\n unless doc # Hpricot didn't well-formify the HTML!\n return zdoc.to_s # note: not indented, but good enough for error messages\n end\n end\n\n# require 'rexml/formatters/default'\n# bar = REXML::Formatters::Pretty.new\n# out = String.new\n# bar.write(doc, out)\n# return out\n\n return doc.to_s # ERGO reconcile with 1.8.6.111!\n\n x = StringIO.new\n doc.write(x, 2)\n return x.string # CONSIDER does REXML have a simpler way?\n end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def version\n super.to_s\n end",
"def version\n super.to_s\n end",
"def mime_version=( val )\n header[:mime_version] = val\n end",
"def bp_meta_tags\n \"<meta name='base-project-version' content='#{bp_version}'>\".html_safe\nend",
"def patch_version; end",
"def version\n super\n end",
"def version\n super\n end",
"def version\n super\n end",
"def version\n super\n end",
"def version\n super\n end",
"def version\n super\n end",
"def version\n super\n end",
"def version\n super\n end"
] | [
"0.6723737",
"0.6723737",
"0.6723737",
"0.6723737",
"0.6659281",
"0.664731",
"0.66338986",
"0.65876263",
"0.6467459",
"0.6310855",
"0.61711985",
"0.61427736",
"0.61385816",
"0.6134556",
"0.60396314",
"0.6014451",
"0.5994631",
"0.5983378",
"0.58720636",
"0.5855758",
"0.5851338",
"0.5851338",
"0.5851338",
"0.5851338",
"0.5834483",
"0.5820719",
"0.57836115",
"0.5778899",
"0.57472235",
"0.5743055",
"0.57350826",
"0.57152116",
"0.5706307",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.5701604",
"0.56502515",
"0.5646122",
"0.5608442",
"0.5605139",
"0.5589043",
"0.5589043",
"0.55863404",
"0.557846",
"0.557002",
"0.5547635",
"0.5530073",
"0.55143666",
"0.55141896",
"0.5505687",
"0.54942816",
"0.5489598",
"0.5488771",
"0.5488771",
"0.5488771",
"0.5488771",
"0.5488771",
"0.54780716",
"0.54587525",
"0.54568034",
"0.54568034",
"0.5456327",
"0.5449817",
"0.54429734",
"0.54410964",
"0.54410964",
"0.54410964",
"0.5429609",
"0.5429609",
"0.54278725",
"0.5424783",
"0.54242736",
"0.54184586",
"0.54184586",
"0.54184586",
"0.54184586",
"0.54184586",
"0.54184586",
"0.54184586",
"0.54184586"
] | 0.66784006 | 4 |
Prints the main menu only | def show_main_menu
puts "Welcome to the app. What's next?"
puts " new - Create a new contact"
puts " list - List all contacts"
puts " find - Find by name"
puts " quit - Exit Application"
print "> "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main()\n main_menu(SHOW_HEADER);\n end",
"def display_main_menu(clear_screen = false)\n clear if clear_screen\n title_header(TITLES[:main_menu],\"_\",\"-\",false)\n\n Api.main_topics.each_with_index do |type, i|\n puts \"#{(\" \" * (PROFILE_SIDE / 2))}#{i+1}\".green + \". #{type}\" \n end\n\n puts \"\\n NAVIGATE: \".black.on_green + \" #{nav_main}\".on_black\n input_menu\n end",
"def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end",
"def print_menu\n\t\tsystem ('cls') or system ('clear')\n\t\t@todo_list.print_list\n\t\tprint_menu_options\n\tend",
"def print_main_menu\n puts \"1. Add a contact\"\n puts \"2. Modify a contact\"\n puts \"3. Display all contacts\"\n puts \"4. Display a contact\"\n puts \"5. Display contact attributes\"\n puts \"6. Delete a contact\"\n puts \"7. Exit\"\n end",
"def show_main_menu\n puts \"Welcome to the app. What's next?\".yellow\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - display details via index\"\n puts \" find - find someone by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def show_main_menu\n puts \"What would you like do next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" delete - Delete a contact\"\n puts \" show - Display contact details\"\n # puts \" find - Find a contact\"\n print \"> \"\n end",
"def show_main_menu\n puts \" Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" list important - List all contacts\"\n puts \" show :id - Display contact details\"\n puts \" delete - Delete an entry\"\n puts \" find - Find an entry\"\n print \"> \"\n end",
"def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end",
"def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" delete - Delete by ID\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def show_main_menu\n puts \"\\e[H\\e[2J\"\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend",
"def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend",
"def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show id - Show info for contact id number\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end",
"def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend",
"def main_menu\n puts \"Here is a list of available commands:\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Show a contact\"\n puts \" search - Search contacts\"\n puts \" delete - Deletes a contact\"\n end",
"def show_main_menu\n puts \"Welcome to the app. What would you like to do?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n puts \" show - shows contact with specific id\"\n puts \" find - find a user\"\n print \"> \"\n end",
"def print_menu\n puts \"1. List patients\"\n # ....\n end",
"def main_menu\n\t\tputs '################################'\n\t\tputs '######### Tic Tac Toe ##########'\n\t\tputs '################################'\n\t\tputs '================================'\n\t\tputs '== Choose your weapon warrior =='\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$$$ 1. \"X\" $$$$$$$$$$$$$'\n\t\tputs '$$$$$$$$$$$ 2. \"O\" $$$$$$$$$$$$$'\n\t\tputs '--------------------------------'\n\tend",
"def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end",
"def print_main_menu\n\t\tputs \"[1] Add a contact\"\n\t\tputs \"[2] Modify a contact\"\n\t\tputs \"[3] Display all contacts\" \n\t\tputs \"[4] Display one contact\"\n\t\tputs \"[5] Display an attribute\"\n\t\tputs \"[6] Delete a contact\"\n\t\tputs \"[7] Exit\"\n\t\tputs \"Enter a number\"\n\tend",
"def main_menu\n puts \"---------------Animal shelter 4.5A-----------\"\n puts\n puts \"[1] List clients\"\n puts \"[2] List animals for adoption\"\n puts \"[3] Add a new client\"\n puts \"[4] Add a new animal\"\n puts\n puts\n puts \"[5] exit\"\n puts \"---------------------------------------------\"\nend",
"def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend",
"def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" update - Enter ID to update a contact\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end",
"def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" add - Add phone numbers\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end",
"def main_menu(owner_name, owner)\n puts \"#{page_break}\\n\n Select from the following menu options to get started:\\n\n 1 - Make New Appointent\n 2 - Reschedule Appointment\n 3 - Cancel Appointment\n 4 - Search for a Groomer\n 5 - Exit\n \"\n end",
"def main_menu\n puts <<~Doc\n Welocome to the New York Times Bestsellers List!\n Please choose one of the following options to get started:\n Doc\n NytBestsellersList::Lists.print_list_names\n end",
"def main_menu()\n system 'clear'\n loop do\n headline(\"My Petsitter App\")\n puts \"#{@emoji[:smiling_cat_face_with_open_mouth]} Welcome! #{@emoji[:dog_face]}\".colorize(:bold)\n puts @headline\n input = @prompt.select('Menu:') do |menu|\n menu.choice name: 'Pet Sitters', value: \"PET_SITTERS\"\n menu.choice name: 'Clients', value: \"CLIENTS\"\n menu.choice name: 'Jobs', value: \"JOBS\"\n menu.choice name: 'Logout', value: \"EXIT\"\n end\n puts '-' * 20\n go_to(input)\n end\n end",
"def print_menu\n isFinished = true\n while (isFinished)\n puts @menu_description\n @menu_items.each_pair { |key, value|\n puts \"(#{key}) #{value}\"\n }\n\n isFinished = determine_action(get_entry(\"Select option: \"))\n end\n end",
"def main_menu\n puts \"Main Menu\"\n puts \"(a) - Basic calculator\"\n puts \"(b) - Advanced calculator\"\n puts \"(c) - Special calculators\"\n puts \"(q) - Quit\"\nend",
"def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end",
"def menu\n # This uses a HEREDOC for multiline listing\n puts \"-------------------------\".colorize(:green) \n puts <<-MENU\n\nChoose a how you would like to see a card. You can view by name, creature, enchantment or sorcery:\n1. See cards by Name \n2. See cards by Creature \n3. See cards by Enchantment \n4. See cards by Sorcery\n\nOr type 'exit' at any time to leave the program. Type 'menu' to return to the main menu.\n MENU\n end",
"def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end",
"def print_main_menu\n\t\tputs \"[1] Add a new contact\"\n\t\tputs \"[2] Modify an existing contact\"\n\t\tputs \"[3] Delete a contact\"\n\t\tputs \"[4] Display all the contacts\"\n\t\tputs \"[5] Display an attribute\"\n\t\tputs \"[6] Exit\"\n\t\tputs \"Enter a number: \"\n \tend",
"def print_menu\n self.menu_items.each do |item|\n p \"#{item.dish_name.upcase} 😋 $#{item.price}\"\n end\n end",
"def print_menu\n MENU.each do |i| \n # in general, avoid printing things.\n # Return them instead and let the code that called it\n # to return it\n puts \"#{i[:name]} costs #{i[:price]}\"\n end\n end",
"def print_menu menu_level= '0'\n print_menu_header menu_level\n\n 20.times do |counter|\n lvl = \"#{menu_level}.#{counter}\"\n puts \" #{counter} : \" + @menu_map[lvl][0] if @menu_map.has_key?(lvl)\n end\n puts \"Make a choice between those items. (X to exit)\"\n puts \"Use left arrow to go back\"\n end",
"def run_normal\n welcome_header\n main_menu \n end",
"def print_menu\n puts \"\\nMAIN MENU\"\n puts \"add (+)\"\n puts \"subtract (-)\"\n puts \"multiply (*)\"\n puts \"divide (/)\"\n puts \"modulo (%)\"\n puts \"exponify (^)\"\nend",
"def main_menu\n menu = [\n \"My Stats\",\n \"My Hikes\",\n \"Trails\",\n \"Quit\"]\n choice = nil\n while choice != \"Quit\"\n system 'clear'\n puts \"------MAIN MENU------\"\n choice = @prompt.select(\"What would you like to do #{@current_user.name}?\", menu)\n\n case choice\n when \"My Stats\"\n user_stats\n when \"My Hikes\"\n hike_options\n when \"Trails\"\n trail_options\n end\n end\n end",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend",
"def print_menu_options\n puts \"\"\n puts \"-------Main menu-------\".center(50)\n puts \"1. Add Students\"\n puts \"2. Show all students\"\n puts \"3. Show all the students that their names starts with an 'A'\"\n puts \"4. Show all the students that their names have less than 12 characters\"\n puts \"5. Show the students grouped by cohort\"\n puts \"6. Save the students in a file\"\n puts \"7. Load students from the file\"\n puts \"8. Update student information\"\n puts \"9. Exit\"\nend",
"def main_menu\n\n\tputs \"***Ruby Cheatsheet***\"\n\tputs \"1. Command Line\"\n\tputs \"2. IDE\" \n\tputs \"3. Search\"\n\tputs \"4. Quit\"\n\tputs \"Make a selection 1 - 4:\"\n\nend",
"def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend",
"def print_main_menu\t\n\t puts\n\t puts \"[1] Add a new contact\"\n\t puts \"[2] Modify an existing contact\"\n\t puts \"[3] Search and display a contact\"\n\t puts \"[4] Delete a contact\"\n\t puts \"[5] Display all contacts\"\n\t puts \"[6] Display a list by attribute\"\n\t puts \"[7] Exit this system\"\n\t puts\n\t puts \"Please enter a number from the above options: \"\n\tend",
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend",
"def nav_main(topic = \"main\")\n main = \"\"\n back = \"\"\n profile = \"[\" + \"\\#\".green + \"] View Profiles \"\n exit_cli = \"[\" + \"exit\".green + \"] Exit Program \"\n if topic != 'main'\n back = \"[\" + \"menu\".green + \"] Main Menu \" if topic != \"Top Ten\" || topic != \"kidnapped\"\n # else\n # main = \"[\" + \"menu\".green + \"] Main Menu \" if topic != \"main\"\n end\n \"#{profile}#{back}#{main}#{exit_cli}\"\n end",
"def main_menu\n input = 0\n until input.to_i == @@main_ops.length - 1 \n print \"\\e[H\\e[2J\" #clears the screen\n puts @name \n print_menu(@@main_ops)\n print \"Choose an option by entering a number: \"\n input = gets.chomp\n call_option(input)\n end\n end",
"def main_menu\n\tputs \"Welcome to Happitails!\"\n\tputs \"Please choose from the options below\"\n\tputs \"1. Add Animal\"\n\tputs \"2. Create Client\"\n\tputs \"3. Adopt an animal\"\n\tputs \"4. Put animal up for adoption\"\n\tputs \"5. View all animals\"\n\tputs \"6. View all clients\"\n\n\n\t# puts \"Z. SECRET DEBUGGING MODE\"\n\n\tputs \"q. Quit\"\nend",
"def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend",
"def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end",
"def goldberg_main_menu\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_menubar.rhtml\", :use_full_path => false, :locals => {:level => 0, :depth => 0, :class_attr => nil}\n end",
"def print_main_menu\n puts \"[1] Add a new contact\"\n puts \"[2] Modify an existing contact\"\n puts \"[3] Delete a contact\"\n puts \"[4] Display all contacts\"\n puts \"[5] Search by attribute\"\n puts \"[6] delete_all\"\n puts \"[7] exit\"\n puts \"Enter a number: \"\n end",
"def main_menu\n while true\n print_main_menu\n user_selected =gets.to_i\n call_option(user_selected)\n end\n end",
"def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end",
"def print_menu\n puts \"User's Menu\\n-----------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def menu_display\n system(\"clear\")\n\t\tputs \"##############################\"\n\t\tputs \"# #\"\n\t\tputs \"# Select a number #\"\n\t\tputs \"# from below #\"\n\t\tputs \"# #\"\n\t\tputs \"# 1. Balance #\"\n\t\tputs \"# 2. Deposit #\"\n\t\tputs \"# 3. Withdraw #\"\n\t\tputs \"# 4. History #\"\n\t\tputs \"# 5. Exit #\"\n\t\tputs \"# #\"\n\t\tputs \"# #\"\n\t\tputs \"##############################\"\n end",
"def print_main_menu\n puts '[1] Add a new contact'\n puts '[2] Modify an existing contact'\n puts '[3] Delete a contact'\n puts '[4] Display all the contacts'\n puts '[5] Search by attribute'\n puts '[6] Exit'\n puts 'Enter a number: '\n\n end",
"def main_menu\n\tputs \"[a] - addition\"\n\tputs \"[s] - subtraction\"\n\tputs \"[m] - multiplication\"\n\tputs \"[d] - divison\"\n\tputs \"[exp] - exponent\"\n\tputs \"[sqrt] - square root\"\n\tputs \"[q] - quit\"\nend",
"def display_main_menu\n loop do\n case main_menu_selection\n when 1\n RunApp.start_quiz(1)\n when 2\n RunApp.start_quiz(2)\n when 3\n exit\n end\n end\n end",
"def print_menu\n # 1. print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"9. Exit\" # '9' because we'll be adding more items later\nend",
"def display_menu(menu)\n puts menu.title\n menu.menu_items.each_with_index { |item| puts \"#{item.key_user_returns}.\\t #{item.user_message}\" }\n end",
"def main_menu\n while true\n print_main_menu\n user_selected = gets.chomp.to_s\n call_option(user_selected)\n end\n end",
"def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end",
"def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend",
"def main_menu\n\tfinished = false\n\tbegin\n\t puts ' Text Music Player '.colorize(:color => :black, :background => :yellow)\n\t puts\n\t puts ' Main Menu: '.colorize(:color => :while, :background => :blue)\n\t puts '1 - Read in Album '.colorize(:color => :black, :background => :white)\n\t puts '2 - Display Albums Info '.colorize(:color => :black, :background => :white)\n\t puts '3 - Play Album '.colorize(:color => :black, :background => :white)\n\t puts '4 - Update Album '.colorize(:color => :black, :background => :white)\n\t puts '5 - Exit '.colorize(:color => :black, :background => :white)\n\t choice = read_integer_in_range(\"Option: \", 1, 5)\n\t case choice\n\t when 1\n\t\tdatabase_file = read_file\n\t\talbums = read_albums(database_file)\n\t when 2\n\t\tif validate(albums)\n\t\t\tprint_albums_info(albums)\n\t\tend\n\t when 3\n\t\tif validate(albums)\n\t\t\tplay_album(albums)\n\t\tend\n\t when 4\n\t\tif validate(albums)\n\t\t\tselect_update_album(albums)\n\t\tend\n\t else\n\t\tif isUpdated(albums)\n\t\t\tputs 'Updating album file infomation..'\n\t\tend\n\t\tfinished = true\n\t end\n\tend until finished\nend",
"def bar\n puts 'bar'\n main_menu\nend",
"def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend",
"def menu\n\tputs\n\tputs\n puts \"Welcome to the Real Estate search engine\"\n puts \"To list all available apartments, please press 1\"\n puts \"Press Q to quit\"\nend",
"def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n prompt = TTY::Prompt.new(active_color: :blue)\n response = prompt.select(\"CTT-Lite\", available_options)\n system \"clear\"\n handle_main_menu(response)\n end",
"def display_main_menu\n puts \"\\nMain Menu\".colorize(:red)\n puts \"-----------------------\".colorize(:blue)\n puts \"You currently have $#{@player.wallet}\".colorize(:red)\n puts \"Please select one of the following:\".colorize(:red)\n puts \"1)Roulette\".colorize(:blue)\n puts \"2)Black Jack\".colorize(:blue)\n puts \"3)Slots\".colorize(:blue)\n puts \"4)Dice\".colorize(:blue)\n puts \"5)Horse Races\".colorize(:blue)\n puts \"6)Additional Options\".colorize(:blue)\n puts \"-----------------------\".colorize(:blue)\n print \"> \"\n choice = gets.to_i\n case choice\n when 1 # Roulette\n Roulette.new(@player)\n when 2 # Black Jack\n BlackJack.new(@player)\n when 3 # Slots\n Slots.new(@player)\n when 4 # Dice\n Dice.new(@player)\n when 5 # Horse Races\n HorseRaces.new(@player)\n when 6\n repeat_menu\n else\n puts \"Invalid input, try again.\".colorize(:red)\n sleep(1)\n display_main_menu\n end\n print `clear`\n repeat_menu\n end",
"def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend",
"def display_menu\n puts \"1. Scrapp townhalls' emails from web\"\n puts \"2. Send massive emails to townhalls\"\n puts \"3. Follow towhalls on Twitter\"\n puts \"4. Print me the JSON\"\n puts \"5. Exit program\"\n end",
"def show_menu\n planet_list = \"\"\n i = 1\n @solar_system.length.times do |n|\n planet_list << \"\\n#{i}. #{@solar_system[n].name}\"\n i += 1\n end\n return \"\\nPlanet List#{planet_list}\\nOther: Exit\\n\\n\"\n end",
"def menu\n \n \n\nend",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def print_menu\n print <<MENU\n \\nPlease choose one of the following options:\n 1. Encrypt\n 2. Decrypt\n 3. Exit\nMENU\nend",
"def main_menu\n \"Welcome to BATTLESHIP\\nEnter p to play or q to quit\"\n end",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def menu\n draw_line\n puts \" _______________________________________________________ \"\n puts \" | |\"\n puts \" | ~~THE QUEST~~ |\"\n puts \" | |\"\n puts \" | >>>>>>>>>>> 1. Thebes |\"\n puts \" | >>> | 2. Troy |\"\n puts \" | | = | 3. Hades |\"\n puts \" | | __| 4. GO HOME |\"\n puts \" | | -| |\"\n puts \" | |______| |\"\n puts \" | |\"\n puts \" |_______________________________________________________|\"\nend",
"def main_menu\n @@prompt.select(\"What would you like to do today?\".colorize(:yellow)) do |menu|\n menu.choice \"Read Reviews\", -> {self.read_reviews}\n menu.choice \"Write a review\", -> { self.writing }\n menu.choice \"Update a review\", -> { self.update_reviews }\n menu.choice \"Delete a review\", -> { self.deleting }\n menu.choice \"Log Out\", -> { self.log_out }\n end\n end",
"def print_menu\n # 1. Print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\"\nend",
"def print_menu\n #print menu message\n border = @menu[:message].gsub(/\\s|\\S/, '*')\n puts border\n puts @menu[:message]\n puts border\n\n #print dishes This is very convoluted but using nested loops i can \n #print the menu and keep it organized the way i want it\n @menu[:options].each do |item| #this grabs all the items in the options hash\n item[:dish].each_with_index do |item2, index| #this grabs the dish array within the option hash\n puts \"#{index+1}. #{item2} - $#{(item[:price][index])}\"#the item[:price][index] grabs all the prices associated with each menu item\n end \n end\n end",
"def render_clf_main_menu(project, options = {})\n # Default options\n options = {\n :ul_class => 'nav',\n :li_class => 'menucontent',\n :menulink_class => 'menulink',\n :title => :clf2_text_main_menu\n }.merge(options)\n\n render_clf_menu((project && !project.new_record?) ? :project_menu : :application_menu, project, options)\n end",
"def print_menu\n puts \"Select one of the following options:\"\n puts \"----//--------//------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list of students\"\n puts \"4. Load the list of students\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def strass_menu_help\n puts \"Available Options for the String Assistant Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"show basic \".light_yellow + \" => \".white + \"Show Basic Functions\".light_red\n puts \"show build \".light_yellow + \" => \".white + \"Show Builder Functions\".light_red\n puts \"show tamper \".light_yellow + \" => \".white + \"Show Tamper Functions\".light_red\n puts \"show append \".light_yellow + \" => \".white + \"Show Append Functions\".light_red\n puts \"show space \".light_yellow + \" => \".white + \"Show Whitespace Functions\".light_red\n puts \"show comma \".light_yellow + \" => \".white + \"Show Comma Functions\".light_red\n puts \"show floor \".light_yellow + \" => \".white + \"Show Floor() Functions\".light_red\n print_line(\"\")\nend",
"def display_menu\n puts \"Welcome to Lorrayne and Sherwin's coffee emporium!\\n\\n\"\n puts \"1) Add item - $5.00 - Light Bag\"\n puts \"2) Add item - $7.50 - Medium Bag\"\n puts \"3) Add item - $9.75 - Bold Bag\"\n puts \"4) Complete Sale\"\n end",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list to a file\"\n puts \"9. Exit\"\nend",
"def print_menu\n puts \"\\n1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to file\"\n puts \"4. Load the list from file\"\n puts \"9. Exit\" # '9' beacuse we'll be adding more.\nend",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend",
"def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a csv file\"\n puts \"4. Load the list from a csv file\"\n puts \"5. Print the source code for this programme\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def menu\nend",
"def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend",
"def main_menu\n\tputs \"\\n1 Library\\n2 Staff Members\\n3 Books\\n4 Patrons\\n0 Exit\\n\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tlibrary_choice = \"9\"\n\t\twhile library_choice != \"0\"\n\t\t\tlibrary_choice = select_choice_library\n\t\tend\n\n \telsif select == \"2\"\n\t\tstaff_member_choice = \"9\"\n\t\twhile staff_member_choice != \"0\"\n\t\t\tstaff_member_choice = select_choice_staff_member\n\t\tend\n\n\n\telsif select == \"3\"\n\t\tbook_choice = \"9\"\n\t\twhile book_choice != \"0\"\n\t\t\tbook_choice = select_choice_book\n\t\tend\n\n\n\telsif select == \"4\"\n\t\tpatron_choice = \"9\"\n\t\twhile patron_choice != \"0\"\n\t\t\tpatron_choice = select_choice_patron\n\t\tend\n\n\n\telsif select == \"0\"\n\t\tputs \"\\nGoodbye\"\t\t \t\t\n\tend\n\tselect \nend"
] | [
"0.78009224",
"0.7689885",
"0.7643563",
"0.76135117",
"0.7599054",
"0.7596337",
"0.75843924",
"0.7488118",
"0.74608237",
"0.74579257",
"0.7409105",
"0.7360588",
"0.7335936",
"0.7329466",
"0.7329066",
"0.73279434",
"0.72759974",
"0.72679996",
"0.7208426",
"0.71990603",
"0.71821415",
"0.7146991",
"0.7133577",
"0.7132169",
"0.712203",
"0.7109032",
"0.70976496",
"0.7092224",
"0.70649004",
"0.70496505",
"0.7041543",
"0.7014145",
"0.6990738",
"0.6967292",
"0.6959382",
"0.6953885",
"0.69242513",
"0.69173056",
"0.687204",
"0.685082",
"0.6846358",
"0.6833789",
"0.6827896",
"0.6816585",
"0.68116426",
"0.6811259",
"0.6779605",
"0.6779442",
"0.6776788",
"0.6762294",
"0.6758214",
"0.6755507",
"0.6755276",
"0.6738198",
"0.66836065",
"0.66804785",
"0.66708314",
"0.6669499",
"0.6669496",
"0.66552794",
"0.66501",
"0.6648121",
"0.66451895",
"0.6636022",
"0.6613525",
"0.65904915",
"0.65879846",
"0.6584302",
"0.65831184",
"0.6545118",
"0.6536809",
"0.6535004",
"0.6535004",
"0.65338296",
"0.6522073",
"0.6516454",
"0.65134495",
"0.6504378",
"0.6493465",
"0.6484608",
"0.64830446",
"0.6476329",
"0.6465355",
"0.6462348",
"0.6458203",
"0.6455814",
"0.64460385",
"0.6442923",
"0.6437053",
"0.6430825",
"0.6429241",
"0.64252645",
"0.6418039",
"0.641024",
"0.641024",
"0.64070165",
"0.6401214",
"0.63938534",
"0.639162",
"0.6385068"
] | 0.7509519 | 7 |
def show_contact Contact. end | def get_contact_name
puts "Please enter the contact first name:"
gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n\n end",
"def contact\n\n end",
"def contact; end",
"def show\n @contact = Contact.new\n end",
"def show\n @contact = contacts.find(params[:id])\n end",
"def show\n @contact = Contact.find(params[:id])\n end",
"def contact \n\n end",
"def show\n @contact = Contacte.find(params[:id])\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def show\n @func_contact = FuncContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @func_contact }\n end\n end",
"def show\r\n\t\t@contact = current_user.contacts.find(params[:id])\r\n\tend",
"def contact\n\t\t@contact\n\tend",
"def contact\n\t\t@contact\n\tend",
"def contactus\r\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def contactus\n end",
"def show_contact(id)\n get(\"contacts/#{id}\")\n end",
"def show\n @contact = current_user.contacts.find(params[:id])\n\n end",
"def show\n @contact = Contact.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def contacts\r\n\r\n end",
"def show(id)\n contact = Contact.find(id)\n puts contact ? full_contact(contact) : \"Contact with id #{id} not found\"\n end",
"def show\n @contact = Contact.find(params[:id])\n @company = @contact.company\n @company = Company.new if !@company\n @company_path_ = @company.id ? company_path(@company) : \" \"\n restrict_access(\"contacts\") if @contact.firm_id != @firm.id\n end",
"def display_one_contact(contact)\n if contact\n puts \"Name: #{contact.name}\"\n puts \"E-mail: #{contact.email}\"\n puts \"Phone Number: #{contact.phone_number}\"\n else\n puts \"Not found!\"\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n @title = @contact.name\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @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 @contact = Contact.find(params[:id])\n\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 = Contact.find(params[:id])\n\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 = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def app_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 contact\n # STUB\n end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); 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 authorize @contact\n\n session[:ret_url] = contact_path(@contact, @shared_user)\n end",
"def show\n @person_contact = PersonContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person_contact }\n end\n end",
"def show\n puts \"need an index?\".green\n index = gets.chomp.to_i\n show_contact(@@contacts.at(index))\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 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 show\n @contacto = Contacto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contacto }\n end\n end",
"def show ( contact )\n puts \"#{contact[:name]}\"\n puts \"phone: #{contact[:phone]}\"\n puts \"email: #{contact[:email]}\"\n puts\nend",
"def show\n @contact = CompanyContact.find(params[:id])\n respond_with @contact\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 \t@contacts = Contact.all\n \t@contact = Contact.find_by_permalink(params[:permalink])\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 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 @contactos = Contactos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contactos }\n end\n end",
"def show\n @provider_contact = ProviderContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @provider_contact }\n format.xml { render :xml => @provider_contact }\n end\n end",
"def display_particular_contact(id)\n if person = Contact.find_by(id: id)\n {status: true, contact: person.display}\n else\n {status: false, error: \"\\nContact not found.\"}\n end\n end",
"def show\n @contact_number = ContactNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact_number }\n end\n end",
"def show\n @contact.read\n @contact.save\n @sender = User.find_by(pseudo: @contact.sender)\n end",
"def show\n @user_contact = UserContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_contact }\n end\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 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 set_contact\n @category = \"Contact\"\n @contact = resource_owner.contacts.find(params[:id])\n end",
"def show\n @contact = Contact.find(params[:id])\n @contact.update_attribute(:is_active, false) if params[:deactivate].present?\n @contact.update_attribute(:is_active, true) if params[:activate].present?\n @class = @contact.is_active ? \"btn\" : \"btn disabled\"\n @next_contact = @contact.next_company\n @previous_contact = @contact.previous\n @members = @contact.members\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 @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 @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 show\n @contact_list = ContactList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact_list }\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 show\n @contact_details = current_user.client_application\n end",
"def show\n @general_contact = GeneralContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @general_contact }\n end\n end",
"def show\n@prac = Contact.find_by(:id => @oncourse_exercise.prac_id )\n@change_agent = Contact.find_by(:id => @oncourse_exercise.change_agent_id)\n end",
"def get_contact\r\n @contact = @customer.contact_people.find_by_name params[:id]\r\n end",
"def show\n @adoption_contact = AdoptionContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adoption_contact }\n end\n end",
"def display_contacts\n # Fill this in\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods\n Contact.all.each do |contacts|\n puts \":#{contacts.full_name}, #{contacts.email}, #{contacts.id}, #{contacts.note}\"\n end\n end",
"def contact\n @title = \"contact\"\n end",
"def show\n @contact_category = ContactCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact_category }\n end\n end",
"def show\n @contacto= @enc_contacto.contactos.build\n end",
"def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end",
"def show\n @marketing_contact = MarketingContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @marketing_contact }\n end\n end",
"def show\n @contacts = @lead.contacts\n @events = @lead.events\n end",
"def set_contact\n @contact = Contact.friendly.find(params[:id])\n end",
"def show\n @global_contact = GlobalContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @global_contact }\n end\n end",
"def show\n @contactinformation = Contactinformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contactinformation }\n end\n end",
"def show\n @emailcontact = Emailcontact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @emailcontact }\n end\n end",
"def display_contacts\n Contact.each do |contacts|\n print \"First name: #{contacts.first_name}, Last name: #{contacts.last_name}, Email address: #{contacts.email}, Notes: #{contacts.note}\"\n end\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\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 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 contact\n find('Contact', contact_id)\n end",
"def show\r\n if verif_admin\r\n\t @contact = Contact.find(params[:id])\r\n\t \r\n\t respond_to do |format|\r\n\t\t format.html # show.html.erb\r\n\t\t format.xml { render :xml => @contact }\r\n\t end\r\n else\r\n\t redirect_to :controller => 'admins', :action => 'index'\r\n end \r\n end"
] | [
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.81235385",
"0.80569017",
"0.80569017",
"0.79665256",
"0.79496145",
"0.7909112",
"0.78851795",
"0.78819156",
"0.78479856",
"0.78211206",
"0.77367663",
"0.7696487",
"0.76631194",
"0.76631194",
"0.76508313",
"0.7639121",
"0.7639121",
"0.7612509",
"0.7544091",
"0.75389",
"0.74812996",
"0.74763185",
"0.7463599",
"0.7409854",
"0.7406952",
"0.7393776",
"0.73761904",
"0.73591304",
"0.73591304",
"0.73591304",
"0.7341623",
"0.7285667",
"0.72527087",
"0.72445685",
"0.72445685",
"0.72445685",
"0.72445685",
"0.72445685",
"0.7238856",
"0.7238856",
"0.7238856",
"0.7238262",
"0.7221755",
"0.72129464",
"0.7204295",
"0.7202801",
"0.71997666",
"0.7183938",
"0.71806574",
"0.71644527",
"0.71602017",
"0.7134189",
"0.7119727",
"0.71055967",
"0.70974207",
"0.7091011",
"0.709056",
"0.7085547",
"0.7083112",
"0.70624405",
"0.7058708",
"0.7047564",
"0.70456356",
"0.70451367",
"0.7039585",
"0.70293134",
"0.7010355",
"0.7000848",
"0.70005226",
"0.6987813",
"0.698709",
"0.69787645",
"0.6968667",
"0.69540167",
"0.6943688",
"0.6938107",
"0.69314563",
"0.6923919",
"0.69230074",
"0.6917802",
"0.6917787",
"0.6906563",
"0.6905532",
"0.6891799",
"0.6889343",
"0.68753505",
"0.6873846",
"0.68710715"
] | 0.0 | -1 |
NOTE: For ref Manual way of authenticate request | def authenticate_manual
api_key = request.headers['X-Api-Key']
@app = App.where(api_key: api_key).first if api_key
unless @app
head status: :unauthorized
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate\n end",
"def authenticate(request)\n\n end",
"def authenticate!\n # Do nothing yet\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def authenticate_requester!(request)\n end",
"def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end",
"def auth\n end",
"def auth\n end",
"def authenticate(request, realm, &password_procedure); end",
"def authenticate\n auth.call(:authenticate)\n end",
"def authenticate\n self.get && true\n end",
"def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end",
"def http_auth?; end",
"def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend",
"def authenticate_request!(request)\n return if @authentication_params.empty?\n \n puts \"AUTHENTICATION PARAMS: #{@authentication_params.inspect}\"\n @nonce_count += 1\n cnonce = Digest::MD5.hexdigest(Time.now.to_s + rand(65535).to_s)\n a1 = \"#{@http_login}:#{@authentication_params['realm']}:#{@password}\"\n a2 = \"#{request.method}:#{request.path}\"\n\n response_digest = Digest::MD5.hexdigest(a1) << ':' <<\n @authentication_params['nonce'] << ':' <<\n ('%08x' % @nonce_count) << ':' <<\n cnonce << ':' <<\n @authentication_params['qop'] << ':' <<\n Digest::MD5.hexdigest(a2)\n\n request['Authorization'] = \"Digest username=\\\"#{@http_login}\\\", \" <<\n \"realm=\\\"#{@authentication_params['realm']}\\\", \" <<\n \"nonce=\\\"#{@authentication_params['nonce']}\\\", \" <<\n \"uri=\\\"#{request.path}\\\", \" <<\n \"nc=#{'%08x' % @nonce_count}, \" <<\n \"qop=\\\"#{@authentication_params['qop']}\\\", \" <<\n \"cnonce=\\\"#{cnonce}\\\", \" <<\n \"response=\\\"#{Digest::MD5.hexdigest(response_digest)}\\\"\"\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end",
"def authenticate\n # puts _process_action_callbacks.map(&:filter)\n # if current_user\n # session['user_id'] = current_user.id\n # true\n # else\n # session[:return_to] = request.original_url\n # respond_to do |format|\n # format.html { redirect_to login_url }\n # format.any(:xml,:json) { request_http_basic_authentication }\n # end\n # false\n # end\n true\n end",
"def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end",
"def authenticate\n \n authenticate_token || render_unauthorized\n end",
"def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end",
"def authenticate\n\t\tauthenticate_token || render_unauthorized\n\tend",
"def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def auth(value); end",
"def auth_param; end",
"def authenticate\n authorize || unauthorized\n end",
"def authenticate\n authenticate_token || render_unauthorized\n end",
"def Authentication\n call('', '')\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def authenticate\n authenticate_token || render_unauthorized\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def auth\n {}\n end",
"def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend",
"def http_auth_hash; end",
"def authenticate\n\t\t \tauthenticate_basic_auth || render_unauthorized\n\t\t \tend",
"def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend",
"def authenticate\n # logger.debug(\"APP: authorization: #{temp_debug(request)}\")\n set_last_uri\n return true unless application_user.nil?\n # logger.info(\"Header NOT-SET = #{request.headers['NOT-SET'].inspect}\")\n if request.env.has_key? \"REMOTE_USER\"\n logger.info(\"REMOTE_USER = #{request.env[\"REMOTE_USER\"]}\")\n apache_authenticate\n elsif request.headers.has_key?('HTTP_X_FORWARDED_USER')\n logger.info(\"Header HTTP_X_FORWARDED_USER = #{request.headers['HTTP_X_FORWARDED_USER']}\")\n proxy_apache_authenticate\n elsif Rails.env == \"test\"\n logger.info(\"Authenticate via test\")\n testing_authenticate\n elsif NONE_AUTHENTICATE\n logger.info(\"Authenticate via none\")\n none_authenticate\n else\n ldap_authenticate\n end\n end",
"def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end",
"def authenticate!\n token = Configuration.authentication_token\n secret = Configuration.authentication_secret\n creds = {token => params[token], secret => params[secret]}\n\n response = HTTPClient.get(Configuration.authentication_endpoint, creds)\n\n unless response.ok?\n halt(403, \"Authentication failed: #{response.body}\")\n end\n end",
"def authenticate(username, password)\n end",
"def authenticate_request!\n raise Exceptions::UnauthorizedError unless current_member\n\n current_member\n end",
"def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def authenticate!\n Authenticator.verify!(params['token'])\n end",
"def authenticate\n \t# get token from header\n \tauthentication_token = request.headers['token']\n \t@user = User.find_by_authentication_token authentication_token if authentication_token\n \t\n \tunless @user\n \t\trender json: {success: false, message: I18n.t('unauthorized'), data: {}}, status: :unauthorized\n \t\treturn false\n \tend\n end",
"def credentials(authorization, request); end",
"def authenticate(request)\n return unless request['Authorization'].nil?\n\n confkey = credential_config_key\n\n token = config(\"#{confkey}.token\")\n user = config(\"#{confkey}.user\")\n pass = config(\"#{confkey}.password\")\n\n if token\n request['Authorization'] = \"token #{token}\"\n elsif user\n begin\n if $stdin.tty?\n pass = ask(\"Enter your password for #{api_url}: \") { |q| q.echo = '*' } if !pass\n else\n $stderr.puts \"STDIN not a TTY - cannot query for missing password.\"\n $stderr.puts \"Please add #{confkey}.password or #{confkey}.token to your gitconfig\"\n exit 1\n end\n rescue Interrupt\n warn \"attempting connection without authorization..\"\n return\n end\n request.basic_auth(user, pass)\n else\n $stderr.puts \"No currently configured username/password or token set for this API Provider.\"\n exit 1 unless $stdin.tty? && setup_credentials\n authenticate(request)\n end\n end",
"def authenticate_user(request)\n @log.info(\"Authentication user #{@username}\")\n request.basic_auth(@username, @password)\nend",
"def basic_auth(*args, &block); end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def valid_for_http_auth?; end",
"def authenticate\n begin \n # TODO No data required to authenticate, send a nil string? hacky\n # TODO should retry if a http connection failed\n return @authenticated if @authenticated\n authenticated = call_remote(:authenticate, \"\")\n @authenticated = authenticated =~ /true/\n rescue \n @authenticated = false\n ensure\n return @authenticated\n end\n end",
"def auth\n if request.get?\n show_auth\n elsif request.post?\n check_auth\n end\n end",
"def authenticate\n case request.format\n when Mime::XML, Mime::ATOM\n if user = authenticate_with_http_basic { |u, p| User.authenticate(u, p) }\n self.current_user = user\n else\n request_http_basic_authentication\n end\n else\n if !session_authenticated?\n remember_requested_location\n redirect_to(new_session_path) and return false\n end\n end\n end",
"def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication failed', status: 401\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |name, password|\n if m=Member.find_by_name(name) \n if (m.authenticate(password) && m.role == \"administrator\")\n\t\t true\n\t\telse\n\t\t false\n\t\tend\n else\n false\n end\n end\n\tname=\"\"\n\tpassword=\"\"\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end",
"def capable_login_auth?; end",
"def authenticate\n \t\tlogged_in? || access_denied\n \tend",
"def authenticate\n authed = true\n if(resource.respond_to?(:authenticate, true))\n authed = false\n uname = nil\n password = nil\n if(request.env['HTTP_AUTHORIZATION'])\n auth = Rack::Auth::Basic::Request.new(request.env)\n if(auth.basic? && auth.credentials)\n uname = auth.credentials[0]\n password = auth.credentials[1]\n end\n end\n authed = resource.send(:authenticate, uname, password)\n end\n raise Unauthorized unless authed\n end",
"def authenticate\n RestClient.post @apiurl + \"authenticate\", \n :username => @username, \n :password => @password\n rescue RestClient::RequestFailed\n handle_error($!)\n return false\n end",
"def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end",
"def authenticate(client)\n \n end",
"def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end",
"def authenticate\n case request.format\n when Mime::XML, Mime::JSON\n unless logged_in? && admin?\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == USER_NAME && password == PASSWORD\n end\n end\n else\n render_404 and return unless logged_in? && admin?\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |email, password| \n User.authenticated?(email, password, request.remote_ip)\n end\n end",
"def authentication_request(controller, realm, message = T.unsafe(nil)); end",
"def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend",
"def authenticate()\n\tuser_env = @env[\"Authorization\"] || @env[\"HTTP_AUTHORIZATION\"]\n if user_env\n user = Base64.decode64(user_env[6,user_env.length-6])[/\\w+/]\n\t\treturn user\n else\n \treturn nil\n\tend\nend",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def authenticate\n authenticated_user = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n response = { message: Message.logged_in, auth_token: authenticated_user[:auth_token], is_doctor: authenticated_user[:is_doctor], doctor_id: authenticated_user[:doctor_id], fullname: authenticated_user[:fullname], date_of_birth: authenticated_user[:date_of_birth] }\n json_response(response)\n end",
"def authenticate\n #Hace el llamado de la clase AuthenticaUser, manda los parametros de :username y :password\n #Realiza el metodo call para obtener el Token del user_id\n #Arroja el token como Json_response\n auth_token = AuthenticateUser.new(auth_params[:username], auth_params[:password]).call \n json_response(auth_token: auth_token)\n end",
"def authenticate\n # :x_amee_source = \"X-AMEE-Source\".to_sym\n request = Typhoeus::Request.new(\"#{protocol}#{@server}/auth/signIn\", \n :method => \"post\",\n :verbose => DEBUG,\n :headers => {\n :Accept => content_type(:xml),\n },\n :body => form_encode(:username=>@username, :password=>@password)\n )\n\n hydra.queue(request)\n hydra.run\n response = request.response\n\n @auth_token = response.headers_hash['AuthToken']\n d {request.url}\n d {response.code}\n d {@auth_token}\n\n connection_failed if response.code == 0\n\n unless authenticated?\n raise AMEE::AuthFailed.new(\"Authentication failed. Please check your username and password. (tried #{@username},#{@password})\")\n end\n # Detect API version\n if response.body.is_json?\n @version = JSON.parse(response.body)[\"user\"][\"apiVersion\"].to_f\n elsif response.body.is_xml?\n @version = REXML::Document.new(response.body).elements['Resources'].elements['SignInResource'].elements['User'].elements['ApiVersion'].text.to_f\n else\n @version = 1.0\n end\n end",
"def authentication_type; end",
"def authenticate\n\t\tauth_token =\n\t\t\tAuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n\t\tjson_response(auth_token: auth_token)\n\tend",
"def authenticate\n authenticate_or_request_with_http_basic(\"Fun!\") do |username, password|\n username == ENV[\"FUN_ADMIN_USER\"] && password == ENV[\"FUN_ADMIN_PASS\"]\n end\n end",
"def token_auth(*args, &block); end",
"def authenticate(password)\n true\n end",
"def auth_methods; end",
"def capable_plain_auth?; end",
"def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end",
"def authenticate\n klass.new(request).authenticate == true\n end",
"def login_from_basic_auth\nauthenticate_with_http_basic do |username, password|\nself.current_user = User.authenticate(username, password)\nend\nend",
"def authenticate!\n if in_flow?\n continue_flow!\n else\n begin_flow!\n end\n end",
"def authenticate\n authenticated_session || render_unauthorized\n end",
"def authenticate\n res = HTTParty.post(\n authenticate_url,\n body: body.to_json,\n headers: { 'Content-Type' => 'application/json' }\n )\n\n check_for_error(res)\n\n res.parsed_response\n end",
"def authenticate!\n raise AuthenticationFailed if authentication.failed?\n raise AuthenticationRequired unless authentication.authenticated?\n end",
"def params_auth_hash; end",
"def login\n \tauthenticate(params)\n end",
"def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def authenticate\n user_auth = AuthenticateUser.new(auth_params[:email],auth_params[:password])\n auth_token = user_auth.call\n\n if user_auth.check_student != \"student\"\n response = {message: Message.basic,user: auth_params[:email], auth_token: auth_token}\n\n else\n response = {message: Message.student, user: auth_params[:email], auth_token: auth_token }\n\n end\n json_response(response)\n end",
"def authentication_method\n super\n end",
"def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end",
"def authentication\n raise NotImplementedError\n end",
"def authenticate( request )\n\t\tself.log.debug \"No authentication provided, returning anonymous credentials.\"\n\t\treturn 'anonymous'\n\tend",
"def authenticate( request )\n\t\tauthheader = request.header.authorization or\n\t\t\tself.log_failure \"No authorization header in the request.\"\n\n\t\t# Extract the credentials bit\n\t\tbase64_userpass = authheader[ /^\\s*Basic\\s+(\\S+)$/i, 1 ] or\n\t\t\tself.log_failure \"Invalid Basic Authorization header (%p)\" % [ authheader ]\n\n\t\t# Unpack the username and password\n\t\tcredentials = base64_userpass.unpack( 'm' ).first\n\t\tself.log_failure \"Malformed credentials %p\" % [ credentials ] unless\n\t\t\tcredentials.index(':')\n\n\t\t# Split the credentials, check for valid user\n\t\tusername, password = credentials.split( ':', 2 )\n\t\tself.check_password( username, password )\n\n\t\t# Success!\n\t\tself.auth_succeeded( request, username )\n\t\treturn username\n\tend"
] | [
"0.8274238",
"0.82676715",
"0.7937465",
"0.7796201",
"0.77778196",
"0.77039933",
"0.77006316",
"0.77006316",
"0.76863253",
"0.76783955",
"0.76482433",
"0.76136935",
"0.7514551",
"0.7502928",
"0.74920034",
"0.7484768",
"0.74815667",
"0.7455801",
"0.74480003",
"0.7414616",
"0.7393196",
"0.739077",
"0.73844224",
"0.7368804",
"0.7367741",
"0.7365253",
"0.7360623",
"0.7344094",
"0.7338416",
"0.73336875",
"0.7333293",
"0.73061365",
"0.72876096",
"0.72872627",
"0.7279847",
"0.7272483",
"0.7252479",
"0.72398865",
"0.72327006",
"0.72314936",
"0.7224546",
"0.72199506",
"0.72051483",
"0.72021717",
"0.7189276",
"0.7187363",
"0.7180484",
"0.71751314",
"0.716922",
"0.71640307",
"0.7160964",
"0.715478",
"0.715478",
"0.71475947",
"0.7141806",
"0.7138287",
"0.71032304",
"0.71019655",
"0.7094718",
"0.70876724",
"0.70856875",
"0.70822406",
"0.70801497",
"0.7078481",
"0.70717704",
"0.70636666",
"0.7062052",
"0.7055914",
"0.705122",
"0.70469576",
"0.7038641",
"0.7038168",
"0.70360357",
"0.70360357",
"0.7033603",
"0.7023839",
"0.70207524",
"0.7018938",
"0.70167243",
"0.70167124",
"0.7011866",
"0.7011358",
"0.6995774",
"0.69946027",
"0.69945866",
"0.6993852",
"0.69922686",
"0.6987065",
"0.6985477",
"0.6985186",
"0.6973803",
"0.6970167",
"0.69691277",
"0.69681346",
"0.6965276",
"0.69642574",
"0.6964117",
"0.69638884",
"0.6963791",
"0.6960528",
"0.69588983"
] | 0.0 | -1 |
Check request per min You can add field to user table request per min or define constant. Here I am just passsing some random value | def validate_rpm
if ApiRpmStore.threshold?(@app.id, @app.api_rpm) # 10 request per min
render json: { help: 'http://prediction.io' }, status: :too_many_requests
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end",
"def set_MinCount(value)\n set_input(\"MinCount\", value)\n end",
"def set_MinCount(value)\n set_input(\"MinCount\", value)\n end",
"def set_min(min)\n\n @min = min \n\n end",
"def min_count\n multiple? ? (@schema['min_count'] || 0) : nil\n end",
"def param_min(param_id)\r\n return 0 if param_id == 1 # MMP\r\n return 1\r\n end",
"def time_min; Time.now.min; end",
"def key_for_min_value\n end",
"def set_min(fields)\n view.update_many(\"$min\" => collect_operations(fields))\n end",
"def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end",
"def get_min\n @min ||= calculate_min\n end",
"def check_daily_limit\n # unless self.user.glucose_levels.of_date(Date.today).count < GlucoseLevel::DAILY_LIMIT\n unless GlucoseLevel.where(user: self.user).of_date(Date.today).count < GlucoseLevel::DAILY_LIMIT\n self.errors.add(:value, \"Daily limit exeeds, You cannot create a new entry today\")\n end\n end",
"def generate_hourly_wage_fields(request)\n request.hourly_rate = (rand * 100.0).round(2)\n request.hours_per_week = (rand * 40.0).to_i + 1\n request.number_of_weeks = (rand * 52).to_i + 1\n end",
"def get_min()\n end",
"def min\n end",
"def min\n end",
"def need_set_threshold?\n return false if self.user_id # no need for registered users\n SmsCode.where([\"phone = ? and created_at > ?\", self.phone, 30.minutes.ago]).count >= 3\n end",
"def earliest(key, min)\n _request_id, time = @store.zrangebyscore(key, \"(#{min}\", '+inf', withscores: true, limit: [0, 1]).first\n time\n end",
"def get_min\n @min\n end",
"def min(value)\n opts[:min] = value\n end",
"def random_spawn_countdown minimum\n 10.randomize(:ratio, :sign).to_i + 60\n end",
"def min\n @min || 0;\n end",
"def get_min()\n @min \n end",
"def wallet_minimum\n (bet_count / 5) + 10\n end",
"def min() end",
"def min\n (count + increment) * multiplier\n end",
"def minimum_spend_met?\n !(user.try(:wholesaler?) && item_total.to_f < MINIMUM_ITEM_TOTAL)\n end",
"def ms_uniform(item_id, limit=1)\n return limit\nend",
"def generate_nonop_fields(request, max_funds)\n has_nonop = rand > 0.6\n return unless has_nonop\n request.nonop_funds = (max_funds * rand).round(2)\n request.nonop_source = Faker::Company.name\n end",
"def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end",
"def set_MinEntries(value)\n set_input(\"MinEntries\", value)\n end",
"def allowed?(request)\n value = options[:value] || 10\n\n key = cache_key(request)\n time = request_start_time(request)\n bucket = cache_get(key) rescue nil\n if bucket == nil\n bucket = {\n :time => Time.now.to_i,\n :tokens => value\n }\n end\n\n if bucket[:tokens] < value\n delta = (value * (Time.now.to_i - bucket[:time]))\n bucket[:tokens] = [value, bucket[:tokens] + (value * delta)].min\n end\n bucket[:time] = Time.now.to_i\n\n allowed = false\n if bucket[:tokens] > 0\n bucket[:tokens] -= 1\n allowed = true\n end\n\n begin\n cache_set(key, bucket)\n allowed\n rescue\n # If cache_set fails, just allow the request\n true\n end\n end",
"def min_count=(min_count)\n @active = (min_count > 0)\n end",
"def async_minimum(column_name)\n async.minimum(column_name)\n end",
"def daily_limit_check\n errors.add(:base, \"Glucose Level can not be added more than 4 times a day.\") if GlucoseLevel.where(:user_id => user_id, :registered_date => registered_date).size >= 4\n end",
"def minretrydelay\r\n\t\t\t`#{BITS::BITSADMIN} /getminretrydelay {#{@id}}`\r\n\t\tend",
"def get_min()\n @min\n end",
"def min_rating\n 0\n end",
"def minimum_interval\n 500\n end",
"def should_check_user_breeder(user, breeder_min=3)\n if !user.breeder? and user.listings.active.count >= breeder_min\n # set breeder flag\n user.update(breeder: true)\n elsif user.breeder? and user.listings.active.count < breeder_min\n # turn off breeder flag\n user.update(breeder: false)\n end\n end",
"def em(x, min=nil)\n min ||= x * @n / 5\n rand(x**@n) + min*@n\n end",
"def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"def key_for_min_value(name_hash)\n small_hash = nil\n \n lowest_num = rand(1..10)\n \n name_hash.each do |k, v|\n \n if v < lowest_num \n small_hash = k \n end \n end \n small_hash\nend",
"def increment_karma_if_needed\n if $user.karma_incr_time.to_i < (Time.now.to_i-KarmaIncrementInterval)\n userkey = \"user:#{$user.id}\"\n $r.hset(userkey,\"karma_incr_time\",Time.now.to_i)\n $user.change_karma_by KarmaIncrementAmount\n end\nend",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend",
"def set_MinResult(value)\n set_input(\"MinResult\", value)\n end",
"def min_field( field )\n Rackamole::Store::MongoDb.field_map[field] || field\n end",
"def key_for_min_value(name_hash)\nif name_hash == {}\n return nil\nelse\n minimum = 1000\n min_key = :placeholder\n name_hash.each do |key, value|\n if value < minimum\n minimum = value\n min_key = key\n end\n end\n min_key\nend\nend",
"def allow?(val = nil)\n val = val.nil? ? random_val : hashed_val(val)\n val < ramp_val\n end",
"def allow?(val = nil)\n val = val.nil? ? random_val : hashed_val(val)\n val < ramp_val\n end",
"def min_value(value, pdef)\n if(value.to_i >= pdef['MinValue'].to_i)\n true\n else\n \"Value must not be less than #{pdef['MinValue']}\"\n end\n end",
"def check_min_max\n\nend",
"def min_record\n min = record(infimum.next)\n min if min != supremum\n end",
"def min() time[1] end",
"def min_rate_must_be_over_minimum\n if !minimum_rate.blank? and minimum_rate < self.property.minimum_room_rate\n errors.add(:minimum_rate, I18n.t('room_types.validate.minimum_rate_must_be_over_minimum', :minimum => self.property.minimum_room_rate))\n end\n end",
"def require_minimum?\n self.minimum_positive_votes > 0\n end",
"def min\n\t\t\t@count\n\t\tend",
"def get_min_key()\n \n end",
"def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end",
"def min_interval\n MIN_INTERVAL\n end",
"def min; end",
"def min; end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def min_in\n @min_in ||= time_in.min\n end",
"def request(requests_made)\n # initiate requests_made if blank\n requests_made[:random] = 0 if requests_made[:random].blank?\n requests_made[:weighted] = 0 if requests_made[:weighted].blank?\n \n # Determine the number of requests to be made, before we must start over with counting\n # TODO: Move the common_denominator to the Campaign model as attribute\n if requests_made[:common_denominator].blank?\n requests_made[:common_denominator] = case \n when [0, 100].include?(random_ratio) then 1\n # Determine the highest common denominator\n else 50.downto(2).find {|i| random_ratio % i == 0 && (100 - random_ratio) % i == 0}\n end\n end\n \n # Determine which request should be made\n if ((rand * 100) < random_ratio && requests_made[:random] < (random_ratio / requests_made[:common_denominator])) ||\n ((100 - random_ratio) / requests_made[:common_denominator]) == requests_made[:weighted]\n requests_made[:random] += 1\n requests_made[:current_request] = :random\n else\n requests_made[:weighted] += 1\n requests_made[:current_request] = :weighted\n end\n \n requests_made\n end",
"def generate_request_status(request)\n under_review_status = ReviewStatus.find_by_code('UnderReview')\n\n review_status = under_review_status\n\n review_status = ReviewStatus.all.sample if rand > 0.80\n\n request.review_status = review_status\n request.review_comment = Faker::Lorem.words(rand(50) + 1).join(' ') unless review_status == under_review_status\n end",
"def acceptable_min\n return unless min_max_validator\n\n min_max_validator.options[:in]&.min || type_related_acceptable_min\n end",
"def start\n @min\n end",
"def worst_user\n @group_users.min_by(&:get_rate)\n end",
"def set_Minimum(value)\n set_input(\"Minimum\", value)\n end",
"def calc_am_slow_start(user, target)\n VAL_0_5 if user.turn_count < 5\n end",
"def rate_limited?\n tries = redis.get(key=\"tries:#{@env['REMOTE_ADDR']}\").to_i\n\n if tries > 10\n true\n else\n # give the key a new value and tell it to expire in 30 seconds\n redis.set(key, tries+1)\n redis.expire(key, 30)\n false\n end\n end",
"def set_request_limit\n @limit = Limit.uniq.pluck(:classification)\n end",
"def min(field = nil)\n block_given? ? super() : aggregates(field)[\"min\"]\n end",
"def api_regen_multiplier(level)\n if level >= User::Levels::GOLD\n 4\n else\n 1\n end\n end",
"def calculate_rating?\n return true if self.rated_at.nil?\n \n self.rated_at <= [ rand(12), 1 ].max.hours.ago # do not kill the db\n end",
"def throttle(request)\n time_left = $redis.ttl(cache_key(request))\n [429, {}, [\"Rate limit exceeded. Try again in #{time_left} seconds.\"]]\n end",
"def min(field)\n determine(field, :<=)\n end",
"def validate_size\n @num_mines <= MAX_SIZE\n end",
"def min(field)\n grouped(:min, field.to_s, Javascript.min)\n end",
"def min_player\n return 0\n end",
"def check_value\n if var == \"limit\" && value.to_i < 1\n raise \"Limit should be at least 1\"\n end\n end",
"def tempo_min\n @tempo_min ||= data[:tempo_min].to_i\n end",
"def time_limit\n [2, problem.time_limit].min\n end",
"def key_for_min_value(name_hash)\n\nmin_num = 1000\nmin_key = nil\nname_hash.each do |a,cost|\n if cost < min_num\nmin_num = cost\nmin_key = a\n end\nend\nmin_key\nend",
"def find_min()\r\n self.min\r\n end",
"def throttled?\n @throttle >= params[:throttle].value\n end",
"def lazy_min=(newmin)\n newmin = newmin.to_f\n \n #Add hours for every 60 minutes given.\n if newmin > 60 or newmin < 0\n hours = (newmin.to_f / 60.0).floor\n newmin -= (hours.to_f * 60.0)\n self.add_hours(hours)\n end\n \n #Convert any decimals to setting the second.\n diff = newmin - newmin.floor\n self.lazy_sec = diff * 60 if diff > 0.0\n \n #Set the actual minute.\n @t_min = newmin.floor\n \n self\n end",
"def recommend_request_sql_query(group_request)\n sql_select_requests = LesseeRequest.where(\"group_id != #{group_request.group_id} and active != false\")\n .where(\"city_id = #{group_request.city_id} and state_id = #{group_request.state_id} and country_id = #{group_request.country_id}\")\n .where(\"smoke = #{group_request.smoke}\")\n .where(\"max_rent <= #{group_request.max_rent + 300} and max_rent >= #{group_request.max_rent - 300}\")\n # |a - b| <= 300\n # a <= 300 + b && a >= -300 + b\n\n current_group_num = group_request.group.users.count\n select_requests = []\n sql_select_requests.each do |request|\n if request.group.users.count + current_group_num <= group_request.max_n_housemates &&\n current_group_num + request.group.users.count <= request.max_n_housemates &&\n group_request.latest_movein_date >= request.earliest_movein_date &&\n group_request.earliest_movein_date <= request.latest_movein_date &&\n group_request.min_duration <= request.max_duration &&\n group_request.max_duration >= request.min_duration\n select_requests.push(request)\n end\n end\n select_requests\n end",
"def minimum_price(price)\n set_limiting_value(:minimum, :price, price)\n end",
"def min_cost?\n false\n end",
"def test_min_dispersa\n\t\tassert_equal(Fraccion.new(66,5), @h3.min, \"Resultado Incorrecto\" )\n\tend",
"def minvalue\n MINVALUE\n end",
"def key_for_min_value(name_hash)\n\n\nmin = 1000000\nmin_key = nil\nname_hash.each do |key, value|\n if value < min\n min = value\n min_key = key\n end\nend\nreturn min_key\nend",
"def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend",
"def candidate_limit(uuid); end",
"def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end",
"def is_min_number?()\n return @ucItemNumber.value == @ucItemNumber.min\n end",
"def limit\n limit = @params[:limit].to_i\n limit = 1 if limit < 1\n [limit, MAX_LIMIT].min\n end",
"def minimum_participants(min=2)\n select { |timeslot, participants|\n participants.count >= min\n }\n end"
] | [
"0.5928781",
"0.58438295",
"0.58438295",
"0.5758866",
"0.5702651",
"0.5686577",
"0.56617475",
"0.56564784",
"0.5653852",
"0.5633291",
"0.5619237",
"0.5602089",
"0.5599445",
"0.55829924",
"0.5573553",
"0.5573553",
"0.5554576",
"0.55529034",
"0.55267805",
"0.5512437",
"0.54966754",
"0.54965717",
"0.5486287",
"0.5483314",
"0.54724413",
"0.5469438",
"0.5453872",
"0.5421458",
"0.5410742",
"0.5406459",
"0.54043",
"0.53948945",
"0.5387211",
"0.5356276",
"0.53327084",
"0.5323406",
"0.5319104",
"0.5315384",
"0.5312224",
"0.52988815",
"0.5293622",
"0.52915096",
"0.5283364",
"0.52669805",
"0.52489936",
"0.52487123",
"0.52411973",
"0.523497",
"0.5229233",
"0.5229233",
"0.5212831",
"0.52122015",
"0.5210494",
"0.52081305",
"0.52053964",
"0.5202429",
"0.5198876",
"0.51739544",
"0.51729846",
"0.5169344",
"0.516149",
"0.516149",
"0.51600826",
"0.5148666",
"0.5131125",
"0.5128402",
"0.51225984",
"0.51195794",
"0.5116816",
"0.5112844",
"0.5106478",
"0.51059765",
"0.5103932",
"0.50892735",
"0.508915",
"0.5087102",
"0.50848967",
"0.50837946",
"0.5077042",
"0.5067319",
"0.506302",
"0.50625837",
"0.5059403",
"0.50563204",
"0.50525105",
"0.5044754",
"0.5039704",
"0.5025705",
"0.5023121",
"0.50211906",
"0.501414",
"0.5011464",
"0.5011166",
"0.5011154",
"0.5007747",
"0.5000864",
"0.4997981",
"0.49934682",
"0.4993436",
"0.49909464"
] | 0.52840704 | 42 |
Write a program that solicits 6 numbers from the user, then prints a message that describes whether or not the 6th number appears amongs the first 5 numbers. | def prompt(msg)
puts ">> #{msg}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_problem()\n\n\tcount = 10\n\twhile count > 0\n\t\tputs \"you have #{count} times you can do this!\"\n\n\t\tputs \"Please enter a number that is a multiple of 3 or 5, 1-100 for a phrase or word back!\"\n\t\tnumber = gets.chomp\n\n\t\tmult_of_three = [\"3\", \"6\", \"9\", \"12\", \"18\", \"21\", \"24\", \"27\", \"33\", \"36\", \"39\", \"42\", \"48\", \"51\", \"54\", \"57\", \"63\", \"66\", \"69\", \"72\", \"78\", \"81\", \"84\", \"87\", \"93\", \"96\", \"99\"]\n\t\tmult_of_five = [\"5\", \"10\", \"20\", \"25\", \"35\", \"40\", \"50\", \"55\", \"65\", \"70\", \"80\", \"85\", \"95\", \"100\"]\n\t\tmult_of_both = [\"15\", \"30\", \"45\", \"60\", \"75\", \"90\"]\n\n\t\tif mult_of_three.include?(number)\n\t\t\tputs \"Bit\"\n\n\t\telsif mult_of_five.include?(number)\n\t\t\tputs \"Maker\"\n\n\t\telsif mult_of_both.include?(number)\n\t\t\tputs \"BitMaker!\"\n\n\t\telse\n\t\t\tputs \"That number is not 1-100, or is not a multiple of 3 and/or 5!\"\n\t\tend\n\n\t\tcount -= 1\n\n\tend\n\n\n\nend",
"def last_include\n result = []\n\n puts \"Enter your first number\"\n first = gets.chomp\n result << first\n\n puts \"Enter your second number\"\n second = gets.chomp\n result << second\n\n puts \"Enter your third number\"\n third = gets.chomp\n result << third\n\n puts \"Enter your fourth number\"\n fourth = gets.chomp\n result << fourth\n\n puts \"Enter your fifth number\"\n fifth = gets.chomp\n result << fifth\n\n puts \"Enter your sixth number\"\n sixth = gets.chomp\n\n if result.include?(sixth)\n puts \"The number #{sixth} appears in #{result}.\"\n else\n puts \"The number #{sixth} doesn't appear in #{result}\"\n end\nend",
"def compare(num1, num2, num3, num4, num5, num6)\n num_array = [num1, num2, num3, num4, num5]\n if num_array.include?(num6)\n p \"The number #{num6} appears in #{num_array}\"\n else\n p \"The number #{num6} does not appear in #{num_array}\"\n end\nend",
"def featured(number)\n loop do\n number +=1\n characters = number.to_s.split('')\n if (number.odd?) && (number % 7 == 0) && (characters.uniq == characters) \n p number\n break\n end \n end \nend",
"def featured(num)\n num +=1 \n until num % 7 == 0 && num.odd?\n num += 1\n end\n\n loop do\n return num if num.to_s.chars.uniq == num.to_s.chars\n num += 14\n break if num >= 9_876_543_210\n end\n\n \"Your quest is doomed. There is no featured number beyond these walls.\"\nend",
"def featured(int)\n int += 1\n int += 1 until int % 7 == 0 && int.odd?\n \n loop do\n double_check = int.to_s.split(\"\")\n if double_check.uniq == double_check\n return int\n else\n int += 14\n end \n break if int >= 9_876_543_210 \n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def find_number_in_arr\n arr = []\n suffixes = {1 => 'st', 2 => 'nd', 3 => 'rd', 4 => 'th', 5 => 'th'}\n 1.upto(5) do |n|\n puts \"Enter the #{n.to_s + suffixes[n]} number:\"\n arr << gets.to_i \n end\n puts \"Enter the last number:\"\n num = gets.to_i\n\n appear_phrase = arr.include?(num) ? \" appears \" : \" does not appear \"\n puts \"The number #{num}\" + appear_phrase + \"in #{arr.inspect}.\"\nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def featured(num)\n num += 1\n num += 1 until num.odd? && (num % 7).zero?\n loop do\n return num if num.to_s.chars.size == num.to_s.chars.uniq.size\n num += 14\n break if num > 9_876_543_210\n end\n 'There is no possible number that fulfills those requirements'\nend",
"def featured2(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number > 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(num)\n divisor = num / 7\n count = 1\n total = 0\n\n until (count > divisor) && (total.odd? && total > num) \n total = count * 7\n count += 1\n end\n\n loop do\n number_chars = total.to_s.split('')\n return total if number_chars.uniq == number_chars\n total += 7\n break if num >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements'\nend",
"def answer_validation(name)\n puts \"\\nHello, #{name}! What would you like to do today?\\n\n [1] Check allergy score.\n [2] Check allergies based on score.\n [3] Check if allergic to.\n [4] See allergy score table\n [5] Exit\"\n answer_keys = [*1..5]\n ans = gets.chomp.to_i\n while !answer_keys.include?(ans)\n puts \"Please navigate through the options using the numbers given.\"\n ans = gets.chomp.to_i\n end\n ans\nend",
"def featured(int)\n loop do \n int += 1\n if int.odd? && int % 7 == 0\n return int if int.to_s.chars.uniq == int.to_s.chars\n end\n break if int == 9_999_999\n end\n \"There is no possible number that fulfils those requirements\"\nend",
"def featured(number)\n featured = 0\n loop do \n number += 1\n if number % 7 == 0 &&\n number.odd? &&\n number.to_s.length == number.to_s.chars.uniq.length\n featured = number\n break\n end\n if number.to_s.length > 10\n puts \"Invalid\"\n featured = 0\n break\n end\n end\n featured\nend",
"def ask_user_for_a_number(message)\n puts message\n print \">\"\n gets.chomp #return iimplicite en dernière d'un f\n\n #until first.include(\"x\") = true\nend",
"def print_it(given_num)\n\n # create initialize a stop variable\n num = 0\n\n # continously loop until num is equal to given_num\n until num == given_num\n\n # if num is a multiple of both 3 and 5 print statement\n if ((num % 3) == 0) && ((num % 5) == 0)\n puts \"#{num} - FizzBuzz\"\n\n # if num is only a multiple of 3 print statement\n elsif (num % 3) == 0\n puts \"#{num} - Fizz\"\n\n # if num is only a multiple of 5 print statement\n elsif (num % 5) == 0\n puts \"#{num} - Buzz\"\n\n # if num is not a mutiple of either 3 or 5 print only the num\n else\n puts num\n end\n\n # increment num for next iteration\n num += 1\n end\n\nend",
"def featured(num)\n loop do\n num += num % 7 == 0 ? 7 : 1\n num_str = num.to_s.chars\n return num if num.odd? && num % 7 == 0 && num_str.uniq == num_str\n break if num >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def find_number\n\ti = 0 \n\tnot_found = true\n\twhile not_found \n\t\ti+=1\n\t\t#puts i \n\t\t#puts is_int(f6(i))\n\t\tnot_found = ! is_int(f6(i.to_f))\n\tend\n\ti\nend",
"def cheat\n puts 'What number do you want to roll?'\n\tnumber = gets.chomp.to_i\n\tif number >= 1 && number <= 6\n\t @number_showing = number\n\telse\n\t puts 'Cheater!!!'\n end\n @number_showing\t\n end",
"def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend",
"def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend",
"def solve ()\n @num_tested = 0\n @num_solutions = 0\n print \"Enter Answer: \"\n answer = gets.chomp.to_i\n print \"Enter Numbers:\\n\"\n numbers = []\n 6.times{numbers << gets.chomp.to_i}\n puts \"Solving...\"\n pick_two(numbers, answer, \"\")\n [@num_tested, @num_solutions]\nend",
"def prompt_user\n puts \"Please choose a number between 1 and 6\"\nend",
"def run_guessing_game\n\tuser_number =\"\"\n\twhile user_number != \"exit\"\n\t\tcom_number = rand(1..6)\n\t\tputs \"Guess a number between 1 and 6.\"\n\t\tuser_number = gets.chomp\n\t\tif com_number == user_number.to_i\n\t\t\tputs \"You guessed the correct number!\"\n\t\telse \n\t\t\tputs \"The computer guessed #{com_number}.\"\n\t\tend\n\tend\n\texit_guessing_cli\nend",
"def number(N)\r\n N =gets.strip.to_i\r\n if\r\n ( N%2==1 || N>5 && N <= 20)\r\n puts \"Weird\"\r\n else\r\n puts \"Not Weird\"\r\n end\r\nend",
"def featured(number)\n max = 9_876_543_210\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n loop do\n number_chars = number.to_s.chars\n if number_chars.size == number_chars.uniq.size\n return number\n end\n if number > max\n break\n end\n number += 14\n end\n \"ERROR! No next featured number!\"\nend",
"def get_toppings_\n puts \"how many pizzas?\"\n pizzanumber = gets.chomp.to_i\n pizza_array = (1..pizzanumber).to_a\n pizza_array.each do |number|\n puts \"how many toppings for #{number} pizza?\"\n toppings = gets.chomp.to_i\n end\n pizza_array.each do |number|\n puts \"Pizaa ##{number} has #{toppings} toppings\"\n end\nend",
"def featured(num)\n return 'Error! No featured numbers exist over 10 digits!' if num >= 9876543210\n loop do\n num += 1\n break if num.odd? && (num % 7).zero? && num.digits.uniq! == nil\n end\n num\nend",
"def run_guessing_game\n \n random_num = rand(6) + 1\n guess_num_between_1_6 = \"\"\n user_input = \"exit\" \nend",
"def guess_the_number(prog_num)\ncounter=0\nwhile counter < 10\nnumber=user_guessing\ncounter+=1\nif number>prog_num\n if number-(prog_num)>5\n puts \"cooold try no.#{counter}\"\n else\n puts \"hooot try no.#{counter}\"\n end\nelsif number<prog_num\n if (prog_num)-number>5\n puts \"cold try no.#{counter}\"\n else\n puts \"hot try no.#{counter}\"\n end\nelsif number==prog_num\n return puts \"you win after #{counter} try(s).\"\nend\nend\nend",
"def featured(int)\n for num in (int + 1...9_999_999_999) \n return num if num.odd? && num % 7 == 0 && num.digits == num.digits.uniq\n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def fizz_buzz_woof(max)\n 1.upto(max).each do |x|\n if (x % 3 == 0) && (x % 5 == 0) && (x % 7 == 0)\n puts \"FizzBuzzWoof\"\n elsif (x % 3 == 0) && (x % 5 == 0)\n puts \"FizzBuzz\"\n elsif (x % 3 == 0) && (x % 7 == 0)\n puts \"FizzWoof\"\n elsif (x % 5 == 0) && (x % 7 == 0)\n puts \"BuzzWoof\"\n elsif x % 3 == 0\n puts \"Fizz\"\n elsif x % 5 == 0\n puts \"Buzz\"\n elsif x % 7 == 0\n puts \"Woof\"\n else\n puts x\n end\n end\nend",
"def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend",
"def counter()\n number = gets.chomp\n number = number.to_i\nfor num in 1..number.to_i\n # if num % 15 == 0\n if num % 5 == 0 && num % 3 == 0\n p \"FizzBuzz\"\n elsif num % 5 == 0\n p \"Buzz\"\n elsif num % 3 == 0\n p \"Fizz\"\n else\n p num\n end\nend\nend",
"def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend",
"def featured(integer)\n return \"There is no possible number that fulfills those requirements\" if \n integer >= 9_876_543_210\n integer += 1\n until integer % 7 == 0 && integer.odd? && integer.digits.uniq! == nil\n integer += 1\n end\n integer\nend",
"def fizzbuzz(num)\n i = 0;\n num.times do\n i += 1\n # Check to see if num is a multiple of 3 but not 5\n if (i % 3 == 0 && i % 5 != 0)\n p \"Fizz\"\n # Check to see if num is a multiple of 5 but not 3\n elsif (i % 5 == 0 && i % 3 != 0)\n p \"Buzz\"\n # Check to see if num is a multiple of 3 and 5\n elsif (i % 5 == 0 && i % 3 == 0)\n p \"FizzBuzz\"\n else\n p i\n end\n end\nend",
"def exes_and_ohs(input)\n # Your code goes here\n arr = input.downcase.split('')\n\n if arr.uniq.count == 2 && arr.count <= 6\n puts true\n else\n puts false\n end\nend",
"def featured?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq.size == num.digits.size\nend",
"def y\n puts \"type a number\"\n u = gets.to_i\n puts \"type a max value\"\n m = gets.to_i\n\n a = []\n i = 0\n while i < m\n i += 1\n a << i\n end\n\n a.each do |x|\n if x % u == 0\n puts x\n else\n end\n end\n\nend",
"def run\n puts \"How many prime numbers' products table do you want to check? (default is 10).\" + \"\\n\"\n n = gets.chomp\n if n.empty?\n print_table(10)\n elsif n.to_i == 0\n puts \"Please run program again and provide a valid number.\" + \"\\n\"\n else\n print_table(n.to_i)\n end\n end",
"def print_list(limit)\n\n 1.upto(limit) do |number|\n\n if divisible_by?(15, number)\n puts \"Fizzbuzz\"\n\n elsif divisible_by?(3, number)\n puts \"Fizz\"\n\n elsif divisible_by?(5, number)\n puts \"Buzz\"\n\n else\n puts number\n\n end\n end\nend",
"def multisum(number) # number 1..10 determines which numbers are divisible by 3 and 5\n sum = 0\n 1.upto(number) do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num # this adds the numbers from 1..num that either are multiples of 3 or 5\n end\n end\n sum # returns sum, need this here to run program successfully\nend",
"def featured(num)\n # next_num = 7 # assume input is only positive\n closer_num = num / 7 * 7 # to start closer to the next required number instead of starting from 7\n next_num = closer_num.odd? ? closer_num : closer_num + 7 # so that next_num is odd and we can increment by 14 in the while loop\n\n while next_num < 9_999_999_999\n if next_num % 7 == 0 \\\n && next_num.to_s.size == next_num.to_s.chars.uniq.size \\\n && next_num > num\n return next_num\n else\n next_num += 14\n end\n end\nend",
"def choose_number_of_games\n win_count = nil\n loop do\n say 'First to how many wins takes the match (1-10)? '\n win_count = gets.chomp\n break if win_count =~ /\\A([1-9]|10)\\z/\n say 'Enter a whole number between one and 10, please.', 1\n end\n win_count = win_count.to_i\n match_wins_text =\n 1 == win_count ? 'win' : match_count_text(win_count) + ' wins'\n say \"Ok, first #{match_wins_text} takes the match.\", 2\n win_count\n end",
"def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend",
"def fizzbuzz(start, finish)\n start.upto(finish) do |num|\n if div_by_3?(num) && div_by_5?(num)\n puts \"FizzBuzz\"\n elsif div_by_5?(num)\n puts \"Buzz\"\n elsif div_by_3?(num)\n puts \"Fizz\"\n else\n puts num\n end\n end\nend",
"def featured(integer)\n count = 0\n\n loop do \n break if count >= 9_999_999_999\n count += 7\n if count.odd? && count % 7 == 0 && count.digits.uniq == count.digits && count > integer\n return count\n end\n end\n \"There is no possible number that fulfills those requirements.\"\nend",
"def guess_the_number\n prog_num=rand(1..20)\ncounter=0\nwhile counter < 10\nnumber=user_guessing\ncounter+=1\nif number>prog_num\n if number-(prog_num)>5\n puts \"too large try no.#{counter}\"\n else number-(prog_num)>5\n puts \"bit large try no.#{counter}\"\n end\nelsif number<prog_num\n if (prog_num)-number>5\n puts \"too small try no.#{counter}\"\n else (prog_num)-number>5\n puts \"bit small try no.#{counter}\"\n end\nelsif number==prog_num\n return puts \"you win after #{counter} try(s).\"\nend\nend\nend",
"def fizzbuzz(int1, int2)\n int1.upto(int2) do | number |\n if (number % 5 == 0) && (number % 3 == 0)\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend",
"def featured?(num)\n chars = num.to_s.split(//)\n num.odd? && (num % 7).zero? && chars.size == chars.uniq.size\nend",
"def pling_plang_plung\n print \"What is your number? \"\n your_number = gets.to_f\n message = \"\"\n\n if your_number % 3 == 0\n message += \"Pling \"\n puts \"Pling\"\n end\n if your_number % 5 == 0\n message += \"Plang \"\n puts \"Plang\"\n end\n if your_number % 7 == 0\n message += \"Plong \"\n puts \"Plong\"\n end\n if your_number % 3 != 0 && your_number % 5 != 0 && your_number % 7 != 0\n message += your_number\n puts your_number\n end\n\n puts message\n\nend",
"def user_number\n puts 'enter your number'\n numb1 = gets.chomp!.to_i\n if numb1 <= 50\n puts 'your number is equal to or less than 50'\n elsif numb1 == 51\n puts 'you number must be 51'\n elsif numb1 <= 100\n puts 'you number is equal to or less than 100'\n else\n 'puts you got a high number'\n end\n end",
"def by_five?(n)\n return n % 5 == 0\nend",
"def multiples(num)\n# \"each\" loop for each integer\n (1..num).each do |num|\n # numbers that are mulitples of 3 and 5\n if num % 3 == 0 && num % 5 == 0\n puts \"FizzBuzz\"\n # multiples of 5\n elsif num % 5 == 0\n puts \"Buzz\"\n # multiples of 3\n elsif num % 3 == 0\n puts \"Fizz\"\n # if not divisible by 5 or 3, just print number\n else\n puts num\n end\n end\nend",
"def runFizzBuzz()\n\twhile true\n\t\tputs \"Number to stop \" + $fizz + $buzz + \"-ing at?\"\n\t\tn = gets.chomp.to_i\n\t\tif n < 1\n\t\t\tputs \"You need to input a number which is equal to or more than 1\"\n\t\t\tnext\n\t\tend\n\t\tfor i in 1..n\n\t\t\tout = isFizzBuzz(i)\n\t\t\tputs out\n\t\tend\n\t\tbreak\n\tend\nend",
"def challenge5 \n\tcounter = 1\n\tnumber = rand(1..100)\n\tputs \"Guess a number between 1 and 100\"\n\tguess = gets.chomp.to_i\n\n\twhile guess != number do\n\t\tif guess > 100 || guess < 0\n\t\t\tputs \"Please guess a number between 1 and 100. Guess again\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\telsif guess < number\n\t\t\tputs \"the number is greater than #{guess}. Guess again.\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\telsif guess > number\n\t\t\tputs \"the number is less than #{guess}. Guess again.\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\tend\n\tend\n\tputs \"You got it in #{counter} attempt(s)!\"\nend",
"def main\n return (N.split(\"\").map(&:to_i).sum % 9 == 0) ? \"Yes\" : \"No\"\nend",
"def fizzbang(limit)\r\n\t1.upto(limit) do |number|\r\n\t\tif number % 3 == 0 and number % 5 == 0\r\n\t\t\tputs \"fizzbang\"\r\n\t\telsif number % 3 == 0\r\n\t\t\tputs \"fizz\"\r\n\t\telsif number % 5 == 0\r\n\t\t\tputs \"bang\"\r\n\t\telse\r\n\t\t\tputs number\r\n\t\tend\r\n\tend\r\nend",
"def how_many_players\n puts \"How many human players are there?\"\n num = gets.chomp.to_i\n until num.between?(1, 2)\n puts \"Please choose a number between 1-2\"\n num = gets.chomp.to_i\n end\n num\n end",
"def user_num\n loop do\n prompt(MESSAGES['number_request'])\n num1 = Kernel.gets().chomp()\n num2 = Kernel.gets().chomp()\n if number?(num1) && number?(num2)\n return num1, num2\n else\n prompt(MESSAGES['invalid_numbers'])\n end\n end\nend",
"def featured_num?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq == num.digits\nend",
"def featured(int)\n if int >= 9_876_543_210\n return 'There is no possible number that fulfills those requirements.'\n end\n \n featured_num = 0\n until featured_num > int\n loop do\n featured_num += 7\n next if featured_num.even?\n next if featured_num.digits != featured_num.digits.uniq\n break\n end\n end\n featured_num\nend",
"def featured?(num)\n chars = num.to_s.chars\n num % 7 == 0 && num.odd? && chars.none? { |char| chars.count(char) > 1 }\nend",
"def check_report(input, number, total)\n input.combination(number).detect { |tuple| tuple.sum == total }.reduce(:*)\nend",
"def featured(int)\n next_num = 0\n loop do\n next_num = int.succ\n break if next_num.odd? && next_num % 7 == 0\n int = next_num\n end\n loop do\n break if next_num >= 9_876_543_210\n if next_num.to_s.chars.uniq == next_num.to_s.chars\n return next_num\n else next_num += 14\n end\n end\n \"There is no possible number that fulfills those requirements.\"\nend",
"def prompt_numbers\n numbers = []\n while numbers.size < 4 do\n numbers << rand(0..9)\n numbers.uniq!\n end\n return numbers.to_s\n end",
"def quick_num_checker(num)\n num = num.to_s\n if num == \"5\"\n return true\n elsif num == \"1\"\n return false\n elsif num == \"2\"\n return true\n elsif num == \"3\"\n return true\n elsif num == \"7\"\n return true \n elsif num.include?(\"0\") || num.include?(\"2\") || num.include?(\"4\") || num.include?(\"5\") || num.include?(\"6\") || num.include?(\"8\")\n return false\n # elsif num[-1]==\"2\"\n # return false\n # elsif num[-1]==\"4\"\n # return false\n # elsif num[-1]==\"5\"\n # return false\n # elsif num[-1]==\"6\"\n # return false\n # elsif num[-1]==\"8\"\n # return false\n else\n return true\n end\nend",
"def featured_num?(num)\n return false unless num.odd?\n return false unless num % 7 == 0\n return false unless num.digits.size == num.digits.uniq.size\n true\nend",
"def small_numbers(a)\n small = a.count {|x| x < 5}\n print small\n \nend",
"def fizz_buzz(max)\n (1...max).select{|number| (number % 4 == 0 || number % 6 == 0) && !(number % 4 == 0 && number % 6 == 0)}\nend",
"def super_fizz(number)\n(0..1000).each do |number|\ndivisible_by_3 = number % 3\ndivisible_by_5 = number % 5\ndivisible_by_7 = number % 7\nif divisible_by_3 == 0\n if divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperFizzBuzz\"\n else\n puts \"FizzBuzz\"\n end\n elsif divisible_by_7 == 0\n puts \"SuperFizz\"\n else\n puts \"Fizz\"\n end\nelsif divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperBuzz\"\n else\n puts \"Buzz\"\n end\nelsif divisible_by_7 == 0\n puts \"Super\"\nelse\n puts number\nend\nend\nend",
"def request_player_input(message = 'Please enter an array of numbers 1-6 each separated by \" \"')\n puts message.to_s\n temp_input = gets.chomp\n temp_input = temp_input.split\n temp_input = temp_input.map(&:to_i)\n end",
"def featured(integer)\n return \"Error: There is no possible number that fulfills those requirements\" if integer >= 9_876_543_210\n counter = integer + 1\n counter += 1 until counter % 7 == 0 && counter.odd?\n \n loop do\n return counter if counter.digits.uniq.size == counter.digits.size\n counter += 14\n end\nend",
"def cracklePop\n (1..100).to_a.each do |x|\n if x % 3 && x % 5 == 0\n puts \"CracklePop\"\n elsif x % 3 == 0\n puts \"Crackle\"\n elsif x % 5 == 0\n puts \"Pop\"\n else\n puts x\n end\n end\nend",
"def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 5 == 0 && num % 3 == 0\n puts \"FizzBuzz\"\n elsif num % 3 == 0 then puts \"Fizz\"\n elsif num % 5 == 0 then puts \"Buzz\"\n else puts num\n end\n end\nend",
"def test_input1(matches, card1, card2,number_of_cards)\n while matches.include?(card1.to_i) || !(/^[1-#{number_of_cards}]$/).match?(card1)\n if !(/^[1-#{number_of_cards}]$/).match?(card1)\n puts \"Please input an integer in the specified range\"\n else\n puts \"That card is already open\"\n end\n card1 = askforcard1(number_of_cards)\n end\n return card1.to_i\nend",
"def ask_user\n puts 'enter a number:'\n input = gets.chomp.to_i\n check_num(input)\n end",
"def validate_numeric_stdin(a)\n print \"\\n(use commas for multiple selections): \"\n nums = gets.chomp.split(\",\").select { |x| /\\d+/.match x }.uniq.map(&:to_i)\n nums.reject { |z| z >= a.size }\nend",
"def dont_give_me_five(start_,end_)\n number = 0\n (start_..end_).each do |n|\n n = n.to_s.split('')\n if n.include?(\"5\")\n else\n number += 1\n end\n end\n return number\nend",
"def featured(n)\n # The next 2 lines guarantees we start with odd multiples of 7 that is higher than n\n n += 1\n n += 1 until n.odd? && n % 7 == 0\n\n while n < 9_876_543_201\n return n if featured?(n)\n n += 14 # this hastens the loop - we only iterate odd multiples of 7\n end\n raise StandardError, \"No more featured number available\"\nend",
"def mult_five(number)\n if number%5 === 0\n puts \"#{number} is a multiple of 5.\"\n else\n puts \"#{number} is not a multiple of 5.\" # You need the hash stuff here because you can't add an integer to a string, you idiot.\n end\nend",
"def multiples\n \tfor n in 1..100\n \t\tif n%3==0 && n%5==0\n \t\t\tputs \"FizzBuzz\"\n \t elsif n%3==0\n \t \tputs \"Buzz\"\n \t else\n \t \tputs n\n \t end\n \tend\nend",
"def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend",
"def supafizbuz(max_num)\n range = (0..max_num).to_a\n range.each do |num|\n if num % 3 == 0\n if num % 7 == 0\n if num % 5 == 0\n puts(\"SuperFizzBuzz\")\n next\n end\n puts(\"SuperFizz\")\n next\n end\n puts(\"Fizz\")\n next\n elsif num % 7 == 0\n if num % 5 == 0\n puts(\"SuperBuzz\")\n next\n end\n puts(\"Super\")\n next\n elsif num % 5 == 0\n puts(\"Buzz\")\n next\n end\n puts(num)\n end\n return nil\n\n range = (0..max_num).to_a\n range.each do |num|\n a = num % 7 == 0 ? \"Super\" : \"\"\n b = num % 3 == 0 ? \"Fizz\" : \"\"\n c = num % 5 == 0 ? \"Buzz\" : \"\"\n puts (a + b + c) == \"\" ? num : (a + b + c)\n end\n return nil\n\nend",
"def fizz_buzz_check\n @numbers.collect do |x|\n if multiple_of(15, x)\n 'FizzBuzz'\n elsif multiple_of(3, x)\n 'Fizz'\n elsif multiple_of(5, x)\n 'Buzz'\n else\n x\n end\n end\n end",
"def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num % 15 == 0\n puts \"FizzBuzz\" \n elsif num % 3 == 0\n puts \"Fizz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n else\n puts num\n end\n end\nend",
"def print_names_less_than_x_characters\n puts \"Please set the max character length of names to display\"\n number = STDIN.gets.chomp\n match_array = []\n #Will not continue unless input is an integer, and avoided cases in which to_i for a string returns 0, AKA an integer\n while number.to_i.to_s != number\n puts \"Please enter an integer\"\n number = STDIN.gets.chomp\n end\n @students.each_with_index do |student, index|\n if student[:name].length <= number.to_i\n match_array.push(student)\n end\n end\n print(match_array)\n if match_array.length == 1\n puts \"We have found #{match_array.size} student with a name of #{number} characters or less\"\n elsif match_array.length > 1\n puts \"We have found #{match_array.size} students with names of #{number} characters or less\"\n end\nend",
"def cheat number\n if number > 0 && number < 7\n @numberShowing = number\n return true\n end\n return false\n end",
"def gets_random_10\n\n count = 0\n\nwhile count < 10\n @num = rand(9)\n divider = \"=========\"\n\n\n if @num == 0\n puts divider\n puts \"#{@num}\" + \" we've got 0\"\n\n elsif @num.odd?\n @result = \"#{@num}\" + \" the number is odd\"\n puts divider\n check_if_five_exists\n elsif @num.even?\n puts divider\n @result = \"#{@num}\" + \" the number is even\"\n check_if_five_exists\n else\n puts \"I can't guess the number\"\n end\n\n count += 1\nend\nend",
"def repeat(input)\n # while i < 6\n i = 0\n numbers = [ ]\n for i in (1 .. input)\n puts \"At the top i is #{i}\"\n numbers.push(i)\n\n puts \"Numbers now: \", numbers\n puts \"At the bottom i is #{i}\"\n end\n\n puts \"The number: \"\n numbers.each {|num| puts num }\nend",
"def by_five?(num)\n num % 5 == 0\nend",
"def run_guessing_game\n picked_number = rand(6) +1 \n \n puts \"Guess my number. It is a number between 1 and 6\"\n input = gets.chomp\n\n if(input == 'exit')\n puts \"Goodbye!\"\n elsif (input.to_i == picked_number)\n puts \"You guessed the correct number!\"\n else \n puts \"Sorry! The computer guessed #{picked_number}.\"\n end\nend",
"def divby2not6(n)\n 1.upto(n) { |e| puts e if (e % 2 == 0) && !(e % 6 == 0) }\nend",
"def findFiveHundred(numberOfFactors)\n count = 1\n triangleNumber = 0\n factors = 0;\n while(factors <= numberOfFactors)\n triangleNumber = triangleNumber + count\n factors = countFactors(triangleNumber)\n\n if(factors > numberOfFactors)\n return triangleNumber\n end\n count += 1\n end\n\n\nend",
"def run_numbers(numbers)\n\t#Define a variable to receive the winners\n\twinners = []\n\tarray_numbers = generateWinnNumbers();\n\tnumbers.each do |number|\n\t\n\t\tarray_numbers.each do |value|\n\t\t\t#For each char of the number compare with our numbers\t\n\t\t\t if number == value\t\t\n\t\t\twinners.push(value) \t\t\t\n\t\t\tend\n\t\tend\n\tend\t\n\tprint array_numbers\n\tprint numbers\n\tprint winners\n\treturn winners\n\nend",
"def get_puzzle_number\n\tputs \"What puzzle(s) would you like to solve today?\"\n\tputs \"---------------------------------------------\"\n\tputs \"Please enter a number from 1-15\"\n\tinput = gets.chomp\n\ttry_again_check(input)\nend",
"def list_topics\n\tputs \"1. Social Media\"\n\tputs \"2. Tech\"\n\tputs \"3. Business\"\n\tputs \"4. Entertainment\"\n\tputs \"5. World\"\n\tputs \"6. Watercooler\"\n\tputs \" \"\n\tputs \"Which topic interests you most?\"\n\tprint \"Please enter a number 1 through 6 or press any other # to quit: \"\nend",
"def featured(num)\n number = 0\n\n loop do\n if num % 7 != 0 && num.even?\n number += 7 \n elsif num % 7 != 0 && num.odd?\n number += 7\n else\n number += 7\n end\n break if number % 7 == 0 && number > num && number.odd?\n end\nend"
] | [
"0.6843137",
"0.682451",
"0.6787685",
"0.67030257",
"0.6488398",
"0.64438015",
"0.6402141",
"0.63950896",
"0.6370546",
"0.6367428",
"0.63459754",
"0.6334254",
"0.63275945",
"0.6324411",
"0.63181484",
"0.63065875",
"0.62793624",
"0.62619233",
"0.6256921",
"0.6234388",
"0.6229749",
"0.6206263",
"0.6100183",
"0.60970044",
"0.60957795",
"0.60848635",
"0.6083642",
"0.607047",
"0.60282373",
"0.6002263",
"0.599281",
"0.59724987",
"0.59509146",
"0.5947483",
"0.5947464",
"0.5945585",
"0.59324616",
"0.5925675",
"0.59140664",
"0.58995426",
"0.5897003",
"0.5862057",
"0.5853382",
"0.5851388",
"0.5851259",
"0.5849507",
"0.5846359",
"0.58439654",
"0.58435804",
"0.5837571",
"0.5836562",
"0.58300364",
"0.5820895",
"0.5819502",
"0.5808911",
"0.5804808",
"0.57940125",
"0.5789292",
"0.5787474",
"0.5787353",
"0.57872176",
"0.5783876",
"0.5781858",
"0.57766265",
"0.57742",
"0.5768756",
"0.5768565",
"0.5767506",
"0.5763502",
"0.5760786",
"0.5745894",
"0.5738802",
"0.57336354",
"0.5724993",
"0.5718739",
"0.5712762",
"0.5710319",
"0.56994635",
"0.569917",
"0.5698903",
"0.569889",
"0.56967384",
"0.5691921",
"0.56904936",
"0.56884116",
"0.56852615",
"0.5682371",
"0.5680365",
"0.5679059",
"0.5674423",
"0.56706595",
"0.5668523",
"0.56655824",
"0.5657414",
"0.5654508",
"0.5628463",
"0.5627435",
"0.56218493",
"0.56192636",
"0.5617156",
"0.5604659"
] | 0.0 | -1 |
removes cards from deck and returns them | def take
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_card\n cards.shift\n return cards\n end",
"def remove_card_from_deck (card)\n\t\t@deck -= [card]\n\tend",
"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 deal_card\n @deck.remove(:front)\n end",
"def deal_card\n @deck.pop\n end",
"def remove_card\n @cards.shift\n end",
"def remove_card\n @cards.shift\n\n end",
"def remove_cards\n\t\t@cards.slice!(0,2)\n\tend",
"def remove_card\n @cards.delete_at(0)\n end",
"def discard(card)\n discard_pile << card\n end",
"def deal_card\r\n\t\tcards.pop\r\n\tend",
"def remove_card\n self.cards.delete_at(0)\n end",
"def remove remove_card\r\n @card_list.remove remove_card\r\n end",
"def remove remove_card\n @card_list.remove remove_card\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 get_card\n @deck.pop\n end",
"def remove_card(card)\n @all_cards.delete(card)\n end",
"def removeCard(card)\n @cards.delete(card)\n end",
"def get_card()\n return @cards.delete_at(rand(@cards.length))\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 deal_card\n @cards.pop\n end",
"def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\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_turn\n @pokerdeck.pop\n turn = @pokerdeck.pop\n @communal_cards << turn\n return turn\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 remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\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 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 deal_cards(old_deck, num_cards)\n hand = old_deck.sample(num_cards)\n new_deck = old_deck - hand\n return [hand, new_deck]\nend",
"def drawcard\n @deck.pop\n end",
"def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\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 deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end",
"def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end",
"def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end",
"def remove_set_from_hand(card)\n\t\t@cards.delete(card)\n\tend",
"def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end",
"def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend",
"def deal_card\n if @cards.length > 0 then\n return @cards.slice!(0)\n else\n raise StandardError, \"No cards left in shoe; please use can_play\"\n end\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 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 deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand(0...@deck.length)\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend",
"def return_cards\n @hand = []\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 drawCards!(n)\n\t\treturn @cards.pop(n)\n end",
"def deal_cards(cards)\n @players.each do |player|\n player.hand += @deck.cards.pop(cards)\n end\n end",
"def deal\r\n @deck_of_cards.shift\r\n end",
"def discard(card)\n hand.transfer!(card: card, to: discard_pile)\n end",
"def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end",
"def deal_one\n cards.pop\n end",
"def deal(number = 1)\r\n raise \"Not enough cards left in the deck!\" if number > @cards.length\r\n [@cards.pop(number)].flatten\r\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 subtractSet(chosenCards)\n @cardsOnTable.each { |c|\n if c = chosenCards[0]\n @cardsOnTable.delete_at(0)\n elsif c = chosencards[1]\n @cardsOnTable.delete_at(1)\n elsif c = chosenCards[2]\n @cardsOnTable.delete_at(2)\n end\n }\n end",
"def hit \n card = self.cards_deck.pop\n return card\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 deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\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 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 reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end",
"def redeal\n # take all current cards in play and add to deck\n @deck.concat(@cards_in_play)\n @cards_in_play = Array.new\n\n #shuffle cards \n @deck.shuffle!\n\n #deal 12 more new cards\n @cards_in_play.concat(@deck.pop(12))\nend",
"def deal_flop\n @pokerdeck.pop\n flop = @pokerdeck.pop(3)\n @communal_cards = flop\n return flop\n end",
"def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\n end",
"def take_card\n raise OutOfCardsError if empty?\n @cards.pop\n end",
"def discard\n player.hand.first\n end",
"def get_cards(deck)\n\n end",
"def create_card(deck)\n card = deck.shuffle.pop\nend",
"def deal_hand\n\t\thand = Array.new\n\t\t@num_cards.times do\n\t\t\tcard = get_card(get_random_number)\n\t\t\thand << card\n\t\t\tremove_card_from_deck(card)\n\t\tend\n\t\thand\n\tend",
"def delete card\n @hand.delete(Card.new(card))\n end",
"def hand_over_dealer\r\n puts \"Dealer 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 @dealer_deck[@random_card] = random_card_val # to dealer\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@dealer_deck = #{@dealer_deck}\"\r\n end",
"def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end",
"def trump_cards\n @cards.select {|c| c.suit == @trump_suit}\n end",
"def deal(num_cards)\n card_lst = @cards.slice!(0,num_cards)\n return (num_cards == 1 ? ((card_lst == nil) ? nil : card_lst[0]) : card_lst)\n end",
"def deal\r\n @cards.shift\r\n end",
"def deal_player_card(current_player)\n\n card = @deck.delete_at(0)\n if current_player == 1 then\n @player1_hand << card\n end\n if current_player == 2 then\n @player2_hand << card\n end\n if current_player == 3 then\n @player3_hand << card\n end\n if current_player == 4 then\n @player4_hand << card\n end\n\n end",
"def deal_cards(deck, playing_cards)\n return if deck.length == 0\n\n #initializing deck.\n if playing_cards.length == 0\n for count in 0...12\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n return\n end\n\n if (valid_table(playing_cards)).length == 0\n #continually adds cards until there is a set or there are no more cards.\n while ((valid_table(playing_cards)).length == 0) && deck.length > 0\n #print(\"\\n Empty: #{(valid_table(playingCards)).length == 0} \\n\")\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n end\n elsif playing_cards.length < 12\n # Adds cards if there is a set but less than 12 playing cards.\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n\n end\n\nend",
"def draw_card(cards)\n card = cards.to_a.sample(1).flatten\n cards.delete(card[0])\n card\nend",
"def deal\n @deckOfCards.shift\n end",
"def card_from_user(hand, cards_played)\n next_card_prompt(hand)\n\n puts \"What card would you like to play?\"\n card = get_card_following_suit(hand, cards_played)\n\n puts \"You picked #{card}\"\n hand.delete(card)\n\n card\n end",
"def deal_cards\n\t\t\tend",
"def deal_a_card(from_the_deck)\n #delete any empty hashes from the deck array otherwise there will be an error because it will be picking a nil result\n if from_the_deck.include?({})\n from_the_deck.delete({})\n end\n \n deck_chosen_from = from_the_deck.sample\n key_chosen_from_deck = deck_chosen_from.keys.sample\n value_chosen_from_deck = deck_chosen_from[key_chosen_from_deck].sample\n \n remove_from_deck(deck_chosen_from, key_chosen_from_deck, value_chosen_from_deck)\n\n #delete any hash key with an empty array value otherwise there will be an error because it will be picking a nil result\n if deck_chosen_from[key_chosen_from_deck].empty?\n deck_chosen_from.delete(key_chosen_from_deck)\n end\n\n picked_card = [key_chosen_from_deck, value_chosen_from_deck]\nend",
"def return *hands\n hands.each do |hand_or_cards|\n cards = (hand_or_cards.is_a?(CardDecks::Hand) ? hand_or_cards.cards : Array.wrap(hand_or_cards))\n @used += cards\n @inhand.delete_if {|c| cards.include?(c) }\n @hands.each {|h| h.cards.delete_if {|c| cards.include?(c) } }\n end\n end",
"def pick_random_card\n random_card = @all_cards.sample\n remove_card(random_card)\n return random_card\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 select_card(dck)\n # sample the deck array, returns a suit return the value obj and sample\n dck.sample.each_with_object({}) do |suit, obj|\n crd = suit[1].to_a.sample\n suit = suit[0]\n obj[suit] = { crd[0] => crd[1] }\n # remove card from deck\n dck = dck.each do |val|\n val.each do |k, v|\n if k == suit\n # mutate the deck\n v.reject! { |key, _| key == crd[0] }\n end\n end\n end\n end\nend",
"def get_card_and_put_in_hand(which_hand)\n the_card = @deck_current.delete_at(rand(@deck_current.length))\n\n if which_hand === \"dealer\"\n @hand_dealer.push(the_card)\n\n elsif which_hand === \"player\"\n @hand_player.push(the_card)\n\n end\n \nend",
"def destroy\n d = @deck_card.deck\n @deck_card.destroy\n flash[:success] = \"Card was successfully removed from the deck\"\n redirect_to d\n end",
"def destroy_deck\n [@heart, @club, @spade, @diamond].each do |suit|\n (2..10).each do |number|\n File.delete(Dir.pwd + \"/#{number}_#{suit}.txt\")\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |face|\n File.delete(Dir.pwd + \"/#{face}_#{suit}.txt\")\n end\n end\n [\"R\", \"B\"].each do |color|\n File.delete(Dir.pwd + \"/#{@joker}_#{color}.txt\")\n end\n end",
"def deal_cards\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n end",
"def unplayed_cards\n player_cards.select { |c| c.unplayed? }\n end",
"def pick_random\n if @cards.length == 0\n return false\n end\n index = rand(@cards.length)\n card = @cards[index]\n @cards.delete_at(index)\n card\n end",
"def remove_cards_forAI(cardToRemove1, cardToRemove2, cardToRemove3)\n\t\t@board.delete(cardToRemove1)\n\t\t@board.delete(cardToRemove2)\n\t\t@board.delete(cardToRemove3)\n\tend",
"def take_card\n @deck.shift\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_river\n @pokerdeck.pop\n river = @pokerdeck.pop\n @communal_cards << river\n return river\n end",
"def take_card\n @store.pop\n end",
"def deal_card(hand)\n #hand is a string whose valid values are 'player_cards' and 'dealer_cards' \n\n if !['player_cards','dealer_cards'].include?(hand)\n raise \"Unknown hand #{hand}\"\n end \n\n #Check for an empty deck and reshuffle if necessary\n if (session['game_cards'].length == 0) \n\n session['game_cards'] = session['discard']\n session['game_cards'].shuffle!\n session['discard'] = []\n append_message(\"Dealer shuffled the cards.\") \n\n end \n\n #Move the card\n session[hand] << session['game_cards'].pop \n\n end",
"def non_trump_cards\n @cards.select {|c| c.suit != @trump_suit}\n end",
"def deal_card!(cards)\n\nend",
"def draw\n return @cards.pop\n end",
"def return(cards)\n @deck.concat(cards)\n end",
"def get_card(deck, n)\n new_card = deck.cards.pop(n)\n cards << new_card\n cards.flatten!\n new_card\n end"
] | [
"0.8165804",
"0.76598626",
"0.76206326",
"0.7613722",
"0.7583243",
"0.75755656",
"0.75327635",
"0.7517896",
"0.7486409",
"0.7441576",
"0.7386255",
"0.73485655",
"0.7311808",
"0.73085326",
"0.7252754",
"0.7192282",
"0.718419",
"0.71690774",
"0.7148452",
"0.71413684",
"0.71409386",
"0.7116335",
"0.71095777",
"0.7094974",
"0.7089172",
"0.7067691",
"0.7042462",
"0.7026898",
"0.6964148",
"0.6951349",
"0.69386774",
"0.6918599",
"0.6900703",
"0.6898223",
"0.6893254",
"0.68890005",
"0.6888955",
"0.6885541",
"0.6875692",
"0.6869512",
"0.683818",
"0.681834",
"0.6800258",
"0.67907375",
"0.6777463",
"0.67761767",
"0.6772608",
"0.6763481",
"0.6746878",
"0.67444164",
"0.6734054",
"0.6722732",
"0.6720456",
"0.6715965",
"0.670868",
"0.6687972",
"0.66609615",
"0.66477036",
"0.6629165",
"0.6629045",
"0.66277987",
"0.6621683",
"0.65864176",
"0.6575028",
"0.6573344",
"0.65641695",
"0.6553679",
"0.6551397",
"0.6544322",
"0.6540005",
"0.6509668",
"0.6503817",
"0.64961874",
"0.64690435",
"0.6467237",
"0.64616543",
"0.6460112",
"0.6447253",
"0.6443858",
"0.64418894",
"0.6433106",
"0.64311934",
"0.64260054",
"0.6424246",
"0.64114374",
"0.64029855",
"0.6394735",
"0.6380309",
"0.63765544",
"0.63728637",
"0.63595563",
"0.6354512",
"0.63539255",
"0.6341806",
"0.6337808",
"0.6331776",
"0.63156503",
"0.63137305",
"0.63104564",
"0.6306229",
"0.62945926"
] | 0.0 | -1 |
method to find edge from 2 vertices | def findEdge(vertex1, vertex2)
visualedges = @visualGraph.visual_edges
visualedges.each do |edge|
if edge.v1.id == vertex1 && edge.v2.id == vertex2
# edge from vertex1 to vertex2
return edge
elsif edge.v2.id == vertex1 && edge.v1.id == vertex2
# edge from vertex2 to vertex1
return edge
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_edge?(vertex1, vertex2)\n\tend",
"def find_edge(node_1, node_2)\n @edges[node_1][node_2] if @edges[node_1]\n end",
"def find_edge(one, two)\n edges.find do |e|\n (e.one == one && e.two == two) || (e.two == one && e.one == two)\n end\n end",
"def end_vertices(edge)\n from = edge.from\n to = edge.to\n return from, to\n end",
"def get_connection_to(another_vertex)\n @edges.each do |edge|\n if edge.head == another_vertex || edge.tail == another_vertex\n return edge\n end\n end\n end",
"def common_face(edge2)\n end",
"def common_face(edge2)\n end",
"def edge_for(left, right)\n edges.detect { |edge| edge.left.equal?(left) && edge.right.equal?(right) }\n end",
"def edge?( from, to )\n @vertices[from].include? to \n end",
"def connect(vert1, vert2)\n # Basically, if the two elements in the edge set are in the @vertices\n # set, then we add the edge to the set.\n edge = [ vert1, vert2 ]\n\n if (edge.to_set & @vertices) == edge.to_set\n @edges.add(edge)\n end\n end",
"def edge(source, target)\n @edges.each_with_index { |test_edge, index| return test_edge if test_edge.source == source and test_edge.target == target }\n end",
"def other_vertex(vertex1)\n end",
"def other_vertex(vertex1)\n end",
"def contract edge\n vertex_1 = edge[0]\n vertex_2 = edge[1]\n #puts \"contracting edge \" + vertex_1.id.to_s + \", \" + vertex_2.id.to_s\n remove_vertex vertex_2\n\n vertex_2.adjacent_vertices.each{ |adjacent_vertex|\n vertex = find(adjacent_vertex)\n vertex_2_index = vertex.adjacent_vertices.index(vertex_2.id)\n vertex.adjacent_vertices[vertex_2_index] = vertex_1.id\n }\n vertex_1.adjacent_vertices.concat(vertex_2.adjacent_vertices)\n vertex_1.adjacent_vertices.delete_if {|adjacent_vertex| adjacent_vertex == vertex_1.id }\n end",
"def edge?(x, y)\n connected?(x, y)\n end",
"def edge?(x, y)\n connected?(x, y)\n end",
"def other_vertex(direction, edge)\n case direction\n when :in; edge.source\n else\n edge.target\n end\n end",
"def edges\n\t (@vertices + [@vertices.first]).each_cons(2) {|v1,v2| yield v1, v2}\n\tend",
"def get_clockwise_neighbor(id_1, id_2)\n return id_1 if @vertices[id_1].y > @vertices[id_2].y\n return id_1 if @vertices[id_1].x < @vertices[id_2].x\n return id_2\n end",
"def edge?( from, to )\n @vertices[ from ].include?( to )\n end",
"def has_edge(start_vertex_name, end_vertex_name)\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_vertex_index = find_index_for_vertex(end_vertex_name)\n\n return false unless (!first_vertex_index.nil? && !second_vertex_index.nil?)\n\n return @vertices[first_vertex_index].neighbours[second_vertex_index] == true\n end",
"def edges_of(node)\n edges_from(node) | edges_to(node)\n end",
"def edges_to(node)\n edges.select { |edge| edge.last == node }\n end",
"def each_edge_in_path(node1, node2)\n path = self.path(node1, node2)\n source = path.shift\n path.each do |target|\n edge = self.get_edge(source, target)\n yield source, target, edge\n source = target\n end\n self\n end",
"def edge_vertices( edge )\r\n if edge_reversed?( edge )\r\n edge.vertices.reverse\r\n else\r\n edge.vertices\r\n end\r\n end",
"def edge(*coords)\n (coords.size == 1) ? edge_map[coords.first] : edge_map[coords]\n end",
"def get_edge(x, y)\n @store[x, y]\n end",
"def remove_edge(start_vertex_name, end_vertex_name)\n\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_vertex_index = find_index_for_vertex(end_vertex_name)\n\n if (first_vertex_index == nil)\n raise GraphError.new('Edge removal error. First vertex could not be found', GraphError::ERROR_REMOVE_EDGE_FAILURE)\n end\n\n if (second_vertex_index == nil)\n raise GraphError.new('Edge removal error. Second vertex could not be found', GraphError::ERROR_REMOVE_EDGE_FAILURE)\n end\n\n remove_edge_by_indexes(first_vertex_index, second_vertex_index)\n end",
"def get_edge_value(x, y)\n raise\n end",
"def is_neighbour_of(another_vertex)\n @edges.each do |edge| \n if edge.head == another_vertex || edge.tail == another_vertex\n return true\n end\n end\n return false\n end",
"def edge?(u,v)\n return @source[u].has_key?(v)\n end",
"def neighbor_vertices\n @meeting_edges.map &:to\n end",
"def other_end(vertex)\n if self.vertices[0] == vertex\n self.vertices[1]\n else\n self.vertices[0]\n end\n end",
"def add_edge(id1, id2)\n # YOUR WORK HERE\n end",
"def edge(grab_handle)\n\t\ttype, target_indidies = VEC_TO_TRANSFORM_DATA[grab_handle.to_a]\n\t\traise ArgumentError, \"#{grab_handle.to_s} is not a valid grab handle\" if type.nil?\n\t\traise ArgumentError, \"Coordinates do not specify an edge\" unless type == :edge\n\t\t\n\t\treturn target_indidies.collect{|i| self.vert(i) }\n\tend",
"def adjacent(vertex1, vertex2)\n connections = @graph[vertex1]\n return connections && connections.include?(vertex2)\n end",
"def edges\n h = hedges\n v = vedges\n [ h[0], v[1], h[1], v[0] ]\n end",
"def get_closest_edge_vertices(lat, lon)\n #Override this function in the corresponding extension (tiger and osm initially)\n return nil\n end",
"def create_edge(node1, node2)\n @nodes[node1.position].add_edge(node2)\n @nodes[node2.position].add_edge(node1)\n end",
"def edgeCross(currEdge,vertexIn)\n if (vertexIn[currEdge[0]] == 1) and (vertexIn[currEdge[1]] == 0)\n return true\n elsif (vertexIn[currEdge[0]] == 0) and (vertexIn[currEdge[1]] == 1)\n return true\n else\n return false\n end\nend",
"def add_edge(start_vertex_name, end_vertex_name)\n\n # Check if graph is not empty\n if (@vertices.length == 0)\n raise GraphError.new('No edges can be added to an empty graph', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_vertex_index = find_index_for_vertex(end_vertex_name)\n\n if (first_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. First vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n if (second_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. Second vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n add_edge_by_indexes(first_vertex_index,second_vertex_index)\n end",
"def find_or_add_edge(one, two)\n edge = find_edge(one, two)\n if edge\n edge.weight += 1\n edge\n else\n edges << Edge.new(one: one, two: two, weight: 1)\n edges.last\n end\n end",
"def edges\n edges = []\n vertices.each do |x|\n if x.neighbors\n neighbors = x.neighbors\n neighbors.each do |id|\n n = find_vert(id)\n edges << [x.id, n.id]\n end\n end\n end\n edges\n end",
"def get_edge_merged(edge1, edge2)\n dist1 = get_edge_distance(edge1)\n dist2 = get_edge_distance(edge2)\n if dist1 and dist2 then\n Edge.new(dist1 + dist2)\n elsif dist1 then\n Edge.new(dist1)\n elsif dist2 then\n Edge.new(dist2)\n else\n Edge.new\n end\n end",
"def get_edge(x, y)\n edge = get(x, y)\n edge[:weight] if edge\n end",
"def neighbors(vertex)\n\tend",
"def edge(resource,node1,node2) \n label = fetch_fragment(resource) if(@options.showedges)\n color = colour_map(resource) if (@options.colour_code)\n @root.add_edge(node1,node2,:label=>label,:color=>color)\n end",
"def common_point(e1, e2)\n p1, p2 = @points_of_edge[e1]\n p3, p4 = @points_of_edge[e2]\n if p1 == p3 || p1 == p4\n p1\n elsif p2 == p3 || p2 == p4\n p2\n else\n nil\n end\n end",
"def find_edge_intersecting_with_line(poly_verts, line_start, line_end)\n count = poly_verts.count\n\n poly_verts.each_with_index do |face_start, i|\n face_end = poly_verts[(i+1) % count]\n\n contact_loc = line_line_intersection(face_start, face_end, line_start, line_end)\n\n if contact_loc\n edge = Edge.new(face_start, face_end)\n edge.contact_loc = contact_loc\n return edge\n end\n end\n\n nil\n end",
"def edge_weight(id_1, id_2)\n @arr[id_1][id_2]\n end",
"def add_edge(x, y)\n\t\traise if @x_connections[x] != -1\n\t\traise if @y_connections[yIdx(y)] != -1\n\t\t\n\t\t@x_connections[x] = y\n\t\t@y_connections[yIdx(y)] = x\n\t\t\n\t\t@unconnected_x_vertices -= 1\n\t\t\n#\t\traise if @x_connected_vertices.member?(xy[0])\n#\t\traise if @y_connected_vertices.member?(xy[1])\n\t\n\tend",
"def connect(vertex1, vertex2, edge_attributes = {})\n self.vertices << vertex1 unless self.vertices.include? vertex1\n self.vertices << vertex2 unless self.vertices.include? vertex2\n edge = Edge.new(edge_attributes)\n self.edges << edge\n edge << vertex1 << vertex2\n end",
"def test_add_edge\n @graph.add_edge('a', 'b');\n vertex_a = @graph.find_vertex('a')\n vertex_b = @graph.find_vertex('b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == true && @graph.vertices[1].neighbours[0] == true)\n end",
"def common_point(e1, e2)\n p1, p2 = @edges[e1]\n p3, p4 = @edges[e2]\n if p1 == p3 || p1 == p4\n p1\n elsif p2 == p3 || p2 == p4\n p2\n else\n nil\n end\n end",
"def remove_edge(x, y)\n raise\n end",
"def get_edge(source, target)\n h = @pathway.graph[source]\n h ? h[target] : nil\n end",
"def get_other_vertex(v_id)\n (vertices - [v_id])[0]\n end",
"def edge?(source, target)\n return false unless vertex?(source) and vertex?(target)\n\n @vertices[source].has_edge?(:out, target)\n end",
"def edge\n :first if first?\n :last if last?\n nil\n end",
"def add_edge(a,b)\n @adj_list[a][b] = 1\n end",
"def vertex_edges(vertex_id)\n vertex_edges = []\n all_edges = edges\n all_edges.each { |e| vertex_edges << [vertex_id, e[1]] if e[0] == vertex_id }\n vertex_edges\n end",
"def in_neighbors(vertex)\n\tend",
"def out_neighbors(vertex)\n\tend",
"def add_edge(from_vertex, to_vertex)\n begin\n self[from_vertex].out_edges << to_vertex\n self[to_vertex].in_edges << from_vertex\n rescue NoMethodError => e\n err_suffix = \"in add_edge(#{from_vertex}, #{to_vertex}).\"\n if self[from_vertex].nil?\n puts(\"No vertex with id #{from_vertex} \" << err_suffix)\n else\n puts(\"No vertex with id #{to_vertex} \" << err_suffix)\n end \n end\n end",
"def edge(v, w)\n (@from_store[v] || []).find{ |e| e.to == w }\n end",
"def end_vertices(e)\n\t\ttemp_array = []\n\t\tfor i in 0..num_edges-1\n\t\t\tif @Edges[i].label==e.label\n\t\t\t\ttmp2 = @Edges[i].points\n\t\t\tend\n\t\tend\n\t\ttemp_array << @Vertices[@Hash[tmp2[0]]]\n\t\ttemp_array << @Vertices[@Hash[tmp2[1]]]\n\t\treturn temp_array\n\tend",
"def edges\n @vertices.reduce(Set.new) { |edges, vertex| edges + vertex.edges }\n end",
"def add_undirected_edge(id1,id2)\n @g[id1] ||= Set.new\n @g[id2] ||= Set.new\n @g[id1] << id2\n @g[id2] << id1\n end",
"def adjacent(x, y)\n raise\n end",
"def find_any_path_between_vertices(source_vertex, destination_vertex)\n validate_integer(source_vertex, destination_vertex)\n return nil if @vertices[source_vertex].nil? || @vertices[destination_vertex].nil?\n return path_between_vertices(source_vertex, destination_vertex)\n end",
"def add_edge(x, y) # from x to y\n if @nodes.key?(x) and @nodes.key?(y)\n if @edges.key?(x)\n unless @edges[x].include?(y)\n @edges[x] << y\n end\n end\n if @back_edges.key?(y)\n unless @back_edges[y].include?(x)\n @back_edges[y] << x\n end\n end\n else\n raise RuntimeError.new \"#{x} and #{y} not both present\"\n end\n end",
"def adjacent?(x2 ,y2 , x1 = @x , y1 = @y)\n return (x1 - x2).abs < 0.6 && (y1 - y2).abs < 0.6\n end",
"def path?(v1,v2)\n return false if v1 < 0 or vertices <= v1\n return false if v2 < 0 or vertices <= v2\n dfs(v1) do |v,w|\n return true if w == v2\n end\n false\n end",
"def adjacent?(x, y)\n @edges[x].include?(y) || @edges[y].include?(x)\n end",
"def each_edge(v)\n raise ArgumentError, \"No such vertex\" if v < 0 or @vertices <= v\n @adjacent[v].each { |w| yield v,w }\n end",
"def delete_edge(vertex1, vertex2)\n if !contains_vertex?(vertex1) || !contains_vertex?(vertex2)\n raise InvalidVertexException, \"The graph does not contain that vertex\"\n elsif !(@graph[vertex1].include?(vertex2))\n raise InvalidEdgeException, \"The graph does not contain that edge\" \n end\n @graph[vertex1].delete(vertex2)\n @graph[vertex2].delete(vertex1)\n self\n end",
"def has_edge?(u, v)\n each_adjacent(u) do |w|\n return true if v == w\n end\n return false\n end",
"def adjEdges(u)\n\t\tl = Array.new\n\t\t@edgeSet.each do |e|\n\t\t\tif e.s == u\n\t\t\t\tl << e\n\t\t\tend\n\t\tend\n\t\tl\n\tend",
"def has_edge?(from, to)\n @vertices.has_key?(from) && @vertices[from].include?(to)\n end",
"def remove_edge(id1, id2)\n # YOUR WORK HERE\n end",
"def add_edge(edge)\n # pp @access_paths\n # pp edge\n added = false\n return added if @edges.include?(edge)\n visited_path = @access_paths.each_with_index.select{|p,idx| !(p & edge).empty? }\n if visited_path.count == 2\n # if the two vertexes are visited in 2 paths\n # We'll combine the 2 paths\n new_path =[]\n to_del_idx =[]\n visited_path.each do |p|\n idx = p[1]\n v_path = p[0]\n new_path = new_path + v_path\n to_del_idx << idx\n end\n @access_paths.delete_if.with_index{|p,idx| to_del_idx.include?(idx)}\n @access_paths << new_path\n @edges << edge unless @edges.include?(edge)\n added = true\n elsif visited_path.count == 1\n v_path = visited_path[0][0]\n # binding.pry\n if (v_path & edge).count() == 2\n # binding.pry\n # add edge only when it does not create cycle\n puts \"Refuse to add edge #{edge.to_s} as it create cycle\"\n else\n # v_path = visited_path[0][1]\n vertext = edge - v_path\n v_path = v_path + vertext\n idx = visited_path[0][1]\n @access_paths.delete_at(idx)\n @access_paths << v_path\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n elsif visited_path.count == 0\n @access_paths << edge\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n # puts \"added is #{added}\"\n\n return added\n\tend",
"def edges_from(node)\n self[node].map { |n| [node, n] }\n end",
"def edge_key(a,b)\n \"#{a}_#{b}\".to_sym\n end",
"def edge_class() @parallel_edges ? Plexus::MultiEdge : Plexus::Edge; end",
"def get_edge_corner_dis\n top_left = [self.x - self.ox, self.y - self.oy]\n bot_right = [top_left[0] + self.width, top_left[1] + self.height]\n return [top_left, bot_right]\n end",
"def wedge(other)\n other = Geom2D::Point(other)\n x * other.y - other.x * y\n end",
"def delete_edge(from_vertex, to_vertex)\n begin\n self[from_vertex].out_edges.delete(to_vertex)\n self[to_vertex].in_edges.delete(from_vertex)\n rescue NoMethodError => e\n err_suffix = \"in delete_edge(#{from_vertex}, #{to_vertex}).\"\n if self[from_vertex].nil?\n puts(\"No vertex with id #{from_vertex} \" << err_suffix)\n else\n puts(\"No vertex with id #{to_vertex} \" << err_suffix)\n end \n end\n end",
"def third_degree_neighbors(edges, start)\nend",
"def add_edge_by_indexes(start_vertex_index, end_vertex_index)\n\n @vertices[start_vertex_index].neighbours[end_vertex_index] = true\n @vertices[end_vertex_index].neighbours[start_vertex_index] = true\n\n self\n end",
"def create_edge_to_and_from(other, weight = 1.0)\n self.class.edge_class.create!(:from_id => id, :to_id => other.id, :weight => weight)\n self.class.edge_class.create!(:from_id => other.id, :to_id => id, :weight => weight)\n end",
"def add_edge(e)\n add_vertex(e.from); add_vertex(e.to)\n (@from_store[e.from].add?(e) && @to_store[e.to].add(e) && e) || edge(e.from, e.to)\n end",
"def both_e(*filters, &block)\n Pacer::Route.property_filter(chain_route(:element_type => :edge,\n :pipe_class => Pacer::Pipes::VertexEdgePipe,\n :pipe_args => Pacer::Pipes::VertexEdgePipe::Step::BOTH_EDGES,\n :route_name => 'bothE'),\n filters, block)\n end",
"def addEdge( from_vertex, to_vertex)\n addVertex( from_vertex )\n addVertex( to_vertex )\n @vertices[from_vertex] << to_vertex\n end",
"def detect_cycle_in_graph(edges)\nend",
"def add_edge(x, y, type)\n debug_msg \"adding edge #{x}, #{y}, #{type}\"\n if self[x,y]\n unless self[x,y] == type\n @contradiction = true\n debug_msg \" \\tcontradiction\"\n throw :add_edge_throw, :contradiction\n else\n debug_msg \"\\ti know\"\n throw :add_edge_throw, :i_know\n end\n else\n super(x, y, type)\n end\n end",
"def edge_to(target)\n Edge.new(self, target)\n end",
"def add_edge(vertex1, vertex2)\n if !@graph[vertex1] || !@graph[vertex2]\n raise InvalidVertexException, \"That vertex doesn't exist in the graph\"\n end\n @graph[vertex1].push(vertex2)\n @graph[vertex2].push(vertex1)\n self\n end",
"def add_edge(object_1, object_2)\n node_1 = check_object(object_1)\n node_2 = check_object(object_2)\n node_1.adjacents << node_2\n node_2.adjacents << node_1\n end",
"def add_directed_edge(id1,id2)\n @g[id1] ||= Array.new\n @g[id1] << id2\n end",
"def make_edge(source, destiny, weigth)\n @vertices[source][destiny] = weigth\n @vertices[destiny][source] = weigth\n end"
] | [
"0.7394766",
"0.7323445",
"0.73078275",
"0.72541255",
"0.7220407",
"0.70989025",
"0.70989025",
"0.6944398",
"0.6875293",
"0.6861289",
"0.68169624",
"0.6740854",
"0.6740854",
"0.6718185",
"0.66641533",
"0.66641533",
"0.65968657",
"0.65937185",
"0.6589447",
"0.65610266",
"0.6543279",
"0.65298456",
"0.6484449",
"0.64715546",
"0.64709836",
"0.64616543",
"0.64452004",
"0.6441212",
"0.6431483",
"0.64288884",
"0.63961124",
"0.6378049",
"0.6367883",
"0.6337751",
"0.6327211",
"0.63012433",
"0.6300435",
"0.629052",
"0.6286233",
"0.6275532",
"0.6275205",
"0.62578595",
"0.6225457",
"0.6201632",
"0.6181538",
"0.6178243",
"0.6160398",
"0.61373585",
"0.61108994",
"0.608945",
"0.6076231",
"0.6067469",
"0.60553586",
"0.6054989",
"0.6046888",
"0.6042343",
"0.6041107",
"0.6031226",
"0.60185444",
"0.6016325",
"0.6006268",
"0.5987425",
"0.59854996",
"0.5966427",
"0.5954027",
"0.59493995",
"0.5945257",
"0.59451383",
"0.593887",
"0.5934807",
"0.59322",
"0.5908306",
"0.58925056",
"0.58781564",
"0.58695567",
"0.58674246",
"0.5860642",
"0.585963",
"0.585772",
"0.5854936",
"0.5851912",
"0.5850285",
"0.58267033",
"0.58120805",
"0.58043677",
"0.5801246",
"0.57897407",
"0.5787865",
"0.5783062",
"0.57707137",
"0.57582664",
"0.5757658",
"0.5756428",
"0.57469064",
"0.5744802",
"0.57329285",
"0.57312363",
"0.57256716",
"0.572372",
"0.57182294"
] | 0.79551625 | 0 |
Method to add an item to a list input: list, item name, and optional quantity steps: define method, add item and quanity to specific list output: the new list | def add_item(list,new_item,item_count)
list[new_item] = item_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list\r\n list[item] = quantity\r\n# output: shopping list with the added item and quantity\r\n printlist(list)\r\nend",
"def add_item(list, item, quantity = 1)\r\n# input: list, item name, and optional quantity\r\n# steps: \r\n # check for optional quantity. if not present, set to default (1)\r\n list[item] = quantity\r\n # update list with input\r\n puts \"#{item.upcase} has been added to your grocery list!\"\r\n p list\r\n# output: complete list, updated\r\nend",
"def add_item(list, name, quantity = 1) \r\n# input: item name and optional quantity\r\n# steps: \r\n# create add method with name and optional quantity arguments\r\n# add name and quantity to hash\r\n list[name] = quantity\r\n# output: print \"your item has been added to the hash\"\r\n return list\r\nend",
"def add_to_list(list,item,quantity)\n\tupdate_item(list,item,quantity)\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend",
"def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend",
"def add_item(item, quantity, list)\n\tlist[item] = quantity\n\titem\nend",
"def add(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as key and quantity as value to final_list hash(item and quantity will be user inputs)\n list[add_item] = add_quantity\n # Return updated hash\n list\nend",
"def add_item(list, item, quantity=0)\n\tlist[item] = quantity\n\tlist\nend",
"def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def add_items(list, item_name, quantity=0)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend",
"def add_new_items(list, item_name, quantity=1)\n list[item_name] = quantity\n list\nend",
"def update_item(list, item, quantity)\r\n add_item(list, item, quantity)\r\n# input: Shopping list, item to be updated, new quantity\r\n# steps:\r\n # Use shopping list as input\r\n # Use item to be updated as input\r\n # Use new quantity to be updated as input\r\n # Update the quantity of the item on the list\r\n # list[item] = quantity\r\n# output: shopping list with updated quantity\r\n # printlist(list)\r\nend",
"def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend",
"def add_item(list, item, qty=nil, print=true)\n\t# input: \n\t# existing list, \n\t# item name (string), \n\t# quantity qty (int or string or nil(default)), \n\t# print? (t(default)/f)\n\t# output: updated list (array)\n\t\n\t# format list item \n\tif qty\n\t\tqty = qty.to_s\n\tend\n\titem = [item.strip.capitalize, qty]\n\t# append to list\n\tlist = list.push(item)\n\t# print list if print=true\n\tif print\n\t\tputs \"\\n\\nList updated: added item '#{item}'\\n\"\n\t\tprint_list(list)\n\tend\n\treturn list\nend",
"def add_list(item_name, item_list, quantity = 1)\n item_list[item_name] = quantity\nend",
"def add_item(list, item_name, optional_quantity)\n\nlist[item_name] = optional_quantity\n\n# input: list, item name, and optional quantity\n# steps:\n # Add new hash key based on item name\n # Tell method there may or may not be a argument passed in for quantity\n # assign quantity to 'optional-quantity' argument in method definition\n # Access method that contains initialized hash def add_item(create_list, item_name, quantity = 3)\n# output:\n # updated grocery list\nend",
"def add_to_list(list, item, quantity)\n #method to add items\n list[item] = quantity\nend",
"def add_item (list, item, quantity = 1)\n\tlist[item] = quantity\n\treturn list\nend",
"def update(list, item, qty)\n add_item(list, item, qty)\nend",
"def add_item(list, item_name, quantity=1)\n list[item_name] = quantity\nend",
"def add_item(item, quantity, list)\n\t# steps: \n\t# if the item is already in the list\n\tif list[item.to_sym] \n\t\t# add to the quantity\n\t\t#list[item.to_sym] = list[item.to_sym] + quantity\n\t\tlist[item.to_sym] += quantity\n\t# otherwise\n\telse\n\t\t# make a new key with the input quantity\n\t\tlist[item.to_sym] = quantity\n\tend\n\t# output:\n\t\t# updated list\n\tlist\nend",
"def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend",
"def add_item(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def add_item(list, new_item, quantity=1)\n list[new_item] = quantity \nend",
"def add_item(new_list, item_name, quantity=1)\r\n \r\n new_list[item_name] = quantity\r\n \r\nend",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def add_item(list, item, quantity=0)\n list[item] = quantity\n list\nend",
"def add_to_list(list, item, quantity = 1)\n\tlist[item] = quantity\nend",
"def updating_item(list,item,quantity)\r\n\r\n adding_item(list,item, quantity)\r\n\r\nend",
"def add_item(list, new_item, qty=1)\n list[new_item] = qty\nend",
"def add_item(item, quant=0)\n\t$grocery_list.store(item, quant)\n\tp \"You added #{item} to your list.\"\nend",
"def add_item_to_list(list_name,item_to_add,quantity_to_add = 1)\n#create a hash element with the item name and the quantity, if specified\n#if no quantity is specified, default value = 1\n new_item = { \n item_name: item_to_add,\n quantity: quantity_to_add\n }\n# insert the hash into array \n list_name.push(new_item)\n new_item\nend",
"def add_item(list, item_name, quantity = 1)\r\n list[item_name] = quantity\r\nend",
"def add_item(item,quantity,list)\n\tlist[item] = quantity\nend",
"def add_item(list,item_name, qty)\n list[item_name] = qty\nend",
"def add_item(item,amount=1,the_lists)\r\n\t# steps: accept 2 arguments. Item name and Quantity (with default)\r\n\tif the_lists[item] != nil\r\n\t puts \"Item is already on the List !\"\r\n\t puts \"Added amount to the quantity\"\r\n\t the_lists[item] += amount\r\n\telse\r\n the_lists[item] = amount\r\n\tend\r\n\r\n\tprint_list(the_lists)\r\nend",
"def list_add(list, item_name, quantity=1)\n list[item_name] = quantity\n p list\nend",
"def add_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend",
"def add_item(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list \nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n list\nend",
"def add_list(list,new_item,quantity=1)\n list[new_item] = quantity\n list\nend",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def add(input_list, item, quantity)\n input_list[item] = quantity\nend",
"def add_item(list, item, quantity=1)\r\n\tlist[item] = quantity\r\n#\tp list\r\nend",
"def add_item!(list, item, qty=1)\r\n list[item] = qty\r\n list\r\nend",
"def add_item_to_list(grocery_list, grocery_item, quantity = 1)\n grocery_list.store(grocery_item,quantity)\n puts \"I've added #{grocery_item} to the list. Please pick up #{quantity} of these.\"\nend",
"def add_item(my_list, item, quantity)\r\n #input: a string seperated by an integer \r\n #steps: use a method that adds an item and quantity to the hash.\r\n my_list.store(item, quantity)\r\n # use a hash or store method hash.merge!(key => value) \r\n #output = hash with the updated item/quantity. \r\n my_list\r\n \r\nend",
"def update_quanity(list, item, quantity)\r\n# input: list, item and quantity to be updated to\r\n# steps:\r\n # check if item exists\r\n # update quantity\r\n list[item] = quantity\r\n # print success \"your cart has been updated!\"\r\n puts \"The quantity for #{item.upcase} has been updated in your grocery list!\"\r\n p list\r\n# output: updated list with new quantity\r\nend",
"def add_item(item, list, quantity)\n list[item] = quantity\nend",
"def add_item(list,item,quantity=1)\r\n list[item] = quantity\r\n list\r\nend",
"def list_adder(list, item_name, quantity=1)\n\tlist.store(item_name, quantity)\n\tp list\nend",
"def add_item(list, item, qty)\n list[item] = qty\n list\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\n p list\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n\n list\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n return list\nend",
"def add(list, item, quantity)\r\n\tlist[item] = quantity\r\n\tlist\r\nend",
"def add_item(list, item_name_string, quantity=1)\r\n\titem_key = item_name_string.to_sym\r\n\tlist[item_key] = quantity\r\n\treturn list\r\nend",
"def list_add(hash_items, item_name, quantity = 1)\n hash_items [item_name] = quantity\n return hash_items\nend",
"def add_item(list, item, qty=1)\n list[item] = qty\n p \"#{item} : #{list[item]}\"\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n return list\nend",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend",
"def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend",
"def add_item(item)\n\t\t#takes in item and adds to list\n\t\t@list << item\n\tend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\nend",
"def add_item(existing_list, new_item, item_integer)\n\t# input: item name and optional quantity\n\t# steps: pass in item name as key and assign value\n\texisting_list[new_item] = item_integer\n\t# output: hash\n\tp existing_list\nend",
"def add_item(shopping_list, item, quantity=1)\r\n\r\n\tshopping_list[item] = quantity\r\n#\treturn shopping_list\r\nend",
"def add_item(grocery_list, item_name, quantity=1)\n\tgrocery_list[item_name] = quantity\n\treturn grocery_list\nend",
"def add_item(item)\r\n @list << item \r\n end",
"def add_item(list,name,quantity=1)\n list[name]=quantity\n return list\nend",
"def update_item(list, item_name, new_qty)\n if list.has_key?(item_name)\n list[item_name] = new_qty\n else\n list = add_method(list, item_name, new_qty)\n end\n list\nend",
"def add_item(list,name,value)\n list = List.find(list)\n list.add(Item.new(name,value))\n say_set list.name, name, value\n end",
"def add_item(name, quantity, list)\n list[name] = quantity\n p list\n return list\nend",
"def update_quanity(list, item_name, new_quantity)\n\n\tlist[item_name] = new_quantity\n\tp list\nend",
"def list_add(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n p list\r\nend",
"def add_to_grocery_list(grocery_list, item_name, quantity=1)\n # steps: add item to hash and set quantity\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def add_to_list(item,quantity,list)\n list[item]=quantity\nend",
"def add_item(grocery_list, new_item_to_add, quanity)\n\tgrocery_list[new_item_to_add] = quanity\n\tp grocery_list\n\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def add_to_list(list, item, quantity = 1)\n list[item] = quantity\n p list\nend",
"def add_change_items(list, item, quantity)\r\n\t#NOTE if changing item make sure to type in 'item' correctly\r\n list[item] = quantity\r\n p list\r\nend",
"def add (list, item, quantity)\n\tlist[item] = quantity\nend",
"def add_item(item_name, grocery_list, quantity=1)\n grocery_list[item_name] = quantity\n grocery_list\n end",
"def add_item (list, item, qty)\n list[item]=qty\nend",
"def add_item(list, item, quant)\n list[item] = quant\nend",
"def update_quantity(grocery_list, item, quantity)\r\n add_item(grocery_list, item, quantity)\r\n \r\nend",
"def add_item(grocery_list, item_name, qty = 1)\n\tgrocery_list[item_name] = qty\n\treturn grocery_list\nend",
"def add_item(list, item, quantity = 1)\r\n list[item] = quantity\r\nend",
"def add_item(grocery_list, item, quantity = 1)\n \tgrocery_list[item.to_sym] = quantity\nend"
] | [
"0.795133",
"0.790262",
"0.78300786",
"0.7814698",
"0.77794486",
"0.7779328",
"0.7779328",
"0.77266306",
"0.77266306",
"0.7657119",
"0.7603219",
"0.76005363",
"0.75877446",
"0.7581513",
"0.7580342",
"0.74991405",
"0.74892855",
"0.74843735",
"0.7478123",
"0.7450399",
"0.7448808",
"0.7440208",
"0.7423686",
"0.73651093",
"0.7362976",
"0.7359207",
"0.7355932",
"0.73547983",
"0.7337604",
"0.733614",
"0.7308788",
"0.7282732",
"0.7279561",
"0.7277395",
"0.7258404",
"0.72369134",
"0.7234068",
"0.721789",
"0.7216392",
"0.72099423",
"0.72045547",
"0.71891654",
"0.71737486",
"0.7171048",
"0.7163124",
"0.7161001",
"0.7160562",
"0.71566266",
"0.7147228",
"0.71335584",
"0.7132205",
"0.71295726",
"0.7124305",
"0.71192646",
"0.7102454",
"0.7101998",
"0.7101255",
"0.7094295",
"0.7093698",
"0.7093547",
"0.7082393",
"0.70805",
"0.70730317",
"0.70644206",
"0.7058715",
"0.7057081",
"0.7055067",
"0.70525825",
"0.70515406",
"0.70492136",
"0.70471174",
"0.7038973",
"0.70294505",
"0.70162946",
"0.70162946",
"0.7007576",
"0.7007576",
"0.70064867",
"0.70052683",
"0.6999742",
"0.6997923",
"0.6997517",
"0.6989252",
"0.6982374",
"0.6964967",
"0.695242",
"0.6951921",
"0.6948275",
"0.6947065",
"0.6938216",
"0.6932356",
"0.69320744",
"0.693185",
"0.69241655",
"0.69212306",
"0.6919777",
"0.6908935",
"0.6907136",
"0.6905189",
"0.68953764",
"0.688499"
] | 0.0 | -1 |
Method to remove an item from the list input: get the hash/list name and the key to delete steps: then delete the key from the hash output: updated list, minus what we deleted | def delete_item(list,item)
list.delete(item)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item name and value from hash\r\n list_name.delete(item)\r\n# output: updated hash with item removed\r\np list_name\r\nend",
"def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend",
"def remove_item(my_list, item)\r\n# input: an item (something already in the list)\r\n# steps:\r\n my_list.delete(item)\r\n \r\n my_list\r\n# declare hash\r\n# delete method for item\r\n# output: hash with removed item\r\nend",
"def remove_item(hash_list, item)\n hash_list.delete(item)\n p hash_list\nend",
"def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend",
"def delitem(list, item)\n# input: list and key\n list.delete(item)\n# steps: delete a given key item\nend",
"def remove_item(item_to_remove)\n $list_hash.delete_if{|current_item, quantity|item_to_remove==current_item} #goes through entire item in delete if hash if item in hash delete from hash\nend",
"def remove_item(list, rm_item)\n# steps:\n # use delete method with key (item) as argument\n list.delete(rm_item)\n # return list\n list\nend",
"def remove_item(item,the_lists)\r\n\t\t# steps: search the hash for the key that match the item name\r\n the_lists.delete_if{|item_name,item_quantity| item_name == item}\r\n\t\t#then delete the element\r\n\r\n\t\tprint_list(the_lists)\r\nend",
"def remove_item(list, key_name)\r\n\tlist.delete(key_name)\r\n\treturn list\r\nend",
"def remove_item(list, name)\r\n# create remove method with name arguments\r\n# check if item is in the hash\r\n if list[name] != nil\r\n# remove item if present\r\n list.delete(name)\r\n end\r\n# output: print \"your item has been deleted from the hash\"\r\n return list\r\nend",
"def remove_an_item(list_hash,item_name)\n if list_hash[item_name]\n puts \"Deleting item: #{item_name}.\"\n list_hash.delete(item_name)\n else\n puts \"Item does not exist.\"\n end\n\n list_hash\nend",
"def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend",
"def remove_from_grocery_list(grocery_list, item_name)\n # steps: remove item from hash\n grocery_list.delete(item_name.to_sym)\n # output: explicit return updated hash\n grocery_list\nend",
"def remove_from_list(list_hash, item)\r\n\tlist_hash.delete(item) { |el| \"#{el} not found\" }\r\n\tlist_hash\r\nend",
"def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend",
"def remove_item(list, item_name)\n # steps:\n # check IF item is included in list\n # delete the item\n # ELSE, print a message to the user\n list.include?(item_name) ? list.delete(item_name) : puts(\"No #{item_name} on the list.\")\n \n # output: return updated hash or the original hash\n list\nend",
"def remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend",
"def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend",
"def remove_item(list,item)\r\n list.delete_if {|key,value| key == item}\r\n list\r\nend",
"def remove_item(item, hash)\n hash.delete(item)\n return hash\nend",
"def remove_item(list, item)\n\t# if list.keys.include?(item)\n\t# \tlist.delete(item)\n\t# end\n\t# list.delete(item) if list.keys.include?(item)\n\tlist.delete_if { |key, value| key == item } \n\t# Destructive method\n\tp list\nend",
"def remove_item(list, item_to_be_removed)\n # if list.has_key? item_to_be_removed\n # list.delete(item_to_be_removed)\n # end\n list.delete(item_to_be_removed) if list.has_key? item_to_be_removed\n list\nend",
"def remove_item(hash_of_items, item)\n hash_of_items.delete(item)\n hash_of_items\nend",
"def remove_item(list, item)\n list_hash = list\n if list_hash.keys.include?(item)\n list_hash.delete(item)\n end\n return list_hash\nend",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def remove(input_list, item)\n input_list.delete(item)\nend",
"def remove_to_list(list, remove_list_key)\r\n list.delete(remove_list_key)\r\n list\r\nend",
"def remove_item(list, list_item)\n if list.has_key?(list_item)\n list.delete(list_item)\n else\n puts \"Item is not in list\"\n end\n p list\n list\nend",
"def remove_item_from_list(hash, item_to_remove)\n if hash.has_key?(item_to_remove)\n hash.delete(item_to_remove)\n else\n puts \"It looks like #{item_to_remove} wasn't in the hash after all!\"\n end\nend",
"def remove_item(item, hash)\n hash.delete(item)\n return hash\nend",
"def remove_item(hash, item)\n hash.delete(item)\n return hash\nend",
"def remove(item, hash)\n hash.delete(item)\nend",
"def remove_item(hash, item)\n hash.delete(item)\n hash\nend",
"def remove_item(hash, item)\n hash.delete(item)\n hash\nend",
"def remove_item(list, item)\r\n# input: shopping list and item to be removed\r\n# steps: \r\n # Use shopping list as input\r\n # Use item to be removed as input\r\n # Remove the item from the list if it exists on the list\r\n list.delete(item)\r\n# output: shopping list with item removed\r\n printlist(list)\r\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name){|item| list[item] = item_name}\n\tp list\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def remove_item(hash, item)\r\n\thash.delete(item)\r\n\thash\r\nend",
"def remove(item, hash)\n hash.delete(item)\n puts hash\nend",
"def remove_item(list, item)\n if list.has_key?(item)\n list.delete(item)\n else\n puts \"ERROR: Item not in list\"\n end\n return list\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove_item(list, item_name)\n list.delete(item_name.to_sym)\n list\nend",
"def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend",
"def remove_item(name, list)\n list.delete(name)\n p list\n return list\nend",
"def remove_item(hash, item)\n hash.delete(item)\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item)\r\n# input: item to be removed, list\r\n# steps: \r\n # check if item exists\r\n # remove item\r\n list.delete(item)\r\n # print success message of item removed\r\n puts \"#{item.upcase} has been removed to your grocery list!\"\r\n p list\r\n# output: updated list\r\nend",
"def remove_item(list_name, item_name)\r\n if list_name.has_key?(item_name)\r\n list_name.delete(item_name)\r\n else\r\n p \"Item is not on the list\"\r\n end\r\nend",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove(hash, item)\n hash.delete(item)\nend",
"def remove(hash, item)\n hash.delete(item)\nend",
"def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend",
"def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend",
"def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n updated_list = $old_list.to_h\n #updated_list.delete_if {|key, value| key == item_to_rmv}\n if updated_list.include?(item_to_rmv) == true \n #p \"test\"\n #p item_to_rmv\n #p $old_list\n p updated_list.delete(item_to_rmv)\n p updated_list.each {|key, val| p key, val}\n #p updated_list\n else \n p \"that item isn't on the list\"\n end\n #if $old_list.to_h.include?(item_to_rmv) == true\n # updated_list.delete(item_to_rmv)\n # updated_list = $old_list.to_h\n #else\n # p \"that item isn't on the list\"\n #end\n \n \nend",
"def delete_item(grocery,item_name)\n # input: list, item name.\n # steps: delete item_name from the hash\n grocery.delete(item_name)\n # output: display the latest list\n display_list(grocery)\nend",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def deleted_item(list, key)\n list.delete_if {|k, v| k == \"#{key}\"}\n list\nend",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(item, list)\n list.delete(item)\nend",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tp list\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(hash, key)\n hash.delete(key)\n p hash\nend",
"def remove_item(item, list)\r\n list.delete(item)\r\n p list\r\n list\r\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def del_item(list, item_to_del)\n list.delete(item_to_del)\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove(final_list, item)\r\n final_list.delete(item)\r\n end",
"def remove(list, item_name)\n\tlist.delete(item_name)\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_from_list(list, item)\n list.delete(item)\n p list\nend",
"def remove_item_from_list(list,item)\r\n list.delete(item)\r\n print_list(list)\r\nend",
"def rem_list(item_name, item_list)\n item_list.delete(item_name)\n puts \"You just removed #{item_name} from the list.\"\nend",
"def remove(list, item_name)\r\n\tlist.delete(item_name)\r\n\tp list\r\nend",
"def delete_hash_item(hash, item)\n [item, hash.delete(item)]\nend",
"def remove_item(list, item)\n if list.has_key?(item) == false\n puts \"Nothing to remove\"\n else\n list.delete(item)\n end\n list\nend",
"def remove_item(list,item)\n list.delete(item)\n p list\nend"
] | [
"0.8384225",
"0.8319248",
"0.81510663",
"0.8003024",
"0.78639805",
"0.7797896",
"0.77775574",
"0.77769065",
"0.7773278",
"0.7648284",
"0.76454604",
"0.7574883",
"0.7484497",
"0.7474068",
"0.7469355",
"0.74413306",
"0.74376804",
"0.74181265",
"0.73635554",
"0.73521113",
"0.734445",
"0.73128486",
"0.7310795",
"0.7302858",
"0.73019546",
"0.7301144",
"0.7300079",
"0.72955984",
"0.72852874",
"0.7283951",
"0.72807944",
"0.72715384",
"0.72636044",
"0.7253491",
"0.7253491",
"0.72521245",
"0.7251881",
"0.7251235",
"0.7236506",
"0.7225832",
"0.7225448",
"0.7223195",
"0.72057694",
"0.7200791",
"0.7152499",
"0.7146768",
"0.7133583",
"0.71288544",
"0.71269345",
"0.71269345",
"0.71269345",
"0.71269345",
"0.7126068",
"0.7123098",
"0.7117427",
"0.7117427",
"0.7117427",
"0.7117281",
"0.7117226",
"0.7117226",
"0.71130323",
"0.71130323",
"0.71129966",
"0.71129966",
"0.7103899",
"0.7099955",
"0.70970947",
"0.70943946",
"0.70913744",
"0.7073255",
"0.7069778",
"0.70643634",
"0.70413107",
"0.703399",
"0.70287716",
"0.7020709",
"0.70204943",
"0.7019072",
"0.7013282",
"0.700389",
"0.70037395",
"0.70037395",
"0.7002986",
"0.7002986",
"0.7002664",
"0.6998972",
"0.6998923",
"0.6996925",
"0.6996064",
"0.69904464",
"0.6984395",
"0.6983159",
"0.6983046",
"0.6979333",
"0.6972218",
"0.6965543",
"0.6961823",
"0.6959188",
"0.6957587",
"0.6952026",
"0.6951172"
] | 0.0 | -1 |
Method to update the quantity of an item input: get the hash/list name, the key, and the upated quantity to change steps: update the quanityt number output: updated list with the new quantity | def update_quantity(list,item,item_count)
list[item] = item_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend",
"def update_quanity(list, item, quantity)\r\n# input: list, item and quantity to be updated to\r\n# steps:\r\n # check if item exists\r\n # update quantity\r\n list[item] = quantity\r\n # print success \"your cart has been updated!\"\r\n puts \"The quantity for #{item.upcase} has been updated in your grocery list!\"\r\n p list\r\n# output: updated list with new quantity\r\nend",
"def update_quantity(list, upd_item, new_quantity)\n# steps:\n # reassign key (item) a new value (quantity)\n list[upd_item] = new_quantity\n # return list\n list\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity.to_i\n\tlist\nend",
"def update_quanity(list, item_name, new_quantity)\n\n\tlist[item_name] = new_quantity\n\tp list\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend",
"def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update_quantity(list, item_name, qty)\n list[item_name] = qty\nend",
"def update_quantity(new_list, item_name, quantity)\r\n \r\n new_list[item_name] = quantity\r\nend",
"def update_qty(list_hash, item, qty)\r\n \tlist_hash[item] = qty\r\n \tlist_hash\r\nend",
"def update_quan(list, item, quantity)\n list[item] = quantity\nend",
"def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def update_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def update_quantity_of_items(list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend",
"def update_item_quantity(hash_of_items, item, quantity)\n hash_of_items[item] = quantity\n hash_of_items\nend",
"def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def update_quantity(grocery,item_name,new_quantity)\n # input:list, item name, and new_quantity\n # steps: change old value of item_name with the new_quantity\n grocery[item_name] = new_quantity\n # output: display the latest list\n display_list(grocery)\nend",
"def update_item_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item_name, quantity)\r\n list[item_name] = quantity\r\nend",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_quantity(groceries_list, item, new_quantity)\n\t# Change value for inputted key to the desired quantity\n\tgroceries_list [item] = new_quantity\n\tgroceries_list\nend",
"def update_quantity(list, item_name, quantity)\n\tlist.each do |item, qty|\n\t\tif item === item_name\n\t\t\tlist[item] = quantity\n\t\tend\n\tend\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item_name, new_quantity)\n list[item_name] = new_quantity\nend",
"def update_quantity(list, item_name, new_quantity)\n list[item_name] = new_quantity\nend",
"def update_quantity(item, list, quantity)\n list[item] = quantity\n return list\nend",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_quantity(thingtochange)\n userinputarray=thingtochange.split(\",\")\n $list_hash.each do|current_item, qty| \n if current_item==userinputarray[0]\n $list_hash[current_item]=userinputarray[1]\n else\n end\n end\nend",
"def update_item(list, item, quantity)\r\n add_item(list, item, quantity)\r\n# input: Shopping list, item to be updated, new quantity\r\n# steps:\r\n # Use shopping list as input\r\n # Use item to be updated as input\r\n # Use new quantity to be updated as input\r\n # Update the quantity of the item on the list\r\n # list[item] = quantity\r\n# output: shopping list with updated quantity\r\n # printlist(list)\r\nend",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def update_quantity_in_grocery_list(grocery_list, item_name, quantity)\n # steps: update quantity for item\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def update_quantity(list, item, quantity)\r\n\tlist[item] = quantity\r\n\treturn list\r\nend",
"def update_quantity(list, item, quantity)\n #method to update quantity\n #can also add items\n list[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\nend",
"def update_qty(shopping_list, item, quantity)\r\n\r\n\tadd_item(shopping_list, item, quantity)\r\n\r\nend",
"def list_update(hash_items, item_name, quantity)\n hash_items[item_name] = quantity\n return hash_items\nend",
"def update_quantity (list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity (list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity.to_i\n list\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update_quantity (quantity, item)\n $list.each do |list_item|\n if list_item[:item] == item\n list_item[:quantity] = quantity\n end\n end\nend",
"def update_item(list, item, new_quantity)\n\tlist[item] = new_quantity\n\tlist\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\nend",
"def change_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def update_quant(current_list, item, quantity)\n current_list[item] = quantity\n current_list\nend",
"def update_quantity(list, item, updated_quantity)\n list[item] = updated_quantity\n list\nend",
"def update(list, item_name, quantity)\n\tlist[item_name] = quantity\nend",
"def update_quantity(hash, item, quantity)\n\thash[item] = quantity\n\treturn hash\nend",
"def item_quantity(list, item_to_update, quantity)\n list[item_to_update] = quantity \nend",
"def update_quantity(list, item, quantity)\nlist[item] = quantity\nlist\nend",
"def update(item,quantity,list)\n\tlist[item] = quantity\nend",
"def update_item (list,item,quantity)\n\tlist[item] = quantity\nend",
"def update_quantity(name, quantity, list)\n list[name] += quantity\nend",
"def update_quantity(list, item_name, quantity)\n # steps:\n # check IF item is included in list\n # update the item’s quantity\n # ELSE, print a message to the user\n list.include?(item_name) ? list[item_name] = quantity : puts(\"No #{item_name} on the list.\")\n\n # output: return the updated hash or the original hash\n list\nend",
"def update_qty(list_items, item_name, new_qty)\n raise ArguementError.new(\"This item does not exist\") unless list_items.include?(item_name)\n list_items[item_name] = item_qty\nend",
"def change_quantity(list, item, new_qty)\n list[item] = new_qty\nend",
"def update_quantity(item_name, grocery_list, quantity)\n grocery_list[item_name] = quantity\n grocery_list\n end",
"def update_quantity(list, key_name, quantity=1)\r\n\tlist[key_name] = quantity\r\n\treturn list\r\nend",
"def update_quantity (item,list, quantity)\n list[item] = quantity\nlist\nend",
"def update_quantity(shopping_list, item, quantity)\n shopping_list[item] = quantity\nend",
"def update_item(item, quantity, list)\n\tlist.each do |i, q|\n\t\tif list.has_key?(item)\n\t\t\tlist[item] = quantity\n\t\telse \n\t\t\tputs \"List does not contain that item.\"\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def update_qty(list, item, qty)\n if list.has_key?(item)\n list[item] = qty\n end\n return list.each {|k,v| puts \"#{k}: #{v}\"}\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def update (list, item, quantity)\n\tlist[item] = quantity\nend",
"def update_quantity(grocery_list, item_to_update, qty)\n grocery_list[item_to_update] = qty\n grocery_list\nend",
"def update_item(list, item, quantity)\n\tlist[item] = quantity\n\treturn list\nend",
"def update_quantity(item, new_quantity, list)\r\n list[item] = new_quantity\r\n p list\r\n list\r\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_quantity (item, quantity)\n item_hash[item] = quantity\nend",
"def update_quantity(input_hash, item, qty)\n# steps: use input item as key and input quantity as value\n# output: hash \n input_hash[item] = qty\n \nreturn input_hash\nend",
"def update_quantity(list, key, quantity)\n list[\"#{key}\"] = quantity\n list\nend",
"def update_item(list, name, change_in_quantity)\n normalize_string(name)\n if (list[name] + change_in_quantity <= 0)\n remove_item(list, name)\n else\n list[name] += change_in_quantity\n return list\n end\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\nend",
"def update_item_quantity(list_hash,item_name,quantity)\n if list_hash[item_name]\n puts \"Updated the quantity of #{item_name} to: #{quantity}.\"\n list_hash[item_name] = quantity\n else\n puts \"Item does not exist.\"\n end\n\n list_hash\nend",
"def update_list(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n list\r\nend",
"def update_quantity(grocery_list, item, quantity)\r\n\tgrocery_list[item] = quantity\r\n\tgrocery_list\r\nend",
"def update(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_item(list_name, item_name, quantity)\r\n list_name[item_name] = quantity if list_name.has_key?(item_name)\r\nend",
"def update_quantity(list,item,quantity)\nlist[item]= quantity\n p list\nend",
"def update_quantity(list_item,quantity,user_list)\n user_list[list_item] = quantity\n user_list\nend",
"def new_quantity(list, item, qty)\n list[item] += qty\n p list\nend",
"def input (list, item, quantity)\n\tlist[item] = quantity\nend",
"def update_item_quantity(current_list)\r\n puts \"Enter item to update: \"\r\n item_to_update = gets.chomp\r\n \r\n puts \"Enter a new quantity: \"\r\n new_item_qty = gets.chomp\r\n new_item_qty = new_item_qty.to_i\r\n \r\n if current_list.has_key?(item_to_update)\r\n current_list[item_to_update] = new_item_qty\r\n end\r\n \r\n current_list\r\nend",
"def update_list(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list\n\nend",
"def update_quantity(grocery_list, item, quantity)\n grocery_list[item] = quantity.to_i \n grocery_list\nend",
"def update_quantity(hash, item, quantity)\n hash[item] = quantity\nend",
"def update_quantity(item, quantity, hash)\n hash[item] = quantity\n return hash\nend",
"def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as key and quantity as value to final_list hash(item and quantity will be user inputs)\n list[add_item] = add_quantity\n # Return updated hash\n list\nend",
"def update_item(item, list, quantity)\n if list.has_key?(item)\n list[item] = quantity\n return list\n else\n return list\n end\nend",
"def update_quantity(hash, item_name, quantity)\r\n hash[item_name] = quantity\r\n hash\r\nend",
"def update_item_quantity(hash, item, quantity)\n hash[item] = quantity\n hash\nend",
"def update_quan(older_list, item, quantity)\r\n older_list[item] = quantity\r\n return older_list \r\nend",
"def update_qty(grocery_list, item, qty)\n grocery_list[item] = qty\n grocery_list\nend"
] | [
"0.82924277",
"0.8264403",
"0.8118773",
"0.80738354",
"0.8057201",
"0.80567276",
"0.80567276",
"0.79823816",
"0.79579365",
"0.79312485",
"0.79053307",
"0.7901778",
"0.7888846",
"0.78810966",
"0.785935",
"0.78493524",
"0.7837322",
"0.7822981",
"0.78197706",
"0.7810973",
"0.7804266",
"0.77966326",
"0.77937055",
"0.7793639",
"0.7761998",
"0.77615905",
"0.77532977",
"0.77532977",
"0.77487266",
"0.77487266",
"0.77407855",
"0.7739675",
"0.7701937",
"0.76981413",
"0.76895076",
"0.7681803",
"0.7667535",
"0.76667184",
"0.7661381",
"0.7659179",
"0.7648167",
"0.76454276",
"0.7641297",
"0.7641297",
"0.7641016",
"0.76273453",
"0.7623622",
"0.76216376",
"0.76152396",
"0.7611962",
"0.7610125",
"0.75910115",
"0.7582329",
"0.75804555",
"0.7571572",
"0.7567705",
"0.75604665",
"0.7553106",
"0.75520754",
"0.7551474",
"0.75512123",
"0.75506175",
"0.7550559",
"0.7550217",
"0.75459325",
"0.7537473",
"0.75354815",
"0.7526857",
"0.7519361",
"0.75089175",
"0.7506944",
"0.74814177",
"0.7479349",
"0.747528",
"0.747528",
"0.7474313",
"0.7466311",
"0.74575824",
"0.74556553",
"0.74498415",
"0.74486446",
"0.74348336",
"0.7419344",
"0.74175346",
"0.74168676",
"0.73975754",
"0.7394201",
"0.73940694",
"0.73885316",
"0.73866516",
"0.73823243",
"0.736954",
"0.73680264",
"0.7367499",
"0.73672587",
"0.7366793",
"0.73645246",
"0.7363351",
"0.7354135",
"0.73458785"
] | 0.7675452 | 36 |
Method to print a list and make it look pretty input: the list name steps: iterate through the list with a puts statement and interpelation output: a series of strings expressing what is contained in the list | def print_list(list)
list.each do |item,count|
puts "#{item}: #{count}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend",
"def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend",
"def pretty_list(list)\r\n\tlist.each { |item, quantity| puts \"Item: #{item.capitalize} - Amount: #{quantity}\" }\r\nend",
"def pretty_list(list)\n list.each{|food, quantity| puts \"Please get #{quantity} #{food}.\"}\n puts \"Thanks!\"\nend",
"def pretty_print(list)\n list.each {|item, quantity| puts \"#{item} : #{quantity}\"}\nend",
"def print_pretty(list)\n list.each { |item, value| puts \"#{item} #{value}\" }\nend",
"def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend",
"def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend",
"def pretty_list(list)\n list.each {|item, quantity| puts \"You need #{quantity} #{item}\"}\nend",
"def prettify_list(list)\n\tlist.each do |item, quantity|\n\t\tp \"You have #{quantity} #{item}\"\n\tend\nend",
"def prettify(list)\r\n\r\n list.each do |item, quantity|\r\n puts \"There are #{quantity} #{item} in the list.\"\r\n end\r\n\r\nend",
"def list_formatter(list)\n\tlist.each do |item, quanity|\n\t\tputs \"we need #{quanity} of #{item}\"\n\tend\nend",
"def pretty_list(list_name)\r\n list_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\n end\r\nend",
"def pretty(list)\n list.each {|item, quantity| p \"You need to buy #{quantity} of #{item}.\"}\nend",
"def pretty_list(list)\n # new_list = \"\"\n # list.each { |item, quantity| new_list << \"You want #{quantity} #{item}\\n\" }\n # return new_list\n list.each { |item, quantity| puts \"You want #{quantity} #{item}\\n\" }\nend",
"def print_list(list)\r\n# input: completed list\r\n# steps:\r\n # iterate over list and print formatted list\r\n puts \"Your Grocery List\"\r\n list.each do |item, quantity|\r\n puts \"#{item}, qty: #{quantity}\"\r\n end\r\n # format: each item with its own line\r\n # \"item - quantity\"\r\n# output: implicit return of list\r\nend",
"def pretty_list(list)\n list.each do |grocery_item, qty|\n puts \"#{grocery_item}, quantity: #{qty}\"\n end\nend",
"def print_list; end",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item.capitalize}: #{quantity}\"\n\tend\nend",
"def print_pretty (list_name, list)\n p list_name.upcase.center (100)\n list.each do |x,y|\n p \"#{x.rjust(50)} : #{y.to_s.ljust(50)} \"\n end\nend",
"def print_list(list_name)\r\n# input: hash name\r\n# steps: add dashes and spacing\r\np \"List:\"\r\nlist_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\nend\r\n# output: pretty hash listed\r\nend",
"def print_list(list)\n\tlist.each do |iterator|\n\tputs \"#{iterator[:item].split.map(&:capitalize).join(' ')} - QTY #{iterator[:qty]}\"\n\tend\n\nend",
"def pretty_list(list)\n puts \"Grocery List:\"\n list.each do |key, value|\n puts \"#{value} #{key}(s)\"\n end\n \nend",
"def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend",
"def print(list)\n list.each do |item|\n puts \"*#{item}\"\n end\nend",
"def print_list(list)\n\tlist.each do |x,y|\n\t\tputs x + \": \" + y.to_s\n\tend\nend",
"def print_list(list)\n\tlist.each do |x,y|\n\t\tputs x + \": \" + y.to_s\n\tend\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_list(grocery_list)\r\n puts \"Your Grocery List for next week!\"\r\n grocery_list.each do |item, num|\r\n puts \"#{item} qty #{num}\"\r\n end\r\n \r\nend",
"def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end",
"def pretty_up(list)\n puts \"\\nHere is your grocery list: \"\n list.each do |key, value|\n puts value.to_s + ' ' + key.to_s\n end\nend",
"def print(list)\n\tputs list\nend",
"def print_list(list)\r\n puts \"-\"*20\r\n list.each do |item,quantity|\r\n puts \"Item:#{item} quantity:#{quantity}\"\r\n end\r\n puts \"-\"*20\r\n list\r\nend",
"def print_pretty (list)\n puts \"Grocery list\".upcase.center(50)\n puts \"-----------------\".center(50)\n list.each do |item,quantity|\n puts item.rjust(25) + \":\" + quantity.to_s.ljust(25) \n end\nend",
"def print_list(title,list)\n# steps:\n # print title of list (will ask user for this input)\n puts \"**********************\"\n puts \" #{title.upcase}:\"\n puts \"**********************\"\n # print headers of item and quantity\n puts \" # ITEM\"\n puts \"----------------------\"\n # print each item and it's quantity, bulleted if possible\n list.each {|item,quantity| puts \" #{quantity} #{item}\"}\n puts \"**********************\"\n # print today's date\n date = Time.new\n puts \" Made on: #{date.month}/#{date.day}/#{date.year}\"\nend",
"def print_list(list)\n\tlist.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\t\t\n\tend\nend",
"def print_list (list)\n list.each do |item|\n puts \"* \" + item\n end\nend",
"def print_pretty(new_list)\n puts \"Grocery List:\"\n new_list.each do |item, amount|\n \n puts \"#{item}: #{amount}\"\n end\nend",
"def print_list(list)\n\tlist.each do |item, qty|\n\t\tputs \"#{item} = #{qty}\"\n\tend\nend",
"def print_list(list)\n\tlist.each do |item,quantity|\n\t\tp \"#{quantity} #{item}\"\n\tend\nend",
"def print_list(list)\r\n # steps:\r\n # use each method to print the following: \"You have #{quantity} #{item_name}\"\r\n list.each do |name, quantity|\r\n puts \"You have #{quantity} of #{name}!\"\r\n end\r\n # output: -no output-\r\nend",
"def print_pretty(grocery_list)\r\n\tgrocery_list.each do |item, quantity| \r\n\t\tputs \"you bought #{quantity} #{item}\"\r\n\tend\r\nend",
"def pretty_list(grocery_list)\n puts \"Shopping List\"\n grocery_list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\n puts \"Happy Shopping!\"\nend",
"def print(list)\n# steps: \n\t# make a new string\n\tstring = \"This is the shopping list: \\n\"\n\t# iterate through the list\n\tlist.each do |item, quantity|\n\t\t# add the items and quantities to the string and end with a newline\n\t\tstring = string + \"#{item}: #{quantity} \\n\"\n\tend\n# output: the string\n\tputs string\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}, amount: #{quantity}\"\n\tend\nend",
"def pretty_list(list)\r\n\tputs \"Grocery List\".center(30)\r\n\tlist.each do |item, quantity|\r\n\t\tputs \"#{item} \".ljust(20) + \"#{quantity}\".rjust(10)\r\n\tend\r\nend",
"def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend",
"def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend",
"def pretty_list(groceries_list)\n\t# Print a line of text to lead into the list\n\tputs \"Here is your updated grocery list:\"\n\t# for each key and value in the list, print a string \n\t# containing the key and value\n\tgroceries_list.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def listing(list)\n list.each {|item|puts \"* #{item}\"}\n print \"\\n\"\nend",
"def print_friendly_list(list)\n puts \n puts \"Shopping List:\"\n puts \"----------------\"\n list.each {|key, value| puts \"#{key} #{value}\" }\n puts \nend",
"def print_out(list)\n\tlist.each {|item, qty| puts \"#{item}; #{qty}\"}\nend",
"def print(list)\n list.each do |food, qty|\n puts \"#{food} with qty: #{qty}\"\n end\nend",
"def print\n placeholder = @head\n list = \"\"\n while placeholder.next\n list += placeholder.data + \"\\n\"\n placeholder = placeholder.next\n end\n list += placeholder.data + \"\\n\" # the plus \"\\n\" added because of the way the spec is written.\n printf list\n end",
"def lister(list)\n\tlist.each do |item|\n\t\tputs \"* #{item}\"\n\tend\nend",
"def print_list(list)\n\tputs \"This is what you need to buy:\"\n\tputs \"--------------------\"\n\tlist.each do |item, quantity|\n\t\tputs \" #{item} : #{quantity}\"\n\tend\n\tputs \"--------------------\"\nend",
"def print_list(list)\n\tlist.each {|food,quantity| puts \"You need to get #{quantity} of #{food}\"}\nend",
"def print_list(list)\n list.each do |name, quantity|\n puts \"#{name} : #{quantity}\"\n end\nend",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list(list)\r\n puts \"_-\" *25 + \"\\n\\n\"\r\n puts \"Here is your Grocery List: \\n\\n\"\r\n list.each do |item, quantity|\r\n puts \"\\tItem: #{item} \\tAmount: #{quantity}\"\r\n end\r\n puts \"_-\" *25\r\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"We need #{quantity} #{item}\"\n\tend\nend",
"def print_list(list)\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\nend",
"def print(list)\r\n\tlist.each do |grocery, q|\r\n\t\tputs \"There are #{q} #{grocery} on your list.\"\r\n\tend\r\nend",
"def print_list(list)\n puts \"List: #{list['name']}\"\n print_separator\n\n list[\"items\"].each do |item|\n puts \"\\tItem: \" + item['name'] + \"\\t\\t\\t\" +\n \"quantity: \" + item['quantity'].to_s\n end\n\n print_separator\nend",
"def printlist(list) \n\tputs \"Today's Grocery List is:\"\n\tlist.map { |item| puts \"* #{item}\"}\n\t\nend",
"def print_list (list)\n puts \" \"\n puts \"On your list!\"\n list.each do | food, quantity|\n puts \"You need to buy #{quantity}: #{food}\"\n puts\"-----------------------------\"\n end\nend",
"def print_list(list)\n# input:list\n# steps: iterate through the list\n list.each do |item, number|\n puts \"we have #{number} #{item}\"\n end\n puts \"in our grocery list\"\nend",
"def grocery_printer(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\n\tend \nend",
"def print_list(list)\r\n puts \"Here is your current list: \"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end\r\nend",
"def print_list(list)\r\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\r\nend",
"def beautify_list(list)\n puts \"Grocery List\"\n puts \" Item: Quantity\"\n list.each do |list_item, item_quantity|\n puts \" #{list_item} : #{item_quantity}\"\n end\nend",
"def printlist(list)\r\n# input: shopping list\r\n# steps:\r\nlist.each {|item, quantity| puts \"Please buy #{quantity} #{item}\"}\r\n # Print each item on the shopping list in a readable fashion\r\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list!!\"\n\tend\nend",
"def print_list(my_list)\r\n# input: \r\n \r\n# steps:\r\n# print to screen: iterate through hash item - quantity\r\n puts '------'\r\n puts \"Grocery list:\"\r\n my_list.each do |item, qty|\r\n puts \"#{item} - #{qty}\"\r\n end\r\n puts '-------'\r\n# output: each k,v pair printed surrounded by dashes\r\nend",
"def print_list(list)\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_list(list)\r\n\r\n\tputs 'Shopping List'\r\n\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\n\t\r\n\tputs \"\"\r\n\r\nend",
"def print_list(input_list)\n input_list.each {|item,quantity|\n puts \"#{item} :#{quantity}\"\n }\nend",
"def print_list(list)\n list.each do |item, quantity|\n p \"#{item}: #{quantity}\"\n end\nend",
"def nice_print(grocery_list)\n\tgrocery_list.each { |food, quantity| puts \"We need #{quantity}, of #{food}.\"}\nend",
"def print_list(list)\n puts \"This week's grocery list:\"\n list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\nend",
"def print_list(list)\n\t# input: list\n\t# output: none\n\n\t# print header\n\tputs \"Grocery List\\n------------\"\n\t# iterate over list\n\tfor item, qty in list do\n\t\t# print each item to screen ex: \" - Lemonade, 2 liters\"\n\t\tputs \" - #{item}, #{qty}\"\n\tend\n\nend",
"def printout (list)\n\tlist.each { |item, quantity| puts \"#{item} is #{quantity} \" } \nend",
"def print_list(list)\n puts \"Shopping List\"\n list.each { |item, quantity| puts \"You need #{quantity} #{item}(s).\" }\nend",
"def print_list(list)\n\tmax_index = list.length;\n\ti=1\n\twhile i<=max_index\n\tprint \"#{i}. #{hash_to_string(list[i-1])}\".center(get_winsize)\n\tprint \"\\n\"\n\ti +=1\n\tend\nend",
"def print_list(list)\n list.each {|item,quantity| puts \"#{item}: #{quantity}\"}\nend",
"def print_list(list)\n puts \"Name \\t\\t Quantity\"\n list.each do |key, value|\n puts \"#{key} \\t\\t #{value}\"\n end\nend",
"def print_list(list)\n list.each do |item, quant| \n puts \"Item: #{item}, Quantity: #{quant}\"\n end\nend",
"def print_list(list)\n list.each do |item, quantity|\n puts \"#{item} x #{quantity}\"\n end\nend",
"def print_out(list)\n list.each { |a,b| puts \"#{a} : #{b}\" }\nend",
"def print_list(list)\n puts \"Here's your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_list\n $list.each {|list_item| puts \"#{list_item[:quantity]} #{list_item[:item]}\"}\nend",
"def display (list)\n\tputs list\nend"
] | [
"0.81935126",
"0.79859966",
"0.79217684",
"0.7825385",
"0.7808363",
"0.772888",
"0.77274865",
"0.76622444",
"0.7649025",
"0.7649025",
"0.7645689",
"0.7641062",
"0.7585162",
"0.75796205",
"0.7570455",
"0.7515595",
"0.7509122",
"0.74346054",
"0.7405648",
"0.73806477",
"0.7373801",
"0.73726064",
"0.7365641",
"0.73587537",
"0.7349437",
"0.73301053",
"0.731264",
"0.7288719",
"0.7288719",
"0.72753006",
"0.72753006",
"0.72753006",
"0.72753006",
"0.7260098",
"0.7246239",
"0.7246239",
"0.724247",
"0.7210564",
"0.7191316",
"0.71722996",
"0.71660256",
"0.7162157",
"0.71507335",
"0.7148167",
"0.71448517",
"0.71373266",
"0.71185076",
"0.7111635",
"0.71070695",
"0.71015054",
"0.70862776",
"0.7084258",
"0.70809084",
"0.7078186",
"0.7078186",
"0.70750314",
"0.70718414",
"0.7069873",
"0.70546424",
"0.70422655",
"0.70419145",
"0.7037368",
"0.7026389",
"0.70194024",
"0.70144594",
"0.701201",
"0.701201",
"0.70059955",
"0.7005378",
"0.69937426",
"0.6989773",
"0.69697046",
"0.69477093",
"0.6928276",
"0.6927989",
"0.6922046",
"0.6915457",
"0.6898777",
"0.686361",
"0.68397224",
"0.6837992",
"0.68322134",
"0.6831195",
"0.6827386",
"0.6820285",
"0.6812159",
"0.6809085",
"0.68079215",
"0.680777",
"0.68065035",
"0.6797042",
"0.67891717",
"0.6786991",
"0.67760575",
"0.6767174",
"0.6763155",
"0.67323416",
"0.6723757",
"0.67119753",
"0.6711549"
] | 0.7038516 | 61 |
def artist_is_current_artist unless current_artist.friendly_id == params[:artist_id] flash[:notice] = "You may only edit your own content." redirect_to artist_albums_path end end | def album_params
params.require(:album).permit(:id, :artist_id, :project_id, :album_id, :title, :release_date, :cover_art, :remove_cover_art, :genre, :genre_list, :tag_list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_artist\n unless logged_in? && (current_user.artist? || current_user.administrator?)\n flash[:warning] = \"Only artists can access the #{controller_name} controller\"\n redirect_to controller: \"home\", action: \"index\"\n end\n end",
"def valid_artist_name?\n\t\t\tif params[:artist].empty?\n\t\t\t\tflash[:danger] = \"Please enter an artist name\"\n\t\t\t\tredirect_to search_artist_path\n\t\t\tend\n\t\tend",
"def artist?\n end",
"def show\n @artist = Artist.find(params[:id])\n unless @artist.belongs_to_this_brand?(website)\n redirect_to artists_path and return\n end\n if @artist.featured || @artist.artist_tier.show_on_artist_page?\n respond_to do |format|\n format.html { render_template } # show.html.erb\n # format.xml { render xml: @artist }\n end\n else\n redirect_to all_artists_path(letter: @artist.name.match(/\\w/).to_s.downcase) and return false\n end\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n end",
"def set_artist\n @artist = Artist.friendly.find(params[:id])\n end",
"def set_artist\n\n\tartist = Artist.find_by_artist_name(self.artist_name)\n\t if artist != nil \n\t\t self.artist_name = artist\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'artist_name' is invalid- it must be unique\")\n\t\t return false\n\tend\nend",
"def set_artist\n @artist = Artist.friendly.find(params[:id])\n end",
"def edit \n if @article.user != current_user\n flash[:danger] = \"You can only edit your own article.\"\n redirect_to root_path\n end\n end",
"def logged_in? # obj - nil\n\t\tcurrent_artist\n\tend",
"def valid_selection?\n\t\t\tif !params[:selected_artist] \n\t\t\t\tflash[:danger] = \"Please select an artist\"\n\t\t\t\tredirect_to search_path(params)\n\t\t\tend\n\t\tend",
"def verify_user\n\t \t@music_inspired = MusicInspired.find(params[:id])\n\t \tcurrent_user.id == @music_inspired.user_id ? @music_inspired : redirect_to(root_url)\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin\n flash[:alert] = \"You can only edit/delete from your own article listings\"\n redirect_to @article\n end\n end",
"def is_listing_owner?\n if session[:listing_id] != params[:id].to_i\n flash[:error] = \"You cannot edit a listing you did not create\"\n custom_redirect_back\n end\n end",
"def require_same_organizer\n if current_organizer != @event.organizer and !current_organizer.admin?\n flash[:danger] = \"You can only edit or delete your own events\"\n redirect_to root_path\n end \n end",
"def is_hem\n if current_user.id == Order.find(params[:id]).user_id\n\n else\n redirect_to home_path\n end\n end",
"def validate_owner\n unless @article.owner == current_user\n redirect_to root_path, notice: 'You do not have edit access to the article!'\n end\n end",
"def set_artist\n @artist = Artist.find(params[:id] || params[:artist_id])\n end",
"def edit\n @song = Song.find(params[:id])\n if @song.private? && @song.editable_by?(current_user)\n load_user_stuff\n current_user.enter_multitrack!\n render :action => 'index'\n elsif @song.public?\n @remix = @song.create_remix_by(current_user)\n redirect_to multitrack_edit_path(@remix)\n else\n redirect_to '/'\n end\n\n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'Song not found..'\n redirect_to '/'\n end",
"def owner?(owner_id)\n return true if current_user && current_user.id.to_i == owner_id.to_i\n\n flash[:info] = 'You are not authorised to view that page.'\n redirect '/app'\n false\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin\n flash[:alert] = \"You can only edit or delete your own article\"\n redirect_to @article\n end\n end",
"def correct_author\n @author = Author.find(params[:id])\n redirect_to(root_url) unless current_author?(@author)\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin?\n flash[:alert] = \"You can only edit or delete your own article\"\n redirect_to @article\n end\n end",
"def current_artist\n\t\tif (artist_id = session[:artist_id])\n\t\t\t@current_artist ||= Artist.find_by(id: artist_id)\n\t\telsif (artist_id = cookies.signed[:artist_id])\n\t\t\tartist = Artist.find_by(id: artist_id)\n\t\t\tif artist && artist.authenticated?(cookies[:remember_token])\n\t\t\t\tlog_in artist\n\t\t\t\t@current_artist = artist\n\t\t\tend\n\t\tend\n\tend",
"def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end",
"def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end",
"def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end",
"def songs_filter\n\t\treturn unless self.controller_name == \"songs\"\n\t\tif !current_user.is_admin\n\t\t\tflash[:notice] = \"Sorry, you can't visit this page unless you're an administrator.\"\n\t\t\tredirect_to user_home_path(current_user)\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to [:admin, @artist], notice: 'Artist was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def show\n @artist = current_user.artists.find(params[:id])\n raise \"not found\" if @artist.blank?\n @albums = @artist.albums.all\n rescue\n redirect_to artists_url, :notice => \"Can't find this artist.\"\n end",
"def owner\n redirect_to shelters_path, notice: 'Woah there! Only owners can edit shelters.' unless current_user.owner || current_user.admin\n end",
"def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end",
"def correct_account\n @album = Album.find(params[:album_id])\n if current_account.fullname != @album.creator\n \tredirect_to(new_album_photo_path(@album))\n \tflash[:notice] = \"You can not add photo to this album.\"\n end\n \tend",
"def current_artist\n if (artist_id = session[:artist_id])\n @current_artist ||= Artist.find_by(id: artist_id)\n elsif (artist_id = cookies.signed[:artist_id])\n artist = Artist.find_by(id: artist_id)\n if artist && artist.authenticated?(:remember, cookies[:remember_token])\n log_in artist\n @current_artist = artist\n end\n end\n end",
"def correct_user\n @article = Article.find(params[:id])\n redirect_to root_url, flash: { error: 'Article can be edited/viewed/deleted by their own user!!'} unless @article.user.id == current_user.id\n end",
"def require_same_user\n # if the user is on another user's edit or update page\n if current_user != @user and !current_user.admin?\n # flash message\n flash[:danger] = \"Access denied.\"\n # and redirect to articles listing\n redirect_to articles_path\n end\n end",
"def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end",
"def check_user_recorded_show\n show = Show.find(params[:id])\n if !current_user.user_has_show(show)\n flash[:notice] = \"You can only modify information for shows that you have recorded.\"\n redirect_to show_path(show)\n end\n end",
"def must_be_current_student\n # Need to match current user to current student id\n unless current_user.id == params[:id]\n redirect_to root_path, notice: \"This is not you!\"\n end\n end",
"def set_artist\n @artist = Artist.find(artist_params[:id])\n end",
"def owner?\n return if current_user == @event.creator\n\n redirect_back(fallback_location: root_path, alert: 'Unauthorized request!')\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def update\n @stay_in = \"Chỉnh Sửa Nghệ Sĩ\"\n @admin_artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @admin_artist.update_attributes(params[:artist])\n format.html { redirect_to admin_artist_path(@admin_artist), notice: 'Sửa nghệ sĩ thành công.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n current_email = current_user.email\n if !current_user.admin? && current_email.gsub(\".\",\"-dot-\") != params[:id]\n flash.keep[:notice] = 'You must be an administrator to access that feature.'\n redirect_to '/'\n end\n super\n end",
"def require_same_user\n if current_user != @article.user and !current_user.admin?\n flash[:danger] = \"You can only update your own articles!\"\n redirect_to root_path\n end\n end",
"def item_owner?\n unless user_signed_in? && !current_user.items.find_by(id: params[:id]).nil?\n flash.alert = \"You are not authorized to access that!\"\n redirect_to root_path\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to organization_artist_url(organization_id: @organization.id, id: @artist.id), notice: 'Artist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin?\n flash[:danger] = \"You do not own this article and thus cannot edit nor delete it\"\n redirect_to root_path\n end\n end",
"def update\n\n artist_id = update_artist_exist_or_new(params[:artist_name])\n\n album_id = update_album_exist_or_new(params[:album_name], params[:genre], artist_id)\n\n respond_to do |format|\n\n @song.album_id = album_id\n a = @song.album\n a.artist_id = artist_id\n a.save\n\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_artist\n\t\t@artist = Artist.find(params[:id])\n\tend",
"def show\n if @playlist.public or (user_signed_in? and (@playlist.user == current_user or are_friends(current_user, @playlist.user) or current_user.admin))\n @isPlayer = true\n else\n redirect_to new_user_session_path\n end\n end",
"def set_bookmark_check_owner\n @bookmark = Bookmark.find(params[:id])\n\n if @bookmark.user != current_user\n respond_to do |format|\n\n format.html { redirect_to root_url, alert: \"You dont have permissions for this action\"}\n\n end\n end\n end",
"def add_another_artist?\n @prompt.yes?(\"Would you like to add another artist?\")\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: t(:update_notice) }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def require_permission\n if current_podcast != Podcast.find(params[:podcast_id])\n redirect_to root_path, notice: \"Sorry You are not allowed to view that page\"\n end\nend",
"def require_correct_petsitter\n\n\t # because this controller inherits/subclasses from app controller and i have in app controller defined current_petsitter means i can use that method here( 3 CHEERS FOR INHERITANCE!!!!!!! )\n\n\t @petsitter = Petsitter.find( params[:id] )\n\n\t unless current_petsitter == @petsitter\n\n\t # rememeber we can't redirect to sign in page because they bypassed the first gate which means they are signed in so no need to give them sign in page - also we don't warn them because it means they knew what they were doing - TRYING TO BREAK INTO S/ONE ELSE'S ACCOUNT AND CHANGE STUFF\n\t redirect_to root_path\n\t end\n\n\t \n\t end",
"def check_non_author\n book = Book.find(params[:id])\n if book.user_id != current_user.id\n redirect_to books_path, alert: \"You are not main author of this book. Access denied\"\n end\n end",
"def current_user\n User.find_by({ id: session[:user_id] }) || Artist.find_by({ id: session[:artist_id] })\n end",
"def show\n authorize Song\n end",
"def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end",
"def set_art\n@user = current_user\n@art = Art.find(params[:id])\nend",
"def check_owner\n if current_user != Checklist.find(params[:format]).user\n flash[:notice] = \"Trying to be cheeky are we? You cannot modify a task that's not yours!\"\n redirect_to '/'\n end\n end",
"def include?(p_artist)\n\n\t\t\t# Check parameter\n\t\t\treturn unless p_artist.is_a? Artist\n\t\t\t\n\t\t\t# Return result\n\t\t\t@artists.include?(p_artist)\n end",
"def show?\n @user && (can_update_seminar? || @record.holder_id == @user.id || @user.authorization.can_read?(@record.seminar.organization_id))\n end",
"def owner_or_admin\n listing = SellerListing.find(params[:id])\n\n unless user_signed_in? && (current_user.id == listing.user_id || current_user.admin?)\n if !user_signed_in?\n Rails.logger.warn(\"User tried to access page without being signed in\")\n elsif current_user.id != listing.user_id\n Rails.logger.warn(\"#{current_user.to_s} tried to access a page that belongs to #{listing.user.to_s}\")\n elsif !current_user.admin?\n Rails.logger.warn(\"#{current_user.to_s} needs to be an admin to access this page\")\n end\n\n flash[:error] = 'Sorry, but you are not permitted to view that page.'\n redirect_to new_home_offer_path\n end\n end",
"def artist_name\n artist ? artist.name : ''\n end",
"def show\n #redirect_to '/', alert: \"Course belongs to different teacher.\" unless @course.teacher == current_teacher\n end",
"def require_extraction_form_ownership\n \t\textraction_form_id = params[:extraction_form_id]\n \t\textraction_form = ExtractionForm.find(extraction_form_id, :select=>[\"creator_id\"])\n \t\tunless extraction_form.creator_id == current_user.id\n \t\t\tflash[:notice] = \"You do not have ownership of the extraction form, and therefore cannot make edits.\"\n \t\t\tredirect_to \"/extraction_forms/#{extraction_form_id.to_s}\"\n \t\t\treturn false\n \t\tend\n \tend",
"def require_same_user\n if current_user.id != @art_plan.user_id\n flash[:danger] = \"You can only edit or delete your own art project plan\"\n redirect_to art_plans_path\n end\n end",
"def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end",
"def require_owner\n @course = Course.find_by_id(params[:id])\n if (!@course || @course.user != current_user)\n redirect_to :root, notice: 'Not yours. Pas touche.' \n end\n end",
"def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end",
"def require_permission\n if current_user.id != @squad.owner_id\n redirect_to api_squads_path, notice: 'You must be owner of a squad to do that action.'\n end\n end",
"def identification_required?\n !(controller_name == \"championships\" && action_name == \"show\")\n end",
"def cookbook_owner?\n if current_cookbook && current_user.id != current_cookbook.owner.id\n redirect_to sections_path, alert: \"As a Contributor you may only access the \\\"Recipes\\\" and \\\"Preview\\\" pages for the cookbook.\"\n end\n end",
"def edit_quiz\n @questionnaire = Questionnaire.find(params[:id])\n if !@questionnaire.taken_by_anyone?\n render :edit\n else\n flash[:error] = \"Your quiz has been taken by some other students, editing cannot be done any more.\"\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]\n end\n end",
"def display_artist(song)\n if song.artist.nil?\n link_to('Add Artist', edit_song_path(song)) \n else\n link_to(song.artist.name, artist_path(song.artist))\n end\n end",
"def playing?\n redirect_to matche_url(@match), alert: I18n.t(:alert, scope: 'custom.controller.comment.playing') unless playing_user?(@match, current_user)\n end",
"def set_artist\n @artist = Artist.find_by(id: params[:id])\n end",
"def set_user_artist\n @user_artist = UserArtist.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n\n format.json { render :show, status: :ok, location: @artist }\n\n else\n\n format.html { render :edit }\n\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def update\n @artist = Artist.find_by(id: params[\"id\"])\n @artist.name = params[\"name\"]\n @artist.save\n\n if @artist.errors.any?\n flash[:error] = \"Artist was not updated.\"\n redirect_to \"/artists/#{@artist.id}/edit\"\n else\n flash[:success] = \"#{@artist.name} was successfully updated.\"\n redirect_to \"/artists\"\n end\n\n end",
"def set_artist\n @artist = Artist.find(params[:id])\n end",
"def checkUnspeakableArtist(artist)\n artist.strip!.downcase!\n case artist\n when \"full beat\"\n log \"Changed '#{artist}' into Volbeat\"\n return \"volbeat\"\n when \"a full beat\"\n log \"Changed '#{artist}' into Volbeat\"\n return \"volbeat\"\n when \"the full beats\"\n log \"Changed '#{artist}' into Volbeat\"\n return \"volbeat\"\n when \"soul fly\"\n log \"Changed '#{artist}' into Soulfly\"\n return \"soulfly\"\n when \"so fly\"\n log \"Changed '#{artist}' into Soulfly\"\n return \"soulfly\"\n else\n log \"Changed nothing for '#{artist}'\"\n return artist\n end\n end",
"def correct_producer\n redirect_to(root_url) unless current_user?(@producer)\n end",
"def owned_entry \n unless current_user == @entry.user\n flash[:alert] = \"That entry doesn't belong to you!\"\n redirect_to root_path\n end\n end"
] | [
"0.7847011",
"0.67857",
"0.67736536",
"0.66327095",
"0.6418005",
"0.639104",
"0.6390477",
"0.6369089",
"0.629358",
"0.6285507",
"0.6281747",
"0.62524927",
"0.6245714",
"0.6233448",
"0.61937875",
"0.6088319",
"0.6084119",
"0.60833615",
"0.6070932",
"0.60606337",
"0.605855",
"0.6054333",
"0.6040735",
"0.6019427",
"0.6018764",
"0.6001965",
"0.6001965",
"0.6001965",
"0.6001864",
"0.6000278",
"0.5986306",
"0.5982033",
"0.5975987",
"0.595091",
"0.5946232",
"0.5931465",
"0.592488",
"0.5913841",
"0.59090424",
"0.59041816",
"0.58993185",
"0.5893029",
"0.5892493",
"0.5892493",
"0.588999",
"0.5886074",
"0.5883906",
"0.58828956",
"0.58796126",
"0.58771795",
"0.58752143",
"0.58717227",
"0.5856887",
"0.5842664",
"0.5841909",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.5841828",
"0.58408374",
"0.5831805",
"0.5827809",
"0.58241165",
"0.58225495",
"0.5817149",
"0.5805826",
"0.57911235",
"0.5783981",
"0.57682395",
"0.5766629",
"0.57661813",
"0.5763974",
"0.575963",
"0.57513815",
"0.5750025",
"0.57497525",
"0.5748703",
"0.57442015",
"0.57412183",
"0.57339376",
"0.5728111",
"0.57164705",
"0.57116306",
"0.57098925",
"0.5709857",
"0.5705493",
"0.5701067",
"0.56985784",
"0.5695275",
"0.5694851",
"0.5683927",
"0.56788784"
] | 0.0 | -1 |
Stretch the children layouts to fill the gaps, remove redundant spaces inside the parent layout | def stretch_children_layouts(parent_template, parent_width, parent_height, lines)
total_height = 0
lines.each_with_index do |line, line_index|
desired_height =
if line_index == lines.length - 1
parent_height - total_height
else
line.map { |_child_template, _child_width, child_height, _x, _y| child_height }.max
end
total_width = 0
line.map!.with_index do |(child_template, child_width, child_height, x, y), index|
child_height = desired_height if parent_template.fill_height
child_width = parent_width - total_width if parent_template.fill_width && index == line.length - 1
total_width += child_width
[child_template, child_width, child_height, x, y]
end
total_height += desired_height
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout()\n layout_children()\n end",
"def do_layout\n _init_layout\n r = @top_margin\n c = @left_margin\n #\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fixed_ctr = 0 # how many items have a fixed wt\n var_ctr = 0\n var_wt = 0.0\n @components.each do |e|\n $log.debug \" looping 1 #{e.name} \"\n _tmpwt = cget(e, :weight) || 0\n # what of field and button placed side by side\n if e.is_a? Field or e.is_a? Button or e.is_a? Label\n # what to do here ?\n @wts[e] ||= 1\n ht += @wts[e] || 1\n fixed_ctr += 1\n elsif _tmpwt >= 1\n ht += _tmpwt || 0\n fixed_ctr += 1\n elsif _tmpwt > 0 and _tmpwt <= 1\n # FIXME how to specify 100 % ???\n var_ctr += 1\n var_wt += _tmpwt\n end\n end\n unaccounted = @components.count - (fixed_ctr + var_ctr)\n $log.debug \" unacc #{unaccounted} , fixed #{fixed_ctr} , var : #{var_ctr} , ht #{ht} height #{@height} \"\n balance_ht = @width - ht # use this for those who have specified a %\n balance_ht1 = balance_ht * (1 - var_wt )\n average_ht = (balance_ht1 / unaccounted).floor # give this to those who have not specified ht\n average_ht = (balance_ht1 / unaccounted) # give this to those who have not specified ht\n $log.debug \" #{balance_ht} , #{balance_ht1} , #{average_ht} \"\n # not accounted for gap in heights\n rem = 0 # remainder to be carried over\n @components.each do |e|\n $log.debug \" looping 2 #{e.name} #{e.class.to_s.downcase} \"\n next if @ignore_list.include? e.class.to_s.downcase\n $log.debug \" looping 3 #{e.name} \"\n e.row = r\n e.col = c\n wt = cget(e, :weight)\n if wt\n if wt.is_a? Integer\n e.width = wt\n elsif wt.is_a? Float\n e.width = (wt * balance_ht).floor\n end\n else\n # no wt specified, give average of balance wt\n e.width = average_ht\n hround = e.width.floor\n\n rem += e.width - hround\n e.width = hround\n # see comment in prev block regarding remaininder\n if rem >= 1\n e.width += 1\n rem = 0\n end\n end\n $log.debug \" layout #{e.name} , w: #{e.width} r: #{e.row} , c = #{e.col} \"\n\n e.height = @height\n c += e.width.floor\n c += @gap\n end\n $log.debug \" layout finished \"\n end",
"def layout_children\n \n end",
"def repack\n @widths = Array.new(@rows.empty? ? 0 : @rows[0].size, 0)\n @heights = Array.new(@rows.size, 0)\n\n filled_columns = []\n filled_rows = []\n\n # Calculate the maximum widths of each column and the maximum height of each row.\n @rows.each_with_index do |row, row_num|\n row.each_with_index do |element, column_num|\n fills = (element.align_h == :fill)\n @widths[column_num] = [fills ? element.min_width : element.outer_width, @widths[column_num]].max\n filled_columns.push fills\n\n fills = (element.align_v == :fill)\n @heights[row_num] = [fills ? element.min_width : element.outer_height, @heights[row_num]].max\n filled_rows.push fills\n end\n end\n\n # Expand the size of each filled column to make the minimum size required.\n unless @widths.empty?\n num_filled_columns = filled_columns.select {|value| value }.count\n total_width = @widths.inject(0, :+) + (padding_left + padding_right) + ((@num_columns - 1) * spacing_h)\n extra_width = min_width - total_width\n if extra_width > 0\n if num_filled_columns > 0\n @widths[filled_columns.index true] += extra_width\n else\n @widths[-1] += extra_width\n end\n end\n end\n\n # Expand the size of each filled row to make the minimum size required.\n unless @heights.empty?\n num_filled_rows = filled_rows.select {|value| value }.count\n total_height = @heights.inject(0, :+) + (padding_left + padding_right) + ((@num_rows - 1) * spacing_v)\n extra_height = min_height - total_height\n if extra_height > 0\n if num_filled_rows > 0\n @heights[filled_rows.index true] += extra_height\n else\n @heights[-1] += extra_height\n end\n end\n end\n\n # Actually place all the elements into the grid positions, modified by valign and align.\n current_y = y + padding_top\n @rows.each_with_index do |row, row_num|\n current_x = x + padding_left\n\n row.each_with_index do |element, column_num|\n element.x = current_x + element.border_thickness\n\n case element.align_h # Take horizontal alignment into consideration.\n when :fill\n if element.width < @widths[column_num]\n element.width = @widths[column_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.x += (@widths[column_num] - element.width) / 2\n when :right\n element.x += @widths[column_num] - element.width\n end\n\n current_x += @widths[column_num]\n current_x += spacing_h unless column_num == @num_columns - 1\n\n element.y = current_y + element.border_thickness\n\n case element.align_v # Take horizontal alignment into consideration.\n when :fill\n if element.height < @heights[row_num]\n element.height = @heights[row_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.y += (@heights[row_num] - element.height) / 2\n when :bottom\n element.y += @heights[row_num] - element.height\n else\n end\n end\n\n self.width = current_x - x + padding_left if row_num == 0\n\n current_y += @heights[row_num] unless row.empty?\n current_y += spacing_h unless row_num == num_rows - 1\n end\n\n self.height = current_y - y + padding_top\n\n nil\n end",
"def do_layout\n $log.debug \" inside do_layout\"\n _init_layout\n raise \"please implement this in your subclass \"\n c = @left_margin\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fixed_ctr = 0 # how many items have a fixed wt\n var_ctr = 0\n var_wt = 0.0\n @components.each do |e|\n $log.debug \" looping 1 #{e.name} \"\n _tmpwt = @wts[e] || 0\n # what of field and button placed side by side\n if e.is_a? Field or e.is_a? Button or e.is_a? Label\n @wts[e] ||= 1\n ht += @wts[e] || 1\n fixed_ctr += 1\n elsif _tmpwt >= 1\n ht += @wts[e] || 0\n fixed_ctr += 1\n elsif _tmpwt > 0 and _tmpwt <= 1\n # FIXME how to specify 100 % ???\n var_ctr += 1\n var_wt += @wts[e]\n end\n end\n unaccounted = @components.count - (fixed_ctr + var_ctr)\n $log.debug \" unacc #{unaccounted} , fixed #{fixed_ctr} , var : #{var_ctr} , ht #{ht} height #{@height} \"\n balance_ht = @height - ht # use this for those who have specified a %\n balance_ht1 = balance_ht * (1 - var_wt )\n average_ht = (balance_ht1 / unaccounted).floor # give this to those who have not specified ht\n average_ht = (balance_ht1 / unaccounted) # give this to those who have not specified ht\n $log.debug \" #{balance_ht} , #{balance_ht1} , #{average_ht} \"\n # not accounted for gap in heights\n rem = 0 # remainder to be carried over\n @components.each do |e|\n $log.debug \" looping 2 #{e.name} #{e.class.to_s.downcase} \"\n next if @ignore_list.include? e.class.to_s.downcase\n $log.debug \" looping 3 #{e.name} \"\n e.row = r\n e.col = c\n wt = @wts[e]\n if wt\n if wt.is_a? Integer\n e.height = wt\n elsif wt.is_a? Float\n e.height = (wt * balance_ht).floor\n end\n else\n # no wt specified, give average of balance wt\n e.height = average_ht\n hround = e.height.floor\n\n rem += e.height - hround\n e.height = hround\n # see comment in prev block regarding remaininder\n if rem >= 1\n e.height += 1\n rem = 0\n end\n end\n $log.debug \" layout #{e.name} , h: #{e.height} r: #{e.row} , c = #{e.col} \"\n\n e.width = @width\n r += e.height.floor\n r += @gap\n end\n $log.debug \" layout finished \"\n end",
"def widths_reset\n @width = GroupLayout::DEFAULT_SIZE\n @max = GroupLayout::DEFAULT_SIZE\n end",
"def layout_minibuilder_field_wide(mb)\n mb.rect.w = @mainRect.w - (@spacing * 2)\n mb.rect.x = @mainRect.x + @spacing\n mb.rect.y = @fieldY\n mb.refresh\n @fieldY = mb.rect.bottom + @spacing\n self << mb\n @wakeup_widgets << mb if @wakeup_widgets\n end",
"def heights_reset\n @height = GroupLayout::DEFAULT_SIZE\n end",
"def fit_it_in\n width, height = available_space\n return fit_as_empty_first_layout(height) if no_space_in_first_layout?(width)\n\n layout = generate_layout(width, @dsl.text)\n if fits_in_one_layout?(layout, height)\n fit_as_one_layout(layout)\n else\n fit_as_two_layouts(layout, height, width)\n end\n end",
"def stretch!(&block)\n each do |stretchable|\n if stretchable.respond_to?(:stretch!)\n stretchable.stretch!(&block)\n end\n end\n \n return self\n end",
"def default_layout(width=@width, height=@height)\n if @nodes.length > 0\n set_static_nodes(width,height)\n static_wheel_nodes(width,height)\n fruchterman_reingold(100,width,height) #fast, little bit of layout for now\n normalize_graph(width,height)\n #do_kamada_kawai\n else\n @notice = NO_ITEM_ERROR\n end\n end",
"def adapt_design_size \n hits = 0\n while space_factor < Constants::Min_allowed_factor and hits < 3\n if @vertical \n @height /= Constants::Shrink_factor\n @height += @height%20 == 0 ? 0 : 20-@height%20\n elsif not @vertical\n @width /= Constants::Shrink_factor\n @width += @width%20 == 0 ? 0 : 20-@width%20\n end\n composite_main_image_position\n generate_white_spaces\n white_space_area = white_space_w * white_space_h\n hits +=1\n end\n end",
"def resizes_if_necessary\n if(@kv_height > @interieur_height || @kv_width > @interieur_width)\n @kv_height = (@kv_height / 2).ceil \n @kv_width = (@kv_width / 2).ceil \n resizes_if_necessary\n end\n end",
"def ensure_children_for_division(division, floats)\n widths = division.split('-').map(&:to_i)\n return if widths.length < floats.length\n widths.zip(floats, children).each do |width, float, child|\n if child\n child.update_attributes!(:width => width, :float => float)\n else\n child = self.class.create!(:width => width, :float => float)\n child.move_to_child_of self\n end\n end\n end",
"def refresh()\n # Filling the parent that is at the root of the screen is apparently broken :/.\n @holder.set_height(@parent.get_height_fit - @holder.get_y)\n set_height(@holder.get_height - get_y)\n end",
"def size_to_fit(opts = { margin: 0 })\n subview_frame = self.frame_for_subviews\n self.frame = subview_frame\n\n # margin = opts[:margin]\n # self.add_margin margin\n\n # TODO reference point is unclear.\n\n self\n end",
"def arrange_tiled\n # some simplifying assumptions for constants that may need revisiting for more flexibility\n margin_v = 5\n row_height = 30\n \n rows = self.rows_of_subviews\n row_v_position = 5\n rows.each { |row|\n total_element_width = row.inject(0) {|r, view| r += view.width}\n total_margin_width = self.width - total_element_width\n margin_h = total_margin_width / (row.count + 1) # e.g. if 3 views, there are 4 margins\n \n x_tally = 0\n row.each { |view|\n view.center = CGPointMake(x_tally + margin_h + (view.width / 2), row_v_position + (row_height / 2))\n x_tally += margin_h + view.width\n }\n \n row_v_position += row_height\n }\n end",
"def reapply!\n root ||= self.view\n @layout_state = :reapply\n run_reapply_blocks\n\n @child_layouts.each do |child_layout|\n child_layout.reapply!\n end\n\n @layout_state = :initial\n\n return self\n end",
"def initialize\n super\n self.orientation = Qt::Vertical\n @layout = Qt::GraphicsLinearLayout.new do\n self.orientation = Qt::Vertical\n end\n item = Qt::GraphicsWidget.new\n item.layout = @layout\n add_item_orig(item)\n add_stretch(1)\n #void setStretchFactor ( QGraphicsLayoutItem * item, int stretch )\n end",
"def stretch(&block)\n clone.stretch!(&block)\n end",
"def clear\n @sizes = FloatRect.new 0, 0, 1, 1\n @paddings = Paddings.new\n @margins = Margins.new\n @children = []\n @handle = nil\n self\n end",
"def layout(sugar)\n # otherwise use standard layout for non moved residues?\n remove_layout(sugar)\n do_initial_layout(sugar)\n setup_scaling(sugar)\n seen_residues = do_chain_layout(sugar)\n seen_residues += do_stubs(sugar,seen_residues)\n do_basic_layout(sugar,seen_residues)\n do_box_layout(sugar)\n do_sibling_bunching(sugar)\n do_center_boxes_more(sugar)\n do_sibling_bunching(sugar)\n do_multi_residue_widening(sugar)\n class << sugar\n alias_method :uncondensed_box, :box\n def box\n box_block = lambda { |r|\n ! r.is_stub?\n }\n return uncondensed_box(&box_block)\n end\n end\n \n end",
"def stretch(&block)\n deep_clone.stretch!(&block)\n end",
"def _init_layout\n # when user gives a negative value, we recalc and overwrite so the need to save, for a redraw.\n @saved_width ||= @width\n @saved_height ||= @height\n\n lines = Ncurses.LINES - 1\n columns = Ncurses.COLS - 1\n if @height_pc\n @height = ((lines - @top_margin - @bottom_margin) * @height_pc).floor\n elsif @saved_height <= 0\n @height = lines - @saved_height - @top_margin - @bottom_margin\n end\n $log.debug \" layout height = #{@height} \"\n if @width_pc\n @width = ((columns - @left_margin - @right_margin) * width_pc).floor\n elsif @saved_width <= 0\n # if width was -1 we have overwritten it so now we cannot recalc it. it remains the same\n @width = columns - @saved_width - @left_margin - @right_margin\n end\n $log.debug \" layout wid = #{@width} \"\n # if user has not specified, then get all the objects\n @components ||= @form.widgets.select do |w| w.visible != false && !@ignore_list.include?(w.class.to_s.downcase); end\n $log.debug \" components #{@components.count} \"\n end",
"def _layout(*_arg0); end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def init_layout(state)\n @cells = Array.new(state[:board_rows]) { Array.new(state[:board_columns], nil) }\n @layout = Gtk::FlowBox.new\n @layout.valign = :start\n @layout.max_children_per_line = 1\n @layout.selection_mode = :none\n @layout.set_row_spacing(10)\n\n @turn_indicator = Gtk::Label.new\n @layout.add(@turn_indicator)\n\n @fixed_layout = Gtk::Fixed.new\n @layout.add(@fixed_layout)\n\n cell_grid = Gtk::Grid.new\n @fixed_layout.put(cell_grid, 0, 0)\n\n (0..(state[:board_columns] - 1)).each do |col|\n (0..(state[:board_rows] - 1)).each do |row|\n cell = Gtk::Button.new\n cell.set_size_request(100, 100)\n @cells[row][col] = cell\n cell_grid.attach(cell, col, row, 1, 1)\n end\n end\n\n column_grid = Gtk::Grid.new\n @fixed_layout.put(column_grid, 0, 0)\n\n (0..(state[:board_columns] - 1)).each do |column_index|\n column = Gtk::Button.new\n column.set_size_request(100, 100 * state[:board_rows])\n column.style_context.add_provider(@column_style, Gtk::StyleProvider::PRIORITY_USER)\n column.signal_connect('clicked') do |_|\n changed\n notify_observers('column_clicked', column_index)\n end\n column_grid.attach(column, column_index, 0, 1, 1)\n end\n\n @tokens_indicator = Gtk::Label.new\n\n @t_button = Gtk::Button.new\n @t_button.set_size_request(100, 100)\n @t_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('t_clicked')\n end\n\n @o_button = Gtk::Button.new\n @o_button.set_size_request(100, 100)\n @o_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('o_clicked')\n end\n\n @winner = Gtk::Label.new\n @main_menu_button = Gtk::Button.new(label: 'Back to Main Menu')\n @main_menu_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('main_menu_clicked')\n end\n\n if state[:type] == AppModel::TOOT_AND_OTTO\n @token_button_box = Gtk::Box.new(:horizontal, 10)\n @layout.add(@tokens_indicator)\n @token_button_box.add(@t_button)\n @token_button_box.add(@o_button)\n @layout.add(@token_button_box)\n end\n\n @mask = Gtk::Button.new(label: 'Please wait for your turn...')\n @mask.set_size_request(100 * state[:board_columns], 100 * state[:board_rows])\n @mask.style_context.add_provider(@mask_style, Gtk::StyleProvider::PRIORITY_USER)\n\n @window.add(@layout)\n end",
"def set_grid_dimensions(row_count, col_count)\n \n # Forbid resetting grid dimensions\n if @grid_dimensions_set\n Vizkit.warn(\"Error: You may set grid dimensions before configuration only.\")\n return\n else\n @grid_dimensions_set = true\n end\n \n # Remove all parent widgets from grid.\n child = nil\n while(child = @grid.take_at(0)) \n widget = child.widget\n widget.set_parent(nil)\n widget = nil\n child = nil\n end\n \n # Generate container widgets with label if not yet existent\n counter = 0\n for row in 0..row_count-1 do\n for col in 0..col_count-1 do\n container = nil\n if not @container_hash[counter]\n widget_pos = (row * col_count) + col\n container = ContainerWidget.new(widget_pos)\n @container_hash[counter] = container\n else\n container = @container_hash[counter]\n end\n \n # Add parent widget to grid\n @grid.add_widget(container, row, col) # TODO does this make @grid the parent of the widget?\n container.show\n counter = counter + 1\n end\n end\n \n # Delete useless container widgets if any\n @container_hash.delete_if {|pos, conatiner| pos >= counter}\n \n end",
"def copy_pad_to_win\n # check that we don't exceed other windows height/maxrow\n smr = smaxrow()\n # SHIT, this means the otherwin has to be a Pad, cannot be a window\n osw = @otherwin.width\n osh = @otherwin.height\n osh = @height if osh == 0 # root window has 0\n osw = @width if osw == 0 # root window has 0\n osmr = @otherwin.smaxrow() rescue osh # TRYING for windows\n osmc = @otherwin.smaxcol() rescue osw\n if smr >= osmr\n $log.debug \" adjusted smr from #{smr} to #{osmr} -1 causing issues in viewfooter\"\n smr = osmr-1 # XXX causing issues in viewport, wont print footer with this\n end\n if smr > @sheight + @top -1 -@pminrow # 2010-01-17 13:27 \n smr = @sheight + @top -1 -@pminrow \n $log.debug \" adjusted smr to #{smr} to prevent crash \"\n end\n smc = smaxcol()\n $log.debug \" SMC original = #{smc} \"\n if smc >= osmc\n smc = osmc-1\n smc = @width # XXX ??? THIS WAS WORKING< but throwing error in viewport case\n smc = [osmc-1, @width].min # yet another hack\n $log.debug \" SMC o-1 #{osmc-1} wdth #{@width}, smc #{smc} \"\n end\n ### XXX commented out since it doesn't let a comp print fully if widget expanded (splitpane)\n #smc = osw -1 if smc >= osw; # added 2009-11-02 17:01 for tabbedpanes\n\n # dang, this is coming up a lot. 2010-01-16 20:34 \n # the second scrollpane was one row too large in testsplit3a.rb\n if smr - @top > @padheight\n $log.debug \" fixing smr to padheight 2010-01-16 20:35 HOPE THIS DOESNT BREAK ANYTHING\"\n smr = @padheight\n end\n @pminrow = 0 if @pminrow < 0\n @pmincol = 0 if @pmincol < 0\n $log.debug \" COPYING #{self.name} to #{@otherwin.name} \"\n $log.debug \" calling copy pad #{@pminrow} #{@pmincol}, #{@top} #{@left}, #{smr} #{smc} self #{self.name} \"\n $log.debug \" calling copy pad H: #{@height} W: #{@width}, PH #{@padheight} PW #{@padwidth} WIN:#{@window} \"\n# $log.debug \" -otherwin target copy pad #{@otherwin.pminrow} #{@otherwin.pmincol}, #{@otherwin.top} #{@otherwin.left}, #{osmr} #{osmc} OTHERWIN:#{@otherwin.name} \"\n ret=\"-\"\n #if ret == -1\n#x XXX $log.debug \" #{ret} otherwin copy pad #{@otherwin.pminrow} #{@otherwin.pmincol}, #{@otherwin.top} #{@otherwin.left}, #{osmr} #{osmc} \"\n $log.debug \" #{ret} otherwin copy pad H: #{osh} W: #{osw}\"\n if @top >= osh\n $log.debug \" #{ret} ERROR top exceeds other ht #{@top} H: #{osh} \"\n end\n if @left >= osw\n $log.debug \" #{ret} ERROR left exceeds other wt #{@left} W: #{osw} \"\n end\n if smr >= osh\n $log.debug \" #{ret} ERROR smrow exceeds other ht #{smr} H: #{osh} \"\n smr = osh() -1 # testing 2010-01-31 21:47 , again 2010-02-05 20:22 \n end\n if smc >= osw\n $log.debug \" #{ret} ERROR smcol exceeds other wt #{smc} W: #{osw} \"\n end\n if smc - @left > @padwidth\n $log.debug \" #{ret} ERROR smcol - left exceeds padwidth #{smc}- #{@left} PW: #{@padwidth} \"\n end\n if smr - @top > @padheight\n $log.debug \" #{ret} ERROR smr - top exceeds padheight #{smr}- #{@top} PH: #{@padheight} \"\n end\n ret = @window.copywin(@otherwin.get_window,@pminrow,@pmincol, @top, @left, smr, smc, 0)\n $log.debug \" copywin ret #{ret} \"\n # 2010-01-11 19:42 one more cause of -1 coming is that padheight (actual height which never\n # changes unless pad increases) or padwidth is smaller than area being printed. Solution: increase \n # buffer by increasing widgets w or h. smc - left should not exceed padwidth. smr-top should not\n # exceed padheight\n #end\n @modified = false\n return ret\n end",
"def refresh()\n # Filling the parent that is at the root of the screen is apparently broken :/.\n @holder.set_height(@parent.get_height_fit - @holder.get_y)\n page_height = @holder.get_height - get_y\n if @keyboard then\n page_height = page_height - @keyboard.get_visible_height()\n end\n\n set_height(page_height)\n end",
"def resize\n\t\t@image = Qt::Image.new @parent.width/2, @parent.width/2, 7\n\t\t@image.fill Qt::Color.new \"#ffffff\"\n\tend",
"def prep_layout_args(layout_args, expand_by: 1)\n unless layout_args.respond_to?(:each)\n layout_args = [layout_args] * expand_by\n end\n layout_args || []\n end",
"def set_layout h,w,t,l\n set_pad_dimensions t,l,h,w\n end",
"def build_multiple_editor_layout(width, height, pane_ids)\n editor_height = height / 2\n top_editor_pane_ids = pane_ids[0, pane_ids.count/2]\n bottom_editor_pane_ids = pane_ids[pane_ids.count/2..-1]\n top_editor_layouts = distribute_horizontally(0, width, editor_height, top_editor_pane_ids)\n bottom_editor_layouts = distribute_horizontally(editor_height+1, width, height-editor_height-1, bottom_editor_pane_ids)\n\n top_layout = top_editor_layouts.count == 1 ? top_editor_layouts.first : Layout.new(\"#{width}x#{editor_height}\", 0, 0, HorizontalNesting.new(top_editor_layouts))\n bottom_layout = bottom_editor_layouts.count == 1 ? bottom_editor_layouts.first : Layout.new(\"#{width}x#{height-editor_height-1}\", 0, editor_height+1, HorizontalNesting.new(bottom_editor_layouts))\n\n Layout.new(\"#{width}x#{height}\", 0, 0, VerticalNesting.new([ top_layout, bottom_layout ]))\nend",
"def agroup_components\n (0..4).each{|i|\n @mode_vbox.pack_start(@mode_rdo[i])\n }\n (@idiom_rdo[0].group).reverse_each{|rdo_btn|\n @idiom_vbox.pack_start(rdo_btn)\n }\n @hbox.pack_start(@mode_vbox)\n @hbox.pack_start(@idiom_vbox)\n @geral_vbox.pack_start(@hbox)\n @geral_vbox.pack_start(@new_btn)\n @geral_vbox.pack_start(@quit_btn)\n self.add(@geral_vbox)\n end",
"def enforce\n assert_minimum_width\n padding = renderer.padding\n\n if natural_width <= renderer.width\n if renderer.resize\n expand_column_widths\n else\n renderer.column_widths.map do |width|\n padding.left + width + padding.right\n end\n end\n else\n if renderer.resize\n shrink\n else\n rotate\n end\n end\n end",
"def _draw(parent, max_col_widths)\n Utils::RasemWrapper.group(parent, class: param(:class), id: param(:id)) do |row_group|\n draw_border(row_group, width_override: max_col_widths.reduce(&:+))\n\n cells.zip(max_col_widths).reduce(0) do |x, (cell, col_width)|\n cell.draw(row_group, debug: @debug).translate(x, 0)\n x + col_width\n end\n end\n end",
"def set_layout\n @layoutme = 1\n end",
"def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end",
"def distribute_widths(widths)\n indent = SPACE * @current_indent\n total_width = widths.reduce(&:+)\n screen_width = @width - (indent.length + 1) * 2 - (widths.size + 1)\n return widths if total_width <= screen_width\n\n extra_width = total_width - screen_width\n\n widths.map do |w|\n ratio = w / total_width.to_f\n w - (extra_width * ratio).floor\n end\n end",
"def distribute_widths(widths)\n indent = SPACE * @current_indent\n total_width = widths.reduce(&:+)\n screen_width = @width - (indent.length + 1) * 2 - (widths.size + 1)\n return widths if total_width <= screen_width\n\n extra_width = total_width - screen_width\n\n widths.map do |w|\n ratio = w / total_width.to_f\n w - (extra_width * ratio).floor\n end\n end",
"def generate_layout(width, text)\n layout = ::Swt::TextLayout.new Shoes.display\n layout.setText text\n layout.setSpacing(@opts[:leading] || DEFAULT_SPACING)\n font = ::Swt::Font.new Shoes.display, @dsl.font, @dsl.font_size,\n ::Swt::SWT::NORMAL\n style = ::Swt::TextStyle.new font, nil, nil\n layout.setStyle style, 0, text.length - 1\n shrink_layout_to(layout, width) unless layout_fits_in?(layout, width)\n\n font.dispose\n\n layout\n end",
"def calc_contents_height\n @q_contents_height = 0\n @layout.each { |dt| @q_contents_height += data_height(dt) } if @quest\n end",
"def splitView(splitView, resizeSubviewsWithOldSize:oldSize)\n\t\tfirstSubview = splitView.subviews.objectAtUntestedIndex(0)\n\t\tsecondSubview = splitView.subviews.objectAtUntestedIndex(1)\n\t\tdividerThickness = splitView.dividerThickness\n\t\tframe = splitView.frame\n\t\t\n\t\tfirstSubviewFrame = firstSubview.frame\t\t\n\t\texistingFirstSubviewFrame = firstSubview.frame\n\t\t\n\t\tfirstSubviewFrame.size.height = frame.size.height\n\t\t\n\t\tminimumSearchPaneWidth = 375\n\t\tmaximumSearchPaneWidth = ((splitView.frame.size.width * 3) / 5).floor\n\t\t\n\t\tif existingFirstSubviewFrame.size.width.floor <= minimumSearchPaneWidth\n\t\t\tif existingFirstSubviewFrame.size.width > ((oldSize.width / 5) * 2).floor\n\t\t\t\t\t# If the width of the search pane has gone down to the minimum size,\n\t\t\t\t\t# then open up to an ideal width, 2 fifths of the frame seems about right\n\t\t\t\t\tfirstSubviewFrame.size.width = ((frame.size.width / 5) * 2).floor\n\t\t\telse\n\t\t\t\t\tfirstSubviewFrame.size.width = minimumSearchPaneWidth\n\t\t\tend\n\t\telse\n\t\t\t# Otherwise continue using the ratio between the subview to the full split view\n\t\t\tfirstSubviewFrame.size.width = (frame.size.width / (oldSize.width / firstSubviewFrame.size.width)).floor\n\t\tend\n\t\t\n\t\tif firstSubviewFrame.size.width <= minimumSearchPaneWidth\n\t\t\tfirstSubviewFrame.size.width = minimumSearchPaneWidth \n\t\telsif firstSubviewFrame.size.width >= maximumSearchPaneWidth\n\t\t\tfirstSubviewFrame.size.width = maximumSearchPaneWidth\n\t\tend\n\t\t\n\t\tfirstSubview.frame = firstSubviewFrame\n\t\t\n\t\tsecondSubviewFrame = secondSubview.frame\n\t\tsecondSubviewFrame.size.height = frame.size.height\n\t\tsecondSubviewFrame.origin.x = firstSubviewFrame.size.width + dividerThickness;\n\t\tsecondSubviewFrame.size.width = frame.size.width - firstSubviewFrame.size.width - dividerThickness;\n\t\tsecondSubview.frame = secondSubviewFrame\n\tend",
"def resize_to_fill(ncols, nrows = nil, gravity = CenterGravity)\n copy.resize_to_fill!(ncols, nrows, gravity)\n end",
"def fit_pinning_top\n union_frame = frame_for_subviews\n \n # # balance horizontally - offset x based on diff between old and new widths.\n # width_change = union_frame.width - self.width \n # new_x = self.x - width_change / 2\n new_x = self.x\n\n # pin at the top - offset y based on original top location and new height.\n new_y = self.frame.top_y - union_frame.height\n\n # we need to apply a vertical offset to all subviews later.\n delta_y = (new_y - self.y)\n\n # set the frame (and pray)\n self.frame = new_rect new_x, new_y, union_frame.width, union_frame.height\n\n self.subviews.each do |subview|\n if delta_y > 0 # we need to grow - move subview y up.\n subview.y += delta_y\n else # we need to shrink - move subview y down.\n subview.y -= delta_y\n end\n end\n end",
"def print_layouts\n STDOUT.puts @layouts.join(\"\\n\")\n exit 0\n end",
"def layout_full_center\n nil\n end",
"def fit_to_bottom_of( sibling_view )\n new_height = sibling_view.frame.origin.y - self.frame.origin.y\n self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.width, new_height)\n end",
"def rows\n layout_text.blank? ? 12 : layout.size\n end",
"def grow \n\t\t@height += 1\n\tend",
"def resize width, height\n @widgets[@index].width = width\n @widgets[@index].height = height\n @widgets[@index].repaint\n end",
"def layout_config\n @squeezed_layout_config\n end",
"def no_layout?; end",
"def layout(layout_width)\n idx, str = 0, ''\n\n #layout_width = 4\n layout_length = object.length - (layout_remainder = object.length % layout_width)\n\n while idx < layout_length - 1 do\n generate_division(layout_width).each do | val |\n # [5, 5].each do | val |\n str += h.render partial: \"layouts/layout_#{val}\", locals: { posts: object.slice(idx, val)}\n idx += val\n end\n end\n\n if layout_remainder > 0\n str += h.render partial: \"layouts/layout_#{layout_remainder}\", locals: { posts: object.slice(idx, layout_remainder)}\n end\n\n str.html_safe\n end",
"def quick_gridlayout(how, what)\n QuickGridLayout.new(self, how, what, parent_widget, window_id, :gridlayout)\n end",
"def agroup_components\n table = Gtk::Table.new(11,8)\n (0..8).each{|i|\n x = $glob.btns[i].x\n y = $glob.btns[i].y\n table.attach($glob.btns[i],(x*2)+1,(x*2)+2,(y*2)+1,(y*2)+2)\n }\n (0..3).each{|i|\n table.attach(Gtk::VSeparator.new,i*2,(i*2)+1,0,8)\n table.attach(Gtk::HSeparator.new,0,8,i*2,(i*2)+1) \n }\n table.attach(@new_btn,0,8,8,9) \n table.attach(@default_size_btn,0,8,9,10)\n table.attach(@quit_btn,0,8,10,11)\n self.add(table)\n end",
"def build_editor_layout(width, height, pane_ids)\n if pane_ids.count == 1\n build_single_editor_layout(width, height, pane_ids.first)\n else\n build_multiple_editor_layout(width, height, pane_ids)\n end\nend",
"def scale_to_fill(new_size)\n scale_to_fill(new_size, position: :center)\n end",
"def set_layout_to_none\n options[:layout] = false\n end",
"def master_shrink(text)\n center = text.layout.options[:center]\n text.layout.options[:center] -= 0.1 if center > 0.1\n text.layout.apply\n end",
"def rearrange\n # Calculate the number of the dynamic dimension.\n case @type\n when :fixed_rows\n @num_columns = (size / @num_rows.to_f).ceil\n when :fixed_columns\n @num_rows = (size / @num_columns.to_f).ceil\n end\n\n # Create an array containing all the rows.\n @rows = case @type\n when :fixed_rows\n # Rearrange the list, arranged by columns, into rows.\n rows = Array.new(@num_rows) { [] }\n @children.each_with_index do |child, i|\n rows[i % @num_rows].push child\n end\n rows\n when :fixed_columns\n @children.each_slice(@num_columns).to_a\n end\n\n nil\n end",
"def build_console_layout(x, width, height, pane_ids)\n console_layouts = distribute_vertically(x, width, height, pane_ids)\n Layout.new(\"#{width}x#{height}\", x, 0,\n VerticalNesting.new(console_layouts))\nend",
"def render_all_layouts(layouts, payload, info)\n renderer.layouts = layouts\n self.output = renderer.place_in_layouts(output, payload, info)\n ensure\n @renderer = nil # this will allow the modifications above to disappear\n end",
"def normalize_graph(width=@width, height=@height, nodeset=@nodes)\n puts \"normalizing graph\"\n \n if nodeset.length > 0 #to handle empty graphs; could also do it in default layout (else display message)\n #center the nodes\n max_x = nodeset.max_by{|k,n| n.location[0]}[1].location[0]\n max_y = nodeset.max_by{|k,n| n.location[1]}[1].location[1]\n min_x = nodeset.min_by{|k,n| n.location[0]}[1].location[0]\n min_y = nodeset.min_by{|k,n| n.location[1]}[1].location[1]\n center_offset = Vector[(max_x+min_x-width)/2, (max_y+min_y-height)/2] #center of the nodes - desired center\n nodeset.each_value {|n| n.location = n.location-center_offset if !n.static}\n\n #scale to fit\n center = [width/2, height/2]\n far_x = nodeset.max_by{|k,n| (n.location[0]-center[0]).abs}[1].location[0] #node with max x\n far_y = nodeset.max_by{|k,n| (n.location[1]-center[1]).abs}[1].location[1] #node with max y\n # scale = [[center[0]/(far_x-center[0]).abs, 1.0].min, #if only shrink to fit, not stretch to fill\n # [center[1]/(far_y-center[1]).abs, 1.0].min]\n \n scale = [center[0].to_f/(far_x-center[0]).abs, #currently stretches to fill\n center[1].to_f/(far_y-center[1]).abs]\n scale[0] = 1 if scale[0] == 1.0/0 #if we don't need to stretch, then don't!\n scale[1] = 1 if scale[1] == 1.0/0\n\n nodeset.each_value {|n| n.location = Vector[scale[0]*(n.location[0]-center[0])+center[0], \n scale[1]*(n.location[1]-center[1])+center[1]] if !n.static}\n end\n end",
"def setupWidgets\n # Create a frame which in which widgets will be ordered horisontally:\n frame = Qt::Frame.new\n frameLayout = Qt::HBoxLayout.new(frame)\n @imageWidget = ImageWidget.new(self)\n @treeView = Qt::TreeView.new\n # Add the two widgets (tree view and image) to the frame:\n frameLayout.addWidget(@treeView)\n frameLayout.addWidget(@imageWidget)\n setCentralWidget(frame)\n end",
"def layout_fields\n \n end",
"def width(*val)\n return @width if val.empty?\n oldvalue = @width || 0\n super\n @width = val[0]\n return if @child == nil\n delta = @width - oldvalue\n return if delta == 0\n @repaint_required = true\n # another safeguard if user did not enter. usesomething sensible 2010-01-17 15:23 \n if @child.width.nil?\n @child.width = @width\n $log.warn \" viewport setting child #{@child.name} to default w of #{@width}. Usually child is larger. \"\n else\n ## sometime we are needless increasing. this happens when we set viewport and\n ##+ child has been set. Or may do only if scrollpane is getting larger than child\n ##+ largely a situation with splitpanes.\n if @cascade_changes\n $log.debug \"warn!! viewport adding #{delta} to child wt #{child.width} \"\n @child.width += delta\n end\n end\n end",
"def place_in_layout?; end",
"def place_in_layout?; end",
"def master_grow(text)\n center = text.layout.options[:center]\n text.layout.options[:center] += 0.1 if center < 0.9\n text.layout.apply\n end",
"def _conditional_layout?; end",
"def build_single_editor_layout(width, height, pane_id)\n Layout.new(\"#{width}x#{height}\", 0, 0, PaneId.new(pane_id))\nend",
"def layout\n yield(monitoring_layout)\n monitoring_layout\n end",
"def gap_width\n @gap_width ||= 150\n end",
"def render_all_layouts(layouts, payload, info); end",
"def contents_width\r\n (item_width + spacing) * item_max - spacing\r\n end",
"def do_layout(payload, layouts)\n end",
"def shrink\n column_size = table.columns_size\n ratio = ((natural_width - renderer.width) / column_size.to_f).ceil\n\n widths = (0...column_size).reduce([]) do |lengths, col|\n width = (renderer.column_widths[col] - ratio)\n # basically ruby 2.4 Numeric#clamp\n width = width < minimum_width ? minimum_width : width\n width = width > renderer.width ? renderer.width : width\n lengths << width\n end\n distribute_extra_width(widths)\n end",
"def alignments_reset\n @valign = GroupLayout::CENTER\n @halign = GroupLayout::CENTER\n end",
"def resize_to_fill(new_width, new_height)\n manipulate! do |image|\n\n image = resize_image image, new_width, new_height, :max\n\n if image.x_size > new_width\n top = 0\n left = (image.x_size - new_width) / 2\n elsif image.y_size > new_height\n left = 0\n top = (image.y_size - new_height) / 2\n else\n left = 0\n top = 0\n end\n\n image.extract_area(left, top, new_width, new_height)\n\n end\n end",
"def calculate_columns!\n\n\n\n span_count = columns_span_count\n\n\n\n columns_count = children.size\n\n\n\n\n\n\n\n all_margins_width = margin_size * (span_count - 1)\n\n\n\n column_width = (100.00 - all_margins_width) / span_count\n\n\n\n\n\n\n\n columns.each_with_index do |column, i|\n\n\n\n is_last_column = i == (columns_count - 1)\n\n\n\n column.set_column_styles(column_width, margin_size, is_last_column)\n\n\n\n end\n\n\n\n end",
"def createWidgets\n @topTab = KDE::TabWidget.new\n\n @mainTabPageHSplitter = Qt::Splitter.new\n @topTab.addTab(@mainTabPageHSplitter, 'Channels')\n\n @mainTabPageHSplitter.addWidget(createChannelAreaWidget)\n\n # Main Tab page. programme table area\n @progTableFrame = Qt::Splitter.new(Qt::Vertical)\n @progTableFrame.addWidget(createProgrammeAreaWidget)\n @progTableFrame.addWidget(createProgrammeSummaryWidget)\n @mainTabPageHSplitter.addWidget(@progTableFrame)\n\n # parameter : Qt::Splitter.setStretchFactor( int index, int stretch )\n @mainTabPageHSplitter.setStretchFactor( 0, 0 )\n @mainTabPageHSplitter.setStretchFactor( 1, 1 )\n\n # dock\n createPlayerDock\n\n\n # Top Tab - Task Page\n @taskWin = TaskWindow.new\n @topTab.addTab(@taskWin, 'Task')\n\n # Top Tab - Schedule Page\n @scheduleWin = ScheduleWindow.new\n @topTab.addTab(@scheduleWin, 'Schedule')\n\n # Top Tab - Log Page\n @logWin = LogWindow.new\n @topTab.addTab(@logWin, 'Log')\n\n\n # set Top Widget & Layout\n setCentralWidget(@topTab)\n end",
"def resize_to_fill(width, height)\n manipulate! do |image|\n image = resize_image image, width, height, :max\n top = 0\n left = 0\n\n if image.x_size > width\n left = (image.x_size - width) / 2\n elsif image.y_size > height\n top = (image.y_size - height) / 2\n end\n\n image.extract_area left, top, width, height\n end\n self\n end",
"def contents_width\n (item_width + spacing) * item_max - spacing\n end",
"def render_all(sx, sy, ws, hs, &block)\n render sx, sy, ws, hs do |r, l|\n yield r, l\n prect = apply_content_paddings(r, ws, hs)\n @children.each do |itm|\n itm.render_all(prect.x, prect.y, prect.w, prect.h, &block)\n end\n end\n end",
"def adjust_height\n self.height = fitting_height(1 + @max_lines)\n end",
"def create_layout_info\n self.piece_layout ||= PieceLayout.create(layout: ImageLayout.create)\n self.part_layout ||= PartLayout.create(layout: ImageLayout.create)\n save\n end",
"def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end",
"def allow_layout?\n true\n end",
"def layout=(_arg0); end",
"def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end",
"def fix_row_widths\n\n fill_cells(@row_offset - 1, 0)\n\n max = 0\n\n @data.each_with_index do |row|\n max = row.length unless max >= row.length\n end\n\n @data.each_with_index do |row,idx|\n if row.length < max\n row = row + [ @base_cell_options.merge({content: ''}) ] * (max - row.length)\n @data[idx] = row\n end\n end\n\n end",
"def resize\n # We need to nuke ncurses to pick up the new dimensions\n Curses.def_prog_mode\n Curses.close_screen\n Curses.reset_prog_mode\n height, width = Curses.dimensions\n \n # Resize tabs \n @tabs.resize(\n :width => width,\n :height => height\n )\n @tabs.render\n end",
"def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end",
"def distribute_extra_width(widths)\n column_size = table.columns_size\n # TODO - add padding size to fully check extra width\n extra_width = renderer.width - (widths.reduce(:+) + border_size)\n per_field_width = extra_width / column_size\n remaining_width = extra_width % column_size\n extra = [1] * remaining_width + [0] * (column_size - remaining_width)\n\n widths.map.with_index do |width, index|\n width + per_field_width + extra[index]\n end\n end",
"def validate_layout(layout); end",
"def augment_children(child_base_nodes)\n if child_base_nodes.size < (sz = self.class.min_children)\n child_base_nodes = child_base_nodes.dup\n child_base_nodes[sz..-1] = [] # Fill with nil\n end\n child_base_nodes.map.with_index do |child, child_index|\n child_name = self.class.child_index_to_name(child_index, child_base_nodes.size)\n if (klass = remap_child(child, child_name))\n klass.new(child, parent: self, index: child_index)\n else\n child\n end\n end\n end",
"def resize_and_pad(width, height, background=:transparent, gravity=::Magick::CenterGravity)\n width = dimension_from width\n height = dimension_from height\n manipulate! do |img|\n img.resize_to_fit!(width, height)\n filled = ::Magick::Image.new(width, height) { |image| image.background_color = background == :transparent ? 'rgba(255,255,255,0)' : background.to_s }\n filled.composite!(img, gravity, ::Magick::OverCompositeOp)\n destroy_image(img)\n filled = yield(filled) if block_given?\n filled\n end\n end"
] | [
"0.59840864",
"0.58018905",
"0.5796675",
"0.5727341",
"0.564793",
"0.5540127",
"0.5504066",
"0.5488912",
"0.5418825",
"0.5327344",
"0.5260132",
"0.5251093",
"0.5246008",
"0.51668864",
"0.51428837",
"0.51121426",
"0.5075789",
"0.5033938",
"0.49686903",
"0.49675438",
"0.49625772",
"0.49400407",
"0.48876196",
"0.4846532",
"0.48207211",
"0.48182464",
"0.48182464",
"0.4816613",
"0.48005098",
"0.47950038",
"0.4778857",
"0.47739747",
"0.4747212",
"0.47434172",
"0.47339746",
"0.46805528",
"0.46512184",
"0.4635555",
"0.46343172",
"0.4603746",
"0.45893723",
"0.45893723",
"0.4589358",
"0.45811197",
"0.45799658",
"0.45330402",
"0.45206055",
"0.45189837",
"0.4517931",
"0.45048997",
"0.44894725",
"0.44885203",
"0.44748363",
"0.44627932",
"0.44558832",
"0.44491094",
"0.44477195",
"0.44330916",
"0.44147828",
"0.44016263",
"0.43855843",
"0.43824485",
"0.4377467",
"0.4372965",
"0.4353469",
"0.43212622",
"0.43203107",
"0.43148094",
"0.4307925",
"0.42955273",
"0.42955273",
"0.42932805",
"0.428989",
"0.42898715",
"0.42870536",
"0.428464",
"0.4275037",
"0.42746508",
"0.42735413",
"0.42704844",
"0.4268162",
"0.42677486",
"0.4265505",
"0.42599458",
"0.42566398",
"0.42535353",
"0.4244763",
"0.42438528",
"0.4219226",
"0.4215903",
"0.4210979",
"0.42077723",
"0.42066824",
"0.42014423",
"0.41938972",
"0.4178394",
"0.41770142",
"0.41768566",
"0.41712815",
"0.41634867"
] | 0.703636 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_reservation
@reservation = Reservation.find(params[:reservation_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 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 action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 _handle_action_missing(*args); 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 call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def reservation_params
params.require(:reservation).permit(:start_date, :end_date, :paid, :equipment_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] | 0.0 | -1 |
validates :description, :browseable, :saleable, :category, presence: true | def as_json(options=nil)
super(include: [:size, :packs, :stocks])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 validate\n validates_presence([:title, :body])\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\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end",
"def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend",
"def valid?\n title_or_description.to_s != ''\n end",
"def check_title_and_description(params)\n if params[:title] == nil\n @errors << \"Title can't be empty\"\n end\n if params[:description] == nil\n @errors << \"You need to add description\"\n elsif params[:description].length < 20\n @errors << \"description can't be less than 20 characters\"\n end\nend",
"def design_data_filled_in?\n !self.description.blank? && \n !self.platform.blank? && \n !self.product_type.blank? && \n !self.project.blank? &&\n !self.design_directory.blank? &&\n !self.incoming_directory.blank?\n end",
"def valid_attributes\n #params.require(:cocktail).permit( :name, :address, :phone_number, :category)\n end",
"def valid?\n return false if @category.nil?\n return false if @institution_name.nil?\n return false if @name.nil?\n return false if @offer_link.nil?\n true\n end",
"def description_present\n if description.blank?\n errors.add(:description, \"Can't be empty\")\n end\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([{:target_market_name => self.target_market_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_target_market\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\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end",
"def valid?\n return false if @name.nil?\n return false if @slug.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])\n return false unless status_validator.valid?(@status)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['digital', 'physical'])\n return false unless type_validator.valid?(@type)\n return false if @sku.nil?\n return false if @price.nil?\n availability_validator = EnumAttributeValidator.new('String', ['available', 'comingSoon', 'retired'])\n return false unless availability_validator.valid?(@availability)\n stock_status_validator = EnumAttributeValidator.new('String', ['available', 'alert', 'unavailable'])\n return false unless stock_status_validator.valid?(@stock_status)\n return false if @categories.nil?\n true\n end",
"def the_event_must_have_at_least_one_description\n if des_es.empty? && des_eu.empty? && des_en.empty? && des_fr.empty?\n errors.add(:des_es, \"Please fill in the desciption at least in one language\")\n end\n if title_es.empty? && title_eu.empty? && title_en.empty? && title_fr.empty?\n errors.add(:des_es, \"Please fill in the desciption at least in one language\")\n end\n end",
"def publishing_requirements\n\t\tif is_published\n\t\t\terrors.add :first_name, I18n.t('models.profile.name_and_company.missing') if (first_name.blank? || last_name.blank?) && company_name.blank?\n\t\t\terrors.add :category, I18n.t('models.profile.category.missing') if categories.blank?\n\t\tend\n\tend",
"def subclass_validations ; true ; end",
"def validation; end",
"def validation; end",
"def validate\n super \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 valid?\n return false if @description.nil?\n return false if @description.to_s.length > 100\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless billing_method_validator.valid?(@billing_method)\n return false if !@po_number.nil? && @po_number.to_s.length > 25\n return true\n end",
"def valid?\n return false if @summary.nil?\n return false if @summary.to_s.length > 100\n record_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n return false unless record_type_validator.valid?(@record_type)\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n return false if @company.nil?\n return false if !@site_name.nil? && @site_name.to_s.length > 50\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@contact_phone_number.nil? && @contact_phone_number.to_s.length > 20\n return false if !@contact_phone_extension.nil? && @contact_phone_extension.to_s.length > 15\n return false if !@contact_email_address.nil? && @contact_email_address.to_s.length > 250\n severity_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless severity_validator.valid?(@severity)\n impact_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless impact_validator.valid?(@impact)\n return false if !@external_x_ref.nil? && @external_x_ref.to_s.length > 100\n return false if !@po_number.nil? && @po_number.to_s.length > 50\n return false if !@automatic_email_cc.nil? && @automatic_email_cc.to_s.length > 1000\n sub_billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless sub_billing_method_validator.valid?(@sub_billing_method)\n knowledge_base_link_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\", \"KnowledgeBaseArticle\", \"Time\", \"Activity\"])\n return false unless knowledge_base_link_type_validator.valid?(@knowledge_base_link_type)\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n predecessor_type_validator = EnumAttributeValidator.new('String', [\"Ticket\", \"Phase\"])\n return false unless predecessor_type_validator.valid?(@predecessor_type)\n return true\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @timezone.nil?\n return false if @timezone.to_s.length < 1\n return false if @currency.nil?\n return false if @currency.to_s.length < 1\n case_sensitivity_validator = EnumAttributeValidator.new('String', [\"sensitive\", \"insensitive-uppercase\", \"insensitive-lowercase\"])\n return false unless case_sensitivity_validator.valid?(@case_sensitivity)\n campaign_priority_validator = EnumAttributeValidator.new('String', [\"universal\", \"stackable\", \"exclusive\"])\n return false unless campaign_priority_validator.valid?(@campaign_priority)\n exclusive_campaigns_strategy_validator = EnumAttributeValidator.new('String', [\"listOrder\", \"lowestDiscount\", \"highestDiscount\"])\n return false unless exclusive_campaigns_strategy_validator.valid?(@exclusive_campaigns_strategy)\n default_discount_scope_validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n return false unless default_discount_scope_validator.valid?(@default_discount_scope)\n default_discount_additional_cost_per_item_scope_validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n return false unless default_discount_additional_cost_per_item_scope_validator.valid?(@default_discount_additional_cost_per_item_scope)\n true\n end",
"def valid?\n return false if @title_code.nil?\n return false if @_class.nil?\n _class_validator = EnumAttributeValidator.new('String', [\"Other\", \"Absolute\", \"Possessory\", \"Qualified\", \"Good\"])\n return false unless _class_validator.valid?(@_class)\n return false if @tenure.nil?\n tenure_validator = EnumAttributeValidator.new('String', [\"Other\", \"Freehold\", \"Leasehold\"])\n return false unless tenure_validator.valid?(@tenure)\n return false if @commonhold.nil?\n return false if @addresses.nil?\n return false if @is_not_main_title.nil?\n return true\n end",
"def category_params\n params.require(:category).permit(:name)\n # if want to create post, it need :user_id, :place_name, :place_type, :address, \n # :bedroom, :bath, :amenity, :cost_per_night,:description validation\n end",
"def validate_build\n end",
"def validate\n super\n end",
"def valid?\n @errors << :title if !@title.is_a?(String) || @title.empty?\n @errors << :author if !@author.is_a?(String) || @author.empty?\n @errors << :release_date unless @release_date.is_a?(Date)\n @errors << :publisher if !@publisher.is_a?(String) || @publisher.empty?\n @errors << :isbn unless @isbn.is_a?(Integer) && @isbn < 10**10 && @isbn >= 10**9\n \n @errors.empty?\n end",
"def valid?\n return false if @name.nil?\n return false if @value.nil?\n return false if @timestamp.nil?\n return false if @source_id.nil?\n return false if @source_label.nil?\n return false if @source.nil?\n source_validator = EnumAttributeValidator.new('String', [\"IMPORT\", \"API\", \"FORM\", \"ANALYTICS\", \"MIGRATION\", \"SALESFORCE\", \"INTEGRATION\", \"CONTACTS_WEB\", \"WAL_INCREMENTAL\", \"TASK\", \"EMAIL\", \"WORKFLOWS\", \"CALCULATED\", \"SOCIAL\", \"BATCH_UPDATE\", \"SIGNALS\", \"BIDEN\", \"DEFAULT\", \"COMPANIES\", \"DEALS\", \"ASSISTS\", \"PRESENTATIONS\", \"TALLY\", \"SIDEKICK\", \"CRM_UI\", \"MERGE_CONTACTS\", \"PORTAL_USER_ASSOCIATOR\", \"INTEGRATIONS_PLATFORM\", \"BCC_TO_CRM\", \"FORWARD_TO_CRM\", \"ENGAGEMENTS\", \"SALES\", \"HEISENBERG\", \"LEADIN\", \"GMAIL_INTEGRATION\", \"ACADEMY\", \"SALES_MESSAGES\", \"AVATARS_SERVICE\", \"MERGE_COMPANIES\", \"SEQUENCES\", \"COMPANY_FAMILIES\", \"MOBILE_IOS\", \"MOBILE_ANDROID\", \"CONTACTS\", \"ASSOCIATIONS\", \"EXTENSION\", \"SUCCESS\", \"BOT\", \"INTEGRATIONS_SYNC\", \"AUTOMATION_PLATFORM\", \"CONVERSATIONS\", \"EMAIL_INTEGRATION\", \"CONTENT_MEMBERSHIP\", \"QUOTES\", \"BET_ASSIGNMENT\", \"QUOTAS\", \"BET_CRM_CONNECTOR\", \"MEETINGS\", \"MERGE_OBJECTS\", \"RECYCLING_BIN\", \"ADS\", \"AI_GROUP\", \"COMMUNICATOR\", \"SETTINGS\", \"PROPERTY_SETTINGS\", \"PIPELINE_SETTINGS\", \"COMPANY_INSIGHTS\", \"BEHAVIORAL_EVENTS\", \"PAYMENTS\", \"GOALS\", \"PORTAL_OBJECT_SYNC\", \"APPROVALS\", \"FILE_MANAGER\", \"MARKETPLACE\", \"INTERNAL_PROCESSING\", \"FORECASTING\", \"SLACK_INTEGRATION\", \"CRM_UI_BULK_ACTION\", \"WORKFLOW_CONTACT_DELETE_ACTION\"])\n return false unless source_validator.valid?(@source)\n return false if @selected_by_user.nil?\n return false if @selected_by_user_timestamp.nil?\n return false if @source_vid.nil?\n return false if @source_metadata.nil?\n return false if @request_id.nil?\n true\n end",
"def validations\n {}\n end",
"def validate\n validate_summary\n validate_duration\n validate_kind\n validate_state\n validate_created_at\n\n super\n end",
"def category_params\n params.require(:category).permit(:description)\n end",
"def links_valid_params(params)\n if params[:link_name].strip == \"\" || params[:link_description].strip == \"\" || params[:category_name].strip == \"\"\n false\n else\n true\n end\n end",
"def valid_attributes\n {title: \"atitle\"}\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"OnQueueWork\", \"Break\", \"Meal\", \"Meeting\", \"OffQueueWork\", \"TimeOff\", \"Training\", \"Unavailable\", \"Unscheduled\"]\n if @scheduled_activity_category && !allowed_values.include?(@scheduled_activity_category)\n return false\n end\n \n \n \n \n \n allowed_values = [\"OnQueueWork\", \"Break\", \"Meal\", \"Meeting\", \"OffQueueWork\", \"TimeOff\", \"Training\", \"Unavailable\", \"Unscheduled\"]\n if @actual_activity_category && !allowed_values.include?(@actual_activity_category)\n return false\n end\n \n \n \n \n \n allowed_values = [\"Available\", \"Away\", \"Busy\", \"Offline\", \"Idle\", \"OnQueue\", \"Meal\", \"Training\", \"Meeting\", \"Break\"]\n if @system_presence && !allowed_values.include?(@system_presence)\n return false\n end\n \n \n \n \n \n \n \n \n \n allowed_values = [\"Positive\", \"Negative\", \"Neutral\", \"Unknown\"]\n if @impact && !allowed_values.include?(@impact)\n return false\n end\n \n \n \n \n \n \n \n end",
"def valid_save?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n if self.general_info.nil? || self.general_info == \"\"\n valid = false\n end\n\n if self.technical_specs.nil? || self.technical_specs == \"\"\n valid = false\n end\n\n if self.where_to_buy.nil? || self.where_to_buy == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n return false if !@channel_partner_item_id.nil? && @channel_partner_item_id.to_s.length > 30\n return false if !@country_code_of_origin.nil? && @country_code_of_origin.to_s.length > 2\n return false if !@description.nil? && @description.to_s.length > 2000\n return false if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20\n return false if !@parent_merchant_item_id.nil? && @parent_merchant_item_id.to_s.length > 20\n return false if !@perishable_class.nil? && @perishable_class.to_s.length > 50\n return false if !@quickbooks_class.nil? && @quickbooks_class.to_s.length > 31\n tax_product_type_validator = EnumAttributeValidator.new('String', ['', 'digital', 'physical', 'service'])\n return false unless tax_product_type_validator.valid?(@tax_product_type)\n true\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end",
"def valid?\n return false if !@adwords_grouping.nil? && @adwords_grouping.to_s.length > 50\n return false if !@adwords_label1.nil? && @adwords_label1.to_s.length > 50\n return false if !@adwords_label2.nil? && @adwords_label2.to_s.length > 50\n return false if !@adwords_label3.nil? && @adwords_label3.to_s.length > 50\n return false if !@adwords_label4.nil? && @adwords_label4.to_s.length > 50\n return false if !@adwords_label5.nil? && @adwords_label5.to_s.length > 50\n return false if !@age_group.nil? && @age_group.to_s.length > 5\n return false if !@book_author.nil? && @book_author.to_s.length > 50\n return false if !@book_format.nil? && @book_format.to_s.length > 50\n return false if !@book_isbn.nil? && @book_isbn.to_s.length > 20\n return false if !@book_publisher.nil? && @book_publisher.to_s.length > 50\n return false if !@category_description.nil? && @category_description.to_s.length > 1000\n return false if !@color.nil? && @color.to_s.length > 20\n return false if !@condition.nil? && @condition.to_s.length > 15\n return false if !@custom_label0.nil? && @custom_label0.to_s.length > 50\n return false if !@custom_label1.nil? && @custom_label1.to_s.length > 50\n return false if !@custom_label2.nil? && @custom_label2.to_s.length > 50\n return false if !@custom_label3.nil? && @custom_label3.to_s.length > 50\n return false if !@custom_label4.nil? && @custom_label4.to_s.length > 50\n return false if !@gender.nil? && @gender.to_s.length > 6\n return false if !@google_product_category.nil? && @google_product_category.to_s.length > 250\n return false if !@music_artist.nil? && @music_artist.to_s.length > 50\n return false if !@music_format.nil? && @music_format.to_s.length > 5\n return false if !@product_type.nil? && @product_type.to_s.length > 10\n return false if !@promotion_id1.nil? && @promotion_id1.to_s.length > 30\n return false if !@promotion_id10.nil? && @promotion_id10.to_s.length > 30\n return false if !@promotion_id2.nil? && @promotion_id2.to_s.length > 30\n return false if !@promotion_id3.nil? && @promotion_id3.to_s.length > 30\n return false if !@promotion_id4.nil? && @promotion_id4.to_s.length > 30\n return false if !@promotion_id5.nil? && @promotion_id5.to_s.length > 30\n return false if !@promotion_id6.nil? && @promotion_id6.to_s.length > 30\n return false if !@promotion_id7.nil? && @promotion_id7.to_s.length > 30\n return false if !@promotion_id8.nil? && @promotion_id8.to_s.length > 30\n return false if !@promotion_id9.nil? && @promotion_id9.to_s.length > 30\n return false if !@search_lowest_url.nil? && @search_lowest_url.to_s.length > 250\n return false if !@size.nil? && @size.to_s.length > 20\n return false if !@video_director.nil? && @video_director.to_s.length > 50\n return false if !@video_format.nil? && @video_format.to_s.length > 5\n return false if !@video_rating.nil? && @video_rating.to_s.length > 5\n return false if !@video_starring.nil? && @video_starring.to_s.length > 150\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @title.nil?\n return false if @title.to_s.length < 1\n return false if @image.nil?\n return false if @image.to_s.length < 1\n return false if @image_type.nil?\n return false if @image_type.to_s.length < 1\n return false if @servings.nil?\n return false if @ready_in_minutes.nil?\n return false if @license.nil?\n return false if @license.to_s.length < 1\n return false if @source_name.nil?\n return false if @source_name.to_s.length < 1\n return false if @source_url.nil?\n return false if @source_url.to_s.length < 1\n return false if @spoonacular_source_url.nil?\n return false if @spoonacular_source_url.to_s.length < 1\n return false if @aggregate_likes.nil?\n return false if @health_score.nil?\n return false if @spoonacular_score.nil?\n return false if @price_per_serving.nil?\n return false if @cheap.nil?\n return false if @credits_text.nil?\n return false if @credits_text.to_s.length < 1\n return false if @dairy_free.nil?\n return false if @gaps.nil?\n return false if @gaps.to_s.length < 1\n return false if @gluten_free.nil?\n return false if @instructions.nil?\n return false if @ketogenic.nil?\n return false if @low_fodmap.nil?\n return false if @sustainable.nil?\n return false if @vegan.nil?\n return false if @vegetarian.nil?\n return false if @very_healthy.nil?\n return false if @very_popular.nil?\n return false if @whole30.nil?\n return false if @weight_watcher_smart_points.nil?\n return false if !@extended_ingredients.nil? && @extended_ingredients.length < 0\n return false if @summary.nil?\n return false if @summary.to_s.length < 1\n true\n end",
"def validate\n super\n validates_presence [:code, :preference, :type_param_id, :application_id]\n end",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end",
"def validate\n if( title =~ /^hc12/ || title =~ /^bthfck2/ )\n errors.add_to_base(\"Titles which begin with 'hc12' or 'bthfck2' are reserved!\" )\n end\n \n if( title =~ /[^\\s^_A-Z^a-z^0-9^-]/ )\n errors.add_to_base(\"Only digits, characters, '-' and blanks are allowed for the title!\")\n end\n\n if( ( bundle = Bundle.find_by_title(title) ) != nil )\n if( bundle.created_by_user_id != user_id )\n errors.add_to_base(\"This title is already used! Choose another one.\")\n end\n end\n \n if content_type\n unless( content_type =~ /^image\\/(png)|(jpeg)|(gif)/i )\n errors.add_to_base(\"Images must have the format jpg, png or gif\")\n end\n \n unless was_upload_successful\n errors.add_to_base(\"Image file is too big. It must be smaller then 300K\")\n end\n \n end\n \n end",
"def is_valid; end",
"def nature_of_business=(nature_of_business)\n validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n unless validator.valid?(nature_of_business) || nature_of_business.empty?\n fail ArgumentError, \"invalid value for \\\"nature_of_business\\\", must be one of #{validator.allowable_values}.\"\n end\n @nature_of_business = nature_of_business\n end",
"def valid?\n return false if !@invoice_number.nil? && @invoice_number.to_s.length > 15\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"Agreement\", \"CreditMemo\", \"DownPayment\", \"Miscellaneous\", \"Progress\", \"Standard\"])\n return false unless type_validator.valid?(@type)\n return false if @company.nil?\n apply_to_type_validator = EnumAttributeValidator.new('String', [\"All\", \"Agreement\", \"Project\", \"ProjectPhase\", \"SalesOrder\", \"Ticket\"])\n return false unless apply_to_type_validator.valid?(@apply_to_type)\n return false if !@attention.nil? && @attention.to_s.length > 60\n return false if !@reference.nil? && @reference.to_s.length > 50\n return false if !@customer_po.nil? && @customer_po.to_s.length > 50\n return true\n end",
"def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\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([{:treatment_type_code => self.treatment_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_treatment_type\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 valid_attributes\n {name: \"Businesses\"}\n end",
"def valid?\n return false unless (valid_string? @title) &&\n (valid_string? @author) &&\n (valid_date? @release_date) &&\n (valid_string? @publisher) &&\n (valid_integer? @isbn)\n true\n end",
"def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend",
"def validate\n \n \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([{:commodity_code => self.commodity_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_commodity\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 additional_controls # \n if kats.nil? or kats.size == 0\n# errors.add('kats', 'At least one category should be selected!')\n end\n if text_over\n errors.add('css_over', 'helpers.help.rotator.css_over_error') if css_over.blank?\n errors.add('picture', 'helpers.help.rotator.picture_error') if picture.blank?\n end\nend",
"def story_validations_required?\n self.instance_of? Story\n end",
"def test_necessary_existence_of_description\n @composer.role_type_desc = nil\n assert !@composer.save\n check_for_error_messages([\"can't be blank\", \"is too short (minimum is 2 characters)\"], @composer, :role_type_desc)\n end",
"def has_categories?\n errors.add(:categories, \"An operation must have some categories.\") if self.categories.empty?\n end",
"def validate\n # Not not perform basic Api::Product validations\n end",
"def category_params\n params.require(:category).permit(:description)\n end",
"def basic_validations\n if title.blank?\n errors.add(:title, 'Title cannot be blank.')\n else\n self.menu_name = self.title if menu_name.blank?\n self.shortcut = self.title.parameterize.html_safe if shortcut.blank?\n errors.add(:shortcut, \"Shortcut cannot contain spaces\") if shortcut.include? \" \"\n errors.add(:shortcut, \"Shortcut cannot contain slashes\") if shortcut.include? \"/\"\n errors.add(:shortcut, \"Shortcut cannot contain '?'\") if shortcut.include? \"?\"\n end\n end",
"def item_category_params\n params.require(:item_category).permit(:name, :description)\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate_params(hash)\n hash.include?('title') and hash.include?('body') and hash.include?('category')\n end",
"def validate\n\n end",
"def valid_create?\n param! :sku_id, Integer, blank: false\n param! :price, Float, blank: false\n param! :discount, Float, blank: false\n end",
"def validate\n end",
"def validate\n !discount_code.nil? && discount.nil? ? raise(InvalidDiscountCode, \"There is no discount with that code\") : true\n end",
"def validations\n valid_page_number? if page_number\n valid_period_name? if period_param\n valid_date? if date_param\n end",
"def is_valid?\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([{:artist_name => self.artist_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_artist\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 required_fields\n [:recipe, :ingredient]\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def extra_validations\n success\n end",
"def validations\n {\n 'Plan' => {\n 'Name' => 'string'\n },\n 'Company' => {\n 'Name' => 'string'\n }\n }\n end",
"def validate\r\n\r\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if !@description.nil? && @description.to_s.length > 255\n true\n end",
"def test_should_require_description\n link = create(:description => nil)\n assert link.errors.invalid?(:description), \":description should be required\"\n assert_invalid link, \"link shouldn't be created\"\n end",
"def valid?\n return false if @category.nil?\n return false if @extension.nil?\n return false if @height.nil?\n return false if @length.nil?\n return false if @location.nil?\n return false if @name.nil?\n privacy_validator = EnumAttributeValidator.new('String', [\"private\", \"friends\", \"public\"])\n return false unless privacy_validator.valid?(@privacy)\n return false if @width.nil?\n return true\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([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_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_rmt_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:id => self.id}],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_season\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 is_valid?(feature)\n !feature.description.blank?\n end",
"def validate\n\t#first check whether combo fields have been selected\n\t is_valid = true\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:farm_code => self.farm_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rmt_variety_code => self.rmt_variety_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pack_material_product_code => self.pack_material_product_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code}],self)\n\t end\n\n\t #now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_farm\n\t end\n\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\n\t if is_valid\n\t\t is_valid = set_pack_material_product\n\t end\n\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\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 item_types_slug_validation\n return unless catalog\n\n return unless catalog.item_types.exists?(slug: slug)\n\n errors.add :slug, I18n.t(\"validations.page.item_types_slug\")\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bck_[a-zA-Z0-9]+$/)\n return false if @auto_reorder.nil?\n return false if @threshold_amount.nil?\n return false if @url.nil?\n return false if @url.to_s.length > 2083\n return false if @url.to_s.length < 1\n return false if @raw_url.nil?\n return false if @raw_url.to_s.length > 2083\n return false if @raw_url.to_s.length < 1\n return false if @front_original_url.nil?\n return false if @front_original_url.to_s.length > 2083\n return false if @front_original_url.to_s.length < 1\n return false if @back_original_url.nil?\n return false if @back_original_url.to_s.length > 2083\n return false if @back_original_url.to_s.length < 1\n return false if @thumbnails.nil?\n return false if @available_quantity.nil?\n return false if @allocated_quantity.nil?\n return false if @onhand_quantity.nil?\n return false if @pending_quantity.nil?\n return false if @projected_quantity.nil?\n return false if @buckslip_orders.nil?\n return false if @buckslip_orders.length < 0\n return false if @stock.nil?\n stock_validator = EnumAttributeValidator.new('String', [\"text\", \"cover\"])\n return false unless stock_validator.valid?(@stock)\n return false if @weight.nil?\n weight_validator = EnumAttributeValidator.new('String', [\"80#\"])\n return false unless weight_validator.valid?(@weight)\n return false if @finish.nil?\n finish_validator = EnumAttributeValidator.new('String', [\"gloss\", \"matte\"])\n return false unless finish_validator.valid?(@finish)\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', [\"processed\", \"rendered\"])\n return false unless status_validator.valid?(@status)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"buckslip\"])\n return false unless object_validator.valid?(@object)\n return false if @description.to_s.length > 255\n size_validator = EnumAttributeValidator.new('String', [\"8.75x3.75\"])\n return false unless size_validator.valid?(@size)\n true\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([{:commodity_code => self.commodity_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_spray_program_result\n\t end\nend",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def valid?\n return false if @pricing_component_type.nil?\n pricing_component_type_validator = EnumAttributeValidator.new('String', [\"setup\", \"subscription\", \"arrears\", \"usage\"])\n return false unless pricing_component_type_validator.valid?(@pricing_component_type)\n return false if @charge_type.nil?\n charge_type_validator = EnumAttributeValidator.new('String', [\"Credit\", \"Debit\"])\n return false unless charge_type_validator.valid?(@charge_type)\n return false if @period_start.nil?\n return false if @period_end.nil?\n return false if @invoice_id.nil?\n return false if @organization_id.nil?\n return false if @name.nil?\n return false if @description.nil?\n return false if @calculation.nil?\n return false if @cost.nil?\n return false if @tax.nil?\n return false if @component_value.nil?\n return false if @pricing_component_id.nil?\n return false if @public_pricing_component_name.nil?\n return false if @pricing_component_name.nil?\n return false if @subscription_charge_id.nil?\n return false if @child_invoice_id.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"PricingComponent\", \"Coupon\", \"Migration\", \"AggregatedInvoice\"])\n return false unless type_validator.valid?(@type)\n return true\n end",
"def item_params\n params.require(:item).permit(:description, :price, :stockQty)\n #validates :price, presence: true\n #validates :description, presence: true\n #validates :stockQty, presence: true\n end",
"def description\n \"validate the presence of any of these attributes: #{attributes.join(', ')}\"\n end",
"def set_description?\n description.nil? || description.empty?\n end"
] | [
"0.7373321",
"0.66990507",
"0.633484",
"0.63333195",
"0.63276315",
"0.6313059",
"0.6274657",
"0.62730753",
"0.6257874",
"0.6254055",
"0.62496096",
"0.6218312",
"0.62084687",
"0.615548",
"0.61207247",
"0.6120579",
"0.6118149",
"0.6026975",
"0.6026975",
"0.6014819",
"0.59984887",
"0.59895116",
"0.5977604",
"0.59489375",
"0.59399396",
"0.5917151",
"0.5916747",
"0.5913229",
"0.5903256",
"0.5902276",
"0.58856374",
"0.58840847",
"0.58830184",
"0.5881975",
"0.58810776",
"0.58697265",
"0.58566153",
"0.58477336",
"0.58386314",
"0.58356327",
"0.58331805",
"0.5831591",
"0.5829463",
"0.5827904",
"0.58235884",
"0.5818937",
"0.5818717",
"0.5817056",
"0.5814567",
"0.5812539",
"0.58110905",
"0.5804686",
"0.58043444",
"0.5799955",
"0.5783332",
"0.57785857",
"0.5776183",
"0.57752734",
"0.5771888",
"0.57686675",
"0.57472056",
"0.57442355",
"0.5741579",
"0.57393056",
"0.5738548",
"0.5738548",
"0.5738548",
"0.5737669",
"0.5737669",
"0.5737669",
"0.5737669",
"0.57336766",
"0.5731864",
"0.5727632",
"0.57274395",
"0.5725389",
"0.5718609",
"0.57147086",
"0.57118225",
"0.57114184",
"0.571015",
"0.571015",
"0.571015",
"0.57084584",
"0.57042104",
"0.57006735",
"0.5697268",
"0.56876236",
"0.5681136",
"0.5673398",
"0.56666523",
"0.56620115",
"0.5661907",
"0.5659292",
"0.56562907",
"0.5651889",
"0.5651889",
"0.56518096",
"0.56486696",
"0.56479067",
"0.5644161"
] | 0.0 | -1 |
GET /sections or /sections.json | def index
@menu = Menu.find(params[:menu_id])
@sections = @menu.sections
render json: SectionSerializer.new(@sections)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def list_sections(opts = {})\n data, _status_code, _headers = list_sections_with_http_info(opts)\n data\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def show\n @sections = Section.find(params[:id])\n end",
"def get_page\n render_page_sections_json\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def show\n respond_to do |format|\n format.html { render html: @section }\n format.json { render json: @section }\n end\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\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 SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def list_sections\n \n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def show\r\n @section = Section.find_by_id(params[:id])\r\n @lesson = @section.lesson\r\n @activities = @section.activities\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\n end",
"def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def index\n @sections=Section.all\n end",
"def show\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu_section }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def show\n @section = Section.includes(:profile).find(params[:id])\n # @teachers = @section.teachers.page(params[:page])\n @users = @section.students.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def show\n @page = Page.find(params[:id])\n @section = @page.section\n\n respond_to do |format|\n format.html { render :template => 'sections/show' }\n format.xml { render :xml => @page }\n end\n end",
"def index\n #@sections = Section.find(params[:course_id])\n #@sections = Section.all\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def show\n @sections = @course.sections.all.to_a\n end",
"def show\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_category }\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def show\n @encyclopaedia = Encyclopaedia.find(params[:id])\n @sections = @encyclopaedia.sections.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encyclopaedia}\n end\n end",
"def index\n @sections = @page.sections.sorted\n end",
"def sections\n parsed {\n @sections\n }\n end",
"def index\n @srsaas = Srsaa.all\n @srsaas = Srsaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsaas }\n end\n end",
"def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"def index\n @form_sections = FormSection.all\n respond_with( @form_sections )\n end",
"def get_sections(request)\n data, _status_code, _headers = get_sections_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def get_sections(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_sections_with_http_info(name, password, folder, storage)\n data\n end",
"def list_by_sections\n\n @list_options = Section.find_alpha\n\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view] then\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[0].id\n end\n\n @section = Section.find(:first, :conditions => [\"#{Section.connection.quote_column_name(\"id\")}=?\", @viewing_by])\n if @section == nil then\n\t\t\tredirect_to :action => 'list'\n\t\t\treturn\n end\n\n @title = \"Content List For Section - '#{@section.name}'\"\n\n conditions = nil\n\n session[:last_content_list_view] = @viewing_by\n\n # Paginate that will work with will_paginate...yee!\n per_page = 30\n list = @section.content_nodes\n pager = Paginator.new(list, list.size, per_page, params[:page])\n @content_nodes = WillPaginate::Collection.new(params[:page] || 1, per_page, list.size) do |p|\n p.replace list[pager.current.offset, pager.items_per_page]\n end\n \n render :action => 'list'\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def send_overview(path)\n response = self.create_section_response\n public_section = DocumentSection.from_path(path, :include => \"Departments\")\n public_section.name = path.split(\"/\")[1]\n response[:sections] << public_section\n return response\n end",
"def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"def index\n @page_sections = PageSection.all\n end",
"def show\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_section }\n end\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_exam_sections(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_SECTIONS % [user_id, course_id, exam_id])\r\n end",
"def show\n redirect_to sections_story_path(params[:id])\n # @story = Story.find_by_id(params[:id])\n\n # respond_to do |format|\n # format.html #show.html.erb\n # format.json { render json: @story }\n # end\n end",
"def fetch_section(section)\n if guardian_sections.include? section\n response = $redis.get(\"news_#{section}\")\n if response.nil?\n @section = \"§ion=\" + section.to_s\n base_uri = \"http://content.guardianapis.com/search?order-by=newest&type=article\"\n response = JSON.generate(HTTParty.get(base_uri + @section + \"&api-key=\" + ENV['GUARDIAN_API_KEY'])[\"response\"][\"results\"])\n $redis.set(\"news_#{section}\", response)\n $redis.expire(\"news_#{section}\", 1.hours.to_i)\n end\n @response = JSON.load(response)\n else\n fetch_articles\n end\n end",
"def sections\n @body.xpath('.//a:section', a: NS)\n end",
"def sections\n @pages.collect { |p| p.sections }.flatten\n end",
"def index\n @srsas = Srsa.all\n @srsas = Srsa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsas }\n end\n end",
"def show\n @section = Section.find(params[:id]) \t\n @nav_sections = Section.where(scenario_id: @section.scenario_id).order(:order)\n @inquests = Inquest.where(section_id: params[:id]).order(:order)\n @scenario = Scenario.where(id: @section.scenario_id)[0]\n end",
"def show\n @section_event = SectionEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_event }\n end\n end",
"def sections\n @sections.values\n end",
"def index\n @about_us_sections = AboutUsSection.all\n end",
"def index\n @sections = Section.order(\"position asc\")\n\n authorize Section\n end",
"def show\n @sections = Section.where(\"course_id = ?\", params[:course_id])\n\n end",
"def index\n @title = \"Prima Lingua: Viewing all sections\"\n if teacher_signed_in?\n @teacher = Teacher.find(current_teacher)\n @sections = Section.where(:teacher_id => @teacher.id)\n elsif params[:teacher_id]\n @teacher = Teacher.find(:teacher_id)\n @sections = Section.where(:teacher_id => @teacher.id)\n elsif admin_signed_in?\n @sections = Section.all\n end\n render_flex_layout\n end",
"def index\n @post = find_post\n @post_sections = @post.sections\n end",
"def index\n @section_comments = SectionComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_comments }\n end\n end",
"def test_list_by_section\n a_section = sections(:pseudoscientific_claims)\n \n get :list_by_section, :section_name => a_section.name\n assert_response :success\n assert_equal assigns(:title), \"Blog entries for #{a_section.name}\"\n assert_template 'index.rhtml'\n assert_not_nil assigns(:content_nodes)\n \n # Assert the blog posts are being shown.\n assert assigns(:sections).size > 0\n assert_select \"a\", :count => 1, :text => content_nodes(:pigasus_awards).title\n assert_select \"a\", :count => 1, :text => content_nodes(:silent_birth).title\n\n\n # Now using an invalid name.\n get :list_by_section, :section_name => \"bleargh\"\n assert_response :missing\n end",
"def show\n if params[:short_url]\n @shop_section = ShopSection.find_by_short_url(params[:short_url])\n else\n @shop_section = ShopSection.find(params[:id])\n end\n\n raise NotFound unless @shop_section\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_section }\n end\n end",
"def index\n @cms_page_sections = Cms::PageSection.all\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end",
"def index\n @lab_sections = LabSection.all\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def index\n if current_user.has_role? :admin\n @sectionalizations = Sectionalization.all\n else\n @classroom = Classroom.find(session[:classroom_id])\n @sectionalizations = Sectionalization.where(classroom_id: @classroom.id)\n session[:sectionalization_id] = nil\n end\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\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 SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @lbaas = Lbaa.all\n @lbaas = Lbaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbaas }\n end\n end",
"def index\n @user_sections = UserSection.all\n end",
"def index_section\n cache_for 10.minutes\n\n @presenter = ReaderAidsPresenter::IndexSectionPresenter.new(\n section_identifier: params[:section]\n )\n\n render locals: {presenter: @presenter}\n end",
"def index\n @discipline_sections = DisciplineSection.all\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @survey_sections = SurveySection.page(params[:page]).per(100)\n end",
"def show\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n end",
"def sections_url\n return @sections_url\n end",
"def section_by_id(section_id = @one_section_id)\n url = @url_sections + '/' + section_id\n @nsx_client.get(url)\n end",
"def list_sections_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.list_sections ...'\n end\n if @api_client.config.client_side_validation && opts[:'enforced_on'] && !['VIF', 'LOGICALROUTER', 'BRIDGEENDPOINT', 'DHCP_SERVICE', 'METADATA_PROXY', 'L2VPN_SESSION', 'NONE'].include?(opts[:'enforced_on'])\n fail ArgumentError, 'invalid value for \"enforced_on\", must be one of VIF, LOGICALROUTER, BRIDGEENDPOINT, DHCP_SERVICE, METADATA_PROXY, L2VPN_SESSION, NONE'\n end\n if @api_client.config.client_side_validation && opts[:'exclude_applied_to_type'] && !['NSGroup', 'LogicalSwitch', 'LogicalRouter', 'LogicalPort'].include?(opts[:'exclude_applied_to_type'])\n fail ArgumentError, 'invalid value for \"exclude_applied_to_type\", must be one of NSGroup, LogicalSwitch, LogicalRouter, LogicalPort'\n end\n if @api_client.config.client_side_validation && opts[:'filter_type'] && !['FILTER', 'SEARCH'].include?(opts[:'filter_type'])\n fail ArgumentError, 'invalid value for \"filter_type\", must be one of FILTER, SEARCH'\n end\n if @api_client.config.client_side_validation && opts[:'include_applied_to_type'] && !['NSGroup', 'LogicalSwitch', 'LogicalRouter', 'LogicalPort'].include?(opts[:'include_applied_to_type'])\n fail ArgumentError, 'invalid value for \"include_applied_to_type\", must be one of NSGroup, LogicalSwitch, LogicalRouter, LogicalPort'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesFirewallApi.list_sections, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesFirewallApi.list_sections, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['LAYER2', 'LAYER3'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of LAYER2, LAYER3'\n end\n # resource path\n local_var_path = '/firewall/sections'\n\n # query parameters\n query_params = {}\n query_params[:'applied_tos'] = opts[:'applied_tos'] if !opts[:'applied_tos'].nil?\n query_params[:'context_profiles'] = opts[:'context_profiles'] if !opts[:'context_profiles'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'deep_search'] = opts[:'deep_search'] if !opts[:'deep_search'].nil?\n query_params[:'destinations'] = opts[:'destinations'] if !opts[:'destinations'].nil?\n query_params[:'enforced_on'] = opts[:'enforced_on'] if !opts[:'enforced_on'].nil?\n query_params[:'exclude_applied_to_type'] = opts[:'exclude_applied_to_type'] if !opts[:'exclude_applied_to_type'].nil?\n query_params[:'extended_sources'] = opts[:'extended_sources'] if !opts[:'extended_sources'].nil?\n query_params[:'filter_type'] = opts[:'filter_type'] if !opts[:'filter_type'].nil?\n query_params[:'include_applied_to_type'] = opts[:'include_applied_to_type'] if !opts[:'include_applied_to_type'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'locked'] = opts[:'locked'] if !opts[:'locked'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'search_invalid_references'] = opts[:'search_invalid_references'] if !opts[:'search_invalid_references'].nil?\n query_params[:'search_scope'] = opts[:'search_scope'] if !opts[:'search_scope'].nil?\n query_params[:'services'] = opts[:'services'] if !opts[:'services'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sources'] = opts[:'sources'] if !opts[:'sources'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSectionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#list_sections\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @tutorial_sections = TutorialSection.all\n end",
"def subsections\n Section.where(parent_id: id)\n end"
] | [
"0.7767557",
"0.72896004",
"0.7129679",
"0.7129679",
"0.6987889",
"0.68669957",
"0.68669957",
"0.68669957",
"0.68408567",
"0.6811863",
"0.6730119",
"0.67064166",
"0.66492844",
"0.66475123",
"0.6639673",
"0.6639673",
"0.6639673",
"0.6639673",
"0.6639673",
"0.6639673",
"0.6639673",
"0.6586922",
"0.6578689",
"0.64933014",
"0.64609784",
"0.6455721",
"0.64333147",
"0.6350244",
"0.63220936",
"0.63072187",
"0.6281956",
"0.62765634",
"0.6272018",
"0.6245441",
"0.6198804",
"0.61818933",
"0.6178685",
"0.61740446",
"0.61585253",
"0.6148563",
"0.61362505",
"0.61223924",
"0.61168116",
"0.61031425",
"0.60997665",
"0.6095274",
"0.6044119",
"0.60366535",
"0.6016826",
"0.60163635",
"0.60044324",
"0.60013163",
"0.59871435",
"0.5967849",
"0.59658504",
"0.59658504",
"0.5958972",
"0.59523576",
"0.59167624",
"0.59167624",
"0.59137857",
"0.5904335",
"0.5898436",
"0.5891718",
"0.5853242",
"0.5842129",
"0.5836537",
"0.58326316",
"0.5809906",
"0.58059776",
"0.5803888",
"0.5788752",
"0.5779819",
"0.5761777",
"0.57238036",
"0.5719817",
"0.5698709",
"0.56957877",
"0.5693984",
"0.56741333",
"0.56733894",
"0.5667937",
"0.5654229",
"0.56517744",
"0.56465894",
"0.5621952",
"0.5617082",
"0.56112593",
"0.5599488",
"0.55977875",
"0.5589979",
"0.5587119",
"0.5580294",
"0.5572888",
"0.5568188",
"0.55540085",
"0.5550367",
"0.55457234",
"0.554212",
"0.55393636"
] | 0.67724836 | 10 |
GET /sections/1 or /sections/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def show\n @sections = Section.find(params[:id])\n end",
"def show\n respond_to do |format|\n format.html { render html: @section }\n format.json { render json: @section }\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def show\r\n @section = Section.find_by_id(params[:id])\r\n @lesson = @section.lesson\r\n @activities = @section.activities\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\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 SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def show\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def list_sections\n \n end",
"def show\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu_section }\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def index\n #@sections = Section.find(params[:course_id])\n #@sections = Section.all\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def list_sections(opts = {})\n data, _status_code, _headers = list_sections_with_http_info(opts)\n data\n end",
"def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def show\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_category }\n end\n end",
"def show\n @page = Page.find(params[:id])\n @section = @page.section\n\n respond_to do |format|\n format.html { render :template => 'sections/show' }\n format.xml { render :xml => @page }\n end\n end",
"def show\n @section = Section.includes(:profile).find(params[:id])\n # @teachers = @section.teachers.page(params[:page])\n @users = @section.students.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def fetch_section(section)\n if guardian_sections.include? section\n response = $redis.get(\"news_#{section}\")\n if response.nil?\n @section = \"§ion=\" + section.to_s\n base_uri = \"http://content.guardianapis.com/search?order-by=newest&type=article\"\n response = JSON.generate(HTTParty.get(base_uri + @section + \"&api-key=\" + ENV['GUARDIAN_API_KEY'])[\"response\"][\"results\"])\n $redis.set(\"news_#{section}\", response)\n $redis.expire(\"news_#{section}\", 1.hours.to_i)\n end\n @response = JSON.load(response)\n else\n fetch_articles\n end\n end",
"def index\n @sections=Section.all\n end",
"def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\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 show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def index\n @srsaas = Srsaa.all\n @srsaas = Srsaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsaas }\n end\n end",
"def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end",
"def show\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_section }\n end\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def show\n @section = Section.find(params[:id]) \t\n @nav_sections = Section.where(scenario_id: @section.scenario_id).order(:order)\n @inquests = Inquest.where(section_id: params[:id]).order(:order)\n @scenario = Scenario.where(id: @section.scenario_id)[0]\n end",
"def show\n redirect_to sections_story_path(params[:id])\n # @story = Story.find_by_id(params[:id])\n\n # respond_to do |format|\n # format.html #show.html.erb\n # format.json { render json: @story }\n # end\n end",
"def show\n @sections = @course.sections.all.to_a\n end",
"def section_by_id(section_id = @one_section_id)\n url = @url_sections + '/' + section_id\n @nsx_client.get(url)\n end",
"def show\n @title = \"Prima Lingua: #{@section.name}\"\n if params[:unit_id]\n @overview_unit = Unit.find(params[:unit_id])\n else\n @overview_unit = @section.lesson.unit\n end\n respond_to do |format|\n format.html { render_flex_layout }\n format.json { render :json => @section }\n end\n end",
"def test_list_by_section\n a_section = sections(:pseudoscientific_claims)\n \n get :list_by_section, :section_name => a_section.name\n assert_response :success\n assert_equal assigns(:title), \"Blog entries for #{a_section.name}\"\n assert_template 'index.rhtml'\n assert_not_nil assigns(:content_nodes)\n \n # Assert the blog posts are being shown.\n assert assigns(:sections).size > 0\n assert_select \"a\", :count => 1, :text => content_nodes(:pigasus_awards).title\n assert_select \"a\", :count => 1, :text => content_nodes(:silent_birth).title\n\n\n # Now using an invalid name.\n get :list_by_section, :section_name => \"bleargh\"\n assert_response :missing\n end",
"def show\n @encyclopaedia = Encyclopaedia.find(params[:id])\n @sections = @encyclopaedia.sections.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encyclopaedia}\n end\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def show\n @sections = Section.where(\"course_id = ?\", params[:course_id])\n\n end",
"def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"def index_section\n cache_for 10.minutes\n\n @presenter = ReaderAidsPresenter::IndexSectionPresenter.new(\n section_identifier: params[:section]\n )\n\n render locals: {presenter: @presenter}\n end",
"def show\n @section_event = SectionEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_event }\n end\n end",
"def show\n if params[:short_url]\n @shop_section = ShopSection.find_by_short_url(params[:short_url])\n else\n @shop_section = ShopSection.find(params[:id])\n end\n\n raise NotFound unless @shop_section\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_section }\n end\n end",
"def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end",
"def show\n @section = Section.find(params[:id])\n\t\t@page = @section.pages[0]\n end",
"def list_by_sections\n\n @list_options = Section.find_alpha\n\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view] then\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[0].id\n end\n\n @section = Section.find(:first, :conditions => [\"#{Section.connection.quote_column_name(\"id\")}=?\", @viewing_by])\n if @section == nil then\n\t\t\tredirect_to :action => 'list'\n\t\t\treturn\n end\n\n @title = \"Content List For Section - '#{@section.name}'\"\n\n conditions = nil\n\n session[:last_content_list_view] = @viewing_by\n\n # Paginate that will work with will_paginate...yee!\n per_page = 30\n list = @section.content_nodes\n pager = Paginator.new(list, list.size, per_page, params[:page])\n @content_nodes = WillPaginate::Collection.new(params[:page] || 1, per_page, list.size) do |p|\n p.replace list[pager.current.offset, pager.items_per_page]\n end\n \n render :action => 'list'\n end",
"def show\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n end",
"def index\n @sections = @page.sections.sorted\n end",
"def sections\n parsed {\n @sections\n }\n end",
"def index\n @srsas = Srsa.all\n @srsas = Srsa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsas }\n end\n end",
"def get_exam_sections(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_SECTIONS % [user_id, course_id, exam_id])\r\n end",
"def get_single_submission_sections(section_id,assignment_id,user_id,include,opts={})\n query_param_keys = [\n :include\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"section_id is required\" if section_id.nil?\n raise \"assignment_id is required\" if assignment_id.nil?\n raise \"user_id is required\" if user_id.nil?\n raise \"include is required\" if include.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :section_id => section_id,\n :assignment_id => assignment_id,\n :user_id => user_id,\n :include => include\n )\n\n # resource path\n path = path_replace(\"/v1/sections/{section_id}/assignments/{assignment_id}/submissions/{user_id}\",\n :section_id => section_id,\n :assignment_id => assignment_id,\n :user_id => user_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n @form_sections = FormSection.all\n respond_with( @form_sections )\n end",
"def find_section\n @section = Section.find(params[:section_id])\n end",
"def show\n @image_section = ImageSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_section }\n end\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def show\n @section_comment = SectionComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_comment }\n end\n end",
"def index\n @page_sections = PageSection.all\n end",
"def get_sections(request)\n data, _status_code, _headers = get_sections_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def send_overview(path)\n response = self.create_section_response\n public_section = DocumentSection.from_path(path, :include => \"Departments\")\n public_section.name = path.split(\"/\")[1]\n response[:sections] << public_section\n return response\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\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 SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @section_comments = SectionComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_comments }\n end\n end",
"def index\n @lab_sections = LabSection.all\n end",
"def index\n @lbaas = Lbaa.all\n @lbaas = Lbaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbaas }\n end\n end",
"def index\n @about_us_sections = AboutUsSection.all\n end",
"def show\n @sections = Section.find(:all)\n params[:section_id] ||= params[:id] # kludgey workaround: for some reason :section_id is getting lost and its value put into :id:\n @section = Section.find(params[:section_id])\n @breaking_story ||= Story.find(:first, \n :conditions => ['is_breaking = ? and published = ?', true, true], \n :order => 'publish_at DESC')\n\n\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def sections\n @sections.values\n end",
"def show\n render json: @course, status: :found\n end",
"def show\n @example_section = ExampleSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @example_section }\n end\n end",
"def index\n @survey_sections = SurveySection.page(params[:page]).per(100)\n end",
"def new\r\n @section = Section.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def get_sections(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_sections_with_http_info(name, password, folder, storage)\n data\n end",
"def index\n respond_to do |format|\n format.html {\n @book_labels = BookLabel.all\n @acad_year = AcademicYear.current\n }\n format.json {\n if params[:section]\n search = params[:section] || \"\"\n @book_labels = BookLabel.where(grade_section_id: search)\n elsif params[:term]\n @book_labels = BookLabel.where('UPPER(name) LIKE ?', \"#{params[:term].upcase}%\")\n end\n }\n end\n\n end",
"def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end",
"def index\n @sections = Section.order(\"position asc\")\n\n authorize Section\n end",
"def index\n @lbdds = Lbdd.all\n @lbdds = Lbdd.where(:section => 'A').order(\"id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbdds }\n end\n end"
] | [
"0.75783086",
"0.71649253",
"0.7023344",
"0.7023344",
"0.7023344",
"0.69710636",
"0.6860085",
"0.6860085",
"0.68000746",
"0.667418",
"0.6659199",
"0.6655881",
"0.6627127",
"0.65668356",
"0.6509227",
"0.65008754",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6494794",
"0.6483621",
"0.64400166",
"0.6407743",
"0.63860613",
"0.6377238",
"0.6352194",
"0.6339547",
"0.6329948",
"0.63216275",
"0.6281065",
"0.62779033",
"0.6275845",
"0.6255219",
"0.62415636",
"0.62043256",
"0.61889553",
"0.6183194",
"0.61647725",
"0.6152173",
"0.6134795",
"0.60915035",
"0.6073099",
"0.6073099",
"0.6046269",
"0.60384387",
"0.6031685",
"0.60258645",
"0.59937495",
"0.5986698",
"0.59866595",
"0.59799826",
"0.5970155",
"0.5956993",
"0.5956867",
"0.5951722",
"0.59335756",
"0.59277713",
"0.5922948",
"0.5922948",
"0.5915377",
"0.5888647",
"0.58873713",
"0.5855754",
"0.5836371",
"0.5824824",
"0.5821548",
"0.5821369",
"0.58183527",
"0.58172923",
"0.5812748",
"0.57769513",
"0.57670087",
"0.57608294",
"0.5752052",
"0.5745362",
"0.57443243",
"0.5736828",
"0.5729865",
"0.57186544",
"0.5693328",
"0.5686321",
"0.5683799",
"0.56688964",
"0.5661255",
"0.5660423",
"0.5650643",
"0.5638034",
"0.5633661",
"0.5633417",
"0.56241393",
"0.5621819",
"0.56214267",
"0.5616387",
"0.5616387",
"0.5612191",
"0.56105095",
"0.5608569"
] | 0.0 | -1 |
POST /sections or /sections.json | def create
@section = Section.new(section_params)
if @section.save
render json: SectionSerializer.new(@section)
else
render json: @section.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.page = @page\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @page, :notice => 'Section was successfully created.' }\n format.json { render :json => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend",
"def create\r\n @section = Section.new(params[:section])\r\n\r\n respond_to do |format|\r\n if @section.save\r\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\r\n format.json { render json: @section, status: :created, location: @section }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\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 SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def create\n @form_section = FormSection.new(form_section_params)\n @form_section.save\n respond_with( [ :admin, @form_section] )\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section,\n notice: 'Section was successfully created.' }\n format.json { render :show,\n status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_section = PostSection.new(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to @post_section, notice: 'Post section was successfully created.' }\n format.json { render :show, status: :created, location: @post_section }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = find_post\n @post_section = @post.sections.build(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n # Add section to course.\n if params.has_key?('course_id')\n course_id = params['course_id']\n add_section_to_course(@section, course_id)\n end\n \n format.js { render \"\", json: @section }\n else\n format.js { render json: @section.errors, status: :unprocessable_entity }\n end\n # if add_section_to_course(@section, course_id)\n # # Use the sections helper to create the relation between the section and its course.\n # format.html { redirect_to Course.find(course_id), notice: 'Section was successfully created.' }\n # format.json { render :show, status: :created, location: @section }\n # else\n # format.html { render :new }\n # format.json { render json: @section.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def create\n @page_section = PageSection.new(page_section_params)\n\n respond_to do |format|\n if @page_section.save\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :created, location: @page_section }\n else\n format.html { render :new }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\r\n @section = Section.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def create\n @section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home = Home.first\n @about = About.first\n\n @section = Section.new(section_params)\n @section.order = Section.all.count+1\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to [:admin, @section], notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"def create\n @survey_section = SurveySection.new(survey_section_params)\n\n respond_to do |format|\n if @survey_section.save\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully created.' }\n format.json { render :show, status: :created, location: @survey_section }\n else\n format.html { render :new }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"/api/v1/elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def create\n @manage_section = Manage::Section.new(manage_section_params)\n\n respond_to do |format|\n if @manage_section.save\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @manage_section }\n else\n format.html { render :new }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def update\n if @section.update(section_params)\n render json: SectionSerializer.new(@section)\n else\n render json: @menu.errors, status: :unprocessable_entity\n end\n end",
"def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end",
"def create\n @section = Section.new(section_params)\n\n if @section.save\n redirect_to sections_path, primary: 'Section was successfully created.'\n else\n render :new\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @studentsection = Studentsection.new(studentsection_params)\n\n respond_to do |format|\n if @studentsection.save\n format.html { redirect_to @studentsection, notice: 'Studentsection was successfully created.' }\n format.json { render :show, status: :created, location: @studentsection }\n else\n format.html { render :new }\n format.json { render json: @studentsection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if section.update_attributes(params[:section_datum])\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to teacher_path(@section.teacher), notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n flash[:error] = @section.errors.full_messages\n @teacher = @section.teacher\n format.html { render action: :new, layout: \"workspace\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_section_with_http_info(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_section ...'\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 SlidesApi.create_section\"\n end\n # verify the required parameter 'section_name' is set\n if @api_client.config.client_side_validation && section_name.nil?\n fail ArgumentError, \"Missing the required parameter 'section_name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'sectionName'] = @api_client.prepare_for_query(section_name) unless section_name.nil?\n query_params[:'slideIndex'] = @api_client.prepare_for_query(slide_index) unless slide_index.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def create\n # Instantiate new object using form params\n @section = Section.new(section_params) #use private method below to get permited data for mass assignment\n @section.page = @page\n # Save object\n if @section.save\n # If successful, redirect to index action\n flash[:notice] = \"Section created successfully.\"\n redirect_to(sections_path(:page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('new') # renders form template with original user data pre-populated\n end\n end",
"def send_overview(path)\n response = self.create_section_response\n public_section = DocumentSection.from_path(path, :include => \"Departments\")\n public_section.name = path.split(\"/\")[1]\n response[:sections] << public_section\n return response\n end",
"def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format|\n # Update subcontents\n if update_section_chunks(section_chunks)\n format.html { redirect_to @course }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @section.update(section_params)\n render :show, status: :ok, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def add_section(project_id, data = {})\n post(\"add_section/#{project_id}\", body: data.to_json)\n end",
"def create\n @store_section = StoreSection.new(params[:store_section])\n\n respond_to do |format|\n if @store_section.save\n format.html { redirect_to @store_section, notice: 'Store section was successfully created.' }\n format.json { render json: @store_section, status: :created, location: @store_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_section = AHomeSection.new(admin_section_params)\n\n respond_to do |format|\n if @admin_section.save\n format.html { redirect_to @admin_section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @admin_section }\n else\n format.html { render :new }\n format.json { render json: @admin_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n authorize Section\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n @section_count = Section.count + 1\n\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:event][:sections].shift\n sections = params[:event][:sections]\n event_id = params[:event][:id]\n params[:event].delete \"sections\"\n\n \n @event = Event.new(params[:event])\n \n respond_to do |format|\n if @event.save\n sections.each do |section_id|\n @section = SectionEvent.new({:event_id => @event.id, :section_id => section_id})\n @section.save\n end \n if request.xhr?\n flash[:notice] = \"Event was successfully created.\"\n format.html #{ redirect_to events_url, notice: 'Event was successfully created.' }\n # format.json { render json: @event, status: :created, location: @event }\n format.js\n @events = Event.by_date(params[:date_query])\n else\n flash[:notice] = \"Event was successfully created.\"\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n format.js\n end\n else\n if request.xhr?\n format.html #{ render action: \"new\" }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\n end\n\n end\n # if @event.save\n # format.html { redirect_to @event, notice: 'Event was successfully created.' }\n # format.json { render json: @event, status: :created, location: @event }\n # format.js\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n # format.js\n\n end\n end",
"def create\n @section_test = SectionTest.new(params[:section_test])\n\n respond_to do |format|\n if @section_test.save\n format.html { redirect_to @section_test, notice: 'Section test was successfully created.' }\n format.json { render json: @section_test, status: :created, location: @section_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_page_section = Cms::PageSection.new(cms_page_section_params)\n\n respond_to do |format|\n if @cms_page_section.save\n format.html { redirect_to :controller => \"/pages\", :action => \"show\", :id => @cms_page_section.page_id, notice: 'Page section was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page_section }\n else\n format.html { render :new }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def create\n @section = Section.new(params[:section])\n \n @section.user_id=session[:userid]\n @section.subject_id=session[:subjectid]\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end \n end\n \n end",
"def sections=(value)\n @sections = value\n end",
"def create\n @tutorial_section = TutorialSection.new(tutorial_section_params)\n\n respond_to do |format|\n if @tutorial_section.save\n format.html { redirect_to @tutorial_section, notice: 'Tutorial section was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial_section }\n else\n format.html { render :new }\n format.json { render json: @tutorial_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.require(:section).permit(:name, :description)\n end",
"def create\r\n @gallery_activity = GalleryActivity.new(params[:gallery_activity])\r\n @gallery_activity.sections << Section.find(params[:section_id])\r\n \r\n respond_to do |format|\r\n if (@gallery_activity.save)\r\n format.html { redirect_to Section.find_by_id(params[:section_id]), notice: 'Gallery activity was successfully created.' }\r\n format.json { render json: Section.find_by_id(params[:section_id]), status: :created, location: Section.find_by_id(params[:section_id]) }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @gallery_activity.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def set_section\n @section = @form.sections.find(params[:id])\n end",
"def create\n @about_us_section = AboutUsSection.new(about_us_section_params)\n\n respond_to do |format|\n if @about_us_section.save\n format.html { redirect_to @about_us_section, notice: \"About us section was successfully created.\" }\n format.json { render :show, status: :created, location: @about_us_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @about_us_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n @course = Course.find(params[:course_id])\n @section.course_id = @course.id\n respond_to do |format|\n if @section.save\n format.html { redirect_to course_section_url(@section.course_id, @section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def create\n @menu_section = MenuSection.new(params[:menu_section])\n\n respond_to do |format|\n if @menu_section.save\n format.html { redirect_to @menu_section, notice: 'Menu section was successfully created.' }\n format.json { render json: @menu_section, status: :created, location: @menu_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @menu_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.require(:section).permit(:name)\n end",
"def section_params\n params.require(:section).permit(:name, :description, :location_id, :interior_map)\n end",
"def create\n @join_section = JoinSection.new(params[:join_section])\n\n respond_to do |format|\n if @join_section.save\n format.html { redirect_to(@join_section, :notice => 'JoinSection was successfully created.') }\n format.xml { render :xml => @join_section, :status => :created, :location => @join_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @join_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_sections\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n nil\n end",
"def new\n @section_test = SectionTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_test }\n end\n end",
"def create\n @time_section = TimeSection.new(params[:time_section])\n\n respond_to do |format|\n if @time_section.save\n format.html { redirect_to @time_section, notice: 'Time section was successfully created.' }\n format.json { render json: @time_section, status: :created, location: @time_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def new\n @section = Section.new\n @section.page = @page\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render :json => @section }\n end\n end",
"def section_params\n params.fetch(:section, {})\n end",
"def create\n @course = Course.new(course_params)\n\n #section_chunks = get_chunks(params)\n sections = JSON.parse(params['sections'])\n\n # The course has been created by the signed-in user.\n @course.user_id = current_user.id\n respond_to do |format|\n if @course.save\n # Save the course's subcomponents to the course.\n update_section_chunks(sections)\n\n format.html { redirect_to @course }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render new_course_path }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def create\n @course_section = CourseSection.new(course_section_params)\n\n respond_to do |format|\n if @course_section.save\n format.html { redirect_to @course_section, notice: 'Course section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course_section }\n else\n format.html { render action: 'new' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @form_sections = FormSection.all\n respond_with( @form_sections )\n end",
"def new\n @sections = Section.find(:all) # TODO: refactor so I don't have to repeat this all over the place\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def new\n @section_heading = SectionHeading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def destroy\n @section.destroy\n render json: SectionSerializer.new(@section)\n end",
"def add_new_section\n @section = Section.new\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_single_submission_sections(section_id,assignment_id,user_id,include,opts={})\n query_param_keys = [\n :include\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"section_id is required\" if section_id.nil?\n raise \"assignment_id is required\" if assignment_id.nil?\n raise \"user_id is required\" if user_id.nil?\n raise \"include is required\" if include.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :section_id => section_id,\n :assignment_id => assignment_id,\n :user_id => user_id,\n :include => include\n )\n\n # resource path\n path = path_replace(\"/v1/sections/{section_id}/assignments/{assignment_id}/submissions/{user_id}\",\n :section_id => section_id,\n :assignment_id => assignment_id,\n :user_id => user_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def create\n @lab_section = LabSection.new(lab_section_params)\n\n respond_to do |format|\n if @lab_section.save\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully created.' }\n format.json { render :show, status: :created, location: @lab_section }\n else\n format.html { render :new }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_section = LanguageSection.new(language_section_params)\n\n respond_to do |format|\n if @language_section.save\n format.html { redirect_to @language_section, notice: 'Language section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @language_section }\n else\n format.html { render action: 'new' }\n format.json { render json: @language_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.fetch(:section, {}).permit(:name, :eng, :jpn)\n end",
"def section_params\n params.require(:section).permit(:name, :description, :slug, :parent_id, :rank)\n end",
"def get_page\n render_page_sections_json\n end",
"def section_params\n params.require(:section).permit(:name, :menu_id)\n end",
"def create\n @model_section = ModelSection.new(params[:model_section])\n\n respond_to do |format|\n if @model_section.save\n format.html { redirect_to(@model_section, :notice => 'Model section was successfully created.') }\n format.xml { render :xml => @model_section, :status => :created, :location => @model_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def list_sections\n \n end",
"def index\n @sections = Section.all\n end"
] | [
"0.67786705",
"0.659407",
"0.6583568",
"0.6568496",
"0.6561841",
"0.6520435",
"0.6520435",
"0.65132475",
"0.6494207",
"0.64769095",
"0.64499754",
"0.64323574",
"0.64323574",
"0.64323574",
"0.64323574",
"0.64296603",
"0.6390424",
"0.6380877",
"0.6375676",
"0.63738686",
"0.6359966",
"0.6298321",
"0.62468934",
"0.62451065",
"0.62132514",
"0.6165719",
"0.6125172",
"0.61225116",
"0.6111153",
"0.60941565",
"0.6067945",
"0.60600024",
"0.60596526",
"0.60596526",
"0.6033562",
"0.6010942",
"0.60063857",
"0.5980034",
"0.5958648",
"0.5954278",
"0.59529483",
"0.5941523",
"0.59152484",
"0.59040403",
"0.5890268",
"0.5884971",
"0.5858198",
"0.5855319",
"0.5847312",
"0.58429056",
"0.5819174",
"0.5813559",
"0.58055204",
"0.5800351",
"0.5794452",
"0.578868",
"0.5785904",
"0.5781799",
"0.5777901",
"0.5775686",
"0.5754265",
"0.5750351",
"0.5747172",
"0.5738196",
"0.5725799",
"0.5722892",
"0.5709469",
"0.57073313",
"0.57072264",
"0.57011014",
"0.5694604",
"0.5691442",
"0.5691045",
"0.5690576",
"0.568346",
"0.56778365",
"0.5668742",
"0.566816",
"0.5650035",
"0.5648633",
"0.5640182",
"0.56369895",
"0.5633547",
"0.56271905",
"0.562661",
"0.56161994",
"0.56095505",
"0.5608253",
"0.55965686",
"0.55957395",
"0.55947036",
"0.5589901",
"0.558518",
"0.55848527",
"0.55738395",
"0.55734855",
"0.55719954",
"0.55719954",
"0.55518657",
"0.554853"
] | 0.6856197 | 0 |
PATCH/PUT /sections/1 or /sections/1.json | def update
if @section.update(section_params)
render json: SectionSerializer.new(@section)
else
render json: @menu.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @section = Section.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @section.update_attributes(params[:section])\r\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n if @section.update(section_params)\n render :show, status: :ok, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format|\n # Update subcontents\n if update_section_chunks(section_chunks)\n format.html { redirect_to @course }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if section.update_attributes(params[:section_datum])\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render json: @section }\n else\n format.html { render action: 'edit' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end",
"def update\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to admin_section_path(@section), notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sections = Section.find(:all)\n @section = Section.find(params[:section_id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n flash[:notice] = 'Section was successfully updated.'\n format.html { redirect_to(@section) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section,\n notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(admin_section_params)\n format.html { redirect_to admin_sections_path, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_section }\n else\n format.html { render :edit }\n format.json { render json: @admin_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lab_section.update(lab_section_params)\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_section }\n else\n format.html { render :edit }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\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 SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def update\n @section = Section.find(params[:pk])\n @section.update_attributes( params[:name] => params[:value] )\n \n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n \n end",
"def update\n @section = Section.find(params[:id])\n @page = @section.page\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @page, :notice => 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to teacher_path(@section.teacher), notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sell_shop_section_update (section_id, section_name, params={})\r\n url = api_url \"/sell/shop/sections/#{section_id}\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.put url, load, req\r\n end \r\n end",
"def update\n respond_to do |format|\n if @soa_section.update(soa_section_params.merge({serial_number: @soa_section.serial_number += 1, revision: @soa_section.revision += 1 }))\n format.html { redirect_to domain_dns_zone_path(@soa_section.dns_zone.domain, @soa_section.dns_zone), notice: 'Soa section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = \"SoaSection validation failed: #{@soa_section.errors.messages}\"\n render action: :edit\n end\n format.json { render json: @soa_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize Section\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section.article, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n @section_count = article.sections.count\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to teacher_section_path(@section), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n if @section_heading.update_attributes(params[:section_heading])\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n if @store_section.update_attributes(params[:store_section])\n format.html { redirect_to @store_section, notice: 'Store section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey_section.update(survey_section_params)\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_section }\n else\n format.html { render :edit }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post_section.update(post_section_params)\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :edit }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @form_section.update(form_section_params)\n respond_with( [ :admin, @form_section] )\n end",
"def update\n @play = Play.find(params[:play_id])\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to edit_play_url(@play), notice: 'section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_play_url(@play) }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { subsection:\n # {\n # \"id\" : id\n # \"subsection_datum_id\":references\n # }\n # }\n if @subsection.update_attributes(params[:module])\n head :no_content\n else\n render json: @subsection.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def update_section(section_id, data = {})\n post(\"update_section/#{section_id}\", body: data.to_json)\n end",
"def update\n respond_to do |format|\n if @language_section.update(language_section_params)\n format.html { redirect_to @language_section, notice: 'Language section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @language_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model_section = ModelSection.find(params[:id])\n\n respond_to do |format|\n if @model_section.update_attributes(params[:model_section])\n format.html { redirect_to(@model_section, :notice => 'Model section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @model_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_heading.update(section_heading_params)\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_heading }\n else\n format.html { render :edit }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutorial_section.update(tutorial_section_params)\n format.html { redirect_to @tutorial_section, notice: 'Tutorial section was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial_section }\n else\n format.html { render :edit }\n format.json { render json: @tutorial_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subsection.update(subsection_params)\n format.html { redirect_to @subsection, notice: 'Subsection was successfully updated.' }\n format.json { render :show, status: :ok, location: @subsection }\n else\n format.html { render :edit }\n format.json { render json: @subsection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = @account.sections.find(params[:id])\n @section.account = @account\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n flash[:notice] = 'Section updated'\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n if @menu_section.update_attributes(params[:menu_section])\n format.html { redirect_to @menu_section, notice: 'Menu section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @menu_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_user_attribution @section, false, true\n respond_to do |format|\n if @section.update(section_params)\n format.js do\n flash[:notice] = \"Section was successfully updated\"\n render layout: false\n end\n format.html { redirect_to edit_document_path(@section.document), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { redirect_to edit_document_path(@section.document), notice: 'Failed to update section.' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @course_section\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_section }\n else\n format.html { render :edit }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # render json:params\n # return \n\n\n respond_to do |format|\n if @manage_section.update(manage_section_params)\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @manage_section }\n else\n format.html { render :edit }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page_section.update(page_section_params)\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :ok, location: @page_section }\n else\n format.html { render :edit }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n \n @section = Section.find(params[:id])\n\n @section.users << User.find(params[:user_add]) if params[:user_add]\n @section.users.delete(User.find(params[:user_remove])) if params[:user_remove]\n # @section.announcements << Announcement.find(params[:announcement_add]) if params[:announcement_add]\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_configuration.update(section_configuration_params)\n format.html { redirect_to @section_configuration, notice: 'Section configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_configuration }\n else\n format.html { render :edit }\n format.json { render json: @section_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @studentsection.update(studentsection_params)\n format.html { redirect_to @studentsection, notice: 'Studentsection was successfully updated.' }\n format.json { render :show, status: :ok, location: @studentsection }\n else\n format.html { render :edit }\n format.json { render json: @studentsection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @section.update(section_params)\n redirect_to @section, primary: 'Section was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.section_id = params[:section_id] unless params[:section_id].nil? \n @page.title = params[:title] unless params[:title].nil? \n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n #ormat.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n if @time_section.update_attributes(params[:time_section])\n format.html { redirect_to @time_section, notice: 'Time section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @example_section = ExampleSection.find(params[:id])\n\n respond_to do |format|\n if @example_section.update_attributes(params[:example_section])\n flash[:notice] = 'ExampleSection was successfully updated.'\n format.html { redirect_to(@example_section) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @example_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sectionalization.update(sectionalization_params)\n format.html { redirect_to @sectionalization, notice: 'Sectionalization was successfully updated.' }\n format.json { render :show, status: :ok, location: @sectionalization }\n else\n format.html { render :edit }\n format.json { render json: @sectionalization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_event = SectionEvent.find(params[:id])\n\n respond_to do |format|\n if @section_event.update_attributes(params[:section_event])\n format.html { redirect_to @section_event, notice: 'Section event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page_section.update(cms_page_section_params)\n format.html { redirect_to @cms_page_section, notice: 'Page section was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page_section }\n else\n format.html { render :edit }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_section = ShopSection.find(params[:id])\n\n respond_to do |format|\n if @shop_section.update_attributes(params[:shop_section])\n format.html { redirect_to shop_section_products_path(@shop_section.short_url), notice: 'Shop section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @shop_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @guide_section.update(guide_section_params)\n format.html { redirect_to guide_sections_url, notice: 'Guide section was successfully updated.' }\n format.json { render :show, status: :ok, location: @guide_section }\n else\n format.html { render :edit }\n format.json { render json: @guide_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n sections = params[:sections]\n\n respond_to do |format|\n if @feedback.update(feedback_params)\n for section in sections\n if section[\"id\"] == 0 || section[\"id\"] == \"\"\n feedbackSection = FeedbackSection.new\n elsif\n feedbackSection = FeedbackSection.find(section[\"id\"])\n end\n\n feedbackSection.feedback_id = @feedback.id\n feedbackSection.question = section[\"question\"]\n feedbackSection.answer = section[\"answer\"]\n\n feedbackSection.rating = 0\n feedbackSection.question_type = 1\n feedbackSection.action_plan = ''\n feedbackSection.category = ''\n feedbackSection.save\n end\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @about_us_section.update(about_us_section_params)\n format.html { redirect_to @about_us_section, notice: \"About us section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @about_us_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @about_us_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @section = Section.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @user_section.update(user_section_params)\n format.html { redirect_to @user_section, notice: 'User section was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_section }\n else\n format.html { render :edit }\n format.json { render json: @user_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def update\n # Find new object using form params\n @section = Section.find(params[:id])\n # Update object\n if @section.update_attributes(section_params) #use private method below to get permited data for mass assignment\n # If successful, redirect to show action\n flash[:notice] = \"Section updated successfully.\"\n redirect_to(section_path(@section, :page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('edit') # renders form template with original pre-populated\n end\n end",
"def update\n if !has_right?(:edit)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.find(params[:id])\n update_objects(@section_preview, params[:section_preview]) ### Add to all resources\n end",
"def update\n respond_to do |format|\n if @discipline_section.update(discipline_section_params)\n format.html { redirect_to @discipline_section, notice: 'Раздел дисциплины был успешно обновлен' }\n format.json { render :show, status: :ok, location: @discipline_section }\n else\n format.html { render :edit }\n format.json { render json: @discipline_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_row.update(section_row_params)\n flash[:success] = \"Section row was successfully updated.\"\n format.html { redirect_to @section_row }\n format.json { render :show, status: :ok, location: @section_row }\n else\n format.html { render :edit }\n format.json { render json: @section_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_section\n @section = @form.sections.find(params[:id])\n end",
"def update\n @make_section = MakeSection.find(params[:id])\n\n respond_to do |format|\n if @make_section.update_attributes(params[:make_section])\n format.html { redirect_to(@make_section, :notice => 'Make section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @make_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_instructor.update(section_instructor_params)\n format.html { redirect_to @section_instructor, notice: 'Section instructor was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_instructor }\n else\n format.html { render :edit }\n format.json { render json: @section_instructor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @join_section = JoinSection.find(params[:id])\n\n respond_to do |format|\n if @join_section.update_attributes(params[:join_section])\n format.html { redirect_to(@join_section, :notice => 'JoinSection was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @join_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @labels = args[:labels] if args.key?(:labels)\n @section_id = args[:section_id] if args.key?(:section_id)\n @section_type = args[:section_type] if args.key?(:section_type)\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 @faq_section.update(faq_section_params)\n format.html { redirect_to @faq_section, notice: \"Faq section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @faq_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @faq_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end"
] | [
"0.70796984",
"0.70526665",
"0.701372",
"0.6969117",
"0.6949376",
"0.68567365",
"0.68482435",
"0.6837389",
"0.6817472",
"0.67823505",
"0.6777296",
"0.6777296",
"0.6777296",
"0.6777296",
"0.6777296",
"0.6777296",
"0.6756845",
"0.66736645",
"0.6610641",
"0.6610641",
"0.6585893",
"0.6577215",
"0.6556651",
"0.65393794",
"0.6538707",
"0.64985144",
"0.64621025",
"0.6460935",
"0.64174753",
"0.6398264",
"0.6388023",
"0.6379804",
"0.6344247",
"0.6343382",
"0.6326708",
"0.63264376",
"0.63233685",
"0.6277084",
"0.6257268",
"0.6251165",
"0.6240679",
"0.62336314",
"0.62332034",
"0.62302464",
"0.6226864",
"0.6210389",
"0.6208268",
"0.62015945",
"0.617341",
"0.61719245",
"0.61662936",
"0.6135438",
"0.61073554",
"0.60885733",
"0.6084995",
"0.60848904",
"0.6064846",
"0.6048619",
"0.6033115",
"0.60203195",
"0.6011261",
"0.6007777",
"0.6006357",
"0.5993686",
"0.5988852",
"0.5985786",
"0.5985347",
"0.59849113",
"0.59849113",
"0.5982531",
"0.595854",
"0.5926428",
"0.59209615",
"0.59163636",
"0.5895801",
"0.58774424",
"0.58545756",
"0.5849005",
"0.58127105",
"0.5802607",
"0.5796147",
"0.57910305",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746",
"0.5771746"
] | 0.67491376 | 17 |
DELETE /sections/1 or /sections/1.json | def destroy
@section.destroy
render json: SectionSerializer.new(@section)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @sections = Section.find(:all)\n @section = Section.find(params[:section_id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @home = Home.first\n @about = About.first\n \n @section = Section.find(params[:id])\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n render nothing: true\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @section = Section.find(params[:id])\n end",
"def destroy\r\n @section = Section.find(params[:id])\r\n @section.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy \n section = SectionDatum.find(params[:id])\n if section.destroy\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url,\n notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_heading = SectionHeading.find(params[:id])\n @section_heading.destroy\n\n respond_to do |format|\n format.html { redirect_to section_headings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = @account.sections.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @menu_section = MenuSection.find(params[:id])\n @menu_section.destroy\n\n respond_to do |format|\n format.html { redirect_to menu_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @example_section = ExampleSection.find(params[:id])\n @example_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(example_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @page = @section.page\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to @page, :notice => 'Section was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @language_section.destroy\n respond_to do |format|\n format.html { redirect_to language_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_section = StoreSection.find(params[:id])\n @store_section.destroy\n\n respond_to do |format|\n format.html { redirect_to store_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n\t\ttemp = @section.name\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_sections_path, :notice => \"Section '#{temp}' was deleted.\" }\n format.xml { head :ok }\n end\n end",
"def sell_shop_section_delete (section_id, params={})\r\n url = api_url \"/sell/shop/sections/#{section_id}\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.delete url, req\r\n end \r\n end",
"def destroy\n authorize Section\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to @section.article, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_category = SectionCategory.find(params[:id])\n @section_category.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Test this query on rail console for menu section that has food\n ActiveRecord::Base.connection.exec_query(\n \"DELETE FROM menu_sections\n WHERE url_id = #{params[:id]}\n AND NOT EXISTS (\n SELECT 1\n FROM Foods\n WHERE ms_url_id = #{params[:id]}\n );\"\n ) \n\n menu_section = ActiveRecord::Base.connection.exec_query(\n \"SELECT 1\n FROM menu_sections\n WHERE url_id = #{params[:id]}\"\n )\n\n if (!menu_section.empty?)\n render json: {errors: \"Cannot delete menu section that has dish in it!\"}, status: 500\n end\n end",
"def destroy\n @time_section = TimeSection.find(params[:id])\n @time_section.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_section.destroy\n respond_to do |format|\n format.html { redirect_to lab_sections_url, notice: 'Lab section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_heading.destroy\n respond_to do |format|\n format.html { redirect_to section_headings_url, notice: 'Section heading was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @make_section = MakeSection.find(params[:id])\n @make_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(make_sections_url) }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @post_section.destroy\n respond_to do |format|\n format.html { redirect_to admin_post_sections_url(@post), notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_section = ShopSection.find(params[:id])\n @shop_section.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_section.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_sections_url, notice: 'Tutorial section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_section.destroy\n respond_to do |format|\n format.html { redirect_to survey_sections_url, notice: 'Survey section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_section.destroy\n respond_to do |format|\n format.html { redirect_to page_sections_url,\n notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_section = ModelSection.find(params[:id])\n @model_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(model_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domicile_type_section = DomicileTypeSection.find(params[:id])\n @domicile_type_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_type_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @about_us_section.destroy\n respond_to do |format|\n format.html { redirect_to about_us_sections_url, notice: \"About us section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sectionalization.destroy\n respond_to do |format|\n format.html { redirect_to sectionalizations_url, notice: 'Sectionalization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_section.destroy\n respond_to do |format|\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_section_with_http_info(name, section_index, with_slides = nil, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.delete_section ...'\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 SlidesApi.delete_section\"\n end\n # verify the required parameter 'section_index' is set\n if @api_client.config.client_side_validation && section_index.nil?\n fail ArgumentError, \"Missing the required parameter 'section_index' when calling SlidesApi.delete_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections/{sectionIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'sectionIndex', section_index)\n\n # query parameters\n query_params = {}\n query_params[:'withSlides'] = @api_client.prepare_for_query(with_slides) unless with_slides.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def destroy\n @cms_page_section.destroy\n respond_to do |format|\n format.html { redirect_to cms_page_sections_url, notice: 'Page section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @menu_section = MenuSection.find(params[:id])\n @menu_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(menu_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @studentsection.destroy\n respond_to do |format|\n format.html { redirect_to studentsections_url, notice: 'Studentsection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guide_section.destroy\n respond_to do |format|\n format.html { redirect_to guide_sections_url, notice: 'Guide section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(s)\n \n key = @sections.keys.grep(/#{s.downcase}/i).first\n old_value = @sections[key].flatten.join\n heading = last_heading(key)\n old_section = heading + old_value\n \n @s.sub!(old_section, '') \n load_sections(@s) \n save()\n \n :deleted\n end",
"def destroy\n # find object\n @section = Section.find(params[:id])\n # destroy object\n @section.destroy\n # redirect back to index\n flash[:notice] = \"Section '#{@section.name}' deleted successfully.\"\n redirect_to(sections_path(:page_id => @page.id))\n end",
"def delete_section(section_id)\n post(\"delete_section/#{section_id}\")\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @institution_app_pages_section.destroy\n respond_to do |format|\n format.html { redirect_to institution_app_pages_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @join_section = JoinSection.find(params[:id])\n @join_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(join_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :destroy, @course_section\n @course_section.destroy\n respond_to do |format|\n format.html { redirect_to course_sections_url, notice: 'Course section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discipline_section.destroy\n respond_to do |format|\n #format.html { redirect_to discipline_sections_url, notice: 'Раздел дисциплины был успешно удален' }\n #format.json { head :no_content }\n format.js { render ('discipline_sections/delete')}\n end\n end",
"def destroy\n @assignment = Assignment.find(params[:id])\n @section = @assignment.section\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to section_path(@section) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_row.destroy\n respond_to do |format|\n flash[:success] = \"Section row was successfully destroyed.\"\n format.html { redirect_to section_rows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @form_section.destroy\n respond_with( [ :admin, @form_section] )\n end",
"def destroy\n @section_configuration.destroy\n respond_to do |format|\n format.html { redirect_to section_configurations_url, notice: 'Section configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Save off a record of who performed the deletion before we proceed to destroy the record\n update_user_attribution @section, false, false, true\n @section.save\n\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { render text: \"Section removed\", status: :ok }\n end\n end",
"def destroy\n @section.destroy\n redirect_to sections_url, primary: 'Section was successfully destroyed.'\n end",
"def destroy\n @section_event = SectionEvent.find(params[:id])\n @section_event.destroy\n\n respond_to do |format|\n format.html { redirect_to section_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section.id }\"),\n notice: t('removed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tSection.find(params[:id]).destroy\n\t\tflash[:notice] = \"Section destroyed\"\n\t\tredirect_to(:action => 'list')\n\tend",
"def destroy\n @play = Play.find(params[:play_id])\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_play_url(@play) }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @user_section.destroy\n respond_to do |format|\n format.html { redirect_to user_sections_url, notice: 'User section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moto_town_type_section = MotoTownTypeSection.find(params[:id])\n @moto_town_type_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_town_type_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html do\n redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n 'panel-tab': @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction_forms_projects_section\n .id),\n notice: t('removed')\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_instructor.destroy\n respond_to do |format|\n format.html { redirect_to section_instructors_url, notice: 'Section instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_section.destroy\n respond_to do |format|\n format.html { redirect_to edit_fabrication_order_path(params[:fabrication_order_id]), notice: 'Section was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @course_section.destroy\n if @course_section.student_count\n flash[:notice] = \"This section has student(s). You can't delete this section!\"\n end\n flash.now[:error] = \"Section record deleted\"\n respond_to do |format|\n format.html { redirect_to course_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_section = ProductSection.find(params[:id])\n @product_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @subsection.destroy\n head :no_content\n else\n render json: @subsection.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @pricing_section.destroy\n respond_to do |format|\n format.html { redirect_to pricing_sections_url, notice: \"Pricing section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat_make_section = BoatMakeSection.find(params[:id])\n @boat_make_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_make_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @community_section.destroy\n respond_to do |format|\n format.html { redirect_to community_sections_url, notice: 'Community section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @homepage_section_content.destroy\n respond_to do |format|\n format.html { redirect_to homepage_index_path, notice: 'Homepage section content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_timing.destroy\n respond_to do |format|\n format.html { redirect_to section_timings_url, notice: 'Section timing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soa_section.destroy\n respond_to do |format|\n format.html { redirect_to domain_dns_zone_path(@soa_section.dns_zone.domain, @soa_section.dns_zone) }\n format.json { head :no_content }\n end\n end",
"def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end",
"def destroy \n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to selection_path(params[:selection_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_comment = SectionComment.find(params[:id])\n @section_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to section_comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_time.destroy\n respond_to do |format|\n format.html { redirect_to section_times_url, notice: 'Section time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n subsection = Subsection.find(params['id']) \n index = subsection.section.subsections.index(subsection)\n checklist_id = subsection.checklist.id\n \n if subsection.remove\n flash['notice'] = 'Subsection deletion successful.'\n else\n flash['notice'] = 'Subsection deletion failed - Contact DTG'\n end\n \n redirect_to(:controller => 'checklist', :action => 'edit', :id => checklist_id)\n \n end",
"def destroy\n @car_model_section = CarModelSection.find(params[:id])\n @car_model_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(car_model_sections_url) }\n format.xml { head :ok }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end"
] | [
"0.7500553",
"0.7500553",
"0.74911845",
"0.74911845",
"0.74698997",
"0.7362964",
"0.7306996",
"0.72674024",
"0.72232556",
"0.72232556",
"0.71437764",
"0.70949495",
"0.709457",
"0.7080434",
"0.7080434",
"0.7080434",
"0.7080434",
"0.7080434",
"0.7080434",
"0.7071732",
"0.70647246",
"0.69472396",
"0.69433385",
"0.69404405",
"0.6922673",
"0.6920701",
"0.68999827",
"0.689261",
"0.6883986",
"0.6874239",
"0.68613",
"0.68109137",
"0.6796074",
"0.6775481",
"0.6770243",
"0.67632174",
"0.67550606",
"0.67434394",
"0.6720174",
"0.671861",
"0.671744",
"0.67136675",
"0.67133355",
"0.67096597",
"0.67006105",
"0.6692142",
"0.6641025",
"0.66277194",
"0.6626737",
"0.6603373",
"0.65872073",
"0.65854776",
"0.658095",
"0.6558357",
"0.65508586",
"0.6549051",
"0.6548661",
"0.65238667",
"0.65120167",
"0.650818",
"0.65045065",
"0.6482994",
"0.64827",
"0.6477818",
"0.6468541",
"0.6467327",
"0.6462131",
"0.6456134",
"0.6445273",
"0.6438036",
"0.6427168",
"0.64249414",
"0.6416731",
"0.6392789",
"0.6377543",
"0.6368565",
"0.6361765",
"0.6351389",
"0.63374126",
"0.63222796",
"0.63147956",
"0.6310899",
"0.6307941",
"0.6304481",
"0.6296014",
"0.6293224",
"0.6291959",
"0.6269659",
"0.62660015",
"0.6260622",
"0.62590605",
"0.62478924",
"0.6240325",
"0.6222764",
"0.6201664",
"0.6201664",
"0.62012494",
"0.6183498",
"0.6172758",
"0.61625105"
] | 0.7121219 | 11 |
Use callbacks to share common setup or constraints between actions. | def set_section
@section = Section.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 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 action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 _handle_action_missing(*args); 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 call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def section_params
params.require(:section).permit(:name, :menu_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] | 0.0 | -1 |
END url helpers for kongo_coaching_pages controllers END | def youtube_embed video, *style
result = content_tag :iframe, 'youtube', src: video.yt_embed_link
if style
result = content_tag :iframe, 'youtube', src: video.yt_embed_link, style: style
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages\n end",
"def paginate_path(site, num_page); end",
"def page\n\n end",
"def url_for_index; end",
"def url_for_index; end",
"def homepage\n end",
"def homepage\n end",
"def homepage\n end",
"def homepage\n end",
"def page_url(page, obj = nil)\n url = case page\n when 'home' then '/'\n when 'featured events' then '#/featured'\n when 'browse all events' then '#/browse/events'\n when 'browse all places' then '#/browse/places'\n when 'browse publishers' then '#/fun'\n when 'my redrover' then '/my'\n when 'settings' then '#/settings'\n else raise \"Unknown page_url: #{page}\"\n end\nend",
"def doi_landing_page\n # is there a way to get this somehow with url_for or some such?\n url = DOI_CONFIG['landing_page_prefix']\n if self.class == Collection\n url + \"collections/\" + id\n else\n url + \"files/\" + id\n end\n end",
"def pages; end",
"def url\n if self.controller and self.action and self.page_id\n return \"/#{self.controller}/#{self.action}/#{self.page_id}\"\n end\n if self.controller and self.action\n return \"/#{self.controller}/#{self.action}\"\n end\n if self.controller\n return \"/#{self.controller}\"\n end\n return \"/#{self.shortcut}\"\n end",
"def controller_path; end",
"def controller_path; end",
"def url_template; end",
"def url_template; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def index\n redirect_to project_path(@project, :anchor => \"comments/p#{@comments.total_pages}\") if request.format == :html\n end",
"def controller_and_view_for(page_path)\n page_path.match(/(.*)\\/([^\\/]+)/)[1..2]\n end",
"def url_for_page( project, opts )\n setup_project_urls( project )\n if (opts[:page_name])\n raise \"No bulletin provided!\" if (! opts[:bulletin])\n url_for :controller => 'content', :action => 'page',\n :project_name => project.name, \n :bulletin_title => opts[:bulletin].title,\n :page_name => opts[:page_name],\n :layout => opts[:layout]\n \n end\n end",
"def route_index; end",
"def home\n\t\t# Home Page\n\tend",
"def next_page_path; end",
"def search_path; end",
"def search_path; end",
"def pathWebSitePages\n pathWebSite + \"pages/\"\nend",
"def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end",
"def homepage\n page.homepage\n end",
"def index\n @pages = @club.all_pages\n \n @page_title = \"Page Listing\"\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end \n end",
"def pages()\n get('subAccountPages')\n end",
"def base_url_for(page)\n \"#{request.path}#{model.framework.prefix}/#{page}\"\n end",
"def index\n return redirect_to(request.env['REQUEST_URI'].include?(\"colleges\") ? college_path(params[:id]) : location_path(params[:id])) if params[:id]\n @locations = Location.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def loc_view\n \n end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def view_paths; end",
"def view_paths; end",
"def view_paths; end",
"def page\n\t\tpage = request.path.split(\"/\")[-1]\n\tend",
"def home_page\n if current_user.guest?\n user_signup_url\n elsif current_user.administrator?\n admin_films_path\n elsif current_user.judge?\n judging_categories_path\n else\n obejct_url current_user\n end\n end",
"def permalink; end",
"def permalink; end",
"def collections_path; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def url; end",
"def page_url(*args)\n api_apps_path(*args)\n end",
"def page_url(page)\n \"#{request.path}?page=#{page}\"\n end",
"def collection_path\n url_for(\n :controller => controller_path, \n :action => 'index',\n :only_path => true,\n :use_route => controller_path.tr('/', '_')\n )\n end",
"def show\n if params[:page_url].blank? && params[:locale].blank?\n redirect_to get_railsgun_url(railsgun_home)\n elsif params[:page_url].blank? && !params[:locale].blank?\n redirect_to get_railsgun_url(railsgun_home, {:lang => params[:locale]})\n else\n page_url = params[:page_url]\n splitted_page_url = page_url.split('/')\n @page = Page.find(:first, :conditions => [\"pretty_url = ?\", splitted_page_url.last]) unless page_url.last.nil?\n if @page\n respond_with(@page, @pages = Page.all, @lang=params[:locale]) \n end \n end\n end",
"def url\n\n # TODO bug with controllers without models e.g. StaticPages\n if controller_id.blank?\n \"#\"\n elsif instance_id.nil? || instance_id == 0\n url_for :controller => controller_id, :action => action_id, :only_path => true\n else\n # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n klass = controller_id.classify.constantize\n if instance_id.present?\n instance = klass.find(instance_id)\n\n if [\"show\"].include? action_id\n polymorphic_path(instance, :only_path => true)\n else\n polymorphic_path(instance, :action => action_id, :only_path => true)\n end\n end\n end\n\n # # Media Link only:\n # # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n # klass = controller_id.classify.constantize\n # action_id = 'show'\n # if instance_id.present?\n # instance = klass.find(instance_id)\n\n # if [\"show\"].include? action_id\n # polymorphic_path(instance, :only_path => true)\n # else\n # polymorphic_path(instance, :action => action_id, :only_path => true)\n # end\n # end\n end",
"def index\n @pages = @comic.pages\n \n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def collection_url\n send route_prefix_to_method_name(\"#{class_name.model_name.route_key}_url\")\n end",
"def url_for_me(action)\n if action == 'show'\n \"/projects/#{to_param}\"\n else\n \"/projects/#{to_param}/#{action}\"\n end\n end",
"def about\n # Static Page\n end",
"def show\n @page = Page.find(params[:page_id])\n # @url = Url.find(params[:id]) # set_url\n end",
"def p_url\n Rails.application.routes.url_helpers.rent_url(id, host: PUBLIC_URL)\n end",
"def nice_page_path(page)\n \"/#{page.title.parameterize}\"\n end",
"def nice_page_path(page)\n \"/#{page.title.parameterize}\"\n end",
"def index\n @page = display_page('Admin')\n \n respond_to do |format|\n format.html\n end\n end",
"def to_partial_path\n \"pagination\"\n end",
"def url\n\t\t\"#{base}/wiki/#{page}\"\n\tend",
"def index\n @page = Page.find(params[:page_id])\n @urls = Url.where(page_id: params[:page_id])\n end",
"def GET; end"
] | [
"0.6180016",
"0.61165375",
"0.60557455",
"0.5946249",
"0.5946249",
"0.5938096",
"0.5938096",
"0.59291613",
"0.59291613",
"0.5895041",
"0.58630806",
"0.5861985",
"0.5838518",
"0.58357346",
"0.58357346",
"0.5805513",
"0.5805513",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5798736",
"0.5780036",
"0.57584953",
"0.5750595",
"0.57157785",
"0.57056457",
"0.56980044",
"0.5690011",
"0.5690011",
"0.56767243",
"0.56672615",
"0.5649992",
"0.5640754",
"0.5640586",
"0.56382114",
"0.5609865",
"0.5605459",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5603417",
"0.5585682",
"0.5585682",
"0.5585682",
"0.5578395",
"0.55744565",
"0.557184",
"0.557184",
"0.5567407",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5566701",
"0.5565717",
"0.5541945",
"0.5538223",
"0.5534083",
"0.5532554",
"0.5524453",
"0.55218375",
"0.5519696",
"0.55175424",
"0.55171204",
"0.55130225",
"0.55011857",
"0.55011857",
"0.54994226",
"0.5498355",
"0.54952914",
"0.5484414",
"0.5477585"
] | 0.0 | -1 |
day08_2.rb AUTHOR:: Kyle Mullins | def process_input(input_lines)
input_lines.map { |instr| instr.chomp.gsub('inc', '+').gsub('dec', '-') }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def w_day; end",
"def day() end",
"def yday() end",
"def yday\n end",
"def cwday\n end",
"def day; end",
"def day=(_arg0); end",
"def best_day\n\n end",
"def ord(day)\n\nend",
"def wday() end",
"def day\n end",
"def sunday_5_54_plus1\n make_hash(draw(49, 5), draw(11, 1))\n end",
"def return_static_day(myday,day_map,human_label)\n\n static_day=myday\n my_1day=(60*60*24) #1 day in seconds\n\n #static holiday\n if ( myday.wday != day_map['sun'] and myday.wday != day_map['sat']) #not on a weekend\n static_day=(\"#{(myday).to_i}:#{human_label}\")\n elsif myday.wday == day_map['sun'] #push Monday after\n static_day=(\"#{(myday+my_1day).to_i}:#{human_label} Monday After\")\n elsif myday.wday == day_map['sat'] #Friday before\n static_day=(\"#{(myday-my_1day).to_i}:#{human_label} Friday Before\")\n else\n #we shouldn't see anything here\n end\n return static_day\nend",
"def unusual_day_1(num)\n if wrong_date(num).to_i == 1\n first_day(num).click\n elsif wrong_date(num).to_i == 31\n calendar_date(num, 1)\n end\nend",
"def unusual_day_2(num)\n if page.has_no_text?('29', count: 2)\n february(num)\n else\n not_february(num)\n end\nend",
"def all_day ; true ; end",
"def unusual_day_3(num)\n if wrong_date(num).to_i == 3\n first_day(num).click\n elsif wrong_date(num).to_i == 30\n wrong_day_30(num)\n elsif wrong_date(num).to_i == 31\n calendar_date(num, 1)\n elsif wrong_date(num).to_i == 23\n unusual_day_4(num)\n end\nend",
"def mday() end",
"def addDays(date)\n\n #puts 'in addDays'\n #puts date\n if date.saturday? then\n #puts \"sat\"\n date1 = date.next_day(7)\n return date1\n elsif date.sunday? then\n #puts \"sun\"\n date1 = date.next_day(8)\n return date1\n else\n #puts 'other'\n date1 = date.next_day(7)\n end\n return date1\n end",
"def est05_toggle_dates #needs more debugging\n\t\t$browser.goto($patch_event_landing)\n\t\t\n\t\tcurrent_day = Time.now.strftime(\"%w\").to_i #grab day of the week as a number, 0 = Sunday\n puts current_day\n\t sleep 3\n\t\t$events_day_5.click #toggle date to fifth entry\n\t\tsleep 3\n\t\t@end_date = $events_date_header.text #grab date displayed on the header \n puts @end_date\n\t\t#parse out day of the week and convert to number\n\t\tnew_date = Date.parse(@end_date.split(\",\").first.to_s).strftime(\"%w\").to_i \n\t\tputs new_date\n\t\tassert current_day <= new_date #compare current day number to toggled date number\n\n\tend",
"def copydaysedit\n end",
"def mday\n end",
"def february(num)\n if wrong_date(num).to_i.between?(23, 28)\n wrong_date_replacements = { 23 => 6, 24 => 5, 25 => 4, 26 => 3,\n 27 => 2, 28 => 1 }\n calendar_date(num, wrong_date_replacements[wrong_date(num).to_i])\n else\n first_day(num).click\n end\nend",
"def daySymbol\n dayNum = 30*(@month - 1) + (@day - 1)\n symbols = [\"Raisin (Grape)\",\n \"Safran (Saffron)\",\n \"Châtaigne (Chestnut)\",\n \"Colchique (Crocus)\",\n \"Cheval (Horse)\",\n \"Balsamine (Impatiens)\",\n \"Carotte (Carrot)\",\n \"Amarante (Amaranth)\",\n \"Panais (Parsnip)\",\n \"Cuve (Vat)\",\n \"Pomme de terre (Potato)\",\n \"Immortelle (Strawflower)\",\n \"Potiron (Calabaza)\",\n \"Réséda (Mignonette)\",\n \"Âne (Donkey)\",\n \"Belle de nuit (The four o’clock flower)\",\n \"Citrouille (Pumpkin)\",\n \"Sarrasin (Buckwheat)\",\n \"Tournesol (Sunflower)\",\n \"Pressoir (Wine-Press)\",\n \"Chanvre (Hemp)\",\n \"Pêche (Peach)\",\n \"Navet (Turnip)\",\n \"Amaryllis (Amaryllis)\",\n \"Bœuf (Cow)\",\n \"Aubergine (Eggplant)\",\n \"Piment (Chili Pepper)\",\n \"Tomate (Tomato)\",\n \"Orge (Barley)\",\n \"Tonneau (Barrel)\",\n \"Pomme (Apple)\",\n \"Céleri (Celery)\",\n \"Poire (Pear)\",\n \"Betterave (Beet root)\",\n \"Oie (Goose)\",\n \"Héliotrope (Heliotrope)\",\n \"Figue (Fig)\",\n \"Scorsonère (Black Salsify)\",\n \"Alisier (Chequer Tree)\",\n \"Charrue (Plough)\",\n \"Salsifis (Salsify)\",\n \"Macre (Water chestnut)\",\n \"Topinambour (Jerusalem Artichoke)\",\n \"Endive (Endive)\",\n \"Dindon (Turkey)\",\n \"Chervis (Skirret)\",\n \"Cresson (Watercress)\",\n \"Dentelaire (Leadworts)\",\n \"Grenade (Pomegranate)\",\n \"Herse (Harrow)\",\n \"Bacchante (Asarum baccharis)\",\n \"Azerole (Acerola)\",\n \"Garance (Madder)\",\n \"Orange (Orange)\",\n \"Faisan (Pheasant)\",\n \"Pistache (Pistachio)\",\n \"Macjonc (Tuberous pea)\",\n \"Coing (Quince)\",\n \"Cormier (Service tree)\",\n \"Rouleau (Roller)\",\n \"Raiponce (Rampion)\",\n \"Turneps (Turnip)\",\n \"Chicorée (Chicory)\",\n \"Nèfle (Medlar)\",\n \"Cochon (Pig)\",\n \"Mâche (Corn Salad)\",\n \"Chou-fleur (Cauliflower)\",\n \"Miel (Honey)\",\n \"Genièvre (Juniper)\",\n \"Pioche (Pickaxe)\",\n \"Cire (Wax)\",\n \"Raifort (Horseradish)\",\n \"Cèdre (Cedar tree)\",\n \"Sapin (Fir tree)\",\n \"Chevreuil (Roe Deer)\",\n \"Ajonc (Gorse)\",\n \"Cyprès (Cypress Tree)\",\n \"Lierre (Ivy)\",\n \"Sabine (Juniper)\",\n \"Hoyau (Grub-hoe)\",\n \"Érable sucré (Maple Tree)\",\n \"Bruyère (Heather)\",\n \"Roseau (Reed plant)\",\n \"Oseille (Sorrel)\",\n \"Grillon (Cricket)\",\n \"Pignon (Pinenut)\",\n \"Liège (cork)\",\n \"Truffe (Truffle)\",\n \"Olive (Olive)\",\n \"Pelle (shovel)\",\n \"Tourbe (Peat)\",\n \"Houille (Coal)\",\n \"Bitume (Bitumen)\",\n \"Soufre (Sulphur)\",\n \"Chien (Dog)\",\n \"Lave (Lava)\",\n \"Terre végétale (Topsoil)\",\n \"Fumier (Manure)\",\n \"Salpêtre (Saltpeter)\",\n \"Fléau (Flail)\",\n \"Granit (Granite stone)\",\n \"Argile (Clay)\",\n \"Ardoise (Slate)\",\n \"Grès (Sandstone)\",\n \"Lapin (Rabbit)\",\n \"Silex (Flint)\",\n \"Marne (Marl)\",\n \"Pierre à chaux (Limestone)\",\n \"Marbre (Marble)\",\n \"Van (Winnowing basket)\",\n \"Pierre à plâtre (Gypsum)\",\n \"Sel (Salt)\",\n \"Fer (Iron)\",\n \"Cuivre (Copper)\",\n \"Chat (Cat)\",\n \"Étain (Tin)\",\n \"Plomb (Lead)\",\n \"Zinc (Zinc)\",\n \"Mercure (Mercury (metal))\",\n \"Crible (Sieve)\",\n \"Lauréole (Spurge-laurel)\",\n \"Mousse (Moss)\",\n \"Fragon (Butcher’s Broom)\",\n \"Perce-neige (Snowdrop)\",\n \"Taureau (Bull)\",\n \"Laurier-thym (Laurustinus)\",\n \"Amadouvier (Tinder polypore)\",\n \"Mézéréon (Daphne mezereum)\",\n \"Peuplier (Poplar Tree)\",\n \"Coignée (Axe)\",\n \"Ellébore (Hellebore)\",\n \"Brocoli (Broccoli)\",\n \"Laurier (Laurel)\",\n \"Avelinier (Cob or filbert)\",\n \"Vache (Cow)\",\n \"Buis (Box Tree)\",\n \"Lichen (Lichen)\",\n \"If (Yew tree)\",\n \"Pulmonaire (Lungwort)\",\n \"Serpette (Billhook)\",\n \"Thlaspi (Pennycress)\",\n \"Thimelé (Rose Daphne)\",\n \"Chiendent (Couch Grass)\",\n \"Trainasse (Knotweed)\",\n \"Lièvre (Hare)\",\n \"Guède (Woad)\",\n \"Noisetier (Hazel)\",\n \"Cyclamen (Cyclamen)\",\n \"Chélidoine (Celandine)\",\n \"Traîneau (Sleigh)\",\n \"Tussilage (Coltsfoot)\",\n \"Cornouiller (Dogwood)\",\n \"Violier (Matthiola)\",\n \"Troène (Privet)\",\n \"Bouc (Billygoat)\",\n \"Asaret (Wild Ginger)\",\n \"Alaterne (Buckthorn)\",\n \"Violette (Violet (plant))\",\n \"Marceau (Goat Willow)\",\n \"Bêche (Spade)\",\n \"Narcisse (Narcissus)\",\n \"Orme (Elm Tree)\",\n \"Fumeterre (Common fumitory)\",\n \"Vélar (Hedge Mustard)\",\n \"Chèvre (Goat)\",\n \"Épinard (Spinach)\",\n \"Doronic (Large-flowered Leopard’s Bane)\",\n \"Mouron (Pimpernel)\",\n \"Cerfeuil (Chervil)\",\n \"Cordeau (Twine)\",\n \"Mandragore (Mandrake)\",\n \"Persil (Parsley)\",\n \"Cochléaria (Scurvy-grass)\",\n \"Pâquerette (Daisy)\",\n \"Thon (Tuna)\",\n \"Pissenlit (Dandelion)\",\n \"Sylve (Forest)\",\n \"Capillaire (Maidenhair fern)\",\n \"Frêne (Ash Tree)\",\n \"Plantoir (Dibber: a hand gardening tool)\",\n \"Primevère (Primrose)\",\n \"Platane (Plane Tree)\",\n \"Asperge (Asparagus)\",\n \"Tulipe (Tulip)\",\n \"Poule (Hen)\",\n \"Bette (Chard Plant)\",\n \"Bouleau (Birch Tree)\",\n \"Jonquille (Daffodil)\",\n \"Aulne (Alder)\",\n \"Couvoir (Hatchery)\",\n \"Pervenche (Periwinkle)\",\n \"Charme (Ironwood)\",\n \"Morille (Morel)\",\n \"Hêtre (Beech Tree)\",\n \"Abeille (Bee)\",\n \"Laitue (Lettuce)\",\n \"Mélèze (Larch)\",\n \"Ciguë (Hemlock)\",\n \"Radis (Radish)\",\n \"Ruche (Hive)\",\n \"Gainier (Judas tree)\",\n \"Romaine (Lettuce)\",\n \"Marronnier (Chestnut Oak)\",\n \"Roquette (Arugula or Rocket)\",\n \"Pigeon (Pigeon)\",\n \"Lilas (Lilac)\",\n \"Anémone (Anemone)\",\n \"Pensée (Pansy)\",\n \"Myrtille (Blueberry)\",\n \"Greffoir (Knife)\",\n \"Rose (Rose)\",\n \"Chêne (Oak Tree)\",\n \"Fougère (Fern)\",\n \"Aubépine (Hawthorn)\",\n \"Rossignol (Nightingale)\",\n \"Ancolie (Columbine)\",\n \"Muguet (Lily of the Valley)\",\n \"Champignon (Button mushroom)\",\n \"Hyacinthe (Hyacinth)\",\n \"Râteau (Rake)\",\n \"Rhubarbe (Rhubarb)\",\n \"Sainfoin (Sainfoin)\",\n \"Bâton-d’or (Wallflower)\",\n \"Chamérops (Palm tree)\",\n \"Ver à soie (Silkworm)\",\n \"Consoude (Comfrey)\",\n \"Pimprenelle (Salad Burnet)\",\n \"Corbeille d’or (Basket of Gold)\",\n \"Arroche (Orache)\",\n \"Sarcloir (Garden hoe)\",\n \"Statice (Sea Lavender)\",\n \"Fritillaire (Fritillary)\",\n \"Bourrache (Borage)\",\n \"Valériane (Valerian)\",\n \"Carpe (Carp)\",\n \"Fusain (Spindle (shrub))\",\n \"Civette (Chive)\",\n \"Buglosse (Bugloss)\",\n \"Sénevé (Wild mustard)\",\n \"Houlette (Shepherd’s crook)\",\n \"Luzerne (Alfalfa)\",\n \"Hémérocalle (Daylily)\",\n \"Trèfle (Clover)\",\n \"Angélique (Angelica)\",\n \"Canard (Duck)\",\n \"Mélisse (Lemon Balm)\",\n \"Fromental (Oat grass)\",\n \"Martagon (Martagon lily)\",\n \"Serpolet (Thyme plant)\",\n \"Faux (Scythe)\",\n \"Fraise (Strawberry)\",\n \"Bétoine (Woundwort)\",\n \"Pois (Pea)\",\n \"Acacia (Acacia)\",\n \"Caille (Quail)\",\n \"Œillet (Carnation)\",\n \"Sureau (Elderberry)\",\n \"Pavot (Poppy plant)\",\n \"Tilleul (Linden or Lime tree)\",\n \"Fourche (Pitchfork)\",\n \"Barbeau (Cornflower)\",\n \"Camomille (Camomile)\",\n \"Chèvrefeuille (Honeysuckle)\",\n \"caille-lait (Bedstraw)\",\n \"Tanche (Tench)\",\n \"Jasmin (Jasmine Plant)\",\n \"Verveine (Verbena)\",\n \"Thym (Thyme Plant)\",\n \"Pivoine (Peony Plant)\",\n \"Chariot (Hand Cart)\",\n \"Seigle (Rye)\",\n \"Avoine (Oats)\",\n \"Oignon (Onion)\",\n \"Véronique (Speedwell)\",\n \"Mulet (Mule)\",\n \"Romarin (Rosemary)\",\n \"Concombre (Cucumber)\",\n \"Échalote (Shallot)\",\n \"Absinthe (Wormwood)\",\n \"Faucille (Sickle)\",\n \"Coriandre (Coriander)\",\n \"Artichaut (Artichoke)\",\n \"Girofle (Clove)\",\n \"Lavande (Lavender)\",\n \"Chamois (Chamois)\",\n \"Tabac (Tobacco)\",\n \"Groseille (Currant)\",\n \"Gesse (Hairy Vetchling)\",\n \"Cerise (Cherry)\",\n \"Parc (Park)\",\n \"Menthe (Mint)\",\n \"Cumin (Cumin)\",\n \"Haricot (Bean)\",\n \"Orcanète (Alkanet)\",\n \"Pintade (Guinea fowl)\",\n \"Sauge (Sage Plant)\",\n \"Ail (Garlic)\",\n \"Vesce (Tare)\",\n \"Blé (Wheat)\",\n \"Chalémie (Shawm)\",\n \"Épeautre (Einkorn Wheat)\",\n \"Bouillon blanc (Common Mullein)\",\n \"Melon (Honeydew Melon)\",\n \"Ivraie (Ryegrass)\",\n \"Bélier (Ram)\",\n \"Prêle (Horsetail)\",\n \"Armoise (Mugwort)\",\n \"Carthame (Safflower)\",\n \"Mûre (Blackberry)\",\n \"Arrosoir (Watering Can)\",\n \"Panis (Panic grass)\",\n \"Salicorne (Common Glasswort)\",\n \"Abricot (Apricot)\",\n \"Basilic (Basil)\",\n \"Brebis (Ewe)\",\n \"Guimauve (Marshmallow root)\",\n \"Lin (Flax)\",\n \"Amande (Almond)\",\n \"Gentiane (Gentian)\",\n \"Écluse (Lock)\",\n \"Carline (Carline thistle)\",\n \"Câprier (Caper)\",\n \"Lentille (Lentil)\",\n \"Aunée (Yellow starwort)\",\n \"Loutre (Otter)\",\n \"Myrte (Myrtle)\",\n \"Colza (Rapeseed)\",\n \"Lupin (Lupin)\",\n \"Coton (Cotton)\",\n \"Moulin (Mill)\",\n \"Prune (Plum)\",\n \"Millet (Millet)\",\n \"Lycoperdon (Puffball)\",\n \"Escourgeon (Six-row Barley)\",\n \"Saumon (Salmon)\",\n \"Tubéreuse (Tuberose)\",\n \"Sucrion (Sugar melon)\",\n \"Apocyn (Apocynum)\",\n \"Réglisse (Liquorice)\",\n \"Échelle (Ladder)\",\n \"Pastèque (Watermelon)\",\n \"Fenouil (Fennel)\",\n \"Épine vinette (Barberry)\",\n \"Noix (Walnut)\",\n \"Truite (Trout)\",\n \"Citron (Lemon)\",\n \"Cardère (Teasel)\",\n \"Nerprun (Buckthorn)\",\n \"Tagette (Mexican Marigold)\",\n \"Hotte (Sack)\",\n \"Églantine (Wild Rose)\",\n \"Noisette (Hazelnut)\",\n \"Houblon (Hops)\",\n \"Sorgho (Sorghum)\",\n \"Écrevisse (Crayfish)\",\n \"Bigarade (Bitter Orange)\",\n \"Verge d’or (Goldenrod)\",\n \"Maïs (Maize or Corn)\",\n \"Marron (Chestnut)\",\n \"Panier (Basket)\",\n \"La Fête de la Vertu (Celebration of Virtue)\",\n \"La Fête du Génie (Celebration of Talent)\",\n \"La Fête du Travail (Celebration of Labour)\",\n \"La Fête de l'Opinion (Celebration of Principles)\",\n \"La Fête des Récompenses (Celebration of Honours)\",\n \"La Fête de la Révolution (Celebration of the Revolution)\"]\n return symbols[dayNum]\n end",
"def cweek\n end",
"def find_day_of(num)\n curr_day = Time.new(2016, 1, 1)\n day_find = curr_day + (3600 * 24 * num - 1)\n #the_day = curr_day.yday()\n\n\n p \"#{day_find} is Monday\" if day_find.monday?\n p \"#{day_find} is Tuesday\" if day_find.tuesday?\n p \"#{day_find} is Wednesday\" if day_find.wednesday?\n p \"#{day_find} is Thursday\" if day_find.thursday?\n p \"#{day_find} is Friday\" if day_find.friday?\n p \"#{day_find} is Saturday\" if day_find.saturday?\n p \"#{day_find} is Sunday\" if day_find.sunday?\n\n p day_find.ctime\nend",
"def dayOfWeek\n days = 0;\n tempYear = MIN_YEAR\n while tempYear < @year\n days += SimpleDate.daysInYear(tempYear).to_i\n tempYear+=1\n end\n\n days = days + ordinalDate\n #puts \"days #{days}\"\n days = days % 7\n\n end",
"def getSundays(d1,d2)\n d1 += 1 while (d1.wday != 0) # add days till starting on sunday\n sundays = []\n d1.step(d2,7) do |date| # move forward seven days for every sunday\n sundays .push date\n end\n sundays\nend",
"def day_of_programmer(year)\n\n days = 215 # total number of days for 7 months (jan - aug except feb).\n # Feb days will be vary. 256th day of the year comes in september\n if year <= 1917 # according to Julian calender\n if (year % 4) == 0\n feb_days = 29\n else\n feb_days = 28\n end\n elsif year == 1918\n feb_days = 15\n else # according to Gregorian\n if (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))\n feb_days = 29\n else\n feb_days = 28\n end\n end\n\n total_days = 256 - (feb_days + days) # 8 months days\n print \"#{total_days}.09.#{year}\"\n\nend",
"def load_hours\n @day = Schedule.first\n @hours = Array.new(48)\n\n @hours[0] =@day.h0\n @hours[1] =@day.h1\n @hours[2] =@day.h2\n @hours[3] =@day.h3\n @hours[4] =@day.h4\n @hours[5] =@day.h5\n @hours[6] =@day.h6\n @hours[7] =@day.h7\n @hours[8] =@day.h8\n @hours[9] =@day.h9\n @hours[10]=@day.h10\n @hours[11]=@day.h11\n @hours[12]=@day.h12\n @hours[13]=@day.h13\n @hours[14]=@day.h14\n @hours[15]=@day.h15\n @hours[16]=@day.h16\n @hours[17]=@day.h17\n @hours[18]=@day.h18\n @hours[19]=@day.h19\n @hours[20]=@day.h20\n @hours[21]=@day.h21\n @hours[22]=@day.h22\n @hours[23]=@day.h23\n @hours[24]=@day.h24\n @hours[25]=@day.h25\n @hours[26]=@day.h26\n @hours[27]=@day.h27\n @hours[28]=@day.h28\n @hours[29]=@day.h29\n @hours[30]=@day.h30\n @hours[31]=@day.h31\n @hours[32]=@day.h32\n @hours[33]=@day.h33\n @hours[34]=@day.h34\n @hours[35]=@day.h35\n @hours[36]=@day.h36\n @hours[37]=@day.h37\n @hours[38]=@day.h38\n @hours[39]=@day.h39\n @hours[40]=@day.h40\n @hours[41]=@day.h41\n @hours[42]=@day.h42\n @hours[43]=@day.h43\n @hours[44]=@day.h44\n @hours[45]=@day.h45\n @hours[46]=@day.h46\n @hours[47]=@day.h47\n\n return @hours\n end",
"def lunch(day)\n\nend",
"def print_month_old\n day = 1\n days = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]\n start_index = [18, 0, 3, 6, 9, 12, 15]\n start_day = first_day\n start = start_index[start_day]\n puts \"#{@month.capitalize} #{@year}\".center(20)\n puts \"Su Mo Tu We Th Fr Sa\" + \"\\n\"\n\n start_index.each do |num|\n if start == num\n num.times {print \"\\s\"}\n if day.to_s.length == 1\n print \" \" + day.to_s + \"\\s\"\n else\n print day.to_s + \"\\s\"\n end\n end\n end\n print_and_break(start + 3, 2)\n puts \"\\n\"\n puts \"\\n\"\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def test_month_that_starts_on_sunday\n skip\n output = `./cal.rb 01 2012`\n expected = <<EOS\n January 2012\nSu Mo Tu We Th Fr Sa\n 1 2 3 4 5 6 7\n 8 9 10 11 12 13 14\n15 16 17 18 19 20 21\n22 23 24 25 26 27 28\n29 30 31\n\nEOS\n assert_equal expected, output\n end",
"def day_less_than_10(num)\n if num == 1\n unusual_day_1(num)\n elsif num == 2\n unusual_day_2(num)\n elsif num == 3\n unusual_day_3(num)\n elsif num.between?(4, 9) && page.has_text?(\"2#{num}\", count: 2)\n calendar_date(num, 1)\n else\n first_day(num).click\n end\nend",
"def set_day_if_discarded; end",
"def print_body(day2, k)\n print \"|\"\n count_events = @ary_event.count do |event|\n event.start_date.day == day2\n end\n if count_events == 1\n ary_time_and_name = convert_time_and_name(@ary_event.find{ |event| event.start_date.day == day2})\n temp_str = ary_time_and_name[k]\n if temp_str.nil? == false\n print temp_str + \" \" * (9 - temp_str.length)\n else\n print \" \" * 9\n end\n elsif count_events >= 2 && k <= 1\n if k == 0\n print count_events.to_s + \" events \"\n else\n print \"scheduled\"\n end\n else\n print \" \" * 9\n end\n end",
"def get_day_name(day)\n# setting a variable with an empty string first\n day_name = \"\"\n\n# instead of writing a LONG if statement for all 7 days\n# we will set up a case expression\n case day\n when \"mon\"\n day_name = \"Monday\"\n when \"tue\"\n day_name = \"Tuesday\"\n when \"wed\"\n day_name = \"Wednesday\"\n when \"thu\"\n day_name = \"Thursday\"\n when \"fri\"\n day_name = \"Friday\"\n when \"sat\"\n day_name = \"Saturday\"\n when \"sun\"\n day_name = \"Sunday\"\n #if user enters invalid abbreviation\n else\n day_name = \"Invalid abbreviation\"\n end #end of case\n return day_name\nend",
"def date_end # originally date_start\n\tdate = Date.today\n\t(1..7).each do |n|\n\t\tdate = Date.today - n#.days\n\t\tbreak if date.wday == 6 # 0 = Sun, 1 = Mon ... 6 = Sat\n\tend\n\tdate\nend",
"def first_day\n m = set_month\n q = 1\n y = set_year\n h = (q + (((m+1) * 26)/10) + y + (y/4) + (6 * (y/100)) + (y/400)) % 7\n end",
"def week; end",
"def unusual_day_4(num)\n if one_30_last(num)\n calendar_date(num, 1)\n elsif one_30_not_last(num) || two_30_one_31_last(num)\n calendar_date(num, 2)\n elsif two_30_one_31_not_last(num) || two_30_two_31\n calendar_date(num, 3)\n end\nend",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n month = birthday.strftime(\"%m\").to_i\n day = birthday.strftime(\"%d\").to_i\n year = birthday.strftime(\"%Y\").to_i\n loop do\n year = year += 1\n time = Time.new(year, month, day)\n break if time.strftime(\"%u\") == \"5\"\n end\n year\nend",
"def check_day(meet_days_integer,day_to_check)\n\n day_shift = {monday: 0, tuesday: 1, wednesday: 2, thursday: 3, friday: 4, saturday: 5, sunday:6}\n\n# puts \"day_to_check = #{day_to_check}\"\n# puts \"day_shift[:tuesday] = #{day_shift[:tuesday]}\"\n# puts \"day_shift[day_to_check] = #{day_shift[day_to_check]}\"\n day_shift_int = day_shift[day_to_check].to_i\n# puts \"day_shift_int = #{day_shift_int}\"\n shifted_int = ( meet_days_integer >> day_shift_int ).to_s(2)\n# puts \"shifted_int = #{shifted_int}\"\n day_checked = shifted_int.to_i % 2\n# puts \"day_checked = #{day_checked}\"\n return day_checked.to_s\nend",
"def to_day_1_7(day_0_6)\n [7,1,2,3,4,5,6,7][day_0_6.to_i] if [0,1,2,3,4,5,6,7].include? day_0_6\n end",
"def to_s\n day_abbrs = day_hash\n i = 0\n #Array of consec_days arrays\n consec_day_groups = []\n #Array of consecutive days. This gets\n #reset when we find a day that is not\n #part of a consecutive set of days.\n consec_days = []\n\n @day_ids.each do |day_id|\n if i == 0\n #add the day abbr for this day if this is the first\n #element of @day_ids.\n consec_days << day_abbrs[day_id.to_s]\n\n elsif @day_ids[i-1] == (day_id - 1)\n #if this is not the first day in @day_ids, check\n #if the previous day in the array is the real life\n #previous day of the week. If so, add it to the\n #consec_days array\n consec_days << day_abbrs[day_id.to_s]\n else\n #otherwise start a new consec_days array and\n #add the current consec_days array to the\n #consec_day_groups array.\n consec_day_groups << consec_days\n\n consec_days = []\n consec_days << day_abbrs[day_id.to_s]\n end\n #Always add the consec_days array when this is the\n #last day of the @day_ids array\n if day_id == @day_ids.last\n consec_day_groups << consec_days\n end\n i += 1\n end\n\n day_strings = []\n consec_day_groups.each do |c|\n if c.length > 2\n day_strings << c.first.to_s + \"-\" + c.last.to_s\n else\n day_strings << c.join(\", \")\n end\n end\n return day_strings.join(\", \")\n end",
"def print_and_break(start, day)\n set_day = day\n num_of_month = is_leap?[adjust_set_month]\n print_time = (((18 - start)/3)+1)\n\n\n if set_day <= num_of_month - 7\n print_time.times do\n if set_day.to_s.length == 1\n print \"\\s\" + set_day.to_s + \"\\s\"\n set_day += 1\n else\n print set_day.to_s + \"\\s\"\n set_day += 1\n end\n end\n print \"\\n\"\n print_and_break(0, set_day)\n else\n for i in set_day..num_of_month\n print i.to_s + \"\\s\"\n end\n end\n end",
"def getForecast(location, today)\n forecasts = location.forecasts\n\n # for each forecast, set the weekday, predicted high temp and predicted low temp\n forecasts.each do |forecast|\n weekday = forecast['date']\n day = weekday.strftime('%A')\n weather = forecast['text'].downcase\n predHigh = forecast['high'].to_i\n predLow = forecast['low'].to_i\n\n dayNum = weekday.strftime('%w')\n\n # set the correct day of the week in the forecast using a conditional statement\n if dayNum == today\n weekday = \"Today\"\n elsif dayNum == today + 1 || dayNum == today -6\n weekday \"Tomorrow\"\n else\n weekday = day\n end\n\n puts \"#{weekday}'s forecast is #{weather} with a high of #{predHigh} ˚C and a low of #{predLow} ˚C.\"\n end\nend",
"def test_08_cal_integration_month_with_1st_on_Sunday_works\n assert_equal(`cal 01 2012`, `ruby cal.rb 01 2012`)\n end",
"def get_work_days\n puts \"Getting work days...\"\n work_days = []\n biweek = get_biweek\n week_1 = @schedule[biweek[0]].compact.uniq\n week_2 = @schedule[biweek[1]].compact.uniq\n\n @schedule.each_with_index do |row, i|\n DAYS.each_with_index do |day, j|\n date = ( i < biweek[1] ? week_1[j] : week_2[j] )\n day_name = day[:day]\n name = row[day[:name]]\n hours = row[day[:hours]]\n if name && hours && name.downcase.include?(@person.downcase)\n work_days.push({\n :name => @person,\n :date => get_date(date, hours)\n })\n end\n end\n end\n puts \"Work days:\\n#{work_days}\"\n return work_days\nend",
"def filling_dates (student_class, class_day)\n prefix = Dayweek.find_by_id(class_day.dayweek_id).dayname\n if prefix == \"Monday\"\n student_class.Mon_fromh = class_day.from_time[0,2]\n student_class.Mon_fromm = class_day.from_time[2,2]\n student_class.Mon_toh = class_day.to_time[0,2]\n student_class.Mon_tom = class_day.to_time[2,2] \n student_class.Mon_check = \"1\"\n end\n if prefix == \"Tuesday\"\n student_class.Tue_fromh = class_day.from_time[0,2]\n student_class.Tue_fromm = class_day.from_time[2,2]\n student_class.Tue_toh = class_day.to_time[0,2]\n student_class.Tue_tom = class_day.to_time[2,2]\n student_class.Tue_check = \"1\"\n end\n \n if prefix == \"Wednesday\"\n student_class.Wed_check = \"1\"\n student_class.Wed_fromh = class_day.from_time[0,2]\n student_class.Wed_fromm = class_day.from_time[2,2]\n student_class.Wed_toh = class_day.to_time[0,2]\n student_class.Wed_tom = class_day.to_time[2,2]\n student_class.Wed_check = \"1\" \n end\n if prefix == \"Thursday\"\n student_class.Thu_fromh = class_day.from_time[0,2]\n student_class.Thu_fromm = class_day.from_time[2,2]\n student_class.Thu_toh = class_day.to_time[0,2]\n student_class.Thu_tom = class_day.to_time[2,2]\n student_class.Thu_check = \"1\"\n end\n if prefix == \"Friday\"\n student_class.Fri_fromh = class_day.from_time[0,2]\n student_class.Fri_fromm = class_day.from_time[2,2]\n student_class.Fri_toh = class_day.to_time[0,2]\n student_class.Fri_tom = class_day.to_time[2,2] \n student_class.Fri_check = \"1\" \n end\n if prefix == \"Saturday\"\n student_class.Sat_fromh = class_day.from_time[0,2]\n student_class.Sat_fromm = class_day.from_time[2,2]\n student_class.Sat_toh = class_day.to_time[0,2]\n student_class.Sat_tom = class_day.to_time[2,2] \n student_class.Sat_check = \"1\" \n end\n if prefix == \"Sunday\" \n student_class.Sun_fromh = class_day.from_time[0,2]\n student_class.Sun_fromm = class_day.from_time[2,2]\n student_class.Sun_toh = class_day.to_time[0,2]\n student_class.Sun_tom = class_day.to_time[2,2]\n student_class.Sun_check = \"1\"\n end\n end",
"def weekday(days)\nt = Date.today\narr = []\n days.times do\n arr << \"ok\" if t.saturday? || t.sunday?; t = t - 1\n end\n arr.count\nend",
"def collect_rainfall(year,month)\r\n # the number of days within a month is determined by the year\r\n days = self.get_days(year,month)\r\n\r\n puts \"Please enter the rainfall details in millimeters, eg: 11\"\r\n rainfall = [@a_place, year, month]\r\n # loop is based on month days\r\n for day in 1..days\r\n if day > 1\r\n print \"Day: \"\r\n if day > 1 && day <= 11\r\n (1..day).each { |i| print \"#{i}\".rjust(5) }\r\n end\r\n puts\r\n print \" mm: \"\r\n if day > 1 and day <= 11\r\n (1..day).each { |i| print \"#{rainfall[i+2]}\".rjust(5) }\r\n end\r\n end\r\n puts\r\n if day > 11 && day <= 22\r\n print \"Day: \"\r\n (1..11).each { |i| print \"#{i}\".rjust(5) }\r\n puts\r\n print \" mm: \"\r\n (1..11).each { |i| print \"#{rainfall[i+2]}\".rjust(5) }\r\n print \"\\n\\n\"\r\n print \"Day: \"\r\n (12..day).each { |i| print \"#{i}\".rjust(5) }\r\n puts\r\n print \" mm: \"\r\n (12..day).each { |i| print \"#{rainfall[i+2]}\".rjust(5) }\r\n end\r\n puts\r\n if day > 22\r\n print \"Day: \"\r\n (1..11).each { |i| print \"#{i}\".rjust(5) }\r\n puts\r\n print \" mm: \"\r\n (1..11).each { |i| print \"#{rainfall[i+2]}\".rjust(5) }\r\n print \"\\n\\n\"\r\n print \"Day: \"\r\n (12..22).each { |i| print \"#{i}\".rjust(5) }\r\n puts\r\n print \" mm: \"\r\n (12..22).each { |i| print \"#{rainfall[i+2]}\".rjust(5) }\r\n print \"\\n\\n\"\r\n print \"Day: \"\r\n (23..day).each { |i| print \"#{i}\".rjust(5) }\r\n puts\r\n print \" mm: \"\r\n (23..day).each { |i| print \"#{rainfall[i+2]}\".rjust(5) }\r\n end\r\n puts\r\n puts \"Enter rainfall on Day: #{day} for #{@a_place} at #{month} #{year}\"\r\n rainfall.insert(day+2,$stdin.gets.chomp)\r\n end\r\n\r\n return rainfall\r\n end",
"def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else\n @start_date = @today\n until @start_date.strftime(\"%a\") == \"Mon\"\n @start_date -= 1\n end\n end\n @end_date = @start_date+21\n @date_range = (@start_date..@end_date)\n @weeks = @date_range.to_a.in_groups_of(3)\n\n\n end",
"def beginning_of_fall_semester\n week = 4\n\n date = Chronic.parse(\"#{week}th thursday last august\")\n while date\n week += 1\n date = Chronic.parse(\"#{week}th thursday last august\")\n end\n\n Chronic.parse(\"#{week - 1}th thursday last august\").to_datetime\n end",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\nend",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\nend",
"def showDay(i)\n\tif i ==1 then puts \"The day is monday\"\n\telsif i ==2 then puts \"The day is tuesday\"\n\telsif i ==3 then puts \"The day is wednesday\"\n\telsif i ==4 then puts \"The day is thursday\"\n\telsif i ==5 then puts \"The day is friday\"\n\t#elsif (6..7)===i then puts \"Weekend time\"\n\telsif (6..7).include?(i) then puts \"Weekend time\"\n\t#equivalent statement in python\n\t#elif i in range(6,8)\n\telse puts \"That's not a real day\" \n\tend\n\t\nend",
"def day(date)\n \n days = self.days(14)\n \n day = Object\n \n days.each do |dayEach|\n break day = dayEach if dayEach.dia == date.strftime(\"%d-%m-%Y\") \n end\n \n day\n \n end",
"def collection_day\n puts \"#{self.street.name} binder\".light_white.on_light_red\n puts ''\n puts \"#{self.contact_name}, the next collection days for your house are:\"\n puts ''\n @bins.each do |bin|\n puts \"#{bin.type}: #{bin.collection_day}\"\n end\n end",
"def beginning_of_week=(_arg0); end",
"def beginning_of_week=(_arg0); end",
"def happy_birth_day\n\tdays = []\n\tmonths = []\n\tyears = []\n\t31.times do |d|\n\t\tdays << d\n\t\tdays.delete(0)\n\tend\n\t12.times do |m|\n\t\tmonths << m\n\t\tmonths.delete(0)\n\tend\n\t2019.times do |y|\n\t\tyears << y\n\t\tyears.delete(0)\n\tend\n\tif months.sample == 2\n\t\tdays.delete(31)\n\t\tdays.delete(30)\n\t\tdays.delete(29)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telsif months.sample == 2 && years.sample % 100 == 0 && years.sample % 400 == 0\n\t\tdays.delete(31)\n\t\tdays.delete(30)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telsif months.sample == 2 && years.sample % 4 == 0 && years.sample % 100 != 0\n\t\tdays.delete(31)\n\t\tdays.delete(30)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telsif months.sample == 4 || months.sample == 6 || months.sample == 9 || months.sample == 11\n\t\tdays.delete(31)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telse\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\tend\nend",
"def holidayChecker(dates, bank_holidays)\n dates = parseDates(dates) #parse dates array\n bank_holidays = parseDates(bank_holidays) #parse bank holidays array\n corrected_schedule = []\n dates.each do |date|\n while date.wday == 6 || date.wday == 7 || bank_holidays.include?(date) #while the date is either a bank holiday OR a Saturday OR a Sunday...\n date += 1\n end\n corrected_schedule.push(date)\n end\n puts corrected_schedule\nend",
"def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end",
"def day_stats\n days = Array.new(7){0}\n @file.each do |line|\n date = line[:regdate].split(\" \")\n date = Date.strptime(date[0],\"%m/%d/%y\")\n days[date.wday.to_i] += 1\n end\n days.each_with_index{ |counter, days| puts \"#{days}: #{counter}\"}\n\n end",
"def sundayCounter\n days = [31,28,31,30,31,30,31,31,30,31,30,31]\n date, sundays = 0, 1\n\n (1901...2000).each do\n (0..11).each do |month|\n date = (date + days[month]) % 7\n sundays += 1 if date == 6\n end\n end\n sundays\nend",
"def sunday_after days_ago=0\n d = Date.today - days_ago\n until d.sunday?\n d += 1\n end\n d\nend",
"def tuesday\n day(:tuesday)\n end",
"def view_symptoms_specific_date(day)\n day_symptoms = $db.execute( <<-SQL\n SELECT * FROM symptoms\n WHERE date=\"#{day}\";\n SQL\n )\n puts \"_____________________________\"\n puts \"Symptoms that occurred on #{day}:\"\n day_symptoms.each do | symptom |\n puts \"#{symptom['symptom']}\"\n end\n puts \"_____________________________\"\nend",
"def get_date(day, hours)\n current_time = Time.new #(2015,7,26) Preset date for testing. Should be current time\n if day.to_i > current_time.day\n month = current_time.month\n year = current_time.year\n else\n if current_time.month + 1 > 12\n month = 1\n year = current_time.year + 1\n else\n month = current_time.month + 1\n year = current_time.year\n end\n end\n year = year.to_i\n month = month.to_i\n day = day.to_i\n hours = hours.split('-')\n hours.map { |str| str.gsub!(/\\s+/, \"\") } #removes all white space\n hours[0] = ((hours[0].to_i != 12 && hours[0].to_i > 6) ? hours[0] + \"am\" : hours[0] + \"pm\") #adjusts hours to a 24 hour clock. Pivots at 6\n hours[1] = (hours[1].downcase.include?(\"close\") ? \"8pm\" : hours[1] + \"pm\") #sets \"close\" to be 8pm\n hours.map! { |time| DateTime.parse(time).strftime(\"%H:%M:%S\") }\n start_time = DateTime.parse(\"#{year}-\" + sprintf(\"%02d\", month) + \"-\" + sprintf(\"%02d\", day) + \"T#{hours[0]}\" + \"-0700\")\n end_time = DateTime.parse(\"#{year}-\" + sprintf(\"%02d\", month) + \"-\" + sprintf(\"%02d\", day) + \"T#{hours[1]}\" + \"-0700\")\n return { :start => start_time, :end => end_time }\nend",
"def list_days\n puts \"This Week's Forecast:\"\n\n Scraper.scrape_cast \n\n days = Project1::Forecast.all\n days.map.with_index(1) do |day, i|\n puts \"#{i}. #{day.name}\"\n end\n end",
"def copytermdays_RETIRED\n logger.debug \"entering copytermdays\"\n #logger.debug \"copytermdays_params: \" + copytermdays_params.inspect\n #sf = 5 # signigicant figures\n mystartcopyfromdate = copytermdays_params[\"from\"].to_date\n myendcopyfromdate = copytermdays_params[\"from\"].to_date + copytermdays_params[\"num_days\"].to_i\n mystartcopytodate = copytermdays_params[\"to\"].to_date\n myendcopytodate = copytermdays_params[\"to\"].to_date + copytermdays_params[\"num_days\"].to_i\n #@cal = calendar_read_display2(sf, mystartcopytodate, myendcopytodate)\n #@cal = calendar_read_display1f(sf, mystartcopytodate, myendcopytodate, {})\n @options = Hash.new\n @options[:startdate] = mystartcopytodate\n @options[:enddate] = myendcopytodate\n #@cal = calendar_read_display1f(sf, @options)\n @cal = calendar_read_display1f(@options)\n unless @cal.empty?\n # destination is not empty - show error and return\n flash[:notice] = \"Destination days are not empty - will not copy!!!\"\n redirect_to copytermdaysedit_path(copytermdays_params)\n end\n @options[:startdate] = mystartcopyfromdate\n @options[:enddate] = myendcopyfromdate\n @cal = calendar_read_display1f(@options)\n if @cal.empty?\n # source is empty - show error and return\n flash[:notice] = \"Source days are empty - nothing to copy!!!\"\n redirect_to copytermdaysedit_path(copytermdays_params)\n end\n # get to here, we are set up to do a copy\n # @cal contains the info to be copied.\n # First get the number of dayes to advance by ( + or - is valid)\n adddays = mystartcopytodate - mystartcopyfromdate\n logger.debug \"adddays: \" + adddays.inspect\n @results = Array.new\n# Each site has an array\n# @cal{sitename}[0][] -> [0] = {value = site name}\n# [1] = {value = date}\n# @cal{sitename}[1][] -> [0] = {value = session_time} e.g. \"03-3- PM\"\n# [1] = {slotid = nnnn\n# id_dom = \"CAL201804041530\"\n# values[] -> [0] = object #<Lesson>\n# [1] = object #<Lesson>\n# ....\n# }\n @cal.each do |site, sitevalue| \n # Now work through the slots for this site and day\n siteName = siteDate = \"\" # control scope\n sitevalue.each_with_index do |bankslots, bankslotindex|\n if bankslotindex == 0 \n siteName = bankslots[0]['value']\n siteDate = siteDateBankFrom = bankslots[1]['value']\n n = siteDate.match(/(\\d+.*)/)\n siteDate = n[1]\n if bankslots[2] == nil\n @results.push \"processing #{siteName} #{siteDateBankFrom}\"\n else\n siteDateBankTo = bankslots[2]['value']\n @results.push \"processing #{siteName} #{siteDateBankFrom} to #{siteDateBankTo}\"\n end\n else\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n @results.push \"Slotid: #{thisslotid}\"\n thisslot = Slot.find(thisslotid)\n mytimeslotTo = thisslot.timeslot + adddays.to_i * 86400\n myslotTo = Slot.new(timeslot: mytimeslotTo, location: thisslot.location)\n if myslotTo.save\n @results.push \"created slot \" + myslotTo.inspect\n else\n @results.push \"FAILED creating slot \" + myslotTo.inspect + \n \"ERROR: \" + myslotTo.errors.messages.inspect\n end\n #-------------------------------------------------------------------\n # For copying term info,\n # 1. Slots are always copied.\n # 2. Determine what tutors and students need to be copied.\n # Logic is:\n # Lesson status | copy lesson | copy tutors | copy students\n # routine | yes | yes if | yes if\n # (=standard) | | - rostered | - rostered\n # | | - away | - away\n # | | - absent | - absent\n # | | | - bye\n # | | no if | no if\n # | | - deal | - deal\n # | | - kind=called| \n # flexible | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # | | - absent | \n # | | no if | \n # | | - deal | \n # | | - kind=called| \n # on_BFL | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # | | - absent | \n # | | no if | \n # | | - deal | \n # | | - kind=called| \n # onSetup | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # | | - absent | \n # | | no if | \n # | | - deal | \n # | | - kind=called| \n # onCall | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # free | yes | no always | no always\n # global | no | | \n # allocate | no | | \n # park | no | |\n #-------------------------------------------------------------------\n # Now to look at each lesson in each slot\n if slot['values'].respond_to?(:each) then\n slot['values'].each do |lesson|\n logger.debug \"lesson: \" + lesson.inspect\n # is this a valid lesson to copy\n next if ['global', 'allocate', 'park'].include?(lesson.status) \n mylesson = Lesson.new(slot_id: myslotTo.id, status: lesson.status)\n if mylesson.save\n @results.push \"created lesson \" + mylesson.inspect\n else\n @results.push \"FAILED creating lesson \" + mylesson.inspect + \n \"ERROR: \" + mylesson.errors.messages.inspect\n end\n # for free lesson, do not copy any tutors or students\n next if lesson.status == 'free'\n # At this point, decision to copy tutors or students depends\n # on their kind and status.\n # Now find all the tutors in this lesson\n if lesson.tutors.respond_to?(:each) then\n lesson.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n thistutrole = tutor.tutroles.where(lesson_id: lesson.id).first\n # Check if this tutor-lesson should be copied\n flagtutorcopy = false\n flagtutorcopy = true if ['scheduled', 'confirmed', 'notified',\n 'attended', 'away', 'absent'].include?(thistutrole.status)\n flagtutorcopy = false if thistutrole.kind == 'called'\n next unless flagtutorcopy\n mytutrole = Tutrole.new(lesson_id: mylesson.id,\n tutor_id: tutor.id, \n status: 'scheduled',\n kind: thistutrole.kind)\n if mytutrole.save\n @results.push \"created tutrole #{tutor.pname} \" + mytutrole.inspect \n else\n @results.push \"FAILED creating tutrole \" + mytutrole.inspect + \n \"ERROR: \" + mytutrole.errors.messages.inspect\n end\n end\n end\n \n # Now find all the students in this lesson\n if lesson.students.respond_to?(:each) then\n lesson.students.sort_by {|obj| obj.pname }.each do |student|\n thisrole = student.roles.where(lesson_id: lesson.id).first\n # check if this student should be copied.\n # for some lesson types, students are never copied\n next if ['flexible', 'on_BFL', 'onSetup', 'onCall',\n 'free'].include?(lesson.status)\n # others depend on their student-lesson status/\n flagstudentcopy = false\n flagstudentcopy = true if ['scheduled', 'attended', 'away',\n 'absent', 'bye'].include?(thisrole.status)\n next unless flagstudentcopy\n # if so, copy this student-lesson\n myrole = Role.new(lesson_id: mylesson.id,\n student_id: student.id, \n status: 'scheduled',\n kind: thisrole.kind)\n if myrole.save\n @results.push \"created role #{student.pname} \" + myrole.inspect\n else\n @results.push \"FAILED creating role \" + myrole.inspect + \n \"ERROR: \" + myrole.errors.messages.inspect\n end\n end\n end\n end\n end\n end\n end \n end\n end\n end",
"def solver(from_date, to_date, weekday)\n result = 0\n days_to_sunday = 7 - weekday\n new_date = from_date.increment_by_days days_to_sunday\n if (new_date.day == 1)\n result = result + 1\n end\n while new_date <= to_date\n if (new_date.day == 1)\n result = result + 1\n end\n new_date = new_date.increment_by_days 7\n end\n return result\nend",
"def not_february(num)\n if wrong_date(num).to_i.between?(23, 29)\n wrong_date_replacements = { 23 => 7, 24 => 6, 25 => 5, 26 => 4, 27 => 3,\n 28 => 2, 29 => 1 }\n calendar_date(num, wrong_date_replacements[wrong_date(num).to_i])\n else\n first_day(num).click\n end\nend",
"def weekloop(sday,looptime,loopday)\r\n @sday = sday.to_date\r\n if @sday.wday < loopday\r\n @sday = @sday + (loopday - @sday.wday)\r\n elsif @sday.wday > loopday\r\n @sday = @sday - (@sday.wday - loopday) + 7\r\n end\r\n dayarray = []\r\n dayarray << @sday.to_s\r\n for i in 1...looptime do\r\n @sday = @sday + 7\r\n dayarray << @sday.to_date.to_s\r\n end\r\n return dayarray\r\n end",
"def generate(day)\n File.open(\"day#{day}.cr\", \"w\") do |f|\n f.puts (<<~EOS)\n # https://adventofcode.com/#{Date.today.year}/day/#{day}\n #\n # --- Day #{day}: ... ---\n #\n\n def problem#{day}(records : Array(Int64))\n raise \"not implemented\"\n end\n\n # --- Part Two ---\n\n def problem#{day}_part_two(records : Array(Int64))\n raise \"not implemented\"\n end\n EOS\n end\n\n File.open(\"day#{day}_spec.cr\", \"w\") do |f|\n f.puts (<<~EOS)\n require \"spec\"\n require \"./day#{day}\"\n\n describe \"Day #{day}\" do\n end\n EOS\n end\n\n puts <<~EOS\n when #{day}.1\n puts \"--- Day #{day}: Sonar Sweep ---\"\n puts \"--- Part One ---\"\n puts \"How many measurements are larger than the previous measurement?\"\n entries = [] of Int64\n STDIN.each_line do |line|\n entries << line.to_i64\n end\n\n answer = problem#{day}(entries)\n when #{day}.2\n puts \"--- Day #{day}: Sonar Sweep ---\"\n puts \"--- Part Two ---\"\n puts \"Consider sums of a three-measurement sliding window. How many sums are larger than the previous sum?\"\n entries = [] of Int64\n STDIN.each_line do |line|\n entries << line.to_i64\n end\n\n answer = problem#{day}_part_two(entries)\n EOS\nend",
"def agenda\n ret = {}\n ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'].map do |day|\n ret[day] = courses.select do |course|\n course.days and course.days.include? day[0, 2]\n end\n ret[day].reverse!\n end\n return ret\n end",
"def generate_daytime_distribution \n \n end",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n while birthday.friday? == false\n birthday += (60 * 60 * 24 * 365)\n end\n birthday.year\n # rspec was after a year, but the question was asking for a day\n # not the clearest of questions. Should state \"someones\" bday, not\n # the users\nend",
"def what_day?(n)\n answer = \"Wrong, please enter a number between 1 and 7\"\n lookup = [\n [1, \"Sunday\"], \n [2, \"Monday\"], \n [3, \"Tuesday\"], \n [4, \"Wednesday\"], \n [5, \"Thursday\"], \n [6, \"Friday\"], \n [7, \"Saturday\"]]\n lookup.each do |v, d|\n if n == v\n answer = d\n end\n end\n answer\nend",
"def abbr_day_name; Date::ABBR_DAYNAMES[wday] end",
"def list_events(calendar, how, month_to_view=false)\n puts \" Here are your events...(#{how})\"\n events = Event.where(calender_id: calendar.id).order('start_time')\n events.each_with_index do |event, index|\n begin\n case how\n when \"today\"\n if DateTime.now.to_date == event.start_time.to_date\n puts \" #{index+1}. #{event.name}\"\n end\n when \"week\"\n if DateTime.now.to_date <= event.start_time.to_date && event.start_time.to_date <= DateTime.now.to_date + 7.days\n puts \" #{index+1}. #{event.name}\"\n end\n when \"month\"\n if month_to_view\n if month_to_view == event.start_time.to_s[5..6]\n puts \" #{index+1}. #{event.name}\"\n end\n else\n if DateTime.now.to_s[5..6] == event.start_time.to_s[5..6]\n puts \" #{index+1}. #{event.name}\"\n end\n end\n else\n puts \" #{index+1}. #{event.name}\"\n end\n rescue\n error\n end\n end\nend",
"def browse_by_day\n # Checkeo de parametros. El parametro date contiene la fecha seleccionada, pero puede venir tambien star_date,\n # con el mismo uso. Hay dos, porque el weekly_viewer usa start_date, pero habria que unificarlo.\n # Si hay algo en esos parametros se usa eso, y si no se usa la fecha de hoy.\n if params[:date].nil?\n if params[:start_date].nil?\n @search_by_date = Date.today\n else\n @search_by_date = params[:start_date].to_date\n end\n else\n if @search_by_date.nil?\n begin\n @search_by_date = Date.parse(params[:date][:year] + '-' + params[:date][:month] + '-' + params[:date][:day])\n rescue => e\n @search_by_date = Date.today\n end\n end\n end\n\n @events = []\n if params.include? :business_hours\n @business_hours = params[:business_hours]\n end\n if not params[:carrera].nil?\n @carrera_selected = params[:carrera][:carrera_id]\n end\n\n # busqueda de los eventos por año, los del año \"0\" son los eventos no recurrentes en este momento, pero eso esta mal, deberian ser los que no estan\n # asignados a una materia. Lo de que sean recurrentes o no recurrentes, ya no es tan asi en esta busqueda y debemos cambiarlo, pero me termino de avivar recien\n # y ya es tarde\n @free_spaces = Espacio.all\n 6.times do |an|\n @calendar = nil\n @calendar = get_calendar :date => @search_by_date, :career => (params.include? :carrera) ? params[:carrera][:carrera_id] : nil, :year => an\n @calendar.events.each do |event|\n\n temp = SimpEvent.new\n temp.starts_at = event.dtstart\n temp.ends_at = event.dtend\n temp.name = event.description + ' - ' + Espacio.find(:first, :conditions => {:id => event.location.to_i}).codigo\n temp.original_id = event.comment[0].to_i\n temp.anio = an\n @events.push temp\n\n @free_spaces.delete(Espacio.find_by_id event.location.to_i) if DateTime.now.strftime('%H%M').to_i.between? event.dtstart.strftime('%H%M').to_i, event.dtend.strftime('%H%M').to_i\n end\n end\n @ver_horas = params[:ver_horas] == \"1\" ? false : true\n redirect_to \"/eventos/browse_by_day?business_hours=#{@ver_horas}&start_date=#{@search_by_date}\" unless params[:ver_horas].nil?\n end",
"def sequential_day\n ActionPlan.sequential_day_for(week,day)\n end",
"def events_seven_days()\n events = []\n today = Date.today\n for i in 0..6 do\n events += events_by_date(today + i)\n end\n return events\nend",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n # Key: tells you the YEAR where birthday will be on a Fri\n # each year = moves up 2 days\n loop {\n if birthday.friday? == true\n return birthday.year\n end\n # key -> don't need to account for day of week change in addition, only 1 year onwards - the .friday? will work out what day of the week it is\n birthday = birthday + (365*24*60*60) }\nend",
"def advance_day\r\n\t\t@day += 1\r\n\t\t@cash_previous = @cash\r\n\t\tpay_workers\r\n\t\tdaily_sales\r\n\t\tdaily_thievery\r\n\t\tdaily_consequences\r\n\t\tif @cash <= 0\r\n\t\t\tputs \"*\"*50\r\n\t\t\tputs \"You ran out of money. Game over.\"\r\n\t\t\t@active = false\r\n\t\t\treturn\r\n\t\telsif @inventory <= 0\r\n\t\t\tputs \"*\"*50\r\n\t\t\tputs \"You ran out of inventory. Game over.\"\r\n\t\t\t@active = false\r\n\t\t\treturn\r\n\t\telsif rand(100) == 0\r\n\t\t\tputs \"*\"*50\r\n\t\t\tputs \"You got caught by cops. Game over.\"\r\n\t\t\t@active = false\r\n\t\t\treturn\r\n\t\tend\r\n\t\toperations\r\n\tend",
"def day_greater_than_23(num)\n if num >= 23 && page.has_text?(\"#{num}\", count: 2)\n calendar_date(num, 1)\n else\n first_day(num).click\n end\nend",
"def test_get_1_day_forecast_text_08\n assert_equal \"Monday:\\nOvercast with rain showers at times. Thunder possible. High near 75F. Winds NE at 5 to 10 mph. Chance of rain 40%.\\n\",\n Forecast.new(zip: 27701).fc_text(0)\n end",
"def get_dates_matche (date_matche,days_game)\n flag_continue=true\n while flag_continue do\n date_matche = date_matche + 1.days\n day_week=date_matche.wday\n if days_game.include?(day_week.to_s)\n return date_matche\n end \n end\n end",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n until birthday.friday?\n birthday = Time.new birthday.year + 1, birthday.month, birthday.day\n end\n birthday.year\nend",
"def day_meetings\n days = []\n @course.weekdays.each_char.each_with_index do |w, i|\n days.push(DAYS_AS_SYM[i]) if w.to_i == 1\n end\n days\n end",
"def print_day date\n @list ||= Array.read TODO\n @done ||= Array.read DONE\n @deleted ||= Array.read DELETED\n\n=begin\n YAML.load_file(RECURRENT).each do |taskstr,dates|\n if dates.include? date.wday #and !@deleted.select{|t| t[:scheduled] == date and t[:description] == taskstr}.empty?\n task = Task.new(taskstr.split(\" \"))\n task[:scheduled] = date.to_datetime\n @list << task if (@done+@list).select{|t| t.scheduled_at?(date) and t[:description] == task[:description]}.empty?\n end\n end\n @list.save TODO\n=end\n\n not_scheduled = (@list+@done).select{|t| t.day_dur(date) > 0.0 and !t.scheduled_at? date}\n all_stat = Stat.new not_scheduled, date, date#[@list,@done]\n done_stat = Stat.new @done, date, date\n todo_stat = Stat.new @list, date, date\n\n puts yellow(\"#{(date).strftime('%a %d %b %Y')} w#{todo_stat[:work][:planned].to_f.to_datetime}/f#{todo_stat[:not_work][:planned].to_f.to_datetime}/t#{todo_stat[:total][:planned].to_f.to_datetime}\")\n @list.each{|t| @list.print t if t[:scheduled] and t[:scheduled].to_date == date}\n\n if date == Date.today\n puts blue(\" Done: w#{done_stat[:work][:measured].to_f.to_datetime}/f#{done_stat[:not_work][:measured].to_f.to_datetime}/t#{done_stat[:total][:measured].to_f.to_datetime}\")\n @done.each do |t|\n if t[:finished] == date\n print \" \"\n @done.print t\n end\n end\n #puts cyan(\" Not scheduled: w#{all_stat[:work][:measured].to_f.to_datetime}/f#{all_stat[:not_work][:measured].to_f.to_datetime}/t#{all_stat[:total][:measured].to_f.to_datetime}\")\n @list.each do |t|\n unless t.day_dur(date) == 0.0 or t.scheduled_at? date\n print \" \"\n @list.print t\n end\n end\n @done.each do |t|\n unless t.day_dur(date) == 0.0 or t.scheduled_at? date\n print \" \"\n @done.print t\n end\n end\n end\nend",
"def jpd_cycle\r\n jpd_date - $jpd_2000\r\nend",
"def deprecated_day_number\n time_zone = self.program_player.user.time_zone_or_default\n now_in_time_zone = Time.now.in_time_zone(time_zone)\n \n # If this budge has been paused, return the number of days until it is UNpaused\n # Note that if they paused this on day 6, and it's starting tomorrow, the day number will still be -1, but\n # tomorrow it will be 6, since it will resume with the day number that it was paused at.\n if !self.program_player.respond_to?(:restart_at)\n if self.program_player.temp_restart_at.present? and self.program_player.temp_restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.temp_restart_at)\n return (now_in_time_zone.to_date-self.program_player.temp_restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n elsif self.program_player.restart_at.present? and self.program_player.restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.restart_at)\n return (now_in_time_zone.to_date-self.program_player.restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n end",
"def zodiac(month,day)\n time=[\n 1,1,1,31, # The Apprentice\n 2,1,2,28, # The Companion\n 3,1,3,31, # The Beacon\n 4,1,4,30, # The Savage\n 5,1,5,31, # The Prodigy\n 6,1,6,30, # The Martyr\n 7,1,7,31, # The Maiden\n 8,1,8,31, # The Gladiator\n 9,1,9,30, # The Voyager\n 10,1,10,31, # The Thief\n 11,1,11,30, # The Glutton\n 12,1,12,31 # The Wishmaker\n ]\n for i in 0...12\n return i if month==time[i*4] && day>=time[i*4+1]\n return i if month==time[i*4+2] && day<=time[i*4+2]\n end\n return 0\nend",
"def get_day_name(day) #convert name into the actual day_name\n day_name = \"\"\n\ncase day\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"thu\"\n day_name =\"Thursday\"\nwhen \"fri\"\n day_name =\"Friday\"\nwhen \"sat\"\n day_name =\"Saturday\"\nwhen \"sun\"\n day_name =\"Sunday\"\nelse #in case user write an option that doesnt exit we could use else keyword\n day_name = \"Invalid abbreviation\"\nend \n\nreturn day_name\nend",
"def enter_wrong_day\n fill_in('Day', with: '32')\n fill_in('Month', with: '1')\n fill_in('Year', with: '1993')\n sleep 1\n end",
"def lead_days\n 1\n end"
] | [
"0.6593516",
"0.6548552",
"0.65404713",
"0.64918506",
"0.6452648",
"0.6359621",
"0.62978435",
"0.62582606",
"0.624706",
"0.6213185",
"0.61213076",
"0.61128575",
"0.6112742",
"0.6079944",
"0.6018732",
"0.60161513",
"0.6010929",
"0.59905607",
"0.59488064",
"0.5940972",
"0.5928544",
"0.59260195",
"0.59188443",
"0.59123963",
"0.5896453",
"0.5878493",
"0.5867218",
"0.58636767",
"0.5857608",
"0.58528477",
"0.58377385",
"0.5831921",
"0.582922",
"0.582922",
"0.58206046",
"0.58023655",
"0.5793152",
"0.57876605",
"0.5785343",
"0.57723844",
"0.5763246",
"0.5759823",
"0.5758906",
"0.57588315",
"0.5747616",
"0.57472354",
"0.5737499",
"0.5734375",
"0.5697478",
"0.5687148",
"0.5677075",
"0.5676032",
"0.56644034",
"0.5636492",
"0.56319374",
"0.5623486",
"0.5616132",
"0.5616132",
"0.56120753",
"0.561192",
"0.5608141",
"0.5606016",
"0.5606016",
"0.56016636",
"0.55712575",
"0.5563819",
"0.5562641",
"0.5560579",
"0.5560089",
"0.55514145",
"0.5550673",
"0.5549787",
"0.55470407",
"0.55459255",
"0.554176",
"0.5539934",
"0.55387765",
"0.5519578",
"0.5503611",
"0.54966706",
"0.54964256",
"0.5495886",
"0.5483085",
"0.5482035",
"0.547863",
"0.54769933",
"0.5472949",
"0.5465857",
"0.5456851",
"0.54558617",
"0.5453158",
"0.5453004",
"0.54493415",
"0.54450655",
"0.5444138",
"0.5439424",
"0.54370224",
"0.5436079",
"0.54324734",
"0.54310536",
"0.54262036"
] | 0.0 | -1 |
GET /commodities GET /commodities.json | def index
@commodities = Commodity.all
if params[:search].present?
@commodities = @commodities.query(params[:search].to_s)
end
@commodities = @commodities.page(params[:page])
respond_to do |format|
format.html
format.js {}
format.json {
render json: {:commodities => @commodities}
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def index\n @comunities = Comunity.all\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end",
"def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end",
"def index\n @equipment_orders = EquipmentOrder.all\n respond_to do |format|\n format.json { render json: @equipment_orders }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n # TODO: ideally instead of eager loading sells, we could just include\n # quantity_sold in the eager_lod for lots.\n @portfolios = Portfolio.eager_graph(lots: :sells).eager_graph(allocations: {:asset_class => :funds}).all\n\n render json: @portfolios\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def index\n @territories = current_company.territories\n @regions = Region.all_regions\n @max_pop = Region.maximum(:population)\n @min_pop = Region.minimum(:population)\n @max_biz_pop = Region.maximum(:business_population)\n @min_biz_pop = Region.minimum(:business_population)\n @opportunities = current_company.opportunities\n @reps = current_company.representatives\n respond_with(@territories)\n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def index\n @modalities = Modality.all\n json_response(@modalities)\n end",
"def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def show\n render json: @competitor_price\n end",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n if (params[:city_id])\n @city = City.find(params[:city_id].to_i)\n @oxygen_suppliers = @city.oxygen_suppliers.active_list\n else\n @oxygen_suppliers = OxygenSupplier.active_list\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\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 index\n @oportunities = Oportunity.all\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end",
"def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end",
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def index\n @equities = Equity.all\n end",
"def index\n @equities = Equity.all\n end",
"def stock_of(commodity)\n @stock[commodity_id(commodity)]\n end",
"def ideal_stock_of(commodity)\n @ideal_stock[commodity_id(commodity)]\n end",
"def index\n @quantities = Quantity.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n city_list = City.all\n puts city_list.inspect\n\n render json: city_list.to_json\n end",
"def index\n @dexterity_mods = DexterityMod.all\n\n render json: @dexterity_mods\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def labors\n aux = WorkOrderLabor.by_name\n render json: serialized_work_order_labors(aux)\n end",
"def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end",
"def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end",
"def foods_units\n get('/foods/units.json')\n end",
"def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:country_id])\n\n render json: @cities\n \n end",
"def index\n current_product_company\n manage_filter_state\n @product = $product\n @company = $company\n product = nil\n if !$product.nil?\n product = $product.id\n else\n product = params[:Products]\n end\n if !$company.nil?\n company = $company.id\n else\n company = params[:Companies]\n end\n\n @search = ProductCompanyPrice.search do\n #fulltext params[:search]\n if !product.blank?\n with :product_id, product\n end\n if !company.blank?\n with :company_id, company\n end\n order_by :product_id, :asc\n order_by :company_id, :asc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @product_company_prices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_company_prices }\n format.js\n end\n end",
"def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end",
"def index\n slip = Slip.all\n render json: {salary_computations:slip.as_json(except: [:id])}\n end",
"def get_price\n available_room_response = hotel_service.get_available_room(params)\n service_available_room = process_response(available_room_response, 'HotelRoomAvailabilityResponse')\n rooms = []\n if service_available_room[\"status\"] == OK\n available_rooms = JSON.parse(service_available_room[\"response\"])\n bookings = available_rooms[\"HotelRoomAvailabilityResponse\"]\n if bookings && bookings[\"@size\"].to_i == 1\n rooms = []\n rooms << bookings[\"HotelRoomResponse\"]\n elsif bookings && bookings[\"@size\"].to_i > 1\n rooms = bookings[\"HotelRoomResponse\"]\n end\n end\n render :json => {:result=> rooms}\n end",
"def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end",
"def show\n render json: @pricing\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def show\n render json: @company\n end",
"def show\n render json: @petty_cash_expense\n end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def show\n render json: [*@company]\n end",
"def commission\n get 'commission'\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end",
"def index\n @career_specialties = CareerSpecialty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @career_specialties }\n end\n end",
"def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cities }\n format.js\n end\n end",
"def habitaciones\n type_of_room_id= Integer(params[:type_of_room_id])\n comfort_id = Integer( params[:comfort_id])\n @habitaciones = Room.where(\"type_of_room_id = ? and comfort_id = ?\",type_of_room_id,comfort_id)\n render json: @habitaciones\n end",
"def show\n render json: @opportunity\n end"
] | [
"0.71912295",
"0.71552944",
"0.7022852",
"0.7022852",
"0.62883896",
"0.6219341",
"0.6219341",
"0.6196894",
"0.61902994",
"0.6051019",
"0.60480565",
"0.60461265",
"0.6030203",
"0.60208625",
"0.60200393",
"0.6002363",
"0.59913033",
"0.5915414",
"0.5910676",
"0.58964765",
"0.58793545",
"0.58774674",
"0.5840518",
"0.5827082",
"0.5800438",
"0.57959306",
"0.57871765",
"0.5768991",
"0.5766338",
"0.5764473",
"0.57576734",
"0.5742972",
"0.57373405",
"0.5732496",
"0.5724644",
"0.5691225",
"0.5689192",
"0.56794727",
"0.5654004",
"0.5644966",
"0.5638806",
"0.56376314",
"0.5637414",
"0.5633186",
"0.56233484",
"0.56233484",
"0.56230605",
"0.5604277",
"0.5601696",
"0.55913734",
"0.5589033",
"0.55872947",
"0.5586248",
"0.5576655",
"0.55753",
"0.55753",
"0.55753",
"0.55753",
"0.55680686",
"0.5559764",
"0.5542486",
"0.55402786",
"0.55402786",
"0.55358267",
"0.5532344",
"0.55297536",
"0.5525792",
"0.5516431",
"0.5512484",
"0.54996175",
"0.549785",
"0.54814",
"0.54745495",
"0.54667085",
"0.54654187",
"0.54590833",
"0.54569805",
"0.545619",
"0.5453749",
"0.54479104",
"0.54443705",
"0.5442345",
"0.54417324",
"0.5441239",
"0.54406893",
"0.5437205",
"0.54343843",
"0.5431806",
"0.5425559",
"0.5423227",
"0.5422766",
"0.54189646",
"0.54184955",
"0.54171693",
"0.5414994",
"0.541366",
"0.54121083",
"0.5387737",
"0.53798485",
"0.5374859"
] | 0.74435806 | 0 |
GET /commodities/1 GET /commodities/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end",
"def show\n render json: @competitor_price\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def show\n @equipment = Equipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def index\n @comunities = Comunity.all\n end",
"def index\n @equipment_orders = EquipmentOrder.all\n respond_to do |format|\n format.json { render json: @equipment_orders }\n end\n end",
"def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def show\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_equipment }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(commodity_params)\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getuom\n @deliverable_type = DeliverableType.find(params[:id])\n respond_to do |format|\n format.json { render :json => @deliverable_type.uom}\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end",
"def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def stock_of(commodity)\n @stock[commodity_id(commodity)]\n end",
"def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def index\n if (params[:city_id])\n @city = City.find(params[:city_id].to_i)\n @oxygen_suppliers = @city.oxygen_suppliers.active_list\n else\n @oxygen_suppliers = OxygenSupplier.active_list\n end\n end",
"def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end",
"def show\n render json: @company\n end",
"def show\n render json: @pricing\n end",
"def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def show\n render json: @petty_cash_expense\n end",
"def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end",
"def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end",
"def ideal_stock_of(commodity)\n @ideal_stock[commodity_id(commodity)]\n end",
"def show\n @closet_item = ClosetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closet_item }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @territory = current_company.territories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territory }\n end\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def show\n render json: [*@company]\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 index\n @modalities = Modality.all\n json_response(@modalities)\n end",
"def commission\n get 'commission'\n end",
"def show\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onecompany_product }\n end\n end",
"def show\n render json: @opportunity\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end",
"def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end",
"def show\n @slot = Slot.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slot }\n end\n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def show\n @sales_productivity = SalesProductivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_productivity }\n end\n end",
"def show\n @compliment = Compliment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compliment }\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :created, location: @commodity }\n else\n format.html { render :new }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end",
"def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @territories = current_company.territories\n @regions = Region.all_regions\n @max_pop = Region.maximum(:population)\n @min_pop = Region.minimum(:population)\n @max_biz_pop = Region.maximum(:business_population)\n @min_biz_pop = Region.minimum(:business_population)\n @opportunities = current_company.opportunities\n @reps = current_company.representatives\n respond_with(@territories)\n end",
"def show\n @equipo= (set_equipo)\n render json: @equipo, status: :ok\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def habitaciones\n type_of_room_id= Integer(params[:type_of_room_id])\n comfort_id = Integer( params[:comfort_id])\n @habitaciones = Room.where(\"type_of_room_id = ? and comfort_id = ?\",type_of_room_id,comfort_id)\n render json: @habitaciones\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def new\n @jetties = Jetty.order(:name)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end",
"def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end"
] | [
"0.7433827",
"0.7433827",
"0.71551454",
"0.69652677",
"0.689434",
"0.6624344",
"0.6624344",
"0.6546328",
"0.6453164",
"0.62858075",
"0.62366587",
"0.61024487",
"0.6100771",
"0.6013886",
"0.5983782",
"0.5970167",
"0.5938198",
"0.5938198",
"0.5905315",
"0.58970386",
"0.5895779",
"0.5863152",
"0.5861469",
"0.5843994",
"0.5816296",
"0.5812809",
"0.5754381",
"0.57485765",
"0.5745969",
"0.57438636",
"0.5740595",
"0.57320476",
"0.57319343",
"0.5719553",
"0.5712258",
"0.57068855",
"0.5692538",
"0.5688024",
"0.56673366",
"0.5665489",
"0.5657841",
"0.56559974",
"0.5653441",
"0.56436574",
"0.5639972",
"0.5614729",
"0.56107754",
"0.5606974",
"0.56065685",
"0.5603926",
"0.55973876",
"0.5595836",
"0.5592491",
"0.55819666",
"0.55813277",
"0.5579849",
"0.55774945",
"0.5574513",
"0.5572847",
"0.5572847",
"0.5572201",
"0.5570916",
"0.5565562",
"0.55642235",
"0.5562096",
"0.5559626",
"0.5558131",
"0.55484235",
"0.5537145",
"0.55270326",
"0.55150163",
"0.55086017",
"0.5495557",
"0.54911643",
"0.5489561",
"0.54873526",
"0.54807645",
"0.54800755",
"0.5477455",
"0.5476024",
"0.5471956",
"0.54701823",
"0.54619896",
"0.54613733",
"0.5461113",
"0.54608196",
"0.545709",
"0.5451594",
"0.5451594",
"0.5451594",
"0.5451594",
"0.54485524",
"0.54449373",
"0.54306555",
"0.5425537",
"0.5425169",
"0.54167414",
"0.5409835",
"0.5409835",
"0.5409835",
"0.5409835"
] | 0.0 | -1 |
POST /commodities POST /commodities.json | def create
@commodity = Commodity.new(commodity_params)
respond_to do |format|
if @commodity.save
format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }
format.json { render :show, status: :created, location: @commodity }
else
format.html { render :new }
format.json { render json: @commodity.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commodity_params\n params.require(:commodity).permit(:name, :code, :commodity_type_id, :bar_code, :specification, :unit, :cost, :sale, :low_stock, :high_stock)\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def accommodation_params\n params.require(:accommodation).permit(:name, :price, :city, :description, :user_id, :rooms)\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accommodation = Accommodation.new(accommodation_params)\n\n respond_to do |format|\n if @accommodation.save\n format.html { redirect_to @accommodation, notice: 'Accommodation was successfully created.' }\n format.json { render :show, status: :created, location: @accommodation }\n else\n format.html { render :new }\n format.json { render json: @accommodation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def oportunity_params\n params.require(:oportunity).permit(:name, :description, :budget, :money, :published_date, :deadline, :result_date, :company_id, :category_id, :status)\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n @carpool = Carpool.new(params[:carpool])\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render json: @carpool, status: :created, location: @carpool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commodity_headings=(commodities)\n @commodity_headings ||= []\n\n commodities.each do |commodity|\n if existing_heading = find_heading(commodity.heading)\n existing_heading.add_commodity(commodity)\n else\n @commodity_headings << build_heading_from(commodity).tap { |heading|\n heading.add_commodity(commodity)\n }\n end\n end\n end",
"def facility_params\n params.require(:facility).permit(:name, :hotel_id, :price, :internet, :parking, :accomodation, :swimming_pool, :pa_system, :bar, :area, :capacity => [], :facility_layouts => [])\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(commodity_params)\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency = Competency.new(competency_params)\n respond_to do |format|\n if @competency.save\n format.json { render :show, status: :created, location: @competency }\n else\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @intelcompany = IntelCompany.new(intelcompany_params)\n\n if @intelcompany.save\n render json: @intelcompany, status: :created, location: @intelcompany\n else\n render json: @intelcompany.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.num = 0\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully canceled.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n end\n end\n end",
"def create\n\t the_params = company_params\n\t the_params[:rating] = 0\n\t the_params[:number_of_votes] = 0\n @company = Company.new(the_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.save\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @modalities = Modality.create!(modality_params)\n json_response(@modalities, :created)\n end",
"def create\n @category = Category.first\n @commodity = Commodity.new(params[:commodity])\n @commodity.user = current_user\n category = Category.find(params[:category])\n\n size = 0\n size = params[:commodity][:photo].size if params[:commodity][:photo]\n\n respond_to do |format|\n if size > 2000000\n @commodity.errors[:base] << \"Photo size should < 2MB\"\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n else\n if @commodity.save\n if category\n @commodity.commodity_cates.create(:category => category)\n end\n\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @equity = Equity.new(equity_params)\n\n respond_to do |format|\n if @equity.save\n format.html { redirect_to @equity, notice: 'Equity was successfully created.' }\n format.json { render :show, status: :created, location: @equity }\n else\n format.html { render :new }\n format.json { render json: @equity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def create\n count = person_equipment_params[:count].to_i\n params = person_equipment_params.merge(count: 1)\n @person_equipments = []\n count.times do |i|\n @person_equipments << PersonEquipment.new(params)\n end\n @person_equipments.each(&:save)\n respond_to do |format|\n if @person_equipments.last.save\n format.html { redirect_to @person_equipments.last, status: 303 }\n format.json { redirect_to @person_equipments.last, status: 303 }\n else\n format.html { render :new }\n format.json { render json: @person_equipments.last.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oportunity = Oportunity.new(oportunity_params)\n\n respond_to do |format|\n if @oportunity.save\n format.html { redirect_to @oportunity, notice: 'Oportunity was successfully created.' }\n format.json { render :show, status: :created, location: @oportunity }\n else\n format.html { render :new }\n format.json { render json: @oportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end",
"def create\n @company = @community.companies.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @charity = Charity.new(charity_params)\n\n respond_to do |format|\n if @charity.save\n format.html { redirect_to @charity, notice: \"Charity was successfully created.\" }\n format.json { render :show, status: :created, location: @charity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @charity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency = Competency.new(params[:competency])\n\n respond_to do |format|\n if @competency.save\n format.html { redirect_to @competency, notice: 'Competency was successfully created.' }\n format.json { render json: @competency, status: :created, location: @competency }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @commodity.update(commodity_params)\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :ok, location: @commodity }\n else\n format.html { render :edit }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @equipment_order = EquipmentOrder.new(equipment_order_params)\n @equipment_order.save\n respond_to do |format|\n format.html { redirect_to equipment_orders_path, status: 303 }\n format.json { redirect_to equipment_orders_path, status: 303 }\n end\n end",
"def create\n @periodicity = current_user.periodicities.new(periodicity_params)\n\n respond_to do |format|\n if @periodicity.save\n format.html { redirect_to @periodicity, notice: 'Periodicity was successfully created.' }\n format.json { render :show, status: :created, location: @periodicity }\n else\n format.html { render :new }\n format.json { render json: @periodicity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def create\n @laboratory = Laboratory.new(params[:laboratory])\n @municipalities = Municipality.all\n respond_to do |format|\n if @laboratory.save\n format.html { redirect_to @laboratory, notice: 'Laboratory was successfully created.' }\n format.json { render json: @laboratory, status: :created, location: @laboratory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @laboratory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @charity = CharityOfTheMonth.new(params[:charity_of_the_month])\n\n respond_to do |format|\n if @charity.save\n format.html { redirect_to charities_path, notice: 'Charity of the Month was successfully set up!' }\n format.json { render json: @charity, status: :created, location: @charity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @charity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hotel = current_user.hotel\n if hotel.pricing\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.where(hotel_id: hotel.id).first\n price = Hash.new\n price = pricing.price\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n\n\n\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n else\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.new\n pricing.hotel_id = hotel.id\n price = Hash.new\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n pricing.price = {}\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n end\n \n \n end",
"def create\n @disponible = Disponible.new(disponible_params)\n\n if @disponible.save\n render json: @disponible, status: :created, location: @disponible\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end",
"def create\n @comunity = Comunity.new(comunity_params)\n\n respond_to do |format|\n if @comunity.save\n format.html { redirect_to @comunity, notice: 'Comunity was successfully created.' }\n format.json { render :show, status: :created, location: @comunity }\n else\n format.html { render :new }\n format.json { render json: @comunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def comapny_params\n params.require(:comapny).permit(:name, :manager, :status, :terms)\n end",
"def create\n @territory = current_company.territories.build(params[:territory])\n if @territory.save\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end",
"def create_division\n \t@division = @company.divisions.create(name: params[:division][:name])\n respond_to do |format|\n format.json { render json: @division }\n end\n end",
"def create\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n\n if @city.blank?\n render json: {error: \"Can't find your ship\"}, status: :unprocessable_entity and return\n elsif (@city.units.count >= @city.max_army_amount)\n render json: {error: \"Unit amount limit exceeded\"}, status: :unprocessable_entity and return\n end\n\n create_unit_by_type params[:unit_type], @city\n\n end",
"def create\n @carpool = Carpool.new(carpool_params)\n @carpool.user_id = current_user.id\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render :show, status: :created, location: @carpool }\n else\n format.html { render :new }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @companium = Companium.new(companium_params)\n\n respond_to do |format|\n if @companium.save\n format.html { redirect_to @companium, notice: 'Companium was successfully created.' }\n format.json { render :show, status: :created, location: @companium }\n else\n format.html { render :new }\n format.json { render json: @companium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city = City.create(params[:city])\n get_data\n end",
"def create\n @expense = Expense.new(params[:expense])\n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n @expense.dossier_id = params[:dossier]\n \n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n @expense.save\n respond_to do |format|\n format.json { render :json => { :success => true, :message => \"Created Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}}\n end\n \n end",
"def expense_params\n params.require(:expense).permit(\n :direction,\n :title,\n :amount,\n :company,\n :facility,\n :expense_category_id,\n :expense_by_id,\n :expense_to_id,\n :expense_date,\n :created_by_id,\n :updated_by_id\n )\n end",
"def create\n @complexity = Complexity.new(params[:complexity])\n\n respond_to do |format|\n if @complexity.save\n format.html { redirect_to @complexity, notice: 'Complexity was successfully created.' }\n format.json { render json: @complexity, status: :created, location: @complexity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @complexity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :update, Carpool\n @carpool = Carpool.new(carpool_params)\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render :show, status: :created, location: @carpool }\n else\n format.html { render :new }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def room_params\n params.require(:room).permit(:price, :capacity, :availability, :services)\n end",
"def create\n begin\n \n detail = @@data_util.hash_data_to_upper_case( params[:company], ['description'])\n\n detail[:mypclient_id] = session[:client_id]\n detail[:createdby] = session[:username]\n detail[:isactive] = 1\n\n @company = Company.new(detail)\n if @company.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'New company successfully created.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def carpool_params\n params.require(:carpool).permit(:amount, :desc, :date, :routes, :tag_list, :from, :to)\n end",
"def equipment_params\n params.require(:equipment).permit(\n :serial_number,\n :inspection_cycle_month,\n :inspection_contract,\n :start_date,\n :system_model_id,\n :place_id,\n :branch_id,\n :service_id\n )\n end",
"def create\n @equipment = Equipment.new(equipment_params)\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to @equipment, notice: 'Equipment was successfully created.' }\n format.json { render :show, status: :created, location: @equipment }\n else\n format.html { render :new }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cargo = Cargo.new(cargo_params)\n if @cargo.save\n render json: @cargo\n else\n render json: @cargo.errors, status: :unprocessable_entity\n end\n end",
"def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end",
"def territory_params\n params.require(:territory).permit(:name, :description, :city, :responsible_id)\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def create\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.new(params[:mostsmallitemequipinventory])\n\n respond_to do |format|\n if @mostsmallitemequipinventory.save\n format.html { redirect_to @mostsmallitemequipinventory, notice: 'Mostsmallitemequipinventory was successfully created.' }\n format.json { render json: @mostsmallitemequipinventory, status: :created, location: @mostsmallitemequipinventory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallitemequipinventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contract = Contract.new(contract_params)\n @contract.daily_premium_prices.push(params[:daily_premium_prices])\n\n respond_to do |format|\n if @contract.save\n # format.html { redirect_to @contract, notice: 'Contract was successfully created.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @equipment_tire = EquipmentTire.new(equipment_tire_params)\n\n respond_to do |format|\n if @equipment_tire.save\n format.html { redirect_to @equipment_tire, notice: 'Equipment tire was successfully created.' }\n format.json { render :show, status: :created, location: @equipment_tire }\n else\n format.html { render :new }\n format.json { render json: @equipment_tire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @jetties = Jetty.order(:name)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def fuel_price_params\n params.require(:fuel_price).permit(:type, :price)\n end",
"def create\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render json: @opportunity, status: :created, location: @opportunity }\n else\n @supplier_accounts = SupplierAccount.approved.order 'fantasy_name'\n \n format.html { render action: \"new\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parking_area_params\n params.require(:parking_area).permit(:capacity)\n end",
"def fuel_supply_params\n params.require(:fuel_supply).permit(:date_supply, :quantity, :price, :vehicle_id)\n end",
"def create\n @laboratory = Laboratory.new(laboratory_params)\n if @laboratory.save\n render json: @laboratory, status: :created\n else\n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def expense_params\n params.require(:expense).permit(:item1, :item2, :item3, :item4, :item5, :item6, :item7, :item8, :item9, :item10, :cost1, :cost2, :cost3, :cost4, :cost5, :cost6, :cost7, :cost8, :cost9, :cost10, :year, :yearend, :yeartotal, :buildinginfo)\n end",
"def create\n @company = Company.new(nested_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def opportunity_params\n params.require(:opportunity).permit(:company, :job_title, :description, :salary, :location, :interest_level, :date_applied, :last_contact, :user_id)\n end",
"def create\n @comite = Comite.new(comite_params)\n\n respond_to do |format|\n if @comite.save\n format.html { redirect_to @comite, notice: 'Comite was successfully created.' }\n format.json { render :show, status: :created, location: @comite }\n else\n format.html { render :new }\n format.json { render json: @comite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end",
"def create\n @dexterity_mod = DexterityMod.new(dexterity_mod_params)\n\n if @dexterity_mod.save\n render json: @dexterity_mod, status: :created, location: @dexterity_mod\n else\n render json: @dexterity_mod.errors, status: :unprocessable_entity\n end\n end",
"def equipment_params\n params.require(:equipment).permit(:name, :year, :color, :brand_id, :package_id, :description, :publication_type, :precio, :modelo, :currency_id , :country_id, :state_id, :ciudad, :category_id, :etiquetas, :user_id, :subcategory_id)\n end",
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def create\n # создать новую заявку на канцелярию\n @stationeryrequest = Stationeryrequest.new\n # инициализировать значения полей заявки\n @stationeryrequest.status = 0\n @stationeryrequest.employee_id = session[:employee_id].to_i\n @stationeryrequest.save\n if(params[:selected_items] && params[:numbers])\n @selected_items = params[:selected_items]\n @numbers = params[:numbers]\n @selected_items.each do |item|\n @hotelsuppliesrequest = Hotelsuppliesrequest.new\n @hotelsuppliesrequest.stationeryrequest_id = @stationeryrequest.id\n @hotelsuppliesrequest.hotelsupply_id = item\n @hotelsuppliesrequest.num = @numbers[item]\n @hotelsuppliesrequest.save\n end\n end\n\n respond_to do |format|\n if true\n format.html { redirect_to '/stationeryrequests', notice: 'Stationeryrequest was successfully created.' }\n format.json { render json: @stationeryrequest, status: :created, location: @stationeryrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_productivity = EmployeeProductivity.new(employee_productivity_params)\n\n respond_to do |format|\n if @employee_productivity.save\n format.html { redirect_to @employee_productivity, notice: 'Employee productivity was successfully created.' }\n format.json { render :show, status: :created, location: @employee_productivity }\n else\n format.html { render :new }\n format.json { render json: @employee_productivity.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7094458",
"0.70077825",
"0.64613676",
"0.6373147",
"0.6214883",
"0.6214883",
"0.6092892",
"0.6036907",
"0.5939506",
"0.58917487",
"0.58812815",
"0.5603079",
"0.5579009",
"0.5560071",
"0.55228204",
"0.5505408",
"0.54937017",
"0.54700327",
"0.54653186",
"0.5463377",
"0.5446629",
"0.54376364",
"0.54376364",
"0.54157156",
"0.5413969",
"0.5398329",
"0.5395525",
"0.5392087",
"0.53903544",
"0.53852636",
"0.53794837",
"0.53523004",
"0.53523004",
"0.5344952",
"0.53293675",
"0.5327213",
"0.5309563",
"0.5298933",
"0.5276526",
"0.5270666",
"0.5262215",
"0.52461153",
"0.52391756",
"0.52240735",
"0.5193604",
"0.51926726",
"0.518827",
"0.51748604",
"0.5172252",
"0.51622254",
"0.51615065",
"0.51533353",
"0.5151526",
"0.51409554",
"0.513125",
"0.51119655",
"0.51075464",
"0.50956374",
"0.5089268",
"0.5081466",
"0.5074855",
"0.5070046",
"0.5069466",
"0.5063229",
"0.50543475",
"0.5049266",
"0.50448656",
"0.5035672",
"0.5030173",
"0.5024906",
"0.5011587",
"0.50022376",
"0.5001674",
"0.49887815",
"0.49843982",
"0.49794713",
"0.49790347",
"0.49757537",
"0.49755707",
"0.49741802",
"0.49737906",
"0.49733543",
"0.4961208",
"0.49608305",
"0.4959533",
"0.49586603",
"0.49567494",
"0.4953482",
"0.49517822",
"0.4949581",
"0.49411508",
"0.49402758",
"0.49397618",
"0.49334857",
"0.49315268",
"0.49314556",
"0.49312863",
"0.49311438",
"0.49291784",
"0.4919692"
] | 0.6577053 | 2 |
PATCH/PUT /commodities/1 PATCH/PUT /commodities/1.json | def update
respond_to do |format|
if @commodity.update(commodity_params)
format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }
format.json { render :show, status: :ok, location: @commodity }
else
format.html { render :edit }
format.json { render json: @commodity.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(commodity_params)\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n if @carpool.update_attributes(params[:carpool])\n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.update(company_params)\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n\n @company = Company.find(1)\n @puntos = @company.get_puntos()\n @employees = @company.get_employees2() \n@trucks = @company.get_trucks\n\n respond_to do |format|\n if @cout.update(cout_params)\n format.html { redirect_to @cout, notice: 'Cout was successfully updated.' }\n format.json { render :show, status: :ok, location: @cout }\n else\n format.html { render :edit }\n format.json { render json: @cout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"def update_accommodation_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccommodationApi.update_accommodation ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling AccommodationApi.update_accommodation\" if id.nil?\n # resource path\n local_var_path = \"/accommodation/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'capacity'] = opts[:'capacity'] if !opts[:'capacity'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccommodationApi#update_accommodation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @carpool.update(carpool_params)\n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { render :show, status: :ok, location: @carpool }\n else\n format.html { render :edit }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n authorize! :update, Carpool\n respond_to do |format|\n if @carpool.update(carpool_params) \n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { render :show, status: :ok, location: @carpool }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n authorize @fuel_supply\n respond_to do |format|\n if @fuel_supply.update(fuel_supply_params)\n format.html { redirect_to @fuel_supply, notice: 'Fuel supply was successfully updated.' }\n format.json { render :show, status: :ok, location: @fuel_supply }\n else\n format.html { render :edit }\n format.json { render json: @fuel_supply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n if @onecompany_product.update_attributes(params[:onecompany_product])\n format.html { redirect_to @onecompany_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecompany_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n if @lab_equipment.update_attributes(params[:lab_equipment])\n format.html { redirect_to @lab_equipment, notice: 'Lab equipment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n if @recipy.update_attributes(params[:recipy])\n format.html { redirect_to @recipy, notice: 'Recipy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @power_order.update(power_order_params)\n render json: @power_order\n end",
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @companium.update(companium_params)\n format.html { redirect_to @companium, notice: 'Companium was successfully updated.' }\n format.json { render :show, status: :ok, location: @companium }\n else\n format.html { render :edit }\n format.json { render json: @companium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end",
"def update\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n if @competency.update_attributes(params[:competency])\n format.html { redirect_to @competency, notice: 'Competency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n if @complexity.update_attributes(params[:complexity])\n format.html { redirect_to @complexity, notice: 'Complexity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @complexity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n if(params[:id]==\"0\")\n accommodations=[]\n params[:accommodation].each_pair do |k,v|\n accommodations.push(Accommodation.find(k))\n end\n respond_to do |format|\n if accommodations.all? { |a| a.update_attributes(params[:accommodation][a.id.to_s]) }\n flash[:notice] = 'Accommodations were successfully updated.'\n format.html { redirect_to yacht_accommodations_path } \n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accommodation.errors, :status => :unprocessable_entity }\n end\n end\n else\t\n @accommodation = Accommodation.find(params[:id])\n\n respond_to do |format|\n if @accommodation.update_attributes(params[:accommodation])\n flash[:notice] = 'Accommodation was successfully updated.'\n format.html { redirect_to yacht_accommodation_path(@accommodation.yacht.id, @accommodation.id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accommodation.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end",
"def update\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n if @fleet.update_attributes(params[:fleet])\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { head :ok }\n else\n @supplier_accounts = SupplierAccount.approved.order 'fantasy_name'\n \n format.html { render action: \"edit\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @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 update\n # updating hard info\n hard_info = HardInfo.where(use_case_no: @use_case.use_case_no, client_name: @use_case.client_name, product_name: @use_case.product_name)\n hard_info.first.update(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n #--\n respond_to do |format|\n if @use_case.update(use_case_params)\n format.html { redirect_to @use_case }\n format.json { render :show, status: :ok, location: @use_case }\n else\n format.html { render :edit }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipment_model.update(equipment_model_params)\n format.html { redirect_to @equipment_model, notice: t('.update_ok', item: @equipment_model.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fuel_price.update(fuel_price_params)\n format.html { redirect_to @fuel_price, notice: 'Fuel price was successfully updated.' }\n format.json { render :show, status: :ok, location: @fuel_price }\n else\n format.html { render :edit }\n format.json { render json: @fuel_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rail_company.update(rail_company_params)\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @territory = current_company.territories.find(params[:id])\n\n # hack to determine new and deleted regions\n adjust_region_ids\n adjust_zipcode_ids\n\n if @territory.update_attributes(params[:territory])\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end",
"def update\n @laboratory = Laboratory.find(params[:id])\n @municipalities = Municipality.all\n respond_to do |format|\n if @laboratory.update_attributes(params[:laboratory])\n format.html { redirect_to @laboratory, notice: 'Laboratory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @laboratory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_royalty_detail.update(company_royalty_detail_params)\n format.html { redirect_to @company_royalty_detail, notice: 'Company royalty detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_royalty_detail }\n else\n format.html { render :edit }\n format.json { render json: @company_royalty_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @petty_cash_expense.update(petty_cash_expense_params)\n format.json { render :show, status: :ok, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @specific_equipment.update(specific_equipment_params)\n format.html { redirect_to @specific_equipment, notice: 'Specific equipment was successfully updated.' }\n format.json { render :show, status: :ok, location: @specific_equipment }\n else\n format.html { render :edit }\n format.json { render json: @specific_equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opportunity.update(opportunity_params)\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grocery = Grocery.find(params[:id])\n\n if @grocery.update(grocery_params)\n head :no_content\n else\n render json: @grocery.errors, status: :unprocessable_entity\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n Rails.logger.info \"******\\n\\n\\nCompany: #{params[:company]}***********\\n\\n\\n\"\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @modality.update(modality_params)\n head :no_content\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 @fleet.update(fleet_params)\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @depot_fuel.update(depot_fuel_params)\n @depot_fuel.surplus_notification\n format.html { redirect_to @depot_fuel, notice: (t 'depot_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @depot_fuel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n if @sp_company_info.update_attributes(sp_company_info_params)\n format.html { redirect_to \"/sp_company_infos\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp_company_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipment_tire.update(equipment_tire_params)\n format.html { redirect_to @equipment_tire, notice: 'Equipment tire was successfully updated.' }\n format.json { render :show, status: :ok, location: @equipment_tire }\n else\n format.html { render :edit }\n format.json { render json: @equipment_tire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equity.update(equity_params)\n format.html { redirect_to @equity, notice: 'Equity was successfully updated.' }\n format.json { render :show, status: :ok, location: @equity }\n else\n format.html { render :edit }\n format.json { render json: @equity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n begin\n @company = Company.find(params[:id])\n detail = @@data_util.hash_data_to_upper_case(params[:company], ['description'])\n detail[:lastupdateby] = session[:username]\n\n @@request_result[:data] = detail \n @@request_result[:type] = params[:company].class \n if @company.update_attributes(detail)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Company successfully updated.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def update\n @closet_item = ClosetItem.find(params[:id])\n\n respond_to do |format|\n if @closet_item.update_attributes(params[:closet_item])\n format.html { redirect_to @closet_item, notice: 'Closet item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @closet_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @disponible = Disponible.find(params[:id])\n\n if @disponible.update(disponible_params)\n head :no_content\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end",
"def update\n @company = Company.find(COMPANY_ID)\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to administration_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipment_detail.update(equipment_detail_params)\n format.html { redirect_to equipment_details_url, notice: 'Equipo Modificado' }\n format.json { render :show, status: :ok, location: @equipment_detail }\n else\n format.html { render :edit }\n format.json { render json: @equipment_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cello.update(cello_params)\n format.html { redirect_to @cello, notice: \"Cello was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cello }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cello.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compliment = Compliment.find(params[:id])\n\n respond_to do |format|\n if @compliment.update_attributes(params[:compliment])\n format.html { redirect_to @compliment, notice: 'Compliment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compliment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prices = Price.all\n @strains = Strain.all\n @regions = Region.all\n respond_to do |format|\n if @price.update(price_params)\n format.html { redirect_to \"/\", notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @price }\n else\n format.html { render :edit }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opportunity.update(opportunity_params)\n format.html { redirect_to @opportunity }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @periodicity.update(periodicity_params)\n format.html { redirect_to @periodicity, notice: 'Periodicity was successfully updated.' }\n format.json { render :show, status: :ok, location: @periodicity }\n else\n format.html { render :edit }\n format.json { render json: @periodicity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @company = Company.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @company.update_attributes(params[:company])\r\n format.html { redirect_to @company, notice: 'Company 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: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def update\n respond_to do |format|\n if @modality.update(modality_params)\n format.html { redirect_to @modality, notice: 'Modality was successfully updated.' }\n format.json { render :show, status: :ok, location: @modality }\n else\n format.html { render :edit }\n format.json { render json: @modality.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end"
] | [
"0.70659274",
"0.70275474",
"0.66141903",
"0.6241457",
"0.6137007",
"0.60896826",
"0.60846996",
"0.60583407",
"0.60425067",
"0.6035777",
"0.5943537",
"0.59056324",
"0.5882299",
"0.58812845",
"0.58788496",
"0.58717203",
"0.5842476",
"0.58403707",
"0.5833222",
"0.58244824",
"0.58029294",
"0.5792419",
"0.57863957",
"0.57832825",
"0.57792556",
"0.5772781",
"0.5769332",
"0.5763262",
"0.5762192",
"0.5751438",
"0.57419246",
"0.5734081",
"0.5725908",
"0.57241887",
"0.5722948",
"0.5720749",
"0.572012",
"0.5719918",
"0.5707718",
"0.57073325",
"0.57046986",
"0.56998914",
"0.56988895",
"0.569872",
"0.56975013",
"0.56902564",
"0.56887186",
"0.5685199",
"0.56844884",
"0.5682069",
"0.5679889",
"0.56749845",
"0.56678474",
"0.5667644",
"0.56659997",
"0.56643444",
"0.566374",
"0.56622565",
"0.5661924",
"0.5657789",
"0.565652",
"0.5652148",
"0.56509674",
"0.56470287",
"0.56470287",
"0.56470287",
"0.56470287",
"0.56470287",
"0.56470287",
"0.564183",
"0.5639682",
"0.56369275",
"0.56363297",
"0.5636195",
"0.5636064",
"0.56353813",
"0.56330055",
"0.5631307",
"0.5630167",
"0.5630167",
"0.56289095",
"0.56270903",
"0.56263614",
"0.5624894",
"0.5619098",
"0.5619053",
"0.5617737",
"0.5617516",
"0.5617449",
"0.5616333",
"0.56135577",
"0.56088907",
"0.5599383",
"0.5598009",
"0.5593813",
"0.5592775",
"0.55895025",
"0.55894417",
"0.558932",
"0.55877066"
] | 0.6697056 | 2 |
DELETE /commodities/1 DELETE /commodities/1.json | def destroy
@commodity.destroy
respond_to do |format|
format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.num = 0\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully canceled.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n end\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency = Competency.find(params[:id])\n @competency.destroy\n\n respond_to do |format|\n format.html { redirect_to competencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment = Equipment.find(params[:id])\n @equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to equipment_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @commemt = Commemt.find(params[:id])\n @commemt.destroy\n\n respond_to do |format|\n format.html { redirect_to commemts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carpool = Carpool.find(params[:id])\n @carpool.destroy\n\n respond_to do |format|\n format.html { redirect_to carpools_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation.destroy\n respond_to do |format|\n format.html { redirect_to accommodations_url, notice: 'Accommodation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_equipment = LabEquipment.find(params[:id])\n @lab_equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_equipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @facility_cost_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_cost_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation = Accommodation.find(params[:id])\n @accommodation.destroy\n\n respond_to do |format|\n format.html { redirect_to(yacht_accommodations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n @mostsmallitemequipinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallitemequipinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @comunity.destroy\n respond_to do |format|\n format.html { redirect_to comunities_url, notice: 'Comunity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission.destroy\n respond_to do |format|\n format.html { redirect_to commissions_url, notice: 'Commission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract = Contract.find(params[:id])\n @contract.destroy\n\n respond_to do |format|\n format.html { redirect_to tower_contracts_path(@tower) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_equipment.destroy\n respond_to do |format|\n format.html { redirect_to specific_equipments_url, notice: 'Specific equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competent = Competent.find(params[:id])\n @competent.destroy\n\n respond_to do |format|\n format.html { redirect_to competents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_royalty_detail.destroy\n respond_to do |format|\n format.html { redirect_to company_royalty_details_url, notice: 'Company royalty detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_tire.destroy\n respond_to do |format|\n format.html { redirect_to equipment_tires_url, notice: 'Equipment tire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |format|\n format.html { redirect_to crunch_companies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @accommodation_charge.destroy\n respond_to do |format|\n format.html { redirect_to accommodation_charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slot = Slot.where(:id => params[:id], :company_id => current_user.company.id).first\n @slot.destroy\n\n respond_to do |format|\n format.html { redirect_to slots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation_change = AccommodationChange.find(params[:id])\n @accommodation_change.destroy\n\n respond_to do |format|\n format.html { redirect_to accommodation_changes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carpool.destroy\n respond_to do |format|\n format.html { redirect_to carpools_url, notice: 'Carpool was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet.destroy\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @periodicity.destroy\n respond_to do |format|\n format.html { redirect_to periodicities_url, notice: 'Periodicity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_detail.destroy\n respond_to do |format|\n format.html { redirect_to equipment_details_url, notice: 'Se ha eliminado un Equipo ' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comming_soon = CommingSoon.find(params[:id])\n @comming_soon.destroy\n\n respond_to do |format|\n format.html { redirect_to comming_soons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @companium.destroy\n respond_to do |format|\n format.html { redirect_to compania_url, notice: 'Companium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url, notice: 'Equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url, notice: 'Equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet = Fleet.find(params[:id])\n @fleet.destroy\n\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comite.destroy\n respond_to do |format|\n format.html { redirect_to comites_url, notice: 'Comite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n laboratory_id = params[:id]\n\n begin\n @laboratory = Laboratory.find(laboratory_id)\n\n @laboratory.delete if @laboratory.status == true\n render json: \"#{@laboratory.nome} deletado com sucesso!\"\n\n rescue ActiveRecord::RecordNotFound\n render json: 'esse dado já foi deletado!'\n end\n end",
"def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end",
"def destroy\n @caricullum = Caricullum.find(params[:id])\n @caricullum.destroy\n\n respond_to do |format|\n format.html { redirect_to caricullums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n @mostsmalltrapeffectinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapeffectinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portion = Portion.find(params[:id])\n @portion.destroy\n\n respond_to do |format|\n format.html { redirect_to portions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plate_cost = PlateCost.find(params[:id])\n @plate_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_costs_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @equipment.destroy\r\n respond_to do |format|\r\n format.html { redirect_to lab_lab_space_equipment_index_path, notice: 'Equipment was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @conductor = Conductor.find(params[:id])\n @conductor.destroy\n\n respond_to do |format|\n format.html { redirect_to conductors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, Carpool\n @carpool.destroy\n respond_to do |format|\n format.html { redirect_to carpools_url, notice: 'Carpool was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @combustible.destroy\n respond_to do |format|\n format.html { redirect_to combustibles_url, notice: 'Combustible was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grocery_list = GroceryList.find(params[:id])\n if @grocery_list.destroy\n render status: :ok # 200\n else\n render json: {\n errors: @grocery_list.errors.full_messages\n },\n status: 404\n end\n end",
"def destroy\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production.destroy\n\n respond_to do |format|\n format.html { redirect_to thermo_oil_productions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equity.destroy\n respond_to do |format|\n format.html { redirect_to equities_url, notice: 'Equity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equity.destroy\n respond_to do |format|\n format.html { redirect_to equities_url, notice: 'Equity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n @evaluable_competency.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluable_competencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity = Opportunity.find(params[:id])\n @opportunity.destroy\n\n respond_to do |format|\n format.html { redirect_to opportunities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sales_productivity = SalesProductivity.find(params[:id])\n @sales_productivity.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_productivities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fuel_price.destroy\n respond_to do |format|\n format.html { redirect_to fuel_prices_url, notice: 'Fuel price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # 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 @add_fuel.destroy\n respond_to do |format|\n format.html { redirect_to add_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def destroy\n @closet_item = ClosetItem.find(params[:id])\n @closet_item.destroy\n\n respond_to do |format|\n format.html { redirect_to closet_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @petty_cash_expense.destroy\n head :no_content \n end",
"def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to companies_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @shipfleet.destroy\n respond_to do |format|\n format.html { redirect_to shipfleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clitem.destroy\n respond_to do |format|\n format.html { redirect_to clitems_url }\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity.destroy\n\n head :no_content\n end",
"def destroy\n @mission_capacity.destroy\n respond_to do |format|\n format.html { redirect_to mission_capacities_url, notice: 'Mission capacity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission_type.destroy\n respond_to do |format|\n format.html { redirect_to commission_types_url, notice: 'Commission type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quantity = Quantity.find(params[:id])\n @quantity.destroy\n\n respond_to do |format|\n format.html { redirect_to quantities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quantity = Quantity.find(params[:id])\n @quantity.destroy\n\n respond_to do |format|\n format.html { redirect_to quantities_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.78400135",
"0.78400135",
"0.70825875",
"0.68719316",
"0.674327",
"0.65776396",
"0.65577424",
"0.6527304",
"0.6523719",
"0.6510812",
"0.6504754",
"0.65034646",
"0.6488678",
"0.646819",
"0.64428866",
"0.64417535",
"0.6437164",
"0.643199",
"0.64151996",
"0.63802296",
"0.6375716",
"0.63734496",
"0.636863",
"0.6337484",
"0.6330924",
"0.63279825",
"0.6324691",
"0.630313",
"0.62994766",
"0.629906",
"0.6294372",
"0.62895256",
"0.6287395",
"0.62859386",
"0.6284572",
"0.6279822",
"0.62783605",
"0.627434",
"0.6270464",
"0.6268101",
"0.6263221",
"0.62588733",
"0.6249559",
"0.6248985",
"0.62482685",
"0.62477654",
"0.6237301",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.6230013",
"0.62290126",
"0.62288195",
"0.62288195",
"0.62277865",
"0.6227484",
"0.62197924",
"0.62174547",
"0.62130344",
"0.6209454",
"0.62068284",
"0.6206297",
"0.6205921",
"0.62025946",
"0.6202378",
"0.6201566",
"0.62011504",
"0.62004775",
"0.6194223",
"0.6193813",
"0.6193763",
"0.6193763",
"0.61922234",
"0.6191302",
"0.619012",
"0.6189758",
"0.61848557",
"0.61847425",
"0.6184125",
"0.61820215",
"0.61809987",
"0.6177299",
"0.61727893",
"0.61709803",
"0.6170461",
"0.6167944",
"0.61636746",
"0.6162394",
"0.61614937",
"0.6159821",
"0.61554855",
"0.61549926",
"0.6154901",
"0.6154901"
] | 0.7336592 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_commodity
@commodity = Commodity.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 commodity_params
params.require(:commodity).permit(:name, :code, :commodity_type_id, :bar_code, :specification, :unit, :cost, :sale, :low_stock, :high_stock)
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 |
Delayed jobs are not yet supported with Redis backend | def enqueue(job:, method:, args:, delay: nil)
meta = { "enqueued_at" => Time.now.to_i }
task = Task.new(self, generate_task_id, job, method, args, meta)
client_push(task)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_job; end",
"def redis_pool; end",
"def delayed_jobs\n # The double-checks here are so that we won't blow up if the config stops using redis-namespace\n timestamps = (Array(Resque.redis.zrange(\"resque:delayed_queue_schedule\",0,-1)) + \n Array(Resque.redis.zrange(\"delayed_queue_schedule\",0,-1)))\n raise \"Nothing on delayed schedule\" if timestamps.empty?\n\n timestamps.map { |timestamp|\n [\n Array(Resque.redis.lrange(\"resque:delayed:#{timestamp}\",0,-1)) + Array(Resque.redis.lrange(\"delayed:#{timestamp}\",0,-1)),\n timestamp,\n ]\n }.map { |(job_strings,timestamp)|\n job_strings.map { |job_string|\n JSON.parse(job_string).merge('scheduler_timestamp' => timestamp.to_i)\n }\n }.flatten\n end",
"def do_job\r\n# disable recycle invites\r\n# min = Time.now.min\r\n# #recycle invites 1 min per hour\r\n# if min == 0\r\n# ret = ActiveRecord::Base.connection.execute(\"delete from invites where invitee_id is null and created_at < subdate(now(), interval 3 day)\")\r\n# puts \"recycle invites: #{ret}\"\r\n# end\r\n end",
"def reset_delayed_queue\n redis.del :delayed_queue\n end",
"def do_after_create \n flush_redis()\n end",
"def lock_redis\n @lock_redis ||= ActiveJobLock::Config.redis\n end",
"def extend_lock!\n Resque.redis.expire(key, timeout)\n end",
"def redis_on_base\n on_base\n end",
"def enqueue\n redis.multi do\n enqueue_non_atomically\n end\n end",
"def publish(jobs, fail_fast = 0)\n @redis.multi do\n @redis.hset(key_queue_config, \"fail_fast\", fail_fast)\n @redis.rpush(key_queue_unprocessed, jobs)\n @redis.set(key_queue_status, STATUS_READY)\n end.first\n end",
"def redis\n Resque.redis\n end",
"def manage_delayed(log_file: nil)\n raise ArgumentError, 'Please supply a block' unless block_given?\n\n timestamps = redis.zrange(:delayed_queue_schedule, 0, -1)\n deleted = changed = matched = scanned = 0\n ts_total = timestamps.size\n logger = Logger.new(log_file) if log_file\n\n timestamps.each.with_index do |ts, ts_index|\n key = \"delayed:#{ts}\"\n redis.lrange(key, 0, -1).each do |job|\n scanned += 1\n res = yield(decode(job))\n matched += 1 if res\n case res\n when Hash\n change_delayed_job(key, job, encode(res))\n changed += 1\n logger&.info({action: 'change', job: job, new_job: new_job, ts: key}.to_json)\n when :delete\n delete_delayed_job(key, job)\n deleted += 1\n logger&.info({action: 'delete', job: job, ts: key}.to_json)\n when nil, false, true\n logger&.info({action: 'match', job: job, ts: key}.to_json)\n else\n raise \"Invalid action: #{res.inspect}\"\n end\n\n print \"\\r#{ts_index + 1}/#{ts_total}: scanned: #{scanned}, matched: #{matched}, deleted: #{deleted}, changed: #{changed}\" if scanned % 1000 == 0\n end\n end\n\n puts \"\\r#{ts_total}/#{ts_total}: scanned: #{scanned}, matched: #{matched}, deleted: #{deleted}, changed: #{changed}\" if scanned % 1000 == 0\n\n deleted\n end",
"def delayed_queue_schedule_size\n redis.zcard(:delayed_queue)\n end",
"def redis_pool=(_arg0); end",
"def redis\n Redis.current\nend",
"def working!\n disque.with {|cn| cn.call :working, job_id } if disque && job_id\n end",
"def queue_dj\n if persisted?\n handler_matcher = \"%SyncRequest%id: #{id}%school_id: #{school_id}%year: #{year}%priority: #{priority}%month: #{month}%\"\n if filter_by_event\n handler_matcher = \"#{handler_matcher}%filter_by_event: #{filter_by_event}%\"\n end\n\n unless Delayed::Job.where(\"handler like ? AND attempts = 0\", handler_matcher).exists?\n # delayed job prioity is lower number -> higher priority\n # queue on DelayedJob starting sync. safe=false for exception to force retrying\n delay(priority: -priority).start(false)\n end\n end\n end",
"def reserve_and_run_one_job; end",
"def rate_limit_redis_key\n return @rate_limit_redis_key if @rate_limit_redis_key\n\n timestamp = Time.now\n timestamp = timestamp.to_i - timestamp.sec\n @rate_limit_redis_key =\n \"jira_handler_rate_limit::#{@event['check']['name']}::#{timestamp}\"\n end",
"def method_missing(method_symbol, *args, &blk)\n redis.send(method_symbol, *args, &blk)\n end",
"def jobs_performed\n Resque.redis.get(jobs_performed_key).to_i\n end",
"def namespace\n 'delayed_jobs'\n end",
"def requeue\n Sidekiq.redis { |conn| conn.rpush(QueueName.expand(queue_name), job) }\n end",
"def requeue_throttled\n Sidekiq.redis { |conn| conn.lpush(QueueName.expand(queue_name), job) }\n end",
"def delayed_push(timestamp, item)\n # This line could raise `LockingError` and it should be handled in the\n # `enqueue_at_with_queue` method\n #\n # We can't handle exception here, because of jobs, which raise an error on locking\n # will run after hooks, but its unexpected behavior.\n Resque::Job.new(item[:queue], 'class' => item[:class], 'args' => item[:args])\n .uniqueness\n .try_lock_queueing(timestamp.to_i - Time.now.to_i)\n super\n end",
"def redis_rate_limiting_cleanup!\n Gitlab::Redis::RateLimiting.with(&:flushdb)\n end",
"def command_queue; end",
"def enqueue!\n return nil unless persisted?\n \"#{job_type.camelize}Job\".constantize.perform_later(self)\n end",
"def redis(cmd, *args)\n fiber = Fiber.current\n \n Chat.redis.send(cmd, *args) do |response|\n fiber.resume response\n end\n \n Fiber.yield\n end",
"def delayed_atomic_pulls\n @delayed_atomic_pulls ||= {}\n end",
"def histcall\n HardWorker.perform_at(24.hours, 1)\n puts \"Cron job: Stocks being added to db\"\n end",
"def apply_async!(queue: 'eventually')\n super\n end",
"def allow_concurrency; end",
"def allow_concurrency; end",
"def e\n @queue << \"enable\"\n end",
"def status\n check_exists\n SideJob.redis.get \"#{redis_key}:status\"\n end",
"def enqueued?(*args)\n inspect_lock(:redis_loner_lock_key, *args)\n end",
"def trigger_requeue!\n false\n end",
"def fail_fast\n return nil unless published?\n\n @fail_fast ||= Integer(@redis.hget(key_queue_config, \"fail_fast\"))\n end",
"def jobs\n raise NotImplementedError\n end",
"def redis_queues_cleanup!\n Gitlab::Redis::Queues.with(&:flushdb)\n end",
"def default_task\n SidekiqUniqueJobs::TimerTask.new(timer_task_options) do\n with_logging_context do\n redis do |conn|\n refresh_reaper_mutex\n Orphans::Reaper.call(conn)\n end\n end\n end\n end",
"def work_once()\n json = @redis.rpop @queue\n raise @@EOQ unless json\n hash = JSON.parse(json)\n # Next bit is sort of ugly, \n klass = Object.const_get(hash[\"class\"])\n raise ArgumentError.new(\"Improper Class\") unless klass < QueuED::QueueAble\n obj = klass.new\n obj.from_hash!(hash)\n obj.do_task\n obj.queue_down(redis:@redis, queue:@queue)\n return obj\n end",
"def redis\n Resque.respond_to?(:redis) ? Resque.redis : Resque.backend.store\n end",
"def create_heartbeat\n heartbeat = Thread.new do\n begin\n hb = {:data => {:hb => true}, :user_id => nil}\n ActiveRecord::Base.connection_pool.with_connection do |connection|\n conn = connection.instance_variable_get(:@connection)\n loop do\n opened_boards = $redis.lrange(\"opened_board_ids\", 0, -1)\n puts 'Currently HeartBeating towards channels: #{opened_boards}'\n puts opened_boards\n opened_boards.each do |board_id|\n conn.async_exec \"NOTIFY boards_#{board_id}, '#{hb.to_json}'\"\n end\n sleep 20.seconds\n end\n end\n ensure\n end\n end\nend",
"def delete_from_delayed_queue\n queue = Sidekiq::Queue.new('mailers')\n queue.each do |job|\n assignmentId = job.args.first\n job.delete if @assignment.id == assignmentId\n end\n\n queue = Sidekiq::ScheduledSet.new\n queue.each do |job|\n assignmentId = job.args.first\n job.delete if @assignment.id == assignmentId\n end\n end",
"def test_autoexpire_lock\n Resque.enqueue(AutoexpireLockJob, 123)\n sleep 2\n Resque.enqueue(AutoexpireLockJob, 123)\n assert_equal 2, Resque.size(Resque.queue_from_class(AutoexpireLockJob))\n end",
"def test_autoexpire_lock\n Resque.enqueue(AutoexpireLockJob, 123)\n sleep 2\n Resque.enqueue(AutoexpireLockJob, 123)\n assert_equal 2, Resque.size(Resque.queue_from_class(AutoexpireLockJob))\n end",
"def initialize key, redis, options = {}\n @key = key\n @redis = redis\n @limit = options[:limit] || 50\n @interval = options[:interval] || 60\n end",
"def test_and_enque_for_time!(time)\n # should this job be enqued?\n return unless should_enque?(time)\n\n enque!\n end",
"def before(delayed_job)\n end",
"def redis_restart_on_change\n restart_on_change = configuration[:redis][:restart_on_change]\n restart_on_change = true if restart_on_change.nil? # nil is true so we have a default value.\n restart_on_change\n end",
"def check_for_enqueued_tasks\n while (task = get_next_task)\n if self.respond_to? task.worker_method\n Thread.current[:persistent_job_id] = task[:id]\n Thread.current[:job_key] = task[:job_key]\n args = Marshal.load(task.args)\n invoke_user_method(task.worker_method,args)\n else\n task.release_job\n end\n # Unless configured to loop on persistent tasks, run only\n # once, and then break\n break unless BDRB_CONFIG[:backgroundrb][:persistent_multi]\n end\n end",
"def enable\n @queue << \"enable\"\n end",
"def generate_redis_connection!\n redis_options ? Redis.new(**redis_options) : Redis.current\n end",
"def after job=dj\n end",
"def perform\n scan\n Delayed::Job.enqueue self, 0, Time.now.utc + 20.seconds # requeue for next time\n # todo: save the job id somewhere\n end",
"def requeue\n __requeue__(\"RPUSH\")\n end",
"def run_job\n end",
"def update_redis(redis, instance_ids, notify=false)\n # Pipeline all status buffer updates\n redis.pipelined do\n instance_ids.each do |iid|\n sb = STATUS_BUFS[iid]\n # Each status buffer update happens in a transaction\n redis.multi do\n key = \"#{OPTS[:domain]}://#{OPTS[:gwname]}/#{iid}/status\"\n redis.del(key)\n sb_hash = sb.to_hash\n redis.mapped_hmset(key, sb_hash)\n # Expire time must be integer, we always round up\n redis.expire(key, (3*OPTS[:delay]).ceil) if OPTS[:expire]\n if notify\n # Publish \"updated\" method to notify subscribers\n channel = \"#{OPTS[:domain]}://#{OPTS[:gwname]}/#{iid}/update\"\n redis.publish channel, key\n end\n end # redis.multi\n end # status_bufs,each\n end # redis.pipelined\nend",
"def requeue_perform_delay\n 1.0\n end",
"def requeue_perform_delay\n 1.0\n end",
"def setup_retry_queue(delay, index)\n channel.queue(\"#{queue_name}_delay_#{index}\",\n durable: !Proletariat.test_mode?,\n auto_delete: Proletariat.test_mode?,\n arguments: {\n 'x-dead-letter-exchange' => exchange_name,\n 'x-dead-letter-routing-key' => \"#{queue_name}_requeue\",\n 'x-message-ttl' => delay\n }\n ).bind(exchange, routing_key: \"#{queue_name}_delay_#{index}\")\n end",
"def flaky_jobs\n if !exhausted? && !build_failed_fast?\n raise \"Queue is not yet exhausted\"\n end\n\n requeued = @redis.hkeys(key_requeues)\n\n return [] if requeued.empty?\n\n requeued - @redis.hkeys(key_failures)\n end",
"def try_obtain\n # Performing a single SET is atomic\n !!redis.set(redis_key, '1', nx: true, ex: @timeout)\n end",
"def try_obtain\n # Performing a single SET is atomic\n !!redis.set(redis_key, '1', nx: true, ex: @timeout)\n end",
"def redis_queues_cleanup!\n Gitlab::Redis::Queues.with(&:flushall)\n end",
"def configure(redis, event_type, max_allowed, over_interval, lockout_interval)\n key = namespaced_key(event_type)\n redis.del(key)\n redis.rpush(key, max_allowed)\n redis.rpush(key, over_interval)\n redis.rpush(key, lockout_interval)\n end",
"def acquire(redis)\n deadline = timestamp + @ttl - @drift\n success = LOCK_SCRIPT.eval(redis, {\n :keys => [@key],\n :argv => [@nonce, @ttl]\n })\n\n success && timestamp <= deadline || false\n end",
"def jeweler_tasks; end",
"def queued\n hydra.queued_requests\n end",
"def fake_redis!\n @@redis = Redis.new(host: ENV['REDIS_HOST'])\n end",
"def redis_save(src, dst, eta)\n @redis.set redis_key(src, dst), eta\n end",
"def redis\n $redis\n end",
"def reschedule(job, time = T.unsafe(nil)); end",
"def method_missing(meth, *args, &block)\n if @redis.respond_to?(meth)\n EntrainRedis.ignore_readonly { @redis.send(meth, *args, &block) }\n else\n super\n end\n end",
"def record_non_example_error(job, message)\n @redis.hset(key_errors, job, message)\n end",
"def send_stock_notifications\n SendStockNotificationsJob.perform_later(sku)\n end",
"def with_redis(&block)\n redis_pool.with(&block)\n end",
"def queue\n workers = %x[ps axe | grep delayed_job].split(\"delayed_job\").length\n j = { :workers => workers, :jobs => Delayed::Job.all }\n render :json=>j\n end",
"def save\n # if job is invalid return false\n return false unless valid?\n\n # update next_enqueue_timestamp\n @next_enqueue_timestamp = calculate_next_enqueue_time(Time.now.utc).to_i\n\n Sidekiq.redis do |conn|\n # add to set of all jobs\n conn.sadd(self.class.jobs_key, redis_key)\n\n # add informations for this job!\n conn.hmset(redis_key, *hash_to_redis(to_hash))\n end\n\n logger.info { \"CRON JOB: add job with name: #{@name}\" }\n end",
"def perform_later(*args, **options)\n __debug_job(__method__) { \"options = #{item_inspect(options)}\" } # TODO: remove\n job_warn { \"ignoring method args #{args.inspect}\" } if args.present?\n enqueue(options)\n end",
"def jobs\n db[TABLE_NAME]\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def ping\n @redis.ping\n end",
"def perform(*args)\n if Service.get_service.jobs_enabled?\n # Job processing is enabled.\n Delayed::Worker.logger.info \"---> running #{self.class}(#{args.join(',')}) on #{self.queue_name} at priority #{Process::getpriority(Process::PRIO_PROCESS, 0)}\"\n start_time = Time.current\n perform_if_enabled(*args)\n Delayed::Worker.logger.info \"<--- finished #{self.class} after #{time_ago_in_words(start_time)}\"\n else\n # Resubmit the job with the required parameters after the specified delay. If the inline adapter is being used, we just ignore this.\n Delayed::Worker.logger.warn \"**** job processing disabled for #{self.class}\"\n begin\n self.class.set(wait: DISABLED_RETRY_INTERVAL).perform_later(*args)\n rescue NotImplementedError => _e\n Delayed::Worker.logger.error \"**** no job queue available for future job #{self.class}\"\n end\n end\n end",
"def jobs\r\n end",
"def enqueue(override = false)\n if self.job_id.nil? && !(self.last_fetch_at.present? && (Time.now - self.last_fetch_at) < UPDATE_TIME) && !override\n Delayed::Job.enqueue(ArtistWorker.new(self.id), 0, Time.now)\n self.job_id = Delayed::Job.last.id\n save\n end \n end",
"def execute(args)\n job_name = self.class.name_for(self.class)\n has_lock = Discourse.redis.setnx(running_key_name, Time.now.to_i)\n\n # If we can't get a lock, just noop\n if args[:force] || has_lock\n begin\n return if OnceoffLog.where(job_name: job_name).exists? && !args[:force]\n execute_onceoff(args)\n OnceoffLog.create!(job_name: job_name)\n ensure\n Discourse.redis.del(running_key_name) if has_lock\n end\n end\n\n end",
"def redis\n raise ArgumentError, 'requires a block' unless block_given?\n redis_pool.with do |conn|\n retryable = true\n begin\n yield conn\n rescue Redis::BaseError => e\n raise e unless config.silent\n rescue Redis::CommandError => ex\n (conn.disconnect!; retryable = false; retry) if retryable && ex.message =~ /READONLY/\n raise unless config.silent\n end\n end\n end",
"def dequeue!(user=nil)\n update_attribute(:queued, false)\n end",
"def jobs\n\t\t# ...\n\tend",
"def perform tenant_id\n accepting_new_jobs = $redis.setnx \"generating_docset\", Time.now.to_i\n\n if !accepting_new_jobs \n $redis.setnx \"new_docset_request\", Time.now.to_i\n\n if stale?\n Rails.logger.debug \"assume prev job died, doing heavy lifting anyway\"\n run_job tenant_id\n else\n Rails.logger.debug \"already in progress, skipping\"\n end\n\n else\n Rails.logger.debug \"starting new job\"\n run_job tenant_id\n end\n\n end",
"def run\n super\n\n config = _get_task_config \"control/collection_processor\"\n\n @sqs = Aws::SQS::Client.new({\n region: 'us-east-1',\n access_key_id: config[\"aws_access_key\"],\n secret_access_key: config[\"aws_secret_access_key\"]\n })\n\n @control_queue_uri = config[\"control_queue_uri\"]\n @status_queue_uri = config[\"status_queue_uri\"]\n sleep_interval = config[\"sleep\"] || 10\n max_seconds = config[\"max_seconds\"] || 36000\n\n handler = config[\"handler\"]\n\n # connect to the configured amazon queue & Grab one\n _set_status :available, nil\n instruction_data = nil\n iteration = 0\n while true\n\n # loop until we have something\n while !instruction_data\n\n _log \"Attempting to get an instruction from the queue!\"\n instruction_data = _get_queued_instruction # try again\n\n # kick it off if we got one, and break out of this loop\n if instruction_data\n _log \"[+] Executing #{instruction_data[\"id\"]} for #{sleep_interval} seconds! (expire in: ~#{max_seconds - (iteration * sleep_interval) }s)\"\n _set_status :start, \"#{instruction_data[\"id\"]}\"\n _execute_instruction(instruction_data)\n else\n _log \"Nothing to do, waiting!\"\n sleep sleep_interval\n end\n\n end\n\n # hold tight\n sleep sleep_interval\n\n # determine how we're doing\n task_count_left = _tasks_left\n seconds_elapsed = iteration * sleep_interval\n done = (iteration > 10 && task_count_left == 0 ) || (seconds_elapsed > max_seconds)\n\n _log \"Seconds elapsed: #{seconds_elapsed}\" if iteration % 10 == 0\n _log \"Tasks left: #{task_count_left}\" if iteration % 10 == 0\n\n if done\n _log_good \"Done with #{instruction_data[\"id\"]} after #{seconds_elapsed}s\"\n _set_status :end, {\n \"id\" => \"#{instruction_data[\"id\"]}\",\n \"elapsed\" => \"#{seconds_elapsed}\",\n \"entities\" => \"#{Intrigue::Model::Project.first(:name => instruction_data[\"id\"]).entities.count}\"\n }\n\n _log_good \"#{instruction_data[\"id\"]}\"\n _run_handlers instruction_data\n _set_status :sent, \"#{instruction_data[\"id\"]}\"\n\n instruction_data = nil\n iteration = -1\n\n end\n\n iteration +=1\n end\n\n end",
"def lock_timeout_retries; end",
"def key_requeues\n key(\"requeues\")\n end",
"def in_progress?\n $redis.keys(redis_key).present?\n end",
"def retrieve_job\n json = Server.redis { |c| c.brpop(Server.keys[:perform_list]) }\n Job.new(JSON.parse(json.last))\n rescue => e\n raise ServerError, e.message\n end",
"def blocking_redirect to, timeout = 0\n brpoplpush(@key, key(:queue)/(to.kind_of?(RedisQueue::Simple) ? to.name : to), timeout)\n end",
"def monitor_redis\n # redis.dup.subscribe(REDIS_CHANNEL) do |on|\n redis.subscribe(REDIS_CHANNEL) do |on|\n on.message do |_, message|\n l = REDIS_HEAD_FIELD_LENGTH\n channel = message[0, l].strip\n client_id = message[l, l].strip\n json = message[(l * 2)..-1]\n send_json_message(client_id: client_id, channel: channel, json: json)\n end\n end\n end",
"def periodic_flush\n true\n end"
] | [
"0.61874324",
"0.6115342",
"0.6074833",
"0.60078037",
"0.58725166",
"0.58628356",
"0.5778365",
"0.57309747",
"0.56849873",
"0.5674684",
"0.5670709",
"0.5653935",
"0.5630518",
"0.55452037",
"0.5497987",
"0.5493746",
"0.54778796",
"0.5468209",
"0.5463209",
"0.54517955",
"0.5346275",
"0.53359514",
"0.5328058",
"0.5318558",
"0.5309803",
"0.53097767",
"0.52950746",
"0.5292395",
"0.528816",
"0.5276535",
"0.5271299",
"0.5270735",
"0.52586305",
"0.5258551",
"0.5258551",
"0.5257204",
"0.52546245",
"0.5251147",
"0.52151114",
"0.52150327",
"0.5212915",
"0.51981324",
"0.5182604",
"0.5181793",
"0.517817",
"0.5176295",
"0.5164631",
"0.51625746",
"0.51625746",
"0.5161614",
"0.5155088",
"0.51367736",
"0.5133825",
"0.51266605",
"0.51263434",
"0.51262933",
"0.51257455",
"0.5125052",
"0.51243323",
"0.50993633",
"0.5098657",
"0.5089898",
"0.5089898",
"0.50866324",
"0.5082996",
"0.50808835",
"0.50808835",
"0.5076116",
"0.50717133",
"0.5055452",
"0.5054544",
"0.5054261",
"0.5049166",
"0.5047655",
"0.50454426",
"0.5044157",
"0.50409335",
"0.5039834",
"0.5039793",
"0.5034006",
"0.5033975",
"0.5025857",
"0.5025664",
"0.5015143",
"0.50150096",
"0.50117785",
"0.5008436",
"0.5005663",
"0.50018245",
"0.5001019",
"0.49978727",
"0.4996705",
"0.4996111",
"0.49957758",
"0.4983829",
"0.49818453",
"0.49764523",
"0.49704093",
"0.49701777",
"0.4969421",
"0.4967"
] | 0.0 | -1 |
Output: [2,3] Approach 3: Hash map Complexity Analysis Time complexity: O(n) average case. | def find_duplicates(array)
result_hash = {}
result_array = []
array.each do |num|
if result_hash[num].nil?
result_hash[num] = 1
else
result_hash[num] += 1
end
end
result_hash.each do |k, v|
result_array.push(k) if v > 1
end
result_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend",
"def hash_map_two_sum(arr,target_sum)\n count = {}\n arr.each do |ele|\n count[ele] = true\n return true if count[target_sum - ele] \n \n end\n false\nend",
"def solution2\n n = 1000\n\n hsh = Hash.new([])\n\n (1..n).each do |x|\n (1..n).each do |y|\n hsh[x**3 + y**3] += [x, y]\n end\n end\n\n hsh.values\nend",
"def hash_map(array, target)\n hash = {}\n\n (0...array.length).each do |ele|\n\n\n end \n\n\nend",
"def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend",
"def using_hash(arr1, arr2)\n sum1 = 0; sum2 = 0\n for i in 0...arr1.length\n sum1 += arr1[i]\n end\n \n for i in 0...arr2.length\n sum2 += arr2[i]\n end \n\n # return if not integer \n return false if (sum1 - sum2) % 2 == 0\n\n diff = (sum1 - sum2).abs / 2\n\n hsh = {}\n \n for i in 0...arr2.length\n hsh[arr2[i]] = true\n end\n\n for i in 0...arr1.length\n if hsh[diff + arr1[i]] == true\n return true\n end \n end \n\n return false\n\nend",
"def three_sum(nums)\n n = nums.length\n result = []\n for i in 0...n-2\n req_sum = 0\n hsh = Hash.new\n curr_sum = req_sum - nums[i]\n \n for j in (i+1)...n\n num = curr_sum - nums[j]\n if hsh[num]\n elements = [nums[i], num, nums[j]].sort\n result << elements unless result.include?(elements)\n end\n hsh[nums[j]] = true\n end \n end\n result\nend",
"def o1\n hasher = {}\n (0...@n).each do |n|\n sym = n.to_s.to_sym\n hasher[sym] = n\n end\n\n print_header('O(1) examples')\n\n hash_count = hasher.count\n do_benchmark(\"O(1) - Hash with #{hash_count} items\") do\n hasher[hash_count.to_s.to_sym]\n end\n\n self\n end",
"def map(hash); end",
"def two_sum_hash(numbers, target)\n n_index = {} \n (0...numbers.length).each do |i2|\n i1 = n_index[target - numbers[i2]] \n\n # We know that n[i2] > n[i1] because input array is sorted.\n return [i1 + 1, i2 + 1] if i1 && i1 != i2\n n_index[numbers[i2]] = i2\n end\nend",
"def hash(key); end",
"def hash_table(arr)\n dict = hash(arr)\n arr_dict = []\n (0..10).each do |key|\n next unless dict[key]\n\n list = dict[key]\n list.each do |item|\n arr_dict << item\n end\n end\n arr_dict\nend",
"def problem_60\n prime_check = lambda do |a,b|\n (a + b).to_i.prime? && (b + a).to_i.prime?\n end\n\n find_match = lambda do |a,k|\n r = a.select {|p| k != p && prime_check.call(k,p) }\n end\n\n primes = Primes.upto(10_000).map(&:to_s)\n primes.delete(\"2\")\n\n hit = {}\n\n primes.each do |p1|\n p1a = find_match.call(primes,p1)\n p1a.each do |p2|\n p2a = find_match.call(p1a,p2)\n p2a.each do |p3|\n p3a = find_match.call(p2a,p2)\n p3a.each do |p3|\n p4a = find_match.call(p3a,p3)\n p4a.each do |p4|\n p5a = find_match.call(p4a,p4)\n if p5a.length > 0\n p5a.each do |p5|\n a = [p1,p2,p3,p4,p5]\n sum = a.map(&:to_i).reduce(&:+)\n unless hit[sum]\n puts \"#{sum} #{a.inspect}\"\n else\n hit[sum] = true\n end\n return sum\n end\n end\n end\n end\n end\n end\n end\nend",
"def hash(*) end",
"def solution0(a)\n\n total_count = 0\n elem_counts = Hash.new(0)\n\n a.each do |elem|\n elem_counts[elem] += 1\n total_count += 1 if elem_counts[elem] == 2\n end\n\n return total_count\n\nend",
"def two_sum_3(nums, target)\n len = nums.length\n hash = {}\n\n for i in (0...len)\n elt = nums[i]\n diff = target - elt\n # check to see if diff is in the hash; if so we found 2 numbers that add up to sum, that is diff and elt\n if hash[diff]\n index1 = nums.index(diff)\n puts \"index1=#{index1+1}, index2=#{i+1}\"\n return\n else\n hash[elt] = 1 # add the key elt to the hash\n end\n end\nend",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash_two_sum?(arr, target)\n hash_count = {}\n\n arr.each { |el| hash_count[el] = true }\n\n hash_count.each_key do |key|\n return true unless hash_count[target - key].nil?\n end\n\n false\n \nend",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash_map_two_sum?(arr, target_sum)\n hash = Hash.new(0)\n arr.each do |num|\n hash[num] += 1\n end\n arr.each do |num|\n target = target_sum - num\n hash[num] -= 1\n return true if hash[target] > 0\n hash[num] += 1\n end\n false\nend",
"def fourth_anagram?(word_1, word_2) # O(n)\n hash_1 = Hash.new(0)\n hash_2 = Hash.new(0)\n\n word_1.each_char {|char| hash_1[char] += 1}\n word_2.each_char {|char| hash_2[char] += 1}\n\n hash_1 == hash_2\nend",
"def makeAnagram(a, b)\n hash_map = Hash.new(0)\n p hash_map \nend",
"def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end",
"def find_hash(possible_words, known_anagram, known_md5s, start, n = 3)\n cpus = Parallel.processor_count\n puts \"Total number of iteration: #{possible_words.length**n}\"\n puts \"You got #{cpus} cores\"\n\n hash_table = get_hash_table(known_anagram)\n known_hash = get_hash(known_anagram, hash_table)\n\n Parallel.map(possible_words, in_processes: cpus) do |w1|\n possible_words.each do |w2|\n possible_words.each do |w3|\n # Print every ten million iteration\n phrase = \"#{w1} #{w2} #{w3}\"\n\n # Allow only equal size phrases\n next unless phrase.length == known_anagram.length\n\n # Allow only equal hash phrases\n hash = get_hash(phrase, hash_table)\n next unless hash == known_hash\n\n # All only equal md5 phrases\n md5 = Digest::MD5.hexdigest phrase\n next unless known_md5s.include?(md5)\n\n puts \"#{phrase} #{md5} (#{Time.now - start}s)\"\n end\n end\n end\nend",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash_two_sum?(arr, target)\n hash = {}\n arr.each do |num|\n return true if hash[target - num]\n hash[num] = true\n end\n false\nend",
"def hash_two_sum(array, target)\n numbers = Hash.new(0)\n array.each { |num| numbers[num] = true }\n numbers.each { |k, v| return true if numbers.has_key?(target - k)}\nend",
"def strange_sums(arr)\n hash = Hash.new(0)\n arr.map do |ele|\n hash[ele.abs] += 1\n end\n \n hash.count do |h,v|\n v == 2\n end\nend",
"def cache_intersection2(nums1, nums2)\n outer_cache = {}\n nums1.each do |n|\n next if outer_cache[n]\n outer_cache[n] = true\n end\n array = []\n inner_cache = {}\n nums2.each do |n|\n next if inner_cache[n]\n array << n if outer_cache[n]\n inner_cache[n] = true\n end\n array\nend",
"def fourth_anagram?(str1, str2) # .338 O(n)\n h1 = Hash.new(0)\n h2 = Hash.new(0)\n str1.each_char { |c1| h1[c1] += 1}\n str2.each_char { |c2| h2[c2] += 1}\n h1 == h2\nend",
"def two_sum?(array, target)\n hash_map = Hash.new\n array.each do |ele|\n return true if hash_map[ele]\n hash_map[target - ele] = true\n end\n false\nend",
"def two_sum_hash?(arr, target)\n\n hash = Hash.new(0)\n\n arr.each do |el|\n value = target - el\n if hash.has_key?(value)\n return true\n else\n hash[el] = true\n end\n end\n\n false\n\nend",
"def intersection_hash(array1, array2)\n hash = Hash.new()\n intersection = []\n\n array1.each do |el|\n hash[el] = true\n end\n\n array2.uniq.each do |el|\n if hash[el]\n intersection << el\n end\n end\n\n intersection\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def hashfunction(key, size)\n #key.hash % size\n key % size\n end",
"def geohash(key, member); end",
"def hash_two_sum(array, target)\n hashy = Hash.new(0)\n array.each do |int|\n hashy[int] += 1\n end\n\n hashy.keys.each do |key|\n hashy[key] -= 1\n return true if hashy[target - key] > 0\n end\n\n false\nend",
"def hash()\n #This is a stub, used for indexing\n end",
"def calcIt\n a = [\"1\",\"5\",\"2\",\"3\",\"4\"]\n h = Hash.new(0)\n a.each do |v|\n h[v] += 1\n end\n h\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hiv_protease(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[23] = ['L',['I']]\n sdrm[24] = ['L',['I']]\n sdrm[30] = ['D',['N']]\n sdrm[32] = ['V',['I']]\n sdrm[46] = ['M',['I','L','V']]\n sdrm[47] = ['I',['V','A']]\n sdrm[48] = ['G',['V','M']]\n sdrm[50] = ['I',['V','L']]\n sdrm[53] = ['F',['L']]\n sdrm[54] = ['I',['V','L','M','T','A','S']]\n sdrm[73] = ['G',['S','T','C','A']]\n sdrm[76] = ['L',['V']]\n sdrm[82] = ['V',['A','T','S','F','L','C','M']]\n sdrm[83] = ['N',['D']]\n sdrm[84] = ['I',['V','A','C']]\n sdrm[85] = ['I',['V']]\n sdrm[88] = ['N',['D','S']]\n sdrm[90] = ['L',['M']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n end\n end\n return out_hash\nend",
"def test_array_hash\r\n # a = %w(brendan baird billy)\r\n # assert_equal(1047868961, a.hash)\r\n end",
"def hash_letter_freq( array )\n\n i = 0 # keeps track of outter loop\n hash = Hash.new()\n\n while( array.length > i )\n\n count = 1\n\n i2 = 1 + i # keeps track of inner while loop\n\n while( array.length > i2 ) # this will never check the last element of the array - otherwise have i2 check itself by doing i2 = i\n\n # puts(\"i #{i} | i2 #{i2}\") -- check if iteration is made right\n\n if( array[i] == array[i2] )\n count += 1\n end\n\n i2 += 1\n end # inner - while\n\n # alternative cond: hash.has_key?(\"#{array[i]}\") http://ruby-doc.org/core-1.9.3/Hash.html#method-i-has_key-3F\n if( hash[\"#{array[i]}\"] == nil ) # checks if key exists\n hash[\"#{array[i]}\"] = count\n end\n\n # for the last element in the array -- skipped by i2\n if( i2 == array.length )\n if( hash[\"#{array[i]}\"] == nil )\n hash[\"#{array[i]}\"] = 1\n end\n end\n\n\n i += 1\n end # while -outter\n\n # puts( hash )\n return hash\n\nend",
"def hash_two_sum?(arr, target_sum)\n hash = Hash.new(0)\n\n arr.each do |ele| \n hash[ele] += 1 \n end\n # hahs = {0=> 1, 1=>1, 5=> 1, 7=> 1}\n arr.each do |ele| # 0, 1, 5\n result = target_sum - ele # 10, # 9, #5 \n return true if hash.has_key?(result) && result != ele #10=>false, 9=> false, 5=>true\n end\n false \nend",
"def fourth_anagram?(str1,str2) #O(n)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n \n str1.split('').each do |c1|\n hash1[c1] += 1\n end \n\n str2.split('').each do |c1|\n hash2[c1] += 1\n end \n\n hash1 == hash2\nend",
"def two_sum2(arr, target_sum)\n hash = {}\n\n arr.each do |el|\n return true if hash[target_sum - el]\n hash[el] = true\n end\n\n false\nend",
"def two_sum_hash(array, target)\n hsh = Hash.new(0)\n\n array.each do |el|\n hsh[el] += 1\n return true if el == target / 2 && hsh[el] >= 2\n return true if hsh[target - el] >= 1 && el != target / 2\n end\n false\nend",
"def contains_duplicate(nums)\n hash_table = {}\n (0..nums.length).each do |i|\n if hash_table.include? nums[i]\n return true\n else\n hash_table[nums[i]] = 1\n end\n end\n return false\nend",
"def hash_two_sum(arr, target)\n h = Hash.new { |h, k| h[k] = [] }\n arr.each_with_index do |num, i|\n return true unless h[target - num].empty?\n h[num] << i\n end\n\n false\nend",
"def solution(arr)\n temp_hash_odd_balls = {}\n\n arr.each { |el| temp_hash_odd_balls[el] ? temp_hash_odd_balls.delete(el) : temp_hash_odd_balls[el] = 0 }\n\n temp_hash_odd_balls.keys.first\nend",
"def arrhash(arg)\n the_hash = {}\n arg.each_with_index do |x,y|\n the_hash[y] = x\n end\n puts the_hash\nend",
"def two_sum(arr, target) \n hash = {}\n \n i = 0\n for val in arr do\n val1 = arr[i]\n val2 = target - val1 \n if hash[val2] \n return [hash[val2], i]\n else\n hash[val1] = i \n end\n i += 1\n end\n\n nil \nend",
"def hash\n num = @high << 64\n num |= @low\n num.hash\n end",
"def intersection(nums1, nums2)\n hsh = {}\n result = []\n\n nums1.each do |num|\n hsh[num] = true\n end\n\n nums2.each do |num|\n if hsh[num]\n result.push(num) \n hsh[num] = false\n end\n end\n\n result\nend",
"def put_in_hash(array1, array2, nb=array1.length)\n hash = {}\n nb.times {|a| hash[array1[a]] = array2[a]}\n return hash\nend",
"def cache_intersection(nums1, nums2)\n array = []\n outer_cache = {}\n inner_cache = {}\n nums1.each do |outer|\n next if outer_cache[outer]\n outer_cache[outer] = true\n nums2.each do |inner| \n next if inner_cache[inner]\n if outer == inner \n array << inner\n inner_cache[inner] = true\n end\n end\n end\n array\nend",
"def hash_two_sum(value,data)\n hash = {}\n hash = add_to_hash(hash,data)\n keys = hash.keys\n data.each do |data_item|\n search_item = value - data_item\n if keys.include?(search_item)\n puts \"found in the hash\"\n break\n end\n end\nend",
"def hash arr\n\t# could also do\n\t# return {max: arr.max, min: arr.min, avg: arr.reduce(:+).to_f / arr.size }\n\tarr_hash = {max: arr.max, min: arr.min, avg: arr.reduce(:+).to_f / arr.size }\n\tp arr_hash\nend",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def arrhash (arg)\n the_hash = {}\n arg.each_with_index do |x,y|\n the_hash[y] = x\n end\n puts the_hash\nend",
"def solution(x,a)\n counter_hash = {}\n a.each_with_index do |value, index|\n counter_hash[value] = true\n return index if counter_hash.size == x\n end\n -1\nend",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def createHashTable()\n \n #Loop to parse alphabetically sorted letters in given word,\n #create hash table\n\n for i in 0..@sortedWord.length-1\n currentLetter = @sortedWord[i]\n \n #Check if currentLetter already has entry. If so, increment currentLetter's \n #occurrencesOfLetter. Then multiply it with global @multiLetterDivisor. If\n #letter has 2 occurrences, @multiLetterDivisor gets multiplied by 2. If it\n #has 3 occurrences, it gets multiplied by 2 and then 3, which is 3!\n #So when hash table is complete, @multiLetterDivisor globally tracks total\n #factorial division needed spanning all letters\n \n if @letterHash.has_key? currentLetter\n @letterHash[currentLetter][\"occurrencesOfLetter\"] =\n @letterHash[currentLetter].fetch(\"occurrencesOfLetter\", 0) + 1\n @multiLetterDivisor *= @letterHash[currentLetter][\"occurrencesOfLetter\"]\n \n #if no entry exists then first occurrence of this letter.\n #Assign global @uniqueLetterCount to this letter's alphabetical index\n #Set occurrencesOfLetter to 1. Increment @uniqueLetterCount.\n \n else\n @letterHash[currentLetter][\"alphabeticalIndex\"] = @uniqueLetterCount\n @letterHash[currentLetter][\"occurrencesOfLetter\"] = 1\n @uniqueLetterCount += 1\n \n #For first letter in alphabetical sequence, totalLettersBefore is 0.\n #For all others, set it to global @totalLetterCount\n \n if (@uniqueLetterCount == 0)\n @letterHash[currentLetter][\"totalLettersBefore\"] = 0\n else\n @letterHash[currentLetter][\"totalLettersBefore\"] = @totalLetterCount\n end \n end\n \n #1 letter has been added to hash table. Increment global\n #@totalLetterCount\n \n @totalLetterCount += 1\n end\n end",
"def solution(a)\n # write your code in Ruby 2.2 \n frecuencies = a.each_with_object(Hash.new(0)) { |key, value| value[key] += 1 } \n \n frecuencies.each do |key, value|\n if value.odd? then return key end\n end\nend",
"def pair_sum_using_hash_table(input, target_sum)\n # hash which will store nos\n hash_table = {}\n \n # target sum should be 10\n #target_sum = 10\n\n # put both no's in array which sums up to 10\n result = []\n \n for i in input do\n tmp_result = target_sum - i\n # if tmp_result is present in hash then break , we found our nos\n if hash_table.has_key?(tmp_result)\n result << i \n result << tmp_result\n break\n else\n # if equation result is not present in hash then put i in hash\n hash_table[i] = true\n end\n end\n ap \"Out put #{result}\"\n return result\nend",
"def fourth_anagram?(str1, str2)\n\n str1_hash = Hash.new {|h,k| h[k] = 0 } # O(1)\n str2_hash = Hash.new {|h,k| h[k] = 0 } # O(1)\n\n str1.each_char do |char| # O(n)\n str1_hash[char] += 1\n end\n\n str2.each_char do |char| # O(n)\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash # O(1)\n\nend",
"def pairs_given_sum num, arr\n the_hash, indices = Hash.new, []\n arr.each_with_index do |x,xi|\n complement = num - x\n lookup = the_hash[complement]\n lookup.nil? ? the_hash[x] = xi : indices << [lookup, xi]\n # puts the_hash\n end\n indices\nend",
"def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend",
"def hash_two_sum?(arr, target)\n hash_of_elements = Hash.new { |h,k| h[k] = 0 }\n\n arr.each do |el|\n complement = target - el\n return true if hash_of_elements.has_key?(complement)\n hash_of_elements[el] += 1\n end\n false\nend",
"def hashit\n n = 0\t \n (\"A\"..\"Z\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n return @rotor_hash\n end",
"def find_pair(array,sum)\n indices = []\n hash = Hash.new\n array.each_with_index do |element,i|\n if hash[sum - element] != nil then\n indices.push(\"#{hash[sum - element]},#{i}\")\n end\n hash[element] = i\n end\n indices\nend",
"def hash()\n #This is a stub, used for indexing\nend",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"def array_flash(n)\nhash = Hash[\n'&','name: Set Intersection---Returns a new array\ncontaining elements common to the two arrays, with no duplicates.\n\n [ 1, 1, 3, 5 ] _____ [ 1, 2, 3 ] #=> [ 1, 3 ]' ,\n'*','name: Repetition---With a String argument, equivalent to\nself.join(str). Otherwise, returns a new array\nbuilt by concatenating the _int_ copies of self.\n[ 1, 2, 3 ] _____ 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]\n[ 1, 2, 3 ] _____\",\" #=> \"1,2,3\" ',\n'+','name: Concatenation---Returns a new array built by concatenating the\ntwo arrays together to produce a third array.',\n'-','Array Difference---Returns a new array that is a copy of\nthe original array, removing any items that also appear in\nother_ary.\n [ 1, 1, 2, 2, 3, 3, 4, 5 ]____[ 1, 2, 4 ] #=> [ 3, 3, 5 ]',\n'<=>','Comparison---Returns an integer (-1, 0,\nor +1) if this array is less than, equal to, or greater than\nother_ary.\n[ \"a\", \"a\", \"c\" ] _____[ \"a\", \"b\", \"c\" ] #=> -1\n [ 1, 2, 3, 4, 5, 6 ]______[ 1, 2 ] #=> +1',\n 'any?','Passes each element of the collection to the given block. The method\nreturns true if the block ever returns a value other\nthan false or nil. If the block is not\ngiven, Ruby adds an implicit block of {|obj| obj} (that\nis any? will return true if at least one\nof the collection members is not false or\nnil.\n%w{ant bear cat}._____ {|word| word.length >= 3} #=> true\n %w{ant bear cat}._____ {|word| word.length >= 4} #=> true\n [ nil, true, 99 ]._____ #=> true',\n'assoc','Searches through an array whose elements are also arrays\ncomparing _obj_ with the first element of each contained array\nusing obj.==.\nReturns the first contained array that matches (that\nis, the first associated array),\nor nil if no match is found.\n s1 = [ \"colors\", \"red\", \"blue\", \"green\" ]\n s2 = [ \"letters\", \"a\", \"b\", \"c\" ]\n s3 = \"foo\"\n a = [ s1, s2, s3 ]\n a._______ #=> [ \"letters\", \"a\", \"b\", \"c\" ]\n a._______ #=> nil(foo is not an array)',\n'clear','Removes all elements from self\na = [ \"a\", \"b\", \"c\", \"d\", \"e\" ] \n______ #=> [ ]',\n'combination','When invoked with a block, yields all combinations of length n\nof elements from ary and then returns ary itself.\nThe implementation makes no guarantees about the order in which\nthe combinations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n a = [1, 2, 3, 4]\n a.______(1).to_a #=> [[1],[2],[3],[4]]\n a.______(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]\n a.______(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]\n a.______(4).to_a #=> [[1,2,3,4]]\n a.______(0).to_a #=> [[]] # one combination of length 0\n a.______(5).to_a #=> [] # no combinations of length 5',\n'compact','Returns a copy of self with all nil elements removed.\n [ \"a\", nil, \"b\", nil, \"c\", nil ]._________ #=> [ \"a\", \"b\", \"c\" ]',\n'concat','Appends the elements of other_ary to SELF.\n[ \"a\", \"b\" ]._________( [\"c\", \"d\"] ) #=> [ \"a\", \"b\", \"c\", \"d\" ]',\n'','Returns the number of elements. If an argument is given, counts\nthe number of elements which equals to obj. If a block is\ngiven, counts the number of elements yielding a true value.\n \tary = [1, 2, 4, 2]\n ary._______ #=> 4\n ary._______(2) #=> 2\n ary._______{|x|x%2==0} #=> 3',\n'cycle','Calls block for each element repeatedly _n_ times or\nforever if none or nil is given. If a non-positive number is\ngiven or the array is empty, does nothing. Returns nil if the\nloop has finished without getting interrupted.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [\"a\", \"b\", \"c\"]\n a.______ {|x| puts x } # print, a, b, c, a, b, c,.. forever.\n a.______(2) {|x| puts x } # print, a, b, c, a, b, c.',\n'delete','\nDeletes items from self that are equal to obj.\nIf any items are found, returns obj. If\nthe item is not found, returns nil. If the optional\ncode block is given, returns the result of block if the item\nis not found. (To remove nil elements and\nget an informative return value, use #compact!)\na = [ \"a\", \"b\", \"b\", \"b\", \"c\" ]\n a.______(\"b\") #=> \"b\"\n a #=> [\"a\", \"c\"]\n a.______(\"z\") #=> nil\n a.______(\"z\") { \"not found\" } #=> \"not found\"',\n'delete_at','Deletes the element at the specified index, returning that element,\nor nil if the index is out of range. See also\nArray#slice!\na = %w( ant bat cat dog )\n a._______(2) #=> \"cat\"\n a #=> [\"ant\", \"bat\", \"dog\"]\n a._______(99) #=> nil',\n'_____','Deletes every element of self for which block evaluates\nto true.\nThe array is changed instantly every time the block is called and\nnot after the iteration is over.\nSee also Array#reject!\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._____ {|x| x >= \"b\" } #=> [\"a\"]',\n 'dig','Retrieves the value object corresponding to the each key objects \n repeatedly.\n h = { foo: {bar: {baz: 1}}}\nh.________(:foo, :bar, :baz) #=> 1\nh.________(:foo, :zot) #=> nil',\n 'drop','removes first n elements from ary and returns the rest of\nthe elements in an array.\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [4, 5, 0]',\n 'drop_while','removes first elements until the statement is false then returns\n an array with the remaining.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]',\n 'each','passes block once for each element in self, passing that\nelement as a parameter.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.______{|x| print x, \" -- \" } #=> a -- b -- c --',\n 'each_index','passes the index of the element\ninstead of the element itself.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [ \"a\", \"b\", \"c\" ]\n a.________ {|x| print x, \" -- \" } #=> 0 -- 1 -- 2 --',\n 'empty?','\nReturns true if self contains no elements.\n\n [].empty? #=> true',\n 'fetch','Tries to return the element at position index. If the index\nlies outside the array, the first form throws an\nIndexError exception, the second form returns\ndefault, and the third form returns the value of invoking\nthe block, passing in the index. Negative values of index\ncount from the end of the array.\n\n a = [ 11, 22, 33, 44 ]\n a.______(1) #=> 22\n a.______(-1) #=> 44\n a.______(4, \"cat\") #=> \"cat\"\n a.______(4) { |i| i*i } #=> 16',\n'fill','The first three forms set the selected elements of self (which\nmay be the entire array) to obj. A start of\nnil is equivalent to zero. A length of\nnil is equivalent to self.length. The last three\nforms fill the array with the value of the block. The block is\npassed the absolute index of each element to be filled.\nNegative values of start count from the end of the array.\n\n a = [ \"a\", \"b\", \"c\", \"d\" ]\n a._____(\"x\") #=> [\"x\", \"x\", \"x\", \"x\"]\n a._____(\"z\", 2, 2) #=> [\"x\", \"x\", \"z\", \"z\"]\n a._____(\"y\", 0..1) #=> [\"y\", \"y\", \"z\", \"z\"]\n a._____ {|i| i*i} #=> [0, 1, 4, 9]\n a._____(-2) {|i| i*i*i} #=> [0, 1, 8, 27]',\n ['index','find_index'],'Returns the index of the first object in self such that the object is\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is true.\nReturns nil if no match is found.\nSee also Array#rindex.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.index(\"b\") #=> 1\n a.index(\"z\") #=> nil\n a.index{|x|x==\"b\"} #=> 1',\n 'flatten','Returns a new array that is a one-dimensional _______ of this\narray (recursively). That is, for every element that is an array,\nextract its elements into the new array. If the optional\nlevel argument determines the level of recursion to _______.\n\n s = [ 1, 2, 3 ] #=> [1, 2, 3]\n t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]\n a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]\n a._______ #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n a = [ 1, 2, [3, [4, 5] ] ]\n a._______(1) #=> [1, 2, 3, [4, 5]]',\n 'frozen?','Returns the freeze status of obj.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.freeze #=> [\"a\", \"b\", \"c\"]\n a.frozen? #=> true',\n 'include?','Returns true if the given object is present in\nself (that is, if any object == anObject),\nfalse otherwise.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._______(\"b\") #=> true\n a._______(\"z\") #=> false',\n 'insert','adds the given values before the element with the given index\n(which may be negative).\n\n a = %w{ a b c d }\n a._______(2, 99) #=> [\"a\", \"b\", 99, \"c\", \"d\"]\n a._______(-2, 1, 2, 3) #=> [\"a\", \"b\", 99, \"c\", 1, 2, 3, \"d\"] ',\n \"inspect\",\"Creates a string representation of self. like puts but as a method\",\n \"join\",\"Returns a string created by converting each element of the array to\na string, separated by sep.\n\n [ 'a', 'b', 'c' ].______ #=> 'abc'\n [ 'a', 'b', 'c' ].______('-') #=> 'a-b-c' \",\n \"keep_if\",\"Deletes every element of self for which block evaluates\nto false.\nSee also Array#select!\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a._______ {|v| v =~ /[aeiou]/} #=> ['a', 'e']\",\n \"last\",\"Returns the last element(s) of self. If the array is empty,\nthe first form returns nil.\n\n a = [ 'w', 'x', 'y', 'z' ]\n a.______ #=> 'z'\n a.______(2) #=> ['y', 'z']\",\n [\"collect!\",\"map!\"],\" Invokes the block once for each element of self, replacing the\nelement with the value returned by _block_.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ {|x| x + '!' }\n a #=> [ 'a!', 'b!', 'c!', 'd!' ] \",\n \"permutation\",\"When invoked with a block, yield all permutations of length n\nof the elements of ary, then return the array itself.\nIf n is not specified, yield all permutations of all elements.\nThe implementation makes no guarantees about the order in which\nthe permutations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a._______.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(1).to_a #=> [[1],[2],[3]]\n a._______(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]\n a._______(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(0).to_a #=> [[]] # one _______ of length 0\n a._______(4).to_a #=> [] # no _______s of length 4\",\n \"place\",\" Places values before or after another object (by value) in\nan array. This is used in tandem with the before and after\nmethods of the {Insertion} class.\n\nexample _______ an item before another\n [1, 2, 3].place(4).before(3) # => [1, 2, 4, 3]\nexample _______ an item after another\n [:a, :b, :c].place(:x).after(:a) # => [:a, :x, :b, :c]\nparam [Array] values value to insert\nreturn [Insertion] an insertion object to\",\n \"pop\",\"Removes the last element from self and returns it, or\nnil if the array is empty.\n\nIf a number _n_ is given, returns an array of the last n elements\n(or less) just like array.slice!(-n, n) does.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ #=> 'd'\n a.______(2) #=> ['b', 'c']\n a #=> ['a'] \",\n \"product\",\"Returns an array of all combinations of elements from all arrays.\nThe length of the returned array is the product of the length\nof self and the argument arrays.\nIf given a block, product will yield all combinations\nand return self instead.\n\n\n [1,2,3].______([4,5]) #=> [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]\n [1,2].______([1,2]) #=> [[1,1],[1,2],[2,1],[2,2]]\n [1,2].______([3,4],[5,6]) #=> [[1,3,5],[1,3,6],[1,4,5],[1,4,6],\n # [2,3,5],[2,3,6],[2,4,5],[2,4,6]]\n [1,2].______() #=> [[1],[2]]\n [1,2].______([]) #=> [] \",\n \"rassoc\",\" Searches through the array whose elements are also arrays. Compares\n_obj_ with the second element of each contained array using\n==. Returns the first contained array that matches.\n a = [ [ 1, 'one'], [2, 'two'], [3, 'three'], ['ii', 'two'] ]\n a.rassoc('two') #=> [2, 'two']\n a.rassoc('four') #=> nil \",\n [\"reject\",\"delete_if\"], \"Returns a new array containing the items in self\nfor which the block is not true.\nIf no block is given, an enumerator is returned instead.\",\n \"repeated_combination\",\"When invoked with a block, yields all repeated combinations of\nlength n of elements from ary and then returns\nary itself.\nThe implementation makes no guarantees about the order in which\nthe ______________ are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a.___________(1).to_a #=> [[1], [2], [3]]\n a.___________(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]\n a.___________(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],\n # [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]\n a.___________(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],\n # [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],\n # [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]\n a.___________(0).to_a #=> [[]] # one ________ of length 0\",\n \"repeated_permutation\",\"When invoked with a block, yield all repeated permutations of length\nn of the elements of ary, then return the array itself.\nThe implementation makes no guarantees about the order in which\nthe ___________are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2]\n a._______(1).to_a #=> [[1], [2]]\n a._______(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]\n a._______(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],\n # [2,1,1],[2,1,2],[2,2,1],[2,2,2]]\n a._______(0).to_a #=> [[]] # one ___________of length 0\",\n \"replace\",\" Replaces the contents of self with the contents of\nother_ary, truncating or expanding if necessary.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a.______([ 'x', 'y', 'z' ]) #=> ['x', 'y', 'z']\n a #=> ['x', 'y', 'z'] #its like reassigning the variable\",\n \"reverse!\",\"\nReverses SELF in place.\n\n a = [ 'a', 'b', 'c' ]\n a._______ #=> ['c', 'b', 'a']\n a #=> ['c', 'b', 'a'] \",\n \"reverse_each\",\"Same as Array#each, but traverses self in reverse\norder.\n\n a = [ 'a', 'b', 'c' ]\n a.______ {|x| print x, ' ' } #=> c b a\",\n \"rindex\",\" Returns the index of the LAST object in self\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is\ntrue, starting from the last object.\nReturns nil if no match is found.\nSee also Array#index.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'b', 'b', 'c' ]\n a.______('b') #=> 3\n a.______('z') #=> nil\n a.______ { |x| x == 'b' } #=> 3\",\n \"rotate\",\"Returns new array by rotating self so that the element at\ncnt in self is the first element of the new array. If cnt\nis negative then it rotates in the opposite direction.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a._______ #=> ['b', 'c', 'd', 'a']\n a #=> ['a', 'b', 'c', 'd']\n a._______(2) #=> ['c', 'd', 'a', 'b']\n a._______(-3) #=> ['b', 'c', 'd', 'a'] \",\n \"sample\",\"Choose a random element or n random elements from the array. The elements\nare chosen by using random and unique indices into the array in order to\nensure that an element doesn't repeat itself unless the array already\ncontained duplicate elements. If the array is empty the first form returns\nnil and the second form returns an empty array.\n\nIf rng is given, it will be used as the random number generator.\",\n \"select\",\"Invokes the block passing in successive elements from self,\nreturning an array containing those elements for which the block\nreturns a true value (equivalent to Enumerable#______).\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a.______ {|v| v =~ /[aeiou]/} #=> ['a', 'e'] \",\n \"shift\",\"Returns the first element of self and removes it (shifting all\nother elements down by one). Returns nil if the array\nis empty.\n\nIf a number _n_ is given, returns an array of the first n elements\n(or less) just like array.slice!(0, n) does.\n\n args = [ '-m', '-q', 'filename' ]\n args._______ #=> '-m'\n args #=> ['-q', 'filename']\n\n args = [ '-m', '-q', 'filename' ]\n args._______(2) #=> ['-m', '-q']\n args #=> ['filename'] \",\n \"shuffle\",\"Returns a new array with elements of this array ______.\n\n a = [ 1, 2, 3 ] #=> [1, 2, 3]\n a.______ #=> [2, 3, 1]\n\nIf rng is given, it will be used as the random number generator.\n\n a.______(random: Random.new(1)) #=> [1, 3, 2] \",\n [\"slice\",\"[]\"],\"Element Reference---Returns the element at _index_,\nor returns a subarray starting at _start_ and\ncontinuing for _length_ elements, or returns a subarray\nspecified by _range_.\nNegative indices count backward from the end of the\narray (-1 is the last element). Returns nil if the index\n(or starting index) are out of range.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a[2] + a[0] + a[1] #=> 'cab'\n a[6] #=> nil\n a[1, 2] #=> [ 'b', 'c' ]\n a[1..3] #=> [ 'b', 'c', 'd' ]\n a[4..7] #=> [ 'e' ]\n a[6..10] #=> nil\n a[-3, 3] #=> [ 'c', 'd', 'e' ]\n # special cases\n a[5] #=> nil\n a[5, 1] #=> []\n a[5..10] #=> []\",\n \"sort\",\"Returns a new array created by organizing self. Comparisons for\nthe _____ will be done using the <=> operator or using\nan optional code block. The block implements a comparison between\na and b, returning -1, 0, or +1. \n\n a = [ 'd', 'a', 'e', 'c', 'b' ]\n a.______ #=> ['a', 'b', 'c', 'd', 'e']\n a.______ {|x,y| y <=> x } #=> ['e', 'd', 'c', 'b', 'a'] \",\n [\"take\",\"first\"] ,\"Returns first n elements from ary.\n\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [1, 2, 3]\",\n \"take_while\",\"\nPasses elements to the block until the block returns nil or false,\nthen stops iterating and returns an array of all prior elements.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a._______{|i| i < 3 } #=> [1, 2] \",\n \"transpose\",\"Assumes that self is an array of arrays and rearranges the\nrows and columns.\n\n a = [[1,2], [3,4], [5,6]]\n a.________ #=> [[1, 3, 5], [2, 4, 6]]\",\n \"uniq\",\"Returns a new array by removing duplicate values in self. If a block\nis given, it will use the return value of the block for comparison.\n\n a = [ 'a', 'a', 'b', 'b', 'c' ]\n a.uniq # => ['a', 'b', 'c']\n\n b = [['student','sam'], ['student','george'], ['teacher','matz']]\n b.uniq { |s| s.first } # => [['student', 'sam'], ['teacher', 'matz']]\",\n \"unshift\",\"Prepends objects to the front of self,\nmoving other elements upwards.\n\n a = [ 'b', 'c', 'd' ]\n a.unshift('a') #=> ['a', 'b', 'c', 'd']\n a.unshift(1, 2) #=> [ 1, 2, 'a', 'b', 'c', 'd']\",\n \"values_at\",\"Returns an array containing the elements in\nself corresponding to the given selector(s). The selectors\nmay be either integer indices or ranges.\nSee also Array#select.\n\n a = %w{ a b c d e f }\n a._______(1, 3, 5)\n a._______(1, 3, 5, 7)\n a._______(-1, -3, -5, -7)\n a._______(1..3, 2...5) \",\n\"zip\",\"Converts any arguments to arrays, then merges elements of\nself with corresponding elements from each argument. This\ngenerates a sequence of self.size n-element\narrays, where n is one more that the count of arguments. If\nthe size of any argument is less than enumObj.size,\nnil values are supplied. If a block is given, it is\ninvoked for each output array, otherwise an array of arrays is\nreturned.\n\n a = [ 4, 5, 6 ]\n b = [ 7, 8, 9 ]\n [1,2,3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]\n [1,2].zip(a,b) #=> [[1, 4, 7], [2, 5, 8]]\n a.zip([1,2],[8]) #=> [[4,1,8], [5,2,nil], [6,nil,nil]] \",\n \"|\",\"Set Union---Returns a new array by joining this array with\nother_ary, removing duplicates.\n\n [ 'a', 'b', 'c' ] | [ 'c', 'd', 'a' ]\n #=> [ 'a', 'b', 'c', 'd' ] \",\n]\n\n\n\n\n\n\n\na = 0\n\tuntil a == n\n\tindex = rand(hash.size)\n\tquestion = hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\n\tp \"which Array method is this?\"\n\tp ''\n\tp question.split.join(' ')#.gsub(/\\\\n/, \" \").gsub(/\\\\/,\" \")\n\t\n\tinput = gets.chomp\n\t\tuntil hash.keys[index].include?(input)\n\t\t\tbreak if ['idk', 'i dont know', 'i give up'].include?(input)\n\t\t\tp ''\n\t\t\tp hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\t\tp ''\n\t\t\tp '!!!!!!!!! try again !!!!!!!!!!'\n\t\t\t\n\t\t\tinput = gets.chomp \n\t\tend\n\t\t\n\t\tp \"\"\n\t\tp \"------------- good job it is #{hash.keys[index]}-----------------\"\n\t\t\n\t\thash.delete((hash.keys[index]))\n\t\ta += 1\n\tend\n\np '~~~~~~~~~~ you finished ~~~~~~~~~~~~~~~~~'\n\nend",
"def element_count(arr)\n hash = {} \n\n # debugger \n arr.each {|ele| hash[ele] = arr.count(ele) }\n\n hash \nend",
"def fourth_anagram?(word_1, word_2) #O(n)\n count1 = Hash.new(0) \n word_1.each_char { |char| count1[char] += 1 }\n\n count2 = Hash.new(0) \n word_2.each_char { |char| count2[char] += 1 }\n\n count1 == count2\nend",
"def solution(a)\n h = {}\n a.each do |num|\n h[num] ? h[num] += 1 : h[num] = 1\n end\n h.keys.count\nend",
"def two_sum(nums, target)\r\n numsLen = nums.size\r\n returnArr = Array.new(2,0)\r\n myHashTable = {nums[0]=>0}\r\n temp = 0\r\n \r\n if numsLen < 2\r\n return returnArr\r\n else\r\n for i in 1..numsLen-1\r\n temp = target - nums[i]\r\n if myHashTable.has_key?(temp) == true\r\n returnArr[0] = myHashTable[temp]\r\n returnArr[1] = i\r\n break\r\n else\r\n myHashTable.store(nums[i],i)\r\n end\r\n end\r\n end\r\n return returnArr\r\nend",
"def hash\n from_end.hash + to_end.hash + overlap.hash + reverse_overlap.to_s.hash\n end",
"def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend",
"def hash_offset(array, offset)\r\n hash = {}\r\n \r\n i = 0\r\n while i < array.length \r\n if i >= (array.length - offset) #if i >= 22, in this case. So this condition applies for the last 4 elements of the array\r\n hash[array[i-array.length + offset]] = array[i] # hash[array[22-26+4]] --> hash[array[0]] --> hash[\"a\"]=array[22] --> hash[\"a\"]=\"w\"\r\n else\r\n hash[(array[i].ord + offset).chr] = array[i] #otherwise do the normal offset by 4\r\n end\r\n i += 1\r\n end\r\n return hash\r\nend",
"def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end",
"def element_count(arr)\n newHash = Hash.new(0)\n arr.each{|x|newHash[x]+=1}\n return newHash\n\nend",
"def solve_for_d_optimized\n hash = {}\n for a in (1..5)\n for b in (1..5)\n result = (a**2) + (b**2)\n if hash[result].nil?\n hash[result] = [\"(#{a}, #{b})\"]\n else\n hash[result] << \"(#{a}, #{b})\"\n end\n end\n end\n\n hash.each do |key, array|\n if array.length > 1\n puts \"This is the result (#{array})\"\n end\n end\nend"
] | [
"0.7060721",
"0.66942304",
"0.6630345",
"0.6484438",
"0.64232737",
"0.6340076",
"0.62901914",
"0.6274769",
"0.627441",
"0.6247868",
"0.62390167",
"0.62355465",
"0.6224337",
"0.62183005",
"0.6195109",
"0.6187997",
"0.61857194",
"0.6136934",
"0.61342776",
"0.61342776",
"0.61342776",
"0.61342776",
"0.61342776",
"0.61342776",
"0.61342776",
"0.6125919",
"0.6103005",
"0.6072847",
"0.60727245",
"0.6061504",
"0.6033767",
"0.60331273",
"0.6027155",
"0.6003857",
"0.59975255",
"0.5989708",
"0.5976577",
"0.5952394",
"0.5932359",
"0.5925214",
"0.59186906",
"0.59136254",
"0.59082526",
"0.5905497",
"0.59043854",
"0.5902925",
"0.58974755",
"0.5896476",
"0.5882846",
"0.58817756",
"0.58816254",
"0.5881382",
"0.58733416",
"0.5861945",
"0.58595514",
"0.58580285",
"0.58578396",
"0.5846127",
"0.5843975",
"0.58421314",
"0.58394796",
"0.58330256",
"0.58278036",
"0.58239",
"0.5822539",
"0.5820945",
"0.5816967",
"0.58056426",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5805239",
"0.5803194",
"0.57920736",
"0.57912624",
"0.57866764",
"0.5783489",
"0.5781653",
"0.57802504",
"0.5775034",
"0.5774522",
"0.5771648",
"0.57636225",
"0.5760922",
"0.57569414",
"0.5749212",
"0.5748698",
"0.5733947",
"0.5732173",
"0.5725231",
"0.57191926",
"0.57165104",
"0.571546",
"0.57147384",
"0.5712094"
] | 0.0 | -1 |
Update various attachments, then remove any that were not updated | def update_or_remove
Event.transaction do
clear_before_time = 1.second.ago
yield
remove_old_attachments(clear_before_time)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_attachments_from_existing_note(note, attachments)\n attachments.each do |attach|\n logger.info \"Removing attachment '#{attach.file_name}' from note ID #{note.id}\"\n wait_for_update_and_click existing_note_attachment_delete_button(note, attach)\n confirm_delete\n existing_note_attachment_delete_button(note, attach).when_not_visible Utils.short_wait\n note.attachments.delete attach\n attach.deleted_at = Time.now\n note.updated_date = Time.now\n end\n end",
"def remove_attachments_from_new_note(note, attachments)\n attachments.each do |attach|\n logger.info \"Removing attachment '#{attach.file_name}' from an unsaved note\"\n wait_for_update_and_click new_note_attachment_delete_button(attach)\n new_note_attachment_delete_button(attach).when_not_visible Utils.short_wait\n note.attachments.delete attach\n note.updated_date = Time.now\n end\n end",
"def update_attachment_references\n return if attachment_references.empty?\n\n ids = attachment_reference_ids_removed\n attachment_references.each do |attachment_reference|\n attachment_reference.mark_for_destruction if ids.include?(attachment_reference.id)\n end\n end",
"def update_attachments(issue, args)\n if issue.persisted?\n delete_ids = args[:delete_attachments]\n issue.attachments.in(id: delete_ids).update_all(deleted: true)\n end\n\n return if (attachments.nil? || attachments.empty?)\n\n attachments.each do |attachment|\n if attachment[:id].blank?\n new_file = issue.attachments.build\n new_file.file = attachment[:data] # <json string>\n new_file.save!\n end\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def delete_attachments\n delete_attachment_queue.each {|k,v| delete_grid_attachment(k,v)}\n end",
"def update_attachment_references\n changes = attachment_reference_id_changes\n added_ids, removed_ids = changes[1] - changes[0], changes[0] - changes[1]\n\n attachment_references.each do |attachment_reference|\n attachment_reference.mark_for_destruction if removed_ids.include?(attachment_reference.id)\n end\n added_ids.each do |attachment_reference_id|\n attachment_references << AttachmentReference.find(attachment_reference_id)\n end\n end",
"def process_attachments!\n child_documents = parsed_form.dig('dependents_application', 'child_supporting_documents')\n spouse_documents = parsed_form.dig('dependents_application', 'spouse_supporting_documents')\n # add the two arrays together but also account for nil arrays\n supporting_documents = [child_documents, spouse_documents].compact.reduce([], :|)\n if supporting_documents.present?\n files = PersistentAttachment.where(guid: supporting_documents.map { |doc| doc['confirmation_code'] })\n files.find_each { |f| f.update(saved_claim_id: id) }\n end\n end",
"def update_attachable(a_id, c_id, a_params)\n logger.debug(\"updating attachments\")\n print \"updating attachments\\n\"\n status = true\n sd_list = Document.where(attachable_id: c_id)\n se_list = Embed.where(attachable_id: c_id)\n a_list = sd_list + se_list\n\n # Sort original list\n a_list.sort! { |x,y| x.display_index <=> y.display_index }\n\n # Find and update the appropriate attribute\n a_idx = a_list.index{ |x| x.id == a_id.to_i }\n a_list[a_idx].assign_attributes(a_params)\n nd_idx = a_list[a_idx].display_index\n\n # Edge case resolving because of the way ruby sorts\n if nd_idx > a_idx\n a_list[a_idx].display_index = a_list[a_idx].display_index + 1\n else\n a_list[a_idx].display_index = a_list[a_idx].display_index - 1\n end\n \n # ReSort the list so that the updated indexes are correct\n a_list.sort! { |x,y| x.display_index <=> y.display_index }\n\n # Re-Update the indices ( With large offset )\n a_list.each_with_index {|x, index| x.display_index = a_list.length + index}\n if a_list.any?{|a| a.display_index < a_list.length}\n throw Error.new(\"This is bad\")\n end\n\n # Split the list and rewite without collision\n begin\n d_list = a_list.find_all { |x| x.class == Document }\n d_list.each(&:save!)\n\n e_list = a_list.find_all { |x| x.class == Embed }\n e_list.each(&:save!)\n rescue Exception => eek\n print(eek)\n status and false\n end\n\n # Remove the offset from the indexes\n a_list.each_with_index {|x, index| x.display_index = index}\n\n # Split the list and rewite final version\n begin\n d_list = a_list.find_all { |x| x.class == Document }\n d_list.each(&:save!)\n\n e_list = a_list.find_all { |x| x.class == Embed }\n e_list.each(&:save!)\n rescue Exception => eek\n print(eek)\n status and false\n end\n\n return status\n end",
"def update!(**args)\n @add_attachments = args[:add_attachments] if args.key?(:add_attachments)\n end",
"def queue_delete_attachments\n self.class.attachment_types.each do |name|\n delete_attachment(name, read_attribute(\"#{name}_id\"))\n end\n end",
"def delete_old_uploaded_images\n dir = FileUploader.file_dir('article', id) # absolete path to images dir\n return unless File.directory?(dir)\n base_url = FileUploader.file_base_url('articles', id) # base url path (whithout filename)\n old_files = Dir.children(dir).select do |file| # select files that not in the article content\n not images.include?(\"#{base_url}/#{file}\")\n end\n old_files.each do |file| # delete files that not in article content\n attached_file_existence = AttachedFile.exists?(\n filable_type: 'Article',\n filable_id: id,\n new_name: file)\n next if attached_file_existence # File is not image in article\n file_path = \"#{dir}/#{file}\"\n File.delete(file_path) if File.exist?(file_path)\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n expire_action( news_url(:slug=>@post.slug) )\n expire_action( news_url(nil) )\n expire_action( home_url() )\n\n # Add/Remove attachments\n params[:attachments].each do |att|\n @post.attachments.create :uploadedfile=>att\n end if params.has_key?( :attachments )\n params[:removed_attachments].each do |att_id|\n begin # Let's be safe about it...\n @post.attachments.find(att_id).destroy\n rescue\n STDERR.puts \"#{att_id} isn't a valid ID for this post.\"\n end\n end if params.has_key?( :removed_attachments )\n\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to posts_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def purge\n if attached?\n attachments.each(&:purge)\n @attachments = nil\n end\n end",
"def call(attachments)\n Attachment.where({canvas_user_id: attachment_conf[:canvas_user_id], submission_id: attachment_conf[:submission_id]}).\n delete_all\n attachments.each do |attachment|\n Attachment.create(attachment_conf.merge({date: Time.parse(attachment['updated_at']),\n attachment_id: attachment['id'], image_url: attachment['url'], content_type: attachment['content-type']})\n )\n end\n end",
"def purge_later\n if attached?\n attachments.each(&:purge_later)\n @attachments = nil\n end\n end",
"def attachments_to_forget\n return [] unless self.class.remember_attachments?\n (self.database.get(self.id)[\"_attachments\"] || {}).keys.reject do |a| \n a.match(VERSION_REGEX) || \n (self.class.remember_attachments.map { |attachment_name_pattern|\n a.match attachment_name_pattern\n }.inject(false) {|b, sum| sum || b})\n end \n end",
"def destroy_attached_files\n Paperclip.log(\"Deleting attachments.\")\n each_attachment do |name, attachment|\n attachment.send(:flush_deletes)\n end\nend",
"def update\n @post_attachment = PostAttachment.where(rent_post: @rent_post.id)\n \n respond_to do |format|\n if @rent_post.update(rent_post_params)\n if params[:post_attachments]!=nil\n @post_attachment.destroy_all\n params[:post_attachments]['image'].each do |a|\n @post_attachment = @rent_post.post_attachments.create!(:image => a, :rent_post_id => @rent_post.id)\n end\n end\n format.html { redirect_to @rent_post, notice: 'Rent post was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent_post }\n else\n format.html { render :edit }\n format.json { render json: @rent_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message[:external_links] = params[:message][:external_links].first.split(\"\\r\\n\").map(&:strip)\n @message.images.purge if params[:images].present?\n @message.zh_tw_images.purge if params[:zh_tw_images].present?\n @message.zh_cn_images.purge if params[:zh_cn_images].present?\n @message.vi_images.purge if params[:vi_images].present?\n @message.hmn_images.purge if params[:hmn_images].present?\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: \"Message was successfully updated.\" }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_attachments(text, attachments)\n attachment_regexp = /\\[attachment=([\\d])+\\]<!-- [\\w]+ -->([^<]+)<!-- [\\w]+ -->\\[\\/attachment\\]?/i\n unreferenced_attachments = attachments.dup\n\n text = text.gsub(attachment_regexp) do\n index = $1.to_i\n real_filename = $2\n unreferenced_attachments[index] = nil\n attachments.fetch(index, real_filename)\n end\n\n unreferenced_attachments = unreferenced_attachments.compact\n text << \"\\n\" << unreferenced_attachments.join(\"\\n\") unless unreferenced_attachments.empty?\n text\n end",
"def update\n authorize @s_material\n files = @s_material.s_material_files\n files += s_material_params[:s_material_files] if s_material_params[:s_material_files]\n @s_material.assign_attributes(s_material_params)\n @s_material.s_material_files = files\n\n if params[:s_material_files_remove]\n\n remain_files = @s_material.s_material_files\n\n params[:s_material_files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @s_material.remove_s_material_files! if remain_files.empty?\n end\n respond_to do |format|\n if @s_material.save\n format.html { redirect_to s_materials_url, notice: t('Record has been saved') }\n format.json { render :show, status: :ok, location: @s_material }\n else\n format.html { render :edit }\n format.json { render json: @s_material.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_files(files)\n not_found = []\n files.each do |file|\n file_stored = Files.where({ '_id' => file[:uuid]}).first\n if file_stored.nil?\n logger.error 'File not found ' + file.to_s\n not_found << file\n else\n if file_stored['pkg_ref'] == 1\n # Referenced only once. Delete in this case\n file_stored.destroy\n del_ent_dict(file_stored, :files)\n file_md5 = Files.where('md5' => file_stored['md5'])\n if file_md5.size.to_i.zero?\n # Remove files from grid\n grid_fs = Mongoid::GridFs\n grid_fs.delete(file_stored['grid_fs_id'])\n end\n else\n # Referenced above once. Decrease counter\n file_stored.update_attributes(pkg_ref: file_stored['pkg_ref'] - 1)\n end\n # file_stored.destroy\n # del_ent_dict(file_stored, :files)\n #\n # # Remove files from grid\n # grid_fs = Mongoid::GridFs\n # grid_fs.delete(file_stored['grid_fs_id'])\n end\n end\n not_found\n end",
"def update\n authorize @s_other\n files = @s_other.s_other_files\n files += s_other_params[:s_other_files] if s_other_params[:s_other_files]\n @s_other.assign_attributes(s_other_params)\n @s_other.s_other_files = files\n\n if params[:s_other_files_remove]\n\n remain_files = @s_other.s_other_files\n\n params[:s_other_files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @s_other.remove_s_other_files! if remain_files.empty?\n end\n respond_to do |format|\n if @s_other.save\n format.html { redirect_to s_others_url, notice: t('Record has been saved') }\n format.json { render :show, status: :ok, location: @s_other }\n else\n format.html { render :edit }\n format.json { render json: @s_other.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @transport_company\n files = @transport_company.transport_company_files\n files += transport_company_params[:transport_company_files] if transport_company_params[:transport_company_files]\n @transport_company.assign_attributes(transport_company_params)\n @transport_company.transport_company_files = files\n\n if params[:transport_company_files_remove]\n remain_files = @transport_company.transport_company_files\n params[:transport_company_files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n @transport_company.remove_transport_company_files! if remain_files.empty?\n end\n respond_to do |format|\n if @transport_company.save\n format.html { redirect_to @transport_company, notice: 'Transport company was successfully updated.' }\n format.json { render :show, status: :ok, location: @transport_company }\n else\n format.html { render :edit }\n format.json { render json: @transport_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_submission_image_update(land_books, measuring_letters, id_number, authority_letter)\n self.submission_files.find_by(file_type: 'id_number').update(image: id_number) unless id_number.nil?\n self.submission_files.find_by(file_type: 'authority_letter').update(image: authority_letter) unless authority_letter.nil?\n\n unless land_books.nil?\n land_books.each do |lb|\n submission_file = self.submission_files.find_by(file_type: 'land_book', description: lb[0])\n if submission_file\n submission_file.update(image: lb[-1])\n else\n self.submission_files.create(file_type: 'land_book', description: lb[0], image: lb[-1])\n end\n end\n end\n\n unless measuring_letters.nil?\n measuring_letters.each do |lb|\n submission_file = self.submission_files.find_by(file_type: 'measuring_letter', description: lb[0])\n if submission_file\n submission_file.update(image: lb[-1])\n else\n self.submission_files.create(file_type: 'measuring_letter', description: lb[0], image: lb[-1])\n end\n end\n end\n end",
"def update!(**args)\n @addon_attachments = args[:addon_attachments] if args.key?(:addon_attachments)\n end",
"def bulk_update_associated_items\n return unless @image_ids.present?\n @image_ids.each_with_index { |image_id, position| update_position_or_create_item(image_id, position) }\n delete_removed_items\n end",
"def update\n # respond_to do |format|\n\n if not post_params[:images].nil?\n @post.images.purge\n end\n\n if not post_params[:attachments].nil?\n @post.attachments.purge\n end\n\n if @post.update(post_params)\n redirect_to root_path, notice: \"Updated!\"\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { render :show, status: :ok, location: @post }\n # else\n # format.html { render :edit }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def adjust_pending_uploads\n return unless parent.respond_to?(:pending_uploads)\n parent.pending_uploads = [] if parent.pending_uploads.blank?\n parent.pending_uploads = (parent.pending_uploads || []) - files\n end",
"def attachment_removed(obj)\n if @current_journal && !obj.new_record?\n @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :old_value => obj.filename)\n @current_journal.save\n end\n end",
"def update\n q = 0\n if(params.has_key?:q)\n q = params[:q].to_i\n end\n\n # Si la modification du message réussit\n if @message.update_attributes(params[:message])\n\n # On s'occupe des pièces jointes\n totalsize = 0\n\n @message.messagefiles.each do |sf|\n if params[\"prevfile#{sf.id}\".to_sym].nil?\n sf.file.destroy\n sf.destroy\n else\n totalsize = totalsize + sf.file_file_size\n end\n end\n\n @message.fakemessagefiles.each do |sf|\n if params[\"prevfakefile#{sf.id}\".to_sym].nil?\n sf.destroy\n end\n end\n\n attach = Array.new\n\n i = 1\n k = 1\n while !params[\"hidden#{k}\".to_sym].nil? do\n if !params[\"file#{k}\".to_sym].nil?\n attach.push()\n attach[i-1] = Messagefile.new(:file => params[\"file#{k}\".to_sym])\n attach[i-1].message = @message\n if !attach[i-1].save\n j = 1\n while j < i do\n attach[j-1].file.destroy\n attach[j-1].destroy\n j = j+1\n end\n @message.reload\n nom = params[\"file#{k}\".to_sym].original_filename\n flash.now[:danger] = \"Votre pièce jointe '#{nom}' ne respecte pas les conditions.\"\n render 'edit' and return\n end\n totalsize = totalsize + attach[i-1].file_file_size\n\n i = i+1\n end\n k = k+1\n end\n\n if totalsize > 5242880\n j = 1\n while j < i do\n attach[j-1].file.destroy\n attach[j-1].destroy\n j = j+1\n end\n @message.reload\n flash.now[:danger] = \"Vos pièces jointes font plus de 5 Mo au total (#{(totalsize.to_f/524288.0).round(3)} Mo).\"\n render 'edit' and return\n end\n\n flash[:success] = \"Votre message a bien été modifié.\"\n tot = @message.subject.messages.where(\"id <= ?\", @message.id).count\n page = [0,((tot-1)/10).floor].max + 1\n\n redirect_to subject_path(@message.subject, :anchor => @message.id, :page => page, :q => q)\n\n # Si il y a eu un bug\n else\n render 'edit'\n end\n end",
"def update\n authorize @task\n @task.updated_by = current_user\n\n files = @task.files\n files += task_params[:files] if task_params[:files]\n @task.assign_attributes(task_params)\n @task.files = files\n\n if params[:files_remove]\n\n remain_files = @task.files\n\n params[:files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @task.remove_files! if remain_files.empty?\n end\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default tasks_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remove_stale_files() = stale_files.each { |file| remove_file(file) }",
"def update\n delImageId = Array.new(0)\n updateIds = Hash.new\n\n # :delete sends hash of delete requested ids\n # ids are of ImageData(not DesignData)\n updateIds = params[:delete]\n updateImage = ImageDatum.find(updateIds.keys)\n\n # for later use\n # file name should be same in all updateImages\n # so it should be ok just to get from the 1st one\n file_name = updateImage[0].file_name\n\n # if the updateIds value of image.id == 1,\n # set the delflag(user wants to delete it)\n updateImage.each {|image|\n if updateIds[image.id.to_s] == \"1\"\n image.delflag = true\n else\n image.delflag = false\n end\n image.save!\n }\n\n # image_data上、最新のseq_idの画像を削除する場合、\n # design_dataのcurSeq_idは、削除されてないimage_dataのseq_idの\n # 一番大きいデータと同期してないといけないので、\n # その処理をする\n updateDesignData = DesignDatum.find_by_file_name(file_name)\n curSeq_id = updateDesignData.curSeq_id\n\n # updateIds に0がある場合(userが削除したくない画像がある場合)\n if updateIds.has_value?(\"0\")\n\n # 削除されなくて、seq_id が一番大きいimage_data をselect\n recoverImage = ImageDatum.find_all_by_id_and_delflag(updateIds.keys, \"0\", :order => \"seq_id DESC\", :limit => \"1\")\n\n if curSeq_id != recoverImage[0].seq_id\n # image_dataの画像と、design_dataの画像は、thumbnailなら一緒!\n updateDesignData.thumbnail = recoverImage[0].thumbnail\n updateDesignData.curSeq_id = recoverImage[0].seq_id\n end\n updateDesignData.delflag = false\n updateDesignData.save!\n else\n updateDesignData.delflag = true\n updateDesignData.save!\n end\n\n respond_to do |format|\n format.html { redirect_to :controller => 'design_data', :action => 'index' }\n format.json { head :no_content }\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @value = args[:value] if args.key?(:value)\n end",
"def reinclude_modules_in_attachments(update_schema = {})\n update_schema.reduce({}) do |memo, key_and_value|\n key, value = key_and_value\n\n case value\n when Paperclip::Attachment\n memo[key] = value.extend(Paperclip::Storage::Filesystem)\n when Hash\n memo[key] = reinclude_modules_in_attachments(value)\n when Array\n memo[key] = value.map do |value_item|\n if value_item.kind_of?(Hash) || value_item.kind_of?(Array)\n reinclude_modules_in_attachments(value_item)\n else\n value_item\n end\n end\n else\n memo[key] = value\n end\n\n memo\n end\n\n end",
"def remove_notes(remove_list)\n \n remove_list.each do |upload_id|\n upload = Upload.find(upload_id)\n if ( @document.uploads.include?(upload) )\n @document.uploads.delete(upload)\n end\n end\n end",
"def remove_notes_collection(remove_list)\n \n remove_list.each do |upload_id|\n upload = Upload.find(upload_id)\n if ( @collection.uploads.include?(upload) )\n @collection.uploads.delete(upload)\n end\n end\n end",
"def cleanup(uploaded_file, file_path)\n File.delete(file_path) if uploaded_file.is_file_upload\n\n # clean up old uploads\n cutoff = Time.now - 1.hour\n lst = UploadedFile.where(status: 'I').all\n lst.each do |u|\n u.update_attribute(:status, 'F') if u.updated_at < cutoff\n end\n end",
"def magic_update(field)\n attachment = ATTACHMENTS.find { |a| a[:key] == field.to_s }\n clean_params[field].split(\"\\n\").map(&:squish).uniq.each do |item|\n create_attachment(attachment, item)\n end\n end",
"def update\n # if params[:filename].present? \n # display_name = params[:filename] \n # else \n # display_name = \"#{@lookbook.name}-lookbook-#{@lookbook.galleries.count + 1}\"\n # end\n # @latestAttach = LookbookPhotoGallery.create(:attachment => params[:attachment], :attachable => @lookbook, :file_name => display_name) if params[:attachment]\n\n @lookbook.update ( admin_lookbook_params )\n \n respond_to do |format|\n if @lookbook.save\n if admin_lookbook_params[:status] == 'enable'\n Lookbook.where.not(id: @lookbook).update_all(status: 'disable')\n end\n\n format.html { redirect_to edit_admin_lookbook_path(@lookbook), notice: 'Successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: :back }\n format.json { render json: @lookbook.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def add_attachments\n @dialog.setSubStatusAndLogIt('Getting attachments')\n @dialog.setSubProgress(1, 5)\n u = ITEM_UTILITY.union(@items['endpoint-attach'], @items['thread-attach'])\n @dialog.logMessage(\"Finding attachments from #{u.size} items with status: endpoint-attach OR thread-attach\")\n @dialog.setSubProgress(2)\n a = ITEM_UTILITY.find_descendants(u)\n @dialog.logMessage(\"Found #{a.size} descendants\")\n @dialog.setSubProgress(3)\n d = ITEM_UTILITY.deduplicate(a)\n @dialog.logMessage(\"Adding #{d.size} deduplicated items (attachments)\")\n @dialog.setSubProgress(4)\n d.to_a\n end",
"def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end",
"def purge_blobs\n photos_attachments.each do |photo_attachment|\n if photo_attachment.marked_for_destruction?\n photo_attachment.blob.purge_later\n end\n end\n end",
"def remove_attachment_at_index(index)\n attachments = @task.attachments # copy the array\n @task.attachments = attachments.delete_at(index) # delete the target attachment\n end",
"def update_emails\n #update the attributes that gets passed\n #accessing the array the following returns an array of selected ids from the email page\n #Email.update([\"delete_flag=?\",1], :id => params[:email_ids])\n #params[:email_ids]\n #update_emails = Email.where(\"id in ?\", params[:email_ids])\n #update_emails.delete_flag = 1\n Email.update_all([\"delete_flag=?, updated_at=?\", 1, Time.now], :id => params[:email_ids])\n flash[:success] = \"#{params[:email_ids].length} Email(s) deleted from inbox!\"\n #redirect_to email_path\n redirect_to :back\n end",
"def refresh!\n updated_contents = File.read(@path)\n updated_yml = YAML.load(updated_contents)\n\n updated_items = fetch_items(updated_yml)\n original_items = items.flatten\n\n updated_items.flatten.each do |updated_item|\n original_item = original_items.find do |oi|\n oi.full_src == updated_item.full_src\n end\n\n # If this is a new item, we're good\n next if !original_item\n\n # Otherwise, we'll need to see if this file changed\n if !original_item.identical?(updated_item)\n original_item.delete!\n end\n end\n\n @items = updated_items\n\n prepare!\n end",
"def update_master_files(context)\n media_object = context[:media_object]\n files = context[:master_files] || {}\n deleted_master_files = []\n if not files.blank?\n files.each_pair do |id,master_file|\n selected_master_file = MasterFile.find(id)\n\n if selected_master_file\n if master_file[:remove]\n deleted_master_files << selected_master_file\n selected_master_file.destroy\n else\n selected_master_file.title = master_file[:title] unless master_file[:title].nil?\n selected_master_file.permalink = master_file[:permalink] unless master_file[:permalink].nil?\n selected_master_file.poster_offset = master_file[:poster_offset] unless master_file[:poster_offset].nil?\n selected_master_file.date_digitized = master_file[:date_digitized].blank? ? nil : master_file[:date_digitized] unless master_file[:date_digitized].nil?\n unless selected_master_file.save\n context[:error] ||= []\n context[:error] << \"#{selected_master_file.id}: #{selected_master_file.errors.to_a.first.gsub(/(\\d+)/) { |m| m.to_i.to_hms }}\"\n end\n end\n end\n end\n end\n deleted_master_files\n end",
"def update\n attachment = Attachment.find_by!(:slug => params[:id],\n :conversation_id => current_account.conversation_ids + [nil])\n\n if params[:task_list] and !params[:task_list][:tasks].empty?\n attachment.update_attribute(:tasks, params[:task_list][:tasks])\n end\n\n render :json => attachment\n end",
"def destroy_unsaved_attachments\n @client_side_timestamp = params[:client_side_timestamp]\n @filename = params[:filename]\n @cas_user = session[:cas_user]\n\n RecordAttachment.where(:client_side_timestamp => @client_side_timestamp, \n :filename => @filename, :cas_user_name => @cas_user).destroy_all\n render :nothing => true\n end",
"def add_attachments_to_existing_note(note, attachments)\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to note ID #{note.id}\"\n existing_note_attachment_input(note).when_present 1\n existing_note_attachment_input(note).send_keys Utils.asset_file_path(attach.file_name)\n existing_note_attachment_delete_button(note, attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.updated_date = Time.now\n note.attachments << attach\n end\n end",
"def unpersisted_attachment_fields(method, multiple)\n unpersisted_attachments(method).map.with_index do |attachment, idx|\n hidden_field method,\n mutiple: multiple ? :multiple : false, value: attachment.signed_id,\n name: \"#{object_name}[#{method}]#{'[]' if multiple}\",\n data: {\n direct_upload_id: idx,\n uploaded_file: { name: attachment.filename, size: attachment.byte_size },\n icon_container_id: \"asdndz-#{object_name}_#{method}__icon-container\"\n }\n end\n end",
"def uncompacted_update(messages)\n BatchSlicer.\n slice(messages).\n each(&method(:update_database))\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n @item.document1.destroy if params[:remove_document1] == \"1\"\n @item.document2.destroy if params[:remove_document2] == \"1\"\n @item.document3.destroy if params[:remove_document3] == \"1\"\n @item.document4.destroy if params[:remove_document4] == \"1\"\n @item.document5.destroy if params[:remove_document5] == \"1\"\n format.html {redirect_to item_path, notice: 'Item was successfully updated.'}\n format.json {render :show, status: :ok, location: @item}\n else\n format.html {render :edit}\n format.json {render json: @item.errors, status: :unprocessable_entity}\n end\n end\n end",
"def attachment_ids=(new_ids)\n super Attachment.where(:id => new_ids).where(post_id: nil).pluck(:id)\n end",
"def flush_deletes\n @queued_for_delete.each do |path|\n Paperclip.log(\"Delete: #{ path }\")\n file_id = search_for_title(path)\n google_api_client.delete_file(file_id) unless file_id.nil?\n end\n @queued_for_delete = []\n end",
"def update\n if @admin_journal_issue.asignee != params[:admin_journal_issue][:asignee]\n params[:admin_journal_issue][:notif_status] = false\n end\n if params[:admin_journal_issue][:status_id] == \"5\"\n params[:admin_journal_issue][:from] = params[:temp_from]\n end\n respond_to do |format|\n if @admin_journal_issue.update(admin_journal_issue_params)\n Admin::JournalIssue.save_attributes(@admin_journal_issue.id,params)\n #this method for sending message to admin about Journal issue who assign\n AdminMailer.delay(:queue => 'notification_create_journal_issue', :priority => 1).mail_journal_issue(@admin_journal_issue.id,@admin_journal_issue.asignee,\"main\")\n unless params[:selected].blank?\n id_params = params[:selected] \n id = convert_to_arr_for_query(id_params)\n @selected_images = Admin::JournalIssueImage.where(\"id in #{id}\")\n @selected_images.each do |image|\n loaded = Cloudinary::Uploader.destroy(\"journal_issue/images/#{image.id}\", :public_id => \"journal_issue/files/#{image.id}\", :invalidate => true)\n end\n Admin::JournalIssueImage.delete_all \"id in #{id}\"\n end\n unless params[:selected_files].blank?\n id_params = params[:selected_files] \n id = convert_to_arr_for_query(id_params)\n @selected_files = Admin::JournalIssueFile.where(\"id in #{id}\")\n @selected_files.each do |file|\n loaded = Cloudinary::Uploader.destroy(\"journal_issue/files/#{file.id}_#{file.document_file_name}\", :invalidate => true, :resource_type => :raw)\n end\n Admin::JournalIssueFile.delete_all \"id in #{id}\"\n end\n format.html { redirect_to admin_journal_issue_path(id_journal: @admin_journal_issue.journal_id), notice: 'Journal issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_journal_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @body = args[:body] if args.key?(:body)\n @create_time = args[:create_time] if args.key?(:create_time)\n @name = args[:name] if args.key?(:name)\n @permissions = args[:permissions] if args.key?(:permissions)\n @title = args[:title] if args.key?(:title)\n @trash_time = args[:trash_time] if args.key?(:trash_time)\n @trashed = args[:trashed] if args.key?(:trashed)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update_projectiles\n @projectiles.delete_if do |proj|\n proj.update\n proj.disposed?\n end\n end",
"def cleanup_derivatives\n deleted_files = []\n image_derivatives = resource.file_metadata.select { |file| (file.derivative? || file.thumbnail_file?) && file.mime_type.include?(image_mime_type) }\n image_derivatives.each do |file|\n storage_adapter.delete(id: file.id)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n end",
"def update_issue_dispositions\n (issues || []).each do |issue_attrs|\n request_issue = appeal.request_issues.find_by(id: issue_attrs[\"id\"]) if appeal\n next unless request_issue\n\n request_issue.update(disposition: issue_attrs[\"disposition\"])\n # If disposition was remanded and now is changed to another dispostion,\n # delete all remand reasons associated with the request issue\n update_remand_reasons(request_issue, issue_attrs[\"remand_reasons\"] || [])\n end\n end",
"def multi_update\n errors = false\n return_value = []\n file_infos_params = params.permit(file_infos: [:id, :review_done, :component_id]).require(:file_infos)\n file_infos_params.each do |key, file_info_entry|\n (return_value << nil) and (errors = true) and next unless file_info_entry[:id]\n file_info = FileInfo.find(file_info_entry[:id])\n (return_value << nil) and (errors = true) and next unless file_info\n if file_info.update(file_info_entry)\n return_value << file_info_entry\n else\n return_value << file_info.errors\n errors = true\n end\n end\n respond_to do |format|\n format.json { render json: return_value }\n if errors\n format.html { redirect_to :back, notice: 'Some entries have errors'}\n else\n format.html { redirect_to :back }\n end\n end\n end",
"def to_xml_updates\n exception_arrays = %w(required_attendees optional_attendees) # exceptions for the DeleteItemField element, those attributes are actually overwritten\n doc = Nokogiri::XML::Document.new\n root = doc.create_element(\"Updates\")\n self.class.elements.each do |name, field|\n value = read_attribute(name)\n # Create or update existing fields\n if changes.include?(name.to_s)\n field.to_xml_updates(value) do |field_uri_xml, element_xml|\n # Exchange does not like updating to nil, so delete those.\n if element_xml.text.present?\n set_item_field = doc.create_element(\"SetItemField\")\n set_item_field << field_uri_xml\n element_wrapper = doc.create_element(tag_name)\n element_wrapper << element_xml\n set_item_field << element_wrapper\n root << set_item_field\n elsif !exception_arrays.include?(name.to_s)\n delete_item_field = doc.create_element(\"DeleteItemField\")\n delete_item_field << field_uri_xml\n root << delete_item_field\n end\n if exception_arrays.include?(name.to_s)\n puts \"FIELD_URI_XML #{field_uri_xml.inspect}\"\n puts \"ELEMENT_XML #{element_xml.inspect}\"\n puts \"-\" * 80\n end\n end\n end\n # Delete removed phone numbers, etc\n if changes.include?(name.to_s) && value.is_a?(Array) && !exception_arrays.include?(name.to_s)\n old_values, new_values = changes[name.to_s]\n deleted_values = old_values - new_values\n field.to_xml_updates(deleted_values) do |field_uri_xml, _|\n delete_item_field = doc.create_element(\"DeleteItemField\")\n delete_item_field << field_uri_xml\n root << delete_item_field\n end\n end\n end\n root\n end",
"def remove_paperclip_attachment(table_name, *attachment_names)\n attachment_names.each do |name|\n remove_column table_name, \"#{name}_file_name\", \"#{name}_content_type\", \"#{name}_file_size\", \"#{name}_updated_at\"\n end\n end",
"def detach(attachment)\n self.attachment_ids -= [attachment.id] if attachment_ids\n self.joined_attachments -= [attachment]\n end",
"def attachments_to_remember\n return [] unless self.class.remember_attachments?\n (self.database.get(self.id)[\"_attachments\"] || {}).keys.reject do |a| \n a.match(VERSION_REGEX) || \n !(self.class.remember_attachments.map { |attachment_name_pattern|\n a.match attachment_name_pattern\n }.inject(false) {|b, sum| sum || b})\n end \n end",
"def update\n authorize @s_tool\n files = @s_tool.s_tool_files\n files += s_tool_params[:s_tool_files] if s_tool_params[:s_tool_files]\n @s_tool.assign_attributes(s_tool_params)\n @s_tool.s_tool_files = files\n\n if params[:s_tool_files_remove]\n\n remain_files = @s_tool.s_tool_files\n\n params[:s_tool_files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @s_tool.remove_s_tool_files! if remain_files.empty?\n end\n respond_to do |format|\n if @s_tool.save\n format.html { redirect_back_or_default s_tools_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @s_tool }\n else\n format.html { render :edit }\n format.json { render json: @s_tool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] unless args[:attachment_id].nil?\n @data = args[:data] unless args[:data].nil?\n @size = args[:size] unless args[:size].nil?\n end",
"def run_on_removals(paths)\n paths.each do |path|\n warn \"file #{path} removed -- it's up to you to remove it from the server if desired\"\n end\n end",
"def documentremove\n if self.documents.attached?\n document_urls = self.documents.map do |adoc| \n Rails.application.routes.url_helpers.delete_document_attachment_tbl_quality_issue_url(adoc, only_path: true)\n end \n else\n nil\n end \n end",
"def attachments\n eco_documents = self.eco_documents.reverse\n eco_documents.delete_if { |d| d.specification? }.reverse\n end",
"def update_note\n id = unsafe_params[:id].to_i\n fail \"id needs to be an Integer\" unless id.is_a?(Integer)\n\n title = unsafe_params[:title]\n fail \"title needs to be a String\" unless title.is_a?(String)\n\n content = unsafe_params[:content] || \"\"\n fail \"content needs to be a String\" unless content.is_a?(String)\n\n attachments_to_save = unsafe_params[:attachments_to_save] || []\n fail \"attachments_to_save needs to be an array\" unless attachments_to_save.is_a?(Array)\n\n attachments_to_delete = unsafe_params[:attachments_to_delete] || []\n fail \"attachments_to_delete neeeds to be an array\" unless attachments_to_delete.is_a?(Array)\n\n note = nil\n Note.transaction do\n note = Note.find_by!(id: unsafe_params[:id])\n fail '' unless note.editable_by?(@context)\n\n attachments_to_save.each do |uid|\n item = item_from_uid(uid)\n note.attachments.find_or_create_by(item: item)\n end\n\n attachments_to_delete.each do |uid|\n item = item_from_uid(uid)\n note.attachments.where(item: item).destroy_all\n end\n\n note.update!(title: title, content: content)\n end\n\n render json: {\n id: note.id,\n path: note_path(note),\n }\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n\n if params[:photo_attachment]\n @video.photo_attachment.delete if @video.photo_attachment\n Attachment.create(media: params[:photo_attachment], attachmentable: @video) \n end\n\n if params[:video_attachment]\n @video.video_attachment.delete if @video.video_attachment\n Attachment.create(media: params[:video_attachment], attachmentable: @video) \n end\n\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attachment\n logger.debug \"==== Create attachment ====\"\n frbr_model_as_string = params[:frbr][:object]\n @frbr_object = convert_id_to_model(frbr_model_as_string)\n klass = @frbr_object.class.to_s.underscore\n \n logger.debug \"Klass is #{klass}\"\n \n valid = false\n begin MediaItem.transaction \n @media_item = convert_id_to_model(params[:media_item][:id])\n \n show_params(params)\n @media_item.update_attributes(params[:media_item]) \n @media_item.updated_by = @login.login_id\n logger.debug \"** MEDIA ITEM UPDATED BY IS #{@media_item.updated_by}\"\n \n valid = @media_item.save\n \n #get the attachment type from the drop down\n type_id = params[:attachment_type][:attachment_type_id]\n logger.debug \"TYPE_ID: #{type_id}\"\n raise ArgumentError, \"Please provide an attachment type\" if type_id.blank?\n \n #now check its valid\n new_attachment_type = AttachmentType.find(type_id)\n raise ArgumentError, \"The selected attachment type of id #{type_id} is invalid\" if new_attachment_type.blank?\n logger.debug \"NEW ATT TYPE: #{new_attachment_type}\"\n \n attachment_klass = (@frbr_object.class.to_s+\"Attachment\").constantize\n frbr_class_id = \"#{@frbr_object.class.to_s.tableize.singularize}_id\"\n attachments = attachment_klass.find(:all, \n :conditions => [\"media_item_id=? and #{frbr_class_id} = ?\", \n @media_item.media_item_id, \n @frbr_object.send(frbr_class_id)]\n )\n for attach in attachments\n attach.attachment_type = new_attachment_type\n attach.save!\n end\n\n #Rescue a failed transaction\n rescue Exception => e\n logger.debug \"Transaction was invalid\"\n logger.debug \"AttachmentException: #{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n @error_message = \"The upload failed, the error was #{e.message}\"\n valid = false\n end\n\n respond_to do |format|\n if valid\n logger.debug \"Valid response\"\n flash[:attachment] = 'MediaItem was successfully updated.'\n \n #This is rather naughty... \n #See http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent for background\n #Without the option of forcing .js routing from a form tag (as opposed to remote form tag) the\n #HTML response is doing javascript manipulation of the page\n format.html do\n logger.debug \"VALID RESPONSE, HTML\"\n responds_to_parent do\n @media_items = attachments(@frbr_object)\n render :update do |page|\n \n # Hide the form and redraw the media item\n gid = generate_id(@media_item)\n page.replace_html gid, :partial => 'shared/attachments/edit_media_item',\n :locals => {:media_item => @media_item, :object => @frbr_object}\n \n page.visual_effect :highlight, gid\n \n end\n end\n end\n format.xml { head :created, :location => media_item_url(@media_item) }\n \n else\n logger.debug \"Response for invalid option\"\n flash[:attachment] = 'The file upload failed for some reason'\n format.html { \n #prepare_edit\n \n responds_to_parent do\n render :update do |page|\n page.replace_html 'uploadWidget', :partial => 'shared/attachments/upload_widget'\n page.visual_effect :shake, 'uploadWidget'\n page << \"alert('#{@error_message}');\"\n end\n end\n }\n format.xml { render :xml => @media_item.errors.to_xml }\n \n end\n end\n end",
"def unpersisted_attachments(method)\n as_relation = @object.send(method)\n if as_relation.is_a?(ActiveStorage::Attached::One) && as_relation.attachment.present? &&\n !@object.persisted?\n [as_relation.attachment]\n elsif as_relation.is_a?(ActiveStorage::Attached::Many)\n as_relation.reject(&:persisted?)\n else\n []\n end\n end",
"def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @uncommitted_file_changes = args[:uncommitted_file_changes] if args.key?(:uncommitted_file_changes)\n end",
"def attachment_update(design_review_document, user, subject_text)\n\n design_users = design_review_document.design.get_associated_users()\n to_list = []\n to_list << design_users[:designer].email if design_users[:designer]\n to_list << design_users[:peer].email if design_users[:peer]\n to_list << design_users[:pcb_input].email if design_users[:pcb_input]\n to_list += design_users[:reviewers].collect { |reviewer| reviewer.email }\n to_list.uniq!\n\n cc_list = ( Role.add_role_members(['Manager', 'PCB Input Gate']) -\n to_list).uniq\n\n subject = MailerMethods.subject_prefix(design_review_document.design) + subject_text\n\n @document = design_review_document\n @attached_by = user.name\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list\n ) \n\n end",
"def update_database(messages)\n # Find all upserted records (i.e. that have a payload) and all\n # deleted record (no payload)\n removed, upserted = messages.partition(&:tombstone?)\n\n upsert_records(upserted) if upserted.any?\n remove_records(removed) if removed.any?\n end",
"def update_attachment_data_file(attachment)\n corrected_tmp_file = repaired_file_for(attachment)\n logger.info(\"\\tAttachment #{attachment.filename} (#{attachment.id}) being updated to #{File.basename(corrected_tmp_file.path)}\")\n\n attachment.attachment_data.file = corrected_tmp_file\n attachment.attachment_data.save!\n ensure\n FileUtils.rm(corrected_tmp_file.path)\n end",
"def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end",
"def update\n @trash.updated_by = current_user.id\n \n user_auth_token = request.headers[\"X-API-TOKEN\"].presence\n if user_auth_token\n if params[:trash][:images] == true \n existing_images = TrashImage.where(trash_id: @trash.id)\n if existing_images \n existing_images.destroy_all\n end\n end\n end\n\n respond_to do |format|\n if @trash.update(trash_params) \n toggle_temp_images #unless params[:trash][:temp_id].blank?\n format.html { redirect_to @trash, notice: 'Trash was successfully updated.' }\n format.json { render :show, status: :ok, location: @trash }\n else\n format.html { render :edit }\n format.json { render json: @trash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n end",
"def cleanup_related_diffs(current_user, include_current)\n self.build.diffs.each do |other_diff|\n if (other_diff != self || include_current) && other_diff.old_image.test_key == self.old_image.test_key\n # Remove preapproval metadata\n other_diff.old_image.clear_preapproval_information(false)\n other_diff.old_image.save\n\n # Mark diff approved, so it is listed in the \"Images approved with this build\" section with the related diff that had its image was approved\n other_diff.approved = true\n other_diff.approved_by = current_user\n other_diff.save\n end\n end\n end",
"def cleanup\n Feed.processing.update_all(processing: false)\n FeedItem.processing.update_all(processing: false)\n end",
"def invalidate(files, include_attributes: nil, exclude_attributes: [])\r\n attributes_to_invalidate = ((include_attributes.nil? ? @attribute_plugins.keys : include_attributes) - exclude_attributes)\r\n files.each do |file|\r\n if @files.key?(file)\r\n attributes_to_invalidate.each do |attribute|\r\n @files[file].delete(attribute)\r\n end\r\n end\r\n end\r\n end",
"def update_files(resource)\n updated = files.select { |file| file.is_a?(Hash) }.map do |file|\n node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first.to_s }.first\n node.updated_at = Time.current\n # Uses the UploadDecorator to abstract the interface for the File Object during persistence by the storage_adapter\n file_wrapper = UploadDecorator.new(file.values.first, node.original_filename.first)\n\n # Ensure that errors for one file are logged but do not block updates for others\n begin\n storage_adapter.upload(file: file_wrapper, original_filename: file_wrapper.original_filename, resource: node)\n node.label = file.values.first.original_filename\n node.mime_type = file.values.first.content_type\n node\n rescue StandardError => error\n Valkyrie.logger.error \"#{self.class}: Failed to update the file #{file_wrapper.original_filename} for #{node.id}: #{error}\"\n # Ensure that this file is not created instead of updated\n @files.delete_if { |updated_file| updated_file.values.first.original_filename == file_wrapper.original_filename }\n nil\n end\n end\n\n updated.compact\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n if params[:project_attachments]\n params[:project_attachments].each do |a|\n # logger.debug \"New attachment: #{a}\"\n @project_attachment = @project.project_attachments.create!(attachment: a)\n end\n end\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def clear_in_database_caches!\n self.cached_attachment_text_clipped = nil\n self.cached_main_body_text = nil\n self.save!\n end",
"def update\n #debugger\n unless @listing.photos.blank? || @listing.photos.find_by_main_photo(true)\n @listing.photos[0].main_photo = true\n @listing.photos[0].save\n end\n\n if @listing.draft\n @listing.draft = false\n notice = 'Listing was successfully created.'\n else\n notice = 'Listing was successfully updated.'\n end\n\n\n if params[:delete_floor_plan]\n @listing.floor_plan.remove_file = true\n @listing.floor_plan._destroy\n @listing.floor_plan.destroy!\n @listing.floor_plan.save\n end\n\n if params[:delete_feature_sheet]\n @listing.feature_sheet.remove_file = true\n @listing.feature_sheet._destroy\n @listing.feature_sheet.destroy!\n @listing.feature_sheet.save\n end\n \n\n\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: notice }\n format.json { head :no_content }\n else\n #debugger\n format.html { \n @photos = @listing.photos\n @listing.build_floor_plan unless @listing.floor_plan.present?\n @listing.build_feature_sheet unless @listing.feature_sheet.present?\n \n\n }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def revert_unchanged_files(files = nil)\n files = (files && files.flatten) || self.files\n unless files.empty?\n @perforce.run(\"revert\", \"-a\", \"-c\", @number, *files)\n end\n end",
"def update\n @item = @collection.items.get(params[:id])\n @collection.schema.each do |field|\n if params[:item][field.to_s].blank? && !field.is_file\n @item[field.name]=nil\n elsif field.is_file\n #do nothing\n unless params[:item][field.to_s].nil?\n new_file = @file_collection.items.new()\n new_file.file =params[:item][field.to_s]\n new_file.save\n @item[field.name]='{\"project\":{\"id\": \"'+@project.id+'\"}, \"collection\":{\"id\": \"'+@file_collection.id+'\"},\"item\":{\"id\": \"'+new_file.id.to_s+'\", \"display\": \"'+new_file.original_filename+'\"}}'\n end\n else\n @item[field.name] = params[:item][field.to_s]\n end\n end\n if @item.save\n update_associated_fields(@item, @collection, @project)\n respond_to do |format|\n format.html do\n flash[:notice] = \"Item Updated Successfully!\"\n end\n #format.json { render json: @item.to_json, status: :updated}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item updated. Close window and refresh your page.</h2>\").attr(\"class\",\"message notice\"); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n else\n respond_to do |format|\n format.html do\n flash[:error] = [\"Item failed to save! Errors:\", @item.errors.full_messages].flatten.join(' ')\n end\n format.json { render json: @item.to_json, status: :error}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item failed update.</h2>\").attr(\"class\",\"message error\").scrollTop(0); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n end\n redirect_to :back\n end",
"def attachment_reference_ids_removed\n attachment_reference_ids = []\n self.class.attachable_columns.each do |column|\n attachment_reference_ids += send(\"#{column}#{ATTACHMENT_REMOVED_SUFFIX}\")\n end\n\n attachment_reference_ids\n end",
"def adjust_pending_uploads(resource)\n return unless resource.respond_to?(:pending_uploads)\n resource.pending_uploads = [] if resource.pending_uploads.blank?\n resource.pending_uploads = (resource.pending_uploads || []) - files\n end",
"def update!(**args)\n @photo_ids = args[:photo_ids] if args.key?(:photo_ids)\n end",
"def update\n old_ta_id = @submission.ta.id\n if(! params[:submission][:subm_file].nil?)\n uploader = AttachmentUploader.new\n uploader.store! params[:submission][:subm_file]\n byebug\n UploadIndividualZipFileJob.perform_later uploader.filename,@submission.assignment.id\n else\n puts \"NO FILE\"\n end\n submission_params[:ta_id] = submission_params[:ta_id].to_i\n\n if submission_params[:final_grade_override].to_i.zero?\n @submission.update(final_grade_override: nil)\n params[:submission].delete(:final_grade_override)\n end\n\n if submission_params[:comment_override].nil? || submission_params[:comment_override].empty?\n @submission.update(comment_override: nil)\n params[:submission].delete(:comment_override)\n end\n\n respond_to do |format|\n if @submission.update(submission_params)\n unless old_ta_id == @submission.ta.id\n [User.find(old_ta_id), @submission.ta].each do |ta|\n create_zip_from_batch @submission.assignment.id, ta.id\n end\n end\n format.html { redirect_to assignment_grades_path(@submission.assignment_id), notice: 'Submission was successfully updated.' }\n format.json { render :show, status: :ok, location: @submission }\n else\n format.html { render :edit }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n @user.remove_attach! if params[:post][:remove_attach] == 1\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.707795",
"0.69840896",
"0.6842216",
"0.6807516",
"0.6785506",
"0.6785506",
"0.6731242",
"0.6606257",
"0.65133536",
"0.6494262",
"0.64389175",
"0.6319224",
"0.6316524",
"0.63062274",
"0.6289922",
"0.618119",
"0.617752",
"0.6173531",
"0.61473244",
"0.6080278",
"0.6079415",
"0.60379666",
"0.60367215",
"0.60154444",
"0.5992771",
"0.5968622",
"0.5960124",
"0.5932157",
"0.59199834",
"0.5913845",
"0.5865875",
"0.58658224",
"0.5839896",
"0.5827089",
"0.581657",
"0.58094305",
"0.58057386",
"0.5800892",
"0.5793012",
"0.5774157",
"0.57111293",
"0.57049865",
"0.5696882",
"0.5696812",
"0.56939286",
"0.56865954",
"0.56625384",
"0.56541055",
"0.565069",
"0.56249034",
"0.560983",
"0.5606651",
"0.55966985",
"0.5574083",
"0.5564466",
"0.55492926",
"0.5546354",
"0.55369186",
"0.55368406",
"0.5528847",
"0.55279523",
"0.55266243",
"0.55210185",
"0.55105364",
"0.55037236",
"0.5500367",
"0.5498121",
"0.5487021",
"0.5481191",
"0.5470203",
"0.54676723",
"0.5465674",
"0.546539",
"0.5464879",
"0.54549843",
"0.54499954",
"0.5444137",
"0.54434043",
"0.5439338",
"0.54285204",
"0.5422366",
"0.5415874",
"0.5405618",
"0.5398417",
"0.5394596",
"0.53891486",
"0.53857994",
"0.5371111",
"0.5370806",
"0.53681934",
"0.5362789",
"0.5356783",
"0.5356407",
"0.53552264",
"0.53492606",
"0.53491783",
"0.53354293",
"0.53343827",
"0.53336114",
"0.53316635"
] | 0.6908596 | 2 |
Magically update multivalue field associations from textarea input To add a new field, add its entry to attachments.json, and ensure that attachment_target supports its base association type | def magic_update(field)
attachment = ATTACHMENTS.find { |a| a[:key] == field.to_s }
clean_params[field].split("\n").map(&:squish).uniq.each do |item|
create_attachment(attachment, item)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend",
"def update!(**args)\n @add_attachments = args[:add_attachments] if args.key?(:add_attachments)\n end",
"def process_attachments!\n child_documents = parsed_form.dig('dependents_application', 'child_supporting_documents')\n spouse_documents = parsed_form.dig('dependents_application', 'spouse_supporting_documents')\n # add the two arrays together but also account for nil arrays\n supporting_documents = [child_documents, spouse_documents].compact.reduce([], :|)\n if supporting_documents.present?\n files = PersistentAttachment.where(guid: supporting_documents.map { |doc| doc['confirmation_code'] })\n files.find_each { |f| f.update(saved_claim_id: id) }\n end\n end",
"def attachments\n adding_field do |f|\n view_context.render \"questions/attachment_editor\", :f => f, :question => question\n end\n end",
"def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end",
"def update_multi_fields(doc, changes)\n #Fields is expected to be in the form of [[field, content, append]]\n #Ex: [[:title, \"My New Title\"],[:people, \"Person I Forgot To List\", true]]\n changes.each do |change|\n content = change[1]\n content = join_content(doc, change[0], change[1]) if change[2]\n doc.send(change[0].to_s+get_args_for_send(change[0]),content)\n end\n return doc.save #Returns true if this all worked\n end",
"def set_AttachmentsWithData(value)\n set_input(\"AttachmentsWithData\", value)\n end",
"def add_attachments(value)\n if value.instance_of? AttachmentJson\n @attachments.push(value)\n end\n end",
"def connect_attachments(params)\n json_attachments = params['data'].try(:[], 'relationships').try(:[], 'attachments')\n return if json_attachments.blank?\n\n attachment_list = resource_list('attachment', json_attachments)\n\n attachment_list.each do |attachment|\n attachment.attachable = self\n attachment.save\n end\n end",
"def update!(**args)\n @addon_attachments = args[:addon_attachments] if args.key?(:addon_attachments)\n end",
"def add_associations_to_form\n extract_delegation_data\n for value in object_values\n association = build_association(value)\n @form.add_association(association)\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def attributes_with_association_ids\n attributes = super\n add_attachments_to_attributes(attributes)\n if attributes['body'] && attributes['content_type'] =~ %r{text/html}i\n attributes['body'] = HtmlSanitizer.dynamic_image_size(attributes['body'])\n end\n Ticket::Article.insert_urls(attributes)\n end",
"def build_existing_attachments\n attachments = Array(object.send(name))\n\n attachments.map.with_index do |attachment, index|\n if multiple?\n @builder.hidden_field(name, multiple: true, id: (tag_id + \"_#{index}\"), value: attachment.signed_id)\n else\n @builder.hidden_field(name, id: tag_id, value: attachment.signed_id)\n end\n end.join.html_safe\n end",
"def update_attachments(issue, args)\n if issue.persisted?\n delete_ids = args[:delete_attachments]\n issue.attachments.in(id: delete_ids).update_all(deleted: true)\n end\n\n return if (attachments.nil? || attachments.empty?)\n\n attachments.each do |attachment|\n if attachment[:id].blank?\n new_file = issue.attachments.build\n new_file.file = attachment[:data] # <json string>\n new_file.save!\n end\n end\n end",
"def update!(**args)\n @attachment_type_id = args[:attachment_type_id] if args.key?(:attachment_type_id)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n @field_type = args[:field_type] if args.key?(:field_type)\n @kg_property_id = args[:kg_property_id] if args.key?(:kg_property_id)\n @name_language = args[:name_language] if args.key?(:name_language)\n end",
"def update\n @valuefield = Valuefield.find(params[:id])\n\n #Components\n #Checks if the valuefield is attached to any components - if so clears them\n if(!@valuefield.components.nil?)\n @valuefield.components.clear\n end\n #Sets Data Files Components\n if(!params[:component_parent_ids].nil?)\n for id in params[:component_parent_ids]\n @valuefield.components.push(Component.find(id))\n end\n end\n\n #Products\n #Checks if the valuefield is attached to any products - if so clears them\n if(!@valuefield.products.nil?)\n @valuefield.products.clear\n end\n #Sets Data Files Products\n if(!params[:product_ids].nil?)\n for id in params[:product_ids]\n @valuefield.products.push(Product.find(id))\n end\n end\n\n #Property\n #Sets valuefield property id\n if(!params[:property_ids].nil?)\n for id in params[:property_ids]\n @valuefield.property_id = id\n end\n end\n\n if(!params[:prod_comp_id].nil?)\n prod_comp_id = Integer(params[:prod_comp_id])\n @valuefield.product = nil\n @valuefield.component = nil\n else\n prod_comp_id = nil\n end\n\n #logger.info(\"\\n\\nPROD_COMP: \" + prod_comp.inspect + \" \\n\\n\\n\")\n if(!prod_comp_id.nil?)\n if(prod_comp_id < 0) #Product id is negative to differentiate from component\n @valuefield.product = Product.find(-(prod_comp_id+1))\n product = Product.find(-(prod_comp_id+1))\n property = Property.find(Integer(params[:property_id][0]))\n @valuefield.property = property\n product.properties.push(property)\n elsif\n @valuefield.component = Component.find(prod_comp_id)\n property = Property.find(Integer(params[:property_id][0]))\n component = Component.find(prod_comp_id)\n @valuefield.property = property\n component.properties.push(property)\n end\n end\n\n if(!params[:property_id].nil?)\n @valuefield.property = Property.find(Integer(params[:property_id][0]))\n end\n\n respond_to do |format|\n if @valuefield.update_attributes(params[:valuefield])\n format.html { redirect_to @valuefield, notice: 'Valuefield was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @valuefield.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachments_to_existing_note(note, attachments)\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to note ID #{note.id}\"\n existing_note_attachment_input(note).when_present 1\n existing_note_attachment_input(note).send_keys Utils.asset_file_path(attach.file_name)\n existing_note_attachment_delete_button(note, attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.updated_date = Time.now\n note.attachments << attach\n end\n end",
"def initialize_fields(attributes, file)\n file.terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output\n file[key] = attributes[key].empty? ? [''] : attributes[key]\n end\n end",
"def update_metadata\n file_attributes = ::FileSetEditForm.model_attributes(attributes)\n actor.update_metadata(file_attributes)\n end",
"def attachments=(value)\n @attachments = Array.new\n unless value.nil? || value.empty?\n value.each do |v1|\n if v1.instance_of? AttachmentJson\n @attachments.push(v1)\n end\n end\n end\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n end",
"def new_file_attachment_attributes=(file_attachment_attributes)\n file_attachment_attributes.each do |attributes|\n file_attachments.build(attributes) unless attributes[\"attachment\"].blank?\n end\n end",
"def update_attachment\n logger.debug \"==== Create attachment ====\"\n frbr_model_as_string = params[:frbr][:object]\n @frbr_object = convert_id_to_model(frbr_model_as_string)\n klass = @frbr_object.class.to_s.underscore\n \n logger.debug \"Klass is #{klass}\"\n \n valid = false\n begin MediaItem.transaction \n @media_item = convert_id_to_model(params[:media_item][:id])\n \n show_params(params)\n @media_item.update_attributes(params[:media_item]) \n @media_item.updated_by = @login.login_id\n logger.debug \"** MEDIA ITEM UPDATED BY IS #{@media_item.updated_by}\"\n \n valid = @media_item.save\n \n #get the attachment type from the drop down\n type_id = params[:attachment_type][:attachment_type_id]\n logger.debug \"TYPE_ID: #{type_id}\"\n raise ArgumentError, \"Please provide an attachment type\" if type_id.blank?\n \n #now check its valid\n new_attachment_type = AttachmentType.find(type_id)\n raise ArgumentError, \"The selected attachment type of id #{type_id} is invalid\" if new_attachment_type.blank?\n logger.debug \"NEW ATT TYPE: #{new_attachment_type}\"\n \n attachment_klass = (@frbr_object.class.to_s+\"Attachment\").constantize\n frbr_class_id = \"#{@frbr_object.class.to_s.tableize.singularize}_id\"\n attachments = attachment_klass.find(:all, \n :conditions => [\"media_item_id=? and #{frbr_class_id} = ?\", \n @media_item.media_item_id, \n @frbr_object.send(frbr_class_id)]\n )\n for attach in attachments\n attach.attachment_type = new_attachment_type\n attach.save!\n end\n\n #Rescue a failed transaction\n rescue Exception => e\n logger.debug \"Transaction was invalid\"\n logger.debug \"AttachmentException: #{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n @error_message = \"The upload failed, the error was #{e.message}\"\n valid = false\n end\n\n respond_to do |format|\n if valid\n logger.debug \"Valid response\"\n flash[:attachment] = 'MediaItem was successfully updated.'\n \n #This is rather naughty... \n #See http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent for background\n #Without the option of forcing .js routing from a form tag (as opposed to remote form tag) the\n #HTML response is doing javascript manipulation of the page\n format.html do\n logger.debug \"VALID RESPONSE, HTML\"\n responds_to_parent do\n @media_items = attachments(@frbr_object)\n render :update do |page|\n \n # Hide the form and redraw the media item\n gid = generate_id(@media_item)\n page.replace_html gid, :partial => 'shared/attachments/edit_media_item',\n :locals => {:media_item => @media_item, :object => @frbr_object}\n \n page.visual_effect :highlight, gid\n \n end\n end\n end\n format.xml { head :created, :location => media_item_url(@media_item) }\n \n else\n logger.debug \"Response for invalid option\"\n flash[:attachment] = 'The file upload failed for some reason'\n format.html { \n #prepare_edit\n \n responds_to_parent do\n render :update do |page|\n page.replace_html 'uploadWidget', :partial => 'shared/attachments/upload_widget'\n page.visual_effect :shake, 'uploadWidget'\n page << \"alert('#{@error_message}');\"\n end\n end\n }\n format.xml { render :xml => @media_item.errors.to_xml }\n \n end\n end\n end",
"def add_fields(fields, inline, embed = Discordrb::Webhooks::Embed.new)\n if fields.respond_to?(:each)\n fields.each do |field|\n embed.add_field(:name => field[:name].to_s, :value => field[:value].to_s, :inline => !inline.nil?)\n end\n embed\n else false end\n end",
"def show_update_attachment_form\n show_params(params)\n get_frbr_object_from_id\n logger.debug \"+++++ UPDATE ATTACHMENT +++++\"\n @media_item = MediaItem.find(params[:media_item_id])\n get_attachment_types(@frbr_object)\n @mode = params[:mode]\n #we need the attachment type\n \n attachment_klass = (@frbr_object.class.to_s+\"Attachment\").constantize\n frbr_class_id = \"#{@frbr_object.class.to_s.tableize.singularize}_id\"\n attachments = attachment_klass.find(:all, \n :conditions => [\"media_item_id=? and #{frbr_class_id} = ?\", \n @media_item.media_item_id, \n @frbr_object.send(frbr_class_id)]\n )\n \n #There should be one\n @attachment_type = attachments[0].attachment_type\n \n logger.debug \"ATTACHMENTS ARE:#{attachments} of len #{attachments.length}\"\n logger.debug \"ATT TYPE:#{@attachment_type.attachment_type_desc}\"\n \n \n \n render :partial => 'shared/attachments/attachment_form',\n :locals => {:object => @frbr_object, :submission => :update, :media_item => @media_item, :mode => @mode}\n end",
"def create\n\n\n @text = Text.new(params[:text])\n @text.resource_id = @resource.id\n @text.save\n\n @resource.attachment = @text\n @resource.save\n \n respond_to do |format|\n if @text.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.html { redirect_to edit_course_path(@course), notice: 'Text was successfully updated.' }\n format.js\n end\n end \n end",
"def update_attachment_paths(item, text_attr)\n attachment_url_regex = %r{!/pro/nodes/(\\d+)/attachments/(.+)!}\n\n return false unless attachment_url_regex =~ item.send(text_attr)\n\n project_id = item.try(:project).try(:id) || item.node.project.id\n new_text = item.send(text_attr).gsub(attachment_url_regex) do |_|\n '!/pro/projects/%d/nodes/%d/attachments/%s!' % [project_id, $1, $2]\n end\n\n item.update_column(text_attr, new_text)\n\n true\nend",
"def merge_details_replace_field(target, victim, selections, values)\n selections.each do |path_fix|\n subrec_name = path_fix[0]\n # this is the index of the order the user arranged the subrecs in the form, not the order of the subrecords in the DB.\n ind = path_fix[1]\n field = path_fix[2]\n position = path_fix[3]\n\n subrec_index = find_subrec_index_in_victim(victim, subrec_name, position)\n\n target[subrec_name][ind][field] = victim[subrec_name][subrec_index][field]\n end\n end",
"def nested_field_set(f, assoc, options = {})\n wrapper_partial = \"shared/nested_fields_wrapper\"\n options[:inner_partial] ||= \"#{f.object.class.model_name.route_key}/#{assoc.to_s.singularize}_fields\"\n options[:multiple] = true unless options.has_key?(:multiple)\n\n wrapper_classes = [\"nested-fields\"]\n wrapper_classes << \"no-label\" if options[:label] == false\n wrapper_classes << \"multiple\" if options[:multiple]\n\n f.input(assoc, options.slice(:required)) do\n content_tag(:div, class: \"nested-field-set\") do\n f.simple_fields_for(assoc, wrapper: :nested_fields) do |f2|\n render(wrapper_partial, f: f2, options: options, classes: wrapper_classes)\n end <<\n if options[:multiple]\n content_tag(:span) do\n link_to_add_association(t(\"cocoon.add_links.#{assoc}\"), f, assoc,\n partial: wrapper_partial,\n render_options: {\n wrapper: :nested_fields, # Simple form wrapper\n locals: {options: options, classes: wrapper_classes}\n }\n )\n end\n end\n end\n end\n end",
"def attributes_with_association_names\n attributes = super\n add_attachments_to_attributes(attributes)\n Ticket::Article.insert_urls(attributes)\n end",
"def add_attachments_to_new_note(note, attachments)\n show_adv_note_options\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to an unsaved note\"\n new_note_attach_input_element.send_keys Utils.asset_file_path(attach.file_name)\n new_note_attachment_delete_button(attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.attachments << attach\n end\n end",
"def update_attachable(a_id, c_id, a_params)\n logger.debug(\"updating attachments\")\n print \"updating attachments\\n\"\n status = true\n sd_list = Document.where(attachable_id: c_id)\n se_list = Embed.where(attachable_id: c_id)\n a_list = sd_list + se_list\n\n # Sort original list\n a_list.sort! { |x,y| x.display_index <=> y.display_index }\n\n # Find and update the appropriate attribute\n a_idx = a_list.index{ |x| x.id == a_id.to_i }\n a_list[a_idx].assign_attributes(a_params)\n nd_idx = a_list[a_idx].display_index\n\n # Edge case resolving because of the way ruby sorts\n if nd_idx > a_idx\n a_list[a_idx].display_index = a_list[a_idx].display_index + 1\n else\n a_list[a_idx].display_index = a_list[a_idx].display_index - 1\n end\n \n # ReSort the list so that the updated indexes are correct\n a_list.sort! { |x,y| x.display_index <=> y.display_index }\n\n # Re-Update the indices ( With large offset )\n a_list.each_with_index {|x, index| x.display_index = a_list.length + index}\n if a_list.any?{|a| a.display_index < a_list.length}\n throw Error.new(\"This is bad\")\n end\n\n # Split the list and rewite without collision\n begin\n d_list = a_list.find_all { |x| x.class == Document }\n d_list.each(&:save!)\n\n e_list = a_list.find_all { |x| x.class == Embed }\n e_list.each(&:save!)\n rescue Exception => eek\n print(eek)\n status and false\n end\n\n # Remove the offset from the indexes\n a_list.each_with_index {|x, index| x.display_index = index}\n\n # Split the list and rewite final version\n begin\n d_list = a_list.find_all { |x| x.class == Document }\n d_list.each(&:save!)\n\n e_list = a_list.find_all { |x| x.class == Embed }\n e_list.each(&:save!)\n rescue Exception => eek\n print(eek)\n status and false\n end\n\n return status\n end",
"def reinclude_modules_in_attachments(update_schema = {})\n update_schema.reduce({}) do |memo, key_and_value|\n key, value = key_and_value\n\n case value\n when Paperclip::Attachment\n memo[key] = value.extend(Paperclip::Storage::Filesystem)\n when Hash\n memo[key] = reinclude_modules_in_attachments(value)\n when Array\n memo[key] = value.map do |value_item|\n if value_item.kind_of?(Hash) || value_item.kind_of?(Array)\n reinclude_modules_in_attachments(value_item)\n else\n value_item\n end\n end\n else\n memo[key] = value\n end\n\n memo\n end\n\n end",
"def update!(**args)\n @attachment_name = args[:attachment_name] if args.key?(:attachment_name)\n @namespaced_type = args[:namespaced_type] if args.key?(:namespaced_type)\n @data = args[:data] if args.key?(:data)\n end",
"def create\n\n @link = Link.new(params[:link])\n @link.resource_id = @resource.id\n \n if !@link.link.include? \"http://\"\n @link.link = \"http://\" + @link.link\n end\n\n\n @resource.attachment = @link\n @resource.save\n\n @link.save\n\n\n\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end",
"def attachments=(value)\n @attachments = value\n end",
"def attachments=(value)\n @attachments = value\n end",
"def attachments=(value)\n @attachments = value\n end",
"def update_conversation_custom_fields(id, fields)\n data = { fields: fields }\n put(\"conversations/#{id}/fields\", { body: data })\n end",
"def attachment_fields_hash\n @attachment_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_attachment_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end",
"def attachment_form(model)\n s = \"<div id=\\\"files\\\" class=\\\"files\\\">\\n <ul>\\n \"\n model.attachments.each do |attachment|\n s << \"<li><a href=\\\"#{attachment.public_path}\\\">#{attachment.name}</a> (#{a('delete', rs(:delete_attachment, model.name, attachment.name))})</li>\\n\"\n end\n s << \"</ul>\\n</div>\\n\\n\"\n\n s << <<EOF\n<script type=\"text/javascript\">\n // The number of created attachments.\n var created_attachments = 0;\n // The number of existing attachments.\n var existing_attachments = 0;\n\n function add_attachment_field_to(element) {\n // The attachment id we'll be creating;\n var id = created_attachments++;\n existing_attachments++;\n\n // The paragraph which contains our file entry line.\n var p = document.createElement('p');\n\n // Label.\n var label = document.createElement('label');\n label.setAttribute('for', 'attachments_' + id);\n label.appendChild(document.createTextNode('Attach:'));\n p.appendChild(label);\n\n // File field.\n field = document.createElement('input');\n field.setAttribute('id', 'attachments_' + id);\n field.setAttribute('name', 'attachments[' + id + ']');\n field.setAttribute('size', '30');\n field.setAttribute('type', 'file');\n field.setAttribute('onchange', 'attachment_field_changed(this);');\n p.appendChild(field);\n\n // Remove button\n remove = document.createElement('input');\n remove.setAttribute('type', 'button');\n remove.setAttribute('value', 'Clear');\n remove.setAttribute('onclick', 'clear_attachment_field(this.previousSibling);');\n p.appendChild(remove);\n\n // Add paragraph to element.\n element.appendChild(p);\n }\n\n function attachment_field_changed(field) {\n if (field.value.length == 0) {\n remove_attachment_field(field);\n }\n if (field.value.length > 0) {\n add_attachment_field_to(field.parentNode.parentNode);\n }\n }\n\n function clear_attachment_field(field) {\n field.value = '';\n attachment_field_changed(field);\n }\n\n function remove_attachment_field(field) {\n if (existing_attachments > 1) {\n field.parentNode.parentNode.removeChild(field.parentNode);\n existing_attachments--;\n }\n }\n\n // Add the first attachment field.\n add_attachment_field_to(document.getElementById('files'));\n</script>\nEOF\n end",
"def UpdateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @value = args[:value] if args.key?(:value)\n end",
"def update\n field_id = params[:id].to_s.split(/_/).last.to_i\n @field = Field.find(field_id)\n new_screen_id = params[:field].delete(:new_screen_id)\n\n if params[:save_as_new_copy] =~ /true/i && new_screen_id != params[:field][:screen_id]\n params[:field][:screen_id] = new_screen_id\n params[:field][:field_id] = nil\n\n case @field\n when Fields::Data\n params[:field][:custom_field_id] = @field.custom_field_id\n params[:field][:value].delete(:related_from)\n params[:field][:value].delete(:related_to)\n when Fields::Accumulation,\n Fields::CodeCombindedReferenceAttribute\n params[:field][:value].delete(:field_id)\n when Fields::Formula\n params[:field][:value][:formula] = {:fnc => 'CNS', :var_1 => '0'}\n when Fields::Comparison\n params[:field][:value][:comparison].delete(:field_id)\n when Fields::DetailInfo\n params[:field][:value].delete(:dependency_screen_id)\n params[:field][:value].delete(:detail_screen_field_ids)\n when Fields::HeaderInfo\n params[:field][:value].delete(:source_field_id)\n when Fields::ReferenceAttribute\n params[:field][:value].delete(:reference_field_id)\n params[:field][:value].delete(:source_field_id)\n end\n \n redirect_to :action => :create,\n :id => params[:id],\n :field => params[:field],\n :save_as_new_copy => params[:save_as_new_copy]\n else\n @screen_self = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n\n @field.update_attributes(params[:field])\n\n respond_to do |format|\n format.html # update.html.erb\n format.xml { render :xml => @field }\n end\n end\n end",
"def attachment=(params)\n super params\n import_attachment if persisted? && attachment.try(:valid?)\n end",
"def populate(attributes)\n attributes.each do |attribute, value|\n id = id_for(attribute)\n\n case control_type_for(id)\n when :file\n attach_file id, value\n when :select\n find_by_id(id).find(\"option[value='#{value}']\").select_option\n when :checkbox\n find_by_id(id).set(value)\n else\n fill_in id, :with => value\n end\n end\n end",
"def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend",
"def update\n respond_to do |format|\n if @resource_type.update_attributes(params[:resource_type])\n if params[:fields]\n params[:fields].each do |param|\n if param[:id]\n @field = Field.find(param[:id])\n @field.update_attributes(\n :name => param[:name], \n :field_type_id => param[:field_type_id],\n :resource_type_id => params[:id],\n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n else\n @field = Field.create(\n :name => param[:name],\n :field_type_id => param[:field_type_id],\n :resource_type_id => params[:id],\n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n end\n if @field.field_validations.any?\n @field.field_validations.each { |v| v.destroy }\n end\n if param[:validator_ids]\n param[:validator_ids].each do |index|\n next if index == \"multiselect-all\"\n @field.field_validations.build(validator_id: index.to_i)\n end\n end \n @field.save\n end\n end \n format.html { redirect_to @resource_type, notice: 'Resource type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link_to_add_fields(name,f,association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association,new_object, :child_index=>\"new_#{association}\") do |builder|\n render(association.to_s.pluralize+\"/\"+association.to_s.singularize + \"_fields\", :f => builder)\n end\n ui_link_to_function('add',name,\"add_fields(this,\\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name,f,association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association,new_object, :child_index=>\"new_#{association}\") do |builder|\n render(association.to_s.pluralize+\"/\"+association.to_s.singularize + \"_fields\", :f => builder)\n end\n ui_link_to_function('add',name,\"add_fields(this,\\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @attachments = args[:attachments] if args.key?(:attachments)\n @contextual_add_on_markup = args[:contextual_add_on_markup] if args.key?(:contextual_add_on_markup)\n @gsuite_integration_metadata = args[:gsuite_integration_metadata] if args.key?(:gsuite_integration_metadata)\n @text = args[:text] if args.key?(:text)\n @user_id = args[:user_id] if args.key?(:user_id)\n end",
"def update_field_records(fsa, fieldset_child, value)\n # make sure the value is a string in case the input from the form is bad\n throw \"Form value type mismatch error: The value from the form must be String for #{self.inspect}.\" unless value.is_a?(String)\n\n # retrieve record\n field_record = DynamicFieldsets::FieldRecord.where(:fieldset_associator_id => fsa.id, :fieldset_child_id => fieldset_child.id).first\n if field_record.nil? \n # create record\n DynamicFieldsets::FieldRecord.create!(\n :fieldset_associator_id => fsa.id, \n :fieldset_child_id => fieldset_child.id, \n :value => value)\n else \n # update record\n field_record.value = value \n field_record.save\n end\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-success btn-block\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @client_name_space = args[:client_name_space] if args.key?(:client_name_space)\n @comment = args[:comment] if args.key?(:comment)\n @messages = args[:messages] if args.key?(:messages)\n @type_id = args[:type_id] if args.key?(:type_id)\n end",
"def update!(**args)\n @corrected_key_text = args[:corrected_key_text] if args.key?(:corrected_key_text)\n @corrected_value_text = args[:corrected_value_text] if args.key?(:corrected_value_text)\n @field_name = args[:field_name] if args.key?(:field_name)\n @field_value = args[:field_value] if args.key?(:field_value)\n @name_detected_languages = args[:name_detected_languages] if args.key?(:name_detected_languages)\n @provenance = args[:provenance] if args.key?(:provenance)\n @value_detected_languages = args[:value_detected_languages] if args.key?(:value_detected_languages)\n @value_type = args[:value_type] if args.key?(:value_type)\n end",
"def link_to_add_fields(name, f, association, additional_params={})\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n data = {id: id, fields: fields.gsub(\"\\n\", \"\")}\n data[:insertion_point] = additional_params[:insertion_point] unless additional_params[:insertion_point].nil?\n link_to(name, '#', class: \"add_fields \" + (additional_params[:class].nil? ? \"\" : additional_params[:class]), data: data)\n end",
"def link_to_add_associations(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def field_value=(value)\r\n if value.is_a?(Array)\r\n value.collect! do |item|\r\n if item.respond_to?(:reload) && (item.respond_to?(:new_record?) && !item.new_record?)\r\n item.reload\r\n else\r\n item\r\n end\r\n end\r\n elsif value.respond_to?(:reload) && (value.respond_to?(:new_record?) && !value.new_record?)\r\n value.reload\r\n end\r\n self.write_attribute(:field_value, value)\r\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render('shared/' + association.to_s.singularize + '_fields', f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def set_Related(value)\n set_input(\"Related\", value)\n end",
"def update\n set_field\n # byebug\n if @field.update(fields_params)\n render :json => {}\n else\n render :json => @subject.errors, status: :unprocessable_entity\n end\n end",
"def update_eob_fields\n if self.manual && self.eob_details.blank?\n self.eob_details.new(:dos => self.dos, :charge_amount => self.charge_amount, :payment_amount => self.payment_amount, :created_user => self.created_user)\n end\n end",
"def attachments=(attachments)\n attachments.each do |attachment|\n assets.build(attachment)\n end\n end",
"def add_attachments\n frm.button(:value=>/(Add|Add \\/ Remove) Attachments/).click\n AssignmentsAttachments.new(@browser)\n end",
"def init_custom_fields\n @image = ''\n @subtype_id = 1\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: { id: id, fields: fields.gsub(\"\\n\", \"\") })\n end",
"def add_to_multivalued_field( data, target, splitter )\n \n if data != nil\n data.split( splitter ).each do |entry|\n target.push( entry )\n end\n end\n \nend",
"def save_attachments attachments\n Attachment.add(attachments, self)\n end",
"def update_fields! message\n message.nested_messages.each(&method(:update_fields!))\n non_primitives = message.fields.reject { |f| f.type_name.empty? }\n non_primitives.each do |f|\n f.message ||= cached_message f.type_name\n f.enum ||= cached_enum f.type_name\n end\n end",
"def link_to_add_fields(name, f, association, divname, count_range, max_len, add_class)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\", \\\"#{divname}\\\", \\\"#{count_range}\\\")\", :class => \"add_fields \"+ add_class, 'data-max_len'=> max_len )\n\n end",
"def update_answer_type_params\n scalar_params = [].tap do |result|\n result.push(:answer_text) # Text response answer\n result.push(attachments_params) # User uploaded files\n end\n # Parameters that must be an array of permitted values\n array_params = {}.tap do |result|\n result[:option_ids] = [] # MRQ answer\n result[:files_attributes] = [:id, :_destroy, :filename, :content] # Programming answer\n # Forum Post Response answer\n forum_post_attributes = [:id, :text, :creatorId, :updatedAt]\n result[:selected_post_packs] = [corePost: forum_post_attributes, parentPost: forum_post_attributes, topic: [:id]]\n end\n scalar_params.push(array_params)\n end",
"def existing_note_attachment_input(note)\n text_area_element(xpath: \"//div[@id='note-#{note.id}-attachment-dropzone']/input\")\n end",
"def link_to_add_fields(name, f, association, params={})\n\t\tnew_object = f.object.class.reflect_on_association(association).klass.new\n\t\tfields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n\t\t\t#merge the params hash with the form builder being sent as a local variable to the partial\n\t \t\trender(association.to_s.singularize + \"_fields\", {:f => builder}.merge(params))\n\t\tend\n\t\tlink_to_function(name, \"add_fields(this, '#{association}', '#{escape_javascript(fields)}')\")\n\tend",
"def link_to_add_fields(name, f, association, params={})\n\t\tnew_object = f.object.class.reflect_on_association(association).klass.new\n\t\tfields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n\t\t\t#merge the params hash with the form builder being sent as a local variable to the partial\n\t \t\trender(association.to_s.singularize + \"_fields\", {:f => builder}.merge(params))\n\t\tend\n\t\tlink_to_function(name, \"add_fields(this, '#{association}', '#{escape_javascript(fields)}')\")\n\tend",
"def add(attributes)\n slug = attributes['slug']\n\n attributes.delete('entries_custom_fields').each do |_attributes|\n _attributes = _attributes.delete_if { |k, v| v.blank? || %w(id updated_at created_at).include?(k) }\n\n # TODO: select options\n\n (attributes['fields'] ||= []) << _attributes\n end\n\n unless self.items.key?(slug)\n self.items[slug] = Locomotive::Mounter::Models::ContentType.new(attributes)\n end\n\n self.items[slug]\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_partial\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def attachments=(atts)\n atts.each do |attachment|\n if attachment[:id].blank?\n assets.build(attachment)\n else\n asset = assets.detect { |a| a.id == attachment[:id].to_i }\n end\n end \n end",
"def attachments=(atts)\n atts.each do |attachment|\n if attachment[:id].blank?\n assets.build(attachment)\n else\n asset = assets.detect { |a| a.id == attachment[:id].to_i }\n end\n end \n end",
"def attachments=(atts)\n atts.each do |attachment|\n if attachment[:id].blank?\n assets.build(attachment)\n else\n asset = assets.detect { |a| a.id == attachment[:id].to_i }\n end\n end \n end",
"def update\n\n @content_relation_type = @project.content_relation_types.where(:intern => params[:crt]).first if params[:crt]\n\n respond_to do |format|\n if @content.update(permitted_params.content)\n\n\n @content.user = nil\n @content.save\n\n if params[:content_elements][:add]\n params[:content_elements][:add].each do |content_element_type, value|\n begin\n @content.content_elements.build(:content_element_type_id => content_element_type, :language => locale, :value => value).save\n rescue\n flash[:error] = t('fehler.ascii')\n @content.content_elements.build(:content_element_type_id => content_element_type, :language => locale, :value => cleanup(value)).save\n end\n end\n end\n\n\n if params[:content_elements][:update]\n params[:content_elements][:update].each do |content_element_id, value|\n ce = @content.content_elements.where('content_elements.id = ?', content_element_id).first\n\n begin\n ce.value = value\n ce.save\n rescue\n flash[:error] = t('fehler.ascii')\n ce.value = cleanup(value)\n ce.save\n end\n end\n end\n\n\n @content.ctbs.each do |ctb|\n if params[:link]\n ctb.link = (params[:link] == ctb.branch_id.to_s) ? true : false\n end\n\n if params[:caption]\n ctb.caption = (params[:caption][ctb.branch_id.to_s]) ? params[:caption][ctb.branch_id.to_s] : ''\n end\n\n ctb.save\n end\n\n\n @content.proof_bracketcommands\n @content.setFileNames\n\n format.html { redirect_to project_content_type_content_path(@project, @content_type, @content, :locale => @locale), notice: 'Content was successfully updated.' }\n format.js {}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.js {}\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_from_relation(field_name, related = Ladder::Config.settings[:with_relations])\n objects = send(field_name).to_a\n\n if related || embedded_relations[field_name]\n # Force autosave of related documents to ensure correct serialization\n methods.select { |i| i[/autosave_documents/] }.each { |m| send m }\n\n # update inverse relation properties\n relation = relations[field_name]\n objects.each { |object| object.resource.set_value(relation.inverse, rdf_subject) } if relation.inverse\n objects.map(&:update_resource)\n else\n # remove inverse relation properties\n objects.each { |object| resource.delete [object.rdf_subject] }\n objects.map(&:rdf_subject)\n end\n end",
"def update\n #Finds selected data file\n @image = Image.find(params[:id])\n\n #Components\n #Checks if the data file is attached to any components - if so clears them\n if(!@image.components.nil?)\n @image.components.clear\n end\n #Sets Data Files Components\n if(!params[:component_parent_ids].nil?)\n for id in params[:component_parent_ids]\n @image.components.push(Component.find(id))\n end\n end\n\n #Products\n #Checks if the data file is attached to any products - if so clears them\n if(!@image.products.nil?)\n @image.products.clear\n end\n #Sets Data Files Products\n if(!params[:product_ids].nil?)\n for id in params[:product_ids]\n @image.products.push(Product.find(id))\n end\n end\n\n #Valuefields\n #Checks if the data file is attached to any valuefields - if so clears them\n if(!@image.valuefields.nil?)\n @image.valuefields.clear\n end\n #Sets Data Files Valuefields\n if(!params[:valuefield_ids].nil?)\n for id in params[:valuefield_ids]\n @image.valuefields.push(Valuefield.find(id))\n end\n end\n #creates an array of products\n @all_products = Product.all\n #creates an array of components\n @all_components = Component.all\n #creates an array of valuefields\n @all_valuefields = Valuefield.all\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def faq_ref_params\n params.require(:faq).permit({reference: [:id, :youtube_url, :web_url, :image => []]})\n end",
"def fields=(attrib_array)\n\n touch()\n @custom_fields = true\n @fields = attrib_array.map { |field| \n (field.is_a?(Hash))? field : field.to_s \n }\n # Delegate fields to fieldsets first\n @fieldsets.each_pair { |name,fieldset|\n fieldset_fields = []\n @fields.delete_if { |field|\n (fieldset.has_field?(field))? (fieldset_fields << field.to_s; true) : false\n }\n fieldset.fields = fieldset_fields\n }\n attrib_array.each { |attrib|\n if attrib.is_a?(Hash) then\n attrib.each_pair { |fieldset_name, fieldset_fields|\n legend = false\n if fieldset_fields.is_a?(Hash) then\n legend = fieldset_fields[:legend]\n fieldset_fields = fieldset_fields[:fields]\n end\n # This is a configuration for a fieldset. \n # There are two cases: \n fieldset = @fieldsets[fieldset_name.to_s]\n if fieldset then \n # - The fieldset already has been added to this form. \n # In this case, just pass field settings along to \n # the fieldset. \n fieldset.fields = fieldset_fields\n else\n # - There is no fieldset with given name in this form. \n # In this case, we expect that at least the given \n # form fields are present in this form, and we \n # implicitly create a Fieldset instance here. \n fieldset = Fieldset.new(:name => fieldset_name, :legend => legend)\n fieldset_fields.each { |field|\n existing_field = @element_map[field.to_s]\n fieldset.add(existing_field) if existing_field\n }\n fieldset.fields = fieldset_fields\n add(fieldset)\n end\n }\n end\n }\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n # Update element map only if referenced element is a \n # Form_Field, do not include Fieldset elements. \n @element_map[field.name.to_s] = field \n elsif field.is_a?(Fieldset) then\n end\n }\n end",
"def set_RelatedWords(value)\n set_input(\"RelatedWords\", value)\n end",
"def update!(**args)\n @auto_complete = args[:auto_complete] if args.key?(:auto_complete)\n @auto_complete_callback = args[:auto_complete_callback] if args.key?(:auto_complete_callback)\n @auto_complete_multiple_selections = args[:auto_complete_multiple_selections] if args.key?(:auto_complete_multiple_selections)\n @hint_text = args[:hint_text] if args.key?(:hint_text)\n @label = args[:label] if args.key?(:label)\n @max_lines = args[:max_lines] if args.key?(:max_lines)\n @name = args[:name] if args.key?(:name)\n @on_change = args[:on_change] if args.key?(:on_change)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"def process_attachments(text, attachments)\n attachment_regexp = /\\[attachment=([\\d])+\\]<!-- [\\w]+ -->([^<]+)<!-- [\\w]+ -->\\[\\/attachment\\]?/i\n unreferenced_attachments = attachments.dup\n\n text = text.gsub(attachment_regexp) do\n index = $1.to_i\n real_filename = $2\n unreferenced_attachments[index] = nil\n attachments.fetch(index, real_filename)\n end\n\n unreferenced_attachments = unreferenced_attachments.compact\n text << \"\\n\" << unreferenced_attachments.join(\"\\n\") unless unreferenced_attachments.empty?\n text\n end",
"def upsert_field_values!(listing, custom_field_params)\n custom_field_params ||= {}\n\n # Delete all existing\n custom_field_value_ids = listing.custom_field_values.map(&:id)\n CustomFieldOptionSelection.where(custom_field_value_id: custom_field_value_ids).delete_all\n CustomFieldValue.where(id: custom_field_value_ids).delete_all\n\n field_values = custom_field_params.map do |custom_field_id, answer_value|\n custom_field_value_factory(listing.id, custom_field_id, answer_value) unless is_answer_value_blank(answer_value)\n end.compact\n\n # Insert new custom fields in a single transaction\n CustomFieldValue.transaction do\n field_values.each(&:save!)\n end\n end",
"def update\n @screen = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n\n @label = Label.find(params[:id])\n\n @label.update_attributes(params[:label])\n \n if @label.errors.empty?\n @captions = params[:captions]\n @captions.each do |language_id, caption_name|\n caption = Caption.find(:first ,\n :conditions => {\n :captions => { :label_id => @label.id , :language_id => language_id }\n }\n )\n caption.update_attributes(\n :name => caption_name\n )\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n params[:event_attachments]['image'].each do |a|\n @event_attachment = @event.event_attachments.create!(:image => a, :event_id => @event.id)\n end\n format.html { redirect_to edit_event_path(@event), notice: 'event was successfully edited.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def update_for=(list)\n build_package_association_assignment(:update_for_items,list)\n end",
"def assign_nested_attributes_for_collection_association association_name, attributes_collection\n return if attributes_collection.nil?\n\n associate_existing_records(association_name, attributes_collection)\n\n super\n end"
] | [
"0.5902316",
"0.5628702",
"0.5626617",
"0.5597691",
"0.5563786",
"0.5543971",
"0.5534968",
"0.54784775",
"0.54414",
"0.5433138",
"0.5420685",
"0.5413567",
"0.5413567",
"0.53953",
"0.5328849",
"0.5213273",
"0.5212476",
"0.51692575",
"0.5123383",
"0.512225",
"0.51111287",
"0.5095082",
"0.50936675",
"0.5088135",
"0.50841177",
"0.5067275",
"0.5060595",
"0.50544053",
"0.504698",
"0.5041536",
"0.5018912",
"0.49920964",
"0.49792883",
"0.49676698",
"0.49667802",
"0.49648216",
"0.4959204",
"0.49587595",
"0.49587595",
"0.49587595",
"0.49445722",
"0.4933351",
"0.49134743",
"0.49099442",
"0.49078715",
"0.4892885",
"0.48881254",
"0.48845688",
"0.48712483",
"0.48640382",
"0.4856866",
"0.4856866",
"0.48346838",
"0.48280352",
"0.4827372",
"0.48257118",
"0.48209268",
"0.48123938",
"0.48113608",
"0.48063263",
"0.48050824",
"0.48039576",
"0.48039576",
"0.48039576",
"0.48039576",
"0.48039576",
"0.48039576",
"0.48039576",
"0.48010325",
"0.47992802",
"0.4795661",
"0.47876766",
"0.4786102",
"0.47787935",
"0.4777666",
"0.4777075",
"0.4776364",
"0.4772259",
"0.4772053",
"0.47687337",
"0.47658503",
"0.47658503",
"0.4758187",
"0.47581843",
"0.4754569",
"0.4754569",
"0.4754569",
"0.4752069",
"0.47438696",
"0.47437066",
"0.4734113",
"0.47297686",
"0.47260103",
"0.47196025",
"0.4711919",
"0.4699514",
"0.4695776",
"0.46952522",
"0.46904504",
"0.46888664"
] | 0.55792487 | 4 |
brackets at SET for single value | def update()
sql = "UPDATE countries
SET
name
=
$1
WHERE id = $2"
values = [@name, @id]
SqlRunner.run(sql, values)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(index, val)\n \n end",
"def []=(string, value); end",
"def []=(string, value); end",
"def set(value)\n execute_only(:set, value)\n end",
"def set(object, value); end",
"def set=(_arg0); end",
"def value=(val); end",
"def value=(_); end",
"def set(item, value)\n run(\"#{ item } #{ value }\")\n end",
"def aset(index, value)\n end",
"def set(value)\n execute(:set, value)\n end",
"def value=(v)\n set(v)\n end",
"def set; end",
"def set; end",
"def []= name, value\n set_all name => value\n end",
"def [](val)\n if val.is_a?(::String) && __single_quote_strings\n _set(\"['#{val}']\")\n else\n _set(\"[#{val.inspect}]\")\n end\n end",
"def set(name,value)\n foundit = false\n @wrapped.map! do |item|\n /^([\\w]*)=(.*)$/ =~ item\n #puts \"#{name} 1=#{$1} and 2=#{$2}\"\n if ($1 == name)\n #puts \"updating #{$1}\"\n foundit = true\n \"#{$1}=#{value}\"\n else\n item\n end\n end\n #puts \"appending #{name}=#{value}\" unless foundit\n append(name,value) unless foundit\n end",
"def set(obj, value)\n if @type\n if @single\n value = @type.parse(value)\n else\n value = value.map{|e| @type.parse(e)}\n end\n elsif @builder\n if @single\n value = @builder.call(value)\n else\n value = value.map{|e| @builder.call(e)}\n end\n end\n obj.send(\"#{@sym}=\".to_sym, value)\n end",
"def set(*args)\n # not supported\n end",
"def set(*args)\n # not supported\n end",
"def set(value)\n value\n end",
"def tag_set(p_tag_sym, p_val) tag.send(\"#{p_tag_sym.to_s}=\", p_val) end",
"def h=(val); self[3] = val; end",
"def raw=(_); end",
"def set_immediate_value(element, *value)\n @bridge.set_immediate_value(element, *value)\n end",
"def []=(name, value); end",
"def []=(name, value); end",
"def []=(name, value); end",
"def k_set!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 63 )\n\n\n\n type = K_SET\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 505:3: 'set'\n match( \"set\" )\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__, 63 )\n\n\n end",
"def set!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n type = SET\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 158:7: 'set'\n match( \"set\" )\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__, 37 )\n\n end",
"def w=(val); self[2] = val; end",
"def set(values); end",
"def set(key, value); end",
"def set(key, value); end",
"def setnx(key, value); end",
"def setnx(key, value); end",
"def set(value)\n mutate build_map(value)\n end",
"def []= name, value\n set name, value\n end",
"def set!(*args)\n end",
"def js_set(pairs = {})\n raise ArgumentError, \"only a single variable is supported\" if pairs.keys.length > 1\n pairs.map.each { |var, expr| js_value %Q|#{var.to_s} = #{marshal expr}| }.join(COLON)\n end",
"def set(str)\n\t\t@pipe.puts \"set #{str}\"\n\tend",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def x=(val); self[0] = val; end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end",
"def s1=(value)\n self[:s1] = value\n end"
] | [
"0.6529487",
"0.6489435",
"0.6489435",
"0.6469051",
"0.6466106",
"0.6461412",
"0.64169127",
"0.63620573",
"0.630727",
"0.6268195",
"0.6232322",
"0.6225457",
"0.62039995",
"0.62039995",
"0.61888295",
"0.61847246",
"0.6141522",
"0.61349905",
"0.60952437",
"0.60952437",
"0.60716635",
"0.6048937",
"0.6041211",
"0.59993535",
"0.599569",
"0.5992122",
"0.5992122",
"0.5992122",
"0.59858996",
"0.5970048",
"0.5963258",
"0.5961746",
"0.59574866",
"0.59574866",
"0.5940867",
"0.5940867",
"0.59224486",
"0.59189826",
"0.5913706",
"0.5903624",
"0.58929324",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.58928484",
"0.5892316",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061",
"0.589061"
] | 0.0 | -1 |
Check whether this range proof is valid or not. | def valid?
# Check tx = <lx, rx>
unless FIELD.mod(lx.zip(rx).map { |a, b| FIELD.mod(a * b) }.sum) == tx
return false
end
return false unless valid_poly_t?
p =
vec_g
.zip(lx)
.map { |a, b| a * b }
.zip(vec_h2.zip(rx).map { |a, b| a * b })
.map { |a, b| a + b }
.sum(GROUP.infinity)
p1 == p2 && p2 == p
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end",
"def valid? _e = self.e\n _e and _e.between?(2, self.p-2) and _e.bits_set > 1\n end",
"def valid?\n x.between?(0, 6) && y.between?(-1, 6)\n end",
"def valid? _e = self.e\n _e and _e.between?(2, self.p-2) and _e.bits_set > 1\n end",
"def validate(spec)\n range = spec['range']\n match_delta(range, node.transform) ? true : false\n end",
"def valid_range?\n (0..@max_num).cover?(@number)\n end",
"def valid?\n test_bounds(x, @xmin, @xmax) && test_bounds(y, @ymin, @ymax)\n end",
"def valid?\n not invalid?\n end",
"def valid?\n !invalid?\n end",
"def valid?\n violations.empty?\n end",
"def valid?(range)\n range[0] < range[1]\nend",
"def valid?\n return false if !@period.nil? && @period > 2147483647\n return false if !@until_occurrences.nil? && @until_occurrences > 2147483647\n true\n end",
"def valid?\n if !value.nil?\n in_range_for_type? &&\n among_validate_in_values? &&\n @cfg.validator.call(value)\n else\n true\n end\n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def check\n if @number >= @lower && @number <= @upper\n @message = \"Number '#{@number}' is within range '#{@lower}-#{@upper}'.\"\n true\n else\n @message = \"Number '#{@number}' is not within range '#{@lower}-#{@upper}'.\"\n false\n end\n end",
"def valid?\n sides.none?{|side| side <= 0} && legal?\n end",
"def validate?\n ( @x <= @y && @d > 0 )\n end",
"def check_validity!\n # nothing\n end",
"def valid?\n valid == true\n end",
"def valid?\n return false if @anchor.nil?\n return false if @cv.nil?\n return false if @nullifier.nil?\n return false if @proof.nil?\n return false if @rk.nil?\n return false if @spend_auth_sig.nil?\n true\n end",
"def valid?\n @valid ||= begin\n @error_message = ''\n if !@ball1 || !in_range(@ball1)\n @error_message = 'The 1st ball knocked wrong number of pins'\n return\n end\n if (!strike? && !@ball2) || !in_range(@ball2)\n @error_message = 'The 2nd ball knocked wrong number of pins'\n return\n end\n if !strike? && !in_range(@ball1 + @ball2)\n @error_message = 'The sum of knocked pins is wrong'\n return\n end\n true\n end\n end",
"def is_validated\n\tif $start_num > $end_num \n\t\tre_enter_number\n\telse\n\t\treturn false\t\n\tend\t\nend",
"def has_valid_proof?\n\t\tprev_proof = self.previous_block.proof\n\t\tprev_hash = self.previous_hash\n\n\t\treturn self.pow_strategy.valid_proof?( prev_proof, prev_hash, self.proof )\n\tend",
"def valid?\n\t\tarea != 0\n\tend",
"def has_range?\n !self.domain_ranges.nil?\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n false\n end",
"def valid?\n false\n end",
"def valid?\n @x.is_a?(Integer) &&\n @y.is_a?(Integer) &&\n orientation_set?\n end",
"def valid?\n return false if !@prefecture_name.nil? && @prefecture_name !~ Regexp.new(/(北海道|青森県|岩手県|宮城県|秋田県|山形県|福島県|茨城県|栃木県|群馬県|埼玉県|千葉県|東京都|神奈川県|新潟県|富山県|石川県|福井県|山梨県|長野県|岐阜県|静岡県|愛知県|三重県|滋賀県|京都府|大阪府|兵庫県|奈良県|和歌山県|鳥取県|島根県|岡山県|広島県|山口県|徳島県|香川県|愛媛県|高知県|福岡県|佐賀県|長崎県|熊本県|大分県|宮崎県|鹿児島県|沖縄県)/)\n return false if !@prefecture_code.nil? && @prefecture_code > 47\n return false if !@prefecture_code.nil? && @prefecture_code < 1\n close_cause_validator = EnumAttributeValidator.new('String', [\"01\", \"11\", \"21\", \"31\"])\n return false unless close_cause_validator.valid?(@close_cause)\n latest_validator = EnumAttributeValidator.new('Integer', [0, 1])\n return false unless latest_validator.valid?(@latest)\n hihyoji_validator = EnumAttributeValidator.new('Integer', [0, 1])\n return false unless hihyoji_validator.valid?(@hihyoji)\n true\n end",
"def valid?\n false\n end",
"def valid?\n self.valid\n end",
"def valid?\n return false if @denominator.nil?\n return false if @interval.nil?\n return false if @numerator.nil?\n return false if @query.nil?\n return false if @res_type.nil?\n return false if @resp_version.nil?\n return false if @times.nil?\n true\n end",
"def invalid?\n not valid?\n end",
"def valid?\n check!\n true\n rescue\n false\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end"
] | [
"0.71757114",
"0.684487",
"0.6843913",
"0.6772827",
"0.674743",
"0.67094177",
"0.6706939",
"0.6704488",
"0.66463506",
"0.6628334",
"0.6627253",
"0.6624542",
"0.65926594",
"0.64792097",
"0.64792097",
"0.64658296",
"0.64633846",
"0.6460021",
"0.6445712",
"0.6417783",
"0.6417542",
"0.64170563",
"0.6403786",
"0.63552785",
"0.63321954",
"0.63192886",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631445",
"0.631431",
"0.631431",
"0.63102996",
"0.6299758",
"0.629875",
"0.6297911",
"0.62905395",
"0.6288708",
"0.62833077",
"0.62777287",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631",
"0.6276631"
] | 0.0 | -1 |
The content of the proof is made into a Hash object. | def to_h
{
V: v.hex,
A: p_a.hex,
S: p_s.hex,
T1: p_t1.hex,
T2: p_t2.hex,
tx: "0x#{tx.hex}",
txbf: "0x#{tx_bf.hex}",
e: "0x#{e.hex}",
lx: {
n: ORDER_HEX,
elems: lx.map { |x| "0x#{x.hex}" }
},
rx: {
n: ORDER_HEX,
elems: rx.map { |x| "0x#{x.hex}" }
},
G: GENERATOR_G.hex,
order: ORDER_HEX
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n @content.hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def proof(key)\n path = []\n roothash # pre-calculate inner nodes' hashes\n node = root_node\n ba_key = Bitarray.new(key)\n # descend to the node or bail with null value hash\n 1.upto(KEY_SIZE) do |depth|\n path << node_subhashes(node)\n bit = ba_key[depth - 1]\n node = ((bit == 0) ? node.left : node.right) || Node.null(node.depth + 1)\n end\n value = node.value || self.class.null_value_hash\n {\n roothash: roothash,\n key: key,\n value: value,\n path: path\n }\n end",
"def makehash(body)\n signer = SSH::Key::Signer.new\n if @config.pluginconf[\"sshkey\"]\n signer.add_key_file(@config.pluginconf[\"sshkey\"])\n signer.use_agent = false\n end\n signatures = signer.sign(body).collect { |s| s.signature }\n return Marshal.dump(signatures)\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n data.hash\n end",
"def hashed_content\n @hashed_content ||= valid? ? Digest::SHA1.hexdigest(content) : nil \n end",
"def hash\n\t\t(language + type + klass + thing).hash\n\tend",
"def hash(*) end",
"def hash\n simplified.hash\n end",
"def hash\n\t\treturn [ self.subject, self.predicate, self.object ].hash\n\tend",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n @hash\n end",
"def mining_hash\n Utils.keccak(rlp_encode skip_keys: [:mix_hash, :nonce])\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n code.hash\n end",
"def hash\n self.atoms.hash\n end",
"def hash\n\n self.h.fei.hash\n end",
"def get_challenge_and_proof username, xverifier, xsalt\n generate_B(xverifier)\n return {\n :challenge => {:B => @B, :salt => xsalt},\n :proof => {:B => @B, :b => @b.to_hex_string, :I => username, :s => xsalt, :v => xverifier}\n }\n end",
"def hash\n code.hash\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end",
"def hash\n [principals, relation].hash\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def hash\n return unless doc_value?\n result['doc']['hash']\n end",
"def to_hash() end",
"def output_hash; end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n bytes.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n [subject_property, proprietorship, surname, forename, middle_name, all_names, historical_match].hash\n end",
"def hash\n swap\n scatter\n completed_string\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end",
"def hash\n @value.hash\n end",
"def passive\t\t\n\tif @body.size > 4\n\t\thash=Digest::MD5.hexdigest(@body[0..500])\t\n\t\t[{:name=>\"hash\",:string=>hash}]\n\telse\n\t\t[]\n\tend\nend",
"def hash\n title.hash\n end",
"def phraseForHash(hash)\n\t\t# As noted in hashForPhrase, our hash is just an integer index, of the form\n\t\t# H = K0 + L0 K1 + L0 L1 K2 + ... + L0 L1 ... L_(n-1) K_n\n\t\t#\n\t\t# The key insight in reversing this is to realize that if we write,\n\t\t# c_0 = 1, c_n = L0 L1 ... L_(n-1)\n\t\t# s_n = c_n K_n\n\t\t# S_n = s0 + s1 + ... + s_n, \n\t\t# then we must have,\n\t\t# c_(n+1) > S_n. (see proof below)\n\t\t#\n\t\t# So if we consider\n\t\t# H = S_n = c_n K_n + S_(n-1)\n\t\t# then\n\t\t# S_n / c_n = K_n + S_(n-1) / c_n\n\t\t# We know that 0 <= S_(n-1) / c_n < 1, so\n\t\t# int(S_n/c_n) = K_n\n\t\t#\n\t\t# We can use this information to recurse:\n\t\t# s_n = c_n K_n = c_n * int(S_n/c_n)\n\t\t# S_n - s_n = S_(n-1),\n\n\t\tbegin\n\t\t\tweight = @dictionaries.inject(1) { |x, dict| dict.length * x } # L0 L1 L2 ... L_n\n\t\t\tsum = hashFromString(hash)\n\t\t\tlines = [ 0 ] * @dictionaries.length # We fill from the end backwards, so allocate the total size up front\n\n\t\t\t(@dictionaries.length-1).downto(0) do |n|\n\t\t\t\tweight /= @dictionaries[n].length # c_n = L0 L1 .. L_(n-1)\n\t\t\t\tlines[n] = (sum / weight).to_i # K_n = int(S_n / c_n)\n\t\t\t\tsum -= weight * lines[n] # S_(n-1) = S_n - c_n K_n\n\t\t\tend\n\t\trescue\n\t\t\treturn nil\n\t\tend\n\n\t\t# Proof of c_(n+1) > S_n\n\t\t#\n\t\t# The following is an inductive proof.\n\t\t# Base case: (c1 > S0)\n\t\t# c1 > S0 <=> L0 > K0, which we know by definition (0 <= K_i < L_i)\n\t\t#\n\t\t# Inductive step: (c_n > S_(n-1) => c_(n+1) > S_n)\n\t\t# Recall that,\n\t\t# c_n = L0 L1 ... L_(n-1)\n\t\t# Notice that (L_n - K_n) >= 1, so\n\t\t# c_n < L0 L1 ... L_(n-1) * (L_n - K_n) = c_(n+1) - s_n\n\t\t# So,\n\t\t# c_n > S_(n-1)\n\t\t# => c_(n+1) - s_n > S_(n-1)\n\t\t# => c_(n+1) > S_(n-1) + s_n = S_n\n\t\t# Therefore, c_n > S_(n-1) => c_(n+1) > S_n.\n\t\t# Since we have c1 > S0,\n\t\t# c_(n+1) > S_n for all n > 0.\n\n\t\tphrase = []\n\t\t@dictionaries.length.times do |i|\n\t\t\tphrase.push @dictionaries[i][lines[i]].strip\n\t\tend\n\n\t\tphrase\n\tend",
"def hash\n to_s.hash\n end",
"def hash\n value.hash\n end",
"def hash\n return to_s.hash\n end",
"def to_hash\n @content.to_hash\n end",
"def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end",
"def to_hash\n body.to_hash\n end",
"def to_hash\n @content\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n to_a.hash\n end",
"def hash\n [ data, type ].hash\n end",
"def calculate_hash!\n entry_hash = to_hash\n entry_hash['description']=nil\n @hash = entry_hash.hash\n end",
"def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end",
"def hash\r\n id.hash\r\n end",
"def hash\n @hash ||= self.to_a.hash\n end",
"def hash\n [uri, parameters, username, password, verify_mode].hash\n end",
"def rehash() end",
"def compute_hash_with_proof_of_work(difficulty =\"0\")\n nonce = 0\n loop do\n hash = compute_hash_with_nonce(nonce)\n if hash.start_with?(difficulty)\n return [hash, nonce]\n else\n nonce += 1\n print \"#{nonce} - \"\n end\n end\n\n end",
"def author_hash; end",
"def get_shakey \n {\"William Shakespeare\"=>{\"1\"=>{\"title\"=>\"The Two Gentlemen of Verona\", \"finished\"=>1591}, \"2\"=>{\"title\"=>\"The Taming of the Shrew\", \"finished\"=>1591}, \"3\"=>{\"title\"=>\"Henry VI, Part 2\", \"finished\"=>1591}, \"4\"=>{\"title\"=>\"Henry VI, Part 3\", \"finished\"=>1591}, \"5\"=>{\"title\"=>\"Henry VI, Part 1\", \"finished\"=>1592}, \"6\"=>{\"title\"=>\"Titus Andronicus\", \"finished\"=>1592}, \"7\"=>{\"title\"=>\"Richard III\", \"finished\"=>1593}, \"8\"=>{\"title\"=>\"Edward III\", \"finished\"=>1593}, \"9\"=>{\"title\"=>\"The Comedy of Errors\", \"finished\"=>1594}, \"10\"=>{\"title\"=>\"Love's Labour's Lost\", \"finished\"=>1595}, \"11\"=>{\"title\"=>\"Love's Labour's Won\", \"finished\"=>1596}, \"12\"=>{\"title\"=>\"Richard II\", \"finished\"=>1595}, \"13\"=>{\"title\"=>\"Romeo and Juliet\", \"finished\"=>1595}, \"14\"=>{\"title\"=>\"A Midsummer Night's Dream\", \"finished\"=>1595}, \"15\"=>{\"title\"=>\"King John\", \"finished\"=>1596}, \"16\"=>{\"title\"=>\"The Merchant of Venice\", \"finished\"=>1597}, \"17\"=>{\"title\"=>\"Henry IV, Part 1\", \"finished\"=>1597}, \"18\"=>{\"title\"=>\"The Merry Wives of Windsor\", \"finished\"=>1597}, \"19\"=>{\"title\"=>\"Henry IV, Part 2\", \"finished\"=>1598}, \"20\"=>{\"title\"=>\"Much Ado About Nothing\", \"finished\"=>1599}, \"21\"=>{\"title\"=>\"Henry V\", \"finished\"=>1599}, \"22\"=>{\"title\"=>\"Julius Caesar\", \"finished\"=>1599}, \"23\"=>{\"title\"=>\"As You Like It\", \"finished\"=>1600}, \"24\"=>{\"title\"=>\"Hamlet\", \"finished\"=>1601}, \"25\"=>{\"title\"=>\"Twelfth Night\", \"finished\"=>1601}, \"26\"=>{\"title\"=>\"Troilus and Cressida\", \"finished\"=>1602}, \"27\"=>{\"title\"=>\"Sir Thomas More\", \"finished\"=>1604}, \"28\"=>{\"title\"=>\"Measure for Measure\", \"finished\"=>1604}, \"29\"=>{\"title\"=>\"Othello\", \"finished\"=>1604}, \"30\"=>{\"title\"=>\"All's Well That Ends Well\", \"finished\"=>1605}, \"31\"=>{\"title\"=>\"King Lear\", \"finished\"=>1606}, \"32\"=>{\"title\"=>\"Timon of Athens\", \"finished\"=>1606}, \"33\"=>{\"title\"=>\"Macbeth\", \"finished\"=>1606}, \"34\"=>{\"title\"=>\"Antony and Cleopatra\", \"finished\"=>1606}, \"35\"=>{\"title\"=>\"Pericles, Prince of Tyre\", \"finished\"=>1608}, \"36\"=>{\"title\"=>\"Coriolanus\", \"finished\"=>1608}, \"37\"=>{\"title\"=>\"The Winter's Tale\", \"finished\"=>1611}, \"38\"=>{\"title\"=>\"Cymbeline\", \"finished\"=>1610}, \"39\"=>{\"title\"=>\"The Tempest\", \"finished\"=>1611}, \"40\"=>{\"title\"=>\"Cardenio\", \"finished\"=>1613}, \"41\"=>{\"title\"=>\"Henry VIII\", \"finished\"=>1613}, \"42\"=>{\"title\"=>\"The Two Noble Kinsmen\", \"finished\"=>1614}}}\nend",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n [clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, contains_macros, contains_xml_external_entities, contains_insecure_deserialization, contains_html, contains_unsafe_archive, verified_file_format, found_viruses, content_information].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n to_pem.hash\n end",
"def hash\n to_pem.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def use_proof(proof) \n @proof = proof\n #@proofsheets = @proof.proofsheets\n end",
"def hash!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = HASH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 157:8: '#'\n match( 0x23 )\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__, 23 )\n\n end",
"def hash\n @vbits.hash\n end",
"def hash\n expr.hash\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def read_hash(lh)\n # lh => location hash\n # lh = decodeURI(location.hash);\n p = false\n hi = false\n h = []\n s = {}\n\n # Version 2 of Emphasis (I am ignoring v1 here because I have not used it on the client side anyways)\n # #h[tbsaoa,Sstaoo,2,4],p[FWaadw] -> p = \"FWaadw\", h = [ \"tbsaoa\", \"Sstaoo\" ], s = { \"Sstaoo\" : [ 2, 4 ] }\n\n # findp = lh.match(/p\\[([^[\\]]*)\\]/)\n # findh = lh.match(/h\\[([^[\\]]*)\\]/)\n # p = (findp && findp.length>0) ? findp[1] : false;\n # hi = (findh && findh.length>0) ? findh[1] : false;\n\n # SEB: strange. it looks like that there was an error in the javascript regexp here but it still works in js!!!\n if lh =~ /p\\[([^\\]]*)\\]/\n p = $1\n end\n if lh =~ /h\\[([^\\]]*)\\]/\n hi = $1\n end\n # puts p\n # puts hi\n\n # undef = nil\n # hi = nil\n\n highlightings = []\n\n if (hi)\n hi = hi.scan(/[a-zA-Z]+(?:,[0-9]+)*/)\n\n hi.each do |hi_element|\n a = hi_element.split(',');\n key = a[0];\n # pos = this.find_key(key)['index']\n\n highlightings.push(find_key(key))\n\n # puts key\n # paragraph_for_key = find_key(key)\n # puts paragraph_for_key['index']\n # puts paragraph_for_key['elm'].to_html\n\n # if (pos != false) {\n # h.push(parseInt(pos)+1);\n # var b = a;\n # b.shift();\n # if (b.length>0) {\n # for (var j=1; j<b.length; j++) {\n # b[j] = parseInt(b[j]);\n # }\n # }\n # s[h[h.length - 1]] = b;\n # }\n # break\n end\n end\n\n # @p = p;\n # @h = h;\n # @s = s;\n return highlightings\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def makehash(body)\n Log.debug(\"Creating message hash using #{private_key_file}\")\n\n sign(private_key_file, body.to_s)\n end",
"def challenge; end"
] | [
"0.7096036",
"0.6494298",
"0.6494298",
"0.6494298",
"0.6494298",
"0.6494298",
"0.6494298",
"0.6494298",
"0.62755364",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6173896",
"0.6147524",
"0.61399823",
"0.6126407",
"0.6126407",
"0.6126407",
"0.6106475",
"0.60296905",
"0.60149074",
"0.5992",
"0.5986772",
"0.5965502",
"0.5962057",
"0.5954433",
"0.59530395",
"0.5917535",
"0.58982944",
"0.5880485",
"0.58754617",
"0.5870981",
"0.5856647",
"0.58558637",
"0.58511883",
"0.5841172",
"0.5836811",
"0.5826639",
"0.58228123",
"0.5808681",
"0.58061856",
"0.5791264",
"0.5788261",
"0.5765797",
"0.5765797",
"0.5765797",
"0.57633996",
"0.5740738",
"0.5706934",
"0.56912005",
"0.5688334",
"0.5687239",
"0.56840605",
"0.5683352",
"0.5668924",
"0.56643254",
"0.5663604",
"0.5659108",
"0.5635819",
"0.56350505",
"0.56285506",
"0.56199867",
"0.56187403",
"0.56187403",
"0.56187403",
"0.56146955",
"0.561297",
"0.56097263",
"0.56063753",
"0.55935585",
"0.5580498",
"0.55581534",
"0.55529624",
"0.5546292",
"0.55451614",
"0.5539115",
"0.5538181",
"0.5536174",
"0.5526945",
"0.5526945",
"0.5515828",
"0.5515828",
"0.55152774",
"0.55152774",
"0.55118465",
"0.5509971",
"0.5508088",
"0.5499248",
"0.5498993",
"0.5483115",
"0.5481948",
"0.5475898",
"0.5471215",
"0.54664016",
"0.5456227"
] | 0.0 | -1 |
Convert compressed range proof using inner product. | def to_compress
a = lx.dup
b = rx.dup
ts = transcript.dup
w = ts.challenge_scalar("w")
q = GENERATOR_BJ * w
a_sum = a.dup
b_sum = b.dup
g_sum = vec_g.dup
h_sum = vec_h2.dup
terms = []
until a_sum.length == 1
a_lo = []
b_lo = []
g_lo = []
h_lo = []
a_hi = []
b_hi = []
g_hi = []
h_hi = []
half = a_sum.length / 2
a_sum.each.with_index do |_, i|
if i < half
a_lo << a_sum[i]
b_lo << b_sum[i]
g_lo << g_sum[i]
h_lo << h_sum[i]
else
a_hi << a_sum[i]
b_hi << b_sum[i]
g_hi << g_sum[i]
h_hi << h_sum[i]
end
end
alo_bhi = a_lo.zip(b_hi).map { |x, y| FIELD.mod(x * y) }.sum
ahi_blo = a_hi.zip(b_lo).map { |x, y| FIELD.mod(x * y) }.sum
l_k =
g_hi.zip(a_lo).map { |x, y| x * y }.sum(INFINITY_J) +
h_lo.zip(b_hi).map { |x, y| x * y }.sum(INFINITY_J) + q * alo_bhi
r_k =
g_lo.zip(a_hi).map { |x, y| x * y }.sum(INFINITY_J) +
h_hi.zip(b_lo).map { |x, y| x * y }.sum(INFINITY_J) + q * ahi_blo
ts.points << l_k
ts.points << r_k
uk = ts.challenge_scalar("uk")
uk_inv = FIELD.inverse(uk)
terms << { L: l_k, R: r_k }
a_sum = []
b_sum = []
g_sum = []
h_sum = []
a_lo.each.with_index do |_, i|
a_sum << (a_lo[i] * uk + a_hi[i] * uk_inv)
b_sum << (b_lo[i] * uk_inv + b_hi[i] * uk)
g_sum << (g_lo[i] * uk_inv + g_hi[i] * uk)
h_sum << (h_lo[i] * uk + h_hi[i] * uk_inv)
end
end
a0 = a_sum.first
b0 = b_sum.first
Compressed.new(v, p_a, p_s, p_t1, p_t2, tx, tx_bf, e, a0, b0, terms)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mult(other_range)\n xlo = first\n xhi = last\n ylo = other_range.first\n yhi = other_range.last\n pos = ->(x) { x >= 0 }\n neg = ->(x) { x <= 0 }\n return (xlo * ylo)..(xhi * yhi) if [xlo, xhi, ylo, yhi].all?(&pos)\n return (xhi * ylo)..(xhi * yhi) if [xlo, xhi, yhi].all?(&pos) and [ylo].all?(&neg)\n return (xhi * ylo)..(xlo * yhi) if [xlo, xhi].all?(&pos) and [ylo, yhi].all?(&neg)\n return (xlo * yhi)..(xhi * ylo) if [xlo].all?(&neg) and [xhi, ylo, yhi].all?(&pos)\n if [xlo, ylo].all?(&neg) and [xhi, yhi].all?(&pos)\n new_min = [(xhi * ylo), (xlo * yhi)].min\n new_max = [(xlo * ylo), (xhi * yhi)].min\n return new_min..new_max\n end\n return (xhi * ylo)..(xlo * ylo) if [xhi].all?(&pos) and [xlo, ylo, yhi].all?(&pos)\n return (xlo * yhi)..(xhi * ylo) if [xlo, xhi].all?(&neg) and [ylo, yhi].all?(&pos)\n return (xlo * yhi)..(xlo * ylo) if [xlo, xhi, ylo].all?(&neg) and [yhi].all?(&pos)\n return (xhi * yhi)..(xlo * ylo) if [xlo, xhi, ylo, yhi].all?(&pos)\n end",
"def scale(range)\n u = uninterpolate\n i = interpolate(range[0], range[1])\n\n lambda do |x|\n x = ([0.0, x, (wrong + right).to_f].sort[1]).to_f\n i.call(u.call(x))\n end\n end",
"def _reduce_193(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def _reduce_193(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def mapping_data(conversion_targetfloat,in_min,in_max,out_min,out_max)\n\n # Convert \"conversion_targetfloat\" from \"in_min\" to \"in_max\" range to \"out_min” to ”out_max\" range.\n return (conversion_targetfloat - in_min) * (out_max - out_min) / (in_max - in_min) + out_min\n\nend",
"def interpolbi pontos\n pontos = pontos.sort\n lambda do |*x|\n lagrange pontos.map {|x1, pts|\n [x1, lagrange(pts).call(x[1])]\n }.call(x[0])\n end\nend",
"def convert(input, source, target)\n input = input.reverse.split('')\n\n mult = source.length\n div = target.length\n\n base10_val = input.map.with_index { |c, i| source.index(c) * (mult ** i) }.reduce(:+)\n\n base_target = (0..find_place(base10_val, div)).to_a.reverse.map do |n|\n index = base10_val / (div ** n)\n base10_val %= (div ** n)\n target[index]\n end.join\nend",
"def folding_ranges; end",
"def to_outer(point)\n transform * point\n end",
"def _reduce_516(val, _values, result)\n result = @builder.range_inclusive(val[0], val[1], val[2])\n \n result\nend",
"def map_range(a, b, s)\n af, al, bf, bl = a.first, a.last, b.first, b.last\n bf + (s - af)*(bl - bf).quo(al - af)\n end",
"def productify(arr)\n products = Array.new(arr.length, 1)\n\n lower_prod = 1\n\n 0.upto(arr.size - 1) do |i|\n products[i] = products[i] * lower_prod\n lower_prod = lower_prod * arr[i]\n end\n\n upper_prod = 1\n\n (arr.size - 1).downto(0) do |i|\n products[i] = products[i] * upper_prod\n upper_prod = upper_prod * arr[i]\n end\n\n products\nend",
"def productify(arr)\n products = Array.new(arr.length, 1)\n\n lower_prod = 1\n 0.upto(arr.size - 1) do |i|\n products[i] = products[i] * lower_prod\n lower_prod = lower_prod * arr[i]\n end\n\n upper_prod = 1\n (arr.size - 1).downto(0) do |i|\n products[i] = products[i] * upper_prod\n upper_prod = upper_prod * arr[i]\n end\n\n products\nend",
"def inflate(x,y)\n return self.class.new(self[0] - x.div(2),\n self[1] - y.div(2),\n self[2] + x,\n self[3] + y)\n end",
"def _reduce_508(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def map(value, v_min, v_max, d_min, d_max)\n v_value = value.to_f # so it returns float\n\n v_range = v_max - v_min\n d_range = d_max - d_min\n (v_value - v_min) * d_range / v_range + d_min\n end",
"def inflate!(x,y)\n self[0] -= x.div(2)\n self[1] -= y.div(2)\n self[2] += x\n self[3] += y\n return self\n end",
"def map_value(val, from_range, to_range)\n orig_range = [1, (from_range[1] - from_range[0]).abs].max\n new_range = [1, (to_range[1] - to_range[0]).abs].max\n\n ((val.to_f - from_range[0]) / orig_range) * new_range + to_range[0]\n end",
"def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end",
"def expo(x) ([x].pack(\"G\")[0..1].unpack(\"S>\")[0] & 0b0111111111110000) >> 4; end",
"def productify(arr)\n\n up_product = 1\n up_array = []\n arr.length.times do |idx|\n up_product *= arr[idx]\n up_array << up_product\n end\n\n down_product = 1\n down_array = Array.new(arr.length)\n (arr.length - 1).downto(0) do |idx|\n down_product *= arr[idx]\n down_array[idx] = down_product\n end\n\n result = []\n arr.length.times do |idx|\n product = 1\n up_idx = idx - 1\n down_idx = idx + 1\n if up_idx >= 0\n product *= up_array[up_idx]\n end\n if down_idx < arr.length\n product *= down_array[down_idx]\n end\n result[idx] = product\n end\n\n result\n\nend",
"def r(range)\n range.to_a\nend",
"def normalize_range(range)\n ar = range.to_a\n if ar.min > 2 # normalizacja zadanego zakresu aby zawsze zakres zaczynał się od 2\n ar += (2..ar.min-1).to_a\n ar = ar.sort\n else\n ar.delete_if { |e| e < 2 }\n end\n ar\nend",
"def best_compressible_range(fields, start)\n cr = compressible_ranges(fields, start)\n\n if cr[0]\n if cr[1]\n if cr[0].count == cr[1].count\n compress = cr[0].first < cr[1].first ? cr[1] : cr[0]\n else\n compress = cr[0]\n end\n else\n compress = cr[0]\n end\n else\n compress = nil\n end\n end",
"def _reduce_528(val, _values, result)\n result = @builder.range_inclusive(val[0], val[1], val[2])\n\n result\nend",
"def encode_2d(n)\n n = (n ^ (n << 8)) & 0x00ff00ff\n n = (n ^ (n << 4)) & 0x0f0f0f0f\n n = (n ^ (n << 2)) & 0x33333333\n n = (n ^ (n << 1)) & 0x55555555\n return n\n end",
"def _reduce_518(val, _values, result)\n result = @builder.range_inclusive(val[0], val[1], val[2])\n \n result\nend",
"def range_remap(input_range:0..255, output_range:0.0..1.0, value:0)\n\t\tsrc = input_range\n\t\tdest = output_range\n\t\t\n\t\t# src: http://stackoverflow.com/questions/3451553/value-remapping\n\t\t# low2 + (value - low1) * (high2 - low2) / (high1 - low1)\n\t\treturn dest.first + (value - src.first) * (dest.last - dest.first) / (src.last - src.first)\n\tend",
"def _reduce_437(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def _reduce_437(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def ranges\n pairs.map { |b, e| (b...e) }\n end",
"def _reduce_533(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def to_int_scale(x)\n sgn, d, _b, e = x.split\n c = d.to_i\n [sgn<0 ? -1 : c, -c, e-d.size]\n end",
"def _reduce_513(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def _reduce_202(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def make_signed_int64(high, low); end",
"def reduce_digits_from_to(_production, _range, _tokens, theChildren)\n raw_range = [theChildren[2].token.lexeme, theChildren[4].token.lexeme]\n range_sorted = raw_range.map(&:to_i).sort\n ch_range = char_range(range_sorted[0].to_s, range_sorted[1].to_s)\n char_class(false, ch_range)\n end",
"def vector_to(point2)\n end",
"def a_to_the_b(a,b)\n\tinteger_combo = []\n\t(2..a).each do |a|\n\t\t(2..b).each do |b|\n\t\t\tinteger_combo << a**b\n\t\tend\n\tend\n\tinteger_combo.sort.uniq\nend",
"def make_lut_flat prob_dist\n lut = []\n pt = 0.0\n prob_dist.map do |ch,pr|\n lut << ((pt*IM).ceil ... ((pt+pr)*IM).ceil).map{ ch }\n pt += pr\n end\n lut.flatten!\nend",
"def _reduce_513(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n\n result\nend",
"def to_bc(date_range)\n if date_range.present?\n return [-date_range[1], -date_range[0]]\n else\n return [nil, nil]\n end\n end",
"def make_ranges_linear\n min, max = @data.values.sort.first, @data.values.sort.last\n value = ( ( max - min ) / File.open(@palette).readlines.size ).to_i + 1\n offset = (( value / 10 ** (value.to_s.size - 1) ).round + 1)* 10 ** (value.to_s.size - 1)\n last = offset > min ? offset : min\n @ranges = [ { :range => [1, last-1] } ]\n while last < max do\n @ranges << { :range => [last, last + offset - 1] }\n last += offset\n end\n @ranges << { :range => [last, last + offset] }\n end",
"def _reduce_525(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def _reduce_199(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def _reduce_523(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def effective_column(range); end",
"def compressible_ranges(fields, start)\n ranges = []\n\n i = start\n while i < 8 && fields[i] != 0 ; i += 1 ; end\n\n if i\n li = i\n\n while i < 8\n while i < 8 && fields[i] == 0 ; i += 1 ; end\n if i > li + 1\n ranges << (li...i)\n end\n\n while i < 8 && fields[i] != 0 ; i += 1 ; end\n\n li = i\n end\n end\n\n ranges.sort! { |a,b| b.count <=> a.count }\n ranges\n end",
"def zrangestore(dest_key, src_key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil)); end",
"def zrevrangebylex(key, max, min, limit: T.unsafe(nil)); end",
"def convert_bits(data, from, to, padding=true)\n acc = 0\n bits = 0\n ret = []\n maxv = (1 << to) - 1\n max_acc = (1 << (from + to - 1)) - 1\n data.each do |v|\n return nil if v < 0 || (v >> from) != 0\n acc = ((acc << from) | v) & max_acc\n bits += from\n while bits >= to\n bits -= to\n ret << ((acc >> bits) & maxv)\n end\n end\n if padding\n ret << ((acc << (to - bits)) & maxv) unless bits == 0\n elsif bits >= from || ((acc << (to - bits)) & maxv) != 0\n return nil\n end\n ret\n end",
"def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend",
"def install_order(arr)\n new_range = (arr.min.min..arr.max.max).to_a\n result_arr = []\n tup_hash = {}\n arr.each do |subarr|\n if tup_hash[subarr[0]]\n tup_hash[subarr[0]] = tup_hash[subarr[0]].push(subarr[1])\n else\n tup_hash[subarr[0]] = [subarr[1]]\n end\n new_range.delete(subarr[0])\n end\n until tup_hash.keys.empty?\n tup_hash.keys.each do |tup|\n if tup_hash[tup].any? { |el| tup_hash.keys.include?(el) }\n\n else\n result_arr.push(tup)\n tup_hash.delete(tup)\n end\n end\n end\n\n\n new_range.concat(result_arr)\n p new_range\n return new_range\nend",
"def op11(interp)\n b, a = interp.stack.pop, interp.stack.pop \n interp.stack.push(Integer(a - b))\n end",
"def combine_ranges(code, ranges); end",
"def solution(range)\n ary = range.select(&:prime?).map do |n|\n n**Math.log(range.max, n).floor\n end.reduce(:*)\nend",
"def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end",
"def test_normalization_C_pri_29\n [\n [0x0B47, 0x0300, 0x0B3E],\n [0x1100, 0x0300, 0x1161]\n ].map { |c| c.pack('U*') }.each do |c|\n assert_equal c.ui, @handler.normalize(c, :c).ui, \"Composition is implemented incorrectly\"\n end\n end",
"def transform_anotation(range)\n alphabet_table = { 'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, 'H' => 7, 'I' => 8, 'J' => 9,\n 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, 'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19,\n 'U' => 20, 'V' => 21, 'W' => 22, 'X' => 23, 'Y' => 24, 'Z' => 25, 'AA' => 26, 'AB' => 27, 'AC' => 28, 'AD' => 29,\n 'AE' => 30, 'AF' => 31, 'AG' => 32, 'AH' => 33, 'AI' => 34, 'AJ' => 35, 'AK' => 36, 'AL' => 37, 'AM' => 38, 'AN' => 39,\n 'AO' => 40, 'AP' => 41, 'AQ' => 42, 'AR' => 43, 'AS' => 44, 'AT' => 45, 'AU' => 46, 'AV' => 47, 'AW' => 48, 'AX' => 49,\n 'AY' => 50, 'AZ' => 51, 'BA' => 52, 'BB' => 53, 'BC' => 54, 'BD' => 55, 'BE' => 56, 'BF' => 57,\n 'BG' => 58, 'BH' => 59, 'BI' => 60, 'BJ' => 61, 'BK' => 62, 'BL' => 63, 'BM' => 64, 'BN' => 65, 'BO' => 66 }\n range = range.split(':')\n start_row = range[0].split(/([A-Z]+)/)\n start_row.shift\n end_row = range[1].split(/([A-Z]+)/)\n end_row.shift\n column_times = alphabet_table[end_row[0]] - alphabet_table[start_row[0]] + 1\n row_times = end_row[1].to_i - start_row[1].to_i + 1\n { 'shift_num': (start_row[1].to_i) - 1,\n 'column': alphabet_table[start_row[0]],\n 'column_times': column_times,\n 'row_times': row_times }\n end",
"def simplify\n super\n return CAS.abs(@x.x) if @x.is_a? CAS::Invert\n return self.simplify_dictionary\n end",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def price(range: T.unsafe(nil), as_string: T.unsafe(nil)); end",
"def p8\n\tvalue = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\n\tvalue_array = value.to_s.split('').map(&:to_i)\n\tproducts = []\n\t(0...value_array.length-5).each do |i|\n\t\tproduct = value_array[i...i+5].reduce(:*)\n\t\tproducts << product\n\tend\n\tproducts.max\nend",
"def invert_abscisses\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n lNewPoints = []\n lMinMaxX = @Function[:Points][0][0] + @Function[:Points][-1][0]\n @Function[:Points].reverse_each do |iPoint|\n lNewPoints << [lMinMaxX - iPoint[0], iPoint[1]]\n end\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end",
"def from_to(l1, c1, l2, c2); end",
"def _reduce_127(val, _values, result); end",
"def _reduce_127(val, _values, result); end",
"def interp2(x, y, z, xq, yq, method, extrapval) # flatten\n nx = x.length\n ny = y.length\n # nz = z.length\n nxq = xq.length\n nyq = yq.length\n inquiry(double: nxq * nyq) do |zq|\n super(nx, ny, x, y, z, nxq, nyq, xq, yq, zq, method, extrapval)\n end\n end",
"def decode_bitstring(bitstring, interval_bound)\n @coord = 0.0\n interval = (-interval_bound .. interval_bound)\n mean = interval.min + (((interval.max) - (interval.min)) / 2.0)\n mini = interval.min\n maxi = interval.max\n bitstring.each_char do |c|\n if c.to_f == 1\n interval = (mean .. maxi)\n mini = mean\n mean = interval.min + (((interval.max) - (interval.min)) / 2.0)\n maxi = interval.max\n else \n interval = (mini .. mean)\n maxi = mean\n mean = interval.min + (((interval.max) - (interval.min)) / 2.0)\n mini = interval.min\n end\n end\n @coord = mean\n return @coord\n end",
"def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def uncompress(str)\n uncompressed = ''\n (0...str.length - 1).each do |i|\n letter = str[i]\n num = str[i + 1].to_i\n uncompressed += letter * num\n end\n uncompressed\nend",
"def sharpen ary\n edge_extend(ary).each_cons(3)\n .map {|l,m,r| [0, (-1.0*l + 5.0*m + -1.0*r)].max }\nend",
"def compress(data); end",
"def _reduce_510(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def partially_decompress(compressed)\n # Keep regex bracketed because of Lint/AmbiguousRegexpLiteral\n if (parsed = compressed.match(/(.*?)\\((\\d+)x(\\d+)\\)(.*)/))\n safe, length, times, rest = parsed.captures\n length = length.to_i\n times = times.to_i\n\n left, right = rest.split_at length\n safe + left * times + partially_decompress(right)\n else\n compressed\n end\n end",
"def transform; end",
"def sum_range(i, j)\n \n end",
"def solution(digits_array)\n res = 0\n digits_2d_array = [\n [\"2\", digits_array[0]],\n [\"3\", digits_array[1]],\n [\"5\", digits_array[2]],\n [\"6\", digits_array[3]]\n ]\n who_make256_2d_array = digits_2d_array.map(&:clone)\n who_make256_2d_array.delete_at(1)\n who_make256_2d_array.sort! {|a,b| a[1] <=> b[1]}\n quantity_of256 = who_make256_2d_array[0][1]\n start_quantity_of2 = digits_2d_array[0][1]\n fin_quantity_of2 = start_quantity_of2 - quantity_of256\n who_make32_2d_array = digits_2d_array.map(&:clone)\n who_make32_2d_array = who_make32_2d_array[0..1]\n who_make32_2d_array[0][1] = fin_quantity_of2\n who_make32_2d_array.sort! {|a,b| a[1] <=> b[1]}\n quantity_of32 = who_make32_2d_array[0][1]\n res = quantity_of256 * 256 + quantity_of32 * 32\n return res\n end",
"def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend",
"def test_008_ranges()\n TestVals.each do |sVal|\n length = sVal.length\n (length - 2).times do |width|\n width += 2\n bs = BitString.new(sVal)\n #\n # Test subranging n bits at a time in a fetch\n #\n (length - width + 1).times do |i|\n excerpt = sVal[length-width-i,width].to_i(2)\n rng = i..i+width-1\n assert_equal(excerpt,\n bs[rng].to_i,\n 'Test fetching bitstring subrange ' +\n \"'#{bs.to_s}'[#{rng}] => '#{excerpt}'\\n\" +\n \"(sVal='#{sVal}', length=#{length}, \" +\n \"width=#{width}, i=#{i})\")\n end\n #\n # Now try setting that range to its complement\n #\n (length - width + 1).times do |i|\n bs = BitString.new(sVal)\n excerpt = (~ sVal[length-width-i,width].to_i(2)) & (2**width - 1)\n rng = i..i+width-1\n bs[rng] = excerpt\n assert_equal(excerpt,\n bs[rng].to_i,\n 'Test bitstring subrange after set' +\n \"'#{bs.to_s}'[#{rng}] => '#{excerpt}'\")\n end\n\n #\n # Now do the same with a bounded bitstring.\n #\n bs = BitString.new(sVal, length)\n #\n # Test subranging n bits at a time in a fetch\n #\n (length - width + 1).times do |i|\n excerpt = sVal[length-width-i,width].to_i(2)\n rng = i..i+width-1\n assert_equal(excerpt,\n bs[rng].to_i,\n 'Test fetching bitstring subrange ' +\n \"'#{bs.to_s}'[#{rng}] => '#{excerpt}'\\n\" +\n \"(sVal='#{sVal}', length=#{length}, \" +\n \"width=#{width}, i=#{i})\")\n end\n #\n # Now try setting that range to its complement\n #\n (length - width + 1).times do |i|\n bs = BitString.new(sVal, length)\n excerpt = (~ sVal[length-width-i,width].to_i(2)) & (2**width - 1)\n rng = i..i+width-1\n bs[rng] = excerpt\n assert_equal(excerpt,\n bs[rng].to_i,\n 'Test bitstring subrange after set' +\n \"'#{bs.to_s}'[#{rng}] => '#{excerpt}'\")\n end\n end\n end\n end",
"def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def reduce(x, y)\n extra = [x.exponent, y.exponent].min\n a = BigDecimal(SIGNS[x.sign <=> 0].to_s + RADIX + x.digits.to_s + EXP + (x.exponent - extra).to_s)\n b = BigDecimal(SIGNS[y.sign <=> 0].to_s + RADIX + y.digits.to_s + EXP + (y.exponent - extra).to_s)\n [a, b, extra]\n end",
"def to_a\n get_range('-inf', '+inf', include_boundaries: true)\n end",
"def reduce_interval(a, b)\n a *= mul\n b *= mul\n return [a, -(get :width) * 1.1].max / mul, [b, (get :width) * 1.1].min / mul\n end",
"def compress(data)\n compressed = \"\\x10\"\n compressed <<\n Bytestream.from_hex(format('%06X', data.length)).to_b.reverse\n\n index = 0\n w = 0xFFF\n window = ''\n lookahead = ''\n\n loop do\n bits = ''\n check = nil\n current_chunk = ''\n\n 8.times do\n window = (index < w ? data[0, index] : data[(index % w)..index])\n lookahead = data[index..-1]\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n check = window.index(lookahead[0..2])\n if check\n bits << '1'\n length = 2\n store_length = 0\n store_check = 0\n while check && length < 18\n store_length = length\n length += 1\n store_check = check\n check = window.index(lookahead[0, length])\n end\n index += store_length\n store_length -= 3\n position = window.length - 1 - store_check\n store_length = store_length << 12\n current_chunk <<\n Bytestream.from_hex(format('%04X', (store_length | position))).to_b\n else\n index += 1\n bits << '0'\n current_chunk << lookahead[0]\n end\n end # 8.times\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end # loop\n\n compressed << \"\\x00\" until compressed.length % 4 == 0\n compressed\n end",
"def unbinarize(block)\n block.map { |byte| byte.to_i(2).chr }.join\n end",
"def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend",
"def from_binary_rep(representation)\n res = 0\n representation.each_with_index do |bit, idx|\n res += bit * (2**idx)\n end\n res\n end",
"def utf8_ranges( range )\n ranges = []\n UTF8_BOUNDARIES.each do |max|\n if range.begin <= max\n return ranges << range if range.end <= max\n\n ranges << range.begin .. max\n range = (max + 1) .. range.end\n end\n end\n ranges\nend",
"def compress!; end",
"def to(other, t)\n self.zip(other).map{|a,b|t*(b-a)+a}.to_np\n end",
"def GF_product_p(a, b)\n (a.polynomial * b.polynomial).to_byte\nend",
"def expand(s)\n\n# change <> diamond bracket and -\nif s =~ /<(\\d+)-(\\d+)>/\ns.gsub!(\"<\",\"{\")\ns.gsub!(\">\",\"}\")\ns.gsub!(\"-\",\"..\")\nelse\nend\n\n# change ?,?,? (numbers) to ?..?\nif s =~ /(,\\d+)+(?=(,\\d+))/ \n s.gsub!(/(,\\d+)+(?=(,\\d+))/,\"..\")\n \n if s =~ /,(\\d+)/\n s.gsub!(/,/,\"\")\n\n else\n end\n else\n end\n\n STDERR.puts s + \"second\"\n\n # change 16,17 to 16..17\n if s =~ /\\{(\\d+),(\\d+)\\}/\n s.gsub!(/\\{(\\d+),(\\d+)\\}/,\"{\"+$1+\"..\"+$2+\"}\")\n else\n end\n\n STDERR.puts s + \"third\"\n STDERR.puts \"START EXPANSION\"\n # start doing the expansion\n s.gsub!(/{(-?\\w+)..(-?\\w+)(..(\\d+))?}/){x,y=$1,$2;a,b,c=[x,y,$4].map &:to_i\n $1[/\\d/]?0:(a,b=x,y)\n k=a<b ?[*a..b]:[*b..a].reverse\n ?{+0.step(k.size-1,$4?c:1).map{|i|k[i]}*?,+?}}\n r=1\n t=->x{x[0].gsub(/^{(.*)}$/){$1}.scan(/(({(\\g<1>|,)*}|[^,{}]|(?<=,|^)(?=,|$))+)/).map{|i|i=i[0];i[?{]?r[i]:i}.flatten}\n r=->x{i=x.scan(/({(\\g<1>)*}|[^{} ]+)/).map(&t)\n i.shift.product(*i).map &:join}\n\n STDERR.puts \"split array\"\n arr = s.split.map(&r).flatten\n STDERR.puts \"print array\"\n STDERR.puts arr\n\n\n STDERR.puts \"check the last case\"\n # deal with the last case\n\n if s=~ /({.+}){3,}/\n #arr1 = arr.select{|str| str.include?(\"i\")} \n #arr2 = arr.select{|str| str.include?(\"j\")}\n #arr3 = arr.select{|str| str.include?(\"k\")}\n STDERR.puts \"inside\"\n #ending = [arr1,arr2,arr3].reduce([], :concat)\n\n ALPHABET = \"abcdefghijklmnopqrstuvwxyz\"\n\n arr.sort_by! do |word|\n word.split('').map do |letter|\n ALPHABET.index(letter)\n end\n end\n\n STDERR.puts \"after sorting\"\n STDERR.puts arr\n else\n end\n\n STDERR.puts \"final array\"\n #STDERR.puts ending\n return arr\n\n\n\n end",
"def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes this work properly for all values (including 0, 1)\n input.map do |ary|\n ary.map do |value|\n (2..value).inject(1, :*)\n end\n end\n\n # First solution\n # Mostly optimized\n # Does 1 more multiplication than needed (mult by 1)\n #\n # input.map do |ary|\n # ary.map do |value|\n # (1..value).inject(1) do |factorial, value|\n # factorial *= value\n # end\n # end\n # end\n end",
"def trans(coord)\n\treturn [coord[0]+600, -coord[1]+350]\nend",
"def p6\n\trange = (1..100).to_a\n\tsquare_of_sum = range.reduce(:+) ** 2\n\tsum_of_square = (range.map{|x| x ** 2}).reduce(:+)\n\tsquare_of_sum - sum_of_square\nend",
"def _reduce_593(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def to_sxp_bin\n @operands.map(&:to_sxp_bin)\n end",
"def decode(c)\n i = interlace(c)\n a = i >> @b_size\n b = (i ^ (a << @b_size))\n [a, b]\n end"
] | [
"0.53129953",
"0.51936966",
"0.5123207",
"0.5123207",
"0.5113586",
"0.50973785",
"0.50620395",
"0.5046364",
"0.50194764",
"0.5015838",
"0.5008503",
"0.5004842",
"0.49989852",
"0.4994211",
"0.49884263",
"0.497221",
"0.4961087",
"0.49530277",
"0.49439105",
"0.4938097",
"0.4936716",
"0.48902306",
"0.48826024",
"0.4875211",
"0.48491544",
"0.48293912",
"0.4817249",
"0.4792278",
"0.4784338",
"0.4784338",
"0.47809136",
"0.47800732",
"0.47789764",
"0.4777963",
"0.47644106",
"0.47486225",
"0.47383898",
"0.47360718",
"0.47346658",
"0.47326887",
"0.4726252",
"0.4724351",
"0.4722841",
"0.4721743",
"0.47213247",
"0.47094578",
"0.47045082",
"0.4681923",
"0.46798307",
"0.46793732",
"0.4678854",
"0.46779206",
"0.4660068",
"0.4642717",
"0.46313667",
"0.46289524",
"0.4626252",
"0.46218306",
"0.46161893",
"0.46152377",
"0.46119824",
"0.4606641",
"0.45989838",
"0.45983455",
"0.45915067",
"0.45792112",
"0.45792112",
"0.4577105",
"0.45692185",
"0.45665354",
"0.45612383",
"0.4559318",
"0.45526716",
"0.45514935",
"0.45471355",
"0.45447895",
"0.45298308",
"0.4524155",
"0.45130664",
"0.4507574",
"0.4506514",
"0.45054892",
"0.45047346",
"0.45038936",
"0.45029753",
"0.4496204",
"0.449266",
"0.4492408",
"0.44882497",
"0.44851285",
"0.44792974",
"0.44791692",
"0.44789788",
"0.44782248",
"0.44771078",
"0.4470231",
"0.446838",
"0.44673896",
"0.44669002",
"0.4459405"
] | 0.5961378 | 0 |
This method is called after all identities have been moved from `other` to `self`, but before `other` has been destroyed and before the end of the transaction. By default, it does nothing. | def perform_additional_merge_operations!(other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap_with(other)\n self.class.base_class.transaction do\n old_position = position\n update_attribute(:position, other.position)\n other.update_attribute(:position, old_position)\n end\n end",
"def absorb other\n self.about = other.about if self.about.blank?\n other.touched_pointers.each { |ref| touch ref.entity, ref.in_collection }\n other.followees.each { |followee| self.add_followee followee }\n other.followers.each { |follower| follower.add_followee self }\n other.votings.each { |voting| vote(voting.entity, voting.up) } # Transfer all the other's votes\n super\n end",
"def commit_transaction\n # The relation graph handling is a bit tricky. We resolve the graphs\n # exclusively using self (NOT other) because if 'other' was a new\n # task, it has been already moved to the new plan (and its relation\n # graph resolution is using the new plan's new graphs already)\n\n super\n\n if @executable != __getobj__.instance_variable_get(:@executable)\n __getobj__.executable = @executable\n end\n\n finalization_handlers.each do |handler|\n __getobj__.when_finalized(handler.as_options, &handler.block)\n end\n end",
"def hand_off_to!(other)\n verify_hand_off_to(other)\n other.children.replace children\n other.parent = parent\n @children = EmptyClass\n @parent = nil\n end",
"def trust(other)\n active_relationships.create(trusted_by_id: other.id)\n end",
"def discard_transaction\n\t clear_relations\n\tend",
"def rearrange\n yield\n other = Tag.where(id: self.other_id).first\n operation = self.operation\n self.operation = self.other_id = nil\n\n begin\n case operation\n when 'nest_under'\n self.update_attribute :parent_id, other.id\n self.update_attribute :siblings_position, 0\n raise 'Cyclic nesting!' if other.parent_id == id\n when 'move_above'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position - 1\n when 'move_below'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position + 1\n end\n rescue\n self.errors.add :other_id, INVALID_TAG_OPERATION\n raise ActiveRecord::Rollback\n end\n end",
"def merge(other_user)\n return unless other_user.instance_of? User\n return if !self.auth_token.blank? and other_user.auth_token.blank? and self.auth_token != other_user.auth_token\n\n attribute_set('auth_token', auth_token || other_user.auth_token)\n\n reservations_to_move = other_user.reservations\n reservations_to_move.update({:user_id => id})\n reservations.concat(reservations_to_move).save\n reservations.reload\n reservations_to_move.reload\n\n participations_to_move = other_user.participations\n participations_to_move.update({:user_id => id})\n participations.concat(participations_to_move).save\n participations.reload\n participations_to_move.reload\n self\n end",
"def simpleMergeAfter(otherMachine)\n\t\tself.merge(otherMachine)\n\t\tlink(otherMachine.states[otherMachine.last], @first)\n\t\t@first = otherMachine.first\n\n\t\tself\n\tend",
"def graft!(other)\n verify_graft(other)\n other.parent = parent\n parent.children.add other\n parent.children.delete self\n end",
"def absorb other\n other.toucher_pointers.each { |ref| ref.user.touch self, ref.in_collection }\n super if defined? super\n end",
"def end_transaction\n @connection = @auth_token = @version = nil\n end",
"def hand_off_to!(other)\n verify_hand_off_to(other)\n\n other.normal_children.replace normal_children\n other.fallback_child = fallback_child\n @normal_children = []\n @fallback_child = nil\n if parent\n if normal?\n parent.normal_children.delete(self)\n parent.normal_children << other\n else\n parent.fallback_child = other\n end\n other.parent = parent\n @parent = nil\n end\n end",
"def move_below(other)\n if position > other.position\n new_position = other.position + 1\n other.lower_siblings.where(:position.lt => self.position).each { |s| s.inc(:position, 1) }\n self.position = new_position\n save!\n else\n new_position = other.position\n other.higher_siblings.where(:position.gt => self.position).each { |s| s.inc(:position, -1) }\n other.inc(:position, -1)\n self.position = new_position\n save!\n end\n end",
"def discard_transaction\n\t clear_vertex\n\t super if defined? super\n\tend",
"def commit_transaction\n\t real_object = __getobj__\n\t partition_new_old_relations(:parent_objects) do |trsc_objects, rel, new, del, existing|\n\t\tfor other in new\n\t\t other.add_child_object(real_object, rel, trsc_objects[other][self, rel])\n\t\tend\n\t\tfor other in del\n\t\t other.remove_child_object(real_object, rel)\n\t\tend\n for other in existing\n other[real_object, rel] = trsc_objects[other][self, rel]\n end\n\t end\n\n\t partition_new_old_relations(:child_objects) do |trsc_objects, rel, new, del, existing|\n\t\tfor other in new\n\t\t real_object.add_child_object(other, rel, self[trsc_objects[other], rel])\n\t\tend\n\t\tfor other in del\n\t\t real_object.remove_child_object(other, rel)\n\t\tend\n for other in existing\n real_object[other, rel] = self[trsc_objects[other], rel]\n end\n\t end\n\n super\n\n if @executable != __getobj__.instance_variable_get(:@executable)\n __getobj__.executable = @executable\n end\n\n finalization_handlers.each do |handler|\n __getobj__.when_finalized(handler.as_options, &handler.block)\n end\n end",
"def within_transaction(object); end",
"def within_transaction; end",
"def within_transaction; end",
"def orphan_self_and_children\n self.class.transaction do\n orphan_children\n orphan\n end\n end",
"def linkAfter(other)\n reparent(self.parent, other.next)\n end",
"def rollback\n objects.clear\n load\n finish_transaction\n end",
"def end_transaction!\n @in_transaction = false\n end",
"def after_destroy\n super\n touch_associations\n end",
"def undo\n\t\t@space.entities.delete @clone\n\t\t\n\t\t@already_added = false\n\tend",
"def <=>(other)\r\n self.id <=> other.id\r\n end",
"def void_last_transaction\n @total-=self.total\n end",
"def union!(other)\n redis.sunionstore key, key, other.key\n ensure\n notify_changed\n end",
"def replace(other)\n if loaded?\n orphan_resources(self)\n end\n other = other.map { |r| r.kind_of?(Hash) ? new(r) : r }\n relate_resources(other)\n super(other)\n end",
"def reload\n super\n self.alt_identities_changed = false\n end",
"def cleanup_old_person\n\t\tself.person_was.destroy if self.person_was && self.person_was.show_positions.count == 0 && self.person_was.netid.blank?\n\tend",
"def fire_duplicate_id(old_entity, new_entity); end",
"def destroy\n Segment.find_by_guid(source.guid).destroy if source && Segment.find_by_guid(source.guid)\n Segment.find_by_guid(target.guid).destroy if target && Segment.find_by_guid(target.guid)\n successors.each {|successor| NetworkConnection.find_by_guid(successor.guid).destroy if successor}\n super\n end",
"def addto!(other)\n\t\treplace(addto(other))\n\tend",
"def delete(other)\n other = coerce(other)\n delete_left(other).join(delete_right(other))\n end",
"def move_above(other)\n if position > other.position\n new_position = other.position\n other.lower_siblings.where(:position.lt => self.position).each { |s| s.inc(:position, 1) }\n other.inc(:position, 1)\n self.position = new_position\n save!\n else\n new_position = other.position - 1\n other.higher_siblings.where(:position.gt => self.position).each { |s| s.inc(:position, -1) }\n self.position = new_position\n save!\n end\n end",
"def absorb other\n return true if !other.page_ref || (other.id == id)\n puts \"PageRef ##{page_ref ? page_ref.id : '<null>'} absorbing #{other.page_ref ? other.page_ref.id : '<null>'}\"\n if page_ref\n PageRefServices.new(page_ref).absorb other.page_ref\n else\n self.page_ref = other.page_ref\n end\n super if defined? super\n end",
"def merge(other_person)\n # Consider just using straight SQL for this --\n # it's not complicated, and the current process generates an\n # enormous amount of SQL\n\n ActiveSupport::Notifications.instrument(\n \"merge.people.admin.racing_on_rails\",\n person_id: id,\n person_name: name,\n other_id: other_person.try(:id),\n other_name: other_person.try(:name)\n ) do\n\n if other_person.nil? || other_person == self\n ActiveSupport::Notifications.instrument(\n \"failure.merge.people.admin.racing_on_rails\",\n person_id: id,\n person_name: name,\n other_id: other_person.try(:id),\n other_name: other_person.try(:name),\n )\n return false\n end\n\n Person.transaction do\n self.merge_version do\n if login.blank? && other_person.login.present?\n self.login = other_person.login\n self.crypted_password = other_person.crypted_password\n other_person.skip_version do\n other_person.update login: nil\n end\n end\n if member_from.nil? || (other_person.member_from && other_person.member_from < member_from)\n self.member_from = other_person.member_from\n end\n if member_to.nil? || (other_person.member_to && other_person.member_to > member_to)\n self.member_to = other_person.member_to\n end\n\n if license.blank?\n self.license = other_person.license\n end\n\n save!\n aliases << other_person.aliases\n events << other_person.events\n names << other_person.names\n results << other_person.results\n race_numbers << other_person.race_numbers\n\n begin\n versions << other_person.versions\n rescue ActiveRecord::SerializationTypeMismatch => e\n logger.error e\n end\n\n versions.sort_by(&:created_at).each_with_index do |version, index|\n version.number = index + 2\n version.save!\n end\n\n Person.delete other_person.id\n existing_alias = aliases.detect{ |a| a.name.casecmp(other_person.name) == 0 }\n if existing_alias.nil? and Person.find_all_by_name(other_person.name).empty?\n aliases.create(name: other_person.name)\n end\n end\n end\n\n ActiveSupport::Notifications.instrument(\n \"success.merge.people.admin.racing_on_rails\",\n person_id: id,\n person_name: name,\n other_id: other_person.try(:id),\n other_name: other_person.try(:name),\n )\n\n true\n end\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 undo\n transaction do\n undoables = self.class.find(:not_undone, :all, :to => self.id, :include => :changes)\n raise Stale unless undoables.include? self\n undoables.each do |op|\n op.changes.each { |change| change.undo }\n op.undone = true\n op.save!\n end\n end\n end",
"def <=>(other)\n our_id_value = self.to_i\n if other.is_a?(self.class)\n other_id_value = other.to_i\n else\n other_id_value = other.to_i\n end\n\n our_id_value.<=>(other_id_value)\n end",
"def <=>(other)\n id <=> other.id\n end",
"def initialize_copy(other)\n super\n @associations = Hash[@associations] if @associations\n self\n end",
"def void_last_transaction\n self.total -= @last_transaction.pop\n end",
"def before_destroy # already protected by a transaction\n return if self[right_col_name].nil? || self[left_col_name].nil?\n self.reload # in case a concurrent move has altered the indexes\n dif = self[right_col_name] - self[left_col_name] + 1\n base_set_class.delete_all( \"#{scope_condition} AND (#{left_col_name} BETWEEN #{self[left_col_name]} AND #{self[right_col_name]})\" )\n base_set_class.update_all(\"#{left_col_name} = CASE \\\n WHEN #{left_col_name} > #{self[right_col_name]} THEN (#{left_col_name} - #{dif}) \\\n ELSE #{left_col_name} END, \\\n #{right_col_name} = CASE \\\n WHEN #{right_col_name} > #{self[right_col_name]} THEN (#{right_col_name} - #{dif} ) \\\n ELSE #{right_col_name} END\",\n scope_condition)\n end",
"def merge!(other)\n other.each do |name, _|\n unless @inverse[name] then\n @map << name\n @inverse[name] = @map.length - 1\n end\n end\n end",
"def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end",
"def transfer_sold_to_child\n return unless self.inventory_units.sold.count > 0\n sold_units = self.inventory_units.sold.all\n sold_units.each { |u| self.inventory_units.delete(u) }\n self.create_child(sold_units)\n end",
"def after_deleted\n self.update_associated_count\n end",
"def retire\n self.class.transaction do\n self.reagent_ids = []\n self.device_ownership_ids = []\n self.lab_id = nil\n self.department_id = nil\n self.institute_id = nil\n self.approved = false\n self.joined = nil\n end\n end",
"def end_transaction\n case @transaction_stack.length\n when 0\n PEROBS.log.fatal 'No ongoing transaction to end'\n when 1\n # All transactions completed successfully. Write all modified objects\n # into the backend storage.\n @transaction_stack.pop.each { |id| @transaction_objects[id]._sync }\n @transaction_objects = ::Hash.new\n @transaction_thread = nil\n else\n # A nested transaction completed successfully. We add the list of\n # modified objects to the list of the enclosing transaction.\n transactions = @transaction_stack.pop\n # Merge the two lists\n @transaction_stack.push(@transaction_stack.pop + transactions)\n # Ensure that each object ID is only included once in the list.\n @transaction_stack.last.uniq!\n end\n end",
"def merge!(other_order, user = nil)\n if other_order.currency == order.currency\n other_order.line_items.each do |other_order_line_item|\n current_line_item = find_matching_line_item(other_order_line_item)\n handle_merge(current_line_item, other_order_line_item)\n end\n end\n\n set_user(user)\n persist_merge\n\n # So that the destroy doesn't take out line items which may have been re-assigned\n other_order.line_items.reload\n other_order.destroy\n end",
"def set_other\n @other = Other.find(params[:id])\n end",
"def nullify\n target.send(metadata.foreign_key_setter, nil)\n target.send(:remove_instance_variable, \"@#{metadata.inverse(target)}\")\n base.send(:remove_instance_variable, \"@#{metadata.name}\")\n target.save\n end",
"def _post_transaction_rewind\n @objects.each { |e| e.instance_variable_set(:@parent,self) }\n end",
"def rollback\n each {|transition| transition.machine.write(object, :event, transition.event)}\n super\n end",
"def mark_as_unseen_by_other(community_id:, transaction_id:, person_id:)\n tx_model = TransactionModel.where(community_id: community_id, id: transaction_id).first\n do_mark_as_unseen_by_other(tx_model, person_id) if tx_model\n\n nil\n end",
"def mark_as_unseen_by_other(community_id:, transaction_id:, person_id:)\n tx_model = TransactionModel.where(community_id: community_id, id: transaction_id).first\n do_mark_as_unseen_by_other(tx_model, person_id) if tx_model\n\n nil\n end",
"def delete\n return super unless mti_class?\n shard_wrangler.class.cascade_delete_all(:id => id)\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def redo_in_transaction\n self.in_transaction = true\n ActiveRecord::Base.transaction { src_obj.replicate(self) }\n end",
"def finalize\n @entities.clear\n end",
"def destroy\n authorize @other\n @other.destroy\n respond_to do |format|\n format.html { redirect_to others_url, notice: t('Record has been deleted') }\n format.json { head :no_content }\n end\n end",
"def after\n each {|transition| transition.machine.write(object, :event_transition, transition)} if skip_after && success?\n super\n end",
"def merge_records(from, to)\n return false if from == to\n transaction do\n reflect_on_all_associations.each{|reflection| reflection_merge(reflection, from, to)}\n destroy(from)\n end\n true\n end",
"def transaction_done\n puts \".........\" + self.class.name + \" has been notified\"\n end",
"def after_transition(order, transition)\n if transition.attributes[:event].to_s == \"complete\" && order.user\n if order.bill_address.id && order.ship_address.id\n order.user.update_attributes!(\n :bill_address_id => order.bill_address.id,\n :ship_address_id => order.ship_address.id\n )\n end\n end\n end",
"def destroy\n final_parent.delete(source.statements)\n\n parent.statements.each do |statement|\n parent.delete_statement(statement) if\n statement.subject == source.rdf_subject || \n statement.object == source.rdf_subject\n end\n\n super { source.clear }\n end",
"def replace!\n self.class.transaction do\n person.update_attribute :shopping_cart_id, nil\n person.shopping_cart # autocreates shopping cart\n end\n end",
"def move_entity entity; end",
"def rollback\n super\n each { |transition| transition.machine.write(object, :event, transition.event) unless transition.transient? }\n end",
"def after_suspended\n self.update_associated_count\n end",
"def disconnect!\n clear_cache!\n reset_transaction\n end",
"def initialize_copy(other)\n # Think the assertion which fails if the after_initialize callback goes at the end of the method is wrong. The\n # deleted clone method called new which therefore called the after_initialize callback. It then went on to copy\n # over the attributes. But if it's copying the attributes afterwards then it hasn't finished initializing right?\n # For example in the test suite the topic model's after_initialize method sets the author_email_address to\n # test@test.com. I would have thought this would mean that all cloned models would have an author email address\n # of test@test.com. However the test_clone test method seems to test that this is not the case. As a result the\n # after_initialize callback has to be run *before* the copying of the atrributes rather than afterwards in order\n # for all tests to pass. This makes no sense to me.\n callback(:after_initialize) if respond_to_without_attributes?(:after_initialize)\n cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)\n # CPK\n #cloned_attributes.delete(self.class.primary_key)\n self.class.primary_key.each {|key| cloned_attributes.delete(key.to_s)}\n\n @attributes = cloned_attributes\n clear_aggregation_cache\n @attributes_cache = {}\n @new_record = true\n ensure_proper_type\n\n if scope = self.class.send(:current_scoped_methods)\n create_with = scope.scope_for_create\n create_with.each { |att,value| self.send(\"#{att}=\", value) } if create_with\n end\n end",
"def merge(other)\n role_set.merge other\n self\n end",
"def end_donorship_With(other_user)\n self.active_donorship.destroy\n end",
"def move_sales_line\r\n=begin\r\n sales_line = ERP::SalesLine.find params[:id]\r\n @original_order_id = sales_line.erp_sales_order_id\r\n sales_line.update_attribute :erp_sales_order_id, params[:target]\r\n \r\n mark_as_unsync [@original_order_id, params[:target]]\r\n=end\r\n @sales_line = ERP::SalesLine.find params[:id]\r\n @store_user.my_account_log(@sales_line,\"Move Sales Line #{@sales_line.invent_trans_id} From #{@sales_line.sales_order.sales_id}\")\r\n if @sales_line && @sales_line.sales_order.erp_customer_id == @customer.id\r\n @sales_line.move_to_order @customer.sales_orders.find( params[:target] )\r\n end\r\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def void_last_transaction\n self.total = self.total - self.last_transaction\n end",
"def void_last_transaction\n self.total = self.total - self.last_transaction\n end",
"def void_last_transaction\n self.total = self.total - self.last_transaction\n end",
"def linkBefore(other)\n reparent(self.parent, other)\n end",
"def after_complete\n session[:order_id] = nil\n end",
"def after_complete\n session[:order_id] = nil\n end",
"def after_complete\n session[:order_id] = nil\n end",
"def delete_left(other)\n left.delete(other.project(left.header))\n end",
"def merge_other_records!(*other_members)\n transaction do\n # Write an audit\n self.audits << Audited::Audit.new({ action: 'merge', comment: { current_member: self.audits.as_json, other_members: other_members.map { |m| m.audits.as_json } }.to_json })\n\n ### Deal with special cases\n # Subscriptions: If either member is subbed to a subscription, then make the merge subbed\n subs = {}\n member_subs = other_members.map { |m| m.member_subscriptions }.flatten + self.member_subscriptions\n member_subs.each do |ms|\n # Once any ms.unsubscribed_at is not present, the value will remain true\n subs[ms.subscription_id] = subs[ms.subscription_id] || ms.unsubscribed_at.blank?\n ms.destroy!\n end\n\n reason = 'admin:merge_records'\n subs.each do |subscription_id, subbed|\n if subbed\n self.subscribe_to(Subscription.find(subscription_id), reason: reason)\n else\n self.unsubscribe_from(Subscription.find(subscription_id), reason: reason)\n end\n end\n\n # Delete area_memberships\n [self, *other_members].each { |m| m.areas.delete_all }\n\n # Call the catch-all merge method:\n self.merge!(*other_members)\n\n # update areas\n self.update_areas\n end\n end",
"def destroy\n return super unless mti_class?\n shard_wrangler.destroy\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end",
"def validate_sibling!(other)\n unless other.is_a?(tree.base_class)\n message = \"#{tree.base_class.name} expected, got #{other.class.name}\"\n raise ActiveRecord::AssociationTypeMismatch, message\n end\n\n other.ordered_tree_node\n end",
"def old_couple\n @old_couple = @students_id - @pair\n @students_id.delete(@pair)\n end",
"def merge!(other_database)\n database.merge!(other_database.__send__(:database))\n other_database.removed_keys.each { |key| unset_value(key) }\n end",
"def unlink(other)\n self.class.graph.disjoin(vertex, other.vertex)\n end",
"def be_replacement_for_others\n unless self.connection_id.blank? or self.id.blank?\n cases_to_replace = self.class.where(replaced_by_id:0).where(connection_id:self.connection_id).all\n cases_to_replace.each{|kase| kase.update_attributes(replaced_by_id:self.id) }\n end\n end",
"def merge!(other)\n @products+=other.products\n @products=@products.uniq{|p| p.ean}\n init_vault\n self\n end",
"def absorb other\n # Take taggings from the other taggable\n other.taggings.map { |tagging| tag_with tagging.tag, tagging.user_id }\n super if defined? super\n end",
"def transact\n history_backup = @agent.history.dup\n begin\n yield self\n ensure\n @agent.history = history_backup\n end\n end"
] | [
"0.5760911",
"0.5438817",
"0.53730154",
"0.5307102",
"0.52858746",
"0.5108874",
"0.51039845",
"0.5095332",
"0.50722384",
"0.50710714",
"0.5052705",
"0.5049128",
"0.50425255",
"0.5033477",
"0.50249666",
"0.5020485",
"0.50151",
"0.5012812",
"0.5012812",
"0.50072485",
"0.4974553",
"0.497371",
"0.4962144",
"0.49546614",
"0.49411345",
"0.49392992",
"0.4931581",
"0.4927898",
"0.49006477",
"0.48973528",
"0.4889908",
"0.48898107",
"0.488856",
"0.4886564",
"0.4843114",
"0.48345184",
"0.4816533",
"0.48158878",
"0.48139632",
"0.47942844",
"0.4777691",
"0.4753395",
"0.4753073",
"0.47499228",
"0.47393665",
"0.4735737",
"0.47353375",
"0.4733468",
"0.47284555",
"0.471956",
"0.47162044",
"0.47160172",
"0.47125286",
"0.47115353",
"0.4707332",
"0.47024092",
"0.47021765",
"0.47021765",
"0.4699056",
"0.46818072",
"0.46815604",
"0.46809307",
"0.466695",
"0.46608353",
"0.4637781",
"0.46341896",
"0.46333492",
"0.46295395",
"0.46227372",
"0.46205062",
"0.4619656",
"0.46189746",
"0.46121475",
"0.46110585",
"0.46103874",
"0.45948607",
"0.45885295",
"0.45885295",
"0.4586448",
"0.4586448",
"0.4586448",
"0.45816165",
"0.45784435",
"0.45784435",
"0.45784435",
"0.45766914",
"0.45765638",
"0.45675802",
"0.45654708",
"0.45654708",
"0.45654708",
"0.45620996",
"0.45531914",
"0.45513925",
"0.45505688",
"0.45482248",
"0.4539244",
"0.45378828",
"0.45360714",
"0.45281968"
] | 0.48784542 | 34 |
GET /shipping_options/1 GET /shipping_options/1.json | def show
@shipping_option = ShippingOption.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @shipping_option }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipping_options\n Hash.new\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def shipping_fee\n @admin_options = Admin::Option.where(\"id = ?\" , 44) \n end",
"def shipping\n @data[:shipping]\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :created, location: @shipping_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping\n cart = Cart.new(request.cookies[\"cart\"])\n cart.set_extra_data(params)\n shipping_methods = ShippingMethod.lookup_methods(cart)\n render :json => shipping_methods\n end",
"def shipping\n adjustments.find { |a| a.type == \"shipping-method\" }\n end",
"def show\n @shipping = scope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping }\n end\n end",
"def show\n @channel_shipping_service = ChannelShippingService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @channel_shipping_service }\n end\n end",
"def shipping_params\n params[:shipping]\n end",
"def index\n @shipping_services = ShippingService.all\n end",
"def update\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n if @shipping_option.update_attributes(params[:shipping_option])\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def resource_url\n \"orders/#{self.order_id}/shipping_addresses\"\n end",
"def minimal_gateway_options\n {:email => order.user.email, \n :customer => order.user.email, \n :ip => order.ip_address, \n :order_id => order.number,\n :shipping => order.ship_amount * 100,\n :tax => order.tax_amount * 100, \n :subtotal => order.item_total * 100} \n end",
"def index\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_addresses = @subscriber.shipping_addresses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shipping_addresses }\n end\n end",
"def resource_url\n \"orders/#{self.order_id}/shippingaddresses\"\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => \"#{billing_address.first_name} #{billing_address.last_name}\",\n :address1 => billing_address.address,\n :city => billing_address.city,\n :state => billing_address.state,\n :country => \"US\",\n :zip => billing_address.zip\n },\n :tax => tax_in_cents,\n :order_id => self.id\n }\n end",
"def destroy\n @shipping_option = ShippingOption.find(params[:id])\n @shipping_option.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_options_url }\n format.json { head :no_content }\n end\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n end",
"def set_shipping_detail\n @shipping_detail = ShippingDetail.find(params[:id])\n end",
"def show\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.find_by_id(params[:id])\n\n if @shipping_address\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_address }\n end\n else\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.json { render json: @shipping_address }\n end\n end\n end",
"def shipping_methods\n [\"Next Day Shipping\", \"2 Day Shipping\",\"Ground Service\"]\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => name,\n :address1 => address,\n :city => city,\n :state => state,\n :country => country,\n :zip => zip\n }\n }\n end",
"def index\n @shipping_methods = ShippingMethod.page params[:page]\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n end",
"def set_shipping_service\n @shipping_service = ShippingService.find(params[:id])\n end",
"def index\n @shipping_details = ShippingDetail.all\n end",
"def set_shipping_method\n @shipping_method = ShippingMethod.find(params[:id])\n end",
"def status_shipping_params\n params.fetch(:status_shipping, {})\n end",
"def set_status_shipping\n @status_shipping = StatusShipping.find(params[:id])\n end",
"def shipping_options_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"ats-wis-shippingoptionslbl\")), __method__)\n end",
"def purchase_options\n {\n :billing_address => {\n :address1 => @address,\n :city => @city,\n :state => @state,\n :country => \"US\",\n :zip => @zip\n }\n }\n end",
"def shipping\n to_price mapping_for(:shipping)\n end",
"def shipping_item\n shipping_scope.first || shipping_scope.build(shipping_options)\n end",
"def show\n option = Option.find_by domain: params[:shop]\n add_cors_headers\n render json: {option: option.as_json(:except => [:created_at, :updated_at, :domain])}, status: :ok\n end",
"def available_shipping_methods\n return ShippingMethod.none unless has_shipping?\n ids = order_items.map { |item| item.product.available_shipping_methods.pluck(:id) }.inject(:&)\n store.shipping_methods.where(id: ids)\n end",
"def set_shipping_information\n @shipping_information = ShippingInformation.find(params[:id])\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n authorized_shipping\n end",
"def shipping_method_code\n hash [\"ShippingMethodCode\"]\n end",
"def show\n @service = Service.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { \n render :json => @service.to_json(:methods => [:polyline],:only => [:shipment]) \n }\n end\n end",
"def by_cube opts\n opts.merge!('method': '3')\n \tresp = perform_request(:get, '/api/shipping', {}, opts)\n \tDeliveright::ShippingQuote.new(resp)\n end",
"def options\n\t\t@options = {\n\t\t\t:ip => ip,\n\t\t\t:email => self.email,\n\t\t\t:description => \"Author: #{self.sku.items.first.owner.id} #{self.sku.items.first.owner.pen_name} SKU: #{self.sku.id} #{self.sku.title}\",\n\t\t\t:billing_address => {\n\t\t\t\t:name => self.billing_address.name,\n\t\t\t\t:address1 => self.billing_address.street,\n\t\t\t\t:address2 => self.billing_address.street2,\n\t\t\t\t:city => self.billing_address.city,\n\t\t\t\t:state => self.billing_address.state,\n\t\t\t\t:zip => self.billing_address.zip,\n\t\t\t\t:country => self.billing_address.country,\n\t\t\t\t:phone => self.billing_address.phone\n\t\t\t}\n\t\t}\n\tend",
"def set_add_shipping\n @add_shipping = AddShipping.find(params[:id])\n end",
"def shipping_method\n object.shipping_method.try(:name)\n end",
"def shipping_address_edit\n @shipping_address = retrieve_shipping_address(@subscription_id)\n @country_codes = get_country_codes\n end",
"def new\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def index\n @shipping_informations = ShippingInformation.all\n end",
"def index\n @billing_options = BillingOption.all\n end",
"def get_options; end",
"def shipping_method\n @shipping_methods = @order.available_shipping_methods\n @shipping_method = @shipping_methods.find(params[:method_id])\n if @shipping_method.shipping_gateway.present?\n @shipping_gateway = @shipping_method.shipping_gateway_class.new(order: @order)\n @data = @shipping_gateway.prepare_interface_data(params)\n else\n @shipping_gateway = nil\n end\n rescue => e\n flash.now[:error] = e.message\n head :unprocessable_entity\n end",
"def index\n @shipping_lines = ShippingLine.all\n end",
"def shipping_address\n @shipping_addresses = ShippingAddress.all.order('id DESC')\n render :template => \"backend/ShippingAddress/shipping_address\"\n end",
"def serializable_shipping\n if shipping = self.shipping?\n shipping_hash = ActiveSupport::HashWithIndifferentAccess.new\n shipping_hash[:local_pick_up] = shipping.local_pick_up?.to_bool # FORCE Boolean\n\n # if shipping.free_shipping?\n # shipping_hash[:free_shipping ] = shipping.free_shipping.to_bool # FORCE Boolean\n # end\n\n case shipping_hash[:mode] = shipping.mode?\n when \"me1\"\n # code here\n when \"me2\"\n # code here\n\n # when \"custom\"\n # TO FIX: https://gist.github.com/gullitmiranda/2ba389dbb5bbf3378c8f#file-shipping_custom-json\n # shipping_hash[:costs] = (shipping.costs? || []).map do |cost|\n # {\n # name: cost.name?,\n # cost: cost.cost?.to_f # FORCE Float\n # }\n # end\n else\n shipping_hash.delete(:mode)\n end\n\n shipping_hash[:dimensions] = shipping.dimensions? if shipping.dimensions?\n\n shipping_hash\n end\n end",
"def new\n @channel_shipping_service = ChannelShippingService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_shipping_service }\n end\n end",
"def orders_create_shipping_with_http_info(id, shipping_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_create_shipping ...'\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 ShippingsApi.orders_create_shipping\"\n end\n # verify the required parameter 'shipping_request' is set\n if @api_client.config.client_side_validation && shipping_request.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_create_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines'.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/vnd.conekta-v2.1.0+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[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_create_shipping\",\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: ShippingsApi#orders_create_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @shipping_cost = ShippingCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shipping_cost }\n end\n end",
"def shipping_methods\n @retailer = Retailer.find(params[:retailer_id])\n @shipping_methods = Spree::ShippingMethod.all\n end",
"def shipping_option_buttons\n $tracer.trace(format_method(__method__))\n #return GameStopShippingRadioButtons.new(@tag.td.className(create_ats_regex_string('ats-shipopts')))\n return GameStopRadioButtons.new(@tag.input.id(\"SelectedShippingOption\"))\n end",
"def index\n @add_shippings = AddShipping.all\n end",
"def index\n @product_option_typeships = ProductOptionTypeship.all\n end",
"def show\n @shipping_term = ShippingTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shipping_term }\n end\n end",
"def shipping_address\n source = shipping_address_customization || order\n source.shipping_address\n end",
"def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def index\n @status_shippings = StatusShipping.all\n end",
"def retrieve_shipping_address(subscription_id) \n begin\n result = ChargeBee::Address.retrieve({ :subscription_id => subscription_id,\n :label => \"shipping_address\"\n })\n return result.address\n rescue ChargeBee::InvalidRequestError => e \n if e.api_error_code == \"resource_not_found\"\n return nil\n else \n throw e\n end\n end\n end",
"def shipping_method\n #shipping = Shipping.find(self.shipping_method_id)\n self.shipping.display_text\n end",
"def show\n @orders = Order.paginate(page: params[:orders_page], per_page: 5).with_current_status().by_customer_id(params[:id])\n @shipping_address = ShippingAddress.new\n end",
"def get_payment_options\n \n po = @data.payment_option\n\n options = PaymentMethod.options\n options.each do |option|\n method = option['pay_method']\n if po.pay_method == method\n option['checked'] = ' checked'\n option[\"pay_ref_#{method}\"] = po.pay_ref\n else\n option['checked'] = ''\n option[\"pay_ref_#{method}\"] = \"\"\n end\n end\n options\n end",
"def shipping_address\n [name_tb.value,address1_tb.value,address2_tb.value,city_tb.value,state_tb.value,country_select.first_selected_option.text,zip_tb.value,phone_tb.value,power_adapter_select.first_selected_option.text]\n end",
"def options\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: '' }\n end\n end",
"def order_opts(order, payment_method, stage)\n items = order.line_items.map do |item|\n price = (item.price * 100).to_i # convert for gateway\n { :name => item.variant.product.name,\n :description => (item.variant.product.description[0..120] if item.variant.product.description),\n :sku => item.variant.sku,\n :quantity => item.quantity,\n :amount => price,\n :weight => item.variant.weight,\n :height => item.variant.height,\n :width => item.variant.width,\n :depth => item.variant.weight }\n end\n\n credits = order.adjustments.map do |credit|\n if credit.amount < 0.00\n { :name => credit.label,\n :description => credit.label,\n :sku => credit.id,\n :quantity => 1,\n :amount => (credit.amount*100).to_i }\n end\n end\n\n credits_total = 0\n credits.compact!\n if credits.present?\n items.concat credits\n credits_total = credits.map {|i| i[:amount] * i[:quantity] }.sum\n end\n\n if params[:host_with_port].nil?\n params[:host_with_port] = request.host_with_port\n end\n\n opts = { :return_url => request.protocol + params[:host_with_port] + \"/confirm/\" + \"orders/#{order.number}/checkout/paypal_confirm?payment_method_id=#{payment_method}\",\n :cancel_return_url => request.protocol + params[:host_with_port] + \"/\" + \"orders/#{order.number}/edit\",\n :order_id => order.number,\n :custom => order.number,\n :items => items,\n :subtotal => ((order.item_total * 100) + credits_total).to_i,\n :tax => ((order.adjustments.map { |a| a.amount if ( a.source_type == 'Order' && a.label == 'Tax') }.compact.sum) * 100 ).to_i,\n :shipping => ((order.adjustments.map { |a| a.amount if a.source_type == 'Shipment' }.compact.sum) * 100 ).to_i,\n :money => (order.total * 100 ).to_i }\n\n # add correct tax amount by subtracting subtotal and shipping otherwise tax = 0 -> need to check adjustments.map\n opts[:tax] = (order.total*100).to_i - opts.slice(:subtotal, :shipping).values.sum\n\n if stage == \"checkout\"\n opts[:handling] = 0\n\n opts[:callback_url] = spree_root_url + \"paypal_express_callbacks/#{order.number}\"\n opts[:callback_timeout] = 3\n elsif stage == \"payment\"\n #hack to add float rounding difference in as handling fee - prevents PayPal from rejecting orders\n #because the integer totals are different from the float based total. This is temporary and will be\n #removed once Spree's currency values are persisted as integers (normally only 1c)\n opts[:handling] = (order.total*100).to_i - opts.slice(:subtotal, :tax, :shipping).values.sum\n end\n\n opts\n end",
"def get_a_shipping_quote\n @helper.get_yaml_data('cart_shipping.yml')['shipping_quote'].each do |element, value|\n puts '==> Selecting value for ' + element\n @browser.text_field(value[:identifier],value[:element]).set value[:text] if value[:text]\n @browser.select_list(value[:identifier],value[:element]).select value[:select] if value[:select]\n end\n\n @helper.custom_click_button :title, 'Get a Quote'\n # assert_section 'cart_shipping'\n @browser.radio(:id,'s_method_ups_GND').set\n @helper.custom_click_button :title, 'Update Total'\n end",
"def shipping_scope\n fee_adjustments.shipping\n end",
"def show\n @funding_status_option = FundingStatusOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funding_status_option }\n end\n end",
"def is_free_shipping\n end",
"def sell_shipping_countries_all (params={})\r\n req = request_params({locale: @locale}.merge(params))\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def retrieval\n shipping_manifest['oil paintings']\nend",
"def gateway_options\n options = { :email => order.email,\n :customer => order.email,\n :ip => order.last_ip_address,\n :order_id => gateway_order_id } # This is the changed line\n\n options.merge!({ :shipping => order.ship_total * 100,\n :tax => order.tax_total * 100,\n :subtotal => order.item_total * 100 })\n\n options.merge!({ :currency => currency })\n\n options.merge!({ :billing_address => order.bill_address.try(:active_merchant_hash),\n :shipping_address => order.ship_address.try(:active_merchant_hash) })\n\n options.merge!(:discount => promo_total) if respond_to?(:promo_total)\n options\n end",
"def show\n @option = Option.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\n end",
"def show\n @option = Option.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\n end",
"def index\n \n load_options\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @options }\n end\n end",
"def new\n @shipping = scope.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping }\n end\n end",
"def default_shipping_class\n shipping_zone.try(:default_shipping_class)\n end",
"def get_options_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OptionsApi.get_options ...\"\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling OptionsApi.get_options\"\n end\n if @api_client.config.client_side_validation && opts[:'type'] && !['call', 'put'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of call, put'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling OptionsApi.get_options, must be smaller than or equal to 10000.'\n end\n\n # resource path\n local_var_path = \"/options/{symbol}\".sub('{' + 'symbol' + '}', symbol.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'strike'] = opts[:'strike'] if !opts[:'strike'].nil?\n query_params[:'strike_greater_than'] = opts[:'strike_greater_than'] if !opts[:'strike_greater_than'].nil?\n query_params[:'strike_less_than'] = opts[:'strike_less_than'] if !opts[:'strike_less_than'].nil?\n query_params[:'expiration'] = opts[:'expiration'] if !opts[:'expiration'].nil?\n query_params[:'expiration_after'] = opts[:'expiration_after'] if !opts[:'expiration_after'].nil?\n query_params[:'expiration_before'] = opts[:'expiration_before'] if !opts[:'expiration_before'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].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 = ['ApiKeyAuth']\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 => 'ApiResponseOptions')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OptionsApi#get_options\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @status_shipping = StatusShipping.new(status_shipping_params)\n\n respond_to do |format|\n if @status_shipping.save\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully created.' }\n format.json { render :show, status: :created, location: @status_shipping }\n else\n format.html { render :new }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_method_params\n # params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_categories)\n params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_category_ids => [])\n end",
"def new\n @shipping_detail = ShippingDetail.new\n @options = ''\n \n unless params[:shipping_detail].nil?\n @product = Product.find(params[:shipping_detail][:product_id])\n @question_response = QuestionResponse.find(params[:shipping_detail][:question_response_id]) \n else\n \n @params_to_pass_to_shipping_details = {}\n\n @product = Product.find(params['product_id'])\n @x = 0\n\n # Add all options\n params.each do |param|\n key = param[0]\n value = param[1]\n\n if key.start_with?('option') \n if value.end_with?('1') == true\n @current_question_option_id = @product.question_options[@x].id\n @options = @options + @current_question_option_id.to_s\n end\n @x = @x + 1\n end\n\n if key.start_with?('option') or key.start_with?('question')\n @params_to_pass_to_shipping_details[key] = value\n end\n end\n\n @question_response = QuestionResponse.new(:product_id => params['product_id'], \n :question_1 => (params[:question_1] == 'answer_1' ? 'True' : 'False'), \n :question_2 => (params[:question_2] == 'answer_5' ? 'True' : 'False'),\n :question_3 => (case params[:question_3] \n when 'answer_5' \n '1' \n when 'answer_6' \n '2'\n when 'answer_7' \n '3'\n when 'answer_8' \n '4'\n else\n '0'\n end),\n :question_4 => @options)\n \n if @question_response.valid?\n @question_response.save\n end\n end\n \n @uuid = nil\n\n # Required by uSell intergration -- Set a 30 day cookie\n if !params[:uuid].nil? # Always transfer to new UUID if uSell provides one\n cookies[:uuid] = { :value => params[:uuid], :expires => 30.day.from_now }\n @uuid = params[:uuid]\n elsif !cookies[:uuid].nil? # If a new UUID is not provided, use the ID from the cookie\n @uuid = cookies[:uuid]\n end\n \n @device = Device.new(:product_id => params['shipping_detail']['product_id'],\n :question_response_id => @question_response.id\n )\n @device.status_code = 0\n \n if @device.valid?\n @device.save\n end\n \n # Assume just 1 device per shipping details\n @shipping_detail.devices[0] = @device\n @shipping_detail.uuid = @uuid unless @uuid.nil?\n @shipping_detail.referer = params[:ref] unless params[:ref].nil?\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_detail }\n end\n end",
"def orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_update_shipping ...'\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 ShippingsApi.orders_update_shipping\"\n end\n # verify the required parameter 'shipping_id' is set\n if @api_client.config.client_side_validation && shipping_id.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_update_shipping\"\n end\n # verify the required parameter 'shipping_request' is set\n if @api_client.config.client_side_validation && shipping_request.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_update_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_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/vnd.conekta-v2.1.0+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[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_update_shipping\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ShippingsApi#orders_update_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def shipping_address\n default_shipping_address ? default_shipping_address : shipping_addresses.first\n end",
"def shipping_address\n default_shipping_address ? default_shipping_address : shipping_addresses.first\n end",
"def update\n \n @preference = get_preference()\n @preference.shop_url = session[:shopify_domain].to_s\n\n shipping_methods_long_desc_int = params.require('shipping_methods_long_desc_int').permit(:INT_PARCEL_COR_OWN_PACKAGING, :INT_PARCEL_EXP_OWN_PACKAGING, :INT_PARCEL_STD_OWN_PACKAGING, :INT_PARCEL_AIR_OWN_PACKAGING, :INT_PARCEL_SEA_OWN_PACKAGING)\n shipping_methods_allowed_int = params.require('shipping_methods_allowed_int').permit(:INT_PARCEL_COR_OWN_PACKAGING, :INT_PARCEL_EXP_OWN_PACKAGING, :INT_PARCEL_STD_OWN_PACKAGING, :INT_PARCEL_AIR_OWN_PACKAGING, :INT_PARCEL_SEA_OWN_PACKAGING)\n shipping_methods_allowed_dom = params.require('shipping_methods_allowed_dom').permit(:AUS_PARCEL_REGULAR,:AUS_PARCEL_EXPRESS,:AUS_PARCEL_REGULAR_SATCHEL_500G,:AUS_PARCEL_EXPRESS_SATCHEL_500G,:AUS_PARCEL_REGULAR_SATCHEL_3KG,:AUS_PARCEL_EXPRESS_SATCHEL_3KG,:AUS_PARCEL_REGULAR_SATCHEL_5KG, :AUS_PARCEL_EXPRESS_SATCHEL_5KG)\n shipping_methods_long_desc_dom = params.require('shipping_methods_long_desc_dom').permit(:AUS_PARCEL_REGULAR,:AUS_PARCEL_EXPRESS,:AUS_PARCEL_REGULAR_SATCHEL_500G,:AUS_PARCEL_EXPRESS_SATCHEL_500G,:AUS_PARCEL_REGULAR_SATCHEL_3KG,:AUS_PARCEL_EXPRESS_SATCHEL_3KG,:AUS_PARCEL_REGULAR_SATCHEL_5KG, :AUS_PARCEL_EXPRESS_SATCHEL_5KG)\n\n @preference[:shipping_methods_long_desc_int] = shipping_methods_long_desc_int.to_h || {}\n @preference[:shipping_methods_long_desc_dom] = shipping_methods_long_desc_dom.to_h || {}\n @preference[:shipping_methods_allowed_int] = shipping_methods_allowed_int.to_h || {}\n @preference[:shipping_methods_allowed_dom] = shipping_methods_allowed_dom.to_h || {}\n @preference.save\n\n shopify_api_shop = ShopifyAPI::Shop.current \n \n shipping_methods_long_desc_int.each do |method_name, value|\n find_or_create_metafield(shopify_api_shop, method_name, value.to_s) \n end\n \n shipping_methods_long_desc_dom.each do |method_name, value|\n find_or_create_metafield(shopify_api_shop, method_name, value.to_s) \n end\n \n\n respond_to do |format|\n @preference.attributes = preference_params\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n installer_class = carrier_installer_class_for('aus_post')\n installer = installer_class.new( session[:shopify_domain], @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_shipping.update(add_shipping_params)\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_shipping }\n else\n format.html { render :edit }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def available_shipping_methods(display_on = nil)\n return [] unless ship_address\n all_methods = Spree::ShippingMethod.all_available(self, display_on)\n puts \"ALL METHODS #{all_methods.count} #{display_on}\"\n if self.digital?\n all_methods.detect { |m| m.calculator.class == Spree::Calculator::DigitalDelivery }.try { |d| [d] } || all_methods\n else\n all_methods\n end\n end",
"def shipping_params\n params.require(:shipping).permit(:order_id, :dispute_id, :provider, :tracking_number, :note, :shop_delivery_confirmation, :user_delivery_confirmation, :surf_delivery_confirmation)\n end",
"def create\n @add_shipping = AddShipping.new(add_shipping_params)\n\n respond_to do |format|\n if @add_shipping.save\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully created.' }\n format.json { render :show, status: :created, location: @add_shipping }\n else\n format.html { render :new }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_params\n params.require(:shipping).permit(:address, :city, :state, :zip)\n end",
"def get options\n rest_request({ method: :get }.merge(options))\n end",
"def get options\n rest_request({ method: :get }.merge(options))\n end",
"def show\n @shipping_unit = ShippingUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shipping_unit }\n end\n end"
] | [
"0.72764933",
"0.7117327",
"0.6745459",
"0.6532361",
"0.64822257",
"0.63974637",
"0.6379292",
"0.6358732",
"0.6284373",
"0.6206988",
"0.6145065",
"0.61441195",
"0.61408645",
"0.61267304",
"0.6120737",
"0.6118218",
"0.6104784",
"0.6083203",
"0.6074076",
"0.6053882",
"0.6050322",
"0.6032428",
"0.6020624",
"0.60135615",
"0.60108334",
"0.6010016",
"0.598171",
"0.5973549",
"0.59716874",
"0.5961193",
"0.59572834",
"0.5934951",
"0.5926419",
"0.59247965",
"0.58651686",
"0.5844635",
"0.5838201",
"0.5828901",
"0.57924885",
"0.57919866",
"0.5775667",
"0.5768969",
"0.5767529",
"0.57538545",
"0.5741585",
"0.5729781",
"0.5715012",
"0.5713629",
"0.57128847",
"0.5678685",
"0.5663173",
"0.56548256",
"0.5652939",
"0.5652773",
"0.5647194",
"0.56436473",
"0.56398183",
"0.56328666",
"0.5624258",
"0.561981",
"0.5619778",
"0.5617075",
"0.5609796",
"0.5601295",
"0.5580001",
"0.5543101",
"0.55401796",
"0.5539644",
"0.5538398",
"0.55265313",
"0.551403",
"0.5507336",
"0.54959166",
"0.5492942",
"0.548593",
"0.5482883",
"0.5482573",
"0.54763687",
"0.5475935",
"0.5473075",
"0.5473075",
"0.54705256",
"0.54609203",
"0.5447472",
"0.5444811",
"0.5439544",
"0.54373336",
"0.543593",
"0.5434305",
"0.5430193",
"0.5430193",
"0.54298496",
"0.5414271",
"0.53907245",
"0.5385178",
"0.53721",
"0.5370592",
"0.5365198",
"0.5365198",
"0.5362691"
] | 0.76127625 | 0 |
GET /shipping_options/new GET /shipping_options/new.json | def new
@shipping_option = ShippingOption.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @shipping_option }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :created, location: @shipping_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shipping = scope.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping }\n end\n end",
"def new\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_method }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @channel_shipping_service = ChannelShippingService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_shipping_service }\n end\n end",
"def new\n # customer creates a new shipping address\n end",
"def create\n @add_shipping = AddShipping.new(add_shipping_params)\n\n respond_to do |format|\n if @add_shipping.save\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully created.' }\n format.json { render :show, status: :created, location: @add_shipping }\n else\n format.html { render :new }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shipping_cost = ShippingCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_cost }\n end\n end",
"def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end",
"def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end",
"def new\n @ship_class = ShipClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ship_class }\n end\n end",
"def create\n @status_shipping = StatusShipping.new(status_shipping_params)\n\n respond_to do |format|\n if @status_shipping.save\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully created.' }\n format.json { render :show, status: :created, location: @status_shipping }\n else\n format.html { render :new }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_detail = ShippingDetail.new(shipping_detail_params)\n\n respond_to do |format|\n if @shipping_detail.save\n format.html { redirect_to @shipping_detail, notice: 'Shipping detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shipment = Shipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipment }\n end\n end",
"def new\n @shipment = Shipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipment }\n end\n end",
"def new\n \t@order = current_order\n @shipping_address = ShippingAddress.new\n @order.update(status: \"filling in shipping address\")\n end",
"def create\n @shipping = scope.new(params[:shipping])\n\n respond_to do |format|\n if @shipping.save\n format.html { redirect_to admin_ship_out_path(@shipping), notice: 'scope was successfully created.' }\n format.json { render json: @shipping, status: :created, location: @shipping }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @delivery_method = DeliveryMethod.new\n @title = \"New Delivery Method\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_method }\n end\n end",
"def new\n \n @ship = Ship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ship }\n end\n end",
"def new\n @shipping_term = ShippingTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_term }\n end\n end",
"def new\n @delivery_address = DeliveryAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_address }\n end\n end",
"def new\n @shipment = Shipment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipment }\n end\n end",
"def shipping_options\n Hash.new\n end",
"def new\n @ship = Ship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ship }\n end\n end",
"def new\n @shipping_category = ShippingCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_category }\n end\n end",
"def new\n @free_shipping_rule = FreeShippingRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @free_shipping_rule }\n end\n end",
"def new\n @shipping_container = ShippingContainer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_container }\n end\n end",
"def new\n @funding_status_option = FundingStatusOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funding_status_option }\n end\n end",
"def new\n @ship_methods = ShipMethods.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ship_methods }\n end\n end",
"def new\n @shipping_unit = ShippingUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_unit }\n end\n end",
"def create\n @product_option_typeship = ProductOptionTypeship.new(product_option_typeship_params)\n\n respond_to do |format|\n if @product_option_typeship.save\n format.html { redirect_to @product_option_typeship, notice: 'Product option typeship was successfully created.' }\n format.json { render :show, status: :created, location: @product_option_typeship }\n else\n format.html { render :new }\n format.json { render json: @product_option_typeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def new\n @shopping_area = ShoppingArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shopping_area }\n end\n end",
"def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end",
"def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end",
"def create\n @shipping = Shipping.new(shipping_params)\n if @shipping.save\n redirect_to store_products_path, notice: 'Dados de envio criado com sucesso. Agora você pode criar produtos.'\n else\n render :new\n end\n end",
"def new\n @shipping_rate = ShippingRate.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_rate }\n end\n end",
"def new\n @order_pick = OrderPick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_pick }\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @shipping_fee = ShippingFee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_fee }\n end\n end",
"def new\n @billing_address = BillingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_address }\n end\n end",
"def create\n @shipping_cost = ShippingCost.new(params[:shipping_cost])\n\n respond_to do |format|\n if @shipping_cost.save\n flash[:notice] = 'ShippingCost was successfully created.'\n format.html { redirect_to( admin_shipping_cost_path(@shipping_cost) ) }\n format.xml { render :xml => @shipping_cost, :status => :created, :location => @shipping_cost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_cost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_fee = ShippingFee.new(shipping_fee_params)\n\n respond_to do |format|\n if @shipping_fee.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @delivery_order = DeliveryOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_order }\n end\n end",
"def create_shipping\n\t\tShipping.create(\n\t\t\tuser_id: params[:user_id],\n\t\t\tcampaign_id: params[:campaign_id],\n\t\t\treward_id: params[:reward_id],\n\t\t\tamount: params[:amount],\n\t\t\tcountry: params[:country]\n\t\t)\n\tend",
"def create\n @delivery_option = DeliveryOption.new(delivery_option_params)\n\n respond_to do |format|\n if @delivery_option.save\n format.html { redirect_to @delivery_option, notice: 'Item criado com sucesso.' }\n format.json { render :show, status: :created, location: @delivery_option }\n else\n format.html { render :new }\n format.json { render json: @delivery_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @product_option_value = ProductOptionValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_option_value }\n end\n end",
"def new\n @option_value = OptionValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option_value }\n end\n end",
"def new\n @voivodeship = Voivodeship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voivodeship }\n end\n end",
"def new\n # @url = \"http://rate-exchange.appspot.com/currency?from=IDR&to=USD\"\n @cart = current_cart\n @cart.line_items.each do |item|\n @productid = item.product.id\n end\n @destinations = Destination.find(:all, group: \"state_id\")\n # @states = State.find(:all, conditions: { state_status: 1 })\n @states = State.find(:all, conditions: { state_status: 1 })\n\n @user = current_user\n if @user.blank?\n @order = Order.new(cart_id: @cart.id)\n else\n @order = Order.new(account_member_id: @user.id, cart_id: @cart.id)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @proof_cost = ProofCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proof_cost }\n end\n end",
"def new\n @shipment = Shipment.new(:tmx => current_user.service_type, :signature_status => 'Required')\n #AutoComplete for Client Name\n @address_autofill = Address.new\n end",
"def new\n @shipping_detail = ShippingDetail.new\n @options = ''\n \n unless params[:shipping_detail].nil?\n @product = Product.find(params[:shipping_detail][:product_id])\n @question_response = QuestionResponse.find(params[:shipping_detail][:question_response_id]) \n else\n \n @params_to_pass_to_shipping_details = {}\n\n @product = Product.find(params['product_id'])\n @x = 0\n\n # Add all options\n params.each do |param|\n key = param[0]\n value = param[1]\n\n if key.start_with?('option') \n if value.end_with?('1') == true\n @current_question_option_id = @product.question_options[@x].id\n @options = @options + @current_question_option_id.to_s\n end\n @x = @x + 1\n end\n\n if key.start_with?('option') or key.start_with?('question')\n @params_to_pass_to_shipping_details[key] = value\n end\n end\n\n @question_response = QuestionResponse.new(:product_id => params['product_id'], \n :question_1 => (params[:question_1] == 'answer_1' ? 'True' : 'False'), \n :question_2 => (params[:question_2] == 'answer_5' ? 'True' : 'False'),\n :question_3 => (case params[:question_3] \n when 'answer_5' \n '1' \n when 'answer_6' \n '2'\n when 'answer_7' \n '3'\n when 'answer_8' \n '4'\n else\n '0'\n end),\n :question_4 => @options)\n \n if @question_response.valid?\n @question_response.save\n end\n end\n \n @uuid = nil\n\n # Required by uSell intergration -- Set a 30 day cookie\n if !params[:uuid].nil? # Always transfer to new UUID if uSell provides one\n cookies[:uuid] = { :value => params[:uuid], :expires => 30.day.from_now }\n @uuid = params[:uuid]\n elsif !cookies[:uuid].nil? # If a new UUID is not provided, use the ID from the cookie\n @uuid = cookies[:uuid]\n end\n \n @device = Device.new(:product_id => params['shipping_detail']['product_id'],\n :question_response_id => @question_response.id\n )\n @device.status_code = 0\n \n if @device.valid?\n @device.save\n end\n \n # Assume just 1 device per shipping details\n @shipping_detail.devices[0] = @device\n @shipping_detail.uuid = @uuid unless @uuid.nil?\n @shipping_detail.referer = params[:ref] unless params[:ref].nil?\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_detail }\n end\n end",
"def create\n all_selected = true\n params[:shipping_category].each_pair do |category_id, rate_id|#[rate]\n if rate_id\n session_admin_cart[:order_items].each do |item|\n if item.second[:variant].product.shipping_category_id == category_id.to_i\n ship_rate = ShippingRate.find(rate_id)\n item.second[:shipping_rate] = ship_rate\n\n end\n end\n else\n all_selected = false\n end\n end\n session_admin_cart[:shipping_rate] = all_selected # complete\n respond_to do |format|\n if all_selected\n format.html { redirect_to(admin_shopping_carts_url, :notice => 'Shipping method was successfully selected.') }\n else\n format.html { redirect_to( admin_shopping_shipping_methods_url, :notice => 'All the Shipping Methods must be selected') }\n end\n end\n end",
"def new\n @payment_option = PaymentOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_option }\n end\n end",
"def new\n @snp = Snp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snp }\n end\n end",
"def new\n @shirt_sub_option = ShirtSubOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shirt_sub_option }\n end\n end",
"def new\n @payable = Payable.find(params[:payable_id])\n @payable_shipment = @payable.payable_shipments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @payable_shipment }\n end\n end",
"def new\n @polygon = Polygon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polygon }\n end\n end",
"def new\n @gossip = Gossip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gossip }\n end\n end",
"def create\n @purchase_option = PurchaseOption.new(purchase_option_params)\n\n respond_to do |format|\n if @purchase_option.save\n format.html { redirect_to @purchase_option, notice: 'Purchase option was successfully created.' }\n format.json { render :show, status: :created, location: @purchase_option }\n else\n format.html { render :new }\n format.json { render json: @purchase_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @planned_order = PlannedOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planned_order }\n end\n end",
"def new\n @delivery = Delivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery }\n end\n end",
"def new\n @purchase_preference = PurchasePreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_preference }\n end\n end",
"def new\n @costtype = Costtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @costtype }\n end\n end",
"def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n end\n end",
"def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n end\n end",
"def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end",
"def new\n @news_site_specialty_option = NewsSiteSpecialtyOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_site_specialty_option }\n end\n end",
"def new\n @poll_options_set = PollOptionsSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_options_set }\n end\n end",
"def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end",
"def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end",
"def new\n @postcode = Postcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_postcode_url }\n end\n end",
"def new\n @voip_cost = VoipCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voip_cost }\n end\n end",
"def new\n @popularty_line_item = PopulartyLineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @popularty_line_item }\n end\n end",
"def new\n @shipment_type = ShipmentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipment_type }\n end\n end",
"def new\n @country_area = CountryArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @country_area }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @service_order = ServiceOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_order }\n end\n end",
"def create\n @shipping_service = ShippingService.new(shipping_service_params)\n\n if @shipping_service.save\n redirect_to dashboard_shipping_service_path(@shipping_service), notice: 'Shipping service was successfully created.'\n else\n render :new\n end\n end",
"def new\n @vote = Vote.new\n 3.times { @vote.options.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n # Form to create a new record\n @shipment = Shipment.new\n # Populate dropdown with data\n @trips = Trip.all\n @broker_companies = Company.where(:company_type => 'broker')\n @cartage_companies = Company.where(:company_type => 'cartage')\n @shipper_receiver = Company.where(\"company_type = 'customer' OR company_type = 'broker'\")\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipment }\n end\n end",
"def new\n @order = Order.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end"
] | [
"0.75195396",
"0.7092113",
"0.7014411",
"0.68997157",
"0.6854294",
"0.6833646",
"0.6670023",
"0.6609017",
"0.65135556",
"0.648711",
"0.648711",
"0.643037",
"0.64238375",
"0.63948464",
"0.6372058",
"0.6372058",
"0.63628006",
"0.63560814",
"0.6337575",
"0.6335904",
"0.6334768",
"0.63344765",
"0.6327888",
"0.63227683",
"0.63158077",
"0.6307175",
"0.62696326",
"0.6229699",
"0.6224448",
"0.61747193",
"0.61621404",
"0.61340296",
"0.61296463",
"0.6117564",
"0.6104458",
"0.6073713",
"0.60683686",
"0.6065581",
"0.60586035",
"0.6052301",
"0.6045065",
"0.6042768",
"0.60357463",
"0.6027295",
"0.6020418",
"0.6016744",
"0.60114706",
"0.6005364",
"0.60018086",
"0.5998813",
"0.59822124",
"0.59802294",
"0.5980171",
"0.5979054",
"0.5958867",
"0.5955813",
"0.5944658",
"0.5931224",
"0.5925474",
"0.5907128",
"0.590117",
"0.5894624",
"0.58897537",
"0.5877735",
"0.58777034",
"0.58737844",
"0.58683634",
"0.58683634",
"0.58665675",
"0.58604425",
"0.5849705",
"0.5848491",
"0.5848491",
"0.5845083",
"0.58362085",
"0.5835118",
"0.5835048",
"0.583364",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58299017",
"0.58243996",
"0.5815556",
"0.5813823",
"0.58127993",
"0.58126915"
] | 0.8196601 | 0 |
POST /shipping_options POST /shipping_options.json | def create
@shipping_option = ShippingOption.new(params[:shipping_option])
respond_to do |format|
if @shipping_option.save
format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }
format.json { render json: @shipping_option, status: :created, location: @shipping_option }
else
format.html { render action: "new" }
format.json { render json: @shipping_option.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipping_options\n Hash.new\n end",
"def shipping_method_params\n # params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_categories)\n params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_category_ids => [])\n end",
"def add_shipping_params\n params.require(:add_shipping).permit(:user_id, :order_id, :phone, :addline1, :addline2, :city, :country, :zipcode)\n end",
"def shipping_params \n params.require(:shipping).permit(:price_for_free_shipping, :standart_price,\n :delivery_policy, :daily_delivery, :weekly_delivery, :reserve_delivery, :pick_up_at_the_store,\n shipping_by_neighborhoods_attributes: ShippingByNeighborhood.attribute_names.map(&:to_sym).push(:_destroy)).merge(store_id: current_store.id)\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def shipping_params\n params.require(:shipping).permit(:address, :city, :state, :zip)\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_method }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_shipping\n\t\tShipping.create(\n\t\t\tuser_id: params[:user_id],\n\t\t\tcampaign_id: params[:campaign_id],\n\t\t\treward_id: params[:reward_id],\n\t\t\tamount: params[:amount],\n\t\t\tcountry: params[:country]\n\t\t)\n\tend",
"def shipping_params\n params.require(:shipping).permit(:order_id, :dispute_id, :provider, :tracking_number, :note, :shop_delivery_confirmation, :user_delivery_confirmation, :surf_delivery_confirmation)\n end",
"def create\n @add_shipping = AddShipping.new(add_shipping_params)\n\n respond_to do |format|\n if @add_shipping.save\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully created.' }\n format.json { render :show, status: :created, location: @add_shipping }\n else\n format.html { render :new }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_service_params\n params.require(:shipping_service).permit!\n end",
"def create\n @status_shipping = StatusShipping.new(status_shipping_params)\n\n respond_to do |format|\n if @status_shipping.save\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully created.' }\n format.json { render :show, status: :created, location: @status_shipping }\n else\n format.html { render :new }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status_shipping_params\n params.fetch(:status_shipping, {})\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => name,\n :address1 => address,\n :city => city,\n :state => state,\n :country => country,\n :zip => zip\n }\n }\n end",
"def shipping_params\n params[:shipping]\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => \"#{billing_address.first_name} #{billing_address.last_name}\",\n :address1 => billing_address.address,\n :city => billing_address.city,\n :state => billing_address.state,\n :country => \"US\",\n :zip => billing_address.zip\n },\n :tax => tax_in_cents,\n :order_id => self.id\n }\n end",
"def create\n @shipping = scope.new(params[:shipping])\n\n respond_to do |format|\n if @shipping.save\n format.html { redirect_to admin_ship_out_path(@shipping), notice: 'scope was successfully created.' }\n format.json { render json: @shipping, status: :created, location: @shipping }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def minimal_gateway_options\n {:email => order.user.email, \n :customer => order.user.email, \n :ip => order.ip_address, \n :order_id => order.number,\n :shipping => order.ship_amount * 100,\n :tax => order.tax_amount * 100, \n :subtotal => order.item_total * 100} \n end",
"def purchase_options\n {\n :billing_address => {\n :address1 => @address,\n :city => @city,\n :state => @state,\n :country => \"US\",\n :zip => @zip\n }\n }\n end",
"def orders_create_shipping_with_http_info(id, shipping_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_create_shipping ...'\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 ShippingsApi.orders_create_shipping\"\n end\n # verify the required parameter 'shipping_request' is set\n if @api_client.config.client_side_validation && shipping_request.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_create_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines'.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/vnd.conekta-v2.1.0+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[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_create_shipping\",\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: ShippingsApi#orders_create_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n\n # merge the raw post data into the params\n params.merge!(Rack::Utils.parse_nested_query(request.raw_post))\n\n url = params[:australia_post_api_connection][:shop]\n\n #try to find the shop preference using url\n preference = Preference.find_by_shop_url!(url)\n\n # recalculate the weight to include blanks\n calculated_weight = params[:australia_post_api_connection][:blanks].to_i * preference.default_weight.to_f\n calculated_weight += params[:australia_post_api_connection][:weight].to_f\n\n items = params[:australia_post_api_connection][:items]\n \n if (preference.offers_flat_rate)\n if (calculated_weight <= preference.under_weight)\n @service_list = Array.new\n @service_list.append({ name: \"Shipping\",\n code: \"Shipping\",\n price: preference.flat_rate.to_s}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return #evil...\n end\n end\n \n weight = params[:australia_post_api_connection][:weight]\n \n if (preference.free_shipping_by_collection)\n subtract_weight = 0\n \n #get free shipping items weight and subtract total weight.\n item_array = items.split(',')\n \n app_shop = Shop.find_by_url(url)\n \n ShopifyAPI::Session.temp(app_shop.myshopify_domain, app_shop.token) do \n item_array.each do |item|\n variant = ShopifyAPI::VariantWithProduct.find(item) \n p = ShopifyAPI::Product.find(variant.product_id)\n \n p.collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n \n p.smart_collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n end\n end\n \n \n weight = weight.to_f - subtract_weight/1000\n end\n\n\n if (weight.to_f == 0.0)\n #no need to call australia post. no weight of item\n @service_list = Array.new\n @service_list.append({ name: \"Free Shipping\",\n code: \"Free Shipping\",\n price: \"0.0\"}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return\n else \n @australia_post_api_connection = AustraliaPostApiConnection.new({:weight=> weight,\n :blanks => params[:australia_post_api_connection][:blanks],\n :from_postcode => preference.origin_postal_code,\n :country_code => params[:australia_post_api_connection][:country_code],\n :to_postcode => params[:australia_post_api_connection][:to_postcode],\n :height=>preference.height, :width=>preference.width, :length=>preference.length,\n :container_weight => preference.container_weight, :items => items\n })\n end\n \n @australia_post_api_connection.domestic = ( @australia_post_api_connection.country_code == \"AUS\" )\n\n # get country list from the API -- we'll format these if there were no errors\n @service_list = @australia_post_api_connection.data_oriented_methods(:service) # get the service list\n\n if @australia_post_api_connection.domestic\n shipping_methods = preference.shipping_methods_allowed_dom\n shipping_desc = preference.shipping_methods_desc_dom\n else\n shipping_methods = preference.shipping_methods_allowed_int\n shipping_desc = preference.shipping_methods_desc_int\n end\n\n respond_to do |format|\n if @australia_post_api_connection.save\n\n @countries = get_country_list(@australia_post_api_connection)\n # TODO right now we are not including the suboptions for each shipping type\n #filter out unwanted methods more efficiently?\n\n @service_list = Array.wrap( @service_list[1]['service'] ).inject([]) do |list, service|\n Rails.logger.debug(\"service code is \" + service['code'])\n if shipping_methods[service['code']]\n price_to_charge = service['price'].to_f\n shipping_name = shipping_desc[service['code']].blank? ? service['name'] : shipping_desc[service['code']]\n unless preference.nil?\n unless preference.surcharge_percentage.nil?\n if preference.surcharge_percentage > 0.0\n price_to_charge =(price_to_charge * (1 + preference.surcharge_percentage/100)).round(2)\n end\n end\n\n unless preference.surcharge_amount.nil?\n if preference.surcharge_amount > 0.0\n price_to_charge = (price_to_charge + preference.surcharge_amount).round(2)\n end\n end\n end\n\n list.append({ name: shipping_name,\n code: service['code'],\n price: price_to_charge})\n end\n \n list\n end\n\n # check if need to add free shipping option\n if (preference.free_shipping_option)\n @service_list.append({ name: preference.free_shipping_description,\n code: \"Free\",\n price: \"0.00\"})\n end\n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false }\n else // if @australia_post_api_connection.save\n # set the flash\n\n flash.now[:error] = @australia_post_api_connection.api_errors.join(', ')\n # format.html { render action: \"new\" }\n # format.json { render json: @australia_post_api_connection.errors, status: :unprocessable_entity }\n # if (flash.now[:error].blank?)\n # format.html { render :text => \"api_error\" }\n # else\n format.html { render partial: \"trouble\", layout: false }\n # end\n end\n end\n end",
"def new\n @shipping_detail = ShippingDetail.new\n @options = ''\n \n unless params[:shipping_detail].nil?\n @product = Product.find(params[:shipping_detail][:product_id])\n @question_response = QuestionResponse.find(params[:shipping_detail][:question_response_id]) \n else\n \n @params_to_pass_to_shipping_details = {}\n\n @product = Product.find(params['product_id'])\n @x = 0\n\n # Add all options\n params.each do |param|\n key = param[0]\n value = param[1]\n\n if key.start_with?('option') \n if value.end_with?('1') == true\n @current_question_option_id = @product.question_options[@x].id\n @options = @options + @current_question_option_id.to_s\n end\n @x = @x + 1\n end\n\n if key.start_with?('option') or key.start_with?('question')\n @params_to_pass_to_shipping_details[key] = value\n end\n end\n\n @question_response = QuestionResponse.new(:product_id => params['product_id'], \n :question_1 => (params[:question_1] == 'answer_1' ? 'True' : 'False'), \n :question_2 => (params[:question_2] == 'answer_5' ? 'True' : 'False'),\n :question_3 => (case params[:question_3] \n when 'answer_5' \n '1' \n when 'answer_6' \n '2'\n when 'answer_7' \n '3'\n when 'answer_8' \n '4'\n else\n '0'\n end),\n :question_4 => @options)\n \n if @question_response.valid?\n @question_response.save\n end\n end\n \n @uuid = nil\n\n # Required by uSell intergration -- Set a 30 day cookie\n if !params[:uuid].nil? # Always transfer to new UUID if uSell provides one\n cookies[:uuid] = { :value => params[:uuid], :expires => 30.day.from_now }\n @uuid = params[:uuid]\n elsif !cookies[:uuid].nil? # If a new UUID is not provided, use the ID from the cookie\n @uuid = cookies[:uuid]\n end\n \n @device = Device.new(:product_id => params['shipping_detail']['product_id'],\n :question_response_id => @question_response.id\n )\n @device.status_code = 0\n \n if @device.valid?\n @device.save\n end\n \n # Assume just 1 device per shipping details\n @shipping_detail.devices[0] = @device\n @shipping_detail.uuid = @uuid unless @uuid.nil?\n @shipping_detail.referer = params[:ref] unless params[:ref].nil?\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_detail }\n end\n end",
"def create\n all_selected = true\n params[:shipping_category].each_pair do |category_id, rate_id|#[rate]\n if rate_id\n session_admin_cart[:order_items].each do |item|\n if item.second[:variant].product.shipping_category_id == category_id.to_i\n ship_rate = ShippingRate.find(rate_id)\n item.second[:shipping_rate] = ship_rate\n\n end\n end\n else\n all_selected = false\n end\n end\n session_admin_cart[:shipping_rate] = all_selected # complete\n respond_to do |format|\n if all_selected\n format.html { redirect_to(admin_shopping_carts_url, :notice => 'Shipping method was successfully selected.') }\n else\n format.html { redirect_to( admin_shopping_shipping_methods_url, :notice => 'All the Shipping Methods must be selected') }\n end\n end\n end",
"def create\n @product_option_typeship = ProductOptionTypeship.new(product_option_typeship_params)\n\n respond_to do |format|\n if @product_option_typeship.save\n format.html { redirect_to @product_option_typeship, notice: 'Product option typeship was successfully created.' }\n format.json { render :show, status: :created, location: @product_option_typeship }\n else\n format.html { render :new }\n format.json { render json: @product_option_typeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_detail_params\n params.require(:shipping_detail).permit(:full_address_name, :address_line_one, :address_line_two, :city_town, :state, :zip, :country, :user_id)\n end",
"def update\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n if @shipping_option.update_attributes(params[:shipping_option])\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_detail = ShippingDetail.new(shipping_detail_params)\n\n respond_to do |format|\n if @shipping_detail.save\n format.html { redirect_to @shipping_detail, notice: 'Shipping detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_fee\n @admin_options = Admin::Option.where(\"id = ?\" , 44) \n end",
"def shipping_information_params\n params.require(:shipping_information).permit(:phone, :additional_info, :address_id)\n end",
"def create\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new(params[:shipping_address])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address.save\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully created.' }\n format.json { render json: @shipping_address, status: :created, location: @shipping_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_add_shipping\n @add_shipping = AddShipping.find(params[:id])\n end",
"def set_shipping_method\n @shipping_method = ShippingMethod.find(params[:id])\n end",
"def order_opts(order, payment_method, stage)\n items = order.line_items.map do |item|\n price = (item.price * 100).to_i # convert for gateway\n { :name => item.variant.product.name,\n :description => (item.variant.product.description[0..120] if item.variant.product.description),\n :sku => item.variant.sku,\n :quantity => item.quantity,\n :amount => price,\n :weight => item.variant.weight,\n :height => item.variant.height,\n :width => item.variant.width,\n :depth => item.variant.weight }\n end\n\n credits = order.adjustments.map do |credit|\n if credit.amount < 0.00\n { :name => credit.label,\n :description => credit.label,\n :sku => credit.id,\n :quantity => 1,\n :amount => (credit.amount*100).to_i }\n end\n end\n\n credits_total = 0\n credits.compact!\n if credits.present?\n items.concat credits\n credits_total = credits.map {|i| i[:amount] * i[:quantity] }.sum\n end\n\n if params[:host_with_port].nil?\n params[:host_with_port] = request.host_with_port\n end\n\n opts = { :return_url => request.protocol + params[:host_with_port] + \"/confirm/\" + \"orders/#{order.number}/checkout/paypal_confirm?payment_method_id=#{payment_method}\",\n :cancel_return_url => request.protocol + params[:host_with_port] + \"/\" + \"orders/#{order.number}/edit\",\n :order_id => order.number,\n :custom => order.number,\n :items => items,\n :subtotal => ((order.item_total * 100) + credits_total).to_i,\n :tax => ((order.adjustments.map { |a| a.amount if ( a.source_type == 'Order' && a.label == 'Tax') }.compact.sum) * 100 ).to_i,\n :shipping => ((order.adjustments.map { |a| a.amount if a.source_type == 'Shipment' }.compact.sum) * 100 ).to_i,\n :money => (order.total * 100 ).to_i }\n\n # add correct tax amount by subtracting subtotal and shipping otherwise tax = 0 -> need to check adjustments.map\n opts[:tax] = (order.total*100).to_i - opts.slice(:subtotal, :shipping).values.sum\n\n if stage == \"checkout\"\n opts[:handling] = 0\n\n opts[:callback_url] = spree_root_url + \"paypal_express_callbacks/#{order.number}\"\n opts[:callback_timeout] = 3\n elsif stage == \"payment\"\n #hack to add float rounding difference in as handling fee - prevents PayPal from rejecting orders\n #because the integer totals are different from the float based total. This is temporary and will be\n #removed once Spree's currency values are persisted as integers (normally only 1c)\n opts[:handling] = (order.total*100).to_i - opts.slice(:subtotal, :tax, :shipping).values.sum\n end\n\n opts\n end",
"def update\n \n @preference = get_preference()\n @preference.shop_url = session[:shopify_domain].to_s\n\n shipping_methods_long_desc_int = params.require('shipping_methods_long_desc_int').permit(:INT_PARCEL_COR_OWN_PACKAGING, :INT_PARCEL_EXP_OWN_PACKAGING, :INT_PARCEL_STD_OWN_PACKAGING, :INT_PARCEL_AIR_OWN_PACKAGING, :INT_PARCEL_SEA_OWN_PACKAGING)\n shipping_methods_allowed_int = params.require('shipping_methods_allowed_int').permit(:INT_PARCEL_COR_OWN_PACKAGING, :INT_PARCEL_EXP_OWN_PACKAGING, :INT_PARCEL_STD_OWN_PACKAGING, :INT_PARCEL_AIR_OWN_PACKAGING, :INT_PARCEL_SEA_OWN_PACKAGING)\n shipping_methods_allowed_dom = params.require('shipping_methods_allowed_dom').permit(:AUS_PARCEL_REGULAR,:AUS_PARCEL_EXPRESS,:AUS_PARCEL_REGULAR_SATCHEL_500G,:AUS_PARCEL_EXPRESS_SATCHEL_500G,:AUS_PARCEL_REGULAR_SATCHEL_3KG,:AUS_PARCEL_EXPRESS_SATCHEL_3KG,:AUS_PARCEL_REGULAR_SATCHEL_5KG, :AUS_PARCEL_EXPRESS_SATCHEL_5KG)\n shipping_methods_long_desc_dom = params.require('shipping_methods_long_desc_dom').permit(:AUS_PARCEL_REGULAR,:AUS_PARCEL_EXPRESS,:AUS_PARCEL_REGULAR_SATCHEL_500G,:AUS_PARCEL_EXPRESS_SATCHEL_500G,:AUS_PARCEL_REGULAR_SATCHEL_3KG,:AUS_PARCEL_EXPRESS_SATCHEL_3KG,:AUS_PARCEL_REGULAR_SATCHEL_5KG, :AUS_PARCEL_EXPRESS_SATCHEL_5KG)\n\n @preference[:shipping_methods_long_desc_int] = shipping_methods_long_desc_int.to_h || {}\n @preference[:shipping_methods_long_desc_dom] = shipping_methods_long_desc_dom.to_h || {}\n @preference[:shipping_methods_allowed_int] = shipping_methods_allowed_int.to_h || {}\n @preference[:shipping_methods_allowed_dom] = shipping_methods_allowed_dom.to_h || {}\n @preference.save\n\n shopify_api_shop = ShopifyAPI::Shop.current \n \n shipping_methods_long_desc_int.each do |method_name, value|\n find_or_create_metafield(shopify_api_shop, method_name, value.to_s) \n end\n \n shipping_methods_long_desc_dom.each do |method_name, value|\n find_or_create_metafield(shopify_api_shop, method_name, value.to_s) \n end\n \n\n respond_to do |format|\n @preference.attributes = preference_params\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n installer_class = carrier_installer_class_for('aus_post')\n installer = installer_class.new( session[:shopify_domain], @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_shipping_address\n Validation.validateParameters(params)\n begin\n ChargeBee::Subscription.update( @subscription_id,\n { :shipping_address => params['shipping_address'] } )\n render json: {\n :forward => \"/ssp/subscription\"\n }\n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_request_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end \n end",
"def shipping\n @data[:shipping]\n end",
"def test_should_set_shipping_method_without_confirmation\n # Execute an earlier test as this one deppends on it.\n test_should_select_shipping_method\n\n # Post to it when the show confirmation preference is false.\n assert Preference.save_settings({ \"store_show_confirmation\" => \"0\" })\n post :set_shipping_method, :ship_type_id => order_shipping_types(:ups_ground).id\n assert_redirected_to :action => :finish_order\n end",
"def test_should_set_shipping_method_with_confirmation\n # Execute an earlier test as this one deppends on it.\n test_should_select_shipping_method\n\n # Post to it when the show confirmation preference is true.\n assert Preference.save_settings({ \"store_show_confirmation\" => \"1\" })\n post :set_shipping_method, :ship_type_id => order_shipping_types(:ups_ground).id\n assert_redirected_to :action => :confirm_order\n end",
"def show\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def gateway_options\n options = { :email => order.email,\n :customer => order.email,\n :ip => order.last_ip_address,\n :order_id => gateway_order_id } # This is the changed line\n\n options.merge!({ :shipping => order.ship_total * 100,\n :tax => order.tax_total * 100,\n :subtotal => order.item_total * 100 })\n\n options.merge!({ :currency => currency })\n\n options.merge!({ :billing_address => order.bill_address.try(:active_merchant_hash),\n :shipping_address => order.ship_address.try(:active_merchant_hash) })\n\n options.merge!(:discount => promo_total) if respond_to?(:promo_total)\n options\n end",
"def delivery_option_params\n params.require(:delivery_option).permit!\n end",
"def shipping\n cart = Cart.new(request.cookies[\"cart\"])\n cart.set_extra_data(params)\n shipping_methods = ShippingMethod.lookup_methods(cart)\n render :json => shipping_methods\n end",
"def create\n @shipping = Shipping.new(shipping_params)\n if @shipping.save\n redirect_to store_products_path, notice: 'Dados de envio criado com sucesso. Agora você pode criar produtos.'\n else\n render :new\n end\n end",
"def destroy\n @shipping_option = ShippingOption.find(params[:id])\n @shipping_option.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_options_url }\n format.json { head :no_content }\n end\n end",
"def create\n @shipping_information = ShippingInformation.new(shipping_information_params)\n @address = Address.all\n respond_to do |format|\n if @shipping_information.save\n format.html { redirect_to @shipping_information, notice: 'La información de envío se guardó correctamente.' }\n format.json { render :show, status: :created, location: @shipping_information }\n else\n format.html { render :new }\n format.json { render json: @shipping_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_status_shipping\n @status_shipping = StatusShipping.find(params[:id])\n end",
"def product_option_typeship_params\n params.require(:product_option_typeship).permit(:product_id, :option_type_id)\n end",
"def create\n @shipping_fee = ShippingFee.new(shipping_fee_params)\n\n respond_to do |format|\n if @shipping_fee.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def options_to_patch_request(options)\n json = []\n Array[options.delete(:remove)].flatten.compact.each { |i| json << {'op' => 'remove', 'path' => \"/#{camelize_words(i)}\"} }\n options.each { |k, v| json << {'op' => 'add', 'path' => \"/#{camelize_words(k)}\", 'value' => v} }\n json.collect { |i| Hash[i.each_pair.to_a] }\n end",
"def options\n\t\t@options = {\n\t\t\t:ip => ip,\n\t\t\t:email => self.email,\n\t\t\t:description => \"Author: #{self.sku.items.first.owner.id} #{self.sku.items.first.owner.pen_name} SKU: #{self.sku.id} #{self.sku.title}\",\n\t\t\t:billing_address => {\n\t\t\t\t:name => self.billing_address.name,\n\t\t\t\t:address1 => self.billing_address.street,\n\t\t\t\t:address2 => self.billing_address.street2,\n\t\t\t\t:city => self.billing_address.city,\n\t\t\t\t:state => self.billing_address.state,\n\t\t\t\t:zip => self.billing_address.zip,\n\t\t\t\t:country => self.billing_address.country,\n\t\t\t\t:phone => self.billing_address.phone\n\t\t\t}\n\t\t}\n\tend",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n authorized_shipping\n end",
"def add_address(options)\n address = options[:billing_address]\n\n post = {}\n post['Address 1'] = address[:address1] unless empty?(address[:address1])\n post['Address 2'] = address[:address2] unless empty?(address[:address2])\n post['City'] = address[:city] unless empty?(address[:city])\n post['State or Province'] = address[:state] unless empty?(\n address[:state]\n )\n post['ZIP or Postal Code'] = address[:zip] unless empty?(address[:zip])\n post['Country'] = address[:country] unless empty?(address[:country])\n\n post\n end",
"def shipping_methods\n [\"Next Day Shipping\", \"2 Day Shipping\",\"Ground Service\"]\n end",
"def set_shipping_service\n @shipping_service = ShippingService.find(params[:id])\n end",
"def test_should_create_shipping_type\n a_shipping_type = OrderShippingType.new\n \n a_shipping_type.code = \"UPWX\"\n a_shipping_type.name = \"UPS Worldwide Express (International Only)\"\n a_shipping_type.is_domestic = 0\n a_shipping_type.price = 12.00\n \n assert a_shipping_type.save\n end",
"def set_shipping_information\n @shipping_information = ShippingInformation.find(params[:id])\n end",
"def resource_url\n \"orders/#{self.order_id}/shippingaddresses\"\n end",
"def update\n respond_to do |format|\n if @add_shipping.update(add_shipping_params)\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_shipping }\n else\n format.html { render :edit }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_options_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"ats-wis-shippingoptionslbl\")), __method__)\n end",
"def shipping_address_post\n params[:address][:country] = params[:address][:state].split(\"-\")[0]\n params[:address][:state] = params[:address][:state].split(\"-\")[1]\n @address = Address.new(params[:address])\n @address.customer = @customer\n if @address.save\n @cart.shipping_address = @address\n unless @cart.billing_address\n @cart.billing_address = @address\n end\n if @cart.save\n redirect_to build_url_options_for_checkout\n return\n end\n else\n flash[:error] = @address.errors.full_messages.join('<br/>')\n render :action => 'shipping_address'\n end\n end",
"def set_shipping_detail\n @shipping_detail = ShippingDetail.find(params[:id])\n end",
"def resource_url\n \"orders/#{self.order_id}/shipping_addresses\"\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n end",
"def shipping_charges_payment\n {'PaymentType' => payment_type,\n 'Payor' => {'AccountNumber' => @model.payor_account_number},\n :order! => ['PaymentType', 'Payor']}\n end",
"def shipping_book_params\n params.require(:shipping_book).permit(:shipping_book_id, :customer_id, :shipping_name, :shipping_address, :shipping_city, :shipping_state_province, :shipping_zip_postal, :shipping_country_region)\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n end",
"def order_params\n params.require(:order).permit(\n # billing info\n :first_name_billing, :last_name_billing, :company_billing, :address_line_one_billing, :address_line_two_billing, :city_billing, :country_billing, :state_billing, :zip_billing, :phone_billing,\n # shipping info\n :first_name_shipping, :last_name_shipping, :company_shipping, :address_line_one_shipping, :address_line_two_shipping, :city_shipping, :country_shipping, :state_shipping, :zip_shipping, :phone_shipping, :email,\n # shipping options\n :shipping_method_id,\n # payment options\n :discount_code\n )\n end",
"def shipping_line_params\n params.require(:shipping_line).permit(:name)\n end",
"def order_opts(order)\n items = order.line_items.map do |item|\n tax = paypal_variant_tax(item.price, item.variant)\n price = (item.price * 100).to_i # convert for gateway\n tax = (tax * 100).to_i # truncate the tax slice\n { :name => item.variant.product.name,\n :description => item.variant.product.description[0..120],\n :sku => item.variant.sku,\n :qty => item.quantity, \n :amount => price - tax, \n :tax => tax,\n :weight => item.variant.weight,\n :height => item.variant.height,\n :width => item.variant.width,\n :depth => item.variant.weight }\n end\n\n opts = { :return_url => request.protocol + request.host_with_port + \"/orders/#{order.number}/paypal_finish\",\n :cancel_return_url => \"http://\" + request.host_with_port + \"/orders/#{order.number}/edit\",\n :order_id => order.number,\n :custom => order.number,\n\n :items => items,\n }\n opts\n end",
"def fixed_opts\n if Spree::PaypalExpress::Config[:paypal_express_local_confirm].nil?\n user_action = \"continue\"\n else\n user_action = Spree::PaypalExpress::Config[:paypal_express_local_confirm] == \"t\" ? \"continue\" : \"commit\"\n end\n\n { :description => \"Goods from #{Spree::Config[:site_name]}\", # site details...\n\n #:page_style => \"foobar\", # merchant account can set named config\n :header_image => \"https://#{Spree::Config[:site_url]}#{Spree::Config[:logo]}\",\n :background_color => \"ffffff\", # must be hex only, six chars\n :header_background_color => \"ffffff\",\n :header_border_color => \"ffffff\",\n :allow_note => true,\n :locale => \"#{request.protocol}#{params[:host_with_port]}\" ,\n :req_confirm_shipping => false, # for security, might make an option later\n :user_action => user_action\n\n # WARNING -- don't use :ship_discount, :insurance_offered, :insurance since\n # they've not been tested and may trigger some paypal bugs, eg not showing order\n # see http://www.pdncommunity.com/t5/PayPal-Developer-Blog/Displaying-Order-Details-in-Express-Checkout/bc-p/92902#C851\n }\n end",
"def add_shipping_as_line_item(extra_options = {})\n raise 'must set shipping/freight before calling this' unless @fields['x_freight']\n add_line_item extra_options.merge({:name => 'Shipping and Handling Cost', :quantity => 1, :unit_price => @fields['x_freight'], :line_title => 'Shipping'})\n end",
"def create\n @shipping_service = ShippingService.new(shipping_service_params)\n\n if @shipping_service.save\n redirect_to dashboard_shipping_service_path(@shipping_service), notice: 'Shipping service was successfully created.'\n else\n render :new\n end\n end",
"def add_address(post, options)\n if address = options[:billing_address] || options[:address]\n post[:ci_billaddr1] = address[:address1]\n post[:ci_billaddr2] = address[:address2] if address[:address2]\n post[:ci_billcity] = address[:city]\n post[:ci_billstate] = address[:state]\n post[:ci_billzip] = address[:zip]\n post[:ci_billcountry] = address[:country]\n end\n\n if address = options[:shipping_address]\n post[:ci_shipaddr1] = address[:address1]\n post[:ci_shipaddr2] = address[:address2] if address[:address2]\n post[:ci_shipcity] = address[:city]\n post[:ci_shipstate] = address[:state]\n post[:ci_shipzip] = address[:zip]\n post[:ci_shipcountry] = address[:country]\n end\n end",
"def create\n @purchase_option = PurchaseOption.new(purchase_option_params)\n\n respond_to do |format|\n if @purchase_option.save\n format.html { redirect_to @purchase_option, notice: 'Purchase option was successfully created.' }\n format.json { render :show, status: :created, location: @purchase_option }\n else\n format.html { render :new }\n format.json { render json: @purchase_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ship_to_address(options)\n for setting in [:first_name, :last_name, :company, :city, :state, :zip, :country] do\n if options[setting] then\n add_field 'x_ship_to_' + setting.to_s, options[setting]\n end\n end\n raise 'must use :address1 and/or :address2' if options[:address]\n add_field 'x_ship_to_address', (options[:address1].to_s + ' ' + options[:address2].to_s).strip\n end",
"def create\n @delivery_option = DeliveryOption.new(delivery_option_params)\n\n respond_to do |format|\n if @delivery_option.save\n format.html { redirect_to @delivery_option, notice: 'Item criado com sucesso.' }\n format.json { render :show, status: :created, location: @delivery_option }\n else\n format.html { render :new }\n format.json { render json: @delivery_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_address\n [name_tb.value,address1_tb.value,address2_tb.value,city_tb.value,state_tb.value,country_select.first_selected_option.text,zip_tb.value,phone_tb.value,power_adapter_select.first_selected_option.text]\n end",
"def serializable_shipping\n if shipping = self.shipping?\n shipping_hash = ActiveSupport::HashWithIndifferentAccess.new\n shipping_hash[:local_pick_up] = shipping.local_pick_up?.to_bool # FORCE Boolean\n\n # if shipping.free_shipping?\n # shipping_hash[:free_shipping ] = shipping.free_shipping.to_bool # FORCE Boolean\n # end\n\n case shipping_hash[:mode] = shipping.mode?\n when \"me1\"\n # code here\n when \"me2\"\n # code here\n\n # when \"custom\"\n # TO FIX: https://gist.github.com/gullitmiranda/2ba389dbb5bbf3378c8f#file-shipping_custom-json\n # shipping_hash[:costs] = (shipping.costs? || []).map do |cost|\n # {\n # name: cost.name?,\n # cost: cost.cost?.to_f # FORCE Float\n # }\n # end\n else\n shipping_hash.delete(:mode)\n end\n\n shipping_hash[:dimensions] = shipping.dimensions? if shipping.dimensions?\n\n shipping_hash\n end\n end",
"def orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_update_shipping ...'\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 ShippingsApi.orders_update_shipping\"\n end\n # verify the required parameter 'shipping_id' is set\n if @api_client.config.client_side_validation && shipping_id.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_update_shipping\"\n end\n # verify the required parameter 'shipping_request' is set\n if @api_client.config.client_side_validation && shipping_request.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_update_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_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/vnd.conekta-v2.1.0+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[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_update_shipping\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ShippingsApi#orders_update_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_params\n params.require(:shipment).permit(:value, :weight_kg,\n contact: %i[name phone],\n vehicles: %i[type body_type],\n origin: %i[city state load_at],\n destination: %i[city state deliver_at])\n end",
"def create \n # TODO - provide AJAX interface for setting shipping method instead of assuming first available\n shipment = @shipment_presenter.shipment\n shipment.order = @order\n shipment.shipping_method = ShippingMethod.first\n shipment.address = @shipment_presenter.address\n unless @shipment_presenter.valid? and shipment.save\n render :action => \"new\" and return\n end \n @order.state_events.create(:name => t('ship'), :user => current_user, :previous_state => @order.state) if params[:mark_shipped] \n flash[:notice] = t('created_successfully')\n redirect_to collection_url\n end",
"def create\n @sender = params[:sender]\n @destination = params[:destination]\n @package = params[:package]\n @notification = params[:notification]\n @preferences = params[:preferences]\n @settlement_info = params[:settlement_info]\n @request = {\n sender: @sender,\n destination: @destination,\n package: @package,\n notification: @notification,\n preferences: @preferences,\n settlement_info: @settlement_info,\n group_id: '5241556',\n mailing_date: Date.today,\n contract_number: '0042956527',\n service_code: params[:service_code],\n mobo: {\n customer_number: params[:mobo],\n username: 'bc02d6bd3733555c',\n password: '111d1a0d29fc00aa47b66a',\n contract_number: '0042956527'\n }\n }\n puts \"**** #{@request}\"\n\n @response = CANADA_POST_SERVICE.create(\n sender: @sender,\n destination: @destination,\n package: @package,\n notification: @notification,\n preferences: @preferences,\n settlement_info: @settlement_info,\n group_id: '5241556',\n mailing_date: Date.today,\n contract_id: '0042956527',\n service_code: params[:service_code],\n mobo: {\n customer_number: params[:mobo],\n username: 'bc02d6bd3733555c',\n password: '111d1a0d29fc00aa47b66a',\n contract_number: '0042956527'\n }\n )\n puts \"Full Response: #{@response}\"\n unless @response[:create_shipping][:errors].present?\n Shipping.track_shipping(@response)\n end\n respond_to do |format|\n format.js {}\n end\n end",
"def shipping\n to_price mapping_for(:shipping)\n end",
"def add_shipping_method(method, name, price)\n @command.create_shipping_method(method) do |sm|\n sm.name = name \n sm.price = Money.new(price * 100, \"USD\")\n sm.create_allowed_area(Google4R::Checkout::WorldArea)\n end\n end",
"def orders_delete_shipping_with_http_info(id, shipping_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_delete_shipping ...'\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 ShippingsApi.orders_delete_shipping\"\n end\n # verify the required parameter 'shipping_id' is set\n if @api_client.config.client_side_validation && shipping_id.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_delete_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_delete_shipping\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ShippingsApi#orders_delete_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def request_shipping(ship_timestamp, dropoff_type, service_type, packaging_type, shipper_contact, shipper_address, \n recipient_contact, recipient_address, payor_country_code, package_line_items, options={})\n options = @options.update(options)\n shipping_request = build_shipping_request(ship_timestamp, dropoff_type, service_type, packaging_type, shipper_contact, shipper_address, \n recipient_contact, recipient_address, payor_country_code, package_line_items, options)\n log(:request_shipping, shipping_request)\n response = commit(save_request(shipping_request), (options[:test] || false))\n log(:request_shipping, response)\n response = response.gsub(/\\sxmlns(:|=)[^>]*/, '').gsub(/<(\\/)?[^<]*?\\:(.*?)>/, '<\\1\\2>')\n parse_shipping_response(response, options)\n end",
"def shipping\n adjustments.find { |a| a.type == \"shipping-method\" }\n end",
"def set_shipping_category\n old_set_shipping_category unless params['shipping_method'][:translations_attributes]\n end",
"def create\n @shipping_line = ShippingLine.new(shipping_line_params)\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, notice: \"Shipping line was successfully created.\" }\n format.json { render :show, status: :created, location: @shipping_line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @shipping_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_method\n @shipping_methods = @order.available_shipping_methods\n @shipping_method = @shipping_methods.find(params[:method_id])\n if @shipping_method.shipping_gateway.present?\n @shipping_gateway = @shipping_method.shipping_gateway_class.new(order: @order)\n @data = @shipping_gateway.prepare_interface_data(params)\n else\n @shipping_gateway = nil\n end\n rescue => e\n flash.now[:error] = e.message\n head :unprocessable_entity\n end",
"def validate_shipping_method\n if shipping_method && !shipping_method.available?(city_id: city_id)\n errors.add(:shipping_method, :invalid)\n end\n end",
"def create\n @shipping_line = ShippingLine.new(params[:shipping_line])\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully created.' }\n format.json { render :json => @shipping_line, :status => :created, :location => @shipping_line }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @channel_shipping_service = ChannelShippingService.new(params[:channel_shipping_service])\n\n respond_to do |format|\n if @channel_shipping_service.save\n format.html { redirect_to @channel_shipping_service, notice: 'Channel shipping service was successfully created.' }\n format.json { render json: @channel_shipping_service, status: :created, location: @channel_shipping_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel_shipping_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def create\n @shipping_detail = ShippingDetail.new(params[:shipping_detail])\n \n @product = Product.find(params[:shipping_detail][:product_id])\n @question_response = QuestionResponse.find(params[:shipping_detail][:question_response_id])\n \n @tos = params[:tos]\n \n @device = Device.new(:product => @product, :question_response => @question_response)\n @device.status_code = 0 \n if @device.valid?\n @device.save\n end\n \n # Take a snapshot of the initial offer\n #@shipping_detail.offer = @question_response.quote unless @question_response.nil?\n #@shipping_detail.final_offer = @question_response.quote unless @question_response.nil? \n @device.offer = @question_response.quote unless @question_response.nil?\n @device.final_offer = @question_response.quote unless @question_response.nil?\n \n @shipping_detail.devices[0] = @device\n \n respond_to do |format|\n if @tos.nil?\n flash[:error] = \"You must first agree to the terms of service\"\n format.html { render :action => \"new\", :product_id => @product.id, :question_response_id => @question_response.id, :notice => \"You must first agree to the terms of service\" }\n format.xml { render :xml => @shipping_detail.errors, :status => :unprocessable_entity }\n elsif @shipping_detail.save\n UserMailer.welcome_email(@shipping_detail).deliver\n UserMailer.new_quote_request_email(@shipping_detail).deliver\n \n format.html { redirect_to(@shipping_detail, :notice => 'Please check your email for confirmation') }\n format.xml { render :xml => @shipping_detail, :status => :created, :location => @shipping_detail }\n else\n format.html { render :action => \"new\", :product_id => @product.id, :question_response_id => @question_response.id }\n format.xml { render :xml => @shipping_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_book = ShippingBook.new(shipping_book_params)\n\n respond_to do |format|\n if @shipping_book.save\n format.html { redirect_to @shipping_book, notice: 'Shipping address in Shipping book was successfully created.' }\n format.json { render :show, status: :created, location: @shipping_book }\n else\n format.html { render :new }\n format.json { render json: @shipping_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_item\n shipping_scope.first || shipping_scope.build(shipping_options)\n end",
"def shipping=(shipping)\n @shipping = ensure_type(Shipping, shipping)\n end",
"def create\n @shipping_cost = ShippingCost.new(params[:shipping_cost])\n\n respond_to do |format|\n if @shipping_cost.save\n flash[:notice] = 'ShippingCost was successfully created.'\n format.html { redirect_to( admin_shipping_cost_path(@shipping_cost) ) }\n format.xml { render :xml => @shipping_cost, :status => :created, :location => @shipping_cost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_cost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_shipment!\n shipping_method(true)\n\n if shipment.present?\n shipment.update_attributes!(:shipping_method => shipping_method)\n else\n self.shipments << Shipment.create!({ :order => self,\n :shipping_method => shipping_method,\n :address => self.ship_address}, :without_protection => true)\n end\n \n end"
] | [
"0.6891033",
"0.66590875",
"0.64115906",
"0.641141",
"0.6390521",
"0.63499707",
"0.63313067",
"0.63216096",
"0.63127196",
"0.6252297",
"0.62448317",
"0.62297773",
"0.6093281",
"0.6087907",
"0.60523325",
"0.60504204",
"0.60492456",
"0.6045949",
"0.6006122",
"0.5944607",
"0.59414375",
"0.5909584",
"0.5884385",
"0.586839",
"0.5848736",
"0.5836508",
"0.5822675",
"0.58087677",
"0.58014464",
"0.57868046",
"0.5727851",
"0.56993943",
"0.5689221",
"0.5689145",
"0.568434",
"0.5679366",
"0.56573385",
"0.56554323",
"0.5654696",
"0.56282645",
"0.56169116",
"0.56087273",
"0.5601322",
"0.5584063",
"0.55801225",
"0.5574631",
"0.5566472",
"0.5546007",
"0.5543617",
"0.553353",
"0.55206585",
"0.551492",
"0.54963267",
"0.54955196",
"0.5494196",
"0.5492146",
"0.549204",
"0.5491951",
"0.54918885",
"0.54857427",
"0.54815733",
"0.5477061",
"0.5469754",
"0.54693246",
"0.54533494",
"0.5451686",
"0.54451954",
"0.54349893",
"0.54319113",
"0.542814",
"0.54253703",
"0.54231775",
"0.5416483",
"0.541317",
"0.5411197",
"0.54079074",
"0.5399706",
"0.53977567",
"0.539734",
"0.53968155",
"0.539283",
"0.53631765",
"0.5362526",
"0.5361874",
"0.5360259",
"0.53529614",
"0.53518015",
"0.53493667",
"0.533098",
"0.5328635",
"0.53278613",
"0.5320795",
"0.5307802",
"0.52977586",
"0.5294768",
"0.52944463",
"0.5294419",
"0.5292777",
"0.52916574",
"0.5291562"
] | 0.7298239 | 0 |
PUT /shipping_options/1 PUT /shipping_options/1.json | def update
@shipping_option = ShippingOption.find(params[:id])
respond_to do |format|
if @shipping_option.update_attributes(params[:shipping_option])
format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @shipping_option.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :created, location: @shipping_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_method.update(shipping_method_params)\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_shipping.update(add_shipping_params)\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_shipping }\n else\n format.html { render :edit }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_shipping_method\n @shipping_method = ShippingMethod.find(params[:id])\n end",
"def update\n \n @preference = get_preference()\n @preference.shop_url = session[:shopify_domain].to_s\n\n shipping_methods_long_desc_int = params.require('shipping_methods_long_desc_int').permit(:INT_PARCEL_COR_OWN_PACKAGING, :INT_PARCEL_EXP_OWN_PACKAGING, :INT_PARCEL_STD_OWN_PACKAGING, :INT_PARCEL_AIR_OWN_PACKAGING, :INT_PARCEL_SEA_OWN_PACKAGING)\n shipping_methods_allowed_int = params.require('shipping_methods_allowed_int').permit(:INT_PARCEL_COR_OWN_PACKAGING, :INT_PARCEL_EXP_OWN_PACKAGING, :INT_PARCEL_STD_OWN_PACKAGING, :INT_PARCEL_AIR_OWN_PACKAGING, :INT_PARCEL_SEA_OWN_PACKAGING)\n shipping_methods_allowed_dom = params.require('shipping_methods_allowed_dom').permit(:AUS_PARCEL_REGULAR,:AUS_PARCEL_EXPRESS,:AUS_PARCEL_REGULAR_SATCHEL_500G,:AUS_PARCEL_EXPRESS_SATCHEL_500G,:AUS_PARCEL_REGULAR_SATCHEL_3KG,:AUS_PARCEL_EXPRESS_SATCHEL_3KG,:AUS_PARCEL_REGULAR_SATCHEL_5KG, :AUS_PARCEL_EXPRESS_SATCHEL_5KG)\n shipping_methods_long_desc_dom = params.require('shipping_methods_long_desc_dom').permit(:AUS_PARCEL_REGULAR,:AUS_PARCEL_EXPRESS,:AUS_PARCEL_REGULAR_SATCHEL_500G,:AUS_PARCEL_EXPRESS_SATCHEL_500G,:AUS_PARCEL_REGULAR_SATCHEL_3KG,:AUS_PARCEL_EXPRESS_SATCHEL_3KG,:AUS_PARCEL_REGULAR_SATCHEL_5KG, :AUS_PARCEL_EXPRESS_SATCHEL_5KG)\n\n @preference[:shipping_methods_long_desc_int] = shipping_methods_long_desc_int.to_h || {}\n @preference[:shipping_methods_long_desc_dom] = shipping_methods_long_desc_dom.to_h || {}\n @preference[:shipping_methods_allowed_int] = shipping_methods_allowed_int.to_h || {}\n @preference[:shipping_methods_allowed_dom] = shipping_methods_allowed_dom.to_h || {}\n @preference.save\n\n shopify_api_shop = ShopifyAPI::Shop.current \n \n shipping_methods_long_desc_int.each do |method_name, value|\n find_or_create_metafield(shopify_api_shop, method_name, value.to_s) \n end\n \n shipping_methods_long_desc_dom.each do |method_name, value|\n find_or_create_metafield(shopify_api_shop, method_name, value.to_s) \n end\n \n\n respond_to do |format|\n @preference.attributes = preference_params\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n installer_class = carrier_installer_class_for('aus_post')\n installer = installer_class.new( session[:shopify_domain], @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_shipping_address\n Validation.validateParameters(params)\n begin\n ChargeBee::Subscription.update( @subscription_id,\n { :shipping_address => params['shipping_address'] } )\n render json: {\n :forward => \"/ssp/subscription\"\n }\n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_request_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end \n end",
"def update\n respond_to do |format|\n if @shipping.update(shipping_params)\n format.html { redirect_to @shipping, notice: 'Shipping was successfully updated.' }\n format.json { render :show, status: :ok, location: @shipping }\n else\n format.html { render :edit }\n format.json { render json: @shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_status_shipping\n @status_shipping = StatusShipping.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @status_shipping.update(status_shipping_params)\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_shipping }\n else\n format.html { render :edit }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_service.shipping_methods[-1].destroy if @shipping_service.shipping_methods.last.name == '' || @shipping_service.shipping_methods.last.price == nil\n if @shipping_service.update(shipping_service_params)\n redirect_to dashboard_shipping_service_path(@shipping_service), notice: 'Shipping service was successfully updated.'\n else\n render :edit\n end\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n authorized_shipping\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n end",
"def set_shipping_service\n @shipping_service = ShippingService.find(params[:id])\n end",
"def set_shipping\n @shipping = Shipping.find(params[:id])\n end",
"def shipping_options\n Hash.new\n end",
"def set_add_shipping\n @add_shipping = AddShipping.find(params[:id])\n end",
"def update\n if @shipping.update_attributes(shipping_params)\n redirect_to edit_store_shipping_path(@shipping), notice: 'Dados de envio atualizado com sucesso.'\n else\n render :edit\n end\n end",
"def set_shipping_detail\n @shipping_detail = ShippingDetail.find(params[:id])\n end",
"def show\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def destroy\n @shipping_option = ShippingOption.find(params[:id])\n @shipping_option.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_options_url }\n format.json { head :no_content }\n end\n end",
"def set_shipping_information\n @shipping_information = ShippingInformation.find(params[:id])\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def update\n @shipping = scope.find(params[:id])\n\n respond_to do |format|\n if @shipping.update_attributes(params[:shipping])\n format.html { redirect_to @shipping, notice: 'scope was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @billing_option.update(billing_option_params)\n @billing_options = BillingOption.all\n @billing_option = BillingOption.new\n end",
"def update\n respond_to do |format|\n if @shipping_detail.update(shipping_detail_params)\n format.html { redirect_to @shipping_detail, notice: 'Shipping detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipping_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_option_typeship.update(product_option_typeship_params)\n format.html { redirect_to @product_option_typeship, notice: 'Product option typeship was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_option_typeship }\n else\n format.html { render :edit }\n format.json { render json: @product_option_typeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_params\n params.require(:shipping).permit(:order_id, :dispute_id, :provider, :tracking_number, :note, :shop_delivery_confirmation, :user_delivery_confirmation, :surf_delivery_confirmation)\n end",
"def shipping_params\n params.require(:shipping).permit(:address, :city, :state, :zip)\n end",
"def shipping_params \n params.require(:shipping).permit(:price_for_free_shipping, :standart_price,\n :delivery_policy, :daily_delivery, :weekly_delivery, :reserve_delivery, :pick_up_at_the_store,\n shipping_by_neighborhoods_attributes: ShippingByNeighborhood.attribute_names.map(&:to_sym).push(:_destroy)).merge(store_id: current_store.id)\n end",
"def update\n \n @preference = get_preference()\n\n @preference.shop_url = session[:shopify].shop.domain\n\n respond_to do |format|\n @preference.attributes = params[:preference]\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n\n installer_class = carrier_installer_class_for(@preference.carrier)\n installer = installer_class.new( session[:shopify].shop, @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_item_option = OrderItemOption.find(params[:id])\n\n if @order_item_option.update(order_item_option_params)\n head :no_content\n else\n render json: @order_item_option.errors, status: :unprocessable_entity\n end\n end",
"def update\n @address = Address.all\n respond_to do |format|\n if @shipping_information.update(shipping_information_params)\n format.html { redirect_to @shipping_information, notice: 'La información de envío se actualizó correctamente.' }\n format.json { render :show, status: :ok, location: @shipping_information }\n else\n format.html { render :edit }\n format.json { render json: @shipping_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_method_params\n # params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_categories)\n params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_category_ids => [])\n end",
"def update\n respond_to do |format|\n if @purchase_option.update(purchase_option_params)\n format.html { redirect_to @purchase_option, notice: 'Purchase option was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchase_option }\n else\n format.html { render :edit }\n format.json { render json: @purchase_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_fee\n @admin_options = Admin::Option.where(\"id = ?\" , 44) \n end",
"def test_should_update_shipping_type\n a_shipping_type = order_shipping_types(:ups_ground)\n assert a_shipping_type.update_attributes(:name => 'UPS Ground Shipping')\n end",
"def add_shipping_params\n params.require(:add_shipping).permit(:user_id, :order_id, :phone, :addline1, :addline2, :city, :country, :zipcode)\n end",
"def orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_update_shipping ...'\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 ShippingsApi.orders_update_shipping\"\n end\n # verify the required parameter 'shipping_id' is set\n if @api_client.config.client_side_validation && shipping_id.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_update_shipping\"\n end\n # verify the required parameter 'shipping_request' is set\n if @api_client.config.client_side_validation && shipping_request.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_update_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_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/vnd.conekta-v2.1.0+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[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_update_shipping\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ShippingsApi#orders_update_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @shipping_fee.update_attributes(shipping_fee_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_service_params\n params.require(:shipping_service).permit!\n end",
"def update_shipping_from_purchase\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n flash[:notice] = 'Address was successfully updated.'\n format.html { redirect_to( new_payment_path ) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit_shipping_from_purchase\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_line.update(shipping_line_params)\n format.html { redirect_to @shipping_line, notice: \"Shipping line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @shipping_line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @shipping_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.find_by_id(params[:id])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address\n if @shipping_address.update_attributes(params[:shipping_address])\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to action: \"index\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n if @shipping_line.update_attributes(params[:shipping_line])\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_product_option_typeship\n @product_option_typeship = ProductOptionTypeship.find(params[:id])\n end",
"def shipping_method=(method)\n raise ArgumentError.new(\"method cannot be nil\") unless method.present?\n self.shipping_name = method.name\n self.shipping_cost = method.cost\n end",
"def update\n @shipping_detail = ShippingDetail.find(params[:id])\n\n respond_to do |format|\n if @shipping_detail.update_attributes(params[:shipping_detail])\n format.html { redirect_to(@shipping_detail, :notice => 'Shipping detail was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_term = ShippingTerm.find(params[:id])\n\n respond_to do |format|\n if @shipping_term.update_attributes(params[:shipping_term])\n flash[:notice] = 'ShippingTerm was successfully updated.'\n format.html { redirect_to(@shipping_term) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def shipping=(shipping)\n @shipping = ensure_type(Shipping, shipping)\n end",
"def update\n @shipping_cost = ShippingCost.find(params[:id])\n\n respond_to do |format|\n if @shipping_cost.update_attributes(params.permit![:shipping_cost])\n flash[:notice] = 'ShippingCost was successfully updated.'\n format.html { redirect_to(admin_shipping_cost_path(@shipping_cost)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_cost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @channel_shipping_service = ChannelShippingService.find(params[:id])\n\n respond_to do |format|\n if @channel_shipping_service.update_attributes(params[:channel_shipping_service])\n format.html { redirect_to @channel_shipping_service, notice: 'Channel shipping service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @channel_shipping_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_book.update(shipping_book_params)\n format.html { redirect_to @shipping_book, notice: 'Shipping address in Shipping book was successfully updated.' }\n format.json { render :show, status: :ok, location: @shipping_book }\n else\n format.html { render :edit }\n format.json { render json: @shipping_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_shipping_line\n @shipping_line = ShippingLine.find(params[:id])\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def set_shipping_info\n if params[:address_id]\n @cart.set_shipping_info(params[:address_id].to_i)\n redirect_to billing_address_account_path\n else\n @address_book = AddressBook.find_or_new(params[:address_book], @cart.buyer)\n render :update do |page|\n if @address_book.save\n @cart.set_shipping_info(@address_book.id)\n page.redirect_to confirm_order_account_path\n else\n page.show \"#message-wraper\"\n page.replace_html \"#message-wraper\", error_messages_for('address_book', :object => @address_book)\n end\n end\n end\n end",
"def shipping_item\n shipping_scope.first || shipping_scope.build(shipping_options)\n end",
"def set_shipping_book\n @shipping_book = ShippingBook.find(params[:id])\n end",
"def set_shipping_company\n @shipping_company = ShippingCompany.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @shipping_company.update(shipping_company_params)\n format.html { redirect_to @shipping_company, notice: 'Shipping company was successfully updated.' }\n format.json { render :show, status: :ok, location: @shipping_company }\n else\n format.html { render :edit }\n format.json { render json: @shipping_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @delivery_option.update(delivery_option_params)\n format.html { redirect_to @delivery_option, notice: 'Item atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @delivery_option }\n else\n format.html { render :edit }\n format.json { render json: @delivery_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_shipping_methods\n @retailer = Retailer.find(params[:retailer_id])\n params[:retailer][:shipping_method_ids] ||= []\n @retailer.update_attributes(params[:retailer])\n flash[:notice] = \"Shipping methods have been updated\"\n redirect_to admin_retailer_shipping_methods_url(@retailer)\n end",
"def shipping_address_edit\n @shipping_address = retrieve_shipping_address(@subscription_id)\n @country_codes = get_country_codes\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_method }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_shipping = StatusShipping.new(status_shipping_params)\n\n respond_to do |format|\n if @status_shipping.save\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully created.' }\n format.json { render :show, status: :created, location: @status_shipping }\n else\n format.html { render :new }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @order = current_order(session) || create_order(session)\n shipping_methods = Breeze::Commerce::ShippingMethod.unarchived\n unless @order.shipping_method && shipping_methods.include?(@order.shipping_method)\n if Breeze::Commerce::ShippingMethod.count > 1\n @order.shipping_method = shipping_methods.unarchived.where(:is_default => true).first\n else\n @order.shipping_method = shipping_methods.unarchived.first\n end\n @order.save\n end\n end",
"def update\n @order.update_attribute(:state, 'cart')\n if params[:shipments_attributes].present?\n if cookies[:board_id].present?\n @order.room_cookie = cookies[:board_id]\n end\n if cookies[:portfolio_id].present?\n @order.portfolio_cookie = cookies[:portfolio_id]\n end\n #params[:shipments_attributes].each do |key, value|\n #\n # shipment = @order.shipments.where(id: value[:id]).first\n # if shipment.present?\n # rate = shipment.shipping_rates.where(id: value[:selected_shipping_rate_id]).first\n #\n # if rate.present?\n # shipment.update_attributes({selected_shipping_rate_id: rate.id, cost: rate.cost})\n # end\n # end\n # shipment.adjustments.create(amount: shipment.cost, source_type: 'Spree::Order', order_id: @order.id, label: 'Shipment')\n #\n # #if @order.adjustments.where(label: 'Shipment').blank?\n # #@order.adjustments.shipping.create(amount: @order.shipments.sum(:cost), source_type: 'Spree::Shipment' ,label: 'Shipment')\n # #end\n #end\n if @order.update_from_params(params, permitted_checkout_attributes)\n persist_user_address\n unless @order.next\n\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to one_page_checkout_path and return\n end\n\n if @order.completed?\n @order.payments.destroy_all if request.put?\n @order.update_totals\n # @order.update(shipment_total: @order.shipments.sum(&:cost))\n shipment_total = @order.shipments.sum(&:cost)\n @order.update(total: @order.item_total + @order.additional_tax_total + shipment_total + @order.promo_total + @order.adjustment_total,shipment_total: shipment_total)#+ @order.adjustment_total\n unless @order.confirmation_delivered?\n @order.deliver_order_confirmation_email\n @order.update_columns(send_order_confirmation_email: true, order_confirmation_sent: true)\n end\n # Rails.logger.info session[:order_id]\n # session[:order_id] = nil\n if @order.subscribe == true\n @subscriber = Spree::Subscriber.find_by_email(@order.email)\n if @subscriber.present?\n @subscriber.update_attribute(\"last_subscribed_at\", Time.now)\n else\n sub = Spree::Subscriber.create(:email => @order.email, :last_subscribed_at => Time.now)\n Rails.logger.info \"ADDED TO MAILCHIMP LIST\" if sub.add_subscriber_to_mailchimp('subscribers')\n end\n end\n\n if @order.user_id.nil? and @order.email.present?\n user = Spree::User.find_by_email(@order.email)\n @order.update_columns(user_id: user.id) if user\n end\n\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n cookies[:user_movement_id] = nil\n redirect_to order_confirmation_path\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n\n render :edit\n end\n else\n @order.errors.add(:shipments, \"Can't be blank\")\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to cart_path\n end\n\n end",
"def status_shipping_params\n params.fetch(:status_shipping, {})\n end",
"def sell_shipping_profile_update (id, shipping_profile, params={})\r\n url = api_url \"/sell/shipping_profiles/#{id}\"\r\n load = MultiJson.dump shipping_profile\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.put url, load, req \r\n end \r\n end",
"def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_params\n params[:shipping]\n end",
"def update\n respond_to do |format|\n if @aws_dhcp_option_attribute.update(aws_dhcp_option_attribute_params)\n format.html { redirect_to @aws_dhcp_option_attribute, notice: 'Aws dhcp option attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @aws_dhcp_option_attribute }\n else\n format.html { render :edit }\n format.json { render json: @aws_dhcp_option_attribute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ship_placement.update(ship_placement_params)\n format.html { redirect_to @ship_placement, notice: 'Ship placement was successfully updated.' }\n format.json { render :show, status: :ok, location: @ship_placement }\n else\n format.html { render :edit }\n format.json { render json: @ship_placement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end",
"def create\n @add_shipping = AddShipping.new(add_shipping_params)\n\n respond_to do |format|\n if @add_shipping.save\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully created.' }\n format.json { render :show, status: :created, location: @add_shipping }\n else\n format.html { render :new }\n format.json { render json: @add_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_detail_params\n params.require(:shipping_detail).permit(:full_address_name, :address_line_one, :address_line_two, :city_town, :state, :zip, :country, :user_id)\n end",
"def update(billing_key, options = {})\n raise MethodNotImplemented\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 @shipping_container = ShippingContainer.find(params[:id])\n\n respond_to do |format|\n if @shipping_container.update_attributes(params[:shipping_container])\n flash[:notice] = 'ShippingContainer was successfully updated.'\n format.html { redirect_to(admin_shipping_containers_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_container.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def shipping\n adjustments.find { |a| a.type == \"shipping-method\" }\n end",
"def update(order_id: nil, shipping_carrier: nil, shipping_confirmation: nil)\n api_request(\"/charges/#{id}/update\", :post, order_id: order_id,\n shipping_carrier: shipping_carrier,\n shipping_confirmation: shipping_confirmation)\n end",
"def update\n @option = Option.find(params[:id])\n\n respond_to do |format|\n if @option.update_attributes(params[:option])\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @option = Option.find(params[:id])\n\n respond_to do |format|\n if @option.update_attributes(params[:option])\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @procedure = Procedure.find(params[:id])\n @options = Option.new\n @types = Type.new\n respond_to do |format|\n if @procedure.update_attributes(params[:procedure])\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @procedure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def shipping_information_params\n params.require(:shipping_information).permit(:phone, :additional_info, :address_id)\n end",
"def update\n @shipping_unit = ShippingUnit.find(params[:id])\n\n respond_to do |format|\n if @shipping_unit.update_attributes(params[:shipping_unit])\n format.html { redirect_to(@shipping_unit, :notice => 'Shipping unit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_unit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_category = ShippingCategory.find(params[:id])\n\n respond_to do |format|\n if @shipping_category.update_attributes(params[:shipping_category])\n flash[:success] = 'Shipping ategory was successfully updated.'\n format.html { redirect_to(admin_shipping_categories_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => name,\n :address1 => address,\n :city => city,\n :state => state,\n :country => country,\n :zip => zip\n }\n }\n end",
"def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end",
"def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def set_delivery_option\n @delivery_option = DeliveryOption.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @location_option.update(location_option_params)\n format.html { redirect_to @location_option, notice: 'Location option was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_option }\n else\n format.html { render :edit }\n format.json { render json: @location_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_billing_option\n @billing_option = BillingOption.find(params[:id])\n end",
"def product_option_typeship_params\n params.require(:product_option_typeship).permit(:product_id, :option_type_id)\n end",
"def update\n respond_to do |format|\n if @customer_ship_address.update(customer_ship_address_params)\n format.html { redirect_to edit_customer_registration_path, notice: t(:ship_address_suc_update) }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @customer_ship_address.errors , status: :unprocessable_entity }\n end\n end\n end",
"def minimal_gateway_options\n {:email => order.user.email, \n :customer => order.user.email, \n :ip => order.ip_address, \n :order_id => order.number,\n :shipping => order.ship_amount * 100,\n :tax => order.tax_amount * 100, \n :subtotal => order.item_total * 100} \n end"
] | [
"0.6716322",
"0.65077084",
"0.64580584",
"0.6420317",
"0.6414997",
"0.63914895",
"0.6363216",
"0.6355999",
"0.63348055",
"0.62984604",
"0.62516844",
"0.6240664",
"0.623425",
"0.6220395",
"0.61370414",
"0.61319315",
"0.6125961",
"0.61213094",
"0.61127245",
"0.610799",
"0.61030614",
"0.60870755",
"0.60685575",
"0.6067308",
"0.6056657",
"0.6038907",
"0.6007437",
"0.5962942",
"0.5957092",
"0.595167",
"0.5946942",
"0.5941731",
"0.5932851",
"0.59247077",
"0.59223986",
"0.58918303",
"0.58835965",
"0.58586526",
"0.5842861",
"0.5786785",
"0.5784609",
"0.5780793",
"0.57774484",
"0.57762396",
"0.57727724",
"0.57711995",
"0.5761091",
"0.57493836",
"0.5743372",
"0.57411444",
"0.57371897",
"0.5734895",
"0.572442",
"0.5719915",
"0.57195556",
"0.57195556",
"0.57058674",
"0.5704267",
"0.56952864",
"0.56792116",
"0.5675715",
"0.5671814",
"0.5662283",
"0.56554544",
"0.56546116",
"0.5646715",
"0.5611446",
"0.55859554",
"0.55819863",
"0.5576819",
"0.55706334",
"0.55706334",
"0.55706334",
"0.55669814",
"0.55576193",
"0.55437267",
"0.55428296",
"0.5528067",
"0.55200446",
"0.5516308",
"0.5496529",
"0.5494931",
"0.54868287",
"0.5484382",
"0.547882",
"0.546633",
"0.54585844",
"0.54570216",
"0.54540086",
"0.5452589",
"0.54496545",
"0.5447498",
"0.5447498",
"0.5441848",
"0.5429253",
"0.54285264",
"0.54211664",
"0.54204106",
"0.5410755",
"0.5404862"
] | 0.74950427 | 0 |
DELETE /shipping_options/1 DELETE /shipping_options/1.json | def destroy
@shipping_option = ShippingOption.find(params[:id])
@shipping_option.destroy
respond_to do |format|
format.html { redirect_to shipping_options_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @shipping_method.destroy\n respond_to do |format|\n format.html { redirect_to admin_shipping_methods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_detail.destroy\n respond_to do |format|\n format.html { redirect_to shipping_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_shipping.destroy\n respond_to do |format|\n format.html { redirect_to add_shippings_url, notice: 'Add shipping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_cost = ShippingCost.find(params[:id])\n @shipping_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_costs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @status_shipping.destroy\n respond_to do |format|\n format.html { redirect_to status_shippings_url, notice: 'Status shipping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping.destroy\n respond_to do |format|\n format.html { redirect_to shippings_url, notice: 'Shipping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_shipping_method\n shipping_method = ShippingMethod.find(params[:method_id])\n service_id = shipping_method.shipping_service_id\n shipping_method.destroy\n redirect_to edit_dashboard_shipping_service_path(service_id)\n end",
"def destroy\n @shipping_line = ShippingLine.find(params[:id])\n @shipping_line.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_container = ShippingContainer.find(params[:id])\n @shipping_container.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_containers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipping_service.destroy\n redirect_to dashboard_shipping_services_path, notice: 'Shipping service was successfully destroyed.'\n end",
"def destroy\n @shipping_information.destroy\n respond_to do |format|\n format.html { redirect_to shipping_informations_url, notice: 'La información de envío se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_detail = ShippingDetail.find(params[:id])\n @shipping_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipping = scope.find(params[:id])\n @shipping.destroy\n\n respond_to do |format|\n format.html { redirect_to shippings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel_shipping_service = ChannelShippingService.find(params[:id])\n @channel_shipping_service.destroy\n\n respond_to do |format|\n format.html { redirect_to channel_shipping_services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_term = ShippingTerm.find(params[:id])\n @shipping_term.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_terms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.find_by_id(params[:id])\n @shipping_address && @shipping_address.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @delivery_option.destroy\n respond_to do |format|\n format.html { redirect_to delivery_options_url, notice: 'Item apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_rate = ShippingRate.find(params[:id])\n @shipping_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_rates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipping_line.destroy\n respond_to do |format|\n format.html { redirect_to shipping_lines_url, notice: \"Shipping line was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_option.destroy\n respond_to do |format|\n format.html { redirect_to purchase_options_url, notice: 'Purchase option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item_option = OrderItemOption.find(params[:id])\n @order_item_option.destroy\n\n head :no_content\n end",
"def destroy\n @shipping_unit = ShippingUnit.find(params[:id])\n @shipping_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_units_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n respond_to do |format|\n if @shipping_fee.destroy\n format.html { redirect_to action: :index }\n end\n end\n end",
"def destroy\n @free_shipping_rule = FreeShippingRule.find(params[:id])\n @free_shipping_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_free_shipping_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_option_typeship.destroy\n respond_to do |format|\n format.html { redirect_to product_option_typeships_url, notice: 'Product option typeship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_fee = ShippingFee.find(params[:id])\n @shipping_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_fees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_category = ShippingCategory.find(params[:id])\n @shipping_category.destroy\n\n respond_to do |format|\n flash[:success] = 'Shipping category was deleted.'\n format.html { redirect_to(admin_shipping_categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @billing_option.destroy\n @billing_options = BillingOption.all\n end",
"def destroy\n @aws_dhcp_option_attribute.destroy\n respond_to do |format|\n format.html { redirect_to aws_dhcp_option_attributes_url, notice: 'Aws dhcp option attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option = Option.find(params[:id])\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option = Option.find(params[:id])\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funding_status_option = FundingStatusOption.find(params[:id])\n @funding_status_option.destroy\n\n respond_to do |format|\n format.html { redirect_to funding_status_options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_company.destroy\n respond_to do |format|\n format.html { redirect_to shipping_companies_url, notice: 'Shipping company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete_option\n option_param = params.permit(:id)\n\n render json: Option.delete_option(option_param)\n end",
"def destroy\n @ship_methods = ShipMethods.find(params[:id])\n @ship_methods.destroy\n\n respond_to do |format|\n format.html { redirect_to(ship_methods_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = option_model.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipment = Shipment.find(params[:id])\n raise error\n @shipment.update_attributes(:active => false)\n\n\n # We need to add capability to refund and return to stock in one large destroy form\n\n respond_to do |format|\n format.html { redirect_to(admin_fulfillment_shipments_url( :order_id => (@shipment.order.number)) ) }\n end\n end",
"def destroy\n @shipment = Shipment.find(params[:id])\n raise error\n @shipment.update_attributes(:active => false)\n\n\n # We need to add capability to refund and return to stock in one large destroy form\n\n respond_to do |format|\n format.html { redirect_to(admin_fulfillment_shipments_url( :order_id => (@shipment.order.number)) ) }\n end\n end",
"def destroy\n @shipping_book.destroy\n respond_to do |format|\n format.html { redirect_to shipping_books_url, notice: 'Shipping address inShipping book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_should_destroy_shipping_type\n a_shipping_type = order_shipping_types(:ups_ground)\n a_shipping_type.destroy\n assert_raise(ActiveRecord::RecordNotFound) {\n OrderShippingType.find(a_shipping_type.id)\n }\n end",
"def destroy\n @billing_address = BillingAddress.find(params[:id])\n @billing_address.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship_placement.destroy\n respond_to do |format|\n format.html { redirect_to ship_placements_url, notice: 'Ship placement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item_option = LineItemOption.find(params[:id])\n @line_item_option.destroy\n \n respond_to do |format|\n format.html { redirect_to current_cart_path }\n format.js { redirect_to current_cart_path }\n end\n end",
"def destroy\n @delivery_address = DeliveryAddress.find(params[:id])\n @delivery_address.destroy\n\n respond_to do |format|\n format.html { redirect_to delivery_addresses_url }\n format.json { head :no_content }\n end\n end",
"def orders_delete_shipping_with_http_info(id, shipping_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_delete_shipping ...'\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 ShippingsApi.orders_delete_shipping\"\n end\n # verify the required parameter 'shipping_id' is set\n if @api_client.config.client_side_validation && shipping_id.nil?\n fail ArgumentError, \"Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_delete_shipping\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ShippingOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ShippingsApi.orders_delete_shipping\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ShippingsApi#orders_delete_shipping\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @location_option.destroy\n respond_to do |format|\n format.html { redirect_to location_options_url, notice: 'Location option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipcount.destroy\n respond_to do |format|\n format.html { redirect_to shipcounts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !params[:format].nil? && params[:format] == \"json\"\n @object=Spree::Country.find_by_id(params[:id])\n if !@object.nil?\n @object.destroy\n if @object.destroy\n error=error_response_method($e4)\n render:json=>error\n end\n else\n error=error_response_method($e2)\n render:json=>error\n end\n end\n end",
"def destroy\n @opt = Opt.find(params[:id])\n @opt.destroy\n\n respond_to do |format|\n format.html { redirect_to(opts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n requires :id\n service.delete_dhcp_options(id)\n true\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shipment_type.destroy\n respond_to do |format|\n format.html { redirect_to shipment_types_url, notice: 'Shipment type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_option = PaymentOption.find(params[:id])\n @payment_option.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @payment_option]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shirt_sub_option = ShirtSubOption.find(params[:id])\n @shirt_sub_option.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_shirt_sub_options_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @selected_options_of_pc.destroy\n respond_to do |format|\n format.html { redirect_to selected_options_of_pcs_url }\n format.json { head :no_content }\n end\n end",
"def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @option = Option.find(params[:id])\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to(options_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to company_shipments_path}\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_option_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipfleet.destroy\n respond_to do |format|\n format.html { redirect_to shipfleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipmment_item.destroy\n respond_to do |format|\n format.html { redirect_to shipmment_items_url, notice: \"Shipmment item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete(pickup_option_id)\n response, status = BeyondApi::Request.delete(@session, \"/pickup-options/#{pickup_option_id}\")\n\n handle_response(response, status, respond_with_true: true)\n end",
"def destroy\n # Logic to delete a record\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_option = ExamOption.find(params[:id])\n @exam_option.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Опция успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @shipmentmethod.destroy\r\n respond_to do |format|\r\n format.html { redirect_to shipmentmethods_url, notice: 'Shipmentmethod was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @opttruck.destroy\n respond_to do |format|\n format.html { redirect_to opttrucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship_class = ShipClass.find(params[:id])\n @ship_class.destroy\n\n respond_to do |format|\n format.html { redirect_to ship_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto_option = AutoOption.find(params[:id])\n @auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to auto_options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mobile_alipay.destroy\n respond_to do |format|\n format.html { redirect_to backend_shop_mobile_alipays_url(@current_shop) }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: \"Shipment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete(path, options={})\n send_request 'delete', path, options\n end",
"def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @buy_option.destroy\n respond_to do |format|\n format.html { redirect_to buy_options_url, notice: 'Buy option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to business_geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_option = ItemOption.find(params[:id])\n @item_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_options_url) }\n format.xml { head :ok }\n end\n end",
"def sell_shipping_profile_delete (id, params={})\r\n url = api_url \"/sell/shipping_profiles/#{id}\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.delete url, req \r\n end \r\n end",
"def destroy\n @option_value = OptionValue.find(params[:id])\n @option_value.destroy\n\n respond_to do |format|\n format.html { redirect_to option_values_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site_option.destroy\n respond_to do |format|\n format.html { redirect_to site_options_url, notice: 'Site option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_request.destroy\n respond_to do |format|\n format.html { redirect_to shop_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billing_plan.destroy\n respond_to do |format|\n format.html { redirect_to billing_plans_url }\n format.json { head :no_content }\n end\n end",
"def update\n @shipping_service.shipping_methods[-1].destroy if @shipping_service.shipping_methods.last.name == '' || @shipping_service.shipping_methods.last.price == nil\n if @shipping_service.update(shipping_service_params)\n redirect_to dashboard_shipping_service_path(@shipping_service), notice: 'Shipping service was successfully updated.'\n else\n render :edit\n end\n end",
"def delete(path, options={}, format=format)\n request(:delete, path, options, format)\n end",
"def destroy\n @survey_option = SurveyOption.find(params[:id])\n @survey_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(survey_options_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7427041",
"0.7112162",
"0.70128614",
"0.69396985",
"0.688937",
"0.68504006",
"0.68322504",
"0.6824092",
"0.6779067",
"0.677389",
"0.67732257",
"0.6763765",
"0.6734603",
"0.67255276",
"0.6657145",
"0.6647442",
"0.6646464",
"0.66054416",
"0.6589272",
"0.656056",
"0.65575373",
"0.6523152",
"0.65073544",
"0.6457461",
"0.64375997",
"0.64147294",
"0.6393432",
"0.6388621",
"0.63703424",
"0.6338075",
"0.6306095",
"0.6306095",
"0.6276022",
"0.6265856",
"0.6257892",
"0.6257892",
"0.6255289",
"0.62392384",
"0.6233974",
"0.61999786",
"0.61999786",
"0.6189316",
"0.618588",
"0.6185369",
"0.61750776",
"0.6174678",
"0.6167212",
"0.61670214",
"0.6157096",
"0.6154464",
"0.6154464",
"0.6154464",
"0.612885",
"0.61255926",
"0.61042666",
"0.6102111",
"0.61013156",
"0.6100162",
"0.60879743",
"0.608767",
"0.6067289",
"0.60550076",
"0.60507596",
"0.60504925",
"0.6049341",
"0.604742",
"0.60448384",
"0.60418737",
"0.60418737",
"0.60418737",
"0.60180396",
"0.6009333",
"0.6005991",
"0.59984505",
"0.59956825",
"0.59829897",
"0.5982643",
"0.5976883",
"0.59570587",
"0.59431154",
"0.59334016",
"0.59333044",
"0.5931132",
"0.5925678",
"0.5924929",
"0.5923886",
"0.5923886",
"0.5923886",
"0.59232444",
"0.59211653",
"0.5919913",
"0.5917953",
"0.5913933",
"0.5898935",
"0.58971196",
"0.58943504",
"0.5887949",
"0.58873445",
"0.5885702",
"0.5883959"
] | 0.80193347 | 0 |
GET /variations GET /variations.json | def index
if @indexer.present?
@variations = @indexer.variations
render json: @variations
else
render json: ErrorSerializer.to_404('Indexer'), status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all(product_id, params = {})\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/variations\", params)\n\n handle_response(response, status)\n end",
"def index\n @variations = Variation.all\n end",
"def index\n @variations = Variation.all\n end",
"def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end",
"def show\n @product = Product.find(params[:id])\n @variations = @product.variations.not_deleted\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def get_variation()\n # Check if a value has been chosen and if not, choose 50 or 100.\n if @metadata[:variations] == nil\n @metadata[:variations] = [50, 100].choose\n end\n return @metadata[:variations]\n end",
"def index\n @variations = Variation.all\nend",
"def index\n @product_variations = ProductVariation.all\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def variations\n raw_variations = item_hash.deep_find([:variations, :variation])\n list = []\n return list if raw_variations.nil?\n raw_variations = [raw_variations] unless raw_variations.is_a?(Array)\n raw_variations.each do |variation|\n sku = variation[:sku]\n next if sku.nil? || sku.strip.length == 0\n price = variation[:start_price]\n quantity_listed = variation[:quantity].to_i\n selling_status_sold = variation.deep_find([:selling_status, :quantity_sold])\n quantity_sold = selling_status_sold.nil? ? 0 : selling_status_sold.to_i\n quantity_available = quantity_listed - quantity_sold\n list << { sku: sku.strip,\n current_price: price,\n quantity_available: quantity_available,\n quantity_listed: quantity_listed,\n quantity_sold: quantity_sold }\n end\n list\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def variation\n params[:variation]\n end",
"def index\n @variences = Varience.all\n end",
"def show\n @flavor = compute.get_flavor(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @flavor }\n end\n end",
"def find(product_id, variation_id)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/variations/#{variation_id}\")\n\n handle_response(response, status)\n end",
"def show\n # accept the params\n # go to the db and get the correct recipe for that param\n p params[:id]\n @recipe = Recipe.find_by(id: params[:id])\n @ingredients = @recipe.ingredients.split(\", \").map {|ingredient| ingredient.capitalize}\n # send this to the view\n # show that data to the user\n render 'show.json.jb'\n end",
"def get_sizes\n @item = Item.find(params[:id])\n @sizes = @item.variants_for(:size, nil, params[:colour])\n respond_to do |format|\n format.json { render :json => @sizes }\n end\n end",
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def set_variety\n @variety = Variety.find(params[:id])\n end",
"def ingredient_data\n respond_to do |format|\n format.json { render json: helpers.get_ingredient(params[:ingredient_type], params[:ingredient_id]) }\n end\n end",
"def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end",
"def get_colours\n @item = Item.find(params[:id])\n @colours = @item.variants_for(:colour, params[:size], nil)\n respond_to do |format|\n format.json { render :json => @colours }\n end\n end",
"def show\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spanish_vocab }\n end\n end",
"def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @recipeIngredients = RecipeIngredient.where(:recipeId => params[:id])\n @ingredients = Ingredient.where(:id => @recipeIngredients.select(:ingredientId))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_choices = @store.dish_choices\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_choices }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def show\n @ingredients_name = IngredientsName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredients_name }\n end\n end",
"def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end",
"def show\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def show\n render json: @recipe\n end",
"def show\n @variant = Variant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variant }\n end\n end",
"def show\n @variant = Variant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variant }\n end\n end",
"def show\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def has_variations?\n item_hash.key?(:variations)\n end",
"def variation\n variations.first\n end",
"def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def show\n @ingredient = Ingredient.find_by_url_slug(params[:id])\n @ingredient = Ingredient.find(params[:id]) if @ingredient.nil?\n @recipes = @ingredient.recipes.order('created_at DESC')\n logger.debug @recipes.inspect\n respond_to do |format|\n format.html {render :layout => 'wall'}\n format.json { render json: @ingredient }\n end\n end",
"def show\n @picture = Picture.find(params[:id]) || Picture.first\n @variation = @picture.variations.last\n end",
"def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end",
"def show\n mix = BreedMix.find(params[:id])\n render json: mix\n end",
"def show\n @store = Store.find(params[:store_id])\n @dish_choice = @store.dish_choices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_choice }\n end\n end",
"def index\n @varieties = Variety.accessible_by(current_ability)\n @varieties = @varieties.where(product_id: params[:product]) if params[:product]\n end",
"def flavors()\n return get_request(address(\"/flavors/detail\"), @token)\t\n end",
"def show\n render json: @choice\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end",
"def get_negotiations(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/conversation_proxies/:uid/negotiations(.:format)',:get,params,add_params)\n end",
"def show\n @cut = Cut.find(params[:id])\n @animal_name = Animal.find(@cut.animal_id).animal_name\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cut }\n end\n end",
"def name_variations(name)\n variations = []\n variations.push(name)\n variations.push(name.downcase)\n variations.push(name.upcase)\n variations.push(name.gsub(/[ _-]/, ''))\n return variations\nend",
"def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end",
"def show\n\n recipe = Recipe.find(params[:id])\n render :json => recipe.to_json\n\n end",
"def init_variety\n @variety = Variety.find(params[:id])\n @product = @variety.product\n @product_id = @product.id\n end",
"def show\n render json: @food_product\n end",
"def index\n @search = Variety.ransack(params[:q])\n @variety = Variety.new\n @varieties = @search.result.order(created_at: :desc).page(params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def show\n render json: @dog\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end",
"def new\n @animal = Animal.new\n @zoo = Zoo.find(params[:zoo_id])\n @species = ['Lion', 'Koala', 'Panda']\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @animal }\n end\n end",
"def set_variation\n @variation = Variation.find(params[:id])\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def new\n @variation = @experiment.variations.build\n end",
"def show\n @adotando_animal = AdotandoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adotando_animal }\n end\n end",
"def list_varieties\n\treturn if authorise_for_web('varieties','read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:varieties_page] = params['page']\n\n\t\t render_list_varieties\n\n\t\t return \n\telse\n\t\tsession[:varieties_page] = nil\n\tend\n\n\tlist_query = \"@variety_pages = Paginator.new self, Variety.count, @@page_size,@current_page\n\t @varieties = Variety.find(:all,\n\t\t\t\t :limit => @variety_pages.items_per_page,\n\t\t\t\t :offset => @variety_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_varieties\nend",
"def index\n @diet_ingredient_types = DietIngredientType.all\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @taxonomy = Taxonomy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n render json: animal.as_json(include: :sightings) \n end",
"def index\n pet_type = PetType.find(params[:pet_type_id])\n @pet_breeds = pet_type.pet_breeds.select { | match | match.published }\n\n respond_to do | format |\n format.html #index.html.erb\n format.json { render json: @pet_breeds }\n end\n end",
"def get_other_varieties(product)\n variety = []\n product_details = data.products[product]\n data.products.each do |key, this|\n if get_brand_name(product).eql?(get_brand_name(key)) && \n product_details.category.eql?(this.category) && \n product_details.type.eql?(this.type) &&\n !product.eql?(key)\n variety.push(link_to(this.scent, this.affiliate_link))\n end\n end\n return variety\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend",
"def show\n @variate = Variate.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @variate.to_xml }\n end\n end",
"def create\n @variation = Variation.new(variation_params)\n\n respond_to do |format|\n if @variation.save\n format.html { redirect_to @variation, notice: 'Variação criada com sucesso.' }\n format.json { render :show, status: :created, location: @variation }\n else\n format.html { render :new }\n format.json { render json: @variation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def values\n render :json => gen_slugs(params[:term].upcase)\n end",
"def create\n @variety = Variety.new(variety_params)\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue creada' }\n format.json { render :show, status: :created, location: @variety }\n format.js{}\n else\n format.html { render :new }\n format.js{}\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_variation\n @variation = Variation.find(params[:id])\n end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @criterion }\n end\n end",
"def show\n set_glossary_locale(params[:locale]) if params[:locale]\n\n respond_to do |format|\n format.html {\n redirect_to glossary_terms_path(params[:id])\n }\n format.json {\n @glossary = Glossary.find(params[:id]).prepare_for_display\n render json: @glossary\n }\n end\n end",
"def show\n @men_fashion = MenFashion.find(params[:id])\n @photos = @men_fashion.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @men_fashion }\n end\n end",
"def index \n recipeIngredients = RecipeIngredient.all\n #render will return the object back in json format so that it can be used by the frontend\n render json: recipeIngredients\n end",
"def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end",
"def show\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kategory }\n end\n end",
"def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end",
"def set_variation\n @variation ||= Variation.find(params[:id])\n end",
"def index\n @sub_variants = SubVariant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sub_variants }\n end\n end",
"def show\n @species = Species.find(params[:id])\n @animals = Animal.where(:species_id => @species.id).order(\"name ASC\")\n \n respond_with(@species)\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json { render json: @recipe }\n end\n end",
"def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end",
"def show\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_recipe }\n end\n end",
"def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end",
"def load_variations(sheet)\n sheet.each METHOD_ROW do |row|\n parents = row[VARIATION_INDEX].to_s.strip\n if parents.empty?\n next\n else\n variant_name = row[METHOD_INDEX].to_s.strip\n variation = DesignMethod.where(name: variant_name).first\n\n parents.split(/, */).each do |parent|\n parent_method = DesignMethod.where(name: parent).first\n if variation && parent_method\n parent_method.variations << variation\n p \" Added: #{variant_name} is variation of #{parent}\"\n end\n end\n end\n end\nend",
"def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end"
] | [
"0.7173117",
"0.6954198",
"0.6954198",
"0.6881798",
"0.6810022",
"0.6711844",
"0.66704345",
"0.66340417",
"0.64411163",
"0.62418133",
"0.6041744",
"0.60115874",
"0.5977257",
"0.5946519",
"0.5925508",
"0.5916899",
"0.5857388",
"0.5843686",
"0.58338875",
"0.5817141",
"0.5812605",
"0.58041054",
"0.5781504",
"0.5781485",
"0.5731097",
"0.57273555",
"0.571409",
"0.56991565",
"0.567646",
"0.5652078",
"0.563928",
"0.5629832",
"0.56275636",
"0.562452",
"0.56233567",
"0.56233186",
"0.5620124",
"0.5620124",
"0.56175584",
"0.5617555",
"0.5612081",
"0.56075203",
"0.5600346",
"0.5599471",
"0.5598485",
"0.55782926",
"0.5574764",
"0.5571554",
"0.55663335",
"0.5554425",
"0.5552522",
"0.5517026",
"0.5515945",
"0.55140954",
"0.5512937",
"0.5512383",
"0.55104274",
"0.55064297",
"0.55015147",
"0.5491518",
"0.5490771",
"0.5487805",
"0.548763",
"0.548325",
"0.54823536",
"0.5477381",
"0.5472809",
"0.5466148",
"0.5454917",
"0.5450788",
"0.5445787",
"0.5444454",
"0.5442284",
"0.54356915",
"0.5429551",
"0.54224986",
"0.54193074",
"0.5410236",
"0.54065746",
"0.5399801",
"0.5395623",
"0.5394396",
"0.5393432",
"0.5391698",
"0.53913957",
"0.5390363",
"0.5388196",
"0.5386903",
"0.5383933",
"0.5383729",
"0.5383541",
"0.5382937",
"0.5381853",
"0.53792846",
"0.53765434",
"0.5376525",
"0.53756416",
"0.5375438",
"0.53740275",
"0.53717744"
] | 0.6581413 | 8 |
POST /variations POST /variations.json | def create
if @indexer.present?
@variation = Variation.new(variation_params)
if @variation.save
render json: @variation, status: :created # Ver como resolver o location
else
render json: ErrorSerializer.to_422('Variation', @variation.errors.messages), status: :unprocessable_entity
end
else
render json: ErrorSerializer.to_404('Indexer'), status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @variety = Variety.new(variety_params)\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue creada' }\n format.json { render :show, status: :created, location: @variety }\n format.js{}\n else\n format.html { render :new }\n format.js{}\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @variation = Variation.new(variation_params)\n\n respond_to do |format|\n if @variation.save\n format.html { redirect_to @variation, notice: 'Variação criada com sucesso.' }\n format.json { render :show, status: :created, location: @variation }\n else\n format.html { render :new }\n format.json { render json: @variation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @variation = Variation.new(variation_params)\n\n respond_to do |format|\n if @variation.save\n format.html { redirect_to @variation, notice: \"Variation was successfully created.\" }\n format.json { render :show, status: :created, location: @variation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @variation.errors, status: :unprocessable_entity }\n end\n end\nend",
"def create\n @variety = Variety.new(variety_params)\n @product_id = params[:variety][:product_id]\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to @variety, notice: 'Variety was successfully created.' }\n format.json { render :show, status: :created, location: @variety }\n else\n format.html { render :new }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_variation = ProductVariation.new(product_variation_params)\n\n respond_to do |format|\n if @product_variation.save\n format.html { redirect_to @product_variation, notice: 'Product variation was successfully created.' }\n format.json { render :show, status: :created, location: @product_variation }\n else\n format.html { render :new }\n format.json { render json: @product_variation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def variation_params\n params.require(:variation).permit(\n :tagline,\n :content,\n :asana_id,\n exercise_attributes: %i[id name image],\n tag_ids: [],\n )\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def product_variety_params\n params.require(:product_variety).permit(:name, :description, :harvest_ids, :selection_ids, :sale_ids, :product_id)\n end",
"def create\n @varience = Varience.new(varience_params)\n\n respond_to do |format|\n if @varience.save\n format.html { redirect_to @varience, notice: 'Varience was successfully created.' }\n format.json { render action: 'show', status: :created, location: @varience }\n else\n format.html { render action: 'new' }\n format.json { render json: @varience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def variety_params\n params.require(:variety).permit(:name)\n end",
"def create\n @variety = Variety.new(params[:variety])\n @variety.company_id = current_user.company_id\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to varieties_path, notice: \"#{@variety.name} fue creada exitosamente.\" }\n format.json { render json: @variety, status: :created, location: @variety }\n else\n format.html { render action: \"new\" }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def variation_params\n params.require(:variation).permit(:project_item_id, :approved, :project_id, :item_id, :item_attribute_id)\n end",
"def create\n @product_variety = ProductVariety.new(product_variety_params)\n\n respond_to do |format|\n if @product_variety.save\n format.js\n format.html { redirect_to @product_variety, notice: 'Product variety was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product_variety }\n else\n format.js\n format.html { render action: 'new' }\n format.json { render json: @product_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @variation = @experiment.variations.build\n end",
"def all(product_id, params = {})\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/variations\", params)\n\n handle_response(response, status)\n end",
"def ad_params\n params.require(:ad).permit(:variations, :description)\n end",
"def create\n @variate = Variate.new(params[:variate])\n\n flash[:notice] = 'Variate was successfully created.' if @variate.save\n respond_with @variate\n end",
"def set_variety\n @variety = Variety.find(params[:id])\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"def variation\n params[:variation]\n end",
"def index\n @variations = Variation.all\n end",
"def index\n @variations = Variation.all\n end",
"def create\n @variate = Variate.new(params[:variate])\n\n respond_to do |format|\n if @variate.save\n flash[:notice] = 'Variate was successfully created.'\n format.html { redirect_to variate_url(@variate) }\n format.xml { head :created, :location => variate_url(@variate) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @variate.errors.to_xml }\n end\n end\n end",
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def form_variation_object(name, variation, price, category)\n object = {\n id: \"##{variation}\",\n type: SquareConnect::CatalogObjectType::ITEM_VARIATION,\n item_variation_data: {\n item_id: name,\n name: variation,\n category_id: category,\n # pricing_type: SquareConnect::CatalogPricingType::FIXED_PRICING,\n pricing_type: SquareConnect::CatalogPricingType::VARIABLE_PRICING,\n # price_money: {\n # amount: (price.to_f * 100).to_i,\n # currency: SquareConnect::Currency::USD\n # }\n }\n }\n end",
"def get_variation()\n # Check if a value has been chosen and if not, choose 50 or 100.\n if @metadata[:variations] == nil\n @metadata[:variations] = [50, 100].choose\n end\n return @metadata[:variations]\n end",
"def index\n if @indexer.present?\n @variations = @indexer.variations\n render json: @variations\n else\n render json: ErrorSerializer.to_404('Indexer'), status: :not_found\n end\n end",
"def variation_params\n params.require(:variation).permit(:price, :stock, :sku, :product_id,:size_id, :color_id)\n end",
"def create\n @varietywine = Varietywine.new(varietywine_params)\n\n respond_to do |format|\n if @varietywine.save\n format.html { redirect_to @varietywine, notice: 'Сорт вина успешно создан.' }\n format.json { render :show, status: :created, location: @varietywine }\n else\n format.html { render :new }\n format.json { render json: @varietywine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_variation\n @variation = Variation.find(params[:id])\n end",
"def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end",
"def index\n @variations = Variation.all\nend",
"def index\n @product_variations = ProductVariation.all\n end",
"def varience_params\n params.require(:varience).permit(:varience, :desc)\n end",
"def create\n @variation = Variation.new(variation_params)\n\n if @variation.project_item.item_attribute_id.present?\n @post = Post.new(\n content: \"VARIATION ADDED - #{@variation.project_item.item.title} (#{@variation.project_item.item_attribute.title}) for #{@variation.project_item.item_group.title} in the #{@variation.project_item.zone.title}\",\n user_id: current_user.id,\n project_id: @variation.project_item.project_id\n )\n @post.save!\n else\n @post = Post.new(\n content: \"VARIATION ADDED - #{@variation.project_item.item.title} for #{@variation.project_item.item_group.title} in the #{@variation.project_item.zone.title}\",\n user_id: current_user.id,\n project_id: @variation.project_item.project_id\n )\n @post.save!\n end\n\n respond_to do |format|\n if @variation.save\n\n \n\n format.html { redirect_to project_path(@variation.project_id), notice: 'Variation was successfully created.' }\n format.json { render :show, status: :created, location: @variation }\n else\n format.html { render :new }\n format.json { render json: @variation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @animal = Animal.new\n @zoo = Zoo.find(params[:zoo_id])\n @species = ['Lion', 'Koala', 'Panda']\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @animal }\n end\n end",
"def product_variation_params\n params.require(:product_variation).permit(:product_id, :variation_id, :stock)\n end",
"def create\n ingredient = Ingredient.create(ingredient_params)\n render json: ingredient\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def animal_params\n params.require(:animal).permit(:name, :longevity, :preys_id => [], :predators_id => [])\n end",
"def create\n @diet_ingredient_type = DietIngredientType.new(diet_ingredient_type_params)\n\n respond_to do |format|\n if @diet_ingredient_type.save\n format.html { redirect_to @diet_ingredient_type, notice: 'Diet ingredient type was successfully created.' }\n format.json { render :show, status: :created, location: @diet_ingredient_type }\n else\n format.html { render :new }\n format.json { render json: @diet_ingredient_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n #@recipe.ingrediences = Ingredience.find(@params[:ingredience_ids]) if @params[:ingredience_ids]\n respond_to do |format|\n if @recipe.save\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to(@recipe) }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n @ingrediences = Ingredience.find(:all, :order => 'title')\n @categories = Category.find(:all, :conditions => [\"food = ?\", true])\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n cat = Cat.find(params[:cat_id])\n @adopted_pet = @selection.add_cat(cat.id)\n\n respond_to do |format|\n if @adopted_pet.save\n format.html { redirect_to adoption_url}\n format.js\n format.json { render action: 'show', status: :created, location: @adopted_pet }\n else\n format.html { render action: 'new' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end",
"def create\n recipeIngredient = rRcipeIngredient.create(recipeIngredient_params)\n render json: recipeIngredient\n end",
"def create\n @variant = Variant.new(variant_params)\n @variant.good = @good\n\n respond_to do |format|\n if @variant.save\n format.html { redirect_to edit_admin_good_url(@variant.good, anchor: \"variants\"), notice: 'Variant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variant }\n else\n format.html { render action: 'new' }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_variation\n @variation = Variation.find(params[:id])\n end",
"def create\n @variant = @product.variants.new(params.require(:variant).permit!)\n @variant.price = params[:variant][:price]\n respond_to do |format|\n if @variant.save\n format.html { redirect_to admin_product_variants_url(@product), notice: 'Variant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variant }\n else\n format.html { render action: 'new' }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @varietal = Varietal.new(params[:varietal])\n\n respond_to do |format|\n if @varietal.save\n format.html { redirect_to(varietals_path, :notice => 'Varietal was successfully created.') }\n format.xml { render :xml => @varietal, :status => :created, :location => @varietal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @varietal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @choice = Choice.new(choice_params)\n\n if @choice.save\n render json: @choice, status: :created, location: @choice\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @dis_ingredient = DisIngredient.new(dis_ingredient_params)\n\n respond_to do |format|\n if @dis_ingredient.save\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @dis_ingredient }\n else\n format.html { render :new }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lection_params\n params.require(:lection).permit(:title, :description, :speciality, :body, :tag_list)\n end",
"def destroy\n @variety = Variety.find(params[:id])\n @variety.destroy\n\n respond_to do |format|\n format.html { redirect_to varieties_url }\n format.json { head :no_content }\n end\n end",
"def create\n @wine_variety = WineVariety.new(wine_variety_params)\n\n respond_to do |format|\n if @wine_variety.save\n format.html { redirect_to @wine_variety, notice: \"Wine variety was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_variety }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wine_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def new\n @flavor = Flavor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @flavor }\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def create\n \n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ PARAMS: #{params}\"\n @variant = Variant.new(params[:variant])\n\n respond_to do |format|\n if @variant.save\n format.html { redirect_to event_path(Product.find(params[:variant][\"product_id\"])), notice: 'Ticket type was successfully created.' }\n format.json { render json: @variant, status: :created, location: @variant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def params_ingredient\n params.permit(:drink_id, :ratio, :volume_alcohol)\n end",
"def create\n @spanish_vocab = SpanishVocab.new(params[:spanish_vocab])\n\n respond_to do |format|\n if @spanish_vocab.save\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully created.' }\n format.json { render json: @spanish_vocab, status: :created, location: @spanish_vocab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spanish_vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n\n respond_to do |format|\n if @vocabulary.save\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary }\n else\n format.html { render :new }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def variant_params\n params.require(:variant).permit(:name, :precio, :product)\n end",
"def show\n @product = Product.find(params[:id])\n @variations = @product.variations.not_deleted\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def create\n render json: Dish.create(dish_params)\n end",
"def create\n # {\"vcpus\": 1, \"disk\": 1, \"name\": \"test\", \"rxtx_factor\": 1, \"OS-FLV-EXT-DATA:ephemeral\": 1, \"ram\": 512, \"id\": 6, \"swap\": 1}}'\n @flavor = compute.create_flavor(\"rxtx_factor\"=>1,\"OS-FLV-EXT-DATA:ephemeral\"=>params[:ephemeral],:vcpus=>params[:vcpus],:disk=>params[:disk],:name=>params[:name],:ram=>params[:ram],:id=>params[:id],:swap=>params[:swap])\n\n respond_to do |format|\n format.html { redirect_to flavors_path, :notice => 'Flavor was successfully created.' }\n format.json { render :json => @flavor, :status => :created, :location => @flavor }\n end\n end",
"def destroy\n @variety.destroy\n respond_to do |format|\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue eliminada' }\n format.json { head :no_content }\n end\n end",
"def create\n @advertisment = Advertisment.new(advertisment_params)\n @advertisment.user_id = current_user.id\n @advertisment.brand_id = params[:brand_id]\n @advertisment.variant_id = params[:varientid]\n respond_to do |format|\n if @advertisment.save\n format.html { redirect_to @advertisment, notice: 'Advertisment was successfully created.' }\n format.json { render :show, status: :created, location: @advertisment }\n else\n format.html { render :new }\n format.json { render json: @advertisment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postulation_pet = PostulationPet.new(postulation_pet_params)\n respond_to do |format|\n if @postulation_pet.save\n\n @postulation_pet.addAnswer(params[:postulation_pet][:answer_pets], @postulation_pet.id )\n\n format.html { redirect_to @postulation_pet, notice: 'Postulation pet was successfully created.' }\n format.js\n # format.json { render :show, status: :created, location: @postulation_pet }\n else\n format.html { render :new }\n format.js\n # format.json { render json: @postulation_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_variation\n @variation ||= Variation.find(params[:id])\n end",
"def variants_params\n params.require(:product).permit(:name, :permalink, :skuid, :price, :cost_price, :tax_rate_id, :size_id, :quantity, :product_id)\n end",
"def varietywine_params\n params.require(:varietywine).permit(:name, :type_of_wine, :color, :aging_in_barrels, :aging_in_bottles,\n {relationships_attributes: [:_destroy, :id, :ratio,\n :grapesort_id, {grapesort_attributes: [:destroy, :id, :name, :place_of_production, :date_of_collection]}\n]}\n)\n end",
"def create\n @recipe_prod = RecipeProd.new(recipe_prod_params)\n\n respond_to do |format|\n if @recipe_prod.save\n format.html { redirect_to @recipe_prod, notice: 'Recipe prod was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_prod }\n else\n format.html { render :new }\n format.json { render json: @recipe_prod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def new\n @variant = Variant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variant }\n end\n end",
"def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @variation.destroy\n respond_to do |format|\n format.html { redirect_to variations_url, notice: 'Variação excluida com sucesso'}\n format.json { head :no_content }\n end\n end",
"def set_varience\n @varience = Varience.find(params[:id])\n end",
"def create\n @criterion = Criterion.new(params[:criterion])\n\n if @criterion.save\n render json: @criterion, status: :created, location: @criterion\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def new\n @spanish_vocab = SpanishVocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spanish_vocab }\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create_variation_with_http_info(location_id, item_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.create_variation ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.create_variation\" if location_id.nil?\n # verify the required parameter 'item_id' is set\n fail ArgumentError, \"Missing the required parameter 'item_id' when calling V1ItemsApi.create_variation\" if item_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1ItemsApi.create_variation\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/items/{item_id}/variations\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'item_id' + '}', item_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Variation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#create_variation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @specialization_category = SpecializationCategory.new(specialization_category_params)\n\n respond_to do |format|\n if @specialization_category.save\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_category }\n else\n format.html { render :new }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :url, :instructions, :picture_url, :menu_type, allergy_ids: [], ingredient_ids: [])\n end",
"def init_variety\n @variety = Variety.find(params[:id])\n @product = @variety.product\n @product_id = @product.id\n end",
"def create\n @recipe = Recipe.find(params[:recipe_id])\n @food = Food.find(params[:food_id])\n @compound = Compound.new\n @compound.food = @food\n @compound.recipe_id = params[:recipe_id]\n @compound.grams = 100\n\n respond_to do |format|\n if @compound.save\n format.html { redirect_to subcategory_foods_path(@food.subcategory),\n notice: 'Compuesto añadido a la receta actual. acceda al menú para finalizar la creación de la receta.' }\n format.json { render :show, status: :created, location: @compound }\n else\n format.html { render :new }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_product_variety\n @product_variety = ProductVariety.find(params[:id])\n end",
"def new\n @ingredient = Ingredient.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ingredient }\n end\n end",
"def create\n @post_ingredient = @post.post_ingredients.build(post_ingredient_params)\n\n respond_to do |format|\n if @post_ingredient.save\n format.html { redirect_to post_post_ingredients_path(@post), notice: \"Post ingredient was successfully created.\" }\n format.json { render :show, status: :created, location: @post_ingredient }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\trespond_with Species.create(species_params)\n\tend",
"def variant_params\n params.require(:variant).permit(:name)\n end",
"def create\n @sub_variant = SubVariant.new(params[:sub_variant])\n\n respond_to do |format|\n if @sub_variant.save\n format.html { redirect_to @sub_variant, notice: 'Sub variant was successfully created.' }\n format.json { render json: @sub_variant, status: :created, location: @sub_variant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sub_variant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingredient_suggestion = IngredientSuggestion.new(ingredient_suggestion_params)\n\n respond_to do |format|\n if @ingredient_suggestion.save\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient_suggestion }\n else\n format.html { render :new }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @recipeingredient = Recipe_ingredient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def has_variations?\n item_hash.key?(:variations)\n end",
"def index\n @product_varieties = ProductVariety.all\n @product_variety = ProductVariety.new\n end",
"def create\n @measured_ingredient = MeasuredIngredient.new(measured_ingredient_params)\n\n respond_to do |format|\n if @measured_ingredient.save\n format.html { redirect_to @measured_ingredient, notice: 'Measured ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @measured_ingredient }\n else\n format.html { render :new }\n format.json { render json: @measured_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flavor = Flavor.new(flavor_params)\n\n respond_to do |format|\n if @flavor.save\n format.html { redirect_to @flavor, notice: 'Flavor was successfully created.' }\n format.json { render :show, status: :created, location: @flavor }\n else\n format.html { render :new }\n format.json { render json: @flavor.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6731026",
"0.6665459",
"0.65123886",
"0.6409058",
"0.63312393",
"0.62752223",
"0.6267235",
"0.61545205",
"0.6154145",
"0.61067826",
"0.6077112",
"0.6059716",
"0.60490584",
"0.60006464",
"0.5938976",
"0.5919521",
"0.5910436",
"0.587525",
"0.58142024",
"0.5803933",
"0.5802745",
"0.5802745",
"0.57828",
"0.577094",
"0.5741332",
"0.57374394",
"0.57191324",
"0.5668395",
"0.56626445",
"0.5652127",
"0.56247187",
"0.5612539",
"0.5609567",
"0.5590252",
"0.55744827",
"0.55588746",
"0.5551419",
"0.5550039",
"0.5545086",
"0.5539494",
"0.5537602",
"0.5533933",
"0.5530338",
"0.55276424",
"0.55087185",
"0.54904735",
"0.5478117",
"0.5474176",
"0.5452439",
"0.5448386",
"0.54462785",
"0.5438886",
"0.54312515",
"0.5422191",
"0.54095525",
"0.53968984",
"0.5387772",
"0.53876346",
"0.53862774",
"0.53785914",
"0.5377818",
"0.53759676",
"0.5368961",
"0.53671396",
"0.53539294",
"0.53539085",
"0.53529793",
"0.5330681",
"0.53273714",
"0.5322861",
"0.531687",
"0.531511",
"0.5310129",
"0.53010345",
"0.52859646",
"0.528331",
"0.5277553",
"0.5275611",
"0.5271464",
"0.52696455",
"0.5261919",
"0.5259202",
"0.5257136",
"0.52544594",
"0.525342",
"0.52503854",
"0.52479464",
"0.5247579",
"0.52470034",
"0.5246502",
"0.52400815",
"0.5239364",
"0.5237837",
"0.5234267",
"0.52337396",
"0.5227377",
"0.52269256",
"0.5225162",
"0.5224133",
"0.5222126"
] | 0.59614366 | 14 |
DELETE /variations/1 DELETE /variations/1.json | def destroy
if @indexer.present?
if @indexer.belongs_to(@variation)
@variation.destroy
head :no_content
else
render json: ErrorSerializer.to_404('Variation'), status: :not_found
end
else
render json: ErrorSerializer.to_404('Indexer'), status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @variety = Variety.find(params[:id])\n @variety.destroy\n\n respond_to do |format|\n format.html { redirect_to varieties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variation.destroy\n respond_to do |format|\n format.html { redirect_to variations_url, notice: 'Variação excluida com sucesso'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @variety.destroy\n respond_to do |format|\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue eliminada' }\n format.json { head :no_content }\n end\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @variation.destroy\n respond_to do |format|\n format.html { redirect_to variations_url, notice: \"Variation was successfully destroyed.\" }\n format.json { head :no_content }\n end\nend",
"def destroy\n @variant.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@variant.good, anchor: \"variants\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variety.destroy\n respond_to do |format|\n format.html { redirect_to varieties_url, notice: 'Variety was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variate = Variate.find(params[:id])\n @variate.destroy\n\n respond_to do |format|\n format.html { redirect_to variates_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_variation.destroy\n respond_to do |format|\n format.html { redirect_to product_variations_url, notice: 'Product variation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variate.destroy\n\n respond_to do |format|\n format.html { redirect_to variates_url }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @varience.destroy\n respond_to do |format|\n format.html { redirect_to variences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product_variety.destroy\n respond_to do |format|\n format.js\n format.html { redirect_to product_varieties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_ingredient_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_ingredient_types_url, notice: 'Diet ingredient type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end",
"def destroy\n @spanish_vocab = SpanishVocab.find(params[:id])\n @spanish_vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to spanish_vocabs_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @varietal = Varietal.find(params[:id])\n @varietal.destroy\n\n respond_to do |format|\n format.html { redirect_to(varietals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @variant.destroy\n respond_to do |format|\n format.html { redirect_to admin_product_variants_url(@product) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to ingredients_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @adoption_dog.destroy\n respond_to do |format|\n format.html { redirect_to adoption_dog_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n @recipe_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ink_varnish = InkVarnish.find(params[:id])\n @ink_varnish.destroy\n\n respond_to do |format|\n format.html { redirect_to ink_varnishes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @variant = Variant.find(params[:id])\n @variant.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_product_variants_url(@variant.master_id) }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n @recipe_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appliance_type = ApplianceType.find(params[:id])\n @appliance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to appliance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dis_ingredient.destroy\n respond_to do |format|\n format.html { redirect_to dis_ingredients_url, notice: 'Dis ingredient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @varietywine.destroy\n respond_to do |format|\n format.html { redirect_to varietywines_url, notice: 'Сорт вина успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_recipe = FoodRecipe.find(params[:id])\n @food_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to food_recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_scenic_spots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mixture.destroy\n respond_to do |format|\n format.html { redirect_to mixtures_url, notice: \"Mixture was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @liquidacion = Liquidacion.find(params[:id])\n\n #Elimino todos los conceptos incluidos en la liquidacion\n @conceptos_liquidacion = ConceptoLiquidacion.where(:liquidacion_id => @liquidacion.id)\n @conceptos_liquidacion.each do |concepto|\n concepto.destroy\n end\n\n @liquidacion.destroy\n respond_to do |format|\n format.html { redirect_to liquidacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measured_ingredient.destroy\n respond_to do |format|\n format.html { redirect_to measured_ingredients_url, notice: 'Measured ingredient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = option_model.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_type.destroy\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n head :no_content\n end",
"def destroy\n @var_conf = VarConf.find(params[:id])\n @var_conf.destroy\n\n respond_to do |format|\n format.html { redirect_to var_confs_url }\n format.json { head :ok }\n end\n end",
"def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end",
"def destroy\n @wine_variety.destroy\n respond_to do |format|\n format.html { redirect_to wine_varieties_url, notice: \"Wine variety was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:store_id])\n @dish_choice = @store.dish_choices.find(params[:id])\n @dish_choice.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_choices_url(@store) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cake_flavor.destroy\n respond_to do |format|\n format.html { redirect_to cake_flavors_url, notice: 'Cake flavor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affectation = Affectation.find(params[:id])\n @affectation.destroy\n\n respond_to do |format|\n format.html { redirect_to affectations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_attribute = TaxonAttribute.find(params[:id])\n @taxon_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_attributes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredients_nutrient.destroy\n respond_to do |format|\n format.html { redirect_to ingredients_nutrients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end",
"def destroy\n @skin_diet.destroy\n respond_to do |format|\n format.html { redirect_to admin_show_path, notice: 'Skin diet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chicken_adoption.destroy\n respond_to do |format|\n format.html { redirect_to chicken_adoptions_url, notice: 'Chicken adoption was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adopcion = Adoption.find(@pet.adoptions_id)\n\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to admin_pets_path, notice: 'La mascota fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n\n @adopcion.destroy\n\n end",
"def destroy\n @sub_variant = SubVariant.find(params[:id])\n @sub_variant.destroy\n\n respond_to do |format|\n format.html { redirect_to sub_variants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to sentence_options_url, notice: 'option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @constitution = Constitution.find(params[:id])\n @constitution.destroy\n\n respond_to do |format|\n format.html { redirect_to constitutions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @ingredient.recipe\n @ingredient.destroy\n respond_to do |format|\n format.html { redirect_to @ingredient.recipe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog_expense.destroy\n respond_to do |format|\n format.html { redirect_to dog_expenses_url }\n format.json { head :no_content }\n end\n end",
"def delete_option\n option_param = params.permit(:id)\n\n render json: Option.delete_option(option_param)\n end",
"def destroy\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bagtype = Bagtype.find(params[:id])\n @bagtype.destroy\n\n respond_to do |format|\n format.html { redirect_to bagtypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ingredient_recipe.destroy\n respond_to do |format|\n format.html { redirect_to ingredient_recipes_url, notice: 'Ingredient recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n @mostsmalltrapeffectinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapeffectinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to vocabularies_url, notice: 'Vocabulary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @avaliation.destroy\n respond_to do |format|\n format.html { redirect_to avaliations_url, notice: 'Avaliation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @dor_variant_performance.destroy\n respond_to do |format|\n format.html { redirect_to dor_variant_performances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @asproduct = Asproduct.find(params[:id])\n @asproduct.destroy\n\n respond_to do |format|\n format.html { redirect_to asproducts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredients_name = IngredientsName.find(params[:id])\n @ingredients_name.destroy\n\n respond_to do |format|\n format.html { redirect_to ingredients_names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end",
"def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7356382",
"0.73307234",
"0.7236511",
"0.704547",
"0.7022853",
"0.7014466",
"0.6995624",
"0.6934989",
"0.6920931",
"0.6867219",
"0.6842477",
"0.6826637",
"0.6779561",
"0.67754567",
"0.66830385",
"0.6619788",
"0.65975",
"0.6590745",
"0.65842605",
"0.6575495",
"0.6573792",
"0.6568702",
"0.6541126",
"0.65310305",
"0.65277755",
"0.6509874",
"0.6504418",
"0.6476597",
"0.6476426",
"0.6472237",
"0.6467985",
"0.6447847",
"0.6442284",
"0.6441112",
"0.64386994",
"0.643797",
"0.64366585",
"0.6428184",
"0.6424737",
"0.642345",
"0.6413149",
"0.6413123",
"0.6412586",
"0.6411956",
"0.64038837",
"0.6403316",
"0.63953125",
"0.63948166",
"0.6385644",
"0.63811266",
"0.63771564",
"0.637685",
"0.6369246",
"0.63690454",
"0.6367583",
"0.63612854",
"0.6358565",
"0.6358126",
"0.6353758",
"0.6352313",
"0.6352313",
"0.6351763",
"0.6347074",
"0.63388234",
"0.6336529",
"0.633643",
"0.63357013",
"0.63341933",
"0.6326028",
"0.63255",
"0.6318824",
"0.6314072",
"0.6313761",
"0.6311736",
"0.63108844",
"0.63091546",
"0.6308113",
"0.6300483",
"0.63002527",
"0.62982565",
"0.6296517",
"0.6294034",
"0.6293695",
"0.62931323",
"0.62924945",
"0.62910014",
"0.62872934",
"0.62870604",
"0.6287041",
"0.6287041",
"0.6287041",
"0.6287041",
"0.6287041",
"0.62857395",
"0.62831676",
"0.62809277",
"0.6271973",
"0.6271973",
"0.6271973",
"0.6271973"
] | 0.65309983 | 24 |
order the rectangles as per assumptions | def order_rectangles(rec1, rec2)
r1 = Rectangle.new(rec1)
r2 = Rectangle.new(rec2)
r1 = order_coord_of_rectangles(r1)
r2 = order_coord_of_rectangles(r2)
if r2.A.X < r1.A.X
temp = r1
r1 = r2
r2 = temp
end
ret = [r1, r2]
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n # Rects Adjustments\n \n # ucEncounters\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = rect.width - rects[0][0].width - rects[0][1].width\n \n # ucDefeated\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = rect.width - rects[1][0].width - rects[1][1].width\n \n # ucEscaped\n rects[2][0].y += spacing*2\n rects[2][1].x += rects[2][0].width\n rects[2][1].y = rects[2][0].y\n rects[2][2].x = rects[2][1].x + rects[2][1].width\n rects[2][2].y = rects[2][0].y\n rects[2][2].width = rect.width - rects[2][0].width - rects[2][1].width\n \n # ucExp\n rects[3][0].y += spacing*3\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = rect.width - rects[3][0].width - rects[3][1].width\n \n # ucGold\n rects[4][0].y += spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].x = rects[4][1].x + rects[4][1].width\n rects[4][2].y = rects[4][0].y\n rects[4][2].width = rect.width - rects[4][0].width - rects[4][1].width\n \n return rects\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,90,24),\n Rect.new(rect.x,rect.y,100,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[8] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[9] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[10] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[11] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n gauge_value_width = rect.width - 24 - 25 - right_pad\n stats_value_width = rect.width - 24 - 50 - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucActStates\n rects[0][1].x += rects[0][0].width\n \n # ucHpStat\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[2].y += rects[1][0].y+gauge_y\n rects[2].height = rects[1][0].height-gauge_y\n \n # ucMpStat\n rects[3][0].y += spacing*2\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[4].y += rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n \n # ucAtkStat\n rects[5][0].y += spacing*3\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].x = rects[5][1].x + rects[5][1].width\n rects[5][2].y = rects[5][0].y\n rects[5][2].width = stats_value_width\n \n # ucDefStat\n rects[6][0].y += spacing*4\n rects[6][1].x += rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][2].x = rects[6][1].x + rects[6][1].width\n rects[6][2].y = rects[6][0].y\n rects[6][2].width = stats_value_width\n \n # ucSpiStat\n rects[7][0].y += spacing*5\n rects[7][1].x += rects[7][0].width\n rects[7][1].y = rects[7][0].y\n rects[7][2].x = rects[7][1].x + rects[7][1].width\n rects[7][2].y = rects[7][0].y\n rects[7][2].width = stats_value_width\n \n # ucAgiStat\n rects[8][0].y += spacing*6\n rects[8][1].x += rects[8][0].width\n rects[8][1].y = rects[8][0].y\n rects[8][2].x = rects[8][1].x + rects[8][1].width\n rects[8][2].y = rects[8][0].y\n rects[8][2].width = stats_value_width\n \n # ucEvaStat\n rects[9][0].y += spacing*7\n rects[9][1].x += rects[9][0].width\n rects[9][1].y = rects[9][0].y\n rects[9][2].x = rects[9][1].x + rects[9][1].width\n rects[9][2].y = rects[9][0].y\n rects[9][2].width = stats_value_width\n \n # ucHitStat\n rects[10][0].y += spacing*8\n rects[10][1].x += rects[10][0].width\n rects[10][1].y = rects[10][0].y\n rects[10][2].x = rects[10][1].x + rects[10][1].width\n rects[10][2].y = rects[10][0].y\n rects[10][2].width = stats_value_width\n \n # ucCriStat\n rects[11][0].y += spacing*9\n rects[11][1].x += rects[11][0].width\n rects[11][1].y = rects[11][0].y\n rects[11][2].x = rects[11][1].x + rects[11][1].width\n rects[11][2].y = rects[11][0].y\n rects[11][2].width = stats_value_width\n \n return rects\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[4] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[5] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[6] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[7] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[8] = Rect.new(rect.x,rect.y,rect.width,24)\n \n # Rects Adjustments\n \n # ucHpCompareStat\n # Nothing to do\n \n # ucMpCompareStat\n rects[1].y += spacing\n \n # ucAtkCompareStat\n rects[2].y += spacing*2\n \n # ucDefCompareStat\n rects[3].y += spacing*3\n \n # ucSpiCompareStat\n rects[4].y += spacing*4\n \n # ucAgiCompareStat\n rects[5].y += spacing*5\n \n # ucEvaCompareStat\n rects[6].y += spacing*6\n \n # ucHitCompareStat\n rects[7].y += spacing*7\n \n # ucCriCompareStat\n rects[8].y += spacing*8\n \n return rects\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,96,96)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucCharFace\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*2\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[2][0].y += spacing\n rects[2][0].width -= rects[2][1].width\n rects[2][1].x += (rects[2][0].width / 2).floor + rects[2][1].width\n rects[2][1].y = rects[2][0].y\n \n # ucHpStat \n rects[3][0].y += rect.height - spacing*4\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].y = rects[3][0].y + spacing\n rects[3][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[4].y = rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n\n # ucMpStat\n rects[5][0].y += rect.height - spacing*2\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].y = rects[5][0].y + spacing\n rects[5][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[6].y = rects[5][0].y+gauge_y\n rects[6].height = rects[5][0].height-gauge_y\n \n return rects\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,96,96)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucCharFace\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*2\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[2][0].y += spacing\n rects[2][0].width -= rects[2][1].width\n rects[2][1].x += (rects[2][0].width / 2).floor + rects[2][1].width\n rects[2][1].y = rects[2][0].y\n \n # ucHpStat \n rects[3][0].y += rect.height - spacing*4\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].y = rects[3][0].y + spacing\n rects[3][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[4].y = rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n\n # ucMpStat\n rects[5][0].y += rect.height - spacing*2\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].y = rects[5][0].y + spacing\n rects[5][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[6].y = rects[5][0].y+gauge_y\n rects[6].height = rects[5][0].height-gauge_y\n \n return rects\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,100,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[3] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[5] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[6] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[8] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[9] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucActStates\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*3\n \n # cCharImage\n rects[1].height -= spacing*3\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[3][0].y += spacing\n rects[3][0].width -= rects[3][1].width\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n \n # ucHpStat \n rects[4][0].y += rect.height - spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].y = rects[4][0].y + spacing\n rects[4][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[5].y = rects[4][0].y+gauge_y\n rects[5].height = rects[4][0].height-gauge_y\n \n # ucMpStat\n rects[6][0].y += rect.height - spacing*2\n rects[6][1].x += rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][2].y = rects[6][0].y + spacing\n rects[6][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[7].y = rects[6][0].y+gauge_y\n rects[7].height = rects[6][0].height-gauge_y\n \n # ucExpStat\n rects[8][0].y += spacing\n rects[8][1].x += rects[8][0].width\n rects[8][1].y = rects[8][0].y\n rects[8][2].y = rects[8][0].y + spacing\n rects[8][2].width = gauge_value_width\n \n # cExpGauge\n rects[9].y = rects[8][0].y+gauge_y\n rects[9].height = rects[8][0].height-gauge_y\n \n return rects\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n value_width = ((rect.width - rects[0][0].width - rects[0][1].width - rects[1][0].width - spacing)/2).floor\n \n # Rects Adjustments\n \n # ucStat\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = value_width\n \n # ucCompareStat\n rects[1][0].x = rects[0][2].x + rects[0][2].width + spacing\n rects[1][1].x = rects[1][0].x + rects[1][0].width\n rects[1][1].width = value_width\n \n return rects\n end",
"def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cEquipName\n rects[1].x += rects[0].width\n rects[1].width -= rects[0].width\n \n return rects\n end",
"def rectangles_finder(arr)\n rectangle_spots = {} # will keep track of where rectangles occupy\n rectangles = [] # will keep track of the rectangle corners for output\n\n arr.each_with_index do |row, i|\n row.each_with_index do |el, j|\n if el == 1 && !rectangle_spots.include?([i, j])\n # Found a new rectangle corner\n ul = [i, j]\n br = bottom_right(arr, ul)\n\n # Add the rectangle corners to the output\n rectangles << [ul, br]\n\n # Add the new coordinates to the hash\n rectangle_spots = update_hash(rectangle_spots, [ul, br])\n end\n end\n end\n\n # Return the rectangles\n rectangles\nend",
"def intersecting_rectanges(rect1, rect2)\n\n intersecting_rect_width = 0\n intersecting_rect_height = 0\n intersecting_rect_left_x = 0\n intersecting_rect_bottom_y = 0\n\n if rect1[:left_x] + rect1[:width] > rect2[:left_x] && rect2[:left_x] > rect1[:left_x]\n intersecting_rect_width = rect1[:left_x] + rect1[:width] - rect2[:left_x]\n intersecting_rect_left_x = rect2[:left_x]\n elsif rect2[:left_x] + rect2[:width] > rect1[:left_x] && rect1[:left_x] > rect2[:left_x]\n intersecting_rect_width = rect2[:left_x] + rect2[:width] - rect1[:left_x]\n intersecting_rect_left_x = rect1[:left_x]\n end\n\n if rect1[:bottom_y] + rect1[:height] > rect2[:bottom_y] && rect2[:bottom_y] > rect1[:bottom_y]\n intersecting_rect_height = rect1[:bottom_y] + rect1[:height] - rect2[:bottom_y]\n intersecting_rect_bottom_y = rect1[:bottom_y]\n elsif rect2[:bottom_y] + rect2[:height] > rect1[:bottom_y] && rect1[:bottom_y] > rect2[:height]\n intersecting_rect_height = rect2[:bottom_y] + rect2[:height] - rect1[:bottom_y]\n intersecting_rect_bottom_y = rect2[:bottom_y]\n end\n \n {\n :left_x => intersecting_rect_left_x,\n :bottom_y => intersecting_rect_bottom_y,\n\n :width => intersecting_rect_width,\n :height => intersecting_rect_height\n }\nend",
"def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,20)\n \n # Rects Adjustments\n \n # cVolumeLabel\n rects[0].width = (rect.width/3).floor\n \n # ucVolumeBar\n rects[1].x += rects[0].width\n rects[1].y += ((rect.height - rects[1].height)/2).floor\n rects[1].width -= rects[0].width\n \n # cMuteLabel\n rects[2].x += rects[0].width\n rects[2].y = rects[1].y\n rects[2].width = rects[1].width\n \n # cVolumeValue\n rects[3].x += rects[0].width\n rects[3].y = rects[1].y\n rects[3].width = rects[1].width\n \n return rects\n end",
"def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,20)\n \n # Rects Adjustments\n \n # cVolumeLabel\n rects[0].width = (rect.width/3).floor\n \n # ucVolumeBar\n rects[1].x += rects[0].width\n rects[1].y += ((rect.height - rects[1].height)/2).floor\n rects[1].width -= rects[0].width\n \n # cMuteLabel\n rects[2].x += rects[0].width\n rects[2].y = rects[1].y\n rects[2].width = rects[1].width\n \n # cVolumeValue\n rects[3].x += rects[0].width\n rects[3].y = rects[1].y\n rects[3].width = rects[1].width\n \n return rects\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,64,rect.height)\n rects[3] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[4] = Rect.new(rect.x,rect.y,32,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cItemName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - rects[3].width - rects[4].width - (spacing*3)\n \n # cItemPrice\n rects[2].x += rect.width - rects[2].width - rects[3].width - rects[4].width - (spacing*2)\n \n # cItemPossess \n rects[3].x += rect.width - rects[3].width - rects[4].width - spacing\n \n # ucItemNumber\n rects[4].x += rect.width - rects[4].width\n \n return rects\n end",
"def place position\n x,y = position\n\n leftmost = most(position, Left)\n rightmost= most(position, Right)\n topmost= most(position, Top)\n bottommost= most(position, Bottom)\n\n (leftmost[0]..rightmost[0]).each {|x| @horizontal.delete [x,y]}\n (topmost[1]..bottommost[1]).each {|y| @vertical.delete [x,y]}\n\n @horizontal[leftmost] = rightmost[0]\n @vertical[topmost] = bottommost[1] \n end",
"def boxes_with_consistent_order\n boxes.sort { |b1, b2| b1.schema_id <=> b2.schema_id }\n end",
"def smallest_rect_for_points(points)\n # Create an initial rect which covers only one point\n initial_point = points.first\n rect = Rect.new(\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left)\n )\n \n # Expand it so it fills every point\n points.each do |point|\n # Check left\n if point.left < rect.top_left.left\n rect.top_left.left = point.left\n rect.bottom_left.left = point.left\n end\n\n # Check right\n if point.left > rect.top_right.left\n rect.top_right.left = point.left\n rect.bottom_right.left = point.left\n end\n\n # Check top\n if point.top < rect.top_left.top\n rect.top_left.top = point.top\n rect.top_right.top = point.top\n end\n\n # Check bottom\n if point.top > rect.bottom_left.top\n rect.bottom_left.top = point.top\n rect.bottom_right.top = point.top\n end\n end\n\n rect\nend",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,32,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cItemName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - spacing\n \n # cItemNumber\n rects[2].x += rect.width - rects[2].width\n \n return rects\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,32,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cItemName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - spacing\n \n # cItemNumber\n rects[2].x += rect.width - rects[2].width\n \n return rects\n end",
"def reformat\n\t\t\tif self.r < self.l\n\t\t\t\t# swap r and l\n\t\t\t\tswap = self.r\n\t\t\t\tself.r = self.l\n\t\t\t\tself.l = swap\n\t\t\tend\n\t\t\tif self.t < self.b\n\t\t\t\t# swap top and bottom\n\t\t\t\tswap = self.t\n\t\t\t\tself.t = self.b\n\t\t\t\tself.b = swap\n\t\t\tend\n\t\tend",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,48,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cSkillName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - spacing\n \n # cSkillMpCost\n rects[2].x += rect.width - rects[2].width\n \n return rects\n end",
"def sort_plates2(plates)\n plates each do |pl|\n p pl\n bnds = pl.bounds.diagonal.to_f.round(4)\n\n #(idea) create a hash of objects and thier diagonal and compact it.\n #check definition instances against each other for diagonal\n\n #make differences unique and update the definition\n\n #check that the now true thickness matches the material thickness\n\n #give warnings when some of these occur.\n end\n\n end",
"def get_draw_ordering\n # raise \"Need to override via subclass\"\n nil\n end",
"def get_bounding_rectangle\n leftmost_x = @panel.get_width\n rightmost_x = 0\n top_y = @panel.get_height\n bottom_y = 0\n\n @entities.each do |e|\n e_x = e.get_x\n e_y = e.get_y\n\n if e_x < leftmost_x\n leftmost_x = e_x\n end\n\n if e_x + ENTITY_WIDTH > rightmost_x\n rightmost_x = e_x + ENTITY_WIDTH\n end\n\n if e_y < top_y\n top_y = e_y\n end\n\n if e_y + ENTITY_HEIGHT > bottom_y\n bottom_y = e_y + ENTITY_HEIGHT\n end\n\n #if leftmost_x - 17 > 0\n # leftmost_x = leftmost_x -17\n #else\n # leftmost_x = 0\n #end\n\n #if rightmost_x + 17 < @panel.get_width\n # rightmost_x = rightmost_x +17\n #else\n # rightmost_x = @panel.get_width\n #end\n\n #if top_y - 17 > 0\n # top_y = top_y -17\n #else\n # top_y = 0\n #end\n\n #if bottom_y + 17 < @panel.get_height\n # bottom_y = bottom_y + 17\n #else\n # bottom_y = @panel.get_height\n #end\n\n end\n return Rectangle.new leftmost_x, top_y, rightmost_x - leftmost_x, bottom_y - top_y\n end",
"def test_obb_vs_obb(rect_a, rect_b)\n @coll_depth = Numeric::POSITIVE_INFINITY\n 2.times do |i|\n axis_a = rect_a.axes[i]\n depth_a = test_intervals(rect_a.projection(axis_a), rect_b.projection(axis_a))\n return false if depth_a == 0\n\n axis_b = rect_b.axes[i]\n depth_b = test_intervals(rect_a.projection(axis_b), rect_b.projection(axis_b))\n return false if depth_b == 0\n\n abs_a = depth_a.abs\n abs_b = depth_b.abs\n\n if abs_a < @coll_depth.abs or abs_b < @coll_depth.abs\n altb = abs_a < abs_b\n @coll_normal = altb ? axis_a : axis_b\n @coll_depth = altb ? depth_a : depth_b\n end\n end\n\n @cpa = rect_a\n @cpb = rect_b\n true\n end",
"def calc_half_rects(rect)\n r = Convert.Rect(rect)\n r1 = r.dup\n r1.width /= 2\n r2 = r.dup\n r2.width -= r1.width\n r2.x += r1.width\n return r, r1, r2\n end",
"def rect; end",
"def rect; end",
"def rectangle(x1, y1, x2, y2)\n return nil if x1 > x2 || y1 > y2 || x1 < 0 || y1 < 0 || x2 > @width || y2 > @height\n pixels = []\n\n @height.times do |x|\n row = Array.new(@width, 0)\n @width.times do |y|\n row[y] = y >= y1 && y <= y2 && x >= x1 && x <= x2 ? 1 : 0 \n end\n pixels << row\n end\n \n PNM.create(pixels, {:type => :pbm})\n end",
"def rectangle_finder(arr)\n # Find the upper left coordinates\n ul_row = arr.index { |row| row.include?(1) }\n ul_col = arr[ul_row].index(1)\n\n # Find the bottom right coordinates from this\n br = bottom_right(arr, [ul_row, ul_col])\n\n # Return the two together\n [[ul_row, ul_col], br]\nend",
"def color_valid_positions\n return if @item.nil?\n \n center_color = Color.new(83,142,250)\n outer_color = Color.new(250,40,100)\n \n cx = cy = (contents.width-@grid_square_size)/@grid_square_size/2 * @grid_square_size + 1\n sq = @grid_square_size-1\n\n points = !(t = @item.tbs_spec_range).nil? ? t[$game_temp.tb_event.dir_to_sym_era] : simple_range\n \n return if points.nil?\n \n points.each do |v|\n offset_x, offset_y = v.x * @grid_square_size, v.y * @grid_square_size\n sz = grid_side\n px,py = cx + offset_x + sq, cy + offset_y + sq\n contents.fill_rect(px-sq,py-sq,sq,sq, outer_color) if px < sz && py < sz\n end\n contents.fill_rect(cx, cy,sq,sq, center_color) # center\n end",
"def inRectangle(points)\n\tpointsY = points.sort{|a, b| a[Y_COORDINATE] <=> b[Y_COORDINATE]}\n\treturn false if pointsY[0][Y_COORDINATE] > ORIGIN[Y_COORDINATE]\n\treturn false if pointsY[2][Y_COORDINATE] < ORIGIN[Y_COORDINATE]\n\tpointsX = points.sort{|a, b| a[X_COORDINATE] <=> b[X_COORDINATE]}\n\treturn false if pointsX[0][X_COORDINATE] > ORIGIN[X_COORDINATE]\n\treturn false if pointsX[2][X_COORDINATE] < ORIGIN[X_COORDINATE]\n\treturn true\nend",
"def arrange\n\t\t\n\tend",
"def show_squares_between\n case direction\n when 'left'\n ['b1', 'c1', 'd1']\n when 'right'\n ['f1', 'g1']\n end\n end",
"def sortBorderPoints\n border_points.sort { |a,b| a.local_index <=> b.local_index }\n end",
"def rect=(rectangle); end",
"def displayRect(length, width)\n #Line\n for i in 0...width\n #Col\n for j in 0...length\n #Draw 0 each coin\n if((i == 0 && j == 0) || (i == width - 1 && j == length - 1) || (i == 0 && j == length - 1) || (i == width - 1 && j == 0))\n print \"O\"\n else\n need_space = true\n #Draw | by see col\n if((j == 0) || (j == length - 1))\n print \"|\"\n need_space = false\n end\n #Draw - by see line\n if((i == 0) || (i == width - 1))\n print \"-\"\n need_space = false\n end\n\n if (need_space)\n print \" \"\n end\n end\n end\n puts \"\\n\"\n end\nend",
"def position_claims\n claims.each do |claim|\n claim_squares(claim)\n end\n end",
"def drag_to_order( dimension, items )\n positions = Array.new\n items.each_index do |n|\n item=$driver.find_element( items[n][0].to_sym, items[n][1] )\n positions[n] = item.location.send( dimension )\n end\n positions.sort!\n $debug and print \"In drag_to_order: items: #{YAML.dump(items)}\\n\"\n $debug and print \"In drag_to_order: positions: #{YAML.dump(positions)}\\n\"\n drag_to_order_internal( dimension, items, positions )\n\n # Then we re-pull the positions and check them\n last=0\n current=0\n items.each_index do |n|\n item=$driver.find_element( items[n][0].to_sym, items[n][1] )\n current = item.location.send( dimension )\n current.should satisfy { |current| current > last }\n last = current\n end\n end",
"def arrange_tiled\n # some simplifying assumptions for constants that may need revisiting for more flexibility\n margin_v = 5\n row_height = 30\n \n rows = self.rows_of_subviews\n row_v_position = 5\n rows.each { |row|\n total_element_width = row.inject(0) {|r, view| r += view.width}\n total_margin_width = self.width - total_element_width\n margin_h = total_margin_width / (row.count + 1) # e.g. if 3 views, there are 4 margins\n \n x_tally = 0\n row.each { |view|\n view.center = CGPointMake(x_tally + margin_h + (view.width / 2), row_v_position + (row_height / 2))\n x_tally += margin_h + view.width\n }\n \n row_v_position += row_height\n }\n end",
"def compute_dungeon_corners\n @d_top_left_x = @d_top_left_y = @d_bottom_right_x = @d_bottom_right_y = 0\n @rooms.each do |room|\n top_left_x, top_left_y, bottom_right_x, bottom_right_y = room.room_corners\n\n @d_top_left_x = top_left_x if top_left_x < @d_top_left_x\n @d_top_left_y = top_left_y if top_left_y < @d_top_left_y\n\n @d_bottom_right_x = bottom_right_x if bottom_right_x > @d_bottom_right_x\n @d_bottom_right_y = bottom_right_y if bottom_right_y > @d_bottom_right_y\n end\n end",
"def bad_find_corners(all_inputs, min_max)\n puts \"#{__method__}:: \"\n\n x_sort = all_inputs.sort_by {|_key, value| value['x']}\n y_sort = all_inputs.sort_by {|_key, value| value['y']}\n\n min_max['x_min'] = x_sort[0][1]['x']\n min_max['x_max'] = x_sort[-1][1]['x']\n min_max['y_min'] = y_sort[0][1]['y']\n min_max['y_max'] = y_sort[-1][1]['y']\n pp min_max\n\n #tr = (x - point['x']).abs + (y - point['y']).abs\n tl = min_max['y_max'] + min_max['x_max']\n tl_label = ''\n x = 0\n y = 0\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < tl\n tl = d\n tl_label = label\n end\n end\n\n bl = min_max['y_max'] + min_max['x_max']\n bl_label = ''\n x = 0\n y = min_max['y_max']\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < bl\n bl = d\n bl_label = label\n end\n end\n\n tr = min_max['y_max'] + min_max['x_max']\n tr_label = ''\n x = min_max['x_max']\n y = 0\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < tr\n tr = d\n tr_label = label\n end\n end\n\n br = min_max['y_max'] + min_max['x_max']\n br_label = ''\n x = min_max['x_max']\n y = min_max['y_max']\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < br\n br = d\n br_label = label\n end\n end\n\n puts \"tl_label #{tl_label}\"\n puts \"bl_label #{bl_label}\"\n puts \"tr_label #{tr_label}\"\n puts \"br_label #{br_label}\"\n # pp x_sort\n # pp y_sort\n\n # Top right corner is a point that has overall max X and overall min\n # Y. Find it by sorting all points by x and all points by y. Then\n # start at largest X - 1 and smallest Y and look for point that has\n # matching y and label name.\n found = false\n x_sort.reverse.each do |xlabel, xpoint|\n y_sort[0..-2].each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH TR #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'TR'\n found = true\n break\n end\n end\n break if found\n end\n\n # Bottom left corner is similar to to top right.\n found = false\n x_sort[1..-1].each do |xlabel, xpoint|\n y_sort.reverse.each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH BL #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'BL'\n found = true\n break\n end\n end\n break if found\n end\n\n # Top left corner\n found = false\n x_sort.each do |xlabel, xpoint|\n y_sort.each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH TL #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'TL'\n found = true\n break\n end\n end\n break if found\n end\n\n # Bottom corner\n found = false\n x_sort.reverse.each do |xlabel, xpoint|\n y_sort.reverse.each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH BR #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'BR'\n found = true\n break\n end\n end\n break if found\n end\n\nend",
"def rect(col, row)\n row.times do |row_index|\n col.times do |col_index|\n @data[row_index][col_index] = true\n end\n end\n end",
"def proefssorted\n \tproefs.order(:position)\n end",
"def print_plateau(rovers)\n (0..boundary_y).reverse_each do |y|\n grid = \"\"\n (0..boundary_x).each do |x|\n roverNames = \"\"\n rovers.each_with_index do |rover, index|\n roverNames = \" #{index+1}\" if rover.position_x == x && rover.position_y == y\n end\n grid += roverNames.empty? ? \" +\" : roverNames\n end\n puts grid\n end\n end",
"def rect(a, b, screen)\n screen[0...b].each do |row|\n row[0...a] = (\"#\"*a).split(\"\")\n end\n\n screen\nend",
"def rect_to_lines(rect)\n x = rect[:x]\n y = rect[:y]\n x2 = rect[:x] + rect[:w]\n y2 = rect[:y] + rect[:h]\n [{ x: x, y: y, x2: x2, y2: y },\n { x: x, y: y, x2: x, y2: y2 },\n { x: x2, y: y, x2: x2, y2: y2 },\n { x: x, y: y2, x2: x2, y2: y2 }]\n end",
"def rectangular\n [re, im]\n end",
"def split\n sw = (w / 2.0).round\n sh = (h / 2.0).round\n return Rect.new(x, y, sw, sh),\n Rect.new(x + sw, y, sw, sh),\n Rect.new(x, y + sh, sw, sh),\n Rect.new(x + sw, y + sh, sw, sh)\n end",
"def sort_trophies_by_priority(trophies)\n #number of trophies per row\n per_row_small = 16\n per_row_medium = 4\n per_row_large = 1\n\n\n rows = []\n per_row = per_row_small + per_row_medium + per_row_large\n num_rows = (trophies.size / per_row.to_f).ceil\n (1..num_rows).each {rows << {:far_left => [],:left => [],:center => [],:right => [],:far_right => []}}\n i = 0\n trophies.each do |trophy|\n #fill center first\n if i < num_rows*per_row_large\n rows[i/per_row_large][:center] << trophy\n #fill left and right rows next\n elsif i < (num_rows*per_row_medium+num_rows*per_row_large)\n j = i - num_rows\n if j.even?\n rows[j/per_row_medium][:left] << trophy\n else\n rows[j/per_row_medium][:right] << trophy\n end\n #fill far left and far right rows next\n elsif i < (num_rows* per_row_small + num_rows*per_row_medium+num_rows)\n j = i - num_rows*per_row_medium - num_rows\n if j.even?\n rows[j/per_row_small][:far_left] << trophy\n else\n rows[j/per_row_small][:far_right] << trophy\n end\n end\n i = i + 1\n end\n rows\n end",
"def rect_to_lines(rect)\n x = rect[:x]\n y = rect[:y]\n x2 = rect[:x] + rect[:w]\n y2 = rect[:y] + rect[:h]\n\n [{ x: x, y: y, x2: x2, y2: y },\n { x: x, y: y, x2: x, y2: y2 },\n { x: x2, y: y, x2: x2, y2: y2 },\n { x: x, y: y2, x2: x2, y2: y2 }]\n end",
"def overlap()\n\n # find max and min x coordinates in each rectangle\n max_rectangle_x = []\n min_rectangle_x = []\n (1..2).each do |i|\n max_rectangle_x[i] = 0\n min_rectangle_x[i] = 1000\n (1..4).each do |j|\n print \"Enter x_coordinate of corner #{j} of recatangle #{i}: \"\n x_coordinate = gets.chomp.to_i\n if max_rectangle_x[i] < x_coordinate\n max_rectangle_x[i] = x_coordinate\n end\n if min_rectangle_x[i] > x_coordinate\n min_rectangle_x[i] = x_coordinate \n end\n end\n end \n\n# find max and min y coordinates in each rectangle\n max_rectangle_y = []\n min_rectangle_y = []\n (1..2).each do |i|\n max_rectangle_y[i] = 0\n min_rectangle_y[i] = 1000\n (1..4).each do |j|\n print \"Enter y_coordinate of corner #{j} of recatangle #{i}: \"\n y_coordinate = gets.chomp.to_i\n if max_rectangle_y[i] < y_coordinate\n max_rectangle_y[i] = y_coordinate\n end\n if min_rectangle_y[i] > y_coordinate\n min_rectangle_y[i] = y_coordinate\n end\n end\n end \n\n# Do max/min tests for overlap [see top of program]\n\n puts \"max_rectangle_x[1] = #{max_rectangle_x[1]}\"\n puts \"min_rectangle_x[1] = #{min_rectangle_x[1]}\"\n puts \"max_rectangle_x[2] = #{max_rectangle_x[2]}\"\n puts \"min_rectangle_x[2] = #{min_rectangle_x[2]}\"\n puts \"max_rectangle_y[1] = #{max_rectangle_y[1]}\"\n puts \"min_rectangle_y[1] = #{min_rectangle_y[1]}\"\n puts \"max_rectangle_y[2] = #{max_rectangle_y[2]}\"\n puts \"min_rectangle_y[2] = #{min_rectangle_y[2]}\"\n\n if max_rectangle_x[1] < min_rectangle_x[2] || \\\n max_rectangle_x[2] < min_rectangle_x[1] || \\\n max_rectangle_y[1] < min_rectangle_y[2] || \\\n max_rectangle_y[2] < min_rectangle_y[1]\n puts \"Rectangles do not overlap\"\n else\n puts \"Rectangles overlap\" \n end\nend",
"def test_rectangle\n # A simple rectangle with more rows than columns\n @game.state = [[0,0],[0,0],[0,0]]\n after = @game.evolve\n assert_equal [[0,0],[0,0],[0,0]],after\n\n # A bigger rectangle with more columns than rows\n # and some life\n @game.state = [[0,0,0,0],[1,1,0,0],[0,0,0,1]]\n after = @game.evolve\n assert_equal [[1,0,0,0],[1,0,0,0],[1,0,0,0]],after\n end",
"def find_entry_rectangles(x_offset,y_offset,page_width,page_height) # take offset\n # how big is the header?\n header_height = page_height * HEADER_PROPORTION\n footer_height = page_height * FOOTER_PROPORTION\n entry_height = (page_height - header_height - footer_height) / ENTRIES_PER_PAGE\n \n entries = []\n ENTRIES_PER_PAGE.times do |i|\n entry_y = y_offset + header_height + entry_height*i\n slop_entry_y = entry_y - entry_height * 0.1\n slop_entry_height = entry_height * 0.2\n entries << [x_offset,slop_entry_y,page_width,slop_entry_height]\n end \n entries\n end",
"def item_rect(index)\n rect = Rect.new\n rect.width = item_width\n rect.height = item_height\n rect.x = item_position(index).at(0)\n rect.y = item_position(index).at(1)\n rect\n end",
"def rooms_sorted_by_area\n room_sort = @rooms.map do |room|\n room.sort_by {|area| area.size}\n end\n end",
"def item_rect(index)\n rect = Rect.new\n rect.width = item_width\n rect.height = item_height\n rect.x = index % col_max * (item_width + spacing)\n rect.y = line_height + (index / col_max * item_height)\n rect\n end",
"def passable_rect?(x, y, d, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n x4 = (x2 + x3) / 2.0\r\r\n y4 = (y2 + y3) / 2.0\r\r\n\r\r\n if((x2.floor != x3.floor && [1, 3, 4, 6, 7, 9].include?(d)) || (y2.floor != y3.floor && [1, 2, 3, 7, 8, 9].include?(d)))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x2, y2, 1)) || ([3, 6, 9].include?(d) && !check_passage(x2, y2, 4))\r\r\n return false if ([3, 6, 9].include?(d) && !check_passage(x2, y3, 4)) || ([7, 8, 9].include?(d) && !check_passage(x2, y3, 8))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x3, y2, 1)) || ([1, 4, 7].include?(d) && !check_passage(x3, y2, 2))\r\r\n return false if ([1, 4, 7].include?(d) && !check_passage(x3, y3, 2)) || ([7, 8, 9].include?(d) && !check_passage(x3, y3, 8))\r\r\n end\r\r\n return true\r\r\n end",
"def overlap(first_rect, second_rect)\n a1 = first_rect[0]\n a2 = first_rect[1]\n b1 = second_rect[0]\n b2 = second_rect[1]\n\n if b1[0] < a2[0] && b1[1] < a2[1]\n return true\n else \n return false\n end\n\nend",
"def initial_pos_boxes\n return BOX_X_RIGHT, BOX_Y\n end",
"def update_bounds(xs, ys)\n x_min = xs.min\n x_max = xs.max\n y_min = ys.min\n y_max = ys.max\n @left = x_min unless @left && x_min > @left\n @top = y_min unless @top && y_min > @top\n @right = x_max unless @right && x_max < @right\n @bottom = y_max unless @bottom && y_max < @bottom\n nil\n end",
"def rect_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 17.5, \"Click inside the red box below.\") # label with instructions\n red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box\n outputs.borders << red_box # output as a border (not filled in)\n\n # If the mouse is clicked inside the red box, two collision boxes are created.\n if inputs.mouse.click\n if inputs.mouse.click.point.inside_rect? red_box\n if !state.box_collision_one # if the collision_one box does not yet have a definition\n # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box.\n # You can try deleting the subtraction to see how it impacts the box placement.\n state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition\n elsif !state.box_collision_two # if collision_two does not yet have a definition\n state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition\n else\n state.box_collision_one = nil # both boxes are empty\n state.box_collision_two = nil\n end\n end\n end\n\n # If collision boxes exist, they are output onto screen inside the red box as solids\n if state.box_collision_one\n outputs.solids << state.box_collision_one\n end\n\n if state.box_collision_two\n outputs.solids << state.box_collision_two\n end\n\n # Outputs whether or not the two collision boxes intersect.\n if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty)\n if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect\n outputs.labels << small_label(x, 23.5, 'The boxes intersect.')\n else # otherwise, if the two boxes do not intersect\n outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.')\n end\n else\n outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output\n end\n end",
"def draw_rect(rect, color, zorder)\r\n $window.draw_line(rect.x, rect.y, color, rect.right, rect.y, color, zorder)\r\n $window.draw_line(rect.right, rect.y, color, rect.right, rect.bottom, color, zorder)\r\n $window.draw_line(rect.right, rect.bottom, color, rect.x, rect.bottom, color, zorder)\r\n $window.draw_line(rect.x, rect.bottom, color, rect.x, rect.y, color, zorder)\r\n end",
"def sort_sprites\n @viewport&.sort_z\n end",
"def natural_rect(logical_x, logical_y, x_range, y_range)\n [\n logical_x * @tile_width,\n logical_y * @tile_width,\n x_range * @tile_width,\n y_range * @tile_width\n ]\n end",
"def draw_graph_area(r,g,b,stripe=false)\n self.draw_filled_rectangle(@g_areax1,@g_area_y1,@g_area_x2,@g_area_y2,r,g,b,false)\n self.draw_rectangle(@g_area_x1,@g_area_y1,@g_area_x2,@g_area_y2,r-40,g-40,b-40)\n i=0\n if stripe\n r2 = r-15\n r2 = 0 if r2<0\n g2 = r-15\n g2 = 0 if g2 < 0\n b2 = r-15\n b2 = 0 if b2 < 0\n line_color = allocate_color(@picture,r2,g2,b2)\n skew_width = @g_area_y2-@g_area_y1-1\n \n i = @g_area_x1-skew_width\n \n while i.to_f<=@g_area_x2.to_f\n x1 = i\n y1 = @g_area_y2\n x2 = i+skew_width\n y2 = @g_area_y1\n if ( x1 < @g_area_x1 )\n x1 = @g_area_x1\n y1 = @g_area_y1 + x2 - @g_area_x1 + 1\n end\n if ( x2 >= @g_area_x2 )\n y2 = @g_area_y1 + x2 - @g_area_x2 +1\n x2 = @g_area_x2 - 1\n end\n image_line(@picture,x1,y1,x2,y2+1,r2,g2,b2)\n i = i+4\n end\n\n end\n end",
"def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x = index % 10 * 32 + index % 10 / 5 * 16\n rect.y = index / 10 * WLH\n rect.width = 32\n rect.height = WLH\n return rect\n end",
"def check_priority\n images = []\n if self.building_id\n Image.reorder_by_building(building_id)\n elsif self.unit_id\n Image.reorder_by_unit(unit_id)\n end\n end",
"def draw_graph_area(r,g,b,stripe=false)\n draw_filled_rectangle(@g_area_x1,@g_area_y1,@g_area_x2,@g_area_y2,r,g,b,false)\n draw_rectangle(@g_area_x1,@g_area_y1,@g_area_x2,@g_area_y2,r-40,g-40,b-40)\n i=0\n if stripe\n r2 = r-15\n r2 = 0 if r2<0\n g2 = r-15\n g2 = 0 if g2 < 0\n b2 = r-15\n b2 = 0 if b2 < 0\n line_color = allocate_color(@picture,r2,g2,b2)\n skew_width = @g_area_y2-@g_area_y1-1\n\n i = @g_area_x1-skew_width\n\n while i.to_f<=@g_area_x2.to_f\n x1 = i\n y1 = @g_area_y2\n x2 = i+skew_width\n y2 = @g_area_y1\n if ( x1 < @g_area_x1 )\n x1 = @g_area_x1\n y1 = @g_area_y1 + x2 - @g_area_x1 + 1\n end\n if ( x2 >= @g_area_x2 )\n y2 = @g_area_y1 + x2 - @g_area_x2 +1\n x2 = @g_area_x2 - 1\n end\n image_line(@picture,x1,y1,x2,y2+1,r2,g2,b2)\n i = i+4\n end\n\n end\n end",
"def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.width = (contents.width + @spacing) / @column_max - @spacing\n rect.height = (WLH * $game_message.multi_line_choice)\n rect.x = index % @column_max * (rect.width + @spacing)\n rect.y = index / @column_max * (WLH * $game_message.multi_line_choice)\n return rect\n end",
"def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end",
"def draw_squares()\n 0.upto(@w / 2) { |x|\n 0.upto(@h / 2) { |y|\n (0..1).each { |i|\n rect = [x * @bw * 2 + @bw * i, y * @bh * 2 + @bh * i, @bw, @bh]\n @im.fill_rect rect, @fg\n }\n }\n }\n end",
"def _locations_ordered_for_text_dump\n locations = Hash[(1..23).to_a.map {|row| [row, {}]}]\n @tiles.each {|t| locations [t.row * 4 ] [t.col * 4 - t.row * 2 + 5] = t}\n @up_vtexs.each {|v| locations [v.row * 4 - 3] [v.col * 4 - v.row * 2 + 5] = v}\n @down_vtexs.each {|v| locations [v.row * 4 + 3] [v.col * 4 - v.row * 2 + 5] = v}\n @asc_edges.each {|e| locations [e.row * 4 - 2] [e.col * 4 - e.row * 2 + 4] = e}\n @desc_edges.each {|e| locations [e.row * 4 - 2] [e.col * 4 - e.row * 2 + 6] = e}\n @vert_edges.each {|e| locations [e.row * 4 ] [e.col * 4 - e.row * 2 + 3] = e}\n return locations\n end",
"def draw_grid\n print_cap\n (0...@vertical).each do |vert_index|\n (0..@v_size).each do |block_height|\n (0...@horizontal).each do |horizontal_index|\n if block_height == (@v_size/2)\n print \"|\" + \" \"*(@h_size/2)\n \"#{print @contents[horizontal_index][vert_index]}|\"\n print \" \"*(@h_size/2-1)\n else\n print \"|\"; print \" \"*@h_size\n end\n end\n print \"|\\n\" \n \n end\n print_cap\n end\n end",
"def order; end",
"def order; end",
"def draw_board\n @board = stack do\n fill rgb(210,105,30)\n rect BOARD_SQUARE_POS[:board_start], BOARD_SQUARE_POS[:board_start], BLOCK_DIMENTION*CHECKERS_WIDTH , BLOCK_DIMENTION*CHECKERS_HEIGHT\n fill rgb(245,222,179)\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if x.even? && y.even?\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if !x.even? && !y.even?\n end\n end\n end\nend",
"def bottom\n self.ox = self.src_rect.width/2\n self.oy = self.src_rect.height\n end",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding) + line_height + standard_padding\n rect\n end",
"def draw_blocks\n case view\n when :south_east\n size_y.times do |y|\n size_x.times do |x|\n size_z.times do |z|\n draw_block(x, y, z, x, y, z)\n end\n end\n end\n when :south_west\n size_x.times do |y|\n size_y.times do |x|\n size_z.times do |z|\n draw_block(x, y, z, size_x - 1 - y, x, z)\n end\n end\n end\n when :north_west\n size_y.times do |y|\n size_x.times do |x|\n size_z.times do |z|\n draw_block(x, y, z, size_x - 1 - x, size_y - 1 - y, z)\n end\n end\n end\n when :north_east\n size_x.times do |y|\n size_y.times do |x|\n size_z.times do |z|\n draw_block(x, y, z, y, size_y - 1 - x, z)\n end\n end\n end\n #end case\n end\n end",
"def each_cell(rect)\n (rect.top_left.left..rect.top_right.left).each do |left|\n (rect.top_left.top..rect.bottom_left.top).each do |top|\n yield left, top\n end\n end\nend",
"def bound_in_rect(rect)\n result = rect\n if rect.x < 0\n result.width = rect.width - rect.x\n result.x = 0\n end\n if rect.y < 0\n result.height = result.height - rect.y\n result.y = 0\n end\n if rect.width > xsize\n result.width = xsize\n end\n if rect.height > ysize\n result.height = ysize\n end\n return result\n end",
"def draw_rotated(screen, angle_x = 0, angle_y = 0, angle_z = 0)\n\t\t@rect.each do |a|\n\t\t\t# get rotated points\n\t\t\tb = []\n\t\t\ta.each do |a2|\n\t\t\t\tb += [rotate_point(a2[0], a2[1], a2[2], 0, 0, 0, angle_x, angle_y, angle_z)]\n\t\t\tend\n\t\t\t# draw lines of rectangle\n\t\t\tline(screen, b[0], b[1])\n\t\t\tline(screen, b[1], b[2])\n\t\t\tline(screen, b[2], b[3])\n\t\t\tline(screen, b[3], b[0])\n\t\tend\n\tend",
"def bottomRightToTopLeft(grid, width, height)\n\n strings = topLeftToBottomRight(grid, width, height)\n\n for string in strings do\n string.reverse!\n end\n\n return strings\n\nend",
"def pos_rect?(x, y, rect)\r\r\n main_left = @x + collision_rect.x / 32.0\r\r\n main_top = @y + collision_rect.y / 32.0\r\r\n main_right = main_left + collision_rect.width / 32.0\r\r\n main_bottom = main_top + collision_rect.height / 32.0\r\r\n other_left = x + rect.x / 32.0\r\r\n other_top = y + rect.y / 32.0\r\r\n other_right = other_left + rect.width / 32.0\r\r\n other_bottom = other_top + rect.height / 32.0\r\r\n coltest = true\r\r\n coltest = false if main_right < other_left\r\r\n coltest = false if main_left > other_right\r\r\n coltest = false if main_bottom < other_top\r\r\n coltest = false if main_top > other_bottom\r\r\n if coltest == false && ($game_map.loop_horizontal? || $game_map.loop_vertical?) && x <= $game_map.width && y <= $game_map.height\r\r\n return true if $game_map.loop_horizontal? && pos_rect?(x + $game_map.width, y, rect)\r\r\n return true if $game_map.loop_vertical? && pos_rect?(x, y + $game_map.height, rect)\r\r\n end\r\r\n return coltest\r\r\n end",
"def reverse\r\n # Mirror the shape by the y axis, effectively creating shape counterparts such as 'L' and 'J'\r\n center = (get_bounds[2] + get_bounds[0]) / 2.0\r\n @blocks.each do |block|\r\n\t block.x = 2*center - block.x - @game.block_width\r\n\tend\r\n end",
"def check_horizontal_bingos\n @horizontal.each do |k, v|\n if size == v\n @num_bingos += 1\n circles.each do |circle|\n if circle.position_y == k\n update_circle(circle)\n end\n end\n end\n end\n end",
"def create_gr(entities)\n\tif($gr_side == \"SW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees\n\t\tt = Geom::Transformation.new [$gr_offset,0,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"SW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees\n\t\tt = Geom::Transformation.new [$length-$gr_offset,$width,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"EW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees\n\t\tt = Geom::Transformation.new [0,$width-$gr_offset,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"EW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees\n\t\tt = Geom::Transformation.new [$length,$gr_offset,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\t\nend",
"def sorted_question_items\n self.items.active.question_items.sort do |x1, x2| \n self.items_positions.index(x1.id) <=> self.items_positions.index(x2.id)\n end\n end",
"def rec_intersection(rect1, rect2)\n\txmin = rect1[0][0] > rect2[0][0] ? rect1[0][0] : rect2[0][0]\n\txmax = rect1[1][0] > rect2[1][0] ? rect2[1][0] : rect1[1][0]\n\tymin = rect1[0][1] > rect2[0][1] ? rect1[0][1] : rect2[0][1]\n\tymax = rect1[1][1] > rect2[1][1] ? rect2[1][1] : rect1[1][1]\n\nreturn nil if ((xmax < xmin) || (ymax < ymin))\nreturn [ [xmin, ymin], [xmax, ymax] ]\nend",
"def rect(a,b)\n new_cells = a.times.flat_map do |x|\n b.times.flat_map do |y|\n Cell.new(x,y,@width,@height)\n end\n end\n\n @cells.merge(new_cells)\n end",
"def item_rect(*args, &block)\n rect = super(*args, &block)\n rect.y += [(rect.height - 98) / 2, 0].max\n rect.height = 98\n rect\n end",
"def union!(rect)\n self.normalize!\n rleft, rtop = self.topleft\n rright, rbottom = self.bottomright\n r2 = Rect.new_from_object(rect).normalize!\n\n rleft = [rleft, r2.left].min\n rtop = [rtop, r2.top].min\n rright = [rright, r2.right].max\n rbottom = [rbottom, r2.bottom].max\n\n self[0,4] = rleft, rtop, rright - rleft, rbottom - rtop\n return self\n end",
"def get_horiz_beam_rect(x, y)\n beam_ul = [@hub_spacing/2 + @hub_spacing*x, (@hub_spacing/2 + @hub_spacing*y) - @hub_dia/2, 0]\n beam_lr = [@hub_spacing/2 + @hub_spacing*(x+1), (@hub_spacing/2 + @hub_spacing*y) + @hub_dia/2, 0]\n [beam_ul, beam_lr]\n end",
"def item_rect(index)\r\n rect = super\r\n rect.x = index * (item_width + spacing)\r\n rect.y = 0\r\n rect\r\n end",
"def recto_verso!\n self.type= 'physical' unless self.type == 'physical'\n self.label= 'Sides' unless self.label == 'Sides'\n create_div_node struct_map, {:order=>'1'} unless divs_with_attribute(false,'ORDER','1').first\n create_div_node struct_map, {:order=>'2'} unless divs_with_attribute(false,'ORDER','2').first\n if (div = divs_with_attribute(false,'ORDER','1').first)\n div['LABEL'] = 'Recto' unless div['LABEL'] == 'Recto'\n end\n if (div = divs_with_attribute(false,'ORDER','2').first)\n div['LABEL'] = 'Verso' unless div['LABEL'] == 'Verso'\n end\n struct_map\n end",
"def group_possible_moves_rook(pm)\n result = []\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] < position[1]\n end\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] > position[1]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] < position[0]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] > position[0]\n end\n result[0].reverse!\n result[2].reverse!\n result\n end",
"def bounding_box\r\n max_x, min_x, max_y, min_y = -Float::MAX, Float::MAX, -Float::MAX, Float::MAX, -Float::MAX, Float::MAX \r\n if with_z\r\n max_z, min_z = -Float::MAX, Float::MAX\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n [Point.from_x_y_z(min_x,min_y,min_z),Point.from_x_y_z(max_x,max_y,max_z)]\r\n else\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n end\r\n [Point.from_x_y(min_x,min_y),Point.from_x_y(max_x,max_y)]\r\n end\r\n end",
"def rect(id)\n\t\tpoints = Points.new\n\t\t\n\t\tif rect = @doc.at(\"//g rect[@id='#{id.to_s}']\")\n\t\t\t#\n\t\t\t# Generate all the points in a rectangle\n\t\t\t#\n\t\t\ttop_left = [rect[:x].to_f, rect[:y].to_f]\n\t\t\ttop_right = [rect[:x].to_f + rect[:width].to_f, rect[:y].to_f ]\n\t\t\tbottom_right = [rect[:x].to_f + rect[:width].to_f, rect[:y].to_f + rect[:height].to_f ]\n\t\t\tbottom_left = [rect[:x].to_f, rect[:y].to_f + rect[:height].to_f ]\n\t\t\t\n\t\t\tpoints << top_left\n\t\t\tpoints << bottom_left\n\t\t\tpoints << bottom_right\n\t\t\tpoints << top_right\n\t\tend\t\t\n\t\t@rects[id.to_sym] = points\n\tend",
"def test_alignTopRight\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(0, 80, @window.contents.width, 120), $data_actors[1], 2)\n uc.draw()\n }\n return true\n end",
"def positions_of_agents\n positions = []\n @figures.each {|f| positions << f.position}\n positions.shift\n positions\n end"
] | [
"0.6826875",
"0.6623872",
"0.6600286",
"0.648778",
"0.648778",
"0.64299035",
"0.6417485",
"0.6112955",
"0.5999371",
"0.5987383",
"0.5915914",
"0.59156555",
"0.58682764",
"0.58656216",
"0.58424985",
"0.5837189",
"0.5820636",
"0.5820636",
"0.5787926",
"0.5780684",
"0.57240295",
"0.56102484",
"0.56027627",
"0.55267525",
"0.544866",
"0.5420004",
"0.5420004",
"0.5416586",
"0.5390642",
"0.5389387",
"0.53823733",
"0.534352",
"0.53415036",
"0.5339081",
"0.53363454",
"0.53280944",
"0.53200084",
"0.53177655",
"0.52995896",
"0.5296227",
"0.52919954",
"0.5255238",
"0.5252542",
"0.52263397",
"0.5223876",
"0.5219832",
"0.5215908",
"0.52145404",
"0.52044934",
"0.51965064",
"0.51887023",
"0.51726675",
"0.5164569",
"0.5161983",
"0.51550436",
"0.5146208",
"0.513819",
"0.51381415",
"0.5135192",
"0.51196843",
"0.5118536",
"0.51158154",
"0.5115169",
"0.5111256",
"0.5076811",
"0.50745547",
"0.5072129",
"0.5070338",
"0.50689",
"0.5063324",
"0.5063027",
"0.5054876",
"0.50350535",
"0.5026262",
"0.5026262",
"0.50227225",
"0.5011936",
"0.5011532",
"0.4997874",
"0.4989483",
"0.4979812",
"0.49783844",
"0.4973452",
"0.496544",
"0.49645975",
"0.49606392",
"0.49583846",
"0.49503323",
"0.4948964",
"0.49487105",
"0.4944773",
"0.49429977",
"0.49419704",
"0.4936299",
"0.4934121",
"0.4934011",
"0.49257416",
"0.49236",
"0.49169034",
"0.4912034"
] | 0.74052614 | 0 |
get a script session id | def get_session_id
@agent.get( @root_url + '/dwr/engine.js') do |page|
@session_id = extract_session_id(page.body)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n @id ||= scgi.session_id\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def session_id\n @options[:session_id]\n end",
"def session_id\n session.transport.algorithms.session_id\n end",
"def session_id\n request.session_options[:id]\n end",
"def session_id\n leftbar_el =get_el doc.css(\"#navigator_bar\")\n return nil if leftbar_el.nil?\n leftbar = leftbar_el.content.to_s\n session_phrase = leftbar.match('Session id: \\d+').to_s\n sesh_id = session_phrase.match('\\d+').to_s.to_i\n sesh_id ||= -1\n return sesh_id\n end",
"def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end",
"def session_id\n @driver.session_id\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def id\n response_hash[:session_id]\n end",
"def session_id\n @grpc.name.split(\"/\")[7]\n end",
"def session_id\n @session_id ||= initiate_xmlrpc_session\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def session_id\n @response.xpath('//SessionId').text\n end",
"def get_session_id(name)\n sessions = parse_body get(\"#{admin_url}/sessions/summary\")\n current = sessions.find do |session|\n session[:name] == name\n end\n current&.dig(:id)\n end",
"def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def session_id\n Capybara.current_session.driver.browser.instance_variable_get(:@bridge).session_id\n end",
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def session_id_key\n @session_id_key\n end",
"def session_id\n @session_id || raise(Error::WebDriverError, 'no current session exists')\n end",
"def session_id\n @session_id ||= (bytes = [SecureRandom.uuid.gsub(DASH_REGEX, '')].pack(UUID_PACK)\n BSON::Document.new(id: BSON::Binary.new(bytes, :uuid)))\n end",
"def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end",
"def extract_session_id(env)\n request = Rack::Request.new(env)\n sid = request.cookies[@key]\n sid ||= request.params[@key] unless @cookie_only\n sid\n end",
"def get_session_id\n p \"==>cookie: #{cookies.inspect}\"\n p \"===>session id=#{session[:sid]} session uid = #{session[:uid]}\"\n p \"cookies[:_wh_session] = #{cookies[:_wh_session] }\"\n\n if cookies[:_wh_session] \n session[:uid] = nil if session[:sid] != session[:sid]\n session[:sid] = cookies[:_wh_session] \n end\n # \n # after uesr first register, the _wh_session will be set in user's cookie\n # which will send by all afteraward quest\n #\n if (params[:sid])\n # reset_session\n\n # p request.host\n # p \"====>>>>dda29\"\n # set cookie first, because this is used to generate sid when write memcached\n if cookies[:_wh_session] == nil or cookies[:_wh_session] != params[:sid] # first time, or manually change session to other session\n\n cookies[:_wh_session] = {\n :value => params[:sid],\n :expires => 1.year.from_now,\n :domain => request.host\n }\n session[:uid] = nil\n end\n # p \"====>>>>dda69\"+params[:sid]\n # p \"====>>>>dda79\"+session[:sid]\n if (session[:sid] == nil || params[:sid] != session[:sid] )\n session[:sid] = params[:sid]\n session[:uid] = nil\n end\n\n # @sid = params[:sid]\n\n # cookies[:_wh_session] = params[:sid]\n # p \"====>>>>dda39\"\n else\n # p \"====>>>>dda19\"\n if !session[:sid]\n sid = cookies[:_wh_session]\n if sid ==nil\n sid = params[:sid] # for dev\n if !sid\n # error(\"session not exist, please restart app\")\n return nil\n end\n end \n session[:sid] = sid\n session[:uid] = nil\n end\n end\n # p \"====>>>>dda9\"\n return session[:sid]\n end",
"def current_client_id\n @session[@session_key]\n end",
"def yii_session_id(sid)\n Digest::MD5.hexdigest(::YiiRedisStore.session_digest).first(5) +\n Digest::MD5.hexdigest(['yii\\redis\\Session', sid].to_json)\n end",
"def userid\n \treturn session[:userid]\n \tend",
"def get_sid(res)\r\n if res.nil?\r\n return '' if res.blank?\r\n end\r\n res.get_cookies.scan(/(JSESSIONID=\\w+);*/).flatten[0] || ''\r\n end",
"def get_session_key\n action = 'uam'\n\n url_params = {\n 'action' => action,\n 'rssuserid' => @parameters['RSSAdminUserID'],\n 'rssurl' => @parameters['RSSURL'],\n 'rssdsn' => @parameters['RSSDSN'],\n 'packetuser' => @parameters['PacketUser'],\n 'assignedby' => @parameters['RSSAdminUserID'],\n 'tssurl' => @parameters['TSSURL']\n }\n\n response_body = get_request(url_params).body\n \n key = response_body.match(/sessionKey = '(.*?)';/)[1]\n if key.nil?\n raise StandardError, \"Session key not found\"\n else\n return key\n end\n end",
"def getSavedSessionId(session_file, username)\n if ! File.readable?(session_file)\n return nil\n end\n begin\n File.open(session_file, \"r\") {\n |f|\n u = f.readline(\"\\n\").strip\n if u == username\n return f.readline().strip\n else\n return nil\n end\n }\n rescue Exception => e\n pp 'Error reading session file', e, e.message\n return nil\n end\n end",
"def id\n @values.fetch('ai.session.id') { \n @values['ai.session.id'] = nil\n }\n end",
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def session_key\n @session_key\n end",
"def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_privileged = true\n end\n begin\n if not @@session_id.nil?\n return @@session_id\n else\n @@session_id = get_new_session2\n end\n rescue\n @@session_id = get_new_session2\n end\n return @@session_id\n end",
"def extract_session_id!(url)\n url.gsub!(/#{::Rails.application.config.session_options[:key]}=([^&]+)&?/, '')\n url.chomp!('?')\n $1\n end",
"def current_id\n session[:user_id]\n end",
"def session_id\n super\n end",
"def session_id\n super\n end",
"def session_generate_id(meta)\n return Digest::MD5.hexdigest(\"#{Time.now.to_f}_#{meta[\"HTTP_HOST\"]}_#{self.ip(:meta => meta)}_#{meta[\"HTTP_USER_AGENT\"]}\")\n end",
"def extract_session_id(response)\n # The Set-Cookie header looks like\n # \"set-cookie\"=>[\"JSESSIONID=16; Path=/; HttpOnly\", \"rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sat, 17-Aug-2013 23:39:37 GMT\"],\n session_cookie = response['set-cookie']\n unless session_cookie.nil?\n session_cookie.split(';').each do |chunk|\n chunk.strip!\n key, value = chunk.split('=')\n return value if key == 'JSESSIONID'\n end\n end\n nil\n end",
"def find_session(env, sid); end",
"def get_session_guid(timeout=nil)\n request = Packet.create_request(COMMAND_ID_CORE_GET_SESSION_GUID)\n\n args = [request]\n args << timeout if timeout\n\n response = client.send_request(*args)\n\n response.get_tlv_value(TLV_TYPE_SESSION_GUID)\n end",
"def ebayapi_get_session_id\n ebay= Ebay::Api.new\n begin\n response = ebay.get_session_id(:ru_name => EBAY_RU_NAME)\n if response.ack ==\"Success\"\n session_id = response.session_id\n end\n rescue Exception => e\n logger.info e.message\n end\n session_id\n end",
"def reference_number\n @session_id\n end",
"def grid_session_id\n @browser.driver.session_id\n end",
"def get_purchase_session_id(purchase_session)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'purchaseSession', purchase_session)\n\t\t\tclient.queue_service_action_call('transaction', 'getPurchaseSessionId', 'bigint', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def session_key\n MfaLog.get_mfa_session_key(self.admin_id, self.ip_address)\n end",
"def sid\n open['sid']\n end",
"def create_new_id\n require 'securerandom'\n begin\n # by OpenSSL, or system provided entropy pool\n session_id = SecureRandom.hex(16)\n rescue NotImplementedError\n # never happens on modern systems\n require 'digest'\n d = Digest('SHA512').new\n now = Time::now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('foobar')\n session_id = d.hexdigest[0, 32]\n end\n session_id\n end",
"def get_id\n id = Thread.current[:id] \n id = 1 if @java_flag\n id\n end",
"def cache_key(id)\n \"_session_id:#{id}\"\n end",
"def to_param\n session_id\n end",
"def generate_sid\n loop do \n sid = super\n break sid unless sessions.find_one( { :_id => sid } )\n end\n end",
"def session(id)\n search_sessions(xml_doc, id).first\n end",
"def cmd_getsid(*args)\n print_line(\"Server SID: #{client.sys.config.getsid}\")\n end",
"def session_key\n \"#{bot.username}:#{chat['id']}:#{from['id']}\" if chat && from\n end",
"def current_uid\n session[:uid] || (current_user && current_user.uid)\n end",
"def logged_in\n\tif session[:user].nil?\n\t\tif\tsession[:id].nil?\n\t\t\tsession[:id] ||= random_string(20)\n\t\tend\n\telse\n\t\treturn session[:id]\n\tend\nend",
"def generate_id\n synchronize do\n n = (get_random() % @@MOD_LEN) + @@MOD_LEN\n time_val = Time.now.to_i\n t = ((time_val / 2) % @@MAX_TICKS) + @@MAX_TICKS\n if time_val != @@last_time_val\n @@session_count = 0\n @@last_time_val = time_val\n end\n @@session_count += 1\n \"#{n.to_s(36)[1..-1]}#{t.to_s(36)[1..-1]}#{@@session_count.to_s(36)}\"\n end\n end",
"def current_user_id\n session[:user_id]\n end",
"def get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end",
"def logged_in_user_id\n session[:user_id]\n end",
"def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end",
"def current_user_unique_id\n return current_user.id unless current_user.nil?\n request.session_options[:id]\n end",
"def sid\n data['sid']\n end",
"def id=(value)\n if value == @defaults['ai.session.id']\n @values.delete 'ai.session.id' if @values.key? 'ai.session.id'\n else\n @values['ai.session.id'] = value\n end\n end",
"def get_session(env, sid)\n raise '#get_session not implemented.'\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def session_key\n if self.new_record?\n @session_key\n else\n ActiveRecord::Base.session_keys[session_key_id]\n end\n end",
"def getterminalid()\r\n return getvalue(SVTags::TERMINAL_ID)\r\n end",
"def get_registration_key(session_id)\n reverse_key = [owner_id, job_id, server].join(\"_\")\n Cache.get(\"#{session_id}_#{reverse_key}\")\n end",
"def set_session\n session_id = SecureRandom.hex(4)\n @connections[:clients].each do |other_session, other_client|\n if session_id == other_session\n # session_id is not unique\n set_session\n end\n end\n session_id\n end",
"def session\n Properties[self.class] ||= {}\n return Properties[self.class][:session] || 'shell'\n end",
"def ctpid\n nspid[1]\n end",
"def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id = @@current_request_id += 1\n end\n request_id\n end",
"def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id = @@current_request_id += 1\n end\n request_id\n end",
"def sid\n close['sid']\n end",
"def session!(id)\n search_sessions(xml_doc!, id).first\n end",
"def session_cookie_value\n cookies[_session_id_key]\n end",
"def get_ip\n session_gc\n session_create\n\n ip = @sessions.keys[Kernel.rand(@sessions.length)]\n @sessions[ip] += 1\n return ip\n end",
"def facebook_session_key\n @json['sessionKey']\n end",
"def get_id_from_cookie\n Sinatra::Authentication::Cookies::Hashing.decrypt(cookies[:ottoman_connection], settings.private_key)\n end",
"def get_userid\n request.cookies['userid']\n end",
"def get_pid\n File.open(@lock_file, 'r').read.to_i\n end",
"def window_id(window)\n window.id_.get\n end",
"def window_id(window)\n window.id_.get\n end",
"def window_id(window)\n window.id_.get\n end",
"def suuid; uuid; end",
"def get_unique_area_id\n session[:request_counter] = 0 if session[:request_counter] > 10000 # Sicherstellen, das keine Kumulation ohne Ende\n \"a#{session[:request_counter]}\"\n end",
"def getacquirerid()\r\n return getvalue(SVTags::ACQUIRER_ID)\r\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def get_target_id\n target_id = send_request_cgi({\n 'method' => 'GET',\n 'uri'=> normalize_uri(datastore[\"Nifi-Path\"], '/process-groups/root')\n }).get_json_document[\"id\"]\n end",
"def instance_id\n `curl --connect-timeout 1 #{aws_url} 2>&1`.chomp\n end",
"def auth0_id_token\n session.fetch(:id_token, nil)\n end",
"def get_session_key\n\t\tres = RestClient.get 'https://secure.techfortesco.com/groceryapi_b1/restservice.aspx', {:params => {:command => 'LOGIN', :email => 'bwhtmn@gmail.com', :password => 'stokfridge', :developerkey => 'OULdsDZaBmGE47M7SWK2', :applicationkey => '04291BA250D2B7D6A01D'}}\n\t\tres = JSON.parse(res)\n\t\tres['SessionKey']\n\tend"
] | [
"0.72828907",
"0.7209385",
"0.7209385",
"0.7209385",
"0.72038054",
"0.7065345",
"0.70478994",
"0.7008191",
"0.6987341",
"0.69795215",
"0.69387335",
"0.6931841",
"0.6925708",
"0.6917141",
"0.6916633",
"0.6915339",
"0.6912884",
"0.6894368",
"0.6856121",
"0.6816429",
"0.67322457",
"0.66127306",
"0.661045",
"0.6595551",
"0.6579866",
"0.65204096",
"0.6474768",
"0.646317",
"0.64367056",
"0.6392271",
"0.6302513",
"0.6275151",
"0.6213946",
"0.6197421",
"0.61802125",
"0.61795974",
"0.61678314",
"0.6167336",
"0.61386895",
"0.6074365",
"0.60578775",
"0.6040913",
"0.6040913",
"0.6027974",
"0.60205483",
"0.5995407",
"0.59712464",
"0.596541",
"0.5927532",
"0.5920116",
"0.59201103",
"0.58906585",
"0.58422637",
"0.5841304",
"0.58395725",
"0.5821814",
"0.58131236",
"0.58116657",
"0.580994",
"0.5801227",
"0.58002156",
"0.5789196",
"0.57736015",
"0.5746761",
"0.57324415",
"0.5718795",
"0.5700398",
"0.5682633",
"0.5673498",
"0.5640117",
"0.5639914",
"0.5637814",
"0.56363106",
"0.56154114",
"0.5611131",
"0.5610692",
"0.5608137",
"0.5604295",
"0.5600558",
"0.55981374",
"0.55981374",
"0.55968976",
"0.55960333",
"0.5595282",
"0.5589692",
"0.556368",
"0.55522716",
"0.5539433",
"0.5529409",
"0.55241406",
"0.55241406",
"0.55241406",
"0.55150455",
"0.55016583",
"0.54995584",
"0.54971623",
"0.54937834",
"0.54896957",
"0.5488095",
"0.5477554"
] | 0.78841764 | 0 |
find the ID of the top headlines element, which is in a script element that looks like this: DM.has("r0c1p15", "headlines"); | def get_headline_div_id(page)
script = page.parser.css('script').select { |script| script.text =~ /DM\.has\(\".*\"\,\ \"headlines\"\)/ }
/DM\.has\(\"(.*)\"\,\ \"headlines\"\)/.match(script[0].to_s)[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head\n @head ||= node.attr(:head).to_i\n end",
"def headliner\n @headliner ||= artists.detect {|a| a.name == headliner_raw }\n end",
"def read_head_id\n File.read(head_path).strip if File.exists?(head_path)\n end",
"def id\n return @doc.xpath('//mets:metsHdr/@ID').to_s\n end",
"def head_node\n return nil unless valid?\n\n head_node = @nodes.select { |n| n.is_shadow? }.compact\n \n # TODO: is the last guard necessary?\n head_node.empty? ? nil : head_node[0]\n end",
"def h1\n Praline::browser.find_element(:xpath, \"//h1\")\n end",
"def cur_heading\n $HEADINGS[0]\nend",
"def html_filter_heading_anchors\n h_nodes = @html.search('//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 and not(@id)]')\n h_nodes.each do |heading|\n heading.set_attribute('id', heading.inner_text.gsub(/\\W+/, '-'))\n end\n end",
"def top_headlines(start = @start, per_page = @per_page, topic = @custom_topic)\r\n headlines = @newsapi.get_top_headlines(category: \"#{topic}\", language: \"en\", country: \"us\")[start...start + per_page]\r\n\r\n puts headlines\r\n\r\n headlines\r\n end",
"def headline\n image_iptc[\"Headline\"]\n end",
"def get_Head()\n return @head\n end",
"def showHead()\n puts \"head is #{@head.data}\"\n end",
"def get_my_hp_elem(u)\n h0 = Hpricot(get_my_html_from_open_uri(u))\n # remove crap\n # (h0/\"script\").remove\n return h0\n end",
"def get_my_hp_elem(u)\n h0 = Hpricot(get_my_html_from_open_uri(u))\n # remove crap\n # (h0/\"script\").remove\n return h0\n end",
"def get_my_hp_elem(u)\n h0 = Hpricot(get_my_html_from_open_uri(u))\n # remove crap\n # (h0/\"script\").remove\n return h0\n end",
"def head?\n @head\n end",
"def title_word(html)\n @title_word ||=\n html.css('.di-title.cdo-section-title-hw .headword').first.text\n end",
"def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end",
"def first_title\n max_level = 6 # any title with a higher level kicks the current one out\n title = false\n @blocks.each do |block|\n if block.is_a?(Prismic::Fragments::StructuredText::Block::Heading)\n if block.level < max_level\n title = block.text\n max_level = block.level # new maximum\n end\n end\n end\n title\n end",
"def head\n @head\n end",
"def head\n @head.value\n end",
"def head\n nil\n end",
"def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end",
"def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end",
"def head\n @head.value if @head\n end",
"def get_first_contained_element phemaObj\n @id_element_map.find { |key, val| val[\"id\"] == phemaObj[\"containedElements\"][0][\"id\"] } if phemaObj[\"containedElements\"] && phemaObj[\"containedElements\"].length > 0\n end",
"def check_result_has_headline(li_arr)\n puts \"#{@@info_indicate} start checking headline\"\n li_arr.each do |li|\n assert_not_nil(get_headline(li),\"#{@@warning_indicate}Could not found headline//n\")\n end\n end",
"def heading_info( elem )\n m = @h_rgxp.match(elem.name)\n level = Integer(m[1])\n\n self.current_level = level\n text = elem.inner_text\n\n lbl = label\n if numbering?\n elem.children.first.before %Q{<span class=\"heading-num\">#{lbl}</span>}\n end\n elem['id'] = \"h#{lbl.tr('.','_')}\" if elem['id'].nil?\n\n return [text, elem['id']]\n end",
"def head\n\t\treturn @head\n\tend",
"def start_of_first_scene(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n line_index = 0\n loop do\n line = script[line_index]\n break unless line\n break if line =~ /[A-Za-z]/\n line_index += 1\n end\n line_index += 1 if line_index < script.size # And ignore the name of the play\n line_index\n end",
"def title()\n el = to_xml.at_css(\"heading[level=1] > text\")\n raise \"No level-1 heading in document.\" if el.nil? || el.text.blank?\n el.text\n end",
"def header_id(n)\n \"#{n.dom_id}_header\"\n end",
"def get_heading_level(element)\n tag = element.get_tag_name\n return 1 if tag == 'H1'\n return 2 if tag == 'H2'\n return 3 if tag == 'H3'\n return 4 if tag == 'H4'\n return 5 if tag == 'H5'\n return 6 if tag == 'H6'\n -1\n end",
"def get_head\n raise \"Not implemented\"\n end",
"def get_head_variant(html)\n node = html.css(\".pos-header .var .v[title='Variant form']\")\n node.map(&:text) unless node.empty?\n end",
"def find_header_node(doc)\n case @page.format\n when :asciidoc\n doc.css(\"div#gollum-root > h1:first-child\")\n when :pod\n doc.css(\"div#gollum-root > a.dummyTopAnchor:first-child + h1\")\n when :rst\n doc.css(\"div#gollum-root > div > div > h1:first-child\")\n else\n doc.css(\"div#gollum-root > h1:first-child\")\n end\n end",
"def head\n\t\t@head\n\tend",
"def dep_head\n deps = dependencies('nsubj')\n dep = nil\n deps.each do |n1,n2|\n next if n1.content != 'good'\n if n2.parent.content =~ /^N/\n if dep.nil? or n2.parent.head?\n dep = n2\n end\n end\n end\n return dep\n end",
"def main_controls_section\n @page.find(:span_id, 'ctl00_contentBody_ctl02_instock')\n end",
"def header_anchor(text)\n Nokogiri::HTML(Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(with_toc_data: true)).render(\"# #{text}\")).css('h1')[0][\"id\"]\n end",
"def head\n return @head\n end",
"def locate_head\n snake_matrix.first\n end",
"def page_heading_id\n ['page-heading', model_type, object.id].compact.join('-')\n end",
"def one_h1?\n xpath(\"//h1\").count.between?(0, 1)\n end",
"def find_scene_starts(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n scene_ends = find_scene_ends(script)\n scene_starts = scene_ends.map{|e| e+1} # Point to the next line after the \"- fin -\" marker\n scene_starts.unshift(start_of_first_scene(script)) # Add a scene start to the beginning\n scene_starts.pop # don't need the last one\n scene_starts\n end",
"def first\n\t\t@head.info if !@head.nil?\n\tend",
"def unique_id?(h, id)\n h.at_css(\"[id='#{id}']\").one?\n end",
"def _head?\n _execution_id == head_execution(reload: true).id\n end",
"def h1_elements(identifier)\n platform.h1s_for(identifier.clone)\n end",
"def headlines_count(start = @start, per_page = @per_page, topic = @custom_topic)\r\n page = per_page + 1\r\n headlines = @newsapi.get_top_headlines(category: \"#{topic}\", language: \"en\", country: \"us\")[start...start + page]\r\n\r\n is_remaining = headings.size\r\n\r\n is_remaining\r\n end",
"def first\n @head\n end",
"def head\n self.segments.to_a.find{|t| t.nominal}\n end",
"def header_exists?\r\n selenium.wait_for_element_to_present(\"css=#header\")\r\n end",
"def node_first\n @head\n end",
"def head\n @head.nil? ? nil : @head.value\n end",
"def session_id\n leftbar_el =get_el doc.css(\"#navigator_bar\")\n return nil if leftbar_el.nil?\n leftbar = leftbar_el.content.to_s\n session_phrase = leftbar.match('Session id: \\d+').to_s\n sesh_id = session_phrase.match('\\d+').to_s.to_i\n sesh_id ||= -1\n return sesh_id\n end",
"def extract_head () # extraemos por cabeza ( este es el que usaremos para practica 7)\n if (@head==nil)\n puts \"Sin elementos en la lista\"\n else\n\t\taux = @head\n @head = @head.nest\n\t aux.nest = nil\n\t if(@head== nil)\n\t\t @tail=nil\n\t else\n \t@head.prev = nil\n\t end\n\t return aux\n \n end\n end",
"def get_title\n title = @doc.css(\"div.headline h1\").text.gsub(\" From Our Partners\", \"\")\n end",
"def title\n @title ||= parsed.css('head title').inner_text rescue nil\n end",
"def tagline\n document.search(\"h5[text()='Tagline:'] ~ div\").first.innerHTML.gsub(/<.+>.+<\\/.+>/, '').strip.imdb_unescape_html rescue nil\n end",
"def results_header\n top = self.div(:id=>\"searchgroups_widget\", :index=>2)\n top.div(:id=>\"results_header\").span(:id=>\"searchgroups_type_title\").text\n end",
"def head(head_identity=nil)\n content_for(:head) do\n case head_identity\n when \"description\"\n \"<meta name=\\\"description\\\" content=\\\"#{yield}\\\" />\\n\"\n when \"keywords\"\n \"<meta name=\\\"keywords\\\" content=\\\"#{yield}\\\" />\\n\"\n else\n yield\n end.html_safe\n end\n end",
"def set_headline\n @headline = Headline.find(params[:id])\n end",
"def set_headline\n @headline = Headline.find(params[:id])\n end",
"def set_headline\n @headline = Headline.find(params[:id])\n end",
"def head?\n @prev.nil?\n end",
"def results_header\n top = self.div(:id=>\"searchgroups_widget\", :index=>1)\n top.div(:id=>\"results_header\").span(:id=>\"searchgroups_type_title\").text\n end",
"def head\n return nil if @head.nil?\n @head.data\n end",
"def at_id(id)\n detect { |title| title.id == id }\n end",
"def node_heading?(node)\n %w(h1 h2 h3 h4 h5 h6).include?(node.name)\n end",
"def get_head(config)\n config['level_tag_level'] || \"Level: \"\n end",
"def sniff\n html = Kramdown::Document.new(data[0, 512], auto_ids: false,\n smart_quotes: ['apos', 'apos', 'quot', 'quot'],\n typographic_symbols: { hellip: '...', ndash: '--', mdash: '--' }).to_html\n heading, html = html.split(\"</h1>\\n\", 2)\n return [nil, nil, nil] if html.nil?\n\n case heading\n when /([\\w_.\\[\\]~+=@:-]+)\\s*\\((\\d\\w*)\\)\\s*-+\\s*(.*)/\n # name(section) -- description\n [$1, $2, $3]\n when /([\\w_.\\[\\]~+=@:-]+)\\s+-+\\s+(.*)/\n # name -- description\n [$1, nil, $2]\n else\n # description\n [nil, nil, heading.sub('<h1>', '')]\n end\n end",
"def title\n @doc.xpath(\"/html/head/title\").first&.text\n end",
"def results_header\n top = self.div(:id=>\"searchgroups_widget\", :index=>0)\n top.div(:id=>\"results_header\").span(:id=>\"searchgroups_type_title\").text\n end",
"def id\n return @poco_data[:id] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:id'))\n end",
"def scrape_page_head(url)\n i=0\n html = open(url)\n # binding.pry\n playerindex = Nokogiri::HTML(html)\n\n # initialize array of player info hashes\n playhasharr = []\n\n # sxcrape to get all the player information headline-blocks (player name, position, school/club)\n pheadarr=playerindex.css (\"div.component.headline-block\")\n\n # put the name, position, school/club, year elements into a hash, then put the hash into an array\n pheadarr.each do |phrow|\n playhashrow={}\n # create playhashrow -- a hash for name, position, school/club, year\n\n # Get the name from div.head (div tag, class=head). The split(\",\").first is to remove a comma\n # in the last name on the list\n playhashrow[:name]=(phrow.css(\"div.text-block div.head\").text).split(\",\").first\n\n # schoolclub variable here actually is \"position|schoolclub, year\"\n schoolclub=phrow.css(\"div.text-block div.subhead\").text\n # get the player's position here in the first part of schoolclub (originally named split1)\n playhashrow[:position]=schoolclub.split(\",\").first\n # split1=prevexp.split(\",\").last.split(\"|\").first\n\n # Get the school / club name from the headline block\n playhashrow[:schoolclub]=schoolclub.split(\",\").last.split(\"|\").first.strip\n # Get the class year\n class_year = schoolclub.split(\",\").last.split(\"|\").last.strip\n # The way that the schoolclub variabkle\n if class_year !=playhashrow[:schoolclub]\n playhashrow[:class_year]=class_year\n\n end\n # put the current rank into the player hash (to avoid having to search later)\n playhashrow[:rank]=i+1\n # binding.pry\n playhasharr << playhashrow\n # puts (\"number #{i+1}\")\n i+=1\n end\n\n playhasharr\n end",
"def head\n return @head.value\n end",
"def grab_pr_tables(pr_link)\n doc = Nokogiri::HTML.parse(@http_client.get(pr_link).body)\n ret_val = Set.new\n base = doc.xpath('//*[@id=\"Super_Smash_Bros._Melee_rankings\"]').first\n if base.nil?\n nil\n else\n potential_heading = base.parent.next_element\n potential_table = potential_heading.next_element\n while(potential_heading.matches?(\"h3\") && potential_table.matches?(\"table.wikitable\")) do\n #ret_val << [potential_heading.content.strip, potential_table]\n ret_val << potential_table\n potential_heading = potential_table.next_element\n potential_table = potential_heading.next_element\n end\n end\n ret_val\n end",
"def get_head\n nekst = @next_object\n @next_object = get_next_for(nekst)\n return nekst\n end",
"def tooltip_for_title(id)\n %Q{\n <script type='text/javascript'>\n var element = $(\"#{id}\");\n new Tooltip(element, element.title);\n </script>\n }\n end",
"def read_head_id\n if File.exists?(head_path)\n File.read(head_path).strip\n elsif File.exists?(\"#{path}/packed-refs\")\n File.open(\"#{path}/packed-refs\", 'rb') do |io|\n while line = io.gets\n line.strip!\n next if line[0..0] == '#'\n line = line.split(' ')\n return line[0] if line[1] == \"refs/heads/#{branch}\"\n end\n end\n end\n end",
"def head_tag_names\n @head_tag_names ||= head_pact_publications_for_tags\n .select { |head_pact_publication| head_pact_publication.id == id }\n .collect { | head_pact_publication| head_pact_publication.values.fetch(:tag_name) }\n end",
"def is_head?\n heads = self.organization_users.collect{|ou| ou if ou.head == true}\n heads.delete(nil)\n return heads.size > 0\n end",
"def head\n if @head.nil?\n nil\n else\n at_index(0)\n end\n end",
"def document_heading\n heading = @document[blacklight_config.show.heading] || @document.id\n if heading.kind_of?(Array)\n heading.first\n else\n heading\n end\n end",
"def head\n HEADER\n end",
"def get_id_from_doc(html_page)\n html_string = html_page.to_s\n match = html_string.match(/\"entity_id\"(\\s?):(\\s?)\"(?<id>\\d+)\"/) ||\n html_string.match(/\"al:ios:url\"(\\s?)content=\"fb:\\/\\/page\\/\\?id=(?<id>\\d+)\"/) ||\n html_string.match(/\"owning_profile\"\\s?:\\s?{\\s?\"__typename\"\\s?:\\s?\"Page\"\\s?,\\s?\"id\"\\s?:\\s?\"(?<id>\\d+)\"/)\n\n match['id'] unless match.nil?\n end",
"def get_section_heading(src, i)\n if src[i] =~ /^\\/\\*\\*? \\#+ *(.*)/\n heading = $1\n elsif src[i+1] =~ /^ ?\\* \\#+ *(.*)/\n heading = $1\n end\n return heading.gsub(' -- ', ' – ')\nend",
"def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end",
"def has_id_element?\n each_node do |n|\n next unless n.kind_of?(Element)\n next unless n.hid\n return true\n end\n false\n end",
"def mailing_headsup(id)\n get(\"/mailings/#{id}/headsup\")\n end",
"def head() slot(:head) end",
"def first_entry\n\t\"count(//cda:entry[cda:organizer[./cda:templateId[@root='#{@template_oid}']]\" +\n\t\"/cda:reference[@typeCode='REFR']/cda:externalDocument[@classCode='DOC']\" +\n\t\"/cda:id[@root='2.16.840.1.113883.4.738']][1]/preceding-sibling::*)+1\"\n end",
"def head \n meta_author \"Kane Baccigalupi\"\n end",
"def get_first\r\n @head&.data\r\n end",
"def get_section(id)\n @doc.at_css(\"##{id}\").parent.next_element\n end",
"def render_element_head element\n render :partial => \"elements/partials/element_head\", :locals => {:element_head => element}\n end",
"def raw_title\n document.at(\"h1\").innerText\n end",
"def head\n return @head.data\n end",
"def parse_first_movie_id(doc)\n link = doc.at_css('#rw3 h4 a')\n link['href'].match(/movie_id=(?<movie_id>\\d+)/)[:movie_id]\n end"
] | [
"0.5985805",
"0.59420973",
"0.5580789",
"0.548702",
"0.54617065",
"0.54027736",
"0.539868",
"0.53349596",
"0.53338015",
"0.530045",
"0.5147233",
"0.51387066",
"0.5123056",
"0.5123056",
"0.5123056",
"0.51198745",
"0.5116149",
"0.51076233",
"0.5077348",
"0.50618815",
"0.5049796",
"0.5046394",
"0.5045456",
"0.5045456",
"0.50423807",
"0.50130934",
"0.49888405",
"0.49862966",
"0.4986251",
"0.49858388",
"0.4970826",
"0.49531612",
"0.49297807",
"0.4909921",
"0.4908531",
"0.48973805",
"0.48967707",
"0.48870137",
"0.48858252",
"0.48691517",
"0.48496145",
"0.4842865",
"0.48353222",
"0.4835176",
"0.48313344",
"0.4828522",
"0.48194504",
"0.4797418",
"0.47949973",
"0.47937122",
"0.47895426",
"0.47874796",
"0.47868723",
"0.47807917",
"0.47739586",
"0.47725993",
"0.47699907",
"0.47565615",
"0.47502458",
"0.4750027",
"0.47211215",
"0.4709051",
"0.47037873",
"0.47037873",
"0.47037873",
"0.46946824",
"0.46945408",
"0.46941036",
"0.468891",
"0.4687963",
"0.46862748",
"0.4683822",
"0.46835026",
"0.46816835",
"0.46787643",
"0.46567208",
"0.46516502",
"0.46394718",
"0.46382758",
"0.46373692",
"0.46367717",
"0.46290824",
"0.46217927",
"0.46204713",
"0.46181253",
"0.46158266",
"0.46100006",
"0.46054628",
"0.46032697",
"0.45987508",
"0.45950818",
"0.45901796",
"0.45891047",
"0.458138",
"0.45719162",
"0.45639306",
"0.45556667",
"0.45486274",
"0.4548496",
"0.45370844"
] | 0.76688844 | 0 |
extract article id from the uri | def get_article_id(urn)
/\/(.*)\/article\-(.*)\/.*/.match(urn)[2].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_id(uri)\n Addressable::URI.parse(uri).basename\n end",
"def extract_id_uri\n @id_uri = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRuri', a: NS)['value']\n empty, @country, @nature, date, @num = @id_uri.split('/')\n\n # yyyy-mm-dd\n @year = date.split('-', 2)[0]\n end",
"def extract_id(link)\n link.split('/').last if link.split('/')\n end",
"def id_from_href(href)\r\n if href.include?(\"?\")\r\n href = href.partition(\"?\")[0]\r\n end\r\n id = href.split(\"/\").last\r\n id\r\n end",
"def extract_pid(uri)\n URI(uri).path.split('/').last\n end",
"def obj_id\n uri.split('/').last\n end",
"def obj_id\n uri.split('/').last\n end",
"def resource_id(res)\n if res.is_a?(String)\n return res.split(/\\//).last.to_i\n else\n return res.href.split(/\\//).last.to_i\n end\n end",
"def id_from_link(node)\n node.attribute('href').value.split('/').last.to_i\n end",
"def goodreads_id\n @url.match(/\\/(\\d+)\\./)[1] rescue nil\n end",
"def get_slide_id( slide_url )\n idx = slide_url.index( \"=id.\" )\n return nil unless idx\n slide_url.slice( idx + 4..-1 )\n end",
"def id(string)\n return if string.blank?\n\n URI(string)\n .path\n .split(\"/\")\n .last\n .to_i\n end",
"def post_item_id(doc)\n href = doc.search('.subtext > a:nth-child(3)').map { |link| link['href'] }\n href[0].match(/\\d+/)\n end",
"def extract_work_id( url )\n /^.*\\/(\\d+-\\d+-.*)$/.match( url )[ 1 ]\nend",
"def ead_id\n URI.parse(self.collection_uri).path.split(\"/\").last unless self.collection_uri.nil?\n end",
"def id\n ref = JSONModel::parse_reference(self.uri)\n\n if ref\n ref[:id]\n else\n nil\n end\n end",
"def extract_id(dom)\n href_with_id = dom.search('.subtext .age a').map { |link| link['href']}.join\n href_with_id[/\\d+/].to_i\n end",
"def parse_url_for_item_id\n return nil if not self.item_id \n if self.item_id.match(/\\D+/).to_s.length != 0\n self.item_id.match(/item=\\d+\\D/).to_s.gsub!(/\\D+/, \"\") ||\n self.item_id.match(/-\\/\\d+/).to_s.gsub!(/\\D+/, \"\")\n else\n return self.item_id\n end\n end",
"def extract_id(object)\n case object\n when ::Integer\n object\n when ::String\n object.split('/').last.to_i\n when URI, Addressable::URI\n object.path.split('/').last.to_i\n when Teamsupport::Identity\n object.ID\n end\n end",
"def get_item_id\n @doc.css('.subtext > .age > a:first-child').map{|ele| ele['href']}.map {|x| x[/\\d+/]}.join\n end",
"def extract_id(self_link, type)\n link = self_link.match(/#{type}\\/(?<id>\\d+)/)\n id = link['id']\nend",
"def get_url_id(url)\n if !url.nil?\n url.split('/').last\n end\nend",
"def embed_id\n match = @node.inner_text.strip.match(self.class.url_regexp)\n match[:id] if match\n end",
"def dom_id\n ['article', id].join('-')\n end",
"def get_id_from_doc(html_page)\n html_string = html_page.to_s\n match = html_string.match(/\"entity_id\"(\\s?):(\\s?)\"(?<id>\\d+)\"/) ||\n html_string.match(/\"al:ios:url\"(\\s?)content=\"fb:\\/\\/page\\/\\?id=(?<id>\\d+)\"/) ||\n html_string.match(/\"owning_profile\"\\s?:\\s?{\\s?\"__typename\"\\s?:\\s?\"Page\"\\s?,\\s?\"id\"\\s?:\\s?\"(?<id>\\d+)\"/)\n\n match['id'] unless match.nil?\n end",
"def id\n source.split('/')[-1].split('_')[0]\n end",
"def extract_record_id(record)\n url = record.xpath('//tei:facsimile/tei:graphic/@url', NS).map(&:text).first\n url.gsub!('http://cudl.lib.cam.ac.uk/content/images/', '')\n url.gsub!(%r{-\\d+-\\d+_files\\/8\\/0_0.jpg}, '')\n end",
"def extract_id_from_response(resp)\n resp.response.headers['location'].split('/').last\n end",
"def actual_id\n args = params[:id].split('-')\n args[0]\n end",
"def parse_attachment_reference_id_from_url(url)\n # TODO: Attachments from a third party domain with the same path should not be returned.\n result = url.match(ATTACHMENT_ID_REGEX)\n result ? result[1] : nil\n end",
"def parse_id(e)\n return e.css('a')[0].attribute('data-play').content.split(':')[1].to_i\n end",
"def user_id\n return link.split(\"/\")[2]\n end",
"def trip_id\n url.to_s =~ /information\\/[a-z]+\\/[^\\/]+\\/([^\\/]+)/\n $1\n end",
"def format_article(article)\n id = article['_links']['self']['href'].match(/\\/api\\/v2\\/articles\\/(\\d+)/)[1].to_i\n article.id = id\n article\n end",
"def id\n @entry_id ||= @url\n end",
"def _parse_image_uri row\n row./('td[2]/a').first[:href] =~ /multiverseid=(\\d+)/\n $1\n end",
"def identifier\n @record.uri.to_s\n end",
"def extract_id(object)\n extract_string object, :id\n end",
"def extract_id\n selector[:_id]\n end",
"def get_article_id(title)\n return @articles_map[title]\n end",
"def url_id\n id\n end",
"def extract_document_id_from_feed(feed,entry)\n links={}\n entry.elements.each('link') do |link|\n links[link.attribute('rel').value] = link.attribute('href').value\n end\n\n if feed==\"documents\"\n @id=entry.elements['id'].text[/.com\\/feeds\\/documents\\/private\\/full\\/spreadsheet%3A(.*)/, 1]\n elsif feed==\"spreadsheets\"\n @id=entry.elements['id'].text[/.com\\/feeds\\/spreadsheets\\/(.*)/, 1]\n else\n puts \"Invalid Feed: Must be 'documents' or 'spreadsheets'.\"\n @id=nil\n end\n \n return @id\n end",
"def elastics_id\n Digest::MD5.hexdigest url\n end",
"def extract_identity(uri)\n return $1.downcase if uri =~ %r[/user/([a-zA-Z_1-9-]*)] || uri =~ %r[://([a-zA-Z_1-9-]*)?\\.#{AppConfig.host(request.host)}] || uri =~ %r[://(.*?)/?$]\n return nil\n end",
"def id\n @entry_id || @url\n end",
"def get_page_id_for_given_nbe_id(uri, nbe_id)\n new_uri = \"https://#{uri.host}/metadata/v1/dataset/#{nbe_id}/pages.json\"\n\n response = http_get_response(new_uri)\n parsed = response.parsed_response\n\n begin\n @log.info(\"PageId: #{parsed[\"publisher\"][0][\"pageId\"]}\")\n parsed[\"publisher\"][0][\"pageId\"]\n rescue\n @log.error(\"PageId not found\")\n end\n end",
"def get_id_from_short_url shortURL\n\t id = 0 # initialize result \n\n\t # A simple base conversion logic \n\t (0...shortURL.size).each do |i| \n\t if ('a' <= shortURL[i] && shortURL[i] <= 'z') \n\t id = id*62 + shortURL[i].ord - 'a'.ord; \n\t end\n\n\t if ('A' <= shortURL[i] && shortURL[i] <= 'Z') \n\t id = id*62 + shortURL[i].ord - 'A'.ord + 26; \n\t end\n\n\t if ('0' <= shortURL[i] && shortURL[i] <= '9') \n\t id = id*62 + shortURL[i].ord - '0'.ord + 52;\n\t end \n\t end\n\n\t id\n\tend",
"def parse_id(id)\n id.split('/')\n end",
"def id\n solr_document.fetch('id').sub(/^id-/, '')\n end",
"def calculate_id_for(blog)\n Digest::MD5.hexdigest(blog['url'])\nend",
"def uri_identifier\n if self.engine_id.present? && self.unique_id.present? && _h.respond_to?(:root_url)\n \"#{_h.root_url.chomp(\"/\")}/bento_search_opaque_id/#{CGI.escape self.engine_id}/#{CGI.escape self.unique_id}\"\n else\n nil\n end\n end",
"def guid_from_url\n # get the last large number from the url, if there is one\n url.to_s.scan(/https:\\/\\/firstlook.org\\/theintercept\\/[0-9]{4}\\/[0-9]{2}\\/[0-9]{2}\\/[a-z0-9-]+/).last\n end",
"def id\n @id || @url\n end",
"def id\n base_path || payload[\"content_id\"]\n end",
"def article_path(article)\r\n article.id + \".html\"\r\n end",
"def parse_attachment_reference_uuid_from_url(url)\n result = url&.match(ATTACHMENT_ID_REGEX)\n result ? result[1] : nil\n end",
"def evolution_id()\n\t\tspecies2 = @evolution_url.split(\"n/\")\n\t\tid = species2[1].split(\"/\")\n\t\treturn id.join('')\n\tend",
"def steam_id_from_url(url)\n url.slice!('https://store.steampowered.com/app/')\n m = url.match(/(\\d+)\\/?/)\n return nil if m.nil?\n m.captures.first.to_i\nend",
"def uri_id\n raise NotImplementedError.new('You must implement uri_id')\n end",
"def get_id(id)\n native_id = Integer(id.split(\":\")[-1])\n end",
"def entity_id\n match(/Entity\\sID\\s+:\\s+([A-F0-9]+)$/)\n end",
"def id\n \n id = path_info.split(\"/\")[1]\n\n # Fix for /path/id.with.dot like /person/full.name - where format is \"json\" (derived from either Accept or Content-Type)\n if [\"html\", \"json\", \"xml\"].include? format\n if not id.nil? # for POST id is null\n id = id.gsub(/\\.(html|json|xml)$/, \"\")\n end\n \n else\n \n # Otherwise, remove trailing .json or .xml\n if id =~ /[.]/\n id = id.split(\".\")\n id.pop\n id = id.join(\".\")\n end\n \n end\n \n if id == [] or id.nil?\n id == \"\"\n end\n \n id\n \n end",
"def parse_site_user_id_from_url url\n url.scan(/cc\\/blog\\/([^\\/]+)/)[0][0].downcase rescue nil\n end",
"def track_id\n @url.gsub(_url_regex, '')\n end",
"def section_id\n match_in_id /\\/(\\w+)$/\n end",
"def id\n @permalink.to_i\n end",
"def extract_id(tag)\n tag =~ /id=\"([^\"]+)\"/\n $1\n end",
"def extract_invoice_id\n invoice_id = Converter.xml_get('Betreff_NR', self.order)\n if invoice_id && invoice_id.match(/Rechnung Nr/)\n self.id = invoice_id.match(/\\d+/)[0]\n end\n end",
"def get_id(what, item)\n case what.keys[0]\n when :study\n /^study_(?<s_id>\\d+)_manage_link$/.match(item['id'])[:s_id]\n when :study_group\n /^study_group_(?<sg_id>\\d+)_manage_link$/.match(item['id'])[:sg_id]\n when :site\n raise \"don't know how to search for site id\"\n when :team\n raise \"don't know how to search for team id\"\n else\n nil\n end\n end",
"def extract_id(str)\n str.to_s.scan(/\\d+/)\n end",
"def id_from_response(response)\n response['Location'][/\\/([^\\/]*?)(\\.\\w+)?$/, 1]\n end",
"def fedora_id_to_numeric_id fedora_id\n /.*:([0-9]+)/.match(fedora_id)[1].to_i\n end",
"def get_presentation_id(slide_url)\n starting_index = slide_url.index(\"/d/\")\n # Following string matching seems to be lengthy, But is faster the Regular Exp.\n ending_index = slide_url.index(\"/present#slide\") || slide_url.index(\"/present?slide\") || slide_url.index(\"/edit#slide\") || slide_url.index(\"/edit?slide\")\n return nil unless ending_index and starting_index\n presentation_id = slide_url[starting_index + 3..ending_index-1]\n end",
"def uid_from_path(url, base_store_url)\n return [:main, 0] if url.include?(base_store_url)\n\n return [:category, url.match(/viewGenre\\?id\\=(\\d+)/)[1]] if url.include?(\"viewGenre?id=\")\n return [:category, url.match(/viewGrouping\\?id\\=(\\d+)/)[1]] if url.include?(\"viewGrouping?id=\")\n return [:room, url.match(/viewMultiRoom\\?fcId\\=(\\d+)/)[1]] if url.include?(\"viewMultiRoom?fcId=\")\n return [:app, url.match(/.+id(\\d+)/)[1]] if url =~ /\\/id\\d+/\n \n [nil, nil]\n end",
"def parse_id(li)\n li.at_css('a')['href'].match(%r{fandango\\.com(/|%2f).*_(?<id>\\d+)(/|%2f)movietimes})[:id]\n end",
"def extract_id(args)\n args.each { |arg| return arg.fetch('id') if arg.is_a? Hash }\n nil\n end",
"def ref_id\n URI.parse(self.archival_series_uri).path.split(\"/\").last unless self.archival_series_uri.nil?\n end",
"def normalize_link_id(id); end",
"def thumb_id\n regex_url = /pictures[\\/][\\d]+[\\/]/ \n string_url = self.content.scan(regex_url).to_s \n regex_id = /[\\d]+/ \n picture_id = string_url.scan(regex_id)[0]\n return picture_id\n end",
"def thumb_id\n regex_url = /pictures[\\/][\\d]+[\\/]/ \n string_url = self.content.scan(regex_url).to_s \n regex_id = /[\\d]+/ \n picture_id = string_url.scan(regex_id)[0]\n return picture_id\n end",
"def test_extractid\n actual = ZenDeskAPI.extractid('http://rateitindia.zendesk.com/tickets/24.xml')\n assert_equal('24.xml', actual)\n end",
"def id_path\n full_path.collect(&:id).join(\":\")\n end",
"def guid_from_url\n # get the last large number from the url, if there is one\n url.to_s.scan(/[0-9]{6,12}/).last\n end",
"def show\n #getting an id of a student\n @URI = request.original_url\n @URI = @URI.split('/').last \n \n end",
"def url_id\n Digest::MD5.hexdigest(url)\n end",
"def pub_id(doc)\n # anchor(doc).gsub(\".\", \" \")\n fetch_doi(doc).split(\"/\")[1..].join(\"/\").gsub(\".\", \" \").sub(/^nist\\sir/, \"NIST IR\")\n end",
"def id\n \"#{doc.id}#excerpt\"\n end",
"def get_legacy_ingest_id( dirname )\n\n begin\n f = File.join( dirname, TaskHelpers::INGEST_ID_FILE )\n File.open( f, 'r') do |file|\n id = file.read( )\n return id\n end\n rescue => e\n end\n return ''\n\n end",
"def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end",
"def id\n self.url\n end",
"def object_key_from_uri(uri)\n uri.split('/')[3..-1].join('/')\n end",
"def id\n basename.gsub('.', '-')\n end",
"def fetch_url(body)\n aux = body.split('<link>').last\n aux = aux.split('<pubdate>').first\n aux\n end",
"def offer_id_from_url(url)\n encrypted_params = CGI::parse(url.query)\n @params = ObjectEncryptor.decrypt(encrypted_params['data'].first)\n\n if url.path.include?('/videos/')\n url.path.split('/')[2]\n elsif url.path.include?('/click/generic') ||\n url.path.include?('/click/mraid') ||\n url.path.include?('/click/app') ||\n url.path.include?('/click/survey') ||\n url.path.include?('/click/action')\n # entity_id and offer_id are the same thing, is this always the case?\n @params[:entity_id]\n else\n nil\n end\n end",
"def extract_item_id(request)\n query = URI.parse(request).query\n !query.nil? && !query.empty? && CGI.parse(query)['item']\nend",
"def load(*args)\n super(*args)\n self.id = self.uri.split('/').last if self.id.nil? and defined? self.uri\n end",
"def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end",
"def extract_key_from_link\n self.resource_id = original_link.to_i\n end",
"def id_for_path(path)\n path.split(\"/\").last.chomp(Joplin::Base::EXT_NAME)\n end",
"def id\n if @id.nil?\n @id = FeedTools::XmlHelper.select_not_blank([\n FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:id/text()\",\n \"atom03:id/text()\",\n \"atom:id/text()\",\n \"id/text()\",\n \"guid/text()\"\n ], :select_result_value => true),\n FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"atom10:id/text()\",\n \"atom03:id/text()\",\n \"atom:id/text()\",\n \"id/text()\",\n \"guid/text()\"\n ], :select_result_value => true)\n ])\n end\n return @id\n end"
] | [
"0.74195385",
"0.72079074",
"0.71480155",
"0.7111334",
"0.69423306",
"0.68857217",
"0.68857217",
"0.6804149",
"0.67912287",
"0.6776286",
"0.66437405",
"0.6629898",
"0.66148144",
"0.655658",
"0.6547822",
"0.64951754",
"0.6484113",
"0.64748013",
"0.64595467",
"0.6423391",
"0.64066184",
"0.64049816",
"0.6399556",
"0.63908607",
"0.63815594",
"0.6366423",
"0.6360365",
"0.63148075",
"0.6272189",
"0.6242037",
"0.6216831",
"0.61853194",
"0.6175982",
"0.6155811",
"0.6141667",
"0.6130925",
"0.6126507",
"0.6103809",
"0.60985494",
"0.60930717",
"0.60697085",
"0.6063454",
"0.6063017",
"0.60370374",
"0.6012653",
"0.6001253",
"0.6000651",
"0.5987838",
"0.59807885",
"0.59782887",
"0.5971802",
"0.59506637",
"0.5941592",
"0.59379244",
"0.5921794",
"0.59183675",
"0.5905198",
"0.5900499",
"0.5899499",
"0.5897954",
"0.58932537",
"0.5867872",
"0.5848718",
"0.5840587",
"0.5840236",
"0.5834211",
"0.5834106",
"0.5822299",
"0.5815649",
"0.58147484",
"0.5811977",
"0.58112717",
"0.57699037",
"0.5728567",
"0.57264453",
"0.5723799",
"0.5723557",
"0.5711133",
"0.5707574",
"0.5707574",
"0.56884927",
"0.5685899",
"0.5671649",
"0.5662231",
"0.56593585",
"0.56499034",
"0.5639065",
"0.5631843",
"0.5629938",
"0.5624613",
"0.5598344",
"0.5596144",
"0.55885184",
"0.5587075",
"0.5572529",
"0.55688906",
"0.5566026",
"0.55557716",
"0.55554473",
"0.55533653"
] | 0.82634616 | 0 |
extract a meta tag value from the page | def get_metatag(page, tag)
page.parser.css("meta[name='#{tag}']").first['content']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_for_meta_tag(attribute_selector, html)\n html.xpath(\"//head/meta[@#{attribute_selector}]/@content\").first.try(:content)\n end",
"def extract_meta\n end",
"def get_tag(meta)\n sanitize_tag parse_tag_metadata_vars(meta)\n end",
"def get_meta(property, prptfile)\n meta_doc = get_file_doc(prptfile, \"meta.xml\")\n property_elem = meta_doc.elements['office:document-meta'].elements['office:meta'].elements[property]\n\n if not property_elem.nil?\n return property_elem.text\n else\n return \"\"\n end\nend",
"def get_meta(url)\n\n unless url.is_a? URI\n error \"{url} (instance of #{url.class}) is not an URI instance!\"\n return nil\n end\n\n begin\n body = Net::HTTP.get(url.host,url.request_uri)\n return nil unless body\n rescue => e\n error \"Failed to request url: #{url} : #{e}\"\n return nil\n end\n\n robots_arr = nil\n\n begin\n doc = Nokogiri::HTML(body)\n tags = doc.xpath(META_ROBOTS_TAG_SELECTOR)\n\n return nil if tags.nil? || tags.length == 0\n\n tag = tags.pop\n robots = tag[\"content\"]\n\n return nil unless robots\n\n robots_arr = robots.gsub(/\\s/,'').split(',')\n rescue => e\n error \"Failed to get meta for #{url} : #{e}\"\n return nil\n end\n\n # return lowercase values\n return robots_arr.map {|val| val.downcase}\n end",
"def meta\n @meta ||= decoded_body[:meta]\n end",
"def scrape_meta_data\n unless @data.meta\n @data.meta!.name!\n @data.meta!.property!\n parsed_document.xpath(\"//meta\").each do |element|\n get_meta_name_or_property(element)\n end\n end\n end",
"def parse_tag_metadata_vars(meta)\n begin\n return tag unless meta\n new_tag = tag\n # Direct value metaname var\n # pattern: %V=key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # directly inserts the value or nothing if nil\n direct_value = new_tag.scan(/%V=[\\w ]*-%/)\n direct_value.map! do |dv|\n {\n :var => dv,\n :key_name => dv.gsub(/%V=|-%/, \"\"),\n :value => meta[dv.gsub(/%V=|-%/, \"\")]\n }\n end\n direct_value.each do\n |dv|\n dv[:value] ||= \"\"\n new_tag = new_tag.gsub(dv[:var].to_s,dv[:value].to_s)\n end\n\n\n # Selected value metaname var\n # pattern: %R=selection_pattern:key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # Where 'selection_pattern' is a Regex string for selecting a portion of the value from the key name in the metadata hash\n # directly inserts the value or nothing if nil\n selected_value = new_tag.scan(/%R=.+:[\\w]+-%/)\n selected_value.map! do |dv|\n {\n :var => dv,\n :var_string => dv.gsub(/%R=|-%/, \"\"),\n :key_name => dv.gsub(/%R=|-%/, \"\").split(\":\")[1],\n :pattern => Regexp.new(dv.gsub(/%R=|-%/, \"\").split(\":\").first)\n }\n end\n\n selected_value.each do\n |sv|\n if sv[:pattern] && sv[:key_name]\n sv[:value] = sv[:pattern].match(meta[sv[:key_name]]).to_s\n end\n sv[:value] ||= \"\"\n new_tag = new_tag.gsub(sv[:var].to_s,sv[:value].to_s)\n end\n rescue => e\n logger.error \"ERROR: #{p e}\"\n tag\n end\n new_tag\n end",
"def parse_tag_metadata_vars(meta)\n begin\n return tag unless meta\n new_tag = tag\n # Direct value metaname var\n # pattern: %V=key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # directly inserts the value or nothing if nil\n direct_value = new_tag.scan(/%V=[\\w ]*-%/)\n direct_value.map! do |dv|\n {\n :var => dv,\n :key_name => dv.gsub(/%V=|-%/, \"\"),\n :value => meta[dv.gsub(/%V=|-%/, \"\")]\n }\n end\n direct_value.each do\n |dv|\n dv[:value] ||= \"\"\n new_tag = new_tag.gsub(dv[:var].to_s,dv[:value].to_s)\n end\n\n\n # Selected value metaname var\n # pattern: %R=selection_pattern:key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # Where 'selection_pattern' is a Regex string for selecting a portion of the value from the key name in the metadata hash\n # directly inserts the value or nothing if nil\n selected_value = new_tag.scan(/%R=.+:[\\w]+-%/)\n selected_value.map! do |dv|\n {\n :var => dv,\n :var_string => dv.gsub(/%R=|-%/, \"\"),\n :key_name => dv.gsub(/%R=|-%/, \"\").split(\":\")[1],\n :pattern => Regexp.new(dv.gsub(/%R=|-%/, \"\").split(\":\").first)\n }\n end\n\n selected_value.each do\n |sv|\n if sv[:pattern] && sv[:key_name]\n sv[:value] = sv[:pattern].match(meta[sv[:key_name]]).to_s\n end\n sv[:value] ||= \"\"\n new_tag = new_tag.gsub(sv[:var].to_s,sv[:value].to_s)\n end\n rescue => e\n logger.error \"ERROR: #{e}\"\n tag\n end\n new_tag\n end",
"def meta\n @d[:meta]\n end",
"def og(key)\n html.at_css(\"meta[property='og:#{key}']\")&.[]('content')\n end",
"def meta\n %Q(\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta property=\"og:title\" content=\"Game Boy opcode table\" />\n <meta name=\"author\" content=\"Luís Mendes\" />\n <meta property=\"og:locale\" content=\"en_US\" />\n <meta name=\"description\" content=\"Game Boy CPU (Sharp LR35902) instruction set\" />\n <meta property=\"og:description\" content=\"Game Boy CPU (Sharp LR35902) instruction set\" />\n <link rel=\"canonical\" href=\"https://gb.insertcoin.dev/\" />\n <meta property=\"og:url\" content=\"https://gb.insertcoin.dev/\" />\n <meta property=\"og:site_name\" content=\"Game Boy opcode table\" />\n <script type=\"application/ld+json\">\n {\"url\":\"https://gb.insertcoin.dev/\",\"@type\":\"WebSite\",\"headline\":\"ink\",\"author\":{\"@type\":\"Person\",\"name\":\"Luís Mendes\"},\"description\":\"Game Boy CPU (Sharp LR35902) instruction set\",\"name\":\"Game Boy opcode table\",\"@context\":\"https://schema.org\"}\n </script>\n)\nend",
"def getValue page, attribute\n if attribute == 'rating'\n return page.search('.ratingValue').children[1].text\n end\nend",
"def assert_meta(tag, text)\n tag = find(:xpath, \"//head/meta[@name='#{tag.to_s}']\")\n assert_equal text, tag.native.attribute(\"content\")\n end",
"def page_meta\n @page_meta ||= {}\n end",
"def html_meta_if(name, content)\n %(<meta name=\"#{name}\" content=\"#{content}\">) if content\n end",
"def check_meta_element(name, doc)\r\n elements = doc.css(\"meta[@name='#{name}']\") \r\n process_tag(name, elements, [\"[]\", \"content\"])\r\n end",
"def meta_title\n\t\tread_attribute('title').gsub(/<\\/?[^>]*>/, \"\")\n\tend",
"def site_meta\n end",
"def site_meta\n end",
"def getMetaElement(file, name, logkey='')\n logstring = \"none\"\n metaelement = File.read(file).match(/(<meta name=\"#{name}\" content=\")(.*?)(\"\\/>)/i)\n unless metaelement.nil?\n metaelement = HTMLEntities.new.decode(metaelement[2])\n logstring = metaelement\n end\n return metaelement\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def meta(name, content)\n raw %(<meta name=\"#{name}\" content=\"#{content}\" />)\n end",
"def page_info_get_val(title, key, inprop = nil)\n response = get_basic_page_info(title, inprop)\n pageid = response['query']['pages'].keys.find { |id| id != '-1' }\n return unless pageid\n response['query']['pages'][pageid][key]\n end",
"def get_page_meta\n @page_meta = PageMeta.find_by(request_path: request.path)\n end",
"def meta_tag(key)\n value = @item[key] || @config[:meta_data][key]\n if key == :author && value[0] == \"@\" && author_full_name = item[:author_full_name]\n value = %Q{#{author_full_name} (#{value})}\n end\n return '<meta name=\"%s\" content=\"%s\">' % [key, value] if value\n end",
"def metadata\n @page.metadata\n end",
"def value\n if meta_key.is_dynamic?\n case meta_key.label\n when \"uploaded by\"\n return media_resource.user\n when \"uploaded at\"\n return media_resource.created_at #old# .to_formatted_s(:date_time) # TODO media_resource.upload_session.created_at ??\n when \"copyright usage\"\n copyright = media_resource.meta_data.get(\"copyright status\").value.first || Meta::Copyright.default # OPTIMIZE array or single element\n return copyright.usage(read_attribute(:value))\n when \"copyright url\"\n copyright = media_resource.meta_data.get(\"copyright status\").value.first || Meta::Copyright.default # OPTIMIZE array or single element\n return copyright.url(read_attribute(:value))\n #when \"public access\"\n # return media_resource.acl?(:view, :all)\n #when \"media type\"\n # return media_resource.media_type\n #when \"gps\"\n # return media_resource.media_file.meta_data[\"GPS\"]\n end\n else\n case meta_key.object_type\n when \"Meta::Copyright\", \"Meta::Department\", \"Person\"\n meta_references.map(&:reference) #.map(&:to_s)\n when \"Meta::Term\", \"Meta::Keyword\"\n meta_keywords.map(&:meta_term) #.map(&:to_s)\n when \"Meta::Date\"\n meta_dates.map(&:to_s).join(' - ')\n when \"Meta::Country\"\n text\n else\n text\n end\n end\n end",
"def bp_meta_tags\n \"<meta name='base-project-version' content='#{bp_version}'>\".html_safe\nend",
"def meta name, contents\n Tagz.tag :meta, :name => name, :contents => contents \n end",
"def meta\n json_body.fetch('meta', {})\n end",
"def metadata(path)\n resp, data = get(path)\n meta = {}\n\n data.scan(/<input type=\"hidden\" name=\"__([A-Z]+)\" id=\"__[A-Z]+\" value=\"(.*?)\" \\/>/).each do |match|\n meta[\"__#{match[0]}\"] = CGI.escape(match[1])\n end\n\n meta\n end",
"def store_metadata\n html = HTMLParse.new(url)\n self.meta_title = html.title\n self.meta_desc = html.desc\n end",
"def get_tag(key)\n meta[key] || metrics[key]\n end",
"def metascore\n details.at(\"div.titleReviewBar a[href^=criticreviews] span\").text.to_i rescue nil\n end",
"def meta_tag(name, content)\n\t\ttag(:meta, name: name, content: content)\n\tend",
"def meta_data\n @meta_data ||= params['metaData']\n end",
"def dynamic_meta_tags\n @meta_tag_object = (@r_object || @page)\n return unless @meta_tag_object\n return unless @meta_tag_object.respond_to?(:meta_tags)\n meta_tags_list = []\n\n @meta_tag_object.meta_tags.each do |meta_tag|\n meta_tags_list << content_tag(:meta, \"\", name: meta_tag.meta_key, content: meta_tag.meta_value)\n end\n\n raw(meta_tags_list.join(\" \"))\n end",
"def meta_title\n read_attribute(:meta_title).blank? ? self.title : read_attribute(:meta_title)\n end",
"def meta\n meta = {}\n set_meta(meta)\n return meta\n end",
"def get_tagvalue(object, tagkey)\n value = \"\"\n if object[:tag_set]\n object[:tag_set].each do |tag|\n if tag[:key] == tagkey\n value = tag[:value]\n break\n end\n end\n end\n \n value\n end",
"def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end",
"def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end",
"def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end",
"def extract(name)\n @meta_tags.delete(name)\n end",
"def scan_text_for_meta(text)\r\n # break up the text with some extra newlines to make matching more likely\r\n # and strip out some tags\r\n text.gsub!(/<br/, \"\\n<br\")\r\n text.gsub!(/<p/, \"\\n<p\")\r\n text.gsub!(/<\\/?span(.*?)?>/, '')\r\n text.gsub!(/<\\/?div(.*?)?>/, '')\r\n\r\n meta = {}\r\n metapatterns = META_PATTERNS\r\n is_tag = {}\r\n [\"fandom_string\", \"pairing_string\", \"freeform_string\", \"rating_string\"].each do |c|\r\n is_tag[c.to_sym] = true\r\n end\r\n metapatterns.each do |metaname, pattern|\r\n # what this does is look for pattern: (whatever)\r\n # and then sets meta[:metaname] = whatever\r\n # eg, if it finds Author: Blah The Great it will set meta[:author] = Blah The Great\r\n metapattern = Regexp.new(\"(#{pattern})\\s*:\\s*(.*)\", Regexp::IGNORECASE)\r\n metapattern_plural = Regexp.new(\"(#{pattern.pluralize})\\s*:\\s*(.*)\", Regexp::IGNORECASE)\r\n if text.match(metapattern) || text.match(metapattern_plural)\r\n value = $2\r\n begin\r\n value = eval(\"convert_#{metaname.downcase}(value)\")\r\n rescue NameError\r\n end\r\n value = sanitize_fully(value) if is_tag[metaname]\r\n meta[metaname] = value\r\n end\r\n end\r\n return meta\r\n end",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def meta\n options[:meta]\n end",
"def version_meta_tag\n \"<meta name='version' content='#{CONFIG[:version]}'/>\"\n end",
"def single(name)\n els = @root.xpath(\"meta/#{name}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{name.inspect} elements found.\")\n return els[0] ? els[0].content : nil\n end",
"def get_meta_tags\n if @content_package\n\n if @content_package.meta_image_uid\n image = \"#{Settings.site_url}#{@content_package.meta_image.thumb('1200x630#').url}\"\n elsif @content_package.respond_to?(:hero_image) && @content_package.hero_image.present?\n image = \"#{Settings.site_url}#{@content_package.hero_image.thumb('1200x630#').url}\"\n end\n\n meta_title = @content_package.meta_title.presence || Settings.default_meta_title\n meta_description = @content_package.meta_description.presence || Settings.default_meta_description\n meta_keywords = @content_package.meta_keywords.presence || Settings.default_meta_keywords\n if @content_package.hide_from_robots?\n meta_hide_from_robots = \"<meta name='robots' content='noindex, nofollow' />\\n\"\n end\n\n else\n meta_title = content_for(:title) || Settings.default_meta_title\n meta_description = content_for(:description) || Settings.default_meta_description\n meta_keywords = content_for(:keywords) || Settings.default_meta_keywords\n meta_hide_from_robots = nil\n end\n\n meta_description = strip_tags CGI.unescapeHTML(meta_description.strip)\n\n meta_image = image || content_for(:meta_image) || \"#{Settings.site_url}#{asset_path(Settings.default_fb_meta_image)}\"\n\n meta_values = [meta_title, meta_description, meta_image, meta_keywords, meta_hide_from_robots]\n\n pig_meta_tags(meta_values)\n end",
"def head_content\n meta 'http-equiv' => 'content-type', :content => 'text/html;charset=UTF-8'\n title page_title\n end",
"def meta_tag(name, content = '')\n tag(:meta, :name => name, :content => content)\n end",
"def get_meta_title \n send_cmd(\"get_meta_title\")\n end",
"def page_meta_description\n \"To encourage an atmosphere of responsibility and transparency, while creating the most positive social network experience, Ello has created this bill of rights for all social network users.\"\n end",
"def get_meta_config\n get_config[:meta]\n end",
"def content_for_open_graph_tag(tag, html)\n # html.xpath(\"//head/meta[@property='#{tag}']/@content\").first.try(:content)\n content_for_meta_tag(\"property='#{tag}'\", html)\n end",
"def meta_title\n _meta_title\n end",
"def get_member_page_info(page, text)\n page.css('span').select{ |_span| _span.content[text] }.last\nend",
"def meta_file(url)\n Nokogiri::XML(open(url + '.meta4'))\n end",
"def meta_property_with_content(property, content)\n Regexp.new(\"<meta property=\\\"#{property}\\\" content=\\\"#{content}\\\">\")\n end",
"def get_value_from_pid(field, value)\n attr_value = \"\"\n begin\n attr_value = ActiveFedora::Base.load_instance_from_solr(value.split(\"/\").last).name if field == \"desc_metadata__creator_sim\"\n attr_value = ActiveFedora::Base.load_instance_from_solr(value).title if field == \"collection_sim\"\n rescue => e\n logger.warn(\"WARN: Helper method get_value_from_pid raised an error when loading #{value}. Error was #{e}\")\n end\n return attr_value.blank? ? value : attr_value\n end",
"def meta(key, value = nil)\n content_blocks.clear if content_for?(key) && value.present?\n value ? content_for(key) { value } : (yield_content(key).presence || nil)\n end",
"def extract_data( page )\n strip_tags page[:content]\n\n #extract_concepts( page[:title] , page , LOC_TITLE ) if page[:title] && page[:title] !=~ PTN_EMPTY\n if page[:tag] && page[:tag] !=~ PTN_EMPTY\n page[:tag] = page[:tag].split(SEP_TAG).map{|e|\"[[\"+e+\"]]\"}.join(\";\")\n extract_concepts( page[:tag] , page , LOC_TAG )\n end\n\n extract_concepts( page[:title] , page , LOC_TITLE)\n extract_concepts( page[:content] , page )\n extract_resources( page[:content] , page )\n end",
"def meta_keywords\n read_attribute(:meta_keywords).blank? ? self.title : read_attribute(:meta_keywords)\n end",
"def meta_data\n return nil unless success?\n\n @meta_data\n end",
"def extract_metadata(content)\n document = parse_kramdown(content)\n toc = ::Kramdown::Converter::Toc.convert(document.root)\n toc_items = toc[0].children.select { |el| el.value.options[:level] == 2 }.map do |t| \n {:id => t.attr[:id], :text => t.value.children.first.value}\n end\n metadata = document.root.options[:metadata]\n metadata[:toc] = toc_items\n metadata[:converted] = document.to_html\n metadata[:technologies] = metadata[:technologies].split(\",\").collect {|tech| tech.strip}\n metadata[:author] = metadata[:author].split(',').first if metadata[:author]\n metadata[:product] ||= @product\n metadata[:experimental] ||= @experimental\n metadata[:experimental] ||= false\n metadata[:level] = 'Beginner'\n metadata\n end",
"def extract_title\n at_css('title').text\n end",
"def page_description\n content_tag :meta, \"\", {name: \"description\", value: current_page.data.description } if current_page.data.description\n end",
"def yield_meta_tag(tag, default_text = '')\n content_for?(:\"meta_#{tag}\") ? content_for(:\"meta_#{tag}\") : default_text\n end",
"def parse(opengraph: nil, type: 'og')\n @page.fragments.to_a.each do |fragment|\n id = fragment.identifier.to_s\n next unless @mappings.key?(id)\n\n value = process_meta_tags(fragment)\n next if value.blank? # don't use the value if it isn't set\n\n # set opengraph meta-tag via a new hash\n payload = {}\n payload[@mappings[id]] = value\n opengraph.content(type, payload)\n end\n end",
"def get_tag_value(key)\n get_tag(key).try(:tag_value).try(:value)\n end",
"def set_meta_image\n regexp = /<img[^>]+src=[\"']([^\"']*)/\n if img_tag = (html_content || '').match(regexp)\n self.meta_image = img_tag[1]\n else\n self.meta_image = nil\n end\n end",
"def meta_property_with_content(property, content)\n Regexp.new(\"<meta property=\\\"#{property}\\\" content=\\\"#{content}\\\">\")\n end",
"def rating\n document.at(\"[@id='bookMeta']/*/[@itemprop='ratingValue']\").innerHTML.strip rescue nil\n end",
"def setExtractMetaTags(value)\n @fields['extract_meta_tags'] = value\n self\n end",
"def page_metadata(page)\n data = []\n add_data = Proc.new do |content|\n data.push(content_tag(:div, content))\n end\n \n filing = page.filing\n doc = page.filing_doc\n\n [[\"Filing: #{filing.fcc_num}\", fcc_filing_url(filing)],\n [\"Document: #{doc.fcc_num}\", doc.url]].each do |args|\n add_data[link_to(*args)]\n end\n\n add_data[\"Pages: #{doc.pagecount}\"] \n\n %w(author lawfirm applicant).each do |name|\n if (value = filing.send(name)).present?\n add_data[\"#{name.titleize}: #{value}\"]\n end\n end\n\n data.join(\"\\n\").html_safe\n end",
"def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end",
"def meta_description\n read_attribute(:meta_description).blank? ? self.intro[0, 255] : read_attribute(:meta_description)\n end",
"def page\n Integer(parsed_body['Meta']['Parameters']['page'] || 1)\n end",
"def og_title\n begin\n meta = doc.css(\"meta[property~='og:title']\")\n\n meta.each do |item|\n next if item[\"content\"].empty?\n\n return item[\"content\"]\n end\n rescue\n log \"Error getting OG tag: #{$!}\"\n end\n nil\n end",
"def get_meta_year \n send_cmd(\"get_meta_year\")\n end",
"def scrape_attribute_value(element, attribute)\n scrape element if !element.not_nil?\n return @result[attribute]\n end",
"def set_meta\n puts 'meta'\n end",
"def parse_meta_tags ( field_key )\n value = self[field_key]\n tags = parse_tags value\n return tags\n end",
"def get_nominee_attribute\n @data.search(\"div.nominee.alt p a:nth-child(2)\").collect { |attribute| attribute.text }\n end",
"def meta_information\n @meta_hash ||= {}\n end",
"def getMeta(metaKey)\n if @support_metakeys.include?(metaKey.to_s) then\n if @meta_data[@platform].key?(metaKey) then\n return @meta_data[@platform][metaKey]\n else\n return nil\n end\n else\n puts \"The given key '#{metaKey}' not support, it just support keys: #{@support_metakeys}.\"\n return nil\n end\n end",
"def meta the_key\n return @top_level[the_key]\n end",
"def meta\n tag(:meta, :charset => \"utf-8\") +\n tag(:meta, :name => \"viewport\",\n :content => \"width=device-width, initial-scale=1.0\")+\n tag(:meta, :name => \"HandheldFriendly\", :content => \"True\")+\n tag(:meta, 'http-equiv' => \"cleartype\", :content => \"on\")+\n favicon_link_tag('https://library.nyu.edu/favicon.ico')+\n csrf_meta_tags\n end",
"def content_rating\n details.at(\"div.subtext meta[itemprop='contentRating']\")['content'] rescue nil\n end",
"def [](name)\n @meta_tags[name]\n end",
"def set_meta\n meta.tap do |m|\n m.tag = [{\n system: META_SYSTEM,\n code: META_CODE,\n display: META_DISPLAY\n }]\n end\n end",
"def extract_from_page(url, spec={})\n finders = spec[:finders] || all_finders\n if label = spec[:label] # Can specify either a single label or a set\n labels = ((label.class == Array) ? label : [label]).collect { |l| l.to_s }\n finders = finders.keep_if { |t| labels.include? t[:label] }\n else\n labels = SiteServices.data_choices\n end\n begin\n pagetags = PageTags.new(url, @site, finders, spec[:all], false)\n rescue\n puts \"Error: couldn't open page '#{url}' for analysis.\"\n return {}\n end\n results = {}\n # We've cracked the page for all tags. Now report them into the result\n labels.each do |label|\n if foundstr = pagetags.result_for(label)\n # Assuming the tag was fulfilled, there may be post-processing to do\n case label\n when \"Title\"\n # A title may produce both a title and a URL, conventionally separated by a tab\n titledata = foundstr.split('\\t')\n results[:URI] = titledata[1] if titledata[1]\n foundstr = trim_title titledata.first\n when \"Image\", \"URI\"\n # Make picture path absolute if it's not already\n foundstr = resolve foundstr\n end\n results[label.to_sym] = foundstr\n end\n end\n results\n end",
"def head \n meta_author \"Kane Baccigalupi\"\n end",
"def meta_tag_keyword\n $tracer.trace(__method__)\n return ToolTag.new(jquery(\"meta[name='keyword']\"),__method__)\n end",
"def scrape_value(element)\n raise ArgumentError, \"scrape_value: element was nil!\" if element.nil?\n scrape element\n return @result.value\n end",
"def get_ver(url,tag)\n puts \"Search and return tag version within the url payload: #{url}, #{tag}\" if @verbose\n tag_ver=\"\"\n doc = open_page(url)\n case tag\n when \"utag.js\" # sample: ...,\"code_release_version\":\"cb20190312032612\",...\n doc.text.each_line do |line|\n my_line = line.downcase\n if my_line.include?(\"code_release_version\")\n puts \"Extract tag version from line: #{my_line}\" if @verbose\n m = my_line.match(/\\\"code\\_release\\_version\\\"\\:\\\"(?<ver>[a-z]+\\d+)\\\"/)\n tag_ver = m[:ver]\n break\n end\n end\n when \"analytics.js\" # sample #1: ga('create', 'UA-19175804-2', 'knopfdoubleday.com');\n doc.text.each_line do |line|\n my_line = line.downcase\n if my_line.include?(\"ga\") && my_line.include?(\"create\") #sample #2: __gaTracker('create', 'UA-121313929-1', 'auto');\n puts \"Extract tag version from line: #{my_line}\" if @verbose\n m = my_line.match(/[\\'|\\\"]create[\\'|\\\"]\\s*\\,\\s*[\\'|\\\"](?<ver>\\w+\\-\\d+\\-\\d+)[\\'|\\\"]\\s*\\,/)\n tag_ver = m[:ver]\n break\n end\n end\n when \"ga.js\"\n doc.text.each_line do |line|\n my_line = line.downcase\n puts my_line if @verbose\n if my_line.include?(\"push\") && my_line.include?(\"_setaccount\") # # sample #1: _gaq.push(['_setAccount', 'UA-13205363-65']);\n m = my_line.match(/[\\'|\\\"]\\_setaccount[\\'|\\\"]\\s*\\,\\s*[\\'|\\\"](?<ver>\\w+\\-\\d+\\-\\d+)[\\'|\\\"]/)\n tag_ver = m[:ver]\n break\n end\n if my_line.include?(\"_gettracker\") # sample #2: var pageTracker = _gat._getTracker(\"UA-12487327-1\");\n puts \"Extract tag version from line: #{my_line}\" if @verbose\n m = my_line.match(/\\_gettracker\\s*\\(\\s*[\\'|\\\"](?<ver>\\w+\\-\\d+\\-\\d+)[\\'|\\\"]/)\n tag_ver = m[:ver]\n break\n end\n\n end\n when \"all.js\" # sample: appId : '749936668352954',\n doc.text.each_line do |line|\n my_line = line.downcase\n if my_line.include?(\"appid\") && my_line.include?(\":\")\n puts \"Extract tag version from line: #{my_line}\" if @verbose\n m = my_line.match(/appid\\s+\\:\\s+[\\'|\\\"](?<ver>\\d+)[\\'|\\\"]\\s*\\,/)\n tag_ver = m[:ver]\n break\n end\n end\n\n else\n puts \"Don't know how to locate Adware Tag version: #{tag}\"\n # do nothing\n end\n doc = nil\n return tag_ver.upcase\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}: #{url} : #{tag}\" if @verbose\n return tag_ver\n end",
"def render_meta_tag(options={})\n default_options = {\n :name => \"\",\n :default_language => \"de\",\n :content => \"\"\n }\n options = default_options.merge(options)\n lang = (current_page.language.blank? ? options[:default_language] : current_page.language)\n %(<meta name=\"#{options[:name]}\" content=\"#{options[:content]}\" lang=\"#{lang}\" xml:lang=\"#{lang}\" />)\n end",
"def meta_file\n get_file(META_PATH)\n rescue StandardError\n nil\n end",
"def remove_metadata(content_node)\n extra_meta = content_node.css(\"h1\")[0]\n if extra_meta.present? && page_title.match(extra_meta.text)\n extra_meta.remove\n end\n end"
] | [
"0.7258221",
"0.6716201",
"0.66033334",
"0.6501697",
"0.6474944",
"0.6412844",
"0.6277703",
"0.62498915",
"0.6245625",
"0.6232757",
"0.6206824",
"0.6184546",
"0.6146254",
"0.61297274",
"0.61200905",
"0.61134243",
"0.6070692",
"0.6048937",
"0.60113454",
"0.60113454",
"0.5992974",
"0.59924483",
"0.59823227",
"0.5976179",
"0.5964441",
"0.59197855",
"0.59082407",
"0.5902618",
"0.5864803",
"0.58443344",
"0.578954",
"0.5765531",
"0.57236165",
"0.5712258",
"0.57039404",
"0.5674376",
"0.5670352",
"0.56496656",
"0.5647139",
"0.5629093",
"0.56154597",
"0.56154597",
"0.56154597",
"0.5613466",
"0.5608935",
"0.56066275",
"0.5604761",
"0.56016845",
"0.5594548",
"0.55727696",
"0.5560132",
"0.5552256",
"0.55326855",
"0.5529574",
"0.5522776",
"0.5513066",
"0.5500321",
"0.54922664",
"0.5480212",
"0.5462776",
"0.5452459",
"0.54363513",
"0.5431617",
"0.5418217",
"0.5408287",
"0.54045993",
"0.54036283",
"0.5401343",
"0.53910846",
"0.5389314",
"0.5386829",
"0.53501236",
"0.5339548",
"0.5291718",
"0.52800167",
"0.52792495",
"0.52785647",
"0.5276524",
"0.5275286",
"0.5257639",
"0.5257129",
"0.5255162",
"0.5253771",
"0.5251384",
"0.5251243",
"0.5248664",
"0.5246665",
"0.5246161",
"0.52338207",
"0.5230439",
"0.5228674",
"0.520947",
"0.5206936",
"0.5204942",
"0.51957595",
"0.5193705",
"0.5188314",
"0.5178674",
"0.5174814",
"0.5174339"
] | 0.76771367 | 0 |
Show the most recent images | def latest
@photos = @region.photos.order("id DESC").limit(18)
respond_to do |format|
format.html { render :template => @template }
format.json { render json: @photos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n # most recent picture first!\n @title = \"Latest photos\"\n @photos = Photo.all.order(created_at: :desc)\n end",
"def index\n @imgs = Img.order(created_at: :desc).limit(20)\n end",
"def index\n @recent_objects = Image.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end",
"def recent_screenshots\n fetch_screenshots\n end",
"def index\n @classfield_images = ClassfieldImage.all.order('created_at DESC').limit('25')\n end",
"def index\n @image_targets = Admin::ImageTarget.recent_year(4).order(target: :asc)\n end",
"def index\n @pics = Pic.all.order(\"created_at DESC\") #decending order \n end",
"def index\n @pictures = Picture.all\n @pictures = @pictures.order(created_at: :desc)\n end",
"def index\n @galleries = Gallery.all.order(updated_at: :desc)\n end",
"def recent_images(count = 20, page = 1)\n latest_photo = self.photos.limit(1).first\n min_id = if latest_photo\n latest_photo.uid\n else\n nil\n end\n\n params = {count: count, access_token: self.access_token}\n params[:min_id] = min_id if min_id\n\n response = Star::Requester.get \"users/#{self.uid}/media/recent\", params\n # Add new photos to DB\n response.body.data.each do |image| \n Photo.create_or_update_from_instagram(image, self)\n end\n self.photos.order('created_at DESC').limit(count)\n\n end",
"def last_front_page_image\n Issue.find(:first, :conditions => ['date <= ? AND front_page_image', date], :order => 'date DESC').front_page_image\n end",
"def get_recent(args = {})\r\n PhotoList.new('flickr.photos.getRecent', args)\r\n end",
"def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end",
"def get_latest_post(post_count)\n #Post.select(\"title AS post_title, content AS post_body, post_image AS blog_image\").limit(post_count).order(\"created_at desc\")\n @latest_p =Post.all.limit(post_count).order(\"updated_at desc\") #added for testin purpose as I am not getting post_image in show.\n end",
"def index\n @guardarios_img = GuardarioImage.last(9).reverse\n end",
"def thumbnails\n ImageCollection.by_make_top(make, 10)\n end",
"def show_images\r\n images = Document.new(self).get_images\r\n puts \"There are #{images.length} images\"\r\n index = 1\r\n images.each do |l|\r\n puts \"image: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" src: #{l.src}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def fetch_recent_images_by_tag(tag = nil)\n configure_connection\n tag ||= Lentil::Engine::APP_CONFIG[\"default_image_search_tag\"]\n Instagram.tag_recent_media(tag, :count=>10)\n end",
"def recently_updated(min_date, args = {})\r\n args['min_date'] = min_date.to_i\r\n PhotoList.new('flickr.photos.recentlyUpdated', args)\r\n end",
"def get_any_top(number)\n images.take(number)\n end",
"def recents\n files = session[:user].x_files.all(:last_update.gte => (DateTime.now - 20.days), folder: false, limit: 20)\n files_list = []\n files.each do |file|\n files_list.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files_list, success: true }\n end",
"def index\n @events = Event.where(\"end_time >= ?\", Time.new).order('created_at DESC').page params[:page]\n @images = @events.first(5).map(&:main_image)\n end",
"def index\n @images = Image.where(\"user_id=?\", current_user.id).reverse\n end",
"def recent_files\n # print -rl -- **/*(Dom[1,10])\n @title = 'Recent files'\n # zsh D DOT_GLOB, show dot files\n # zsh om order on modification time\n @files = `zsh -c 'print -rl -- **/*(Dom[1,15])'`.split(\"\\n\").reject { |f| f[0] == '.' }\nend",
"def recent(id=nil)\n id = \"self\" unless id\n get \"/users/#{id}/media/recent\", auth_params\n end",
"def preview_images\n sql = <<-SQL\n select i.*\n from terms\n left join tourfilter_shared.images i\n on (i.term_text = terms.text)\n left join matches\n on (terms.id=matches.term_id)\n\n and i.term_text is not null\n and i.created_at>adddate(now(),interval -7 day)\n group by i.term_text\n order by i.created_at desc\n SQL\n @images = Image.find_by_sql(sql)\n end",
"def latest_image\n attachments.present? ? attachments.last.document.url(:medium) : \"#{APP_URL}/images/missing.png\"\n end",
"def images\n do_client.images.all.select do |image|\n image.public == false && image.type.casecmp('snapshot').zero?\n end.sort_by(&:id).reverse\n rescue DropletKit::Error => e\n e\n end",
"def recent_drops_with_preview\n Drop.after_on_topic(Time.now,self).only_visable.order_by_topic(self).with_preview_image.limit(2)\n end",
"def index\n @images = Image.where(homepage: true).order(updated_at: :desc).paginate(:page => params[:page], :per_page => 3)\n end",
"def index\n @albumfives = Albumfive.all.order(\"created_at DESC\")\n end",
"def get_user_recent_media\n response = @client.get(\"#{@base_url}/v1/users/self/media/recent\", access_token: get_user_access_token)\n medias = JSON.parse(response.body) \n if(medias[\"meta\"][\"code\"] == 200)\n media_url = []\n medias[\"data\"].each do |media|\n url = media[\"images\"][\"standard_resolution\"][\"url\"]\n media_url.push(url)\n end\n media_url \n end\n end",
"def show\n @emptyphoto = Photo.new\n @photo = Photo.find_by_secret_id(params[:id])\n @top5 = Photo.popular\n\n @photo.add_to_view_count(1)\n end",
"def recent\n self.order('created_at DESC')\n end",
"def index\n @pagy, @posts = pagy(Post.with_attached_images.all.order(\"created_at DESC\"))\n end",
"def display_recently_uploaded?\n Flipflop.show_recently_uploaded?\n end",
"def index\n @recent_objects = Citation.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end",
"def index\n sort_by = ['recent','votes'].include?(params[:sort]) ? params[:sort] : 'recent'\n order = sort_by == \"recent\" ? \"created_at DESC\" : \"up_votes DESC\"\n @images = Image.where(:contest_id=>@contest).order(order).page(params[:page])\n respond_to do |format|\n format.html {render :layout=>false}\n format.js \n end\n end",
"def index\n if @current_user.is_admin\n @pictures = Picture.order('created_at DESC')\n else\n @pictures = @current_user.pictures.order('created_at DESC')\n end\n # @pictures = Picture.all\n end",
"def index\n @stampimages = Stampimage.all\n @stampimages = Stampimage.order(\"rate\")\n end",
"def image\n images.first\n end",
"def recent\n\n\t\t# GET ALL THE RECENT POSTS\n\t\t@posts_recent = Post.find(:all, :limit => 5)\n\n respond_to do |format|\n format.html { render :layout => false } # recent.html.erb\n format.xml { render :xml => @posts_recent }\n end\n end",
"def show\n if params.has_key?(:page)\n @images = Kaminari.paginate_array(@image_label_set.images).page(params[:page])\n else\n @images = Kaminari.paginate_array(@image_label_set.images).page(1)\n end\n end",
"def list_images\n if params[:page].to_s.to_i > 1000\n render(\n status: :too_many_requests,\n content_type: \"text/plain\",\n plain: \"Your queries are killing our server. \" \\\n \"There are much better ways to scrape the images \" \\\n \"from our site. \" \\\n \"Please contact the webmaster.\" \\\n \"And please stop hammering our server!\"\n )\n return\n end\n\n query = create_query(:Image, :all, by: :created_at)\n show_selected_images(query)\n end",
"def latest_ubuntu\n @images.select do |img|\n img[\"official\"] == true &&\n img[\"arch\"] == \"i686\" &&\n img[\"name\"] =~ /ubuntu/i\n end.sort do |a, b|\n # Reverse sort so \"raring\" > \"precise\" and \"13.10\" > \"13.04\"\n b[\"name\"].downcase <=> a[\"name\"].downcase\n end.first[\"id\"]\n rescue StandardError\n nil\n end",
"def index\n @tags = params[:tags] ? params[:tags].split(Image.tags_separator) : nil\n\n if @tags\n include_tags = @tags.reject {|t| t.slice(0, 1) == '-'}\n exclude_tags = @tags.select {|t| t.slice(0, 1) == '-'}\n exclude_tags.map! {|t| t[1..-1]}\n\n @images = Image.recent.tagged_with_all(include_tags).not_in(:tags_array => exclude_tags)\n else\n @images = Image.recent\n end\n\n @images = Kaminari.paginate_array(@images).page(params[:page]).per(200)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @images }\n format.atom\n end\n end",
"def index\n if params[:tag]\n @images = Image.tagged_with(params[:tag]).recent.page(params[:page])\n else\n @images = Image.recent.page(params[:page]).per(12)\n end\n respond_to do |format|\n \tformat.html\n format.js\n end\n end",
"def show\n @recents = @circle.recents\n end",
"def latest_interviews\n self.interviews.order(\"DATE DESC\").where(:status=>1)\n end",
"def recent\n @question = Question.new\n @questions = Question.only_public.order(\"created_at desc\").paginate({\n :page => params[:page]\n })\n\n render layout: \"full-width\"\n end",
"def index\n @featured_memorials = Memorial.most_recent\n end",
"def index\n @recent_objects = Content.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end",
"def index\n @pictures = Picture.all\n @older_than = Picture.more_than_month\n end",
"def latest\n @loops = Loop.latest\n render 'list'\n end",
"def index\n @articles = Article.all\n @most_recent = Article.last\n end",
"def index\n @images = Image.where(\"article is not null or thumbnail is not null\").order(\"id desc\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @console_images }\n end\n end",
"def index\n @recent_objects = Note.where(project_id: $project_id).order(updated_at: :desc).limit(10)\n end",
"def newest\n @submissions = Submission.all.order(\"created_at DESC\")\n @from_newest = true;\n render :index\n end",
"def show\n @images = Image.all\n render :index\n end",
"def index\n @albumfours = Albumfour.all.order(\"created_at DESC\")\n end",
"def latest_ubuntu\n @images.select do |img|\n img[\"official\"] == true &&\n img[\"status\"] == \"available\" &&\n img[\"arch\"] == \"x86_64\" &&\n img[\"name\"] =~ /ubuntu/i\n end.sort do |a, b|\n # Reverse sort so \"22.10\" > \"22.04\"\n NameSorter.new(b[\"name\"]).version <=> NameSorter.new(a[\"name\"]).version\n end.first[\"id\"]\n rescue StandardError\n nil\n end",
"def recent_videos\n videos.first(6)\n end",
"def index\n @photos = if params[:id].present?\n if params[:limit]\n Collection.find(params[:id]).photos.order(\"created_at DESC\").limit(4)\n else\n Collection.find(params[:id]).photos.order(\"created_at DESC\")\n end\n else\n Photo.ranked\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def get_recent_view\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => [0,1]).order('interests.created_at DESC').limit(5)\n return shows.all\n end",
"def gallery_images\n imgs = []\n images.each do |image|\n imgs << image.public_filename(:medium)\n end\n 1.upto(6 - imgs.size) do |i|\n imgs << \"/images/placeholder.png\"\n end\n imgs\n end",
"def current\n entries = Dir.glob(\"#{self.ftp_upload_directory}/*.jpg\")\n # File.mtime is modified time.\n res = entries.max_by {|f| File.mtime(f)}\n if (res == nil)\n raise NoPictureException.new(\"No Latest Picture\")\n end\n return res\n end",
"def index\n @winning_photos = WinningPhoto.all.reverse\n end",
"def index\n @viewers = Viewer.all.order(\"created_at desc\")\n end",
"def reported\n #ordered by report count, then by most recent\n @photos = Photo.where(\"report_count > 0\").order(report_count: :desc, created_at: :desc)\n if (@photos.size > 0)\n @title = \"Reported photos\"\n else\n @title = \"No reported photos\"\n end\n render 'index'\n end",
"def recent_observations(num = 5)\n observations.find(:all, :limit => num, :order => \"created_at DESC\")\n end",
"def index\n @images = Image.order(\"id DESC\")\n @images = @images.paginate(:page => params[:page], per_page: 4)\n end",
"def show\n @gallery = Gallery.find(params[:id])\n @images = @gallery.images.order('position ASC')\n end",
"def index\n @cameras = current_user.cameras.latest.page(params[:page]).per 6\n end",
"def recent_posts(count=5)\n @sorted_articles ||= sorted_articles\n\n return @sorted_articles[0, count-1]\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end",
"def recent_photos(user_id_or_url, options = {})\n options = make_options(:user_id, user_id_or_url, options)\n options[:recent_photos] = true\n get(options)\n end",
"def index\n @tags = Tag.popular.paginate(:page => params[:page], :per_page => 24)\n @last_updated = Tag.order(:updated_at).reverse_order.first\n end",
"def activity\n (self.photos.recent + self.comments.recent).sort_by(&:created_at)\n end",
"def index\n @galleries = Gallery.order(created_at: :desc)\n @categories = Category.all\n end",
"def index\n @recent_objects = AssertedDistribution.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end",
"def recent\n @title = \"Recently Active\".t\n do_search_kases(kase_class, :most_recent)\n render :template => 'kases/index' unless request.xhr?\n end",
"def set_order_of_images!\n n = 1\n images.order('order_of_display, created_at asc').each do |image|\n image.order_of_display = n\n n += 1\n class << image\n def record_timestamps; false; end\n end\n image.save!(:validate => false)\n end\n end",
"def index\n @albumsevens = Albumseven.all.order(\"created_at DESC\")\n end",
"def most_recent\n self.stats.first\n end",
"def load_pictures\n page = params[:page].to_i\n per_page = 20\n off = (page-1)*per_page\n @discussion_group = DiscussionGroup.find(params[:id])\n @pictures = @discussion_group.images.offset(off).limit(10).order(\"photo_updated_at DESC \")\n end",
"def index\n @repositories = Repository.limit(20)\n @recent_objects = Repository.order(updated_at: :desc).limit(10)\n end",
"def index\n @galleries = Gallery.find_all_by_private(:false)\n \n @galleries.sort! { |a,b| b.created_at<=>a.created_at }\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @galleries }\n end\n end",
"def foreach_recent_badge\n CollectionWrapper.new(current_group.badges.desc(:created_at).page(params[:badges_page]).per(25), BadgeWrapper, view_context)\n end",
"def recent_posts\n posts.reverse[0,25]\n end",
"def recent\n result = http_get(\"/services/data/v#{self.version}/recent\")\n collection_from(result.body)\n end",
"def show_most_popular\n @card_sets = CardSet.order(\"impressions_count DESC\")[0..19]\n end",
"def show\n redirect_to :controller => 'sessions', :action => 'connect' if !session[:access_token] \n\n @contest = Contest.find(params[:id])\n\n client = Instagram.client(:access_token => session[:access_token])\n @user = client.user\n \n pictures = client.tag_recent_media('mazeh9art')\n \n pictures.data.each do |p|\n picture = Picture.find_or_initialize_by_instagram_id(p.id)\n picture.update_attributes(title: p.caption.text, url: p.images.standard_resolution.url )\n end\n \n gon.pics = pictures #Contest.first.getNextPictures() \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def desc\n profiles.latests.first\n end",
"def cur_image\n self\n end",
"def index\n @albumones = Albumone.all.order(\"created_at DESC\")\n end",
"def index\n if logged_in?(:site_admin)\n @magics = Magic.recent.page(params[:page]).per(5)\n else\n @magics = Magic.published.recent.page(params[:page]).per(5)\n end\n @page_title = \"My Portfolio Blog\"\n end",
"def index\n @recent_objects = Serial.order(updated_at: :desc).limit(10)\n end",
"def index\n @albumsixs = Albumsix.all.order(\"created_at DESC\")\n end",
"def index\n @gallery_items = GalleryItem.all.order(created_at: :desc).page params[:page]\n end",
"def newest\n @posts = Post.order(:created_at).reverse_order.all\n @contador = 0\n end"
] | [
"0.7246279",
"0.7193732",
"0.7173222",
"0.685053",
"0.6738076",
"0.67314905",
"0.67102146",
"0.6678358",
"0.6583362",
"0.6579719",
"0.6561391",
"0.6553216",
"0.65126586",
"0.6499532",
"0.64647305",
"0.6424361",
"0.63947105",
"0.6359862",
"0.6342885",
"0.63407385",
"0.62854546",
"0.62831396",
"0.6277576",
"0.6202774",
"0.61881655",
"0.6174489",
"0.61722684",
"0.61354995",
"0.613025",
"0.6117595",
"0.6092927",
"0.6087502",
"0.6084482",
"0.6070918",
"0.60673034",
"0.6044667",
"0.6022241",
"0.60191613",
"0.6012015",
"0.6010533",
"0.5997755",
"0.59965897",
"0.5976567",
"0.5962803",
"0.5949436",
"0.59388846",
"0.5928833",
"0.59278613",
"0.5915766",
"0.59140307",
"0.59115934",
"0.5905007",
"0.5903024",
"0.5896363",
"0.589401",
"0.5879516",
"0.58700967",
"0.5866105",
"0.5855079",
"0.5843632",
"0.5841475",
"0.5827992",
"0.5819459",
"0.5810453",
"0.58074737",
"0.58000016",
"0.5799939",
"0.57966644",
"0.57953197",
"0.57933676",
"0.57866526",
"0.5782268",
"0.5782198",
"0.5782068",
"0.5777531",
"0.5768161",
"0.5758355",
"0.5751315",
"0.57478",
"0.57431597",
"0.5741219",
"0.5736686",
"0.57355285",
"0.5734635",
"0.5732731",
"0.57312226",
"0.5725104",
"0.5721017",
"0.5717036",
"0.57129437",
"0.570711",
"0.5695461",
"0.569484",
"0.56944627",
"0.5694221",
"0.56879634",
"0.568521",
"0.5683666",
"0.56829125",
"0.5673257"
] | 0.604605 | 35 |
Show the toprated images from the past 48 hours | def popular
@limit = params[:limit] || 50;
@photos = @region.photos.where("created_at > ? AND score > 0", now - 48 * 3600).order("score DESC").limit(@limit)
if not @photos.any?
@photos = @region.photos.where("score < 100 AND score > 20").order("score DESC").limit(@limit)
end
respond_to do |format|
format.html { render :template => @template }
format.json { render json: @photos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @altitude_file = \"graphs/#{@track.id}-altitude.png\"\n @altitude_thumbnail_file = \"graphs/#{@track.id}-altitude-thumbnail.png\"\n altitude_path = File.expand_path(\"images/#{@altitude_file}\", Rails.public_path)\n altitude_thumbnail_path = File.expand_path(\"images/#{@altitude_thumbnail_file}\", Rails.public_path)\n if ! (File.exists?(altitude_path) and File.exists?(altitude_thumbnail_path))\n image = Gruff::Line.new\n image.title = 'Altitude'\n t_start = Time.parse(@track.nodes.first.time.to_s).to_i\n puts \"Start: #{@track.nodes.first.inspect}\"\n puts \"End: #{@track.nodes.last.inspect}\"\n t_range = Time.parse(@track.nodes.last.time.to_s).to_i - t_start\n image.dataxy('Altitude', @track.nodes.map{ |n| [Time.parse(n.time.to_s).to_i - t_start, n.alt] })\n (t_range/3600 + 1).times do |i|\n image.labels[i*3600] = \"#{i}\"\n end\n image.x_axis_label = 'Hours'\n image.y_axis_label = 'Meters'\n image.minimum_value = 0\n image.write(altitude_path)\n image.resize(0.5)\n image.write(altitude_thumbnail_path)\n end\n end",
"def url\n file.expiring_url(10 * 60)\n end",
"def url\n file.expiring_url(10 * 60)\n end",
"def pics(from_datetime, to_datetime)\n # returns true if any new pictures were downloaded from the web, false otherwise\n pic_dwnlded = false\n from_datetime += 10 * 60 # +10.minutes from our latest pic on local drive\n\n while from_datetime <= to_datetime\n tenmin = if last_iter?(from_datetime, to_datetime)\n OsUtils.tenmin(from_datetime.min, to_datetime.min)\n elsif !pic_dwnlded # i.e. it's while's first iteration. don't update the whole hour, only the remaining minutes\n OsUtils.tenmin(from_datetime.min)\n else\n OsUtils.tenmin\n end\n\n pic_dwnlded = pic(from_datetime, tenmin)\n\n break if last_iter?(from_datetime, to_datetime) || !pic_dwnlded\n\n from_datetime = if to_datetime - from_datetime > 3600\n from_datetime + 3600\n else\n Time.new(to_datetime.year, to_datetime.month, to_datetime.day, to_datetime.hour, 0, 0, '+00:00')\n end\n end\n\n if verbose\n puts pic_dwnlded ? \"Latest Fetched: #{find_latest_local[:timestamp]}\" : 'Nothing downloaded.'\n end\n pic_dwnlded\n end",
"def slideshow_time\n end",
"def recent_screenshots\n fetch_screenshots\n end",
"def preview_images\n sql = <<-SQL\n select i.*\n from terms\n left join tourfilter_shared.images i\n on (i.term_text = terms.text)\n left join matches\n on (terms.id=matches.term_id)\n\n and i.term_text is not null\n and i.created_at>adddate(now(),interval -7 day)\n group by i.term_text\n order by i.created_at desc\n SQL\n @images = Image.find_by_sql(sql)\n end",
"def show_image\n @timetable = Timetable.find(params[:id])\n if !@timetable.nil?\n send_file @timetable.timetable_image_file.url, disposition: 'inline'\n else\n redirect_to root_url, notice: \"Timetable does not exist yet\"\n end\n end",
"def index\n @imgs = Img.order(created_at: :desc).limit(20)\n end",
"def dump_show_img\n FileUtils.rm_rf(Dir.glob(\"#{project.image_for('', 'show_image_desk')}/*\"))\n FileUtils.rm_rf(Dir.glob(\"#{project.image_for('', 'show_image_mob')}/*\"))\n FileUtils.rm_rf(Dir.glob(\"#{project.image_for('', 'show')}/*\"))\n end",
"def get_image_url(newspaper, date)\n date_path = get_date_path(date)\n\n return \"https://tar.mx/periodicos-mexico/dl/#{date_path}/#{newspaper}_t.jpg\"\nend",
"def show\n @show_times_today = @cinema.show_times.where(:show_time => ((Date.current.beginning_of_day)..(Date.current.end_of_day))).order(\"show_time ASC\")\n @show_times_tomorrow = @cinema.show_times.where(:show_time => ((Date.current.beginning_of_day + 216000)..(Date.current.end_of_day + 216000))).order(\"show_time ASC\")\n end",
"def capture\n for i in 0..49\n\t open(\"tempImages/image#{i}.png\", 'wb') do |file|\n\t file << open('http://hq.cirrusmio.com:82/media/?action=snapshot', http_basic_authentication: [\"admin\", \"admin\"]).read\n\t sleep(0.2)\n\tend\n end\n end",
"def index\n @recent_objects = Image.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end",
"def index\n @events = Event.where(\"end_time >= ?\", Time.new).order('created_at DESC').page params[:page]\n @images = @events.first(5).map(&:main_image)\n end",
"def expire_cache_pictures(picture)\n expire_page :controller => '/pictures', :action => :index\n expire_page :controller => '/pictures', :action => :show, :id => picture\n end",
"def show\n scan_procedure_array =current_user[:view_low_scan_procedure_array]\n \n @visit = Visit.where(\"visits.id in (select visit_id from scan_procedures_visits where scan_procedure_id in (?))\", scan_procedure_array).find_by_id(params[:id])\n # Grab the visits within 1 month +- visit date for \"previous\" and \"back\" hack.\n @visits = Visit.where(\"visits.id in (select visit_id from scan_procedures_visits where scan_procedure_id in (?))\", scan_procedure_array).where(:date => @visit.date-1.month..@visit.date+1.month).all\n # might be giving errors if user not have perms on some of visits????\n idx = @visits.index(@visit)\n @older_visit = idx + 1 >= @visits.size ? nil : @visits[idx + 1]\n @newer_visit = idx - 1 < 0 ? nil : @visits[idx - 1]\n \n @image_datasets = @visit.image_datasets.page(params[:page])\n @participant = @visit.try(:enrollments).first.try(:participant) \n @enumbers = @visit.enrollments\n @mriscantask = Mriscantask.where(\"visit_id in (?) and (lookup_set_id not in (8) or lookup_set_id is NULL)\",@visit.id)\n @appointment = Appointment.find(@visit.appointment_id)\n @vgroup = Vgroup.find(@appointment.vgroup_id)\n\n v_thumbnail_base = \"/Users/caillingworth/code/WADRC-Data-Tools/public/system/thumbnails/\"\n if Rails.env==\"production\" \n v_thumbnail_base = \"/Library/WebServer/WADRC-Data-Tools/shared/system/thumbnails/\"\n end\n @visit.image_datasets.each do |ids|\n v_thumbnail_path = v_thumbnail_base+ids.id.to_s\n puts \"aaaaaaaaaaaa v_thumbnail_path= \"+v_thumbnail_path\n # problem with umask 007 setting all files to 770 , and files created as non-expected (web server?) user\n # FileUtils.chown_R('panda_user','panda_group', v_thumbnail_path); \n # check if file exists,\n # check permissions \n if File.directory?(v_thumbnail_path)\n FileUtils.chmod_R(0774, v_thumbnail_path)\n end \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visit }\n end\n end",
"def generate_thumbnails\n self.thumbnails = []\n\n # generate from thumb_moments\n (JSON.parse(profile.thumb_moments) rescue []).each do |time|\n self.thumbnails << Thumbnail.generate(\n newly_converted,\n :width => profile.thumbnail_width,\n :height => profile.thumbnail_height,\n :time => time) if time.to_f <= newly_converted.duration_in_secs\n end\n\n # generate from thumb_way\n thumb_start = profile.thumb_start.to_f > 0.0 ? profile.thumb_start.to_f : 0.0\n thumb_end = profile.thumb_end .to_f > 0.0 ? profile.thumb_end .to_f : newly_converted.duration_in_secs\n thumb_amount = profile.thumb_amount.to_i > 0 ? profile.thumb_amount.to_i : 0\n\n thumb_start = newly_converted.duration_in_secs if thumb_start > newly_converted.duration_in_secs\n thumb_end = newly_converted.duration_in_secs if thumb_end > newly_converted.duration_in_secs\n\n thumb_amount.times do |i|\n time =\n case profile.thumb_way\n when Thumbnail::RAND\n thumb_start + rand*(thumb_end-thumb_start)\n else#Thumbnail::EVEN\n thumb_start + (i+1)*(thumb_end-thumb_start)/(thumb_amount+1)\n end\n self.thumbnails << Thumbnail.generate(\n newly_converted,\n :width => profile.thumbnail_width,\n :height => profile.thumbnail_height,\n :time => time)\n end if thumb_start <= thumb_end\n end",
"def index\n @pictures = Picture.all\n @older_than = Picture.more_than_month\n end",
"def screenshot\n dname = Document.name.get[0][0..-5]\n a = File.open(\"/tmp/skim-#{dname}-tmp\",\"a\")\n page = Document.get[0].current_page.get.index.get\n\n curfile = File.last_added(\"#{Home_path}/Desktop/Screen*.png\")\n a << \"#{curfile},#{page}\\n\"\n growl(\"One picture added to wiki notes cache\")\nend",
"def screenshots(num_thumbnail_imgs)\n puts \"transcoded_movie thumbnail generation\"\n\t puts \"number of thumbnails #{num_thumbnail_imgs}\"\n\t \n\t \n\t #skipping some frames from begining and ending to take screenshots\n\t init_time = 15\n seek_t = ($transcoded_movie.duration - init_time*2) / num_thumbnail_imgs.to_i\n \t \n\t \n\t i = 0\n\t \n\t while i < num_thumbnail_imgs.to_i do\n filename = \"thumbnail_#{i}.jpg\"\n \n \t #, preserve_aspect_ratio: :width\n # keeping 160x90 to preserve aspect ratio 16:9 \n\t\t \n\t\t puts \"generating #{filename}\"\n \n\t\t $transcoded_movie.screenshot(filename, seek_time: (init_time + seek_t * i), resolution: '160x90')\n\t\t i += 1\n end #end while\t \n end",
"def delete_expired_images(region = AWSCONFIG[:default_region])\n #find images with tags of expiring and less than today's date\n ec2 = AWS::EC2.new(:region => region).client\n images = ec2.describe_images(:owners => [\"self\"], :filters => [:name => 'tag-key', :values => ['expiring']])\n deleted_images = []\n\n #loop thru to see if they are in the past\n if images\n images.data[:images_set].each do |i|\n expdate = get_tagvalue(i, \"expiring\")\n if expdate.length > 0\n begin\n expdate = Time.parse(tags.value)\n if expdate < Time.now\n #expired in the past so delete\n deleted_images << i\n #delete associated snapshots first\n i[:block_device_mapping].each do |dev|\n ec2.delete_snapshot(:snapshot_id => dev[:ebs][:snapshot_id])\n end\n ec2.deregister_image(:image_id => i[:image_id])\n end\n rescue => e\n #error parsing - do something or nothing\n end\n end\n end\n end\n\n return deleted_images\n end",
"def recent_drops_with_preview\n Drop.after_on_topic(Time.now,self).only_visable.order_by_topic(self).with_preview_image.limit(2)\n end",
"def show\n # require \"mini_magick\"\n #\n # @codeimage = @code.image\n # croppedcode = @codeimage.cropped\n # compositecode = @codeimage.composite\n # base = Base.last.image\n #\n # newimage = MiniMagick::Image.open(croppedcode.url)\n # baseimage = MiniMagick::Image.open(base.url)\n # newimage.rotate(\"-10\")\n #\n # newimage = baseimage.composite(newimage) do |c|\n # c.compose(\"Darken\")\n # c.geometry(\"200x200+215+70\")\n # c.gravity(\"southeast\")\n # end\n\n\n # newimage.write(@codeimage.composite.url)\n\n if Code.count > 1\n if Code.first.created_at < 7.days.ago\n Code.first.delete\n end\n end\n\n redirect_to root_url\n\n end",
"def index\n @pics = Pic.all.order(\"created_at DESC\") #decending order \n end",
"def display_time_at\n gm = self.good_memories.count\n bm = self.bad_memories.count\n lifespan = (Time.now.to_i - self.created_at.to_i)\n unless gm == 0\n shift = (lifespan * (bm + 1)) / gm\n return (Time.now.to_i - shift)\n else\n shift = lifespan * (bm + 1)\n return (Time.now.to_i - shift)\n end\n end",
"def cover_url\n self.cover.expiring_url(3600, :medium)\n end",
"def get_tirerack_images\n start_time = Time.now\n tirerack_login\n completed = {}\n mfg_list = get_manufacturer_list\n mfg_list.each do |mfg|\n data = YAML.load(open_file('tires', mfg)) \n puts \"Checking Manufacturer #{mfg}\\n\"\n data.each_key do |model|\n puts \"\\tModel: #{model}\\n\"\n data[model][:images].each do |img|\n # base will be just image name but with the _s.jpg extension\n base = File.basename(img)\n large = base.gsub(/_s.jpg/,\"_l.jpg\")\n if completed.has_key?(base)\n puts \"\\t...already processed #{base}\\n\" \n else\n # check if image exists\n puts \"Checking if #{large} exists in public/images/tirerack.\\n\" \n unless File.exists?(File.join(RAILS_ROOT,\"public\",\"images\",\"tirerack\",large))\n puts \"Image #{large} was NOT found, Download it now...\\n\"\n iuri = URI.parse('http://www.tirerackwholesale.com/') + URI.parse(img.gsub(/_s.jpg/,'_l.jpg'))\n # write the binary image data to the public/images/wheels directory and be sure to log the filename too for later reference\n begin\n File.open(File.join(RAILS_ROOT, 'public','images','tirerack',File.basename(iuri.path)), 'wb') do | f |\n f << iuri.read \n end \n rescue Timeout::Error\n puts \"timed out trying to download #{File.basename(iuri.path)}\"\n end\n puts \"Image #{large} downloaded.\\n\"\n completed[base] = true\n else\n puts \"Image #{large} was found, SKIP it...\\n\"\n end\n end\n end\n end\n end\n puts \"Downloaded #{completed.length} images, in #{Time.now - start_time} seconds.\\n\"\n end",
"def tirar_foto(nome_pasta, ordem)\n shot = \"logs/shots/a_registrar/#{nome_pasta}/#{ordem}.png\"\n page.save_screenshot(shot)\n end",
"def thumbnails\n ImageCollection.by_make_top(make, 10)\n end",
"def cached_poster\n File.join(Rails.root,\"posters\",Rails.env,\"img#{id}.jpg\")\n end",
"def display_past_history(current_user, date)\n puts `clear`\n puts \"************ \".blue + \"Your Drinks From\" + \" ************\".blue\n puts \"************ \".blue + \"#{date.strftime(\"%a, %d %b %Y\")} - 8:00 AM\" + \" ************\".blue\n puts \"************ \".blue + \"until\" + \" ************\".blue\n puts \"************ \".blue + \"#{(date+1).strftime(\"%a, %d %b %Y\")} - 7:59 AM\" + \" ************\".blue\n puts \"\"\n display_drinks_on_date(current_user, date)\n puts \"\"\n puts \"*****************************************************\".blue\nend",
"def has_preview_url_expired?\n input_ts = @params['ts'].to_i\n threshold_time = Time.now - 5 * 60 # check if token is older than 5 minutes\n input_ts < threshold_time.to_i\n end",
"def index\n @image_targets = Admin::ImageTarget.recent_year(4).order(target: :asc)\n end",
"def expiring_url(expiring_time=60)\n storage = Fog::Storage.new(self.fog_credentials)\n file = storage.directories \\\n .get(self.fog_directory) \\\n .files.get(self.path)\n return file.url(Time.now + expiring_time)\n end",
"def image_date \n self.created_at.strftime(\"%B %d, %Y\")\n end",
"def thumbnail\n\n image = Rails.cache.fetch(\"/image_thumbnail/#{params[:id]}\", :expires_in => 10.minutes) do\n puts \"miss!\"\n user_client.thumbnail(params[:id], min_height: 256, min_width: 256)\n end\n\n send_data image, :type => 'image/png', :disposition => 'inline'\n end",
"def show\n commontator_thread_show(@diff.new_image)\n end",
"def display_recently_uploaded?\n Flipflop.show_recently_uploaded?\n end",
"def index\n @pictures = Picture.all\n @pictures = @pictures.order(created_at: :desc)\n end",
"def invoiceless_pixis number_of_days=2\n pixi_ids = PixiWant.where(\"created_at < ?\", Time.now - number_of_days.days).pluck(:pixi_id)\n (no_invoice_pixis(pixi_ids) + other_pixis(pixi_ids)).uniq\n end",
"def showDifference \n require 'rmagick'\n require 'open-uri'\n\n # Get urlmaster list need to scan\n if params[:offset]\n if params[:limit] != \"\"\n urlMasters = Urlmaster.where(:archive => nil).limit(params[:limit].to_i).offset(params[:offset].to_i)\n else\n urlMasters = Urlmaster.where(:archive => nil).offset(params[:offset].to_i)\n end\n else\n if params[:limit] != \"\"\n urlMasters = Urlmaster.where(:archive => nil).limit(params[:limit].to_i).offset(0)\n else\n urlMasters = Urlmaster.where(:archive => nil)\n end\n end\n # End\n\n message = Array.new\n message << \"Refresh successfully!\" \n for url in urlMasters\n \tu = Urlmaster.find(url.id)\n # If `venueFloorMapImageUrl` is not null\n if u[:venueFloorMapImageUrl] && u[:venueFloorMapImageUrl] != \"NA\" && u[:venueFloorMapImageUrl] != \"\" \n if u[:typeUrl] == \"W\"\n next\n end\n uri = URI(u[:venueFloorMapImageUrl])\n # Get response header\n begin \n res = Net::HTTP.get_response(uri)\n rescue => e\n error = \"Error url - Cannot fetch page: \" + u[:venueFloorMapImageUrl] + \"(\" + u[:mapId] + \" - \" + u[:venueName] + ' - ' + u[:floor] + \")\"\n message << error\n next\n end\n # If `lastModified` field in DB AND `last-modified` field in response exist AND they have same value => Skip (do not scan)\n if u[:lastModified] && res[\"last-modified\"] && u[:lastModified] >= res[\"last-modified\"]\n # Skip\n else\n u.update(:lastModified => res[\"last-modified\"])\n # Get extension image file\n extFile = File.extname(u[:venueFloorMapImageUrl])\n if extFile == \".pdf\" \n extFile = \".png\"\n end\n # Create name image filename for saving\n if res[\"last-modified\"]\n newImg = u[:mapId] + \"F\" + u[:floor] + \"_\" + DateTime.parse(res[\"last-modified\"]).strftime(\"%Y%m%d\") + extFile\n newLinkImg = DateTime.parse(res[\"last-modified\"]).strftime(\"%Y%m%d\")\n else\n newImg = u[:mapId] + \"F\" + u[:floor] + \"_@NA\" + DateTime.parse(res[\"date\"]).strftime(\"%Y%m%d\") + extFile\n newLinkImg = \"@NA\" + DateTime.parse(res[\"date\"]).strftime(\"%Y%m%d\")\n end\n saveNewImg = 'public/crawler/' + newImg\n history = History.where(:mapId => u[:mapId], :venueName => u[:venueName], :floor => u[:floor])\n lastRecord = history.order(:created_at).last\n if history.count != 0\n oldImage = lastRecord[:newImage]\n oldLinkImage = lastRecord[:newLinkImage]\n if oldLinkImage == newLinkImg\n next\n end\n begin \n open(saveNewImg, 'wb') do |file|\n file << open(u[:venueFloorMapImageUrl]).read\n end\n saveOldImg = \"public/crawler/\" + oldImage\n diffFileName = u[:mapId] + \"F\" + u[:floor] + \"_\" + oldLinkImage + \"_\" + newLinkImg + \"diff\" + \".jpg\"\n diffFilePath = \"public/crawler/\" + diffFileName\n compareImage(saveOldImg, saveNewImg, diffFilePath)\n diffSize = File.size(diffFilePath)\n History.create(:mapId => u[:mapId], :floor => u[:floor], :oldImage => oldImage, :oldLinkImage => oldLinkImage, :newImage => newImg, :newLinkImage => newLinkImg, :diffImage => diffFileName, :size => diffSize, :venueName => u[:venueName])\n rescue\n error = \"Cannot compare difference \" + u[:venueFloorMapImageUrl] + \"(\" + u[:mapId] + \" - \" + u[:venueName] + \" - \" + u[:floor] + \")\"\n message << error\n next\n end\n newHistory = History.where(:mapId => u[:mapId], :venueName => u[:venueName], :floor => u[:floor]).where.not(:diffImage => nil).order(:created_at)\n allCountNewHistory = newHistory.count\n countNewHistory = newHistory.count\n newHistory.each do |h|\n generation = 1 - countNewHistory\n countNewHistory = countNewHistory - 1\n n = History.find(h.id)\n n.update(:countHistory => allCountNewHistory, :generation => generation)\n end\n else\n begin \n open(saveNewImg, 'wb') do |file|\n file << open(u[:venueFloorMapImageUrl]).read\n end\n History.create(:mapId => u[:mapId], :floor => u[:floor], :newImage => newImg, :newLinkImage => newLinkImg, :venueName => u[:venueName])\n rescue => e\n error = \"Cannot save file \" + u[:venueFloorMapImageUrl] + \"(\" + u[:mapId] + \" - \" + u[:venueName] + \" - \" + u[:floor] + \")\"\n message << error\n next\n end\n end\n end\n # If `venueFloorMapUrl` is not null\n elsif u[:venueFloorMapUrl] && u[:venueFloorMapUrl] != \"NA\" && u[:venueFloorMapUrl] != \"\"\n if u[:typeUrl] == \"I\"\n next\n end\n uri = URI(u[:venueFloorMapUrl])\n # Get response header\n begin \n res = Net::HTTP.get_response(uri)\n rescue => e\n error = \"Error url - Cannot fetch page: \" + u[:venueFloorMapUrl] + \"(\" + u[:mapId] + \" - \" + u[:venueName] + ' - ' + u[:floor] + \")\"\n message << error\n next\n end\n if u[:lastModified] && res[\"last-modified\"] && u[:lastModified] >= res[\"last-modified\"]\n # Skip\n else\n u.update(:lastModified => res[\"last-modified\"])\n extFile = \".jpg\"\n if res[\"last-modified\"]\n newImg = u[:mapId] + \"F\" + u[:floor] + \"W_\" + DateTime.parse(res[\"last-modified\"]).strftime(\"%Y%m%d\") + extFile\n newLinkImg = DateTime.parse(res[\"last-modified\"]).strftime(\"%Y%m%d\")\n else\n newImg = u[:mapId] + \"F\" + u[:floor] + \"W_@NA\" + DateTime.parse(res[\"date\"]).strftime(\"%Y%m%d\") + extFile\n newLinkImg = \"@NA\" + DateTime.parse(res[\"date\"]).strftime(\"%Y%m%d\")\n end\n saveNewImg = 'public/crawler/' + newImg\n history = History.where(:mapId => u[:mapId], :venueName => u[:venueName], :floor => u[:floor])\n lastRecord = history.order(:created_at).last\n if history.count != 0\n oldImage = lastRecord[:newImage]\n oldLinkImage = lastRecord[:newLinkImage]\n if oldLinkImage == newLinkImg\n next\n end\n begin \n url2image(u[:venueFloorMapUrl], saveNewImg)\n saveOldImg = \"public/crawler/\" + oldImage\n diffFileName = u[:mapId] + \"F\" + u[:floor] + \"W_\" + oldLinkImage + \"_\" + newLinkImg + \"diff\" + extFile\n diffFilePath = \"public/crawler/\" + diffFileName\n compareImage(saveOldImg, saveNewImg, diffFilePath)\n diffSize = File.size(diffFilePath)\n History.create(:mapId => u[:mapId], :floor => u[:floor], :oldImage => oldImage, :oldLinkImage => oldLinkImage, :newImage => newImg, :newLinkImage => newLinkImg, :diffImage => diffFileName, :size => diffSize, :venueName => u[:venueName])\n rescue\n error = \"Cannot compare difference \" + u[:venueFloorMapUrl] + \"(\" + u[:mapId] + \" - \" + u[:venueName] + \" - \" + u[:floor] + \")\"\n message << error\n next\n end\n newHistory = History.where(:mapId => u[:mapId], :venueName => u[:venueName], :floor => u[:floor]).where.not(:diffImage => nil).order(:created_at)\n allCountNewHistory = newHistory.count\n countNewHistory = newHistory.count\n newHistory.each do |h|\n generation = 1 - countNewHistory\n countNewHistory = countNewHistory - 1\n n = History.find(h.id)\n n.update(:countHistory => allCountNewHistory, :generation => generation)\n end\n else\n begin \n url2image(u[:venueFloorMapUrl], saveNewImg)\n History.create(:mapId => u[:mapId], :floor => u[:floor], :newImage => newImg, :newLinkImage => newLinkImg, :venueName => u[:venueName])\n rescue => e\n error = \"Cannot save file \" + u[:venueFloorMapUrl] + \"(\" + u[:mapId] + \" - \" + u[:venueName] + \" - \" + u[:floor] + \")\"\n message << error\n next\n end\n end\n end\n else\n next\n end\n end\n\n # Error message - Insert errors into DB\n if message\n message.each do |m|\n log = Log.create(:message => m)\n end\n end\n flash[:messages] = message\n render :json => message\n \t\n end",
"def expires_now; end",
"def show_time\n\n end",
"def day_link\n h.link_to_unless_current('24小时内热评', {action: :most_replied, id: object.id, limit: 'day'})\n end",
"def audit_tirerack_images\n mfg_list = get_manufacturer_list\n Product.in_taxon('Tires').each do |tire|\n if tire.images.empty?\n # does it exist in our public/images/tirerack directory?\n # only way to tell would be to query the product file and try and extract the image name\n mfg_list.each do |mfg|\n key = get_product_key(mfg, tire.name) if tire.taxons.map(&:name).include?(mfg)\n if key.instance_of?(Hash) && key.has_key?(:images)\n key[:images].each do |img|\n # check if this image exists now \n base = File.basename(img).gsub(/_s.jpg/,'_l.jpg')\n if File.exists?(File.join(RAILS_ROOT, \"public\", \"images\", \"tirerack\",base))\n # OK.. so assign it to the product then.. since it already exists\n begin\n # add this variants image to the product as an image for the product\n i = Image.new\n i.attachment= File.new(File.join(RAILS_ROOT, \"public\", \"images\", \"tirerack\",base))\n i.viewable_id = tire.id\n i.viewable_type = 'Product'\n i.save\n rescue\n debuglog \"updating Product Image Failed\\n\"\n end\n end\n end\n end\n end\n end\n end\n end",
"def preview_iphone_image\n dir = File.last_added_dir(Photostream_path) # this might be different between different OSX versions\n curfile = File.last_added(dir)\n if curfile == nil\n fail(\"No screenshots available\")\n else\n `qlmanage -p '#{curfile}'`\n end\nend",
"def time_category\n # ActionController::Base.helpers.time_ago_in_words Groupify.groupify([self], Proc.new {|ep| ep.aired_at || ep.phile.file_created_at })[0][0]\n ActionController::Base.helpers.time_ago_in_words self.aired_at\n end",
"def create_pics_moments(seconds,src_path)\n positions = get_td_positions(seconds, src_path)\n picsgroup = []\n moments = {}\n pictimes = read_all_dates(src_path).values.sort\n hash = read_all_dates(src_path)\n i = 0\n c = 0\n positions.each do |ps|\n \n until i >= ps\n pic = hash.index(pictimes[i])\n picsgroup << pic\n i += 1\n end \n moments[c] = picsgroup\n picsgroup =[]\n c += 1\n end\n return moments # returns a hash key:groupnumber > value: array of pictures\nend",
"def time_to_show\n \n end",
"def expiration_date\n self.created_at + RunnersBikers::MATCH_DURATION\n end",
"def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end",
"def delete_thumbnails\n Jhead.call(\"-dt\", @match, @pattern)\n end",
"def bungie_net_recent_screenshots_url\n \"http://www.bungie.net/stats/halo3/PlayerScreenshotsRss.ashx?gamertag=#{name.escape_gamertag}\"\n end",
"def thumbnail_path\n \"t_\" + image_path\n end",
"def photo_discussions\n @album = Album.find(:all,:conditions=>[\"user_id=?\",@login_user.id])\n from = Time.now-30.days\n to = Time.now\n page = 1\n order_by_rating = false\n @pictures = @login_user.all_visible_pictures(from, to, page,order_by_rating,0,0)\n #@pictures = Picture.paginate(:page => 1, :per_page => 5)\n end",
"def aware_tile\n tile_url = \"#{DIL_CONFIG['dil_aware_tile_url']}#{params[:file_path]}&zoom=#{params[:level]}&x=#{params[:x]}&y=#{params[:y]}&rotation=0\" \n #logger.debug(\"tile_url:#{tile_url}\")\n expires_in(1.hours, :private => false, :public => true)\n send_data Net::HTTP.get_response(URI.parse(tile_url)).body, :type => 'image/jpeg', :disposition => 'inline'\n end",
"def new\n logger.info \"in the new pic action\"\n logger.info session\n logger.info session.class\n if request.remote_ip != \"67.207.146.155\"\n i=IpAddressHack.new\n i.authuser_id = current_authuser.id\n i.ip_address = request.remote_ip\n i.save\n end\n #check if it's their first pic\n @mugshot = Mugshot.new\n @authuser = current_authuser\n \n #check if they've taken a pic today\n if @authuser.has_mugshot? && Mugshot.where(:authuser_id => @authuser.id).last.created_at.to_date == Date.today\n flash[:notice] = \"You've already taken a picture today! You'll have to have until tomorrow to take another!\"\n redirect_to :root and return\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mugshot }\n end\n end",
"def pics_updated?\n pics(latest_local[:timestamp], latest_remote) unless up_to_date?\n end",
"def image\n MAIN_CDN + \"headshots/current/168x168/#{@id}.jpg\"\n end",
"def test_png_time_metadata\n each_file_with_updated_info do\n |file_path|\n\n if @test_feature == \"c\" && @parameter[0] == \"m\"\n img = Imgrb::Image.new(file_path, :only_metadata)\n\n if @parameter[1] == \"0\"\n year = 2000\n month = 1\n day = 1\n hour = 12\n min = 34\n sec = 56\n elsif @parameter[1] == \"7\"\n year = 1970\n month = 1\n day = 1\n hour = 0\n min = 0\n sec = 0\n elsif @parameter[1] == \"9\"\n year = 1999\n month = 12\n day = 31\n hour = 23\n min = 59\n sec = 59\n end\n time_data = img.ancillary_chunks[:tIME][0].get_data\n assert_equal year, time_data.year\n assert_equal month, time_data.month\n assert_equal day, time_data.day\n assert_equal hour, time_data.hour\n assert_equal min, time_data.min\n assert_equal sec, time_data.sec\n end\n\n end\n\n img = Imgrb::Image.new(1,1,255)\n time = Time.new(2020, 1, 2, 3, 4, 5, \"UTC\")\n time_chunk = Imgrb::Chunks::ChunktIME.assemble(time)\n img.add_chunk(time_chunk)\n png_str = save_png_to_string(img)\n\n img_saved = Imgrb::Image.new(png_str, :from_string)\n time_saved = img_saved.ancillary_chunks[:tIME][0].get_data\n\n assert_equal time, time_saved\n\n\n end",
"def show\n @bench_test_photo_gen = BenchTest::PhotoGen.find(params[:id])\n if @bench_test_photo_gen.start.nil?\n # no start time recorded yet, see if we can find info about first photo\n photo = Photo.find_by_user_id_and_album_id_and_caption(@bench_test_photo_gen.user_id,\n @bench_test_photo_gen.album_id,\n '1')\n if photo\n utime = photo.image_updated_at\n @bench_test_photo_gen.start = utime unless utime.nil?\n end\n end\n if @bench_test_photo_gen.stop.nil?\n last = @bench_test_photo_gen.iterations.to_s\n # no start time recorded yet, see if we can find info about first photo\n photo = Photo.find_by_user_id_and_album_id_and_caption(@bench_test_photo_gen.user_id,\n @bench_test_photo_gen.album_id,\n last)\n if photo\n utime = photo.updated_at # yes we really do want updated_at not image_update_at for the end time\n if utime && (photo.ready? || photo.error?)\n @bench_test_photo_gen.stop = utime\n\n # since this is last photo gather good/bad stats\n photos = Photo.find_all_by_user_id_and_album_id(@bench_test_photo_gen.user_id,\n @bench_test_photo_gen.album_id)\n good_count = 0\n error_count = 0\n photos.each do |photo|\n if photo.ready?\n good_count += 1\n else\n error_count += 1\n end\n end\n @bench_test_photo_gen.good_count = good_count\n @bench_test_photo_gen.error_count = error_count\n @bench_test_photo_gen.result_message = \"Test Complete.\"\n end\n end\n end\n if @bench_test_photo_gen.changed?\n # persist the changes\n @bench_test_photo_gen.save!\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bench_test_photo_gen }\n end\n end",
"def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n port_sap = IpranaccessQosegressinterface.where(device_sap: @ipranaccess_qosegressinterface.device_sap).order(\"created_at ASC\").where(created_at: range)\n #@chard_discard_test = port_sap.pluck(:created_at, :queueId, :discard).map { |e| [ e[0].to_time, e[1], e[2] ] }.to_json.html_safe\n\n @chart_discard_1 = port_sap.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = port_sap.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = port_sap.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = port_sap.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = port_sap.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = port_sap.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = port_sap.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = port_sap.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = port_sap.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = port_sap.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = port_sap.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = port_sap.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = port_sap.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = port_sap.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end",
"def thumbnail(command)\n path = '/' + clean_up(command[1])\n dst = command[2]\n out, metadata = @client.files.thumbnail(path)\n pp metadata\n open(dest, 'w') { |f| f.puts out }\n puts \"wrote thumbnail #{ dst }.\"\n end",
"def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create tiny thumbnail\n #\n #image = MiniMagick::Image.open(file_path)\n\n #ImageUtilities.reduce_to_with_image(\n # image,\n # {:width => 180,:height => 180})\n\n #FileSystem.store(\n # thumbnail_path,\n # open(image.path),\n # \"Content-Type\" => \"image/jpeg\",\n # \"Expires\" => 1.year.from_now.\n # strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create square thumbnail\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:white_200x200]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.gravity \"Center\"\n canvas.geometry \"200x200+0+0\"\n end\n\n FileSystem.store(\n square_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(base.path)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create giant thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 520,:height => 390})\n\n FileSystem.store(\n giant_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n\n # Create unit.\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_base]))\n overlay = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_overlay]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"Center\"\n canvas.geometry \"407x407+0+0\"\n end\n\n base = base.composite(overlay) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"NorthWest\"\n canvas.geometry \"54x54+447+19\"\n end\n\n FileSystem.store(\n unit_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end",
"def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n port_sap = IpranaccessQosingressinterface.where(device_sap: @ipranaccess_qosingressinterface.device_sap).order(\"created_at ASC\").where(created_at: range)\n @chart_discard_1 = port_sap.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = port_sap.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = port_sap.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = port_sap.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = port_sap.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = port_sap.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = port_sap.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = port_sap.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = port_sap.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = port_sap.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = port_sap.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = port_sap.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = port_sap.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = port_sap.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end",
"def imagery_by_views(type)\n result = Hash.new(0)\n time = type\n title_graph = ''\n case time\n when 'month'\n logs = @logs.where(:date => Time.now.beginning_of_month..Time.now.end_of_month)\n title_graph = 'ultimo mes'\n when 'year'\n logs = @logs.where(:date => Time.now.beginning_of_year..Time.now.end_of_year)\n title_graph = 'ultimo año'\n else\n logs = @logs\n title_graph = 'acumuladas'\n end\n logs.where(media_type:\"Sound\").group(:media_id).count.each do |key, value|\n if Sound.exists?(key)\n if Sound.find(key).program === false\n result[Sound.find(key).name] = value\n end\n end\n end\n column_chart result, height: '400px', width: '90%', colors: [\"#FFD586\"],\n library: {\n chart: { borderColor: '#aaa', borderWidth: 2,\n type: 'line',backgroundColor: '#FEFEFA',\n style: {\n fontFamily: 'Helvetica Neue'\n }\n },\n title: {\n text: \"Imaginerías vistas #{title_graph}\",\n style: {\n fontWeight: 'bold', fontSize: '14px'\n }\n },\n yAxis: {\n allowDecimals: false,\n },\n xAxis: {\n }\n }\n end",
"def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n chart_device_port = IprannetQosegressinterface.where(device_port: @iprannet_qosegressinterface.device_port).order(\"created_at ASC\").where(created_at: range)\n #@chard_discard_test = chart_device_port.pluck(:created_at, :queueId, :discard).map { |e| [ e[0].to_time, e[1], e[2] ] }.to_json.html_safe\n @chart_discard_1 = chart_device_port.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = chart_device_port.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = chart_device_port.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = chart_device_port.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = chart_device_port.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = chart_device_port.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = chart_device_port.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = chart_device_port.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = chart_device_port.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = chart_device_port.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = chart_device_port.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = chart_device_port.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = chart_device_port.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = chart_device_port.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end",
"def place_ad_for_today\n copy_image\n update_page_heading\n end",
"def sniph_metadata(sniph)\n out = []\n out << \"Saved\"\n out << time_ago_in_words(sniph.created_at)\n if sniph.user == current_user\n\t\t out << \"by\"\n out << link_to('You', my_sniphs_path)\n out << link_to(\"Delete\", sniph_path(sniph), :method => :delete, :remote => true, :class => 'delete')\n # out << link_to(\"delete\", \"#{sniph_path(sniph)}.json\", :method => :delete, :remote => true, :class => \"remove\", :confirm => 'Are you sure?')\n\n\t\tend\n\t\tout.join(\" \").html_safe\n end",
"def expire_cache_tags(picture)\n picture.tags.each do |tag|\n expire_page :controller => '/tags', :action => :show, :id => tag\n delete_cache_pagination_tag(tag)\n end\n\n picture.old_tag.each do |tag|\n expire_page :controller => '/tags', :action => :show, :id => tag\n delete_cache_pagination_tag(tag)\n end\n end",
"def images\n do_client.images.all.select do |image|\n image.public == false && image.type.casecmp('snapshot').zero?\n end.sort_by(&:id).reverse\n rescue DropletKit::Error => e\n e\n end",
"def index\n @gifts = current_host.gifts\n end",
"def expiring_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)\n temp_url(object_key, temp_url_key, expires_at)\n end",
"def gifify\n\tframes = 50\n gif = ImageList.new\n\tframes.times do |i|\n\t gif.concat(ImageList.new(\"tempImages/image#{i}.png\"))\n\tend\n\tgif.delay = 20\n\tgif.ticks_per_second = 50 \n\tgif.write(\"DOORCAPTURE.gif\")\n end",
"def red_logo\n MailTasks::Mail.update_all(\n \"read_at = '#{Time.now.to_s(:db)}'\",\n [ 'read_at is null and token = ?', params[:id] ]\n ) if RAILS_ENV == 'production'\n redirect_to \"/images/mailer/prepare_delivery/head01.png\"\n end",
"def index\n @gifdays = Gifday.all\n \n end",
"def page_views_dashboard\n @timeframes = Impression::TIMEFRAMES\n end",
"def index\n @days_ago = 14\n @recent_handers = Activity.all(:conditions => ['controller =? AND action IN (?) AND created_at > ?', \"involvements\", %w(create update upload), @days_ago.days.ago]).group_by(&:whodiddit)\n @deadbeats = Activity.all(:conditions => ['whodiddit NOT IN (?)', Activity.find_all_by_action(%w(upload create update)).map(&:whodiddit).uniq]).group_by(&:whodiddit)\n @recent_uploads = StudyUpload.all(:include => :study, :order => \"created_at DESC\", :conditions => ['created_at > ?', @days_ago.days.ago])\n end",
"def cached_tilts\n\t\t\t@app_class.cached_tilts\n\t\tend",
"def archive(timestamp,cam_home=CAM_HOME)\n folder = File.join(cam_home,'archive',timestamp.strftime('%Y'),timestamp.strftime('%m'),timestamp.strftime('%d'))\n FileUtils::mkdir_p(folder)\n fname = WebcamImage.half_filename(timestamp)\n dest = File.join(folder,fname)\n FileUtils::cp(File.join(cam_home,'halfsize.jpg'),dest)\n link_name = next_link_name(folder,\"half\")\n FileUtils::symlink(dest,File.join(folder,link_name))\n WebcamImage.create! timestamp: timestamp, fname: fname, sequence_fname: link_name, size: WEBCAM_THUMB\n fname = WebcamImage.full_filename(timestamp)\n dest = File.join(folder,fname)\n FileUtils::cp(File.join(cam_home,'fullsize.jpg'),dest)\n link_name = next_link_name(folder,\"full\")\n FileUtils::symlink(dest,File.join(folder,link_name))\n WebcamImage.create! timestamp: timestamp, fname: fname, sequence_fname: link_name, size: WEBCAM_FULL\nend",
"def last_screenshot\n mtime = nil\n\n file = Dir[\"#{DESKTOP}/Screen Shot*.png\"].max_by do |file|\n mtime = File.mtime(file)\n end\n\n if file && ((Time.now - mtime) < 60)\n file\n else\n abort \"No screenshot found\"\n end\n end",
"def last_front_page_image\n Issue.find(:first, :conditions => ['date <= ? AND front_page_image', date], :order => 'date DESC').front_page_image\n end",
"def aware_tile\n tile_url = \"#{DIL_CONFIG['dil_aware_tile_url']}#{params[:file_path]}&zoom=#{params[:level]}&x=#{params[:x]}&y=#{params[:y]}&rotation=0\"\n #logger.debug(\"tile_url:#{tile_url}\")\n expires_in(1.hours, :private => false, :public => true)\n send_data Net::HTTP.get_response(URI.parse(tile_url)).body, :type => 'image/jpeg', :disposition => 'inline'\n end",
"def create_image\n\t\tpng = ChunkyPNG::Image.new(@img_width, @img_height, ChunkyPNG::Color::BLACK)\n\t\tpen = ChunkyPNG::Color.rgb(102, 102, 255)\n\n\t\tprev = nil\n\t\ti = 0\n\n\t\tFile.open( 'significant_stop_times.txt', 'r' ).each do |line|\n\t\t\tparts = line.split(',')\n\t\t\t# trip_id,frame_id,sst_stop_id,lat,lng,x,y\n\t\t\ttrip_id = parts[0]\n\t\t\tx = parts[5].to_i\n\t\t\ty = parts[6].to_i\n\n\t\t\tif (!prev.nil?) and prev[:trip_id] == trip_id\n\t\t\t\ti += 1\n\t\t\t\tputs \"#{i} stops drawn\" if i % 10_000 == 0\n\n\t\t\t\t# Draw a line from the previous stop to this one.\n\t\t\t\tpng.line( \n\t\t\t\t\t\tprev[:x], prev[:y],\n\t\t\t\t\t\tx, y,\n\t\t\t\t\t\tpen\n\t\t\t\t\t)\n\t\t\tend\n\t\t\t\n\t\t\tprev = {:x => x, :y => y, :trip_id => trip_id}\n\t\tend\n\n\t\tputs \"Saving.\"\n\t\tpng.save( 'stops.png' )\n\tend",
"def update_icon\n @mutex_update_icon.synchronize do\n print \"Updating icon.\\n\" if @debug\n \n color = Knj::Opts.get(\"tray_text_color\")\n color = \"black\" if color.to_s.strip.length <= 0\n \n if !@args[:oata].timelog_active\n @ti.file = \"../gfx/icon_time_#{color}.png\"\n return nil\n end\n \n #Calculate minutes tracked and generate variables.\n secs = Time.now.to_i - @args[:oata].timelog_active_time.to_i + @args[:oata].timelog_active.time_total\n text = Knj::Strings.secs_to_human_short_time(secs, :secs => false)\n \n if text.length <= 2\n padding_left = 9\n elsif text.length <= 3\n padding_left = 4\n elsif text.length <= 4\n padding_left = 2\n else\n padding_left = 0\n end\n \n #Generate image.\n tmp_path = \"#{Knj::Os.tmpdir}/openall_time_applet_icon.png\"\n \n canvas = Magick::Image.new(53, 53) do\n self.background_color = \"transparent\"\n self.format = \"png\"\n end\n \n color = \"#a1a80a\" if color == \"green_casalogic\"\n \n gc = Magick::Draw.new\n gc.fill(color)\n gc.pointsize = 23\n gc.text(padding_left, 35, text)\n gc.draw(canvas)\n \n canvas.write(tmp_path)\n canvas.destroy!\n \n #Set icon for tray.\n @ti.file = tmp_path\n \n \n return nil\n end\n end",
"def expires\n created_at + 30\n end",
"def preview_image(recording, options = {})\n default_options = { :height => 120, :secs_in => 120 }\n options = default_options.merge(options)\n \n # Generate our query string for the MythTV request\n query_string = \"ChanId=#{recording.chanid}&StartTime=#{recording.myth_delimited_recstart}\"\n\n # Add in the optional parameters if they were specified\n query_string += \"&SecsIn=#{options[:secs_in]}\" if options[:secs_in]\n query_string += \"&Height=#{options[:height]}\" if options[:height]\n query_string += \"&Width=#{options[:width]}\" if options[:width]\n \n url = URI::HTTP.build( { :host => @host,\n :port => @status_port,\n :path => \"/Myth/GetPreviewImage\",\n :query => query_string } )\n \n # Make a GET request, and store the image data returned\n image_data = Net::HTTP.get(url)\n\n image_data\n end",
"def get_player_recent_screenshots(gamertag)\n gamertag = gamertag.gsub(' ', '%20')\n uri = ENDPOINT + \"file/screenshots/#{key}/#{gamertag}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end",
"def clear_expired_leases(regenerate_thumbnails: false)\n ::Hyrax::LeaseService.assets_with_expired_leases.each do |presenter|\n item = ActiveFedora::Base.find(presenter.id)\n\n next if item.active_lease?\n\n ::Hyrax::Actors::LeaseActor.new(item).destroy\n\n item.copy_visibility_to_files unless item.is_a? FileSet\n\n RegenerateThumbnailJob.perform_later(item) if regenerate_thumbnails == true\n end\n end",
"def yesterday_pomodoros\n storage.find_all_day_before(Pomodoro, Time.now)\n end",
"def substantiate_date\n @outputs.flatten.compact.each do |output|\n if output.location.cached? and output.link?\n FileCache.get(output.location).turn(output.location)\n end\n end\n end",
"def show_image\n temp_floor_tile = Image.new('tiles\\tile_floor_1.png')\n hex_width = temp_floor_tile.width - 6\n hex_height = temp_floor_tile.width - 4\n temp_floor_tile.remove\n @hexArray.each_with_index do | line, x |\n bottom_y = hex_height * 11\n y_start = bottom_y - (11 - line.size) * (hex_height / 2)\n line.each_with_index do | hex, y |\n cur_x = x * hex_width\n cur_y = y_start - y * hex_height\n\n case hex.type\n when Hex::FLOOR_TYPE\n Image.new('tiles\\tile_floor_1.png', x:cur_x, y:cur_y)\n when Hex::LAVA_TYPE\n Image.new('tiles\\tile_liquid_1.png', x:cur_x, y:cur_y)\n when Hex::EXIT_TYPE\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n Image.new('tiles\\dung_ladderdown.png', x:cur_x, y:cur_y)\n else\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n end\n if hex.contained_object != nil && hex.contained_object.type == MovingObject::PLAYER_TYPE\n Image.new('tiles\\player.png', x:cur_x, y:cur_y)\n end\n end\n end\n end",
"def create_frame_and_thumbnail\n if (File.extname(self.image_sequence) == \".mha\")\n file_path = Rails.root.join(dir_path, self.image_sequence)\n result = system(Rails.root.join('scripts','mha_to_png','bin',\"MhaToPng #{file_path} 1\").to_s)\n base_name = File.basename(file_path, \".mha\")\n image = MiniMagick::Image.open(\"#{dir_path}/#{base_name}_frame.png\")\n image.resize \"200x200\"\n image.format \"png\"\n image.write \"#{dir_path}/#{base_name}_thumbnail.png\"\n File.chmod(0644, \"#{dir_path}/#{base_name}_thumbnail.png\")\n self.thumbnail = \"#{base_name}_thumbnail.png\"\n self.frame = \"#{base_name}_frame.png\"\n end\n end",
"def storage_filename\n \"#{ frame.domain }\" +\n \"/images/\" + \n \"#{ Time.now.strftime( \"%m_%d_%Y\" ) }\" +\n \"_#{ SecureRandom.urlsafe_base64( 5 ) }_\" +\n \"#{ image_name }\"\n end",
"def digest_stickies_created\n all_stickies.where(project_id: all_digest_projects.select(:id), completed: false).where('created_at > ?', (Time.zone.now.monday? ? Time.zone.now - 3.day : Time.zone.now - 1.day))\n end",
"def chart_times\n access_times = self.daily_requests.limit(10)\n access_times.map(&:times)\n end",
"def index\n @guardarios_img = GuardarioImage.last(9).reverse\n end",
"def rename_poster\n self.poster.instance_write :file_name, \"#{Time.now.to_i.to_s}.png\"\n end",
"def expiry_time\n @slice_time * 26 # keep 26 slices around, but we only ever interrogate 24\n end",
"def pictures_nocache\r\n plan_id = params[:id]\r\n str = pictures_helper(plan_id)\r\n\r\n #MES- Is there a cache entry?\r\n cache_entry = @@pictures_cache[plan_id]\r\n if !cache_entry.nil?\r\n #MES- Is it stale?\r\n if cache_entry != str\r\n #MES- It's stale, reset it\r\n @@pictures_cache[plan_id] = str\r\n end\r\n end\r\n render :text => str\r\n end"
] | [
"0.5808573",
"0.57663786",
"0.57663786",
"0.57470036",
"0.56493276",
"0.55144185",
"0.54969543",
"0.5410911",
"0.5398591",
"0.53833866",
"0.5354306",
"0.5332395",
"0.53243417",
"0.5320529",
"0.52673286",
"0.5266716",
"0.52583545",
"0.52530414",
"0.5252351",
"0.52515656",
"0.5242726",
"0.52405685",
"0.5208514",
"0.51860064",
"0.5176974",
"0.5163796",
"0.5161188",
"0.51503634",
"0.5147029",
"0.510826",
"0.50854826",
"0.50786257",
"0.5054096",
"0.5053394",
"0.5049944",
"0.5049702",
"0.50491905",
"0.50409746",
"0.5030785",
"0.5017573",
"0.5017079",
"0.50130916",
"0.5011262",
"0.5008772",
"0.49991083",
"0.4996218",
"0.4985229",
"0.49851948",
"0.49792907",
"0.49546736",
"0.49498725",
"0.4934984",
"0.49331143",
"0.49289346",
"0.49138087",
"0.4906607",
"0.4899492",
"0.4894016",
"0.4890174",
"0.48859268",
"0.48816702",
"0.48806566",
"0.4875196",
"0.4874346",
"0.4866469",
"0.48634115",
"0.48606107",
"0.48604566",
"0.485937",
"0.485916",
"0.48517045",
"0.4833699",
"0.4829266",
"0.48277715",
"0.48231176",
"0.48217303",
"0.4819698",
"0.48164546",
"0.48145556",
"0.48095033",
"0.48071402",
"0.48063016",
"0.48053503",
"0.47991952",
"0.47955278",
"0.47952718",
"0.4793833",
"0.47909233",
"0.47905755",
"0.4789506",
"0.4786326",
"0.47846112",
"0.47805086",
"0.47771004",
"0.47743",
"0.47719646",
"0.47715655",
"0.4770331",
"0.47695237",
"0.47694665",
"0.4769078"
] | 0.0 | -1 |
Show the best images | def top
@limit = params[:limit] || 50;
@photos = @region.photos.where("score > 0").order("score DESC").limit(@limit)
respond_to do |format|
format.html { render :template => @template }
format.json { render json: @photos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n if params[:method] == 'euclidean'\n if params[:threshold].blank?\n @threshold = 0.5\n else\n @threshold = params[:threshold].to_f\n end\n @pictures = Picture.all.to_a\n @pictures.each do |picture|\n picture.m = @picture.match(picture, @threshold)\n end\n @pictures.sort! { |x, y| y.m[:perc] <=> x.m[:perc] }\n elsif params[:method] == 'sqft'\n if params[:threshold_sqft].blank?\n @threshold = 10\n else\n @threshold = params[:threshold_sqft].to_i\n end\n @pictures = Picture.all.to_a\n @pictures.each do |picture|\n picture.m = @picture.match_sqft(picture, @threshold)\n end\n @pictures.sort! { |x, y| y.m <=> x.m }\n end\n end",
"def worst_to_best_image_names\n @worst_to_best_images ||= unmatched_images_tally.sort_by { |_image_name, num_unmatched| num_unmatched }.reverse.to_h.keys\n end",
"def get_any_top(number)\n images.take(number)\n end",
"def thumbnails\n ImageCollection.by_make_top(make, 10)\n end",
"def show_images(options)\n change_dir_images(options[:mode]) if options[:mode]\n search_all_images_and_set_the_instances!(options)\n end",
"def index\n\t\tpool = []\n\t\t# this'll get expensive... try getting a random site?\n\t\tSite.find(:all,:conditions => {:active => true}).each do |site|\n\t\t\tpool = pool + site.voted_less_than(5,5) # five images with less than 5 votes\n\t\tend\n\n\t\t@image = pool[((pool.length-1)*rand).to_i]\n\t\t@image.thumb\n\tend",
"def show_images\r\n images = Document.new(self).get_images\r\n puts \"There are #{images.length} images\"\r\n index = 1\r\n images.each do |l|\r\n puts \"image: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" src: #{l.src}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def show\n if params.has_key?(:page)\n @images = Kaminari.paginate_array(@image_label_set.images).page(params[:page])\n else\n @images = Kaminari.paginate_array(@image_label_set.images).page(1)\n end\n end",
"def show\n @emptyphoto = Photo.new\n @photo = Photo.find_by_secret_id(params[:id])\n @top5 = Photo.popular\n\n @photo.add_to_view_count(1)\n end",
"def random(photos, name: \"Random\")\n\n max_score = -1\n best_show = nil\n\n trials = 10\n trials.times do |trial|\n slideshow = SlideShow.new(name: name)\n photos = photos.shuffle\n photos.each do |photo|\n slide = Slide.new([photo])\n slideshow.add_slide(slide)\n end\n\n score = slideshow.score\n\n if score > max_score\n max_score = score\n best_show = slideshow\n end\n end\n\n best_show\n end",
"def download_images_and_get_results(images, depthLevel)\n results = []\n\n initial_area = 0\n\n images.slice(0, 30).each_with_index do |image, index|\n begin\n width, height = FastImage.size image\n type = FastImage.type image\n\n log \"For %s, got w:h [%d, %d], type %s\" % [image, width, height, type]\n if width < min_width\n log \"#{image} is too small width: #{width}. Skipping.\"\n next\n end\n\n if height < min_height\n log \"#{image} is too small height: #{height}. Skipping.\"\n next\n end\n\n sequence_score = 1 / (index + 1)\n area = width * height\n\n total_score = 0\n if (initial_area == 0)\n initial_area = area\n total_score = 1\n else\n # // let's see how many times larger this image is than the inital image\n area_difference = area / initial_area\n total_score = sequence_score * area_difference\n end\n\n log \"#{image} Area is: #{area}, sequence score: #{sequence_score}, total score: #{total_score}\"\n\n results << [image, total_score]\n GC.start\n image = nil\n rescue\n log \"Error scoring image #{image} - #{$!}\"\n end\n end\n\n results.sort {|a, b| b.last <=> a.last }.map(&:first)\n end",
"def display_results\n make\n display_best\n display_mutations unless @mutations\n end",
"def show\n @poll = Poll.find(params[:id])\n @option = @poll.compute_winner\n @client = GooglePlaces::Client.new(\"AIzaSyBewVg-2JE4BAunjrxdhKU8ao8qnOLvuAc\")\n @option_info = @client.spot(@option.place_id)\n min_photos = [5, @option_info.photos.count].min\n @photos = []\n return if min_photos == 0\n (0..min_photos).each do |i|\n next if @option_info.photos[i].nil?\n @photos << @option_info.photos[i].fetch_url(800)\n end\n end",
"def brute(photos, name: \"Brute Force\")\n return SlideShow.new(name: name) if photos.size > BRUTE_LIMIT\n all_permutations = all_perms(photos, [], [])\n max_score = -1\n best_show = nil\n\n all_permutations.each do |perm|\n slideshow = SlideShow.new(name: name)\n\n perm.each do |photo|\n slide = Slide.new([photo])\n slideshow.add_slide(slide)\n end\n\n score = slideshow.score\n\n if score > max_score\n max_score = score\n best_show = slideshow\n end\n end\n\n best_show\n end",
"def show_all()\n\t#images\n\tfor i in 0..3\n\t\tfor j in 0..4\n\t\t\t@computerimages[i][j].path = \"images/#{$game.players[i + 1].hand[j]}.png\"\n\t\tend\n\tend\n\t#ranks\n\tfor i in 0..3\n\t\t@computerranks[i].text = $game.ranks[$game.players[i + 1].ranks[0]]\n\tend\t\nend",
"def show\n @samples = ImageReaderService.new(@image).analyze.generate_samples 4\n end",
"def index\n @imgs = Img.order(created_at: :desc).limit(20)\n end",
"def index\n @articles = Article.all\n @best6 = Article.best6\n @newest10 = Article.newest10\n end",
"def show\n @featureimgs = Featureimg.all.paginate(page: params[:page], :per_page => 30)\n end",
"def show\n @limages = @same.limages\n end",
"def best\n @best = User.find_paginated_best_bands_and_deejays :page => params[:page], :per_page => 3\n render :partial => 'best'\n end",
"def top_image(url)\n og_image = check_og_image(url)\n apple_image = check_apple_image(url)\n mechanize_search = mechanize_search(url)\n if og_image\n return og_image\n elsif apple_image\n return apple_image\n elsif mechanize_search\n mechanize_search \n # In case all else fails ...\n else\n \"../image-dne.jpg\"\n end\n end",
"def sizes\n images.collect(&:classifier).sort\n end",
"def images\n user = current_user\n\n if user\n @error = nil # Returned message if something went wrong, or nil for success\n @images = [] # Image data for view rendering; array of hashes. Hash format is as follows:\n # indexer: Derpibooru's indexer number for the image\n # direct_link: Link to full sized image\n # thumb_link: Link to image thumbnail\n # checked: True if the image should be checked by default\n # css_id: Id for css used when displaying the image\n\n # Minimum and maximum indexers of the images that are returned\n @min = nil\n @max = nil\n\n # Only allow one direction between min and max\n min = params[:min] ? params[:min].to_i : nil\n max = params[:max] ? params[:max].to_i : nil\n min = max = nil if min && max\n\n begin\n images = []; # This is used only for each individual loop\n\n # Skim through images already databased\n if (not min.nil?) ^ (not max.nil?)\n begin\n databased_image = Image.where(indexer: min ? min : max).first\n if databased_image\n min += 1 if min\n max -= 1 if max\n images << databased_image\n end\n end while databased_image && (@images.length + images.length) < THUMBS_PER_PAGE\n end\n\n # If we haven't reached our desired thumbnail count, ask derpibooru for more\n unless (@images.length + images.length) >= THUMBS_PER_PAGE\n response = make_request(generate_request(user, min, max), @error)\n if response\n images += process_response(user, response)\n else\n @images = nil\n break\n end\n # Update min and max for the images we just covered so another set can be requested as needed\n sorted_images = images.sort { |x, y| x.indexer.to_i <=> y.indexer.to_i}\n\n\t\t if sorted_images.length > 0\n\t\t if min\n min = sorted_images.last.indexer.to_i + 1\n else\n max = sorted_images.first.indexer.to_i - 1\n end\n\t\t end\n end\n\n # Now we must process these images for the view\n images.each do |image|\n unless(image.dead || user.discarded?(image))\n @images << process_image(user, image)\n end\n end\n end while (images.length > 0) && (@images.length < THUMBS_PER_PAGE)\n\n # We've safely databased, but limit the amount of images on the page to reduce confusion.\n\t @images = @images[0 .. (THUMBS_PER_PAGE - 1)]\n\n\t # Reverse them when going backwards so the order stays the same\n @images.reverse! unless min.nil?\n\n # Compute final minimum and maximum values of the final thumbnails\n range = @images.collect {|x| x[:indexer].to_i}\n @min = range.min\n @max = range.max\n else\n # Nope - not logged in!\n redirect_to root_path\n end\n end",
"def show_selected_images(query, args = {})\n store_query_in_session(query)\n @view = view_context ## Needed for matrix view helepr\n @links ||= []\n\n # I can't figure out why ActiveRecord is not eager-loading all the names.\n # When I do an explicit test (load the first 100 images) it eager-loads\n # about 90%, but for some reason misses 10%, and always the same 10%, but\n # apparently with no rhyme or reason. -JPH 20100204\n args = {\n action: \"list_images\",\n matrix: true,\n include: [:user, { observations: :name }, :subjects, :best_glossary_terms,\n :glossary_terms, :image_votes]\n }.merge(args)\n\n # Add some alternate sorting criteria.\n args[:sorting_links] = [\n [\"name\", :sort_by_name.t],\n [\"original_name\", :sort_by_filename.t],\n [\"date\", :sort_by_date.t],\n [\"user\", :sort_by_user.t],\n # [\"copyright_holder\", :sort_by_copyright_holder.t],\n [\"created_at\", :sort_by_posted.t],\n [\"updated_at\", :sort_by_updated_at.t],\n [\"confidence\", :sort_by_confidence.t],\n [\"image_quality\", :sort_by_image_quality.t],\n [\"num_views\", :sort_by_num_views.t]\n ]\n\n # Add \"show observations\" link if this query can be coerced into an\n # observation query.\n @links << coerced_query_link(query, Observation)\n\n # Paginate by letter if sorting by user.\n case query.params[:by]\n when \"user\", \"reverse_user\"\n args[:letters] = \"users.login\"\n # Paginate by letter if sorting by copyright holder.\n when \"copyright_holder\", \"reverse_copyright_holder\"\n args[:letters] = \"images.copyright_holder\"\n # Paginate by letter if sorting by name.\n when \"name\", \"reverse_name\"\n args[:letters] = \"names.sort_name\"\n end\n\n show_index_of_objects(query, args)\n end",
"def show\n\n # Get random gif from Giphy (http://giphy.com)\n response = HTTParty.get('http://api.giphy.com/v1/gifs/search?' +\n 'q=' + @boolio.val.to_s +\n '&api_key=dc6zaTOxFJmzC' + # provided for public beta testing via (https://github.com/Giphy/GiphyAPI#public-beta-key)\n '&limit=1' + # only want 1\n '&offset=' + rand(30).to_s + # pull from the top 10 most relevant images\n '&rating=pg' + # afraid if this is any higher\n '&fmt=json' # seems to return JSON anyway, but just in case\n )\n\n if response.code == 200\n\n # conver to JSON\n json = JSON.parse response.body, object_class: OpenStruct\n\n # set image from returned results\n @image = json.data[0].images if json.data.count > 0\n end\n\n end",
"def images(limit = 3)\n if @options[:image_extractor]\n extractor = ImageExtractor.new(self, @url, {\n :min_width => @options[:min_image_width],\n :min_height => @options[:min_image_height],\n :logger => @options[:logger]\n })\n extractor.get_best_images limit\n else\n reader_doc && !reader_doc.images.empty? ? reader_doc.images(limit) : nil\n end\n end",
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Image)\n show_selected_images(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search')\n end\n end",
"def display_image \r\n self.image.variant(resize_to_limit: [1000, 1000]) \r\n end",
"def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end",
"def index\n @images = Image.where(\"article is not null or thumbnail is not null\").order(\"id desc\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @console_images }\n end\n end",
"def best\n load\n end",
"def show\n @images = Image.all\n render :index\n end",
"def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end",
"def preview_images\n sql = <<-SQL\n select i.*\n from terms\n left join tourfilter_shared.images i\n on (i.term_text = terms.text)\n left join matches\n on (terms.id=matches.term_id)\n\n and i.term_text is not null\n and i.created_at>adddate(now(),interval -7 day)\n group by i.term_text\n order by i.created_at desc\n SQL\n @images = Image.find_by_sql(sql)\n end",
"def show_most_popular\n @card_sets = CardSet.order(\"impressions_count DESC\")[0..19]\n end",
"def show\n @imgs = @guardario.guardario_images\n end",
"def show\n @images = Image.where(:aquarium => @aquarium).page(params[:page]).per(8)\n respond_to do |format|\n format.html # show.html.slim\n end\n end",
"def images_for_project\n if project = find_or_goto_index(Project, params[:id].to_s)\n query = create_query(:Image, :for_project, :project => project)\n show_selected_images(query, {:always_index => 1})\n end\n end",
"def list_images\n if params[:page].to_s.to_i > 1000\n render(\n status: :too_many_requests,\n content_type: \"text/plain\",\n plain: \"Your queries are killing our server. \" \\\n \"There are much better ways to scrape the images \" \\\n \"from our site. \" \\\n \"Please contact the webmaster.\" \\\n \"And please stop hammering our server!\"\n )\n return\n end\n\n query = create_query(:Image, :all, by: :created_at)\n show_selected_images(query)\n end",
"def display_image\n image.variant(resize_to_limit: [500,500])\n end",
"def show\n\n matches = params[:size].match(\"([0-9]+)x([0-9]+).*\") if params[:size]\n\n default_size = 200\n min_size = 16\n max_size = 200\n\n if matches\n\n width = matches[1].to_i\n height = matches[2].to_i\n\n if ((width < min_size) || (width > max_size) || (height < min_size) || (height > max_size))\n width = default_size\n height = default_size\n end\n\n else\n width = 200\n height = 200\n end\n \n send_cached_data(\"public/pictures/show/#{width.to_i}x#{height.to_i}/#{params[:id].to_i}.jpg\",\n :type => 'image/jpeg', :disposition => 'inline') {\n\n img = Magick::Image.from_blob(@picture.data).first\n img = img.change_geometry(\"#{width}x#{height}>\") do |c, r, i| i.resize(c, r) end\n\n img.format = \"jpg\"\n img.to_blob\n }\n\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def show\n\n tempList = Array.new\n @course.knowledges.each do|k|\n tempList = tempList << k.id \n end\n \n @best_list = Array.new\n len = tempList.size\n for i in 0..len-1\n max = tempList[0];\n tempLen = tempList.size\n for j in 0..tempLen-1\n if Knowledge.find((tempList[j])).good > Knowledge.find(max).good\n max = tempList[j]\n end\n end\n @best_list = @best_list << Knowledge.find(max)\n tempList.delete(max)\n end\n\n end",
"def show\n @gallery = Gallery.find(params[:id])\n @images = @gallery.images.order('position ASC')\n end",
"def afficher\n @image.display\n end",
"def show\n\t\t@order_term = build_order\n\t\t@searches = Search.all.order(@order_term)\n\t\t@search.get_photos\n\tend",
"def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end",
"def official_minimal\n @images.select do |img|\n img[\"official\"] == true &&\n img[\"virtual_size\"] != 0\n end.sort_by do |img|\n img[\"disk_size\"]\n end.first[\"id\"]\n rescue StandardError\n nil\n end",
"def show\n @gabinete_objects = GabineteObject.all\n @expo = Exhibit.find_by(id: @gabinete_object.exhibit_id)\n set_actual_obj(@gabinete_objects, @expo)\n \n @fotos = @gabinete_object.photos.all\n @historia = @gabinete_object.histories.all\n @gabinete_object.photos.each do |ima|\n @imagem_portada = ima if ima.ocapa == true\n @imagem_cara = ima if ima.cara == true\n end\n end",
"def best_picks\n self.picks.sort_by{|pick| pick.points}.reverse!.first(5)\n end",
"def show\n @image_file_type = [\"jpg\", \"png\", \"JPG\", \"PNG\"]\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end",
"def show\n raise ArgumentError.new(\"There is no image\") if self.data == []\n (0...self.data.row_count).each do |i|\n puts self.data.row(i).to_a.join\n end\n end",
"def display id\n get_image(id).display\n end",
"def show\n #@relations = Relationship.where(\"follower_id = ? OR followed_id = ?\", @user.id, @user.id)\n followeds_rel = Relationship.where('follower_id = ?', @user.id).pluck(:followed_id)\n @followeds = User.where(id: followeds_rel)\n followers_rel = Relationship.where('followed_id = ?', @user.id).pluck(:follower_id)\n @followers = User.where(id: followers_rel)\n @followers_sample = @followers.count > 5 ? @followers.sample(5) : @followers\n @followeds_sample = @followeds.count > 5 ? @followeds.sample(5) : @followeds\n\n favourites = Favourite.where(user_id: current_user.id).pluck(:image_id)\n @images = Image.joins(:category).find(favourites)\n @objects = Array.new\n @categories = Array.new\n @images.each do |image|\n image_category = image.category\n @categories << {id: image_category.id, name: image_category.name}\n method = image_category.name.downcase.singularize.to_sym\n object = image.send(method)\n @objects << object\n end\n @categories.uniq! {|object| object[:id] }\n end",
"def show(name)\n @current_image = @files.detect do |path|\n path.basename.to_s.\n sub(/^\\d+-/, '').\n sub(/\\.(?:png|jpg)$/, '') == name.to_s\n end\n end",
"def popular\n @limit = params[:limit] || 50;\n @photos = @region.photos.where(\"created_at > ? AND score > 0\", now - 48 * 3600).order(\"score DESC\").limit(@limit)\n \n if not @photos.any?\n @photos = @region.photos.where(\"score < 100 AND score > 20\").order(\"score DESC\").limit(@limit)\n end\n\n respond_to do |format|\n format.html { render :template => @template }\n format.json { render json: @photos }\n end\n end",
"def images; end",
"def show\n @q = YhPicture.search(params[:q])\n @yh_pictures = @q.result\n if params[:q]\n session[:current_yh_picture_category] = params[:q]['category_cont']\n end\n @yh_pictures = @yh_pictures.order(:date).page(params[:page]).reverse_order.per(30)\n end",
"def show_selected_images(query, args={})\n store_query_in_session(query)\n @links ||= []\n\n # I can't figure out why ActiveRecord is not eager-loading all the names.\n # When I do an explicit test (load the first 100 images) it eager-loads\n # about 90%, but for some reason misses 10%, and always the same 10%, but\n # apparently with no rhyme or reason. -JPH 20100204\n args = {\n :action => 'list_images',\n :matrix => true,\n :include => [:user, {:observations => :name}],\n }.merge(args)\n\n # Add some alternate sorting criteria.\n args[:sorting_links] = [\n ['name', :sort_by_name.t],\n ['original_name', :sort_by_filename.t],\n ['date', :sort_by_date.t],\n ['user', :sort_by_user.t],\n # ['copyright_holder', :sort_by_copyright_holder.t],\n ['created_at', :sort_by_posted.t],\n ['updated_at', :sort_by_updated_at.t],\n ['confidence', :sort_by_confidence.t],\n ['image_quality', :sort_by_image_quality.t],\n ['num_views', :sort_by_num_views.t],\n ]\n\n # Add \"show observations\" link if this query can be coerced into an\n # observation query.\n if query.is_coercable?(:Observation)\n @links << [:show_objects.t(:type => :observation), {\n :controller => 'observer',\n :action => 'index_observation',\n :params => query_params(query),\n }]\n end\n\n # Paginate by letter if sorting by user.\n if (query.params[:by] == 'user') or\n (query.params[:by] == 'reverse_user')\n args[:letters] = 'users.login'\n # Paginate by letter if sorting by copyright holder.\n elsif (query.params[:by] == 'copyright_holder') or\n (query.params[:by] == 'reverse_copyright_holder')\n args[:letters] = 'images.copyright_holder'\n # Paginate by letter if names are included in query.\n elsif query.uses_table?(:names)\n args[:letters] = 'names.sort_name'\n end\n\n show_index_of_objects(query, args)\n end",
"def best_viewport()\n \n percentage = 0\n \n read() do |img|\n\n found = faces()\n \n index = if found.any? then\n \n # find the top y\n box = found.max_by {|x, y, width, height| y}\n y, height = box.values_at 1, 3\n y - (height / 2)\n \n else\n \n y_maxcontrast(img)\n \n end\n \n percentage = (100 / (img.rows / index.to_f)).round\n \n end \n \n return percentage\n \n end",
"def search\n @imageFiles = ImageFile.all\n image = ImageFile.create!(image_params)\n image.process_img\n res = []\n for hash in @imageFiles\n if hash.compare(image.avg_hash) < 20\n res.append(hash)\n end\n end\n render json: res\n end",
"def show_image # :nologin: :prefetch:\n store_location\n if @image = find_or_goto_index(Image, params[:id].to_s, :include => [\n :copyright_changes,\n :image_votes,\n :license,\n {:observations => [:comments, :name]},\n :projects,\n :user,\n ])\n @is_reviewer = is_reviewer\n pass_query_params\n\n # Decide which size to display.\n @default_size = @user ? @user.image_size : :medium\n @size = params[:size].blank? ? @default_size : params[:size].to_sym\n\n # Make this size the default image size for this user.\n if @user and (@default_size != @size) and\n (params[:make_default] == '1')\n @user.image_size = @size\n @user.save_without_our_callbacks\n @default_size = @size\n end\n\n # Wait until here to create this search query to save server resources.\n # Otherwise we'd be creating a new search query for images for every single\n # show_observation request. We know we came from an observation-type page\n # because that's the only time the 'obs' param will be set (with obs id).\n obs = params[:obs]\n if !obs.blank? &&\n # The outer search on observation won't be saved for robots, so no sense\n # in bothering with any of this.\n !is_robot?\n obs_query = find_or_create_query(:Observation)\n obs_query.current = obs\n img_query = create_query(:Image, :inside_observation,\n :observation => obs, :outer => obs_query)\n set_query_params(img_query)\n end\n\n # Cast user's vote if passed in 'vote' parameter.\n if @user and\n (val = params[:vote]) and\n (val == '0' or (val = Image.validate_vote(val)))\n val = nil if val == '0'\n cur = @image.users_vote\n if cur != val\n anon = @user.votes_anonymous == :yes\n @image.change_vote(@user, val, anon)\n Transaction.put_images(:id => @image, :set_vote => val, :set_anonymous => anon)\n end\n\n # Advance to next image automatically if 'next' parameter set.\n if params[:next]\n query = find_or_create_query(Image)\n query.current = @image\n if query.index(@image) and\n (query = query.next)\n @image = query.current\n end\n end\n end\n\n # Grab list of votes.\n @votes = @image.image_votes(:include => :user).sort_by do |v|\n (v.anonymous ? :anonymous.l : v.user.unique_text_name).downcase\n end\n\n # Update view stats on image we're actually showing.\n update_view_stats(@image)\n end\n end",
"def all_images\n # For all images:\n image_text_files = Dir\n .children(folder_path)\n .select do |path|\n path.start_with?('output-')\n end\n .sort\n # .tap{|fs| puts fs }\n image_text_data = image_text_files.map do |path|\n File.read(File.join(folder_path, path))\n end\n image_jsons = image_text_data.map do |json_string|\n JSON.parse(json_string)\n end\n page_regex = /#{image_prefix}(\\d+)#{image_suffix}/\n ordered_image_jsons = image_jsons.sort do |a, b|\n a_uri = a['responses'].first['context']['uri']\n b_uri = b['responses'].first['context']['uri']\n a_num = a_uri.match(page_regex)[1].to_i\n b_num = b_uri.match(page_regex)[1].to_i\n a_num <=> b_num\n end\n\n ordered_images_count = ordered_image_jsons.count\n ordered_image_jsons.each.with_index do |ordered_image_json, image_index|\n # next unless image_index == 4\n\n puts \"Processing image #{image_index+1} of #{ordered_images_count}\"\n uri = ordered_image_json['responses'].first['context']['uri']\n # puts \"Processing URI #{uri}\"\n page_number = uri.match(page_regex)[1].to_i\n # puts \"Processing page number #{page_number}\"\n\n input_image_path = full_image_path(page_number)\n # puts \"File.exist?(#{input_image_path}): #{File.exist?(input_image_path)}\"\n image = Magick::Image.read(input_image_path)[0]\n # json_path =\"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/output-#{page_number}-to-#{page_number}.json\"\n # json_text = File.read(json_path)\n # json = JSON.parse(json_text)\n\n bounding_box = ordered_image_json[\"responses\"].first[\"textAnnotations\"][1][\"boundingPoly\"]\n vertices = bounding_box[\"vertices\"]\n\n confidence_symbols_to_colors = {\n # very_confidence: '#BED1D8',\n # very_confidence: '#000000',\n very_confidence: '#555',\n moderately_confidence: '#FFAE03',\n sort_of_confidence: '#E67F0D',\n low_confidence: '#E9190F'\n }\n\n numbers_to_confidence_symbols = {\n 80..100 => :very_confidence,\n 50..80 => :moderately_confidence,\n 31..50 => :sort_of_confidence,\n 0..30 => :low_confidence\n }\n\n numbers_to_stroke_opacity = {\n 80..100 => '35%',\n 60..80 => '100%',\n 31..60 => '100%',\n 0..30 => '100%'\n }\n numbers_to_stroke_width = {\n 80..100 => 2,\n # 80..100 => 4,\n 50..80 => 5,\n # 50..80 => 4,\n 31..50 => 5,\n 0..30 => 5\n }\n\n pages = ordered_image_json[\"responses\"].first[\"fullTextAnnotation\"]['pages']\n blocks = pages.map{|p| p['blocks'] }.flatten.compact\n paragraphs = blocks.map{|b| b['paragraphs'] }.flatten.compact\n words = paragraphs.map{|p| p['words'] }.flatten.compact\n symbols = words.map{|w| w['symbols'] }.flatten.compact\n symbols_total = symbols.count\n symbols.each.with_index do |symbol, symbol_index|\n # next unless symbol_index == 41\n\n # puts \" Processing symbol #{symbol_index+1} of #{symbols_total}\"\n bounding_box = symbol[\"boundingBox\"]\n vertices = bounding_box[\"vertices\"]\n confidence = symbol['confidence'] || 0\n confidence_number = (confidence * 100).to_i\n confidence_symbol = numbers_to_confidence_symbols.select{|n| n === confidence_number }.values.first\n color = confidence_symbols_to_colors[confidence_symbol]\n stroke_opacity = numbers_to_stroke_opacity.select{|n| n === confidence_number }.values.first\n stroke_width = numbers_to_stroke_width.select{|n| n === confidence_number }.values.first\n\n draw = Magick::Draw.new\n draw.fill_opacity(0)\n draw.stroke(color)\n draw.stroke_opacity(stroke_opacity)\n # draw.stroke_opacity('100%')\n draw.stroke_width(stroke_width)\n\n p1x = vertices[0]['x'] || 0\n p1y = vertices[0]['y'] || 0\n # p2x = vertices[1]['x']\n # p2y = vertices[1]['y']\n # p3x = vertices[3]['x']\n # p3y = vertices[3]['y']\n p4x = vertices[2]['x'] || 0\n p4y = vertices[2]['y'] || 0\n\n unless p1x && p1y && p4x && p4y\n # unless p1x && p1y && p2x && p2y && p3x && p3y && p4x && p4y\n puts \"Error: Missing at least one vertex for image json block from file #{image_text_files[image_index]} for page#{page_number}.jpg\"\n puts \"Error: Vertices:\"\n puts vertices\n next\n end\n\n # puts \"trying to draw rectangle at #{p1x}, #{p1y}, #{p3x}, #{p3y}\"\n # draw.roundrectangle(p1x, p1y, p4x, p4y, 5, 5)\n draw.rectangle(p1x, p1y, p4x, p4y)\n # draw.line(p1x, p1y, p2x, p2y)\n # draw.line(p1x, p1y, p3x, p3y)\n # draw.line(p2x, p2y, p4x, p4y)\n # draw.line(p3x, p3y, p4x, p4y)\n\n draw.draw(image)\n next\n end\n # After exploring this, I'm confident that missing vertices should be\n # treated as 0s\n altered_image_suffix = image_suffix\n .split('.')\n .insert(1, 'symbol_confidence')\n .join('.')\n output_image_path = \"#{full_image_prefix}#{page_number}#{altered_image_suffix}\"\n # output_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.symbol_confidence.missingvertices.jpg\"\n image.write(output_image_path)\n end\n puts \"Finished drawing on images...\"\nend",
"def show\n @img = ImageRow.find(params[:id])\n if @img.is_deleted\n @img = nil\n else\n # Index img rows in show because only here will the metadata like height/width actually be written.\n # And, this helps us capture any updates very quickly.\n # Would need some caching logic to prevent hammering the db with these in prod though.\n @img.image.analyze # need to manually trigger analysis before indexing to get dimensions.\n Search::Index.index_one(@img)\n end\n end",
"def index\n sort_by = ['recent','votes'].include?(params[:sort]) ? params[:sort] : 'recent'\n order = sort_by == \"recent\" ? \"created_at DESC\" : \"up_votes DESC\"\n @images = Image.where(:contest_id=>@contest).order(order).page(params[:page])\n respond_to do |format|\n format.html {render :layout=>false}\n format.js \n end\n end",
"def show\n @pictures = GeneticBankPicture.group(:genetic_bank_id) \n end",
"def avatar_list\n @suggestions = Suggestion.where(:status => '0').order(\"score DESC, created_at DESC\").limit(5)\n\t\trender :partial => 'suggestions/avatar_list'\n end",
"def frontcover_resource\n fc=@supporting_resources.select { |sr| sr.type.human==\"FrontCover\" }\n if fc.length > 0\n if fc.length > 1\n best_found=fc.select{|c| c.versions.last and c.versions.last.image_width}.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first\n if best_found\n # we take larger one\n best_found.versions.last\n else\n # we try first that is not gif\n fc.select{|sr| not sr.versions.last.file_format==\"Gif\"}.first.versions.last\n end\n else\n fc.first.versions.last\n end\n end\n end",
"def images\n @assets = filtered_assets.where(type: \"Image\").order(\"created_at DESC\").paginate(params)\n @assets = @assets.search(params[:q], fuzzy: true) if params[:q].present?\n respond_to do |format|\n format.html do\n render template: \"/dash/chooser/images\"\n end\n format.js do\n render template: \"/dash/chooser/images_search\"\n end\n end\n end",
"def frontcover_resource\n fc=@supporting_resources.front_cover\n if fc.length > 0\n if fc.length > 1\n best_found=fc.select{|c| c.versions.last and c.versions.last.image_width}.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first\n if best_found\n # we take larger one\n best_found.versions.last\n else\n # we try first that is not gif\n fc.select{|sr| not sr.versions.last.file_format==\"Gif\"}.first.versions.last\n end\n else\n fc.first.versions.last\n end\n end\n end",
"def find_images\n if params.has_key?(:image) \n @images = Image.all()\n @image = Image.new()\n @image.tags = \"\"\n helpers.fetch_tags(find_images_params)\n\n tag_array = Array.new()\n tags = @image.tags\n tag_array = tags.delete_suffix(',').split(',')\n @search_results = helpers.find_images(tag_array)\n \n render 'images/searchResults'\n else\n @images = Image.all()\n render 'images/index'\n end\n\n \n end",
"def official_minimal\n @images.select do |img|\n img[\"official\"] == true &&\n img[\"status\"] == \"available\" &&\n img[\"virtual_size\"] != 0\n end.sort_by do |img|\n img[\"disk_size\"]\n end.first[\"id\"]\n rescue StandardError\n nil\n end",
"def index\n @images = get_approved\n @left_images = []\n @right_images = []\n @center_images = []\n counter = 0\n @images.each do |image|\n counter+=1\n if counter == 1\n @left_images << image\n elsif counter ==2\n @center_images << image\n elsif counter ==3\n counter = 0\n @right_images << image\n end\n end\n end",
"def scan_images\n assert_privileges(\"image_scan\")\n showlist = @lastaction == \"show_list\"\n ids = showlist ? find_checked_items : find_current_item(ContainerImage)\n\n if ids.empty?\n add_flash(_(\"No %{model} were selected for Analysis\") % {:model => ui_lookup(:tables => \"container_image\")},\n :error)\n else\n process_scan_images(ids)\n end\n\n showlist ? show_list : show\n ids.count\n end",
"def show\n redirect_to :controller => 'sessions', :action => 'connect' if !session[:access_token] \n\n @contest = Contest.find(params[:id])\n\n client = Instagram.client(:access_token => session[:access_token])\n @user = client.user\n \n pictures = client.tag_recent_media('mazeh9art')\n \n pictures.data.each do |p|\n picture = Picture.find_or_initialize_by_instagram_id(p.id)\n picture.update_attributes(title: p.caption.text, url: p.images.standard_resolution.url )\n end\n \n gon.pics = pictures #Contest.first.getNextPictures() \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def image_error_num( max ); \"每則日誌最多可貼 #{max} 張圖片\"; end",
"def show\n @images = @category.images\n end",
"def images_for_project\n project = find_or_goto_index(Project, params[:id].to_s)\n return unless project\n\n query = create_query(:Image, :for_project, project: project)\n show_selected_images(query, always_index: 1)\n end",
"def find_largest filename, json\n index = -1\n maxsize = 0\n json[\"images\"].each_with_index do |image, i|\n unless image[\"filename\"].nil?\n size = width_of \"#{dir filename}/#{image['filename']}\"\n if size > maxsize\n maxsize = size\n index = i\n end\n end\n end\n # Warn users if upscaling assets\n unless json['images'][index] == json['images'][-1]\n image = lastdir filename, '.*'\n puts \"warning: Upscaling from #{maxsize}px occured in asset '#{image}'\"\n end\n return json['images'][index]\nend",
"def show\n #@images = Image.where(:user_id => 1)\n end",
"def index\n @objective_images = ObjectiveImage.all\n end",
"def index\n @unfilteredPictures = @theme.pictures\n @pictures = Picture.getPictures(@unfilteredPictures)\n end",
"def index\n @classfield_images = ClassfieldImage.all.order('created_at DESC').limit('25')\n end",
"def show\n\t #@adm_galeria = Adm::Galeria\n\t@adm_galerias_imagem =Adm::Galeria.find(params[:id]).galerias_imagens.all # @adm_galeria.preload(:galerias_imagens) #joins(:galerias_imagens) \n\t#@adm_galeria = Adm::Galeria.find(params[:id]).galerias_imagens.all\n\t#abort('gil');\n end",
"def show\n @aimages = @awsub.aimages\n end",
"def index_image # :nologin: :norobots:\n query = find_or_create_query(:Image, :by => params[:by])\n show_selected_images(query, :id => params[:id].to_s, :always_index => true)\n end",
"def most_popular\r\n \r\n @sql = ActiveRecord::Base.connection()\r\n @most_popular_seller=@sql.select_rows(\"SELECT DISTINCT bs.store_id, s.username, a.id, a.attachment_file_name\r\n FROM products p\r\n LEFT JOIN brands_stores bs ON bs.brand_id = p.brand_id\r\n LEFT JOIN stores s ON s.id = bs.store_id\r\n LEFT JOIN assets a ON a.viewable_id = s.id\r\n WHERE a.viewable_type = 'Store'\r\n AND a.type = 'ProfileImage'\r\n ORDER BY p.page_views DESC\r\n LIMIT 6 \")\r\n\r\n i=0\r\n @most_array = Array.new(6){Array.new(3)}\r\n @most_popular_seller.each do |most|\r\n @most_array[i][0] = most[1]\r\n @most_array[i][1] = most[3]\r\n @most_array[i][2] = most[2]\r\n i+=1\r\n end\r\n \r\n @most=Array.new(6) {Hash.new(2)}\r\n \r\n for i in 0..5\r\n \r\n @most[i]['image'] = \"http://s3.amazonaws.com/SpreeHeroku/assets/profiles/#{@most_array[i][2]}/small/#{@most_array[i][1]}\"\r\n @most[i]['url']=\"http://shop.soletron.com/stores/#{@most_array[i][0]}\"\r\n\r\n end \r\n render \"most_popular\" ,:layout=>false\r\n end",
"def select_image_given_image_urls(image_urls, width, index = 0)\n if image_urls.nil? or image_urls == \"\"\n return \"/assets/Image_Missing.png\"\n end\n \n y = image_urls.to_s.split(\";\")\n \n if index < y.length\n y = y[index]\n elsif y.length > 0\n y = y[0]\n else\n return \"\"\n end\n \n z = y.split(\",\")\n image = select_closest_image(z, width)\n end",
"def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end",
"def index\n @top_photos = Photo.where(:imageable_type => \"TopPhoto\")\n @sug_photos = Photo.where(:imageable_type => \"SugPhoto\")\n @bottom_photos = Photo.where(:imageable_type => \"BottomPhoto\")\n end",
"def show\n @toppings = @pizza.toppings.all\n @images = @pizza.images.order('image_relationships.position ASC')\n end",
"def index\n @bests = Best.all\n end",
"def show_ind which=:best, until_end: false\n ind = case which\n when :best then opt.best.last\n when :mean then opt.mu\n when NArray then which\n else raise ArgumentError, \"Which should I show? `#{which}`\"\n end\n nsteps = until_end ? max_nsteps*1000 : max_nsteps\n print \"Re-running best individual \"\n fit = fitness_one ind, render: true, nsteps: nsteps\n puts \"-- fitness: #{fit}\"\n end"
] | [
"0.6460681",
"0.6364586",
"0.6218618",
"0.6197685",
"0.6127764",
"0.609799",
"0.60435635",
"0.59243995",
"0.5874635",
"0.5873022",
"0.5816592",
"0.5795879",
"0.57858586",
"0.57765824",
"0.57743907",
"0.5773743",
"0.5767515",
"0.5762214",
"0.57542896",
"0.5733784",
"0.5670172",
"0.56512034",
"0.563931",
"0.5636665",
"0.56355727",
"0.5633573",
"0.56309396",
"0.55823386",
"0.5580563",
"0.55730855",
"0.5558543",
"0.55540115",
"0.5550531",
"0.5540061",
"0.55296695",
"0.5510868",
"0.55009544",
"0.5500774",
"0.5498728",
"0.5493037",
"0.5478754",
"0.54638207",
"0.5451087",
"0.5451087",
"0.5451087",
"0.5451087",
"0.5451087",
"0.5451087",
"0.54424405",
"0.54412323",
"0.5438056",
"0.54324424",
"0.5428333",
"0.5426945",
"0.5413383",
"0.5409936",
"0.5406446",
"0.5390001",
"0.5387739",
"0.53815764",
"0.53725106",
"0.53635466",
"0.53632593",
"0.53602815",
"0.53602153",
"0.5356648",
"0.53540474",
"0.5350034",
"0.534651",
"0.5344091",
"0.53435713",
"0.53414536",
"0.53217834",
"0.5319489",
"0.53121096",
"0.5311865",
"0.5295443",
"0.52926946",
"0.5286373",
"0.52845716",
"0.5274021",
"0.52677727",
"0.5267388",
"0.5261341",
"0.5260003",
"0.5257729",
"0.5255821",
"0.5254764",
"0.52438176",
"0.5242116",
"0.52372086",
"0.52357674",
"0.5231642",
"0.5224613",
"0.52185446",
"0.5217943",
"0.5217323",
"0.5213436",
"0.5205164",
"0.5195966"
] | 0.54717237 | 41 |
Show the images by an ID | def show
@limit = params[:limit] || 24;
@photos = @region.photos.where("id <= ?", params[:id]).order("id DESC").limit(@limit)
if @region.name == "artstech"
@og_title = "Styleblaster @ Arts/Tech NYC"
else
@og_title = "Styleblaster"
end
if @photos.any?
@og_image = @photos.first.photo.url
@og_url = "http://styleblaster.net/#{@region.name}/p/#{@photos.first.id}/"
end
respond_to do |format|
format.html { render :template => @template }
format.json { render json: @photos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display id\n get_image(id).display\n end",
"def show\n @id = params[:id]\n @image = Image.find(@id)\n end",
"def show\r\n\t\tbegin\r\n\t\t\t@image = Image.find(params[:id])\r\n\t\trescue ActiveRecord::RecordNotFound\r\n\t\t\trender :text => \"Image ##{params[:id].to_s} not found\"\r\n\t\tend\r\n\tend",
"def show_images\r\n images = Document.new(self).get_images\r\n puts \"There are #{images.length} images\"\r\n index = 1\r\n images.each do |l|\r\n puts \"image: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" src: #{l.src}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def show\n\t\t@image = Image.find(params[:id])\n\tend",
"def show\n #@images = Image.where(:user_id => 1)\n end",
"def show\n @img = ImageRow.find(params[:id])\n if @img.is_deleted\n @img = nil\n else\n # Index img rows in show because only here will the metadata like height/width actually be written.\n # And, this helps us capture any updates very quickly.\n # Would need some caching logic to prevent hammering the db with these in prod though.\n @img.image.analyze # need to manually trigger analysis before indexing to get dimensions.\n Search::Index.index_one(@img)\n end\n end",
"def show\n @images = Image.all\n render :index\n end",
"def show\n @imgs = @guardario.guardario_images\n end",
"def show\n @instance = Instance.find_by_id( params[:id] )\n @image = Image.find_by_ami(@instance.image_id)\n end",
"def images_for_project\n if project = find_or_goto_index(Project, params[:id].to_s)\n query = create_query(:Image, :for_project, :project => project)\n show_selected_images(query, {:always_index => 1})\n end\n end",
"def show_myimage\n if signed_in?\n @menu = \"mytemplate\" \n @board = \"myimage\"\n @section = \"show\"\n \n @sharedimage = Sharedimage.get(params[:id].to_i)\n \n render '/sharedimages/myimage_show', :layout => 'ajax-load-page'\n\n else\n redirect_to '/login'\n end\n end",
"def show_images(options)\n change_dir_images(options[:mode]) if options[:mode]\n search_all_images_and_set_the_instances!(options)\n end",
"def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end",
"def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end",
"def index_image\n query = find_or_create_query(:Image, by: params[:by])\n show_selected_images(query, id: params[:id].to_s, always_index: true)\n end",
"def show\n @image = @account.images.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def index\n @images = Image.where(user_id: params[:id])\n @user = User.find(params[:id])\n end",
"def show\n @pictures = TaxiSevice.find(params[:id]).taxi_images\n end",
"def show\n @image = @user.images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def show\n @pictures = GeneticBankPicture.group(:genetic_bank_id) \n end",
"def show\n @images = @galleries_album.galleries\n end",
"def show\n @gallery = Gallery.find_by_permalink params[:id]\n unless @gallery.nil?\n @pictures = Picture.paginate_by_gallery_id @gallery.id, :page => params[:page],\n :per_page => 12\n else\n render :status => 404\n end\n end",
"def show\n @comments = Comment.where(:image_id => params[:id])\n end",
"def images_for_project\n project = find_or_goto_index(Project, params[:id].to_s)\n return unless project\n\n query = create_query(:Image, :for_project, project: project)\n show_selected_images(query, always_index: 1)\n end",
"def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end",
"def show\n if params.has_key?(:page)\n @images = Kaminari.paginate_array(@image_label_set.images).page(params[:page])\n else\n @images = Kaminari.paginate_array(@image_label_set.images).page(1)\n end\n end",
"def set_id\n @image = Image.find(params[:id])\n end",
"def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def index_image # :nologin: :norobots:\n query = find_or_create_query(:Image, :by => params[:by])\n show_selected_images(query, :id => params[:id].to_s, :always_index => true)\n end",
"def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @limages = @same.limages\n end",
"def image(image_id)\n images(:image_ids => [image_id])[0]\n end",
"def show\n @cat = Cat.find(params[:id])\n @pictures = Picture.where(\"title LIKE '\"+@cat.id.to_s+\"'\")\n end",
"def picture_show(id, n, x=0, y=0, ori=0, z_x=100, z_y=100, op=255, bl=0)\n pictures[id].show(n, ori, x, y, z_x, z_y, op, bl)\n end",
"def image_by_id(image_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking image ID #{image_id.inspect} from pool\"\n images.select { |image| image[:id] == image_id.to_i }.first\n end",
"def imgs\n @id = params[:id]\n @all_photos = ProductPhoto.where(product_id: params[:id])\n @photo = ProductPhoto.new\n \n end",
"def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagem }\n end\n end",
"def show\n @pictures = TourService.find(params[:id]).tour_images\n # render :show\n end",
"def show\n @images_index = ImagesIndex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @images_index }\n end\n end",
"def show\n @song = Song.find(params[:id])\n @metadata = @song.metadatum\n @images = BackgroundImage.where(song_id: @song.id)\n end",
"def show\n @gallery = Gallery.find(params[:id])\n @images = @gallery.images.order('position ASC')\n end",
"def show\n @images = @category.images\n end",
"def show()\n @photo = Photo.find(params[:id])\n end",
"def show\n @picture = Picture.find(params[:id])\n # tell rails to find pictures by params[:id] in table Picture\n # to store in picture object\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @image }\n end\n end",
"def images_by_user\n user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n return unless user\n\n query = create_query(:Image, :by_user, user: user)\n show_selected_images(query)\n end",
"def show\n @picture = @theme.pictures.find(params[:id])\n @verspictures = Picture.where(name: @picture.name)\n end",
"def show\n @picture = @album.pictures.find(params[:id])\n end",
"def show\n image = Image.find_by_name(params[:id])\n send_data image.content, :filename=>image.name, :type => image.content_type, :disposition => 'inline'\n end",
"def show\n @aimages = @awsub.aimages\n end",
"def show\n if current_user.id.to_s == params[:id]\n random_picture_generator\n end\n\n @pictures = Picture.pictures_by_user(params[:id])\n end",
"def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end",
"def show_image\n @case_module = CaseModule.find(params[:id])\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n end",
"def show\n @photo = Photo.find(params[:id])\n end",
"def show\n if @current_user.nil? and (!params[:id].to_i.zero? or User.find_by_username(params[:id]).nil?)\n redirect_to '/login' \n else\n if !params[:id].to_i.zero? and !@current_user.nil? and @current_user.image_ids.include? params[:id].to_i\n @image=Image.find params[:id]\n user=@current_user\n else\n user=User.find_by_username params[:id]\n @image=user.images.random\n end\n @image.text=user.quotes.random\n send_data(@image.to_img(request),\n :type => 'image/png',\n :disposition => 'inline')\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n\t #@adm_galeria = Adm::Galeria\n\t@adm_galerias_imagem =Adm::Galeria.find(params[:id]).galerias_imagens.all # @adm_galeria.preload(:galerias_imagens) #joins(:galerias_imagens) \n\t#@adm_galeria = Adm::Galeria.find(params[:id]).galerias_imagens.all\n\t#abort('gil');\n end",
"def show\n @images = Image.tagged_with @tag\n end",
"def index\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n @imgs = Img.find(:all)\n end",
"def show\n @gallery = Gallery.find(params[:id])\n end",
"def show\n @gallery = Gallery.find(params[:id])\n end",
"def show\n @gallery = Gallery.find(params[:id])\n end",
"def show\n @picture = Picture.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.png { render :inline => \"@picture.operate{}\", :type => :flexi}\n format.gif { render :inline => \"@picture.operate{}\", :type => :flexi}\n format.jpg { render :inline => \"@picture.operate{}\", :type => :flexi}\n format.xml { render :xml => @picture }\n end end",
"def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end",
"def index\n @images = Image.where(:user_id=>current_user.id)\n end",
"def index\n\t\t@user = User.find params[:user_id] #el corchete con params tiene que ir junto!!\n\t\t@images = @user.images\n\tend",
"def show\n @image_datum = ImageDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_datum }\n end\n end",
"def show\n\n matches = params[:size].match(\"([0-9]+)x([0-9]+).*\") if params[:size]\n\n default_size = 200\n min_size = 16\n max_size = 200\n\n if matches\n\n width = matches[1].to_i\n height = matches[2].to_i\n\n if ((width < min_size) || (width > max_size) || (height < min_size) || (height > max_size))\n width = default_size\n height = default_size\n end\n\n else\n width = 200\n height = 200\n end\n \n send_cached_data(\"public/pictures/show/#{width.to_i}x#{height.to_i}/#{params[:id].to_i}.jpg\",\n :type => 'image/jpeg', :disposition => 'inline') {\n\n img = Magick::Image.from_blob(@picture.data).first\n img = img.change_geometry(\"#{width}x#{height}>\") do |c, r, i| i.resize(c, r) end\n\n img.format = \"jpg\"\n img.to_blob\n }\n\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jpg # show.jpg.erb\n format.png # show.png.erb\n format.xml { render :xml => @image }\n end\n end",
"def show\n @pictures = Picture.all.where(travel_destination_id:@travel_destination.id)\n end",
"def show\n @image = current_user.sprites.find(params[:sprite_id]).images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @images = Image.where(:aquarium => @aquarium).page(params[:page]).per(8)\n respond_to do |format|\n format.html # show.html.slim\n end\n end",
"def show\n @imagem = @evento.imagems.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagem }\n end\n end",
"def show\n\t\t@vote_pic = VotePic.find(params[:id])\n end",
"def scroll(id); det.image(:index, \"#{id}\"); end",
"def show\n @imageable = @film\n @pictures = @imageable.pictures\n @picture = Picture.new\n end",
"def images\n Image.where(product_id: id)\nend",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def set_img\n @img = Img.find(params[:id])\n end",
"def fetch_image_by_id(image_id)\n configure_connection\n Instagram.media_item(image_id)\n end",
"def rows id\n get_image(id).rows\n end",
"def show\n\n @showcase = Showcase.find(params[:showcase_id])\n @showcase_image = @showcase.showcase_images.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @showcase_image }\n end\n end",
"def show\n @content_title = 'Tag your friends and beers!'\n @image = Image.find(params[:id], :include => [ :tag_images ])\n @tag_images = @image.tag_images\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @tag_images.to_xml }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n hash = {:folder_index => 7, :entry_path => 1}\n @index_count = @entry.getImgCount(hash)\n\n hash.delete(\"entry_path\")\n hash[:count] = 5;\n @image_array = @entry.getRndImgFromDir(hash)\n @image_name = @entry.image.split(\"/\").last().split(\"_\").last().split(\".\").first()\n img = @entry.image\n #@image_name = img[img.rindex('/')+1, img.length][img.rindex('_'), img.length]\n #.split(\".\")[0]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def imgs obj\n Image.find(obj.image_ids)\n end",
"def show\n @gallery = Gallery.find(params[:id])\n @pictures = Picture.find_all_by_gallery_id(@gallery.id)\n \n # Set the title\n @title = @gallery.title\n\n render :action => 'show', :layout => @gallery.layout\n\n end",
"def image(id, options={})\n params = options\n get(surl('image') + id, params).body\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.jpg # show.jpg.flexi\n format.html # show.html.erb\n format.png # show.png.flexi\n format.xml { render :xml => @image }\n end\n end"
] | [
"0.81350785",
"0.7725066",
"0.7464046",
"0.74391973",
"0.7371636",
"0.735456",
"0.7167137",
"0.709756",
"0.7092669",
"0.7017839",
"0.70171493",
"0.69977516",
"0.6984865",
"0.6972654",
"0.6957121",
"0.69379497",
"0.69279194",
"0.69264853",
"0.69031394",
"0.6900149",
"0.6840053",
"0.68363214",
"0.683564",
"0.68339807",
"0.6827131",
"0.6824388",
"0.68147695",
"0.6805791",
"0.6801239",
"0.6795587",
"0.67938656",
"0.6779714",
"0.6767663",
"0.67670137",
"0.67493856",
"0.6742762",
"0.6728785",
"0.6724319",
"0.67190444",
"0.6718107",
"0.6714958",
"0.6713039",
"0.67107034",
"0.67099303",
"0.6709836",
"0.6704831",
"0.6699849",
"0.66958964",
"0.66898876",
"0.66792566",
"0.6668123",
"0.66585463",
"0.66584843",
"0.66576993",
"0.6652011",
"0.6649081",
"0.66484004",
"0.6637688",
"0.6637688",
"0.663733",
"0.6636443",
"0.6636443",
"0.6636443",
"0.6636443",
"0.66352916",
"0.6630628",
"0.6625526",
"0.6624386",
"0.6624386",
"0.6624386",
"0.6618936",
"0.66180533",
"0.6615477",
"0.6615477",
"0.6610696",
"0.6609673",
"0.66044295",
"0.6598579",
"0.65935445",
"0.65923524",
"0.65872985",
"0.65843546",
"0.65770125",
"0.6575891",
"0.6573965",
"0.6573121",
"0.65715146",
"0.65699816",
"0.6566942",
"0.6566942",
"0.6566942",
"0.6566485",
"0.65627766",
"0.6557538",
"0.65552545",
"0.6554456",
"0.6554254",
"0.6545511",
"0.6533083",
"0.65316683",
"0.65207505"
] | 0.0 | -1 |
Show images by a random ID | def random
@limit = params[:limit] || 1;
@photos = @region.photos.order(sql_rand).limit(@limit)
respond_to do |format|
format.html { render :template => @template }
format.json { render json: @photos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n if current_user.id.to_s == params[:id]\n random_picture_generator\n end\n\n @pictures = Picture.pictures_by_user(params[:id])\n end",
"def display id\n get_image(id).display\n end",
"def show\n if @current_user.nil? and (!params[:id].to_i.zero? or User.find_by_username(params[:id]).nil?)\n redirect_to '/login' \n else\n if !params[:id].to_i.zero? and !@current_user.nil? and @current_user.image_ids.include? params[:id].to_i\n @image=Image.find params[:id]\n user=@current_user\n else\n user=User.find_by_username params[:id]\n @image=user.images.random\n end\n @image.text=user.quotes.random\n send_data(@image.to_img(request),\n :type => 'image/png',\n :disposition => 'inline')\n end\n end",
"def choose_image\n \"banners/#{ rand(35) + 1 }.jpg\"\n end",
"def random_image(query = 'safe, cute', nsfw = false)\n img = get(url: 'search/images', query: \"q=#{query.present? ? query : 'safe, cute'}&sf=random&per_page=1\", nsfw: nsfw)\n\n if img\n img_data = img['images'][0]\n image img_data.id, nsfw if img_data\n end\n end",
"def show_myimage\n if signed_in?\n @menu = \"mytemplate\" \n @board = \"myimage\"\n @section = \"show\"\n \n @sharedimage = Sharedimage.get(params[:id].to_i)\n \n render '/sharedimages/myimage_show', :layout => 'ajax-load-page'\n\n else\n redirect_to '/login'\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n @options = Array.new\n @options << @photo\n ops = Photo.where(\"id != ?\", @photo.id) \n c = ops.count\n @options << ops.find(:first, :offset => rand(c)) \n @options << ops.find(:first, :offset => rand(c))\n @options.shuffle!\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @id = params[:id]\n @image = Image.find(@id)\n end",
"def random_front_picture\n if request.xhr?\n @gallery = Gallery.find_by_permalink params[:id]\n else\n edit\n end\n @gallery.random_front_picture\n respond_to do |format|\n format.html {render :action => 'edit'}\n format.js {}\n end\n end",
"def find_normal_image\n return \"Pictures/pcn%04d.png\" % (80 + id)\n end",
"def index_image # :nologin: :norobots:\n query = find_or_create_query(:Image, :by => params[:by])\n show_selected_images(query, :id => params[:id].to_s, :always_index => true)\n end",
"def image_by_id(image_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking image ID #{image_id.inspect} from pool\"\n images.select { |image| image[:id] == image_id.to_i }.first\n end",
"def show\n\n # Get random gif from Giphy (http://giphy.com)\n response = HTTParty.get('http://api.giphy.com/v1/gifs/search?' +\n 'q=' + @boolio.val.to_s +\n '&api_key=dc6zaTOxFJmzC' + # provided for public beta testing via (https://github.com/Giphy/GiphyAPI#public-beta-key)\n '&limit=1' + # only want 1\n '&offset=' + rand(30).to_s + # pull from the top 10 most relevant images\n '&rating=pg' + # afraid if this is any higher\n '&fmt=json' # seems to return JSON anyway, but just in case\n )\n\n if response.code == 200\n\n # conver to JSON\n json = JSON.parse response.body, object_class: OpenStruct\n\n # set image from returned results\n @image = json.data[0].images if json.data.count > 0\n end\n\n end",
"def show\r\n\t\tbegin\r\n\t\t\t@image = Image.find(params[:id])\r\n\t\trescue ActiveRecord::RecordNotFound\r\n\t\t\trender :text => \"Image ##{params[:id].to_s} not found\"\r\n\t\tend\r\n\tend",
"def index_image\n query = find_or_create_query(:Image, by: params[:by])\n show_selected_images(query, id: params[:id].to_s, always_index: true)\n end",
"def show_images\r\n images = Document.new(self).get_images\r\n puts \"There are #{images.length} images\"\r\n index = 1\r\n images.each do |l|\r\n puts \"image: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" src: #{l.src}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def show\n @place_images = nil\n if @place\n if @place.galleries.random\n @place_images = @place.galleries.random.images.random(3)\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def test_show\n get :show,\n :id => pictures(:by_quentin).id\n assert_response :success\n end",
"def index\n @picture_one, @picture_two = two_random()\n @pictures = Picture.all\n end",
"def public_id\n # return \"Image/\" + Cloudinary::Utils.random_public_id\n \"Image/#{model.food_key}\"\n end",
"def index\n\n\n #@link_arr= []\n #(1..2).each do |i|\n # Five00px.new.five_px(i)\n # end\n @image = Unlimited.skip(rand(Unlimited.count)).first\n\n end",
"def show\n #@images = Image.where(:user_id => 1)\n end",
"def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def set_id\n @image = Image.find(params[:id])\n end",
"def get_image_by_uuid\n @command = :get_image_by_uuid\n # the UUID was the last \"previous argument\"\n image_uuid = @prev_args.peek(0)\n # setup the proper URI depending on the options passed in\n uri = URI.parse(@uri_string + '/' + image_uuid)\n # and get the results of the appropriate RESTful request using that URI\n result = hnl_http_get(uri)\n # finally, based on the options selected, print the results\n print_object_array(hash_array_to_obj_array([result]), \"Image:\")\n end",
"def index\n @images = @current_user.images\n @images.each do |i|\n i.text=@current_user.quotes.random\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def image(image_id)\n images(:image_ids => [image_id])[0]\n end",
"def show\n\t\t@image = Image.find(params[:id])\n\tend",
"def find_home_image\n return \"Pictures/pct%04d.png\" % (80 + id)\n end",
"def get_random_image( )\n\n print \"getting image... \"\n\n dest_file = \"#{File::SEPARATOR}tmp#{File::SEPARATOR}#{SecureRandom.hex( 5 )}.jpg\"\n Net::HTTP.start( \"lorempixel.com\" ) do |http|\n resp = http.get(\"/640/480/cats/\")\n open( dest_file, \"wb\" ) do |file|\n file.write( resp.body )\n end\n end\n puts \"done\"\n return dest_file\n\n end",
"def fetch_image_by_id(image_id)\n configure_connection\n Instagram.media_item(image_id)\n end",
"def index\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n @imgs = Img.find(:all)\n end",
"def show\n @imgs = @guardario.guardario_images\n end",
"def random\n open_listings_ids = Listing.open.select(\"id\").find_with(nil, @current_user, @current_community).all\n if open_listings_ids.empty?\n redirect_to root and return\n #render :action => :index and return\n end\n random_id = open_listings_ids[Kernel.rand(open_listings_ids.length)].id\n #redirect_to listing_path(random_id)\n @listing = Listing.find_by_id(random_id)\n render :action => :show\n end",
"def image_for(id, size=:source)\n image_tag \"https://spoonacular.com/recipeImages/#{id}-#{IMAGE_SIZES[size]}\"\n end",
"def picture_show(id, n, x=0, y=0, ori=0, z_x=100, z_y=100, op=255, bl=0)\n pictures[id].show(n, ori, x, y, z_x, z_y, op, bl)\n end",
"def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end",
"def random_photo\n if params[:city] && !params[:city][:name]\n city = City.find :first, :conditions => {:name => params[:city]}\n @photo = Photo.find :first, :conditions => {:city_id => city.id}\n end\n if !@photo\n @photo = Photo.find(:first, :offset => rand(Photo.all.size))\n end\n @photo['filename'] = \"#{@photo.city.name.gsub(' ','').downcase}.jpg\"\n end",
"def show\n\n matches = params[:size].match(\"([0-9]+)x([0-9]+).*\") if params[:size]\n\n default_size = 200\n min_size = 16\n max_size = 200\n\n if matches\n\n width = matches[1].to_i\n height = matches[2].to_i\n\n if ((width < min_size) || (width > max_size) || (height < min_size) || (height > max_size))\n width = default_size\n height = default_size\n end\n\n else\n width = 200\n height = 200\n end\n \n send_cached_data(\"public/pictures/show/#{width.to_i}x#{height.to_i}/#{params[:id].to_i}.jpg\",\n :type => 'image/jpeg', :disposition => 'inline') {\n\n img = Magick::Image.from_blob(@picture.data).first\n img = img.change_geometry(\"#{width}x#{height}>\") do |c, r, i| i.resize(c, r) end\n\n img.format = \"jpg\"\n img.to_blob\n }\n\n end",
"def show\n @pictures = GeneticBankPicture.group(:genetic_bank_id) \n end",
"def sample\n img :src => $imgHostURL + \"/\" + $sampleImg\n end",
"def show\n @pictures = TaxiSevice.find(params[:id]).taxi_images\n end",
"def randomize_id\n begin\n self.id = SecureRandom.hex 5\n end while ItAsset.where(id: self.id).exists?\n end",
"def set_img\n @img = Img.find(params[:id])\n end",
"def images_by_user\n user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n return unless user\n\n query = create_query(:Image, :by_user, user: user)\n show_selected_images(query)\n end",
"def show\n @instance = Instance.find_by_id( params[:id] )\n @image = Image.find_by_ami(@instance.image_id)\n end",
"def index\n\t\tpool = []\n\t\t# this'll get expensive... try getting a random site?\n\t\tSite.find(:all,:conditions => {:active => true}).each do |site|\n\t\t\tpool = pool + site.voted_less_than(5,5) # five images with less than 5 votes\n\t\tend\n\n\t\t@image = pool[((pool.length-1)*rand).to_i]\n\t\t@image.thumb\n\tend",
"def index\n @images = Image.where(user_id: params[:id])\n @user = User.find(params[:id])\n end",
"def show_image_number\n @druid=params[:id]\n @image_number=params[:image_number].to_i\n @document = SolrDocument.find(@druid)\n render :partial=>'annotate_image', :locals=>{:image_number=>@image_number}\n end",
"def show\n @image = current_user.sprites.find(params[:sprite_id]).images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def image(id, options={})\n params = options\n get(surl('image') + id, params).body\n end",
"def images_by_user # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Image, :by_user, :user => user)\n show_selected_images(query)\n end\n end",
"def show\n @images = Image.all\n render :index\n end",
"def show_image\n @case_module = CaseModule.find(params[:id])\n end",
"def images_for_project\n if project = find_or_goto_index(Project, params[:id].to_s)\n query = create_query(:Image, :for_project, :project => project)\n show_selected_images(query, {:always_index => 1})\n end\n end",
"def show\n #modificando este metodo para traer objetos de la bd cuando ingresen a un articulo\n @articulo = Articulo.find_by_url(params[:id])\n puts \"Ingresando a show de articulos\"\n @gridarticulos = Articulo.order(\"RANDOM()\").limit(8)\n @artimg = Articulo.order(\"RANDOM()\").limit(1)\n @artrand = Articulo.order(\"RANDOM()+1\").limit(1) \n @artlike = Like.where(articulo_id: @articulo.id).count\n end",
"def test_reuse_image_page_access\n obs = observations(:agaricus_campestris_obs)\n params = { id: obs.id }\n assert_equal(\"rolf\", obs.user.login)\n\n logout\n get(:reuse, params: params)\n assert_response(:login, \"No user: \")\n\n login(\"mary\", \"testpassword\")\n get(:reuse, params: params)\n\n # assert_redirected_to(%r{/#{obs.id}$})\n assert_redirected_to(permanent_observation_path(obs.id))\n\n login(\"rolf\", \"testpassword\")\n get(:reuse, params: params)\n\n assert_response(:success)\n # qr = QueryRecord.last.id.alphabetize\n assert_form_action(action: :attach, id: obs.id)\n end",
"def show\n user_id, id, ref = params[:user_id], params[:id], params[:ref]\n img = nil\n if id == '0' && ref\n # do lookup by reference\n img = Image.find_user_image_by_ref(user_id, params[:ref])\n elsif id != '0'\n # do lookup by guid\n img = Image.find_user_image_by_guid(user_id, id)\n end\n return not_found if !img\n\n respond_to do |format|\n format.json { render :json => img.js_serialize, :callback => params[:callback] }\n end\n end",
"def scroll(id); det.image(:index, \"#{id}\"); end",
"def show\n @gallery = Gallery.find_by_permalink params[:id]\n unless @gallery.nil?\n @pictures = Picture.paginate_by_gallery_id @gallery.id, :page => params[:page],\n :per_page => 12\n else\n render :status => 404\n end\n end",
"def index\n @images = Image.where(:user_id=>current_user.id)\n end",
"def show_images(options)\n change_dir_images(options[:mode]) if options[:mode]\n search_all_images_and_set_the_instances!(options)\n end",
"def image_uri_from_id= id\n self.image_uri = Image_URI % id\n end",
"def show\n\n #render plain: @myimage\n end",
"def random \n if params[:random]\n @card = Card.where(:first => params[:random]).sample\n else\n # @card = Card.all.sample\n rand_id = rand(Card.count)\n @card = Card.first(:conditions => ['id >= ?', rand_id])\n end\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @card }\n end\n end",
"def ask_id(session, name)\n read_task('rvpe.image.ask_id', session) do\n flag = -1\n admin_session(session, false) { flag = -2 }\n img = Image.find_by_name(name, session, flag).last\n raise \"Image[#{name}] is not found. \" unless img\n\n [true, img.id]\n end\n end",
"def show\n @post = Post.find(params[:id])\n add_impression(current_user) # AppController method\n\n @random_post = Post.all.sample\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n image = Image.find_by_name(params[:id])\n send_data image.content, :filename=>image.name, :type => image.content_type, :disposition => 'inline'\n end",
"def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end",
"def get_raw_image_by_id(id)\n\n repo_images = self.get_raw_repository_images\n\n # select images from this repository with matching id\n image = repo_images.select { |image| image.id[0,id.length] == id }\n\n if image.length == 0\n raise \"Image not found\"\n elsif image.length > 1\n raise \"More than one image matched\"\n end\n\n return image[0]\n\n end",
"def random_product_image_filename\n [\"img_1.png\",\"img_2.png\", \"img_3.png\", \"img_4.jpg\", \"img_5.jpg\", \n \"img_6.jpg\", \"img_7.jpg\", \"img_8.jpg\", \"img_9.jpg\", \"img_10.jpg\" ].shuffle.first\nend",
"def show\n @emptyphoto = Photo.new\n @photo = Photo.find_by_secret_id(params[:id])\n @top5 = Photo.popular\n\n @photo.add_to_view_count(1)\n end",
"def index\n id = (params[:id].to_i || 0) * 8\n @pictures = current_user.pictures.limit(8).offset(id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n @img = ImageRow.find(params[:id])\n if @img.is_deleted\n @img = nil\n else\n # Index img rows in show because only here will the metadata like height/width actually be written.\n # And, this helps us capture any updates very quickly.\n # Would need some caching logic to prevent hammering the db with these in prod though.\n @img.image.analyze # need to manually trigger analysis before indexing to get dimensions.\n Search::Index.index_one(@img)\n end\n end",
"def find_image\n @image = Image.find(params[:id])\n end",
"def find_image\n @image = Image.find(params[:id])\n end",
"def find_image\n @image = Image.find(params[:id])\n end",
"def show\n redirect_to :controller => 'sessions', :action => 'connect' if !session[:access_token] \n\n @contest = Contest.find(params[:id])\n\n client = Instagram.client(:access_token => session[:access_token])\n @user = client.user\n \n pictures = client.tag_recent_media('mazeh9art')\n \n pictures.data.each do |p|\n picture = Picture.find_or_initialize_by_instagram_id(p.id)\n picture.update_attributes(title: p.caption.text, url: p.images.standard_resolution.url )\n end\n \n gon.pics = pictures #Contest.first.getNextPictures() \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @image = @account.images.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def show\n render_general(@image)\n end",
"def choose_image(discovery, filter)\n \n FlickRaw.api_key=ENV[\"FLICKR_KEY\"]\n FlickRaw.shared_secret=ENV[\"FLICKR_SECRET\"]\n\n bath = flickr.places.find :query => \"Bath\"\n latitude = bath[0]['latitude'].to_f\n longitude = bath[0]['longitude'].to_f\n\n args = {}\n args[:place_id] = bath[0]['place_id']\n args[:accuracy] = 11 #city\n args[:per_page] = 500 #this is max size\n #license ids at: https://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html\n args[:license] = \"7,6,5,4,3,2,1\"\n args[:sort] = discovery\n \n images = flickr.photos.search args\n #puts images.inspect\n images.to_a.shuffle.each do |i|\n if !filter.include?( i[\"id\"] )\n filter.insert( i[\"id\"] )\n return i\n end\n end \n raise \"No image!\"\nend",
"def show\n @cat = Cat.find(params[:id])\n @pictures = Picture.where(\"title LIKE '\"+@cat.id.to_s+\"'\")\n end",
"def show\n #authenticate_admin!\n #require 'open-uri'\n \n @candy = Candy.find(params[:id])\n @candy_photo = @candy.data['photo']\n @photo = @candy.photos.first\n \n# dir_pic = \"#{RAILS_ROOT}/public/images/candies/#{@candy.id}\"\n# \n# FileUtils.mkdir_p dir_pic if !File.directory?(dir_pic)\n# open(@candy_photo) do |o|\n# File.open(\"#{dir_pic}/#{@candy.pid}.jpg\", \"w\") { |f| f << o.read }\n# end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @candy }\n format.json { render :json => @candy }\n end\n end",
"def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end",
"def image\n images.first\n end",
"def show\n @picture = @album.pictures.find(params[:id])\n end",
"def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end",
"def show\n @gallery = Gallery.find(params[:id])\n end",
"def show\n @gallery = Gallery.find(params[:id])\n end",
"def show\n @gallery = Gallery.find(params[:id])\n end",
"def show\n @song = Song.find(params[:id])\n @metadata = @song.metadatum\n @images = BackgroundImage.where(song_id: @song.id)\n end",
"def imgs\n @id = params[:id]\n @all_photos = ProductPhoto.where(product_id: params[:id])\n @photo = ProductPhoto.new\n \n end",
"def poster_img\n ok, data = RemoteData.omdb_query(params[:imdb_id])\n if ok\n redirect_to data[:Poster], status: :moved_permanently\n else\n head :not_found\n end\n end",
"def shareAllRandomly (id)\nend",
"def show\n\t\t@vote_pic = VotePic.find(params[:id])\n end",
"def images_for_project\n project = find_or_goto_index(Project, params[:id].to_s)\n return unless project\n\n query = create_query(:Image, :for_project, project: project)\n show_selected_images(query, always_index: 1)\n end",
"def index\n @imgs = Img.order(created_at: :desc).limit(20)\n end",
"def show\n @entry = Entry.find(params[:id])\n hash = {:folder_index => 7, :entry_path => 1}\n @index_count = @entry.getImgCount(hash)\n\n hash.delete(\"entry_path\")\n hash[:count] = 5;\n @image_array = @entry.getRndImgFromDir(hash)\n @image_name = @entry.image.split(\"/\").last().split(\"_\").last().split(\".\").first()\n img = @entry.image\n #@image_name = img[img.rindex('/')+1, img.length][img.rindex('_'), img.length]\n #.split(\".\")[0]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n # proxy to GET /roi/id\n @result = ImageServer.get('/roi/'+params[:id]);\n render :json => @result\n end",
"def show\n @pictures = TourService.find(params[:id]).tour_images\n # render :show\n end"
] | [
"0.7557411",
"0.7292666",
"0.71763915",
"0.68948567",
"0.6842437",
"0.681356",
"0.6791631",
"0.6731747",
"0.66986704",
"0.6571749",
"0.65645045",
"0.6527514",
"0.6512736",
"0.65032476",
"0.65014976",
"0.64475197",
"0.6437598",
"0.64323455",
"0.635937",
"0.6353477",
"0.63495815",
"0.63466394",
"0.6345307",
"0.6334484",
"0.6326738",
"0.63053423",
"0.63048434",
"0.6296845",
"0.6288898",
"0.62860024",
"0.6273114",
"0.62420803",
"0.6233539",
"0.622592",
"0.6207924",
"0.6202163",
"0.6182531",
"0.6171607",
"0.61711055",
"0.61637884",
"0.6140216",
"0.6126241",
"0.6119729",
"0.61105585",
"0.610283",
"0.6096672",
"0.60876375",
"0.6080255",
"0.6075205",
"0.6066751",
"0.6061711",
"0.6059349",
"0.6046583",
"0.60423315",
"0.6042007",
"0.6036549",
"0.6015954",
"0.6008845",
"0.60076195",
"0.60064286",
"0.59992534",
"0.5996157",
"0.5993862",
"0.5978406",
"0.5977632",
"0.5974952",
"0.5972688",
"0.59627575",
"0.59610486",
"0.59580064",
"0.59563553",
"0.59552515",
"0.59481466",
"0.5946241",
"0.5939405",
"0.5939405",
"0.5939405",
"0.59378225",
"0.5937702",
"0.5937146",
"0.5936027",
"0.5935609",
"0.5919369",
"0.5917052",
"0.5916696",
"0.59068143",
"0.5903943",
"0.58952856",
"0.58952856",
"0.58952856",
"0.5894257",
"0.588471",
"0.58836687",
"0.587504",
"0.5871506",
"0.5849804",
"0.58497906",
"0.5846036",
"0.5845835",
"0.5843626"
] | 0.6112831 | 43 |
/upload API used by processing, returns url to image | def create
@region = Region.find_by_name(params[:name])
# if @region.secret != params[:secret]
# render :text => "404"
# return
# end
@photo = Photo.create( :photo => params[:test], :score => 1, :region => @region )
render :text => @photo.photo.url
# render :text => "http://localhost:3000/gallery/" + @photo.id.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end",
"def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end",
"def upload_file_url\n \"file://#{upload_full_path}\"\n end",
"def get_upload_url\n url_service = UploadUrlFetcher.new(@context, unsafe_params[:id])\n\n result = url_service.fetch_url(unsafe_params)\n\n render json: result\n end",
"def server_image_url(filename)\n uri = \"#{@api_url}/#{@project_id}/images/get_upload_url?filename=#{filename}&access_token=#{@access_token}\"\n get uri\n end",
"def upload_url\n return @upload_url\n end",
"def upload(image)\n imgur_image = Imgur::LocalImage.new(image, title: 'null')\n uploaded = @client.upload imgur_image\n uploaded.link\n end",
"def upload_image\n uploaded_io = params[:file]\n statut = :ok\n if uploaded_io.nil?\n json_f = {}\n else\n json_f = { location: File.join('..', 'images',\n uploaded_io.original_filename) }\n begin\n File.open(Rails.root\n .join('public', 'images',\n uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.read)\n end\n rescue IOError\n statut = :internal_server_error\n end\n end\n render json: json_f, status: statut\n end",
"def upload\n end",
"def upload\n end",
"def upload\r\n \r\n end",
"def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend",
"def img\n source = Tinify.from_file(params[:file].tempfile.path)\n if source.store(\n service: 's3',\n aws_access_key_id: ENV['AWS_Access_Key_ID'],\n aws_secret_access_key: ENV['AWS_Secret_Access_Key'],\n region: 'us-west-1',\n path: 'gkbimages//client/'+params[:file].original_filename\n )\n render :json => {status: 0, data: 'https://s3-us-west-1.amazonaws.com/gkbimages//client/'+params[:file].original_filename}\n else \n render :json => {status: 404, data: \"Something went wrong with image upload\"}\n end\n end",
"def upload_photo(file, params)\n url_str = BASE_URL + PHOTO_UPLOAD_ENDPOINT + \"?\"\n # build out url based on params of photo\n url_str = url_str + \"name=#{params['name']}&description=#{params['description']}&category=0&privacy=0\"\n\n url = URI.parse(url_str)\n File.open(file) do |jpg|\n req = Net::HTTP::Post::Multipart.new url.path, \"file\" => UploadIO.new(jpg, \"image/jpeg\", \"#{params['file_name']}.jpg\")\n add_oauth(req)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start do |https|\n res = https.request(req)\n # puts res.body\n return res.body\n end\n end\nend",
"def get_upload_url\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_upload_url, \n message: { 'wsdl:sessionID' => @session_id }\n \n @upload_url = response.body[:get_upload_url_response][:get_upload_url_result] \n end",
"def image_location\n url_opts = { :storage => params[:storage] || 'default', :preset => params[:preset] || 'default', :format => params[:format] || 'jpg' }\n raise BadRequest if request.raw_post.blank?\n base_url = params[:relative] ? '' : (request.protocol + \"://\" + request.host)\n image_uri = base_url + url_for_external_image(request.raw_post.strip, url_opts)\n self.status, headers[\"Location\"] = 301, image_uri if params[:redirect]\n image_uri\n end",
"def image_location\n url_opts = { :storage => params[:storage] || 'default', :preset => params[:preset] || 'default', :format => params[:format] || 'jpg' }\n raise BadRequest if request.raw_post.blank?\n base_url = params[:relative] ? '' : (request.protocol + \"://\" + request.host)\n image_uri = base_url + url_for_image(request.raw_post.strip, url_opts)\n self.status, headers[\"Location\"] = 301, image_uri if params[:redirect]\n image_uri\n end",
"def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend",
"def upload_url_product_image(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/products/:rid/images/upload_url(.:format)',:post,params,add_params)\n end",
"def call(params = {})\n return variant.image.url(params) unless processible_image?\n\n \"/#{uid}\"\n end",
"def image_url\n rails_blob_url(object.image)\n # This helper gets the URL from the file we pass to it\n end",
"def upload_url(url, options = {})\n params = upload_params(options).for_url_upload(url)\n file_upload_response = request_file_upload(params)\n\n handle_response(file_upload_response)\n end",
"def imgurl\n return url unless fake_url?\n # The more complicated case: we have an IR with image data, but no URL.\n # So we lookup the corresponding URL on AWS. If it exists, we return that;\n # Otherwise, we CREATE it on AWS first, then return it.\n #\n # Does the resource exist? If so, we just return the link\n path = \"uploads/reference/#{id}.png\"\n obj = S3_BUCKET.objects[path]\n unless obj.exists?\n puts 'Creating AWS file ' + path\n # The nut of the problem: take the image in the thumbdata, upload it to aws, and return the link\n b64 = thumbdata.sub 'data:image/png;base64,', ''\n img = Magick::Image.read_inline(b64).first\n S3_BUCKET.objects[path].write img.to_blob, {:acl => :public_read}\n end\n obj.public_url.to_s\n end",
"def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end",
"def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end",
"def url\n URI.join(request.url, @picture.image.url)\n end",
"def upload_derivs(img, filename)\n\n\n ret = {}\n\n # Full:\n full_path = \"#{BUCKET_FOLDER}/full/#{filename}\" # data['capture_uuid']}.#{suffix}.jpg\"\n upload_image img, full_path\n ret['file_path'] = \"https://s3.amazonaws.com/#{BUCKET_NAME}/#{full_path}\"\n\n # Thumb (exactly 150px wide by however tall):\n img.change_geometry(\"150\") { |cols, rows, img| img.resize!(cols, rows) }\n thumb_path = \"#{BUCKET_FOLDER}/thumb/#{filename}\"\n upload_image img, thumb_path\n ret['thumbnail'] = \"https://s3.amazonaws.com/#{BUCKET_NAME}/#{thumb_path}\"\n\n ret\nend",
"def upload_simple\r\n \r\n end",
"def uploading_pictures\n end",
"def image_url\n image_uri\n end",
"def upload_file\n #TODO\n end",
"def image_url\n self.filename.url \n end",
"def upload_img\n result = RestaurantManage.upload_img(@restaurant, params[:qqfile], request.body.read)\n get_restaurant()\n render json: result\n end",
"def image_url\n image.url\n end",
"def get_upload_url\n # raise 'Login first!' unless @customer_login_id\n\n response = @soap_client.call :get_upload_url, \n message: { 'wsdl:sessionID' => @session_id }\n \n @upload_url = response.body[:get_upload_url_response][:get_upload_url_result] \n end",
"def path_to_image(source)\n path = super(source)\n if @generate_urls_with_host\n protocol = request.protocol()\n path = protocol + request.host_with_port() + path\n end\n return path\n end",
"def unit_url\n is_processed ?\n FileSystem.url(unit_path) :\n orig_image_url\n end",
"def image_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.image_file_url = params[:image_file_url]\n if ar_object.save\n @messages = 'fleximage updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.image_domid(ar_object),\n render(:partial => \"/main/image_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end",
"def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end",
"def upload_image(filename)\n\n # Create URI::HTTP\n uri = URI.parse(K_Google_Sbi)\n\n response = Net::HTTP.start(uri.host, uri.port){|http|\n\n # -----\n # request instance\n request = Net::HTTP::Post.new(uri.path)\n request[\"user-agent\"] = K_User_Agent\n request[\"content-type\"] = \"multipart/form-data; boundary=myboundary\"\n \n # -----\n # request body\n # (see also multipart/form-data spec)\n body = \"\"\n body.concat(\"--myboundary\\r\\n\")\n body.concat(\"content-disposition: form-data; name=\\\"#{K_Field_Name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\")\n body.concat(\"\\r\\n\")\n File::open(filename){|f| body.concat(f.read + \"\\r\\n\") }\n \n body.concat(\"--myboundary--\\r\\n\")\n request.body = body\n \n # send request!\n http.request(request)\n }\n \n return response\nend",
"def upload_image(image_url)\n uri = \"#{@api_url}/#{@project_id}/images/upload_from_url?url=#{image_url}&access_token=#{@access_token}\"\n result = post uri\n result['ok'] ? result['result']['id'] : false\n end",
"def path\n \"/#{UPLOAD_DIR}/#{filename}\"\n end",
"def file_url\n end",
"def image_from_url(url)\n self.image = open(url)\n self.direct_upload_url = \"none\"\n end",
"def download_image(src_url,dest_path)\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\")\n content_type = content_type.gsub(\"pjpeg\",\"jpg\")\n content_type = content_type.gsub(\"jpeg\",\"jpg\")\n vortex_url = download_resource(src_url,dest_path,content_type)\n return vortex_url\nend",
"def upload_image\n image_file = ImageFile.new(params)\n\n delete_image() unless @collection.image.nil?\n\n @image = @collection.build_image({ extension: image_file.extension })\n\n unless @image.save\n render json: @image.errors, status: :unprocessable_entity; return\n end\n\n image_file.name = @image._id\n image_processor = CollectionImageProcessor.new(collection_id, image_file)\n\n if image_processor.save_image\n render json: @collection, status: :ok#, location: @collection\n else\n render json: image_processor.errors, status: :unprocessable_entity\n end\n end",
"def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end",
"def upload_photo(cocktail_id)\n cocktailloader = Cocktailloader.find_by(mrcock_id: cocktail_id)\n cocktail = Cocktail.find(cocktail_id)\n img = cocktailloader.strDrinkThumb if cocktailloader\n cocktail.remote_photo_url = img if img\n puts \"photo saved\"\n cocktail.save\nend",
"def get_image\n source_file = Item.new(Path.new(params[:source]+\".\"+params[:type]))\n begin\n send_file source_file.path, :filename => source_file.path.basename.to_s, :type => \"image/#{params[:type]}\"\n rescue \n not_found\n end\n end",
"def postEntityImageBy_url( entity_id, image_url, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['image_url'] = image_url\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image/by_url\",params)\n end",
"def upload_client(target_uri, file_size, method)\n return {} if target_uri.nil? || method.nil?\n\n uri = URI.parse(target_uri)\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n\n begin\n req = Net::HTTP::Post.new(uri.request_uri)\n req[\"Content-Type\"] = \"image/jpeg\"\n req[\"Content-Length\"] = file_size\n\n response = https.request(req)\n\n puts \"code -> #{response.code}\"\n puts \"body -> #{response.body}\"\n rescue => e\n logger.error [uri.to_s, e.class, e].join(\" : \")\n return nil\n end\n\n end",
"def image_path\n thumbnail_url\n end",
"def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end",
"def giant_url\n is_processed ?\n FileSystem.url(giant_path) : \n orig_image_url\n end",
"def pull_image(value)\n user_hash = pull_records(value)\n id = user_hash[0][\"id\"]\n image_name = user_hash[0][\"image\"]\n image = \"images/uploads/#{id}/#{image_name}\"\nend",
"def image\n #__log_activity\n # __debug_route\n response = Faraday.get(params[:url]) # TODO: caching\n image_data = Base64.encode64(response.body)\n mime_type = response.headers['content-type']\n render plain: image_data, format: mime_type, layout: false\n end",
"def upload_file(upload, user, client_name)\n if upload != nil\n if user.link_picture != nil\n File.delete('public/images/' << user.link_picture)\n end\n name = upload['img'].original_filename\n directory = 'public/images/' + client_name + '/users/' + user.username\n path = File.join(directory, name)\n File.open(path, 'wb') { |f| f.write(upload['img'].read) }\n path_img = client_name + '/users/' + user.username + '/' + name\n User.where(:id => user.id).update_all(link_picture: path_img)\n end\n end",
"def migrate_user url, user\n \n # make sure the url contains file stack\n return unless url.start_with? 'https://cdn.filepicker.io'\n\n open('migrated.jpg', 'wb') do |file|\n \n file << open(url).read\n \n #upload the file to the user\n attachment = ActionDispatch::Http::UploadedFile.new(tempfile: file, filename: \"migrated\", type: \"image/jpg\")\n user.avatar_src = attachment\n user.save!\t\n end\nend",
"def upload_weathermap_image(upload, current_user_guid, org_token, options={})\n return if upload.length==0\n self.init_uploaded_file(upload, 'WeatherMap Image', current_user_guid,\n options)\n\n oi = XmlSaving.store_original_file(@file_path, self.guid, @input_category, @mime_type) if is_file_upload\n oi = XmlSaving.store_original_input(upload, self.guid, @input_category, @mime_type) if !is_file_upload\n\n # Store the WeatherMap Images record\n WeatherMapImage.create(organization_token: org_token, image_id: oi.id)\n\n self.status = ActionStatus::SUCCEEDED\n self.save\n IngestUtilities.cleanup(self, @file_path)\n rescue Exception => e\n IngestUtilities.add_error(self, \"#{e.backtrace.first}: #{e.message} (#{e.class})\")\n ExceptionLogger.debug(\"exception: #{e}, message: #{e.message}, backtrace: #{e.backtrace}\")\n self.save\n IngestUtilities.cleanup(self, @file_path)\n end",
"def post_image(url, filename)\n post(url) do |req|\n req.body = open(filename).read\n end\n end",
"def upload_image_from_url(_image_url)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n b_frame = @browser.find_element(:xpath => @mlgm.media_browser_frame)\n @browser.switch_to.frame(b_frame)\n wait.until { @browser.find_element(:xpath => @mlgm.image_from_url) }.click\n temp = wait.until { @browser.find_element(:xpath => @mlgm.url_edit) }\n temp.clear\n temp.send_keys(_image_url)\n wait.until { @browser.find_element(:xpath => @mlgm.submit_image) }.click\n s_frame = wait.until { @browser.find_element(:xpath => @mlgm.media_style_frame) }\n @browser.switch_to.frame(s_frame)\n wait.until { @browser.find_element(:xpath => @mlgm.confirm_image_submit) }.click\n @browser.switch_to.default_content\n end",
"def thumb\n map = Map.find(params[:id])\n thumb = map.upload.url(:thumb)\n redirect_to thumb\n end",
"def square_url\n is_processed ?\n FileSystem.url(square_path) : \n orig_image_url\n end",
"def multipart_upload\n end",
"def upload_file(file_upload, owner)\n image = MiniMagick::Image.open(file_upload.tempfile.path)\n image.resize \"500x500>\"\n image.format \"jpeg\"\n\n tempfile = Tempfile.new \"item_picture\"\n image.write(tempfile)\n\n owner = \"#{current_user.id}/#{owner}\"\n\n upload = Upload.find_by(owner: owner) || Upload.new(owner: owner)\n\n upload.mime_type = \"image/jpeg\"\n upload.extension = \".jpeg\"\n upload.body = tempfile.read\n\n if upload.save\n StoreUploadToCloudJob.perform_later upload\n\n upload\n end\n end",
"def image_url\n Image.find(image_id).url\n end",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def thumb\n map = Map.find(params[:id])\n thumb = map.upload.url(:thumb)\n \n redirect_to thumb\n end",
"def create_image_with_url(name, type, container_uuid, url)\n @logger.debug(\"Creating image from url #{url}\")\n spec = { name: name, annotation: name, image_type: type,\n image_import_spec: {\n storage_container_uuid: container_uuid, url: url\n } }\n @logger.debug(\"Image creation specs => #{spec}\")\n task = JSON.parse(@client.post('v2.0', 'images', spec.to_json))\n task_uuid = task['task_uuid']\n # Timeout is set to 60 minutes as image upload may take time\n TaskManager.wait_on_task(task_uuid, @client, @logger, 60 * 60)\n rescue => e\n raise e\n end",
"def img_upload(file)\n\t \t# puts \"++++ #{file.inspect} ++++\"\n\t \tpath=File.dirname(__FILE__) + '/public/uploads/' + file[:filename]\n\t \t# puts \"///////\"\n\t \t# puts path\n\t \tFile.open(path, \"w\") do |upload|\n\t \t\tupload.write(file[:tempfile].read)\n\t end\n\t return file[:filename]\n\t end",
"def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)\n instrument :url, key: key do |payload|\n verified_token_with_expiration = ActiveStorage.verifier.generate(\n {\n key: key,\n content_type: content_type,\n content_length: content_length,\n checksum: checksum\n },\n { expires_in: expires_in,\n purpose: :blob_token }\n )\n\n generated_url = url_helpers.update_rails_imgur_service_url(verified_token_with_expiration, host: current_host)\n\n payload[:url] = generated_url\n generated_url\n end\n end",
"def b2_get_upload_url()\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n bucket_id = ENV['bucket_id']\n\n uri = URI(\"#{api_url}/b2api/v1/b2_get_upload_url\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"bucketId\\\":\\\"#{bucket_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend",
"def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend",
"def serve_image\n\n # http://stackoverflow.com/questions/9462785/referencing-model-with-string-input\n # https://github.com/carrierwaveuploader/carrierwave/issues/614\n # model.avatar.file.filename\n # model[:avatar]\n # model.avatar_identifier\n # File.basename(model.file.path)\n\n\n if params[:id] && params[:model] && params[:type] && params[:id_image] && params[:uploader]\n\n model = params[:model].singularize.classify.constantize.find(params[:id_image])\n name = model.read_attribute(params[:uploader].to_s)\n image_name = \"#{params[:type]}_#{name}\"\n\n image_path = File.join(Rails.root,\"images\",Rails.env, params[:model], params[:uploader], params[:id_image],image_name)\n\n unless send_file( image_path,disposition: 'inline', type: 'image/jpeg', x_sendfile: true )\n return \"some default image\" # ensure views have css defining the size of thumbnail, that way default image is the proper size\n end\n end\n\n end",
"def url(options = {})\n image = image_file\n\n raise MissingImageFileError, \"Missing image file for #{inspect}\" if image.nil?\n\n image = processed_image(image, options)\n image = encoded_image(image, options)\n\n image.url(options.except(*TRANSFORMATION_OPTIONS).merge(name: name))\n rescue MissingImageFileError, WrongImageFormatError => e\n log_warning e.message\n nil\n end",
"def imgurl\n picref.imgurl if picref\n end",
"def upload_to_flickr!\n # download image to tmp/\n photo_path = download_from_instagram\n @log.debug(\"Path is #{photo_path}\")\n # upload to flickr\n flickr.access_token = @params['flickr_access_token']\n flickr.access_secret = @params['flickr_access_secret']\n response = flickr.upload_photo photo_path, :title => @payload['title'], :description => @payload['caption'] \n @log.debug(\"Flickr Response = #{response}\")\n # push it into the Redii and delete local version.\n add_to_storage\n File.delete(photo_path)\n end",
"def upload(name, url, digest = nil)\n \n r = request('UploadTemplate', { :name => name, :url => url, :digest => digest})\n \n { :status => r['status'] == ' ok ', :blocks => r['blocks'] }\n end",
"def url\n return nil unless @uploader.upyun_bucket_host\n\n [@uploader.upyun_bucket_host, @path].join(\"/\")\n end",
"def image\n @sys_image = resource_find(params[:id])\n uploaded_io = params[:file]\n _size = File.size(uploaded_io)\n write_resource(@sys_image, uploaded_io.read, \"ndz\")\n redirect_to(@sys_image) \n end",
"def thumbnail_url\n is_processed ? \n FileSystem.url(thumbnail_path) :\n orig_image_url\n end",
"def groupme_url_from_io(io)\n conn = Faraday.new(UPLOAD_HOST) do |f|\n f.request :multipart\n f.request :url_encoded\n f.response :json\n f.adapter :httpclient\n end\n\n token = bot.config['groupme']['token']\n file = Faraday::UploadIO.new(io, 'application/octet-stream')\n\n res = conn.post UPLOAD_PATH, 'token' => token, 'file' => file\n res.body['payload']['url']\n end",
"def upload_image\r\n @venue = Venue.find(params[:id])\r\n if request.post? \r\n # picture too big or wrong format return\r\n if params[:picture][:uploaded_picture] == ''\r\n flash[:image] = Resource.get(\"venue_image_instructions\")\r\n return\r\n end \r\n # if a picture exists its an update\r\n if @venue.image > 0 and Picture.find(@venue.image)\r\n @picture = Picture.find(@venue.image)\r\n if @picture.update_attributes(params[:picture]) \r\n @picture = nil\r\n @picture = Picture.find(@venue.image)\r\n # all ok\r\n @picture_available = 1\r\n end \r\n # otherwise its a new image\r\n else \r\n @picture = Picture.new(params[:picture])\r\n if @picture.save \r\n @venue.image = @picture.id\r\n @venue.save\r\n @picture = nil\r\n @picture = Picture.find(@venue.image)\r\n # saved\r\n @picture_available = 1\r\n end \r\n end \r\n # request via get\r\n else \r\n # if a picture exists add to assigns hash\r\n if @venue.image > 0 and Picture.find(@venue.image)\r\n @picture = Picture.find(@venue.image)\r\n @picture_available = 1\r\n else\r\n @picture = nil\r\n @picture_available = nil\r\n end\r\n @venue \r\n end \r\n end",
"def create_remote\n img = {}\n data = {}\n if params[:data].present?\n data = JSON.parse(params[:data]).symbolize_keys\n img = data[:image].symbolize_keys\n else\n img = params[:image]\n end\n model = @imageable.class\n former_image = @imageable.respond_to?(:images) ? nil : @imageable.image\n kind = img[:kind]\n kind = model::IMAGE_KINDS.keys.first if kind.blank? && model.const_defined?(:IMAGE_KINDS)\n image = Image.new(imageable: @imageable, kind: kind, legend: img[:legend].to_s, zoomable: (img[:zoomable].present? ? img[:zoomable] : true))\n if Figaro.env.s3_enabled.to_bool\n # Special field for carrierwave_direct's business\n image.img.key = data[:key]\n end\n if request.xhr?\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n return render(json: image, status: :ok)\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n errors = image.errors[:img]\n render json: [{ error: errors }], status: :error\n else\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n if Figaro.env.s3_enabled.to_bool && Figaro.env.js_upload_enabled.to_bool && Figaro.env.js_s3_iframe_enabled.to_bool\n return render(nothing: true)\n end\n return redirect_to({ action: :assist, id: image })\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n redirect_to parent_url, alert: \"L’image n’a pas pu être créée\"\n end\n end",
"def put_jpeg_url image, url, url_name = url\n item = [\n [Pasteboard::Type::JPEG, image],\n [Pasteboard::Type::URL, url],\n [Pasteboard::Type::URL_NAME, url_name],\n [Pasteboard::Type::UTF_8, url],\n ]\n\n put item\n end",
"def upload_picture(file, \r\n ticket_id)\r\n\r\n # Validate required parameters\r\n if file == nil\r\n raise ArgumentError.new \"Required parameter 'file' cannot be nil.\"\r\n elsif ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}/picture_upload'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # prepare parameters\r\n _parameters = {\r\n 'file' => file\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.post _query_url, headers: _headers, parameters: _parameters\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Return appropriate type\r\n _response.body\r\n end",
"def upload_new_image_url(detection_flags, image = {})\n params = {detection_flags:detection_flags}\n params[:url] = image[:url] if image[:url].present?\n params[:original_filename] = image[:url].split(\"/\")[-1] if image[:url].present? and image[:original_filename].blank?\n @client.post \"/service_json_ssl.svc/UploadNewImage_Url\", params\n end",
"def photo_from_url(url)\n end",
"def image_url\n return unless image.attached?\n\n url_for(image)\n end",
"def url\n source_url || reporter.photo_urlformat(uniqueid, 's')\n end",
"def upload_image\n render template: \"/dash/chooser/upload_image\"\n end",
"def image_url\n object.image_url\n end",
"def upload_path picture\n entity = picture.class.name.sub('Picture','').upcase\n \"PICTURE_#{entity}_PATH\".constantize\n end",
"def image_url\n if image.present?\n image\n else\n \"http://loremflickr.com/320/240/#{CGI.escape name}\"\n end\n end",
"def create_updated_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end",
"def image_url\n\t\t\t@data[\"image\"][\"source\"]\n\t\tend",
"def send_upload(apikey, external_url = nil, security = nil, options = nil)\n base = \"#{FilestackConfig::CDN_URL}/#{apikey}/#{build_store_task(options)}\"\n\n if security\n policy = security.policy\n signature = security.signature\n base = \"#{base}/security=s:#{signature},p:#{policy}\"\n end\n\n response = Typhoeus.post(\"#{base}/#{external_url}\", headers: FilestackConfig::HEADERS)\n\n if response.code == 200\n begin\n response_body = JSON.parse(response.body)\n return response_body\n rescue\n raise response.body\n end\n end\n raise response.body\n end",
"def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end",
"def url_to_image(source, options = T.unsafe(nil)); end",
"def create\n @upload_photo = UploadPhoto.new(params[:upload_photo])\n\n @upload_photo.user_id = 0 - @session_id.to_i # this will be updated when user logged in.\n @upload_photo.user_id = params[:user_id] unless params[:user_id].blank?\n\n if @upload_photo.save\n\t\t render :text => @upload_photo.data.url(:medium).split('?').first # @upload_photo.data.url(:thumb)\n else\n render :text => \"ERROR WHILE UPLOADING IMAGE\"\n end\n end",
"def image_url(source, options = T.unsafe(nil)); end"
] | [
"0.76762915",
"0.76309806",
"0.7230602",
"0.7212467",
"0.7100774",
"0.7009256",
"0.6970784",
"0.69499105",
"0.68149436",
"0.68149436",
"0.67911583",
"0.6778094",
"0.673239",
"0.6729469",
"0.6695691",
"0.667052",
"0.6664613",
"0.664523",
"0.6636087",
"0.663372",
"0.6615889",
"0.66125816",
"0.6607654",
"0.6606928",
"0.6606928",
"0.65912586",
"0.6582435",
"0.6561351",
"0.65238774",
"0.6508866",
"0.64944386",
"0.6453045",
"0.64488083",
"0.643816",
"0.6435588",
"0.6431576",
"0.6431227",
"0.6428516",
"0.6407309",
"0.6406433",
"0.64053565",
"0.639207",
"0.63865054",
"0.63636297",
"0.6355899",
"0.6350088",
"0.63317287",
"0.63300073",
"0.6309271",
"0.6295131",
"0.6290386",
"0.62859607",
"0.6267436",
"0.6265411",
"0.6237157",
"0.62187576",
"0.6209238",
"0.61829084",
"0.61766803",
"0.6174653",
"0.61730504",
"0.61713177",
"0.6171013",
"0.61680275",
"0.61656636",
"0.6164946",
"0.6162092",
"0.61617464",
"0.61550105",
"0.6154669",
"0.6150935",
"0.6145598",
"0.61321414",
"0.61283535",
"0.6125121",
"0.61112905",
"0.6106288",
"0.61049944",
"0.6093918",
"0.60921764",
"0.60901725",
"0.60884225",
"0.6086961",
"0.60852635",
"0.60830176",
"0.6080817",
"0.6077324",
"0.60734636",
"0.60720503",
"0.60653245",
"0.60613745",
"0.60601395",
"0.605831",
"0.60575765",
"0.60554767",
"0.60538906",
"0.6052709",
"0.6042294",
"0.60365796",
"0.60344934",
"0.60340035"
] | 0.0 | -1 |
GET /ad_domains GET /ad_domains.json | def index
#@ad_domains = AdDomain.all
@ad_domains = AdDomain.order("name asc").paginate :page => params[:page], :per_page => 25
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_domains\n render json: dme.show_domains\n end",
"def domains\n\tfetch(\"/Domain.List\")\nend",
"def domains_list\n call('domains.list')[:domains]\n end",
"def domains\n get()[\"app\"][\"domains\"]\n end",
"def index\n\t\t@domains = Domain.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domains }\n\t\tend\n\tend",
"def list(options = {})\n @client.get('domains', options).to_h['items']\n end",
"def domains\n render json: Url.select(:domain).distinct, each_serializer: DomainsSerializer, root: false\n end",
"def domains\n raw_data['domains']\n end",
"def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end",
"def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end",
"def get_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domains ...'\n end\n # resource path\n local_var_path = '/domains'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DomainPreview>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#get_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end",
"def domains\n @domains\n end",
"def list(domain=nil)\n if domain\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains/#{domain}\")\n else\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains\")[\"items\"] || []\n end\n end",
"def show_domain\n render json: dme.show_domain(\"#{params[:domain]}\")\n end",
"def domains\n connection.list_domains[:domains]\n end",
"def get_domains(opts = {})\n data, _status_code, _headers = get_domains_with_http_info(opts)\n data\n end",
"def index\n @domains = Domain.active.alphabetical.all\n\n render json: @domains\n end",
"def index\n @domains = Domain.all\n end",
"def domains\n []\n end",
"def domains; end",
"def get_subdomains entity_name, api_key, headers, url\n\n response = http_get_body(url,nil,headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"count\"] != 0\n # Create subdomains\n json[\"cidr\"][\"cidr16\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n # Create subdomains\n json[\"cidr\"][\"cidr24\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n\n # Create list of related organizations\n json[\"data\"][\"as\"][\"results\"].each do |e|\n _create_entity(\"Organization\", \"name\" => e[\"entity\"][\"organization\"])\n end\n\n # Create list of related countrys\n json[\"data\"][\"country\"][\"results\"].each do |e|\n _create_entity(\"PhysicalLocation\", \"name\" => e[\"entity\"][\"value\"])\n end\n\n # Create list of related IPs\n json[\"data\"][\"ip\"][\"results\"].each do |e|\n _create_entity(\"IpAddress\", \"name\" => e[\"entity\"][\"value\"])\n end\n end\n end",
"def list_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.list_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.list_domains\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.list_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<DomainResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.list_domains\",\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: DomainApi#list_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end",
"def index\n @domains = query(DOMAIN, :name)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @domains }\n end\n end",
"def getDomains()\r\n\r\n _dprint(\"getDomains() called ...\")\r\n\r\n valid_tag = \"DOMAINLIST\"\r\n _dprint(\"Getting Domains\")\r\n\r\n mesg = <<XML\r\n <transaction>\r\n <type>3</type>\r\n <data>\r\n <domain-list>null</domain-list>\r\n </data>\r\n </transaction>\r\nXML\r\n reconnect {\r\n xml = _request(mesg)\r\n domains = XPath.match(xml, '//data/domain-list')\r\n }\r\n _dprint(\"Returning Results...\")\r\n return domains\r\n end",
"def get_by_domain\n render json: Url.where(\"domain LIKE :dom\", {:dom => \"%#{params[:domain]}%\"})\n end",
"def response_domains\n self.response_domain_datetimes.to_a + self.response_domain_numerics.to_a +\n self.response_domain_texts.to_a + self.response_domain_codes.to_a\n end",
"def domains(app_env)\n domains = self.settings['domains'] || {}\n domains[app_env] || []\n end",
"def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end",
"def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end",
"def domains\n collect { |a| a.domain }\n end",
"def index\n @subdomains = Subdomain.all\n respond_with @subdomains\n end",
"def list_service_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.list_service_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling ServiceApi.list_service_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<DomainResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.list_service_domains\",\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: ServiceApi#list_service_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @domains = current_user.domains || []\n end",
"def show\n render json: @domain\n end",
"def subdomains(query)\n get('enrichment/subdomains', {'query' => query})\n end",
"def index\n @crm_domains = Crm::Domain.all\n end",
"def get_domain(session,id)\n result = @connection.rest_request(\n method: :get,\n path: \"/mps_setup/get_domain/#{id}\",\n session: session\n )\n xml = result.body.sub(/(?<=\\<n:get_domainResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:get_domainResponse).*?(?=\\>)/,\"get_domainResponse\")\n return Hash.from_xml(xml).to_json\n end",
"def list_domains(opts = {})\n data, _status_code, _headers = list_domains_with_http_info(opts)\n data\n end",
"def list\n @client.call(method: :get, path: 'tracking-domains')\n end",
"def get_languageunderstanding_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstandingApi.get_languageunderstanding_domains ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/languageunderstanding/domains\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 => 'NluDomainListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageUnderstandingApi#get_languageunderstanding_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def parse_domain_list\n search = config.scan(/(?<=^ip\\sdomain-list\\s).+$/)\n { domain_list: search }\n end",
"def domain(domain)\n get(\"/dns/domain/#{domain}\")\n end",
"def domains\n get_proxy_bypass_domains(resource[:name])\n end",
"def show\n @domain = Domain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain }\n end\n end",
"def dns(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/dns/#{target}\", params) { |json| json }\n end",
"def response_domains\n grid_rds_qs.map { |x| x.response_domain }\n end",
"def domains()\n return MicrosoftGraph::Domains::DomainsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def show\n\t\treturn status 404 if @domain.nil?\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domain }\n\t\tend\n\tend",
"def stub_list_domains(user, domain_names)\n body = { data: [], pagination: { current_page: 1, per_page: 30, total_entries: domain_names.count, total_pages: 1 } }\n domain_names.each_with_index do |domain_name, i|\n body[:data] << Hash[\n id: i + 1,\n account_id: user.uid,\n registrant_id: nil,\n name: domain_name,\n unicode_name: domain_name,\n token: \"domain-token\",\n state: \"hosted\",\n auto_renew: false,\n expires_on: nil,\n created_at: Time.now.utc.iso8601,\n updated_at: Time.now.utc.iso8601\n ]\n end\n\n stub_request(:get, \"https://api.sandbox.dnsimple.com/v2/#{user.uid}/domains\")\n .with(headers: { 'Accept' => 'application/json', 'Authorization' => \"Bearer #{user.token}\", 'User-Agent' => \"dnsimple-ruby/#{Dnsimple::VERSION} hello-domains-rails\" })\n .to_return(status: 200, body: JSON.generate(body), headers: {})\n end",
"def domain\n Domain.find_by_id(domain_id)\n end",
"def show\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @http_domain_rule }\n end\n end",
"def index\n @subdomains = Subdomain.all\n end",
"def domains(app_env)\n name, env = app_env.split(SEPARATOR)\n domains = self.settings['domains'] || {}\n domains_from_app_config = (domains[name] && domains[name][env]) || []\n domains_from_global_config = (domains['all'] && domains['all'][env]) || []\n\n domains_from_app_config + domains_from_global_config\n end",
"def results\n get_domain_data\n end",
"def read_domains(org_guid = nil, space_guid = nil)\n domains = []\n\n type = space_guid == nil ? (org_guid == nil ? :none : :org) : :space\n\n cc_domains = @client.domains\n domains_api = case type\n when :org then @client.organization(org_guid).domains + cc_domains.select { |cc_domain| cc_domain.owning_organization == nil }\n when :space then @client.space(space_guid).domains\n else cc_domains\n end\n\n domains_api.each do |domain_api|\n owning_org = domain_api.owning_organization\n owning_org_name = owning_org == nil ? \"Shared\" : owning_org.name\n\n domain_name = domain_api.name\n domain_wildcard = domain_api.wildcard\n domain_spaces = domain_api.spaces rescue []\n domain_guid = domain_api.guid\n\n domains << Domain.new(domain_name, domain_wildcard, owning_org_name, domain_spaces, domain_guid)\n end\n\n domains.uniq {|domain| domain.name }\n end",
"def index\n # @budget_domains = current_user.budget_domains\n end",
"def check_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.check_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.check_domains\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.check_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain/check_all'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Array>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.check_domains\",\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: DomainApi#check_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @short_domain = ShortDomain.find(params[:id], :include => { :short_urls => :short_domain })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @short_domain }\n end\n end",
"def list_service_domains(opts = {})\n data, _status_code, _headers = list_service_domains_with_http_info(opts)\n data\n end",
"def custom_domains(node_id)\n get(node_id)['domains']['custom_domains']\n end",
"def subdomain(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/subdomain/#{target}\", params) { |json| json }\n end",
"def entries\n STDOUT.puts db.entries(@params[:domain]).map{|row| row.to_parsed_h}.to_json\n end",
"def check_domains(opts = {})\n data, _status_code, _headers = check_domains_with_http_info(opts)\n data\n end",
"def index\n @ensembl_subdomains = EnsemblSubdomain.all\n end",
"def initialize\n @domains = []\n end",
"def domain\n @domain = Domain.find( \n params[:id], \n :user => current_user\n )\n end",
"def add_domain_list(name)\n configure \"ip domain-list #{name}\"\n end",
"def show\n @domain = Domain.find(params[:id])\n end",
"def get_domains(node, appname, env = 'getcourse')\n unless node.fetch('deploy', {}).fetch(appname, {})['domains'].nil?\n return node['deploy'][appname]['domains'].join(' ')\n end\n\n unless node.fetch('vagrant', {}).fetch('applications', {}).fetch(appname, {})['domain_name'].nil?\n domains = node['vagrant']['applications'][appname]['domain_name']\n if domains.is_a?(String)\n return domains\n else\n return domains.join(' ')\n end\n end\n\n unless node.fetch(env, {}).fetch('domain', {})[appname].nil?\n Chef::Log.warn(\"Using old node[#{env}]['domain'][appname] domain config\")\n return node[env]['domain'][appname]\n end\n\n ''\n end",
"def parse_for_urls(doc, domains)\n\tlinks = doc.search('//*[@id=\"wg0\"]/li/div/div/div[1]/h3/a')\n\tlinks.each do |link|\n\t\tdomain = get_host_name(link.attributes['href'])\n\t\tdomains[domain] = link.inner_text\n\tend\n\treturn domains\nend",
"def get_domain\n @domain\n end",
"def domain\n try_opt(:domain)\n end",
"def get_domain_info(sld, tld)\n query_push 'Command' => 'GetDomainInfo', 'SLD' => sld, 'TLD'=> tld\n get_response\n end",
"def set_ad_domain\n @ad_domain = AdDomain.find(params[:id])\n end",
"def getDomain\n @domain\n end",
"def get_domain(opts = {})\n data, _status_code, _headers = get_domain_with_http_info(opts)\n data\n end",
"def all_domains(page: nil, per: nil, params:, requester: nil)\n filter_sql = qualified_domain_ids(params[:domain_filter])\n\n # get sorting rules\n sorts = params.fetch(:sort, {}).first || []\n sort = %w[name registrar_name valid_to].include?(sorts.first) ? sorts.first : 'valid_to'\n order = %w[asc desc].include?(sorts.second) ? sorts.second : 'desc'\n\n # fetch domains\n domains = qualified_domain_name_list(requester, filter_sql)\n domains = domains.includes(:registrar).page(page).per(per)\n\n # using small rails hack to generate outer join\n domains = if sorts.first == 'registrar_name'.freeze\n domains.where.not(registrars: { id: nil })\n .order(\"registrars.name #{order} NULLS LAST\")\n else\n domains.order(\"#{sort} #{order} NULLS LAST\")\n end\n\n # adding roles. Need here to make faster sqls\n domain_c = Hash.new([])\n registrant_domains.where(id: domains.map(&:id)).each do |d|\n domain_c[d.id] |= ['Registrant'.freeze]\n end\n\n DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each do |d|\n domain_c[d.domain_id] |= [d.type]\n end\n\n domains.each { |d| d.roles = domain_c[d.id].uniq }\n domains\n end",
"def find_domain(id)\n debug \"Finding domain #{id}\"\n if link = api.link_href(:SHOW_DOMAIN, ':name' => id)\n request(:url => link, :method => \"GET\")\n else\n domains.find{ |d| d.name.downcase == id.downcase }\n end or raise DomainNotFoundException.new(\"Domain #{id} not found\")\n end",
"def get_domain_data\n get_stored_paths.inject({ 'domain' => base_uri.hostname, 'paths' => {}}) do |hsh, path|\n hsh['paths'][path] = get_path_data(path)\n hsh\n end\n end",
"def index\n @dns = Dn.all\n end",
"def organization(domain)\n _get(\"/query/dataleaks/organization/#{domain}\") { |json| json }\n end",
"def owned_subdomains\n companies.map(&:subdomain) + advised_companies.map(&:subdomain)\n end",
"def domains\n @_domains ||= mxers.map { |m| Host.new(m.first).domain_name }.sort.uniq\n end",
"def index\n @dns_entries = DnsEntry.all\n end",
"def delete_agent_domain\n return false unless validate_domain\n render json: dme.delete_domain(params[:domain])\n end",
"def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end",
"def index\n @dns_device_assocs = DnsDeviceAssoc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dns_device_assocs }\n end\n end",
"def index\n @virtual_domains = VirtualDomain.all\n end",
"def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end",
"def domains_master_names\n self.domains.pluck(:name)\n end",
"def domain\n @domain\n end",
"def domain\n @domain\n end",
"def index\n @tmp_domain_names = TmpDomainName.all\n end",
"def show\n @domain_map = DomainMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def search_subdomains entity_name, headers\n\n # Set the URL for ip open ports\n url2 = \"https://api.spyse.com/v3/data/domain/subdomain?limit=100&domain=#{entity_name}\"\n\n # make the request\n response2 = http_get_body(url2,nil,headers)\n json2 = JSON.parse(response2)\n\n json2[\"data\"][\"items\"].each do |result|\n\n # Create related subdomains\n create_dns_entity_from_string(result[\"name\"], nil, false, { \"extended_spyse\" => result})\n\n # Create SslCertificate\n if result[\"cert_summary\"][\"fingerprint_sha256\"] != \"\"\n #_create_entity(\"SslCertificate\", \"name\" => result[\"cert_summary\"][\"fingerprint_sha256\"], \"extended_spyse\" => result[\"cert_summary\"])\n end\n\n # Create related IpAddress, physical location and ISP organization\n # if result[\"dns_records\"]\n # result[\"dns_records\"][\"A\"].each do |ip_result|\n # if ip_result[\"ip\"] != \"\"\n # _create_entity(\"IpAddress\", \"name\" => ip_result[\"ip\"], \"extended_spyse\" => ip_result)\n # end\n # if ip_result[\"country\"] != \"\"\n # _create_entity(\"PhysicalLocation\", \"name\" => ip_result[\"country\"])\n # end\n # if ip_result[\"org\"] != \"\"\n # _create_entity(\"Organization\", \"name\" => ip_result[\"org\"])\n # end\n # end\n # end\n\n end\n end",
"def domain\n @domain ||= 'https://api.sirportly.com'\n end",
"def get_domain_count\n query_push 'Command' => 'GetDomainCount'\n get_response\n end",
"def get_by_id_with_http_info(domain_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainsApi.get_by_id ...'\n end\n # verify the required parameter 'domain_id' is set\n if @api_client.config.client_side_validation && domain_id.nil?\n fail ArgumentError, \"Missing the required parameter 'domain_id' when calling DomainsApi.get_by_id\"\n end\n # resource path\n local_var_path = '/cms/v3/domains/{domainId}'.sub('{' + 'domainId' + '}', CGI.escape(domain_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Domain'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"DomainsApi.get_by_id\",\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: DomainsApi#get_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.7707752",
"0.76426905",
"0.74041206",
"0.7386878",
"0.7279645",
"0.7222806",
"0.7068997",
"0.70481753",
"0.69936115",
"0.6979934",
"0.6912498",
"0.6842025",
"0.6822738",
"0.68227273",
"0.68019074",
"0.67960876",
"0.6770521",
"0.6767098",
"0.6765649",
"0.6753531",
"0.6709583",
"0.6588858",
"0.65846443",
"0.65836185",
"0.6568563",
"0.656786",
"0.65447384",
"0.6475799",
"0.6466747",
"0.6409678",
"0.6409678",
"0.6387899",
"0.63789284",
"0.6362414",
"0.6352091",
"0.63504744",
"0.6350441",
"0.63411254",
"0.631874",
"0.63104147",
"0.6306412",
"0.63012403",
"0.62848336",
"0.62786335",
"0.6272282",
"0.6227633",
"0.6224788",
"0.61923826",
"0.61735725",
"0.6155568",
"0.6139416",
"0.6075808",
"0.60046506",
"0.5957291",
"0.59386986",
"0.58972657",
"0.5892158",
"0.58891577",
"0.5878588",
"0.58671874",
"0.58636886",
"0.5859972",
"0.58419496",
"0.58242005",
"0.5816806",
"0.58157927",
"0.5802719",
"0.5788717",
"0.57862335",
"0.5777825",
"0.57743144",
"0.5773077",
"0.5747366",
"0.57394254",
"0.5739236",
"0.5738009",
"0.57290834",
"0.5728932",
"0.57151306",
"0.57137215",
"0.5711613",
"0.5703449",
"0.5687522",
"0.5663104",
"0.5661891",
"0.56395626",
"0.56269604",
"0.5625387",
"0.5612707",
"0.56008536",
"0.5594453",
"0.55663556",
"0.55500644",
"0.55500644",
"0.55484295",
"0.55397546",
"0.5533042",
"0.55316716",
"0.55306894",
"0.5524046"
] | 0.61448765 | 50 |
GET /ad_domains/1 GET /ad_domains/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_domains\n render json: dme.show_domains\n end",
"def domains\n\tfetch(\"/Domain.List\")\nend",
"def show_domain\n render json: dme.show_domain(\"#{params[:domain]}\")\n end",
"def index\n\t\t@domains = Domain.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domains }\n\t\tend\n\tend",
"def show\n @domain = Domain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain }\n end\n end",
"def domains_list\n call('domains.list')[:domains]\n end",
"def show\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @http_domain_rule }\n end\n end",
"def index\n @domains = Domain.all\n end",
"def get_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domains ...'\n end\n # resource path\n local_var_path = '/domains'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DomainPreview>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#get_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @domains = Domain.active.alphabetical.all\n\n render json: @domains\n end",
"def domains\n get()[\"app\"][\"domains\"]\n end",
"def get_domain(session,id)\n result = @connection.rest_request(\n method: :get,\n path: \"/mps_setup/get_domain/#{id}\",\n session: session\n )\n xml = result.body.sub(/(?<=\\<n:get_domainResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:get_domainResponse).*?(?=\\>)/,\"get_domainResponse\")\n return Hash.from_xml(xml).to_json\n end",
"def show\n render json: @domain\n end",
"def show\n\t\treturn status 404 if @domain.nil?\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domain }\n\t\tend\n\tend",
"def domain(domain)\n get(\"/dns/domain/#{domain}\")\n end",
"def domains\n render json: Url.select(:domain).distinct, each_serializer: DomainsSerializer, root: false\n end",
"def get_subdomains entity_name, api_key, headers, url\n\n response = http_get_body(url,nil,headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"count\"] != 0\n # Create subdomains\n json[\"cidr\"][\"cidr16\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n # Create subdomains\n json[\"cidr\"][\"cidr24\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n\n # Create list of related organizations\n json[\"data\"][\"as\"][\"results\"].each do |e|\n _create_entity(\"Organization\", \"name\" => e[\"entity\"][\"organization\"])\n end\n\n # Create list of related countrys\n json[\"data\"][\"country\"][\"results\"].each do |e|\n _create_entity(\"PhysicalLocation\", \"name\" => e[\"entity\"][\"value\"])\n end\n\n # Create list of related IPs\n json[\"data\"][\"ip\"][\"results\"].each do |e|\n _create_entity(\"IpAddress\", \"name\" => e[\"entity\"][\"value\"])\n end\n end\n end",
"def domain\n Domain.find_by_id(domain_id)\n end",
"def show\n @domain = Domain.find(params[:id])\n end",
"def get_by_domain\n render json: Url.where(\"domain LIKE :dom\", {:dom => \"%#{params[:domain]}%\"})\n end",
"def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end",
"def index\n @domains = query(DOMAIN, :name)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @domains }\n end\n end",
"def list(options = {})\n @client.get('domains', options).to_h['items']\n end",
"def show\n @short_domain = ShortDomain.find(params[:id], :include => { :short_urls => :short_domain })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @short_domain }\n end\n end",
"def list_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.list_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.list_domains\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.list_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<DomainResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.list_domains\",\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: DomainApi#list_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domain\n @domain = Domain.find( \n params[:id], \n :user => current_user\n )\n end",
"def domains\n raw_data['domains']\n end",
"def list(domain=nil)\n if domain\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains/#{domain}\")\n else\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains\")[\"items\"] || []\n end\n end",
"def dns(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/dns/#{target}\", params) { |json| json }\n end",
"def set_ad_domain\n @ad_domain = AdDomain.find(params[:id])\n end",
"def index\n @crm_domains = Crm::Domain.all\n end",
"def domains; end",
"def show\n @domain = DOMAIN.first_or_get!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domain }\n end\n end",
"def find_domain(id)\n debug \"Finding domain #{id}\"\n if link = api.link_href(:SHOW_DOMAIN, ':name' => id)\n request(:url => link, :method => \"GET\")\n else\n domains.find{ |d| d.name.downcase == id.downcase }\n end or raise DomainNotFoundException.new(\"Domain #{id} not found\")\n end",
"def index\n @subdomains = Subdomain.all\n respond_with @subdomains\n end",
"def domains\n @domains\n end",
"def list_service_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.list_service_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling ServiceApi.list_service_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<DomainResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.list_service_domains\",\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: ServiceApi#list_service_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end",
"def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end",
"def get_by_id_with_http_info(domain_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainsApi.get_by_id ...'\n end\n # verify the required parameter 'domain_id' is set\n if @api_client.config.client_side_validation && domain_id.nil?\n fail ArgumentError, \"Missing the required parameter 'domain_id' when calling DomainsApi.get_by_id\"\n end\n # resource path\n local_var_path = '/cms/v3/domains/{domainId}'.sub('{' + 'domainId' + '}', CGI.escape(domain_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Domain'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"DomainsApi.get_by_id\",\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: DomainsApi#get_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end",
"def index\n @domains = current_user.domains || []\n end",
"def get_languageunderstanding_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstandingApi.get_languageunderstanding_domains ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/languageunderstanding/domains\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 => 'NluDomainListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageUnderstandingApi#get_languageunderstanding_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domains\n []\n end",
"def index\n #@ad_domains = AdDomain.all\n @ad_domains = AdDomain.order(\"name asc\").paginate :page => params[:page], :per_page => 25\n end",
"def domains\n connection.list_domains[:domains]\n end",
"def getDomains()\r\n\r\n _dprint(\"getDomains() called ...\")\r\n\r\n valid_tag = \"DOMAINLIST\"\r\n _dprint(\"Getting Domains\")\r\n\r\n mesg = <<XML\r\n <transaction>\r\n <type>3</type>\r\n <data>\r\n <domain-list>null</domain-list>\r\n </data>\r\n </transaction>\r\nXML\r\n reconnect {\r\n xml = _request(mesg)\r\n domains = XPath.match(xml, '//data/domain-list')\r\n }\r\n _dprint(\"Returning Results...\")\r\n return domains\r\n end",
"def subdomains(query)\n get('enrichment/subdomains', {'query' => query})\n end",
"def get_domain\n @domain\n end",
"def show\n @domain_map = DomainMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def get_domain_info(sld, tld)\n query_push 'Command' => 'GetDomainInfo', 'SLD' => sld, 'TLD'=> tld\n get_response\n end",
"def new\n @short_domain = ShortDomain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @short_domain }\n end\n end",
"def check_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.check_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.check_domains\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.check_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain/check_all'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Array>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.check_domains\",\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: DomainApi#check_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve(domain_name)\n domain_name = @client.url_encode(domain_name)\n @client.call(method: :get, path: \"tracking-domains/#{domain_name}\")\n end",
"def get_domain_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domain ...'\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 DomainControllerApi.get_domain\"\n end\n # resource path\n local_var_path = '/domains/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'checkForErrors'] = opts[:'check_for_errors'] if !opts[:'check_for_errors'].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(['*/*'])\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] || 'DomainDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#get_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @domain }\n end\n end",
"def response_domains\n self.response_domain_datetimes.to_a + self.response_domain_numerics.to_a +\n self.response_domain_texts.to_a + self.response_domain_codes.to_a\n end",
"def get_domain_count\n query_push 'Command' => 'GetDomainCount'\n get_response\n end",
"def parse_domain_list\n search = config.scan(/(?<=^ip\\sdomain-list\\s).+$/)\n { domain_list: search }\n end",
"def get_domains(opts = {})\n data, _status_code, _headers = get_domains_with_http_info(opts)\n data\n end",
"def subdomain(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/subdomain/#{target}\", params) { |json| json }\n end",
"def domain\n try_opt(:domain)\n end",
"def organization(domain)\n _get(\"/query/dataleaks/organization/#{domain}\") { |json| json }\n end",
"def getDomain\n @domain\n end",
"def delete_agent_domain\n return false unless validate_domain\n render json: dme.delete_domain(params[:domain])\n end",
"def search_apility_by_domain entity_name, headers\n\n # Get the Api response\n response_body = http_get_body(\"https://api.apility.net/baddomain/#{entity_name}\",nil, headers)\n\n if response_body == \"Resource not found\"\n _log_error \"Response not found\"\n return\n end\n\n begin\n json = JSON.parse(response_body)\n rescue JSON::ParserError => e\n _log_error \"Error parsing JSON\"\n _log_error \"Response:\\n#{response_body}\"\n return\n end\n\n\n # Check if response different to nil\n if json[\"response\"]\n # Check if the domain is listed in a blacklist\n if json[\"response\"][\"domain\"][\"blacklist\"]\n #create an issue per source\n json[\"response\"][\"domain\"][\"blacklist\"].each do |e|\n source = e\n description = \"apility.io is a blacklist aggregator\"\n # Create an issue if the ip is flaged in one of the blacklists\n _create_linked_issue(\"suspicious_activity_detected\", {\n status: \"confirmed\",\n additional_description: description,\n source: source,\n proof: \"This domain was flagged as suspicious in #{source} blacklist\",\n })\n # Also store it on the entity\n blocked_list = @entity.get_detail(\"suspicious_activity_detected\") || []\n @entity.set_detail(\"suspicious_activity_detected\", blocked_list.concat([{source: source}]))\n end\n end\n\n # check if Nameserver is not empty\n if json[\"response\"][\"domain\"][\"ns\"]\n json[\"response\"][\"domain\"][\"ns\"].each do |n|\n # create Nameserver entity\n _create_entity(\"Nameserver\", \"name\" => n)\n end\n end\n\n # Create an IP entity\n _create_entity(\"IpAddress\", \"name\" => json[\"response\"][\"ip\"][\"address\"])\n\n end\n end",
"def index\n @dns_device_assocs = DnsDeviceAssoc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dns_device_assocs }\n end\n end",
"def index\n @subdomains = Subdomain.all\n end",
"def stub_list_domains(user, domain_names)\n body = { data: [], pagination: { current_page: 1, per_page: 30, total_entries: domain_names.count, total_pages: 1 } }\n domain_names.each_with_index do |domain_name, i|\n body[:data] << Hash[\n id: i + 1,\n account_id: user.uid,\n registrant_id: nil,\n name: domain_name,\n unicode_name: domain_name,\n token: \"domain-token\",\n state: \"hosted\",\n auto_renew: false,\n expires_on: nil,\n created_at: Time.now.utc.iso8601,\n updated_at: Time.now.utc.iso8601\n ]\n end\n\n stub_request(:get, \"https://api.sandbox.dnsimple.com/v2/#{user.uid}/domains\")\n .with(headers: { 'Accept' => 'application/json', 'Authorization' => \"Bearer #{user.token}\", 'User-Agent' => \"dnsimple-ruby/#{Dnsimple::VERSION} hello-domains-rails\" })\n .to_return(status: 200, body: JSON.generate(body), headers: {})\n end",
"def get_domain_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.get_domain ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n domain_name = opts[:'domain_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.get_domain\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.get_domain\"\n end\n # verify the required parameter 'domain_name' is set\n if @api_client.config.client_side_validation && domain_name.nil?\n fail ArgumentError, \"Missing the required parameter 'domain_name' when calling DomainApi.get_domain\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain/{domain_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'domain_name' + '}', CGI.escape(domain_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DomainResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.get_domain\",\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: DomainApi#get_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @dns_entries = DnsEntry.all\n end",
"def index\n # @budget_domains = current_user.budget_domains\n end",
"def index\n @dns = Dn.all\n end",
"def set_domain\n @domain = Domain.find(params[:id])\n end",
"def set_domain\n @domain = Domain.find(params[:id])\n end",
"def api_domain\n 'api.' + base_domain\n end",
"def domains(app_env)\n domains = self.settings['domains'] || {}\n domains[app_env] || []\n end",
"def load_domain(domain_id)\n client.servers.get(domain_id)\n rescue ::Libvirt::RetrieveError\n debug(\"Domain with id #{domain_id} was not found.\")\n nil\n end",
"def results\n get_domain_data\n end",
"def domain\n @domain ||= 'https://api.sirportly.com'\n end",
"def search_subdomains entity_name, headers\n\n # Set the URL for ip open ports\n url2 = \"https://api.spyse.com/v3/data/domain/subdomain?limit=100&domain=#{entity_name}\"\n\n # make the request\n response2 = http_get_body(url2,nil,headers)\n json2 = JSON.parse(response2)\n\n json2[\"data\"][\"items\"].each do |result|\n\n # Create related subdomains\n create_dns_entity_from_string(result[\"name\"], nil, false, { \"extended_spyse\" => result})\n\n # Create SslCertificate\n if result[\"cert_summary\"][\"fingerprint_sha256\"] != \"\"\n #_create_entity(\"SslCertificate\", \"name\" => result[\"cert_summary\"][\"fingerprint_sha256\"], \"extended_spyse\" => result[\"cert_summary\"])\n end\n\n # Create related IpAddress, physical location and ISP organization\n # if result[\"dns_records\"]\n # result[\"dns_records\"][\"A\"].each do |ip_result|\n # if ip_result[\"ip\"] != \"\"\n # _create_entity(\"IpAddress\", \"name\" => ip_result[\"ip\"], \"extended_spyse\" => ip_result)\n # end\n # if ip_result[\"country\"] != \"\"\n # _create_entity(\"PhysicalLocation\", \"name\" => ip_result[\"country\"])\n # end\n # if ip_result[\"org\"] != \"\"\n # _create_entity(\"Organization\", \"name\" => ip_result[\"org\"])\n # end\n # end\n # end\n\n end\n end",
"def info(domain)\n fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain\n @client.get(\"domains/#{domain}\").to_h!\n end",
"def list\n @client.call(method: :get, path: 'tracking-domains')\n end",
"def domains\n get_proxy_bypass_domains(resource[:name])\n end",
"def create\n @domain = Domain.new(domain_params)\n\n if @domain.save\n render json: @domain, status: :created, location: @domain\n else\n render json: @domain.errors, status: :unprocessable_entity\n end\n end",
"def index\n @cdn_configs = CdnConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cdn_configs }\n end\n end",
"def get_domain_data\n get_stored_paths.inject({ 'domain' => base_uri.hostname, 'paths' => {}}) do |hsh, path|\n hsh['paths'][path] = get_path_data(path)\n hsh\n end\n end",
"def domain\n @domain\n end",
"def domain\n @domain\n end",
"def activate_domain(session,id,active)\n result = @connection.rest_request(\n method: :get,\n path: \"/mps_setup/activate_domain/#{id}/#{active}\",\n session: session\n )\n xml = result.body.sub(/(?<=\\<n:activate_domainResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:activate_domainResponse).*?(?=\\>)/,\"activate_domainResponse\")\n return Hash.from_xml(xml).to_json\n end",
"def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end",
"def getDomain(payload)\n\tdomainName = \"\"\n\t\n\twhile true\n\n\t\t# Get length of domain name section\n\t\tlength = payload[0].unpack('c*')[0]\n\t\t#length = payload[0].to_i\n\n\t\tif(length != 0)\n\n\t\t\t# Add domain section to overall domain name string\n\t\t\tdomainName += payload[1, length] + \".\"\n\t\t\tpayload = payload[length + 1..-1]\n\t\telse\n\t\t\t# Return overall domain name string\n\t\t\treturn domainName = domainName[0, domainName.length - 1]\n\t\tend\n\tend\n\tputs \"Domain Info: \" + domainName\nend",
"def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end",
"def initialize\n @domains = []\n end",
"def domain\n @attributes[:domain]\n end",
"def domain\n @attributes[:domain]\n end",
"def create\n @ad_domain = AdDomain.new(ad_domain_params)\n #authorize! :create, @ad_domain\n\n respond_to do |format|\n if @ad_domain.save\n format.html { redirect_to @ad_domain, notice: 'Active Directory domain was successfully created.' }\n format.json { render :show, status: :created, location: @ad_domain }\n else\n format.html { render :new }\n format.json { render json: @ad_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def domain\n @domain ||= self.domain_id ? Domain.find_by_id(self.domain_id) : nil\n end",
"def domain\n @domain ||= self.domain_id ? Domain.find_by_id(self.domain_id) : nil\n end",
"def domain\n settings.service.domain \n end",
"def create_agent_domain\n return false unless validate_params\n puts '########## CREATING DOMAIN ##########'\n dme.create_domain(params[:domain])\n puts '########## CREATING DEFAULT RECORDS ##########'\n create_default_records\n puts '########## CREATING ADDITIONAL RECORDS ##########'\n create_additional_records\n puts '########## RENDERING DATA TO CLIENT##########'\n show_domain\n end"
] | [
"0.7409508",
"0.7155722",
"0.70655483",
"0.7014493",
"0.6839358",
"0.6675204",
"0.66522604",
"0.66339266",
"0.6592849",
"0.6574667",
"0.65659446",
"0.65580225",
"0.65531814",
"0.6524862",
"0.651711",
"0.6517048",
"0.64981836",
"0.64917034",
"0.6484045",
"0.64769214",
"0.64749765",
"0.6461568",
"0.6449179",
"0.6446318",
"0.6414689",
"0.6360721",
"0.62514377",
"0.62341887",
"0.62141037",
"0.6192759",
"0.6178118",
"0.6165597",
"0.61640674",
"0.6147943",
"0.6141028",
"0.60950536",
"0.60815823",
"0.6067326",
"0.60614634",
"0.60486805",
"0.60408",
"0.60068315",
"0.6003644",
"0.5986433",
"0.5966426",
"0.59535605",
"0.5928144",
"0.59183073",
"0.591011",
"0.5898033",
"0.58931506",
"0.58863336",
"0.58831066",
"0.58501166",
"0.5850095",
"0.5836331",
"0.58322096",
"0.5829967",
"0.5829177",
"0.5827801",
"0.5827495",
"0.5814222",
"0.58000714",
"0.5796354",
"0.5795611",
"0.57948285",
"0.57925606",
"0.57597953",
"0.5757092",
"0.5751457",
"0.57492495",
"0.5746557",
"0.572881",
"0.5724553",
"0.5724553",
"0.57099956",
"0.5699021",
"0.56789285",
"0.5653332",
"0.56477743",
"0.56424177",
"0.5638484",
"0.56302154",
"0.5619794",
"0.5611151",
"0.55787593",
"0.55737567",
"0.5572692",
"0.5572692",
"0.5566762",
"0.5559778",
"0.5536206",
"0.55304646",
"0.552881",
"0.55268145",
"0.55268145",
"0.5523758",
"0.5522322",
"0.5522322",
"0.55173975",
"0.55051416"
] | 0.0 | -1 |
POST /ad_domains POST /ad_domains.json | def create
@ad_domain = AdDomain.new(ad_domain_params)
#authorize! :create, @ad_domain
respond_to do |format|
if @ad_domain.save
format.html { redirect_to @ad_domain, notice: 'Active Directory domain was successfully created.' }
format.json { render :show, status: :created, location: @ad_domain }
else
format.html { render :new }
format.json { render json: @ad_domain.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_agent_domain\n return false unless validate_params\n puts '########## CREATING DOMAIN ##########'\n dme.create_domain(params[:domain])\n puts '########## CREATING DEFAULT RECORDS ##########'\n create_default_records\n puts '########## CREATING ADDITIONAL RECORDS ##########'\n create_additional_records\n puts '########## RENDERING DATA TO CLIENT##########'\n show_domain\n end",
"def create\n @domain = Domain.new(domain_params)\n\n if @domain.save\n render json: @domain, status: :created, location: @domain\n else\n render json: @domain.errors, status: :unprocessable_entity\n end\n end",
"def post(org_key, domain)\n HttpClient::Preconditions.assert_class('org_key', org_key, String)\n HttpClient::Preconditions.assert_class('domain', domain, Apidoc::Models::Domain)\n @client.request(\"/domains/#{CGI.escape(org_key)}\").with_json(domain.to_json).post { |hash| Apidoc::Models::Domain.new(hash) }\n end",
"def show_domains\n render json: dme.show_domains\n end",
"def ad_domain_params\n params.require(:ad_domain).permit(:name, :description, :active)\n end",
"def delete_agent_domain\n return false unless validate_domain\n render json: dme.delete_domain(params[:domain])\n end",
"def create(values)\n @client.call(method: :post, path: 'tracking-domains', body_values: values)\n end",
"def create\n @domain = Domain.new(domain_params.merge({:user_id => current_user.id}))\n respond_to do |format|\n if @domain.save\n format.html { redirect_to @domain, notice: 'Domain was successfully created.' }\n format.json { render action: 'show', status: :created, location: @domain }\n else\n format.html { render action: 'new' }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def register_domain(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/apple-pay/domains'\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\n @crm_domain = Crm::Domain.new(crm_domain_params)\n\n respond_to do |format|\n if @crm_domain.save\n format.html { redirect_to @crm_domain, notice: 'Domain was successfully created.' }\n format.json { render :show, status: :created, location: @crm_domain }\n else\n format.html { render :new }\n format.json { render json: @crm_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_languageunderstanding_domains(body, opts = {})\n data, _status_code, _headers = post_languageunderstanding_domains_with_http_info(body, opts)\n return data\n end",
"def writeDomains(domains)\n\t#SSconfig\n\tssconfigText = File.read($ssconfig)\n\tnewssconfig = ssconfigText.gsub(/web_domains=.*/, \"web_domains=\" + getSSConfigStringFromDomainsArray(domains))\n\tFile.open($ssconfig, \"w\") { |file| file.puts newssconfig }\n\n\t#Ejabberd\n\tejabbberdText = File.read($ejabberd)\n\tnewEjabberdconfig = ejabbberdText.gsub(/^{hosts, .*/, getEjabberdStringFromDomainsArray(domains))\n\tFile.open($ejabberd, \"w\") { |file| file.puts newEjabberdconfig }\n\n\treturn $done\nend",
"def add_domain(domain)\n put :add_domain!, {:domain => domain}\n end",
"def get_subdomains entity_name, api_key, headers, url\n\n response = http_get_body(url,nil,headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"count\"] != 0\n # Create subdomains\n json[\"cidr\"][\"cidr16\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n # Create subdomains\n json[\"cidr\"][\"cidr24\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n\n # Create list of related organizations\n json[\"data\"][\"as\"][\"results\"].each do |e|\n _create_entity(\"Organization\", \"name\" => e[\"entity\"][\"organization\"])\n end\n\n # Create list of related countrys\n json[\"data\"][\"country\"][\"results\"].each do |e|\n _create_entity(\"PhysicalLocation\", \"name\" => e[\"entity\"][\"value\"])\n end\n\n # Create list of related IPs\n json[\"data\"][\"ip\"][\"results\"].each do |e|\n _create_entity(\"IpAddress\", \"name\" => e[\"entity\"][\"value\"])\n end\n end\n end",
"def add_domain_record_aaaa(params)\n post('dns/recordaaaa', params)\n end",
"def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end",
"def create\n @short_domain = ShortDomain.new(params[:short_domain])\n puts @short_domain.inspect\n\n respond_to do |format|\n if @short_domain.save\n format.html { redirect_to @short_domain, notice: 'Short domain was successfully created.' }\n format.json { render json: @short_domain, status: :created, location: @short_domain }\n else\n format.html { render action: \"new\" }\n format.json { render json: @short_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def domains; end",
"def create\n @domain = Domain.new(params[:domain])\n# domain_regex = /[a-z0-9]*\\.[a-z0-9]*/\n# @domain.name = @domain.name.match(domain_regex)[0] \n respond_to do |format|\n if @domain.save\n format.html { redirect_to @domain, notice: 'Domain was successfully created.' }\n format.json { render json: @domain, status: :created, location: @domain }\n else\n format.html { render action: \"new\" }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_languageunderstanding_domains_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstandingApi.post_languageunderstanding_domains ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling LanguageUnderstandingApi.post_languageunderstanding_domains\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/languageunderstanding/domains\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NluDomain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageUnderstandingApi#post_languageunderstanding_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domains\n raw_data['domains']\n end",
"def add\n unless domain = shift_argument\n error(\"Usage: heroku domains:add DOMAIN\\nMust specify DOMAIN to add.\")\n end\n validate_arguments!\n domain = action(\"Adding #{domain} to #{app}\") do\n api.post_domains_v3_domain_cname(app, domain).body\n end\n output_with_bang \"Configure your app's DNS provider to point to the DNS Target #{domain['cname']}\"\n output_with_bang \"For help, see https://devcenter.heroku.com/articles/custom-domains\"\n end",
"def create_domain\n debug(\"Creating domain #{domain_name}\")\n debug(\"Using options: #{domain_options}\")\n domain = client.servers.create(domain_options)\n prepare_domain(domain)\n domain\n end",
"def domains\n render json: Url.select(:domain).distinct, each_serializer: DomainsSerializer, root: false\n end",
"def create\n subdomains_params = subdomain_params\n subdomains_params[:user_id] = User.last.id\n @subdomain = Subdomain.new(subdomains_params)\n\n respond_to do |format|\n if @subdomain.save\n format.html { redirect_to @subdomain, notice: 'Subdomain was successfully created.' }\n format.json { render :show, status: :created, location: @subdomain }\n else\n format.html { render :new }\n format.json { render json: @subdomain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, BudgetDomain\n service = BudgetDomainCreator.call(create_params)\n @budget_domain = service.budget_domain\n if service.status == :ok\n redirect_to @budget_domain, notice: 'Budget domain was successfully created.'\n else\n render :new\n end\n end",
"def get_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domains ...'\n end\n # resource path\n local_var_path = '/domains'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DomainPreview>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#get_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @subdomain = @user.subdomains.build(params[:subdomain])\n if @subdomain.save\n redirect_to @user, notice: \"Successfully created subdomain.\"\n end\n end",
"def index\n\t\t@domains = Domain.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domains }\n\t\tend\n\tend",
"def create_godaddy_records\n dme.create_mx_record(params[:domain], '', '0', 'smtp.secureserver.net.', {} )\n dme.create_mx_record(params[:domain], '', '5', 'mailstore1.secureserver.net.', {} )\n\n dme.create_record(params[:domain], 'email', 'CNAME', 'email.secureserver.net.', {})\n dme.create_record(params[:domain], 'imap', 'CNAME', 'imap.secureserver.net.', {})\n dme.create_record(params[:domain], 'mail', 'CNAME', 'pop.secureserver.net.', {})\n dme.create_record(params[:domain], 'mobilemail', 'CNAME', 'mobilemail-v01.prod.mesa1.secureserver.net.', {})\n dme.create_record(params[:domain], 'pda', 'CNAME', 'mobilemail-v01.prod.mesa1.secureserver.net.', {})\n dme.create_record(params[:domain], 'pop', 'CNAME', 'pop.secureserver.net.', {})\n dme.create_record(params[:domain], 'smtp', 'CNAME', 'smtp.secureserver.net.', {})\n dme.create_record(params[:domain], 'webmail', 'CNAME', 'webmail.secureserver.net.', {})\n end",
"def create_domain_with_http_info(create_domain_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.create_domain ...'\n end\n # verify the required parameter 'create_domain_options' is set\n if @api_client.config.client_side_validation && create_domain_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_domain_options' when calling DomainControllerApi.create_domain\"\n end\n # resource path\n local_var_path = '/domains'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # 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(create_domain_options) \n\n # return_type\n return_type = opts[:return_type] || 'DomainDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#create_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_domain_record_a(params)\n post('dns/recorda', params)\n end",
"def domain_params\n params.require(:domain).permit(:name, :ext_id, :origin_server)\n end",
"def list_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.list_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.list_domains\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.list_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<DomainResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.list_domains\",\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: DomainApi#list_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show_domain\n render json: dme.show_domain(\"#{params[:domain]}\")\n end",
"def create\n\t\t@domain = Domain.new(:hostname => params[:hostname])\n\n\t\t# Attempt to save the domain, and return the appropriate JSON or Error\n\t\trespond_to do |format|\n\t\t\tif @domain.save\n\t\t\t\tformat.json { render json: @domain, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @domain.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Fetch the hostname IP address and update the record in a new thread\n\t\tt1=Thread.new{fetch_origin_ip()}\n\t\tt1.join\n\tend",
"def create\n # create registrant -> create order -> create domain\n @order = Order.create(user_id:current_user.id)\n @order.save\n\n if @order.save\n puts \"order created with id #{@order.id}\"\n else\n puts 'order creation failed'\n end\n\n @domain = current_user.domains.new(domain_params)\n\n @domain.user_id = current_user.id\n @domain.registrant_id = Registrant.last.id\n @domain.order_id = @order.id\n\n # create an order first\n respond_to do |format|\n if @domain.save\n format.html { redirect_to @domain, notice: 'Domain was successfully created.' }\n format.json { render :show, status: :created, location: @domain }\n else\n format.html { render :new }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_domain(opts = {})\n data, _status_code, _headers = create_domain_with_http_info(opts)\n data\n end",
"def add_domain_list(name)\n configure \"ip domain-list #{name}\"\n end",
"def create\n @ensembl_subdomain = EnsemblSubdomain.new(ensembl_subdomain_params)\n\n respond_to do |format|\n if @ensembl_subdomain.save\n format.html { redirect_to @ensembl_subdomain, notice: 'Ensembl subdomain was successfully created.' }\n format.json { render :show, status: :created, location: @ensembl_subdomain }\n else\n format.html { render :new }\n format.json { render json: @ensembl_subdomain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(domain, options = {})\n fail(ParameterError, 'No domain given to add on Mailgun', caller) unless domain\n options = { smtp_password: nil, spam_action: 'disabled', wildcard: false }.merge(options)\n options[:name] = domain\n @client.post('domains', options).to_h\n end",
"def create\n @virtual_domain = VirtualDomain.new(virtual_domain_params)\n\n respond_to do |format|\n if @virtual_domain.save\n format.html { redirect_to @virtual_domain, notice: 'Virtual domain was successfully created.' }\n format.json { render :show, status: :created, location: @virtual_domain }\n else\n format.html { render :new }\n format.json { render json: @virtual_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ad_domain\n @ad_domain = AdDomain.find(params[:id])\n end",
"def domains_list\n call('domains.list')[:domains]\n end",
"def domains\n\tfetch(\"/Domain.List\")\nend",
"def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end",
"def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end",
"def response_domains\n self.response_domain_datetimes.to_a + self.response_domain_numerics.to_a +\n self.response_domain_texts.to_a + self.response_domain_codes.to_a\n end",
"def create_domain_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.create_domain ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.create_domain\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.create_domain\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\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 form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DomainResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.create_domain\",\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: DomainApi#create_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stub_list_domains(user, domain_names)\n body = { data: [], pagination: { current_page: 1, per_page: 30, total_entries: domain_names.count, total_pages: 1 } }\n domain_names.each_with_index do |domain_name, i|\n body[:data] << Hash[\n id: i + 1,\n account_id: user.uid,\n registrant_id: nil,\n name: domain_name,\n unicode_name: domain_name,\n token: \"domain-token\",\n state: \"hosted\",\n auto_renew: false,\n expires_on: nil,\n created_at: Time.now.utc.iso8601,\n updated_at: Time.now.utc.iso8601\n ]\n end\n\n stub_request(:get, \"https://api.sandbox.dnsimple.com/v2/#{user.uid}/domains\")\n .with(headers: { 'Accept' => 'application/json', 'Authorization' => \"Bearer #{user.token}\", 'User-Agent' => \"dnsimple-ruby/#{Dnsimple::VERSION} hello-domains-rails\" })\n .to_return(status: 200, body: JSON.generate(body), headers: {})\n end",
"def domain_create(domain, fields)\n unless ([ :period, :registrant, :admin, :tech, :billing, :nservers ] - fields.keys).empty?\n raise ArgumentError, \"Required fields not found\"\n end\n query :domain_register, {\n domain: domain,\n period: (fields[:period] * 12),\n owner_c: fields[:registrant],\n admin_c: fields[:admin],\n tech_c: fields[:tech],\n billing_c: fields[:billing],\n ns_list: fields[:nservers].join(':')\n }\n end",
"def domains\n get()[\"app\"][\"domains\"]\n end",
"def check_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.check_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.check_domains\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.check_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain/check_all'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Array>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.check_domains\",\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: DomainApi#check_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def register_domain(sld, tld, *extra_info)\n query_push({'Command' => 'Purchase', 'SLD' => sld, 'TLD' => tld,\n 'Debit' => 'True'})\n if extra_info[:admin]\n if extra_info[:admin].is_a? Contact\n query_push {}\n end\n end\n\n if extra_info[:nameservers]\n query_push {}\n else\n query_push {'UseDNS' => 'default'}\n end\n\n get_response\n if @result['RRPCode'].to_i == 200\n return true\n else\n return false\n end\n end",
"def budget_domain_params\n params.require(:budget_domain).permit(:name, :description)\n end",
"def new_domain(domain)\n d = Domain.new\n d.name = domain\n d.type = \"NATIVE\"\n\n d.save\n return d\n end",
"def create_networksolutions_records\n dme.create_mx_record(params[:domain], '', '0', \"inbound.#{params[:domain]}.netsolmail.net.\", {} )\n\n dme.create_record(params[:domain], 'mail', 'CNAME', \"mail.#{params[:domain]}.netsolmail.net.\", {})\n dme.create_record(params[:domain], 'mail', 'CNAME', \"smtp.#{params[:domain]}.netsolmail.net.\", {})\n end",
"def create_domain(domain_name)\n Adapter.create_domain(domain_name)\n self[domain_name]\n end",
"def domains(app_env)\n domains = self.settings['domains'] || {}\n domains[app_env] || []\n end",
"def add_domain_record_srv(params)\n post('dns/recordsrv', params)\n end",
"def parse_domain_list\n search = config.scan(/(?<=^ip\\sdomain-list\\s).+$/)\n { domain_list: search }\n end",
"def setup_dns(domain)\n # TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end",
"def setup_dns(domain)\n # TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end",
"def setup_dns(domain)\n# TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end",
"def create\n @urls = params[:domain].split(\"\\r\\n\")\n\n @urls.each do |url|\n @whitelist_url = WhitelistUrl.new(:domain => url)\n @whitelist_url.save\n end\n\n redirect_to whitelist_urls_url\n\n # respond_to do |format|\n # if @whitelist_url.save\n # format.html { redirect_to @whitelist_url, notice: 'Whitelist url was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @whitelist_url }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @whitelist_url.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n if params[:domain_map][:domain].blank?\n @req_error = \"req_error\"\n end\n if params[:domain_map][:map_type] == \"organisation\" \n params[:domain_map][:organisation_id] = current_organisation.id\n params[:domain_map][:program_id] = nil\n elsif\n params[:domain_map][:organisation_id] = nil\n end\n @domain_map = current_user.domain_maps.new(params[:domain_map])\n\n respond_to do |format|\n if @domain_map.save\n format.html { redirect_to domain_maps_url, notice: 'Domain map was successfully created.' }\n format.json { render json: domain_maps_url, status: :created, location: domain_maps_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @domain_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_domains\n authorize unless @heroku\n each_heroku_app do |heroku_env, app_name, repo|\n # get the domains that we are aiming towards\n domains = @config.domains(heroku_env)\n\n # get the domains that are already on the servers\n existing_domains = (@heroku.list_domains(app_name) || []).map{|a| a[:domain]}\n\n # remove the domains that need to be removed\n existing_domains.each do |existing_domain|\n # check to see if we need to delete this domain\n unless domains.include?(existing_domain)\n # delete this domain if they arent on the approved list\n destroy_command \"heroku domains:remove #{existing_domain} --app #{app_name}\"\n end\n end\n\n # add the domains that dont exist already\n domains.each do |domain|\n # check to see if we need to add this domain\n unless existing_domains.include?(domain)\n # add this domain if they are not already added\n creation_command \"heroku domains:add #{domain} --app #{app_name}\"\n end\n end\n\n # display the destructive commands\n output_destroy_commands(app_name)\n end\n end",
"def domains()\n return MicrosoftGraph::Domains::DomainsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def search_subdomains entity_name, headers\n\n # Set the URL for ip open ports\n url2 = \"https://api.spyse.com/v3/data/domain/subdomain?limit=100&domain=#{entity_name}\"\n\n # make the request\n response2 = http_get_body(url2,nil,headers)\n json2 = JSON.parse(response2)\n\n json2[\"data\"][\"items\"].each do |result|\n\n # Create related subdomains\n create_dns_entity_from_string(result[\"name\"], nil, false, { \"extended_spyse\" => result})\n\n # Create SslCertificate\n if result[\"cert_summary\"][\"fingerprint_sha256\"] != \"\"\n #_create_entity(\"SslCertificate\", \"name\" => result[\"cert_summary\"][\"fingerprint_sha256\"], \"extended_spyse\" => result[\"cert_summary\"])\n end\n\n # Create related IpAddress, physical location and ISP organization\n # if result[\"dns_records\"]\n # result[\"dns_records\"][\"A\"].each do |ip_result|\n # if ip_result[\"ip\"] != \"\"\n # _create_entity(\"IpAddress\", \"name\" => ip_result[\"ip\"], \"extended_spyse\" => ip_result)\n # end\n # if ip_result[\"country\"] != \"\"\n # _create_entity(\"PhysicalLocation\", \"name\" => ip_result[\"country\"])\n # end\n # if ip_result[\"org\"] != \"\"\n # _create_entity(\"Organization\", \"name\" => ip_result[\"org\"])\n # end\n # end\n # end\n\n end\n end",
"def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end",
"def list_service_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.list_service_domains ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling ServiceApi.list_service_domains\"\n end\n # resource path\n local_var_path = '/service/{service_id}/domain'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<DomainResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.list_service_domains\",\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: ServiceApi#list_service_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def register_domain(attribs)\n Args.new(attribs) do |c|\n c.requires :domain, :contacts, :nameservers\n c.optionals :term, :options\n end\n\n attribs[:term] = 1 unless attribs[:term]\n nameservers = format_nameservers(attribs[:nameservers])\n\n attributes = {\n :contact_set => attribs[:contacts],\n :custom_nameservers => 1,\n :custom_tech_contact => 1,\n :domain => attribs[:domain],\n :nameserver_list => nameservers,\n :period => attribs[:term],\n :reg_username => @user,\n :reg_password => @password\n }\n\n attributes[:reg_type] = :new unless attribs[:options] && attribs[:options][:reg_type]\n attributes.merge!(attribs[:options]) if attribs[:options]\n attributes[:key] = 'attributes'\n\n res = run_command :sw_register, :domain, attributes\n end",
"def initialize\n @domains = []\n end",
"def create\n @nad = Nad.new(params[:nad])\n #automatically infer domain from outboundlink\n dname = URI.parse( \"http://\" + @nad.outboundlink).host\n \n #if the domain doesn't exists\n @domain = Domain.find_by_name(dname)\n if @domain\n @nad.domain_id = @domain.id\n else\n @domain = Domain.new(:name => dname)\n @domain.save!\n #build automatically assigns domain_id to the nad\n @nad = @domain.nads.build(:outboundlink => @nad.outboundlink, :imgurl => @nad.outboundlink, :head => @nad.head, :caption => @nad.caption, :approved => 0)\n end\n \n respond_to do |format|\n if @nad.save\n format.html { redirect_to(@nad, :notice => 'Nad was successfully created.') }\n format.xml { render :xml => @nad, :status => :created, :location => @nad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_dnsbl(name, domain, type = 'ip', codes = { '0' => 'OK', '127.0.0.2' => 'Blacklisted' })\n @dnsbls[name] = codes\n @dnsbls[name]['domain'] = domain\n @dnsbls[name]['type'] = type\n end",
"def index\n @domains = Domain.all\n end",
"def create\n @domain = DOMAIN.new(params[:domain])\n @domain.current_user = current_user\n\n respond_to do |format|\n if @domain.save\n flash[:notice] = 'Domain was successfully created.'\n format.html { redirect_to(domain_url(@domain.id)) }\n format.xml { render :xml => @domain, :status => :created, :location => domain_url(@domain.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @domains = Domain.active.alphabetical.all\n\n render json: @domains\n end",
"def create\n @domain = Domain.friendly.find(params[:domain_id])\n @dns_zone = @domain.dns_zones.create(dns_zone_params.merge({:version => 1}))\n if @dns_zone.save\n redirect_to @domain, notice: 'Dns zone was successfully created.'\n else\n render action: 'edit', @errors => @dns_zone.errors, alert: \"Dns zone validation failed.\"\n end\n end",
"def crm_domain_params\n params[:crm_domain].permit!\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def add\n domain = args.shift.downcase rescue nil\n fail(\"Usage: heroku domains:add DOMAIN\") if domain.to_s.strip.empty?\n heroku.add_domain(app, domain)\n display \"Added #{domain} as a custom domain name for #{app}\"\n end",
"def update_subdomains\n backup_subdomains\n parse_subdomains\n end",
"def check_domains(sld_or_domains, tlds=nil)\n query_args = {'Command' => 'Check'}\n if sld_or_domains.is_a? Array\n query_args['DomainList'] = sld_or_domains.join(',')\n else\n query_args['SLD'] = sld_or_domains\n end\n unless tlds == nil\n if tlds.is_a? Array\n query_args['TLDList'] = tlds.join(',')\n else\n query_args['TLD'] = tlds\n end\n end\n query_push(query_args)\n get_response\n # Set up a hash of domains\n checked_domains = {}\n if query_args['DomainList']\n sld_or_domains.each {|domain| checked_domains[domain] = nil}\n elsif query_args['TLDList']\n tlds.each {|tld| checked_domains[sld_or_domains + '.' + tld] = nil}\n else\n checked_domains[sld_or_domains + '.' + tlds] = nil\n end\n # RRPCodes: 210 = available, 211 = not available\n if checked_domains.length > 1\n # If we have multiple domains, run a loop to fill in results\n x = 1\n @result['DomainCount'].to_i.times do\n domain = @result['Domain' + x.to_s]\n if @result['RRPCode' + x.to_s].to_i == 210\n checked_domains[domain] = true\n elsif @result['RRPCode' + x.to_s].to_i == 211\n checked_domains[domain] = false\n end\n x += 1\n end\n else\n if @result['RRPCode'].to_i == 210\n checked_domains[sld_or_domains + '.' + tlds] = true\n elsif @result['RRPCode'].to_i == 211\n checked_domains[sld_or_domains + '.' + tlds] = false\n end\n end\n puts checked_domains.to_yaml\n end",
"def update_domain_nameservers(domain, nameservers = {})\n connection.post \"/domain/update_nameservers/#{domain}\", { :nameservers => nameservers }\n end",
"def domain_params\n params.require(:domain).permit(:name, :note)\n end",
"def create\n @email_domain = Email::Domain.new(params[:email_domain])\n\n respond_to do |format|\n if @email_domain.save\n format.html { redirect_to(@email_domain, :notice => 'Domain was successfully created.') }\n format.xml { render :xml => @email_domain, :status => :created, :location => @email_domain }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @email_domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_default_records\n dme.create_record(params[:domain], '', 'ANAME', 'www', {})\n dme.create_record(params[:domain], 'www', 'CNAME', 'lb.moxiworks.com', {})\n end",
"def list(options = {})\n @client.get('domains', options).to_h['items']\n end",
"def set_domain\n if check_fields_google_domain? # google domain\n @domain.push(:Google)\n elsif check_fields_nas_domain? # NAS domain\n @domain.push(:NAS)\n else \n @domain.push(:Cross)\n end\n notify \"DOMAIN : #{@domain}\"\n end",
"def check_domains(opts = {})\n data, _status_code, _headers = check_domains_with_http_info(opts)\n data\n end",
"def domains\n []\n end",
"def add_domain_record_ns(params)\n post('dns/recordns', params)\n end",
"def domain_create(args)\n response = send_request(domain_create_xml(args))\n\n get_result(:xml => response, :callback => :domain_create_process)\n end",
"def dns(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/dns/#{target}\", params) { |json| json }\n end",
"def create_domain(domain)\n raise MogileFS::ReadOnlyError if readonly?\n res = @backend.create_domain :domain => domain\n res ? res['domain'] : nil\n end",
"def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @domain }\n end\n end",
"def process_domains\n domains.each do |domain|\n params = options\n params[:host] = configuration.host\n params[:server] = servers[domain][\"server\"]\n compiler = YMDP::Compiler::Base.new(domain, git_hash, params)\n \n compiler.process_all\n end\n end",
"def new\n @short_domain = ShortDomain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @short_domain }\n end\n end"
] | [
"0.6632935",
"0.6578056",
"0.6368173",
"0.6293478",
"0.60988146",
"0.60834527",
"0.60630584",
"0.6025382",
"0.5943322",
"0.58792007",
"0.5857681",
"0.5857312",
"0.58540356",
"0.58126026",
"0.58043593",
"0.57285047",
"0.57284164",
"0.567969",
"0.5673843",
"0.5659294",
"0.5659239",
"0.564231",
"0.56389314",
"0.56309533",
"0.56254345",
"0.56192356",
"0.56157297",
"0.5615672",
"0.5615588",
"0.5605045",
"0.5602252",
"0.5600163",
"0.5596993",
"0.5592968",
"0.5590061",
"0.5587957",
"0.55854005",
"0.558265",
"0.5581206",
"0.5579177",
"0.55766845",
"0.5570356",
"0.5564145",
"0.55539227",
"0.5534715",
"0.5526794",
"0.5520117",
"0.5509003",
"0.5505298",
"0.5501741",
"0.54993176",
"0.5498088",
"0.5497127",
"0.5492807",
"0.54847866",
"0.5471748",
"0.5455384",
"0.54460233",
"0.543684",
"0.5418591",
"0.54176044",
"0.53619385",
"0.53619385",
"0.53489155",
"0.53480154",
"0.5344917",
"0.5335222",
"0.53331196",
"0.53263503",
"0.5319336",
"0.5302352",
"0.52844936",
"0.5283266",
"0.52804875",
"0.52721095",
"0.52548695",
"0.5253322",
"0.524144",
"0.5232841",
"0.52208227",
"0.5218445",
"0.52179325",
"0.52144736",
"0.52041656",
"0.5197681",
"0.51943266",
"0.51925284",
"0.51923096",
"0.51885813",
"0.51858026",
"0.5168598",
"0.5166196",
"0.5164749",
"0.51638174",
"0.5159751",
"0.5148041",
"0.5131219",
"0.5130801",
"0.5121863",
"0.5118767"
] | 0.65196174 | 2 |
PATCH/PUT /ad_domains/1 PATCH/PUT /ad_domains/1.json | def update
authorize! :update, @ad_domain
respond_to do |format|
if @ad_domain.update(ad_domain_params)
format.html { redirect_to @ad_domain, notice: 'Active Directory domain was successfully updated.' }
format.json { render :show, status: :ok, location: @ad_domain }
else
format.html { render :edit }
format.json { render json: @ad_domain.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @domain = Domain.find(params[:id])\n\n if @domain.update(domain_params)\n head :no_content\n else\n render json: @domain.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @domain.update(domain_params)\n format.html { redirect_to @domain, notice: 'Domain was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @domain.update(domain_params)\n format.html { redirect_to @domain, notice: 'Domain was successfully updated.' }\n format.json { render :show, status: :ok, location: @domain }\n else\n format.html { render :edit }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @short_domain = ShortDomain.find(params[:id])\n\n respond_to do |format|\n if @short_domain.update_attributes(params[:short_domain])\n format.html { redirect_to @short_domain, notice: 'Short domain was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @short_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:domain_map][:domain].blank?\n @req_error = \"req_error\"\n end\n @domain_map = DomainMap.find(params[:id])\n params[:domain_map][:verified] = false\n if params[:domain_map][:map_type] == \"organisation\" \n params[:domain_map][:organisation_id] = current_organisation.id\n params[:domain_map][:program_id] = nil\n elsif\n params[:domain_map][:organisation_id] = nil\n end\n respond_to do |format|\n if @domain_map.update_attributes(params[:domain_map])\n format.html { redirect_to domain_maps_url, notice: 'Domain map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @domain_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @domain = Domain.find(params[:id])\n respond_to do |format|\n if @domain.update(domain_params)\n format.html { redirect_to users_domain_path(@domain), notice: 'Domain was successfully updated.' }\n format.json { render :show, status: :ok, location: @domain }\n else\n format.html { render :edit }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crm_domain.update(crm_domain_params)\n format.html { redirect_to edit_crm_domain_path(@crm_domain), notice: 'Информация по домену обновлена.' }\n format.json { render :show, status: :ok, location: @crm_domain }\n else\n format.html { render :edit }\n format.json { render json: @crm_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dns_entry_response = RestClient.put('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n respond_to do |format|\n if @dns_entry.update(dns_entry_params)\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully updated.\" }\n format.json { render :show, status: :ok, location: @dns_entry }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @domain = Domain.find(params[:id])\n\n respond_to do |format|\n if @domain.update_attributes(params[:domain])\n format.html { redirect_to(@domain, :notice => 'Domain was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ensembl_subdomain.update(ensembl_subdomain_params)\n format.html { redirect_to @ensembl_subdomain, notice: 'Ensembl subdomain was successfully updated.' }\n format.json { render :show, status: :ok, location: @ensembl_subdomain }\n else\n format.html { render :edit }\n format.json { render json: @ensembl_subdomain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @budget_domain\n if @budget_domain.update(budget_domain_params)\n redirect_to @budget_domain, notice: 'Budget domain was successfully updated.'\n else\n render :edit\n end\n end",
"def update(domain, options = {})\n fail(ParameterError, 'No domain given to add on Mailgun', caller) unless domain\n @client.put(\"domains/#{domain}\", options).to_h\n end",
"def update\n @email_domain = Email::Domain.find(params[:id])\n\n respond_to do |format|\n if @email_domain.update_attributes(params[:email_domain])\n format.html { redirect_to(@email_domain, :notice => 'Domain was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @domain.update_attributes(:hostname => params[:hostname])\n\t\t\t\tformat.json { head :no_content, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @domain.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\n\t\t# Fetch the hostname IP address and update the record in a new thread\n\t\tt1=Thread.new{fetch_origin_ip()}\n\t\tt1.join\n\tend",
"def update_domain_with_http_info(id, update_domain_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.update_domain ...'\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 DomainControllerApi.update_domain\"\n end\n # verify the required parameter 'update_domain_options' is set\n if @api_client.config.client_side_validation && update_domain_options.nil?\n fail ArgumentError, \"Missing the required parameter 'update_domain_options' when calling DomainControllerApi.update_domain\"\n end\n # resource path\n local_var_path = '/domains/{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(['*/*'])\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(update_domain_options) \n\n # return_type\n return_type = opts[:return_type] || 'DomainDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#update_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def domain_update(domain, fields)\n unless ([ :admin, :tech, :billing, :nservers ] - fields.keys).empty?\n raise ArgumentError, \"Required fields not found\"\n end\n query :domain_modify, {\n domain: domain,\n admin_c: fields[:admin],\n tech_c: fields[:tech],\n billing_c: fields[:billing],\n ns_list: fields[:nservers].join(':')\n }\n end",
"def update\n @domain = DOMAIN.first_or_get!(params[:id])\n @domain.current_user = current_user\n\n respond_to do |format|\n if @domain.update(params[:domain]) or not @domain.dirty?\n flash[:notice] = 'Domain was successfully updated.'\n format.html { redirect_to(domain_url(@domain.id)) }\n format.xml { render :xml => @domain }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @virtual_domain.update(virtual_domain_params)\n format.html { redirect_to @virtual_domain, notice: 'Virtual domain was successfully updated.' }\n format.json { render :show, status: :ok, location: @virtual_domain }\n else\n format.html { render :edit }\n format.json { render json: @virtual_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n @id = args[:id] if args.key?(:id)\n end",
"def update\n if actions = params[:http_domain_rule].try(:[], :actions)\n actions = JSON.load(actions) if String === actions\n params[:http_domain_rule][:actions] = actions\n end\n\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n if @http_domain_rule.update_attributes(params[:http_domain_rule])\n format.html do\n flash[:success] = 'Domain rule was successfully updated.'\n redirect_to @core_application\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @http_domain_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n subdomains_params = subdomain_params\n subdomains_params[:user_id] = current_user.id\n respond_to do |format|\n if @subdomain.update(subdomain_params)\n format.html { redirect_to @subdomain, notice: 'Subdomain was successfully updated.' }\n format.json { render :show, status: :ok, location: @subdomain }\n else\n format.html { render :edit }\n format.json { render json: @subdomain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_domain_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainApi.update_domain ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n domain_name = opts[:'domain_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DomainApi.update_domain\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DomainApi.update_domain\"\n end\n # verify the required parameter 'domain_name' is set\n if @api_client.config.client_side_validation && domain_name.nil?\n fail ArgumentError, \"Missing the required parameter 'domain_name' when calling DomainApi.update_domain\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/domain/{domain_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'domain_name' + '}', CGI.escape(domain_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\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 form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DomainResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DomainApi.update_domain\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainApi#update_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @domain = Domain.find(params[:id])\n respond_to do |format|\n if @domain.update_attributes(params[:domain])\n format.html { redirect_to articles_path, notice: 'Domain was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n # each update of domain fields recored to history\n new_history = History.new(:custom_css => @domain.custom_css, :domain_name => @domain.name, :user_id => current_user.id, :user_name => current_user.email, :rule => @domain.rule, :domain_id => @domain.id, :title_rule => @domain.title_rule)\n new_history.save\n end\n end",
"def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n end",
"def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @tmp_domain_name.update(tmp_domain_name_params)\n format.html { redirect_to @tmp_domain_name, notice: 'Tmp domain name was successfully updated.' }\n format.json { render :show, status: :ok, location: @tmp_domain_name }\n else\n format.html { render :edit }\n format.json { render json: @tmp_domain_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subdomain = Subdomain.find(params[:id])\n\n respond_to do |format|\n if @subdomain.update_attributes(params[:subdomain])\n format.html { redirect_to(@subdomain, :notice => 'Subdomain was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subdomain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_ad_domain\n @ad_domain = AdDomain.find(params[:id])\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n zone = @dns_zone.deep_clone\n if (zone.update(dns_zone_params.merge( {:version => @dns_zone.new_version} ))) && zone.valid?\n zone.save!\n @dns_zone.domain.dns_zones << zone\n format.html { redirect_to @dns_zone.domain, notice: 'Dns zone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = \"Dns zone validation failed.\"\n @dns_zone = zone\n render action: :edit\n end\n format.json { render json: @dns_zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @domain.update(domain_params)\n redirect_to :action=>\"index\"\n flash[:notice] = \"Successfully updated..\"\n else\n redirect_to :action=>\"edit\"\n flash[:notice] = \"Invalid domain name\"\n end\n end",
"def update\n # TODO: refactor models so that externaluserdomain is in portal namespace?\n # @external_user_domain = Portal::ExternalUserDomain.find(params[:id])\n @external_user_domain = ExternalUserDomain.find(params[:id])\n respond_to do |format|\n if @external_user_domain.update_attributes(params[:external_user_domain])\n flash[:notice] = 'Portal::ExternalUserDomain was successfully updated.'\n format.html { redirect_to(@external_user_domain) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_user_domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @domain_badge = args[:domain_badge] if args.key?(:domain_badge)\n @domain_name = args[:domain_name] if args.key?(:domain_name)\n end",
"def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update(domain_name, values)\n domain_name = @client.url_encode(domain_name)\n @client.call(method: :put, path: \"tracking-domains/#{domain_name}\", body_values: values)\n end",
"def update!(**args)\n @custom_domain = args[:custom_domain] if args.key?(:custom_domain)\n @custom_domain_state = args[:custom_domain_state] if args.key?(:custom_domain_state)\n @domain_verification_request_time = args[:domain_verification_request_time] if args.key?(:domain_verification_request_time)\n @pending_custom_domain = args[:pending_custom_domain] if args.key?(:pending_custom_domain)\n @use_custom_domain = args[:use_custom_domain] if args.key?(:use_custom_domain)\n end",
"def update\n @domain_mapping = DomainMapping.find(params[:id])\n\n respond_to do |format|\n if @domain_mapping.update_attributes(params[:domain_mapping])\n format.html { redirect_to(@domain_mapping, :notice => 'Domain mapping was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domain_mapping.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @allow_all_domains = args[:allow_all_domains] if args.key?(:allow_all_domains)\n @allow_amp_traffic = args[:allow_amp_traffic] if args.key?(:allow_amp_traffic)\n @allowed_domains = args[:allowed_domains] if args.key?(:allowed_domains)\n @challenge_security_preference = args[:challenge_security_preference] if args.key?(:challenge_security_preference)\n @integration_type = args[:integration_type] if args.key?(:integration_type)\n end",
"def update!(**args)\n @anchors_dropped = args[:anchors_dropped] if args.key?(:anchors_dropped)\n @domain = args[:domain] if args.key?(:domain)\n end",
"def update\n @cdn_config = CdnConfig.find(params[:id])\n\n respond_to do |format|\n if @cdn_config.update_attributes(params[:cdn_config])\n format.html { redirect_to @cdn_config, notice: 'Cdn config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cdn_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n @company_authority = CompanyAuthority.find(params[:id])\n\n if @company_authority.update(company_authority_params)\n head :no_content\n else\n render json: @company_authority.errors, status: :unprocessable_entity\n end\n end",
"def update_domain_nameservers(domain, nameservers = {})\n connection.post \"/domain/update_nameservers/#{domain}\", { :nameservers => nameservers }\n end",
"def domain_update(args)\n if args.key?(:chg) && args[:chg].key?(:registrant)\n raise ArgumentError, 'You need to do a trade or recover operation to change the registrant'\n end\n has_contacts = args.key?(:add) && args[:add].key?(:contacts) || args.key?(:add) && args[:add].key?(:contacts)\n has_ns = args.key?(:add) && args[:add].key?(:ns) || args.key?(:add) && args[:add].key?(:ns)\n has_other = args.key?(:add) && args[:add].key?(:status) || args.key?(:add) && args[:add].key?(:status) || args.key?(:chg) && args[:chg].key?(:authInfo)\n if [has_contacts, has_ns, has_other].count { |v| v } > 1\n raise ArgumentError, \"You can't update all that at one time\"\n end\n [:add, :rem].each do |ar|\n if args.key?(ar) && args[ar].key?(:ns) && args[ar][:ns].first.is_a?(String)\n args[ar][:ns] = args[ar][:ns].map { |ns| { :hostName => ns } }\n end\n end\n super\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end",
"def update\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n if @dns_device_assoc.update_attributes(params[:dns_device_assoc])\n format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dns_device_assoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_domain\n @domain = Domain.find(params[:id])\n end",
"def set_domain\n @domain = Domain.find(params[:id])\n end",
"def patch_languageunderstanding_domain_with_http_info(domain_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstandingApi.patch_languageunderstanding_domain ...\"\n end\n \n \n # verify the required parameter 'domain_id' is set\n fail ArgumentError, \"Missing the required parameter 'domain_id' when calling LanguageUnderstandingApi.patch_languageunderstanding_domain\" if domain_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling LanguageUnderstandingApi.patch_languageunderstanding_domain\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/languageunderstanding/domains/{domainId}\".sub('{format}','json').sub('{' + 'domainId' + '}', domain_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['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 = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NluDomain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageUnderstandingApi#patch_languageunderstanding_domain\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @campaign = Campaign.find_by(id: params[:id])\n if @campaign.update(update_campaign_params)\n head :no_content\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def update\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n\n respond_to do |format|\n if @wp_dyna_config.update_attributes(params[:wp_dyna_config])\n format.html { redirect_to @wp_dyna_config, notice: 'Wp dyna config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wp_dyna_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ad_contact = AdContact.find(params[:id])\n\n respond_to do |format|\n if @ad_contact.update_attributes(params[:ad_contact])\n format.html { redirect_to @ad_contact, notice: 'Ad contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_domain(opts = {})\n data, _status_code, _headers = update_domain_with_http_info(opts)\n data\n end",
"def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n @scope = args[:scope] if args.key?(:scope)\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n if params[:site][:manager_ids]\n format.html { redirect_to sites_url(subdomain: \"www\"), notice: 'Site was successfully updated.' }\n else\n format.html { redirect_to edit_site_url(subdomain: @site.subdomain), notice: 'Site was successfully updated.' }\n end\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_agent_domain\n return false unless validate_domain\n render json: dme.delete_domain(params[:domain])\n end",
"def update\n if @subdomain.update_attributes(params[:subdomain])\n flash[:notice] = \"Successfully updated subdomain.\"\n end\n respond_with([@user, @subdomain])\n end",
"def domain_update(args)\n response = send_request(domain_update_xml(args))\n\n get_result(response)\n end",
"def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @ad_breaks = args[:ad_breaks] if args.key?(:ad_breaks)\n @ads_on_embeds = args[:ads_on_embeds] if args.key?(:ads_on_embeds)\n @countries_restriction = args[:countries_restriction] if args.key?(:countries_restriction)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update\n fix_tokenized_input_params\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to [@ad.org, @ad], notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: [@ad.org, @ad] }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(subdomain, data)\n domain = [subdomain, ZONE].join(\".\")\n\n @lines << \"update delete #{domain} TXT\\n\"\n @lines << \"update add #{domain} #{TTL} TXT \\\"#{data}\\\"\\n\"\n @count += 1\n\n self\n end",
"def update!(**args)\n @offdomain_count = args[:offdomain_count] if args.key?(:offdomain_count)\n @ondomain_count = args[:ondomain_count] if args.key?(:ondomain_count)\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update!(**args)\n @dns_search_domains = args[:dns_search_domains] if args.key?(:dns_search_domains)\n @dns_servers = args[:dns_servers] if args.key?(:dns_servers)\n @ntp_servers = args[:ntp_servers] if args.key?(:ntp_servers)\n end",
"def update\r\n @area = Area.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @area.update_attributes(params[:area])\r\n format.html { redirect_to areas_url(domain_id: @area.domain_id), notice: 'Area 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: @area.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def update\n @restriction = Restriction.find(params[:id])\n\n if @restriction.update(params[:restriction])\n head :no_content\n else\n render json: @restriction.errors, status: :unprocessable_entity\n end\n end",
"def set_crm_domain\n @crm_domain = Crm::Domain.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @attachments_encryption_disable_domain_to.update(attachments_encryption_disable_domain_to_params)\n format.html { redirect_to attachments_encryption_disable_domain_tos_url, notice: 'Attachments encryption disable domain to was successfully updated.' }\n format.json { render :show, status: :ok, location: @attachments_encryption_disable_domain_to }\n else\n format.html { render :edit }\n format.json { render json: @attachments_encryption_disable_domain_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def update_subdomains\n backup_subdomains\n parse_subdomains\n end",
"def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\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(id:,\n name: nil,\n origin_ips: nil,\n minimum_cache_ttl: nil,\n maximum_cache_ttl: nil,\n deprecate_any_request: nil,\n ratelimit: nil)\n id_check(:id, id)\n\n data = {}\n\n unless name.nil?\n id_check(:name, name)\n max_length_check(:name, name, 160)\n data[:name] = name\n end\n\n unless origin_ips.nil?\n non_empty_array_check(:origin_ips, origin_ips)\n data[:origin_ips] = origin_ips\n end\n\n unless minimum_cache_ttl.nil?\n range_check(:minimum_cache_ttl, minimum_cache_ttl, 30, 36000)\n data[:minimum_cache_ttl] = minimum_cache_ttl\n end\n\n unless maximum_cache_ttl.nil?\n range_check(:maximum_cache_ttl, maximum_cache_ttl, 30, 36000)\n data[:maximum_cache_ttl] = maximum_cache_ttl\n end\n\n unless deprecate_any_request.nil?\n valid_value_check(:deprecate_any_request, deprecate_any_request, [true, false])\n data[:deprecate_any_request] = deprecate_any_request\n end\n\n unless ratelimit.nil?\n range_check(:ratelimit, ratelimit, 0, 100000000)\n data[:ratelimit] = ratelimit\n end\n\n cf_patch(path: \"#{uri_prefix}/virtual_dns/#{id}\", data: data)\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\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update!(**args)\n @cse_domain = args[:cse_domain] if args.key?(:cse_domain)\n @wrapped_key = args[:wrapped_key] if args.key?(:wrapped_key)\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @domain_name = args[:domain_name] if args.key?(:domain_name)\n @language_code = args[:language_code] if args.key?(:language_code)\n @use_supplied_urls_only = args[:use_supplied_urls_only] if args.key?(:use_supplied_urls_only)\n end",
"def update\n respond_to do |format|\n if @corp.update(corp_params)\n format.html { redirect_to @corp, notice: 'Corp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @corp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @website = Website.find(params[:id])\n\n if @website.update(website_params)\n head :no_content\n else\n render json: @website.errors, 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 update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @period = Period.find(params[:id])\n\n if @period.update(params[:period])\n head :no_content\n else\n render json: @period.errors, status: :unprocessable_entity\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 @question_item = QuestionItem.find(params[:id])\n# render :text => params.inspect\n\n\t\t#the 'chosen' plugin does not seem to delete the last response_domain_alls, add missing explicit empty value\n\t\tif !params[:question_item].key?(\"response_domain_all_ids\")\n\t\t\tparams[:question_item][:response_domain_all_ids] = [\"\"]\n\t\tend\n\n respond_to do |format|\n if @question_item.update_attributes(params[:question_item])\n format.html { redirect_to(@question_item, :notice => 'Question item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @advertisement_campaign.update(advertisement_campaign_params_to_update)\n format.html { redirect_to @advertisement_campaign, notice: 'Advertisement campaign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @advertisement_campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @campaign.update(campaign_params)\n render json: @campaign\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def update\n @admin_agency = Admin::Agency.find(params[:id])\n\n respond_to do |format|\n if @admin_agency.update_attributes(params[:admin_agency])\n format.html { redirect_to @admin_agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n @domain.put_attributes(@key, @attributes, :replace => :all)\n end",
"def update\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.attributes = params[:datacenter]\n @datacenter.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @datacenter.save\n format.html { redirect_to @datacenter, notice: 'Datacenter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datacenter.errors, status: :unprocessable_entity }\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"
] | [
"0.71034247",
"0.6570461",
"0.6513877",
"0.6490646",
"0.6346449",
"0.6333242",
"0.6294404",
"0.6265997",
"0.61892194",
"0.6174989",
"0.6146322",
"0.61300796",
"0.608417",
"0.6057645",
"0.604849",
"0.60423124",
"0.60218257",
"0.5990034",
"0.5987713",
"0.592205",
"0.59196925",
"0.5883425",
"0.58804125",
"0.5876873",
"0.5876873",
"0.58168715",
"0.57956403",
"0.5794617",
"0.577822",
"0.5761977",
"0.573135",
"0.5708472",
"0.57055616",
"0.5679316",
"0.5674153",
"0.56729585",
"0.565704",
"0.5651055",
"0.5645888",
"0.56333447",
"0.56200767",
"0.56143564",
"0.56106037",
"0.55984175",
"0.5575049",
"0.55626",
"0.55527717",
"0.5540565",
"0.5540565",
"0.55391896",
"0.5512954",
"0.55069995",
"0.54930794",
"0.5486168",
"0.54567915",
"0.5440985",
"0.5427754",
"0.542642",
"0.54251623",
"0.542334",
"0.5402847",
"0.5393311",
"0.5392002",
"0.53897727",
"0.5388892",
"0.5378686",
"0.5357735",
"0.5352818",
"0.5350003",
"0.5346487",
"0.53419465",
"0.5330322",
"0.53178424",
"0.53124243",
"0.5311326",
"0.5300434",
"0.5300434",
"0.52965546",
"0.5287224",
"0.52826786",
"0.5269644",
"0.526469",
"0.52577084",
"0.52569556",
"0.5247088",
"0.52447814",
"0.5242881",
"0.5236726",
"0.5236489",
"0.52318066",
"0.5230571",
"0.5229773",
"0.5229411",
"0.52286154",
"0.5227562",
"0.5225188",
"0.5219641",
"0.52126217",
"0.52044636",
"0.5200392"
] | 0.6770255 | 1 |
DELETE /ad_domains/1 DELETE /ad_domains/1.json | def destroy
authorize! :destroy, @ad_domain
@ad_domain.destroy
respond_to do |format|
format.html { redirect_to ad_domains_url, notice: 'Active Directory domain was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_agent_domain\n return false unless validate_domain\n render json: dme.delete_domain(params[:domain])\n end",
"def destroy\n @domain = Domain.find(params[:id])\n @domain.destroy\n\n respond_to do |format|\n format.html { redirect_to domains_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @short_domain = ShortDomain.find(params[:id])\n @short_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to short_domains_url }\n format.json { head :no_content }\n end\n end",
"def delete_domain(session,id)\n result = @connection.rest_request(\n method: :get,\n path: \"/mps_setup/delete_domain/#{id}\",\n session: session\n )\n xml = result.body.sub(/(?<=\\<n:delete_domainResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:delete_domainResponse).*?(?=\\>)/,\"delete_domainResponse\")\n return Hash.from_xml(xml).to_json\n end",
"def destroy\n @crm_domain.destroy\n respond_to do |format|\n format.html { redirect_to crm_domains_url, notice: 'Домен удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @domain.destroy\n\n head :no_content\n end",
"def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end",
"def destroy\n @domain.destroy\n respond_to do |format|\n format.html do\n redirect_to domains_url, notice: 'Domain deleted.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @domain = Domain.find(params[:id])\n @domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(domains_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domain.destroy\n respond_to do |format|\n format.html { redirect_to domains_url, notice: 'Domain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete(domain_name)\n domain_name = @client.url_encode(domain_name)\n @client.call(method: :delete, path: \"tracking-domains/#{domain_name}\")\n end",
"def destroy\n domain = @record.domain_id\n @record.destroy\n respond_to do |format|\n format.html { redirect_to domain_path(domain), notice: 'Record foi apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @domain = DOMAIN.first_or_get(params[:id])\n @domain.destroy if @domain\n\n respond_to do |format|\n flash[:notice] = 'Domain was successfully deleted.'\n format.html { redirect_to(domains_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end",
"def destroy\n @ensembl_subdomain.destroy\n respond_to do |format|\n format.html { redirect_to ensembl_subdomains_url, notice: 'Ensembl subdomain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dn.destroy\n respond_to do |format|\n format.html { redirect_to dns_url, notice: 'Dn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad_url.destroy\n respond_to do |format|\n format.html { redirect_to ad_urls_url, notice: 'Ad url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hostname.destroy\n respond_to do |format|\n format.html { redirect_to hostnames_url, notice: 'Alias was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subdomain = Subdomain.find(params[:id])\n @subdomain.delete\n\n respond_to do |format|\n format.html { redirect_to(subdomains_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\trespond_to do |format|\n\t\t\tif @domain.destroy\n\t\t\t\tformat.json { head :no_content, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @domain.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def destroy\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n @dns_device_assoc.destroy\n\n respond_to do |format|\n format.html { redirect_to dns_device_assocs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to org_ads_url(@ad.org), notice: 'Ad was successfully destroyed.' }\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 @email_domain = Email::Domain.find(params[:id])\n @email_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_domains_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domain.destroy\n redirect_to domains_url\n flash[:notice] = \"Deleted successfully\"\n end",
"def delete(*args)\n url, subdomain, path, = parse_args(*args)\n rewrap_errors do\n RestClient.delete(build_url(url || subdomain, path), headers)\n end\n end",
"def destroy\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n @home_indices_ad.destroy\n\n respond_to do |format|\n format.html { redirect_to home_indices_ads_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @virtual_domain.destroy\n respond_to do |format|\n format.html { redirect_to virtual_domains_url, notice: 'Virtual domain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subdomain.destroy\n respond_to do |format|\n format.html { redirect_to subdomains_url, notice: 'Subdomain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @budget_domain\n @budget_domain.destroy\n redirect_to budget_domains_path, notice: 'Budget domain was successfully destroyed.'\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adhub = Adhub.find(params[:id])\n @adhub.destroy\n respond_to do |format|\n format.html { redirect_to adhubs_url, notice: \"Advertisement was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(domain_guid)\n domain = @client.domain(domain_guid)\n domain.delete(:recursive => true)\n end",
"def destroy\n @cdn_config = CdnConfig.find(params[:id])\n @cdn_config.destroy\n\n respond_to do |format|\n format.html { redirect_to cdn_configs_url }\n format.json { head :ok }\n end\n end",
"def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @tmp_domain_name.destroy\n respond_to do |format|\n format.html { redirect_to tmp_domain_names_url, notice: 'Tmp domain name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end",
"def destroy\n @advertisement_campaign.destroy\n respond_to do |format|\n format.html { redirect_to advertisement_campaigns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bottom_ad.destroy\n respond_to do |format|\n format.html { redirect_to admin_bottom_ads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adss.destroy\n respond_to do |format|\n format.html { redirect_to adsses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @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(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete\n api_client.delete(url)\n end",
"def deleteEntityWebsite( 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/website\",params)\n end",
"def destroy\n @domain_map = DomainMap.find(params[:id])\n @domain_map.destroy\n\n respond_to do |format|\n format.html { redirect_to domain_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad_crawling_db.destroy\n respond_to do |format|\n format.html { redirect_to ad_crawling_dbs_url, notice: 'Ad crawling db was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete(domain_name, type:nil, name:nil, content:nil, geozone:nil)\n state_changed = false\n\n domain_id = get_domain_by_name(domain_name)\n\n matcher = {\n 'type' => type,\n 'name' => name\n }\n\n matcher['geo_region_id'] = get_geozone_by_name(geozone) unless geozone.nil?\n matcher['content'] = content unless content.nil?\n\n match_records(domain_id, matcher).each do |record|\n url_cmd = \"https://secure.rage4.com/rapi/deleterecord/#{record['id']}\"\n buffer = open(url_cmd, http_basic_authentication: [@auth_id, @auth_key]).read\n result = JSON.parse(buffer)\n\n if result['status']\n state_changed = true\n Chef::Log.info \"Deleted record #{record['id']} #{record['type']} #{record['name']} #{content} #{geozone}\" if result['status']\n else\n Chef::Log.error(\"Rage4 API error: #{result['error']}\")\n end\n end\n\n state_changed\n end",
"def destroy\n @campaign.destroy\n head :no_content\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: \"Ad was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def domain_delete(domain)\n response = send_request(domain_delete_xml(domain))\n\n get_result(response)\n end",
"def destroy\n authenticate_user!\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n @campaign = Campaign.find(params[:id])\n \n @campaign.pledges.destroy_all\n @campaign.key_policy_makers.destroy_all\n @campaign.beneficiaries.destroy_all\n @campaign.updates.destroy_all\n \n @campaign.destroy\n\n respond_to do |format|\n format.html { redirect_to campaigns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n @wp_dyna_config.destroy\n\n respond_to do |format|\n format.html { redirect_to wp_dyna_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { render :action => :admin_dash, :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # TODO: refactor models so that externaluserdomain is in portal namespace?\n # @external_user_domain = Portal::ExternalUserDomain.find(params[:id])\n @external_user_domain = ExternalUserDomain.find(params[:id])\n @external_user_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_external_user_domains_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dapi.destroy\n respond_to do |format|\n format.html { redirect_to dapis_url, notice: 'Dapi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad_type = AdType.find(params[:id])\n @ad_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @campaign.destroy\n\n head :no_content\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_path, notice: 'Quảng cáo đã được xóa.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def host_delete(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.http_delete\n end",
"def destroy\n @ad_banner.destroy\n respond_to do |format|\n format.html { redirect_to ad_banners_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @adj.destroy\n respond_to do |format|\n format.html { redirect_to adjs_url, notice: 'Adj was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(address)\n \tMailgun.submit :delete, list_url(address)\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n # @advertisement = Advertisement.find(params[:id])\n @advertisement.destroy\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end",
"def delete_db_post domain\n # Tell the user\n puts \"> Tar bort domänen från databasen\".green\n\n # Connect to the database\n conn = PG.connect( dbname: DB_DATABASE_NAME, user: DB_USER, password: DB_PASSWORD )\n\n # Delete the domain\n conn.exec \"DELETE FROM #{DB_DOMAINS_TABLE} WHERE domain = '#{domain['domain']}'\" unless $simulate\n\n # Should we also delete the accounts for the domain?\n if $delete_accounts\n # Tell the user\n puts \"> Tar bort tillhörande e-postkonton från databasen\".green\n # Delete the accounts\n conn.exec \"DELETE FROM #{DB_ACCOUNTS_TABLE} WHERE userid LIKE '%@#{domain['domain']}'\" unless $simulate\n end\n\n # Close the connection\n conn.close\nend",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend",
"def destroy\n @attachments_encryption_disable_domain_to.destroy\n respond_to do |format|\n format.html { redirect_to attachments_encryption_disable_domain_tos_url, notice: 'Attachments encryption disable domain to was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n src = Tagaly3::SRC\n # Code to connect with API\n @uri = URI.parse(src)\n http = Net::HTTP.start(@uri.host,@uri.port)\n request = Net::HTTP::Delete.new(\"/adexchange/advertiser/advertisement/#{id}\")\n response = http.request(request)\n http.finish\n redirect_to '/ads/'\n end",
"def destroy\n respond_to do |format|\n # if @dns_zone.domain.dns_zone != @dns_zone && @dns_zone.destroy\n if @dns_zone.destroy\n format.html { redirect_to @dns_zone.domain, notice: 'Dns zone was successfully deleted.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @dns_zone.domain, alert: 'Dns_zone in use!' }\n format.json { render json: @tag, status: :has_nodes }\n end\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @agency = Agency.find(params[:id])\n @agency.destroy\n\n #head :no_content\n head :accepted # o deberia dejarlo en not_content\n end",
"def destroy\n @ad = Ad.find_by_slug(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7554419",
"0.71615237",
"0.71452945",
"0.7079409",
"0.70446527",
"0.70075154",
"0.69847095",
"0.695375",
"0.6878732",
"0.6815567",
"0.677915",
"0.6765168",
"0.67313164",
"0.66974014",
"0.6670479",
"0.66543275",
"0.664836",
"0.66335446",
"0.6631375",
"0.65705687",
"0.6562874",
"0.6562208",
"0.65508175",
"0.6549318",
"0.65392125",
"0.65242267",
"0.65167874",
"0.651611",
"0.65154254",
"0.6514697",
"0.6508107",
"0.650433",
"0.65027463",
"0.6491963",
"0.6490687",
"0.64857405",
"0.6460887",
"0.6439285",
"0.6421346",
"0.6409489",
"0.6395037",
"0.63868797",
"0.63820064",
"0.637035",
"0.6370319",
"0.63675743",
"0.636741",
"0.636741",
"0.63527364",
"0.6347334",
"0.63361585",
"0.6335474",
"0.6332024",
"0.63309085",
"0.6328197",
"0.63267916",
"0.6326336",
"0.6314056",
"0.63104856",
"0.63094896",
"0.6308058",
"0.630536",
"0.630536",
"0.630536",
"0.6297718",
"0.6284506",
"0.6282083",
"0.6282083",
"0.6282083",
"0.6282083",
"0.62803155",
"0.627451",
"0.62742317",
"0.6272741",
"0.62722784",
"0.62716985",
"0.62700045",
"0.6264196",
"0.62606823",
"0.6258571",
"0.6257519",
"0.624971",
"0.6248091",
"0.6247722",
"0.6243757",
"0.6238271",
"0.62335986",
"0.6233485",
"0.6232539",
"0.623121",
"0.62255967",
"0.62238806",
"0.6221928",
"0.6216987",
"0.62157375",
"0.62057316",
"0.62037575",
"0.62024367",
"0.6201753",
"0.62011755"
] | 0.7128267 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_ad_domain
@ad_domain = AdDomain.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 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 action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 _handle_action_missing(*args); 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 call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ad_domain_params
params.require(:ad_domain).permit(:name, :description, :active)
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 |
+cache+ must behave like a hash (Hash and Monkeyshines::Store::TyrantRdbKeyStore are both cromulent choices). | def initialize _options
self.options = DEFAULT_OPTIONS.deep_merge(_options)
self.cache = Monkeyshines::Store.create(options[:cache])
self.store = Monkeyshines::Store.create(options[:store])
self.misses = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_store; end",
"def cache_store; end",
"def cache_key; @cache.to_sym; end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def cache; shrine_class.new(cache_key); end",
"def [](*args)\n args = args.first if (args.size == 1)\n return super(args) if args.is_a?(Hash)\n ck = cache_key(args)\n if obj = @cache_store.get(ck)\n return obj\n end\n if obj = super(args)\n @cache_store.set(ck, obj, @cache_ttl)\n end \n obj\n end",
"def cache_fetch(*args)\n super { |key| @store[key] }\n end",
"def cache_store(*args)\n super { |key, value| @store[key] = value }\n end",
"def key\n :cache\n end",
"def query_cache_store(key)\n raise NotImplementedError\n end",
"def cache_key\n end",
"def cache\n @cache ||= {}\n end",
"def get_memcache_key_object\n MemcacheKey.new('aml.all_aml_match')\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def get_memcache_key_object\n MemcacheKey.new('aml.aml_search')\n end",
"def cache_store\n {\n redis: @redis,\n ttl: @ttl,\n cached: @cached,\n }\n end",
"def test_ttl_eviction_on_access\n @cache.store(:a, 1)\n @cache.store(:b, 2)\n\n Timecop.freeze(Time.now + 330)\n\n @cache.store(:c, 3)\n\n assert_equal({ c: 3 }, @cache.raw[:cache])\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache_store_type\n \"memcache\"\n end",
"def cache(key, action, cache_store)\n binding.pry\n cache_key = key.to_s + \"_\" + action.to_s\n if cache_store[cache_key]\n return cache_store[cache_key]\n else\n result = yield # run the block\n cache_store[cache_key] = result # store it in our cache\n return result\n end\nend",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache_store_type\n \"dummy\"\n end",
"def make_cache\n if !@thread_safe \n @@c = {}\n elsif defined?(ThreadSafe)\n @@c = ThreadSafe::Hash.new\n else\n raise 'ThreadSafe is required to use the Memory cache.'\n end \n end",
"def update_cache(ticket, cache)\n cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)\n cache\n end",
"def cache(data); end",
"def simple_cache\n @@cache_store\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def test_set_key_value\n result = @cache.set('Key', 'Data', 0, Time.now.to_i + 60)\n cache = @cache.get('Key').args\n\n assert_true result.success\n assert_equal 'STORED', result.message.chomp.split(\"\\s\")[0]\n assert_equal 'Data', cache.data\n end",
"def cache!\n @@cache\n end",
"def cache_key(id); end",
"def cache\n @cache ||= build_cache\n end",
"def use_cache(cache)\n @cache = cache\n end",
"def cache\n env[CACHE] ||= Hash.new {|hash, sha| hash[sha] = read(sha) }\n end",
"def cache\n @cache ||= MemoryCache.new\n end",
"def cached(key:, ttl: 5.minutes)\n redis = CertManager::Configuration.redis_client\n redis_key = \"User_#{id}_#{key}\"\n value = redis.get(redis_key)\n value = JSON.parse(value) if value\n unless value\n value = yield\n redis.setex(redis_key, ttl, value.to_json)\n end\n value\n end",
"def cache_key\n @cache_key ||= [\n self.class.name,\n RedisMemo::Util.checksum(\n RedisMemo::Util.deep_sort_hash(@props).to_json,\n ),\n ].join(':')\n end",
"def fetch_from_cache\n get_cache_object().get make_key\n end",
"def cache(key = nil, &code)\n key ||= Stash.caller_name\n @store[key.to_sym] ||= code.call\n end",
"def get_by_ued_memcache_key_object\n MemcacheKey.new('user.user_kyc_comparison_detail')\n end",
"def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end",
"def [](key)\n data = @cache.get key\n Marshal.load Base64.decode64(data) if data\n end",
"def initialize\n @cache = {}\n end",
"def cache(key = nil)\n key ||= BasicCache.caller_name\n key = key.to_sym\n if include? key\n @store[key].value\n else\n value = yield\n @store[key] = TimeCacheItem.new Time.now, value\n value\n end\n end",
"def cache_store_type\n \"memory\"\n end",
"def store(value, *key)\n @cache[key] = value\n end",
"def cache\n DataCache\n end",
"def cache(key, as_json = false)\n @cache ||= { json: {}, raw: {} }\n if block_given?\n @cache[:raw][key] = yield\n @cache[:json][key] = JSON.parse(@cache[:raw][key]) if as_json\n end\n\n @cache[as_json ? :json : :raw][key]\nend",
"def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end",
"def cached\n raise NotImplementedError\n end",
"def to_hash(*a)\n if a.empty?\n cache.dup\n else\n super\n end\n end",
"def cache\n @cache ||= Flareshow::Cache.new\n end",
"def cache\n $Redis\n end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('ost_price_points.chain_specific')\n end",
"def cached(key)\n return nil unless cache?(key)\n auth_objects_cache[key]\n end",
"def configure_cache; end",
"def git_cache\n self[KEY]\n end",
"def cached(cache_key)\n begin\n result = yield\n $memcache.set(cache_key, result, 7200)\n warn \"Component #{cache_key} Set Successfully\" \n result\n rescue\n {}\n end\n end",
"def cache_store(key, value, options = {})\n key = namespaced(key)\n ttl = options[:ttl] rescue nil\n expires = Time.now + ttl if !ttl.nil?\n record = @store[:key => key]\n\n # Figure out if the record is new or already exists\n if !record\n record = @store.create(:key => key, :value => value, :expires => expires)\n record.value\n else\n record = record.update(:value => value, :expires => expires)\n record.value\n end\n end",
"def check_cache(type, id)\n end",
"def check_cache(type, id)\n end",
"def cache key, opts = {}\n if opts[:ttl]\n # cache globaly if ttl provided\n Lux.cache.fetch(key, opts) { yield }\n else\n data = @var[:cache] ||= {}\n data = @var[:cache][key]\n return data if data\n @var[:cache][key] = yield\n end\n end",
"def singleton_cache; end",
"def cache_read(key: cache_key, **)\n Rails.cache.read(key, namespace: namespace) if validate_key(key)\n end",
"def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value in the cache\n return store( key, value )\n end",
"def cache(key, value)\n @cache[key] = value\n end",
"def cached?(key)\n false\n end",
"def check_cache(type, id)\n end",
"def save_cache\n store_in_cache(@json_response) if valid_rates?(@json_response)\n rescue Errno::ENOENT\n raise InvalidCache\n end",
"def initialize(cache)\n self.cache = cache\n end",
"def cache(key, &block)\n fail 'Block required!' unless block_given?\n Rails.cache.fetch(key, cache_config, &block)\n end",
"def cached?; end",
"def call_with_cache(key)\n cache.key?(key) ? cache[key] : cache[key] = fetch(key).call\n end",
"def cache(key, opts = {}, &block)\n key = Util.md5(key)\n if opts[:disable] || !Config.production?\n yield(self)\n elsif @store.include?(key) && (!opts[:update] || opts[:defer])\n Worker.defer { update(key, opts, &block) } if opts[:update]\n opts[:marshal] ? Marshal.restore(@store[key]) : @store[key]\n else\n update(key, opts, &block)\n end\n end",
"def new_store\n Cache.new\n end",
"def cache_key(load_key)\n load_key\n end",
"def cache\n @cache ||= Chef::Cache.new()\n end",
"def initialize_cache\n @elephant_cache = {}\n end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('client.api_credentials')\n end",
"def cache(key, opts = {}, &block)\n instance.cache(key, opts, &block)\n end",
"def cache(opts = {}, &block)\n expiration_time = (opts[:expires_in] || default_expire_time).to_i\n stale_time = (opts[:stale_for] || default_stale_if_error_time).to_i\n cache_key = opts[:key]\n\n set_headers(expiration_time, stale_time)\n\n if expiration_time > 0\n ::Rails.cache.fetch(cache_key, raw: true, expires_in: expiration_time) do\n block.call.to_json\n end\n else\n block.call.to_json\n end\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def cache_value?; end",
"def store(key, contents)\n raise NotImplementedError.new 'Implement store(key, contents) in your CacheManager'\n end",
"def get(key)\n @cache[key]\n end",
"def cached_render_memory\n cache = Cache.actions\n options = cache_options\n store_options = {}\n key = full_path\n\n if options.respond_to?(:values_at)\n block, ttl = options.values_at(:key, :ttl)\n\n key = [full_path, block.call] if block\n store_options[:ttl] = ttl if ttl\n end\n\n cached_memory_process(cache, key, store_options)\n end",
"def [](key)\n puts \"STUB: [] in CacheMethods::Cache\"\n end",
"def cache_look(src, dst)\n #p 'cache'\n res = @redis.get redis_key(src, dst)\n res.to_f if res\n end"
] | [
"0.72714496",
"0.72714496",
"0.70328534",
"0.69505024",
"0.69505024",
"0.6944917",
"0.69408226",
"0.6904367",
"0.68752587",
"0.6856064",
"0.67527133",
"0.6676023",
"0.66746426",
"0.66718924",
"0.666134",
"0.666134",
"0.666134",
"0.666134",
"0.666134",
"0.666134",
"0.666134",
"0.664573",
"0.6643776",
"0.66309834",
"0.6594068",
"0.6594068",
"0.6573068",
"0.6573068",
"0.6563608",
"0.65453964",
"0.6540413",
"0.6540413",
"0.6540413",
"0.6540413",
"0.65249974",
"0.6514448",
"0.6500181",
"0.6484847",
"0.6477756",
"0.64700896",
"0.64700896",
"0.6448173",
"0.6426045",
"0.6424307",
"0.6393738",
"0.63701516",
"0.63529176",
"0.6321242",
"0.6311375",
"0.6306626",
"0.6290941",
"0.62876004",
"0.6286857",
"0.6286126",
"0.62835145",
"0.62829596",
"0.6276789",
"0.6261586",
"0.6249091",
"0.62470424",
"0.62425596",
"0.6239604",
"0.62308586",
"0.6215379",
"0.6207166",
"0.6188359",
"0.61670107",
"0.6162275",
"0.61556846",
"0.61546594",
"0.6152719",
"0.61522734",
"0.61490995",
"0.61490995",
"0.6125184",
"0.6117698",
"0.60960686",
"0.6082923",
"0.60803163",
"0.6078505",
"0.6073478",
"0.6067642",
"0.60667235",
"0.6063553",
"0.60623854",
"0.6057411",
"0.6057334",
"0.60556483",
"0.60517156",
"0.60467315",
"0.6043737",
"0.6037769",
"0.603354",
"0.60323524",
"0.60305935",
"0.6030542",
"0.60225487",
"0.6019871",
"0.60013705",
"0.59920496",
"0.59882486"
] | 0.0 | -1 |
If key is absent, save the result of calling the block. If key is present, block is never called. Ex: rt_store.set(url) do fetcher.get url will only be called if url isn't in rt_store end | def set key, force=nil, &block
return if (!force) && cache.include?(key)
cache_val, store_val = block.call()
return unless cache_val
cache.set_nr key, cache_val # update cache
store << store_val # save value
self.misses += 1 # track the cache miss
store_val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(key, &block)\n store.compute_if_absent(key, &block)\n end",
"def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value in the cache\n return store( key, value )\n end",
"def fetch(key)\n @monitor.synchronize do\n found, value = get(key)\n found ? value : store(key, yield)\n end\n end",
"def cache(key, action, cache_store)\n binding.pry\n cache_key = key.to_s + \"_\" + action.to_s\n if cache_store[cache_key]\n return cache_store[cache_key]\n else\n result = yield # run the block\n cache_store[cache_key] = result # store it in our cache\n return result\n end\nend",
"def get(key, &block)\n @store.synchronize do\n @store.get(key, &block)\n end\n end",
"def get(key, &block)\n return if key.nil?\n @_lock.synchronize do\n if !has_key?(key.to_sym) && block_given?\n value = yield\n _publish(key.to_sym, :set, nil, value)\n store(key.to_sym, value)\n else\n self[key.to_sym]\n end\n end\n end",
"def cache(key, opts = {}, &block)\n key = Util.md5(key)\n if opts[:disable] || !Config.production?\n yield(self)\n elsif @store.include?(key) && (!opts[:update] || opts[:defer])\n Worker.defer { update(key, opts, &block) } if opts[:update]\n opts[:marshal] ? Marshal.restore(@store[key]) : @store[key]\n else\n update(key, opts, &block)\n end\n end",
"def fetch_or_default(key, &block)\n @hash[key] = @hash.fetch(key, &block)\n end",
"def once (key, store: \"/var/cache/blower.json\", quiet: false)\n return yield unless key\n log.info \"once: #{key}\", quiet: quiet do\n hash_map(hosts) do |host|\n done = begin\n JSON.parse(host.read(store, quiet: true))\n rescue => e\n {}\n end\n unless done[key]\n on [host] do\n yield\n end\n done[key] = true\n host.write(done.to_json, store, quiet: true)\n end\n end\n end\n end",
"def cache(key = nil, &code)\n key ||= Stash.caller_name\n @store[key.to_sym] ||= code.call\n end",
"def get_or_cache(key, expiry = 0, &block)\n return block.call(key) unless servers?\n get(key) || put(key, block.call(key))\n end",
"def fetch(key)\n now = Time.now.public_send(_kind)\n value = get(key, now)\n\n if value.nil?\n clear_all(key)\n value = set(key, now, set_nil(yield))\n end\n\n unset_nil(value)\n end",
"def call(key, ttl: ShopifyClient.config.cache_ttl, &block)\n value = get(key)\n\n if value.nil?\n value = block.()\n\n set(key, value, ttl: ttl)\n end\n\n value\n end",
"def fetch(*key)\n if block_given?\n @cache[key] ||= yield\n else\n @cache[key]\n end\n end",
"def cache key, value=nil, &block\n return self[key] if self.has_key?(key)\n @lock.write_sync{ @data[key] = block_given? ? yield() : value }\n end",
"def fetch(key, options = {})\n @logger_off = true\n if !options[:force] && value = read(key, options)\n @logger_off = false\n log(\"hit\", key, options)\n value\n elsif block_given?\n @logger_off = false\n log(\"miss\", key, options)\n\n value = nil\n seconds = Benchmark.realtime { value = yield }\n\n @logger_off = true\n write(key, value, options)\n @logger_off = false\n\n log(\"write (will save #{'%.5f' % seconds})\", key, nil)\n\n value\n end\n end",
"def fetch(*key)\n @cache[key] ||= yield\n end",
"def fetch( key, &block )\n fail NotImplementedError\n end",
"def cache(key = nil)\n key ||= BasicCache.caller_name\n key = key.to_sym\n if include? key\n @store[key].value\n else\n value = yield\n @store[key] = TimeCacheItem.new Time.now, value\n value\n end\n end",
"def storing\n if block_given?\n yield\n end.tap { persist! if persistible? }\n end",
"def get(key, &block)\n do_with_logging(:get, key) do\n retryable do\n val = self.adapter.get(key)\n handle_store_object(key, adapter.unmarshal(val), &block)\n end\n end\n end",
"def fetch key, exp=60, &block\n get(key) or block.().tap {|x| set(key, x, exp)}\n end",
"def call_with_cache(key)\n cache.key?(key) ? cache[key] : cache[key] = fetch(key).call\n end",
"def store(key, value)\r\n obj = for_context(self) { |c| c.store(key, value); c }\r\n return if obj != self \r\n super(key, value)\r\n end",
"def cache(key)\n return @cache[key] if cached?(key)\n\n @cache[key] = yield\n end",
"def cache(key)\n @lock.synchronize do\n @contents[key] ||= yield\n end\n end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def fetch(key, &block)\n result = cache.read(key) if should_cache?\n\n if result.nil?\n if block_given?\n ActiveRecord::Base.connection.with_master do\n result = yield\n end\n result = map_cached_nil_for(result)\n\n if should_cache?\n cache.write(key, result)\n end\n end\n logger.debug \"[IdentityCache] cache miss for #{key}\"\n else\n logger.debug \"[IdentityCache] cache hit for #{key}\"\n end\n\n unmap_cached_nil_for(result)\n end",
"def store_or_delete(key,value_or_nil)\n if value_or_nil\n store(key,value_or_nil)\n else\n delete(key)\n end\n end",
"def fetch_if(key_or_proc, key, &block)\n if get(key)\n key_or_proc = key_or_proc.call if key_or_proc.is_a?(Proc)\n value = fetch(key_or_proc, &block)\n else\n value = block.call\n key_or_proc = key_or_proc.call if key_or_proc.is_a?(Proc)\n set(key_or_proc, Marshal.dump(value))\n end\n value\n end",
"def store_value_simply key, value\n @@key_value_storage[key] ||= value if key\n end",
"def store *args, █ put *args, █ end",
"def with_local_cache(key, force_refresh, &block)\n raise ScriptError unless block_given?\n if force_refresh || @associations_cache[key].nil?\n results = yield\n @associations_cache[key] = results\n end\n @associations_cache[key]\n end",
"def process(key, options = {})\n before_all(key, options)\n is_typed?(key, Hash) ? store(key, ->(item){Hash.try_convert(item)}, options) : raise_type_error(key, \"Hash\")\n end",
"def [](key)\n @lock.synchronize { @store[key] }\n end",
"def fetch(key, force: false)\n if force\n value = yield if block_given?\n write(key, value) if value\n else\n value = @cache.read(key)\n unless value\n value = yield if block_given?\n @cache.write(key, value) if value\n end\n end\n value\n end",
"def set(key, value=nil, &block)\n assert_value_or_block_not_both(value, block)\n\n # Skip validation behavior if no validators are registered for this key\n return super unless validators.key?(key)\n\n value_to_evaluate = block || value\n\n if callable_without_parameters?(value_to_evaluate)\n super(key, assert_valid_later(key, value_to_evaluate), &nil)\n else\n assert_valid_now(key, value_to_evaluate)\n super\n end\n end",
"def cached_client(type, key)\n return yield unless cache_enabled?(type)\n\n @cache[type][key] ||= yield\n end",
"def test_no_block_get\n @noblock_cache.set key, @value\n assert_equal @value, @noblock_cache.get(key)\n end",
"def cached_fetch(key)\n fetch(key) do\n return yield unless h = self[:cache]\n Sequel.synchronize{return h[key] if h.has_key?(key)}\n value = yield\n Sequel.synchronize{h[key] = value}\n end\n end",
"def any(key, options = {})\n before_all(key, options)\n store(key, ->(item){item}, options)\n end",
"def cache(key, opts = {}, &block)\n return yield if opts[:disable] || !Config.production?\n if exist?(key) && !opts[:update]\n content = read(key)\n return opts[:marshal] ? Marshal.restore(content) : content\n end\n content = yield\n write(key, opts[:marshal] ? Marshal.dump(content) : content)\n content\n end",
"def cache(key)\n @cache ||= {}\n timestamp, data = @cache[key]\n if timestamp && data && Time.now - timestamp < 1\n puts 'CACHE HIT'\n data\n else\n data = yield\n @cache[key] = [Time.now, data]\n data\n end\n end",
"def cache(key, &block)\n fail 'Block required!' unless block_given?\n Rails.cache.fetch(key, cache_config, &block)\n end",
"def memoize(key)\n return instance_variable_get(\"@#{key}\") if instance_variable_defined?(\"@#{key}\")\n\n instance_variable_set(\"@#{key}\", yield)\n end",
"def save(key, data)\n self.ready\n \n unless @validId.nil?\n\t\t\t\traise SwapDmi::CacheSaveError.new(key) unless self.instance_exec(key, &@validId)\n end\n \n self.evict(key) if @evictWhen[:save]\n self.instance_exec(key, data, &@save)\n self\n end",
"def restore(key, data_store = nil, default = nil)\n data_store.transaction do\n data_store[key.to_sym] || default\n end\n end",
"def cached(cache_key)\n begin\n result = yield\n $memcache.set(cache_key, result, 7200)\n warn \"Component #{cache_key} Set Successfully\" \n result\n rescue\n {}\n end\n end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return true\n end",
"def cache(key, options = {}, &block)\n if cache_configured?\n cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)\n else\n yield\n end\n end",
"def cached_lookup(key, default, &block)\n if cache_has_key(key)\n retval = cached_value(key)\n else\n retval = yield key, default\n cache(key, retval)\n end\n retval\nend",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set method\n set(key[0..-2], *args)\n else\n args.push(Proc.new(&block)) if block\n return call(key, *args) if args.length > 0\n get(key)\n end\n end",
"def with(key)\n @path.push(key)\n value = yield\n @path.pop\n value\n end",
"def with(key)\n @path.push(key)\n value = yield\n @path.pop\n value\n end",
"def cache_store(*args)\n super { |key, value| @store[key] = value }\n end",
"def cache(key, options = {}, &block)\n name = cache_name(key)\n tags = options.delete(:tags) || []\n check_tags_existance(name, tags)\n if ActionController::Base.perform_caching\n cache = read(name, options)\n if cache && cache.is_a?(Hash) && cache[:data] && is_cache_actual?(cache) \n # Overwriting the cache with the same data for avoiding its expiration\n # when 'freeze cache' option is enabled.\n write(name, cache, options) if AstroConfig.freeze_cache?\n data = modify_cache_by_personalized_data(cache[:data], options)\n data.is_a?(String) ? data.html_safe : data\n else\n self.class.do_not_cache_block = false\n output = execute_block(&block)\n unless self.class.do_not_cache_block\n tags_hash = generate_tags_hash(tags)\n write(name, { :data => output, :tags => tags_hash }, options)\n end\n self.class.do_not_cache_block = false\n output.is_a?(String) ? output.html_safe : output\n end\n else\n execute_block(&block)\n end\n end",
"def store(key, process, options)\n contains?(key, validator.datas[key], options[:contains]) if(options.has_key?(:contains))\n super(key, process, options)\n end",
"def cache(key, opts = {}, &block)\n instance.cache(key, opts, &block)\n end",
"def memoize_results(key)\n (@inst_var_refreshable || @inst_var_refreshable = Set.new) << key\n return instance_variable_get(key) if instance_variable_defined?(key)\n instance_variable_set(key, yield)\n end",
"def method_missing( m, *args, &block )\n puts \"Storage#method_missing( #{m.inspect}), #{args.inspect} )\"\n\n ## todo: add support ? for bool\n ## elsif m.end_with?('?') && args.empty?\n ## @storage[m]\n\n if m =~/\\A[a-z][a-zA-Z0-9_]*=\\z/ && args.size == 1\n key = m[0...-1].to_sym ## note: cut-off trailing equal sign (=), use EXCLUSIVE (...) range and NOT INCLUSIVE (..)\n value = args[0]\n puts \" SSTORE( #{key.inspect}, #{value.inspect} )\"\n @data[key] = value\n elsif m =~/\\A[a-z][a-zA-Z0-9_]*\\z/ && args.empty? ## todo/fix: check for valid identifier\n key = m\n puts \" SLOAD( #{key.inspect} )\"\n @data[key]\n else\n super\n end\n end",
"def get_by_key(key)\n @store_[key] || YakvdConstants.key_not_found\n end",
"def put(key, value, timeout = @default_timeout)\n @store.synchronize do\n @store.put(key, value, timeout) unless value.nil?\n end\n end",
"def call(key, ttl: TTL)\n key = namespaced_key(key)\n\n fetch(key) || cache(key, yield, ttl)\n end",
"def store_hash(key, process, options)\n has_keys?(key, options[:has_keys]) if(options.has_key?(:has_keys))\n contains?(filtered, datas[key].values, options[:contains]) if(options.has_key?(:contains))\n store(key, process, options)\n end",
"def fetch(key)\n send(:[], key){return(yield if defined?(yield))}\n end",
"def updateKey; @key = getKey; self end",
"def once_per_run(key, &block)\n Pedant::OncePerRun.once_per_run(key, &block)\n end",
"def store(value, *key)\n @cache[key] = value\n end",
"def lookup_or_add(key)\n\t\traise ArgumentError, \"cleanup() has already been called.\" if @done\n\t\tmust_be_in_synchronize_block\n\t\tserver = @collection[key]\n\t\tif server\n\t\t\tregister_activity(server)\n\t\t\treturn server\n\t\telse\n\t\t\tserver = yield\n\t\t\tif !server.respond_to?(:start)\n\t\t\t\traise TypeError, \"The block didn't return a valid AbstractServer object.\"\n\t\t\tend\n\t\t\tif eligable_for_cleanup?(server)\n\t\t\t\tserver.next_cleaning_time = Time.now + server.max_idle_time\n\t\t\t\tif @next_cleaning_time && server.next_cleaning_time < @next_cleaning_time\n\t\t\t\t\t@next_cleaning_time = server.next_cleaning_time\n\t\t\t\t\t@next_cleaning_time_changed = true\n\t\t\t\tend\n\t\t\tend\n\t\t\t@collection[key] = server\n\t\t\treturn server\n\t\tend\n\tend",
"def delete( key, &block )\n\t\trval = @data.delete( key, &block )\n\t\treturn rval\n\tensure\n\t\t@modified = true if rval != @data.default\n\tend",
"def store(key, value)\n #open!(key)\n super(key, value)\n end",
"def register(key, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @items[key] = block\n end",
"def snapshot_key\n # no-op\n end",
"def add_key_value?(key, val)\n @store.transaction do\n return false if @store.to_h.key? key\n @store[key]=val\n end\n true\n end",
"def fetch(key, options = {})\n options ||= {}\n value = read(key, options) unless options[:force]\n\n if value.nil? && block_given?\n value = yield(key)\n write(key, value, options)\n end\n\n value\n end",
"def cache!(key=nil, options={})\n if @context.controller.perform_caching\n value = _cache_fragment_for(key, options) do\n _scope { yield self }\n end\n\n merge! value\n else\n yield\n end\n end",
"def put(key, value)\n has_key = get(key)\n\n if has_key != -1\n @store[key].val = value\n elsif has_key == -1 && length < capacity\n n = @store[key] = LNode.new(value, key)\n append_to_tail(n)\n @length += 1\n else #if has_key == -1 && length >= capacity\n lru = @store[:head].nxt\n remove_node_from_store_links(lru)\n @store.delete(lru.key)\n n = @store[key] = LNode.new(value, key)\n append_to_tail(n)\n end\n nil\n end",
"def store\n @cache.compute_if_absent(current_store_id) { new_store }\n end",
"def []=(key, value)\n @lock.synchronize { @store[key] = value }\n end",
"def cache_fetch(*args)\n super { |key| @store[key] }\n end",
"def get(key, expires_in = 0, &block)\n\n #look for the cache item in the store\n items = @store.select { |i| i[:key] == build_key(key) }\n item = if !items.empty? then items[0] else nil end\n #check if a valid item was found in the store\n if item == nil || (item[:expires] != nil && item[:expires] <= Time.now.utc)\n #a valid item wasn't found so check if a hydration block was specified.\n if block_given?\n #create the item from the block\n value = yield\n #put the item in the store\n set(build_key(key), value, expires_in)\n return value\n else\n #no hydration block was specified\n\n #check if an expired item was found\n if item != nil\n #remove the expired item from the store\n remove(build_key(key))\n end\n return nil\n end\n end\n\n #return the item\n return item[:value]\n end",
"def cache(name, opts={}, &block)\n cache = opts[:cache]\n if cache then\n if redis.exists name then\n redis.get name\n else\n value = yield\n redis.set name, value\n value\n end\n else\n value = yield\n redis.set \"last_request\", Time.now\n end\n end",
"def derivatives_storage(storage_key = nil, &block)\n if storage_key || block\n shrine_class.derivatives_options[:storage] = storage_key || block\n else\n shrine_class.derivatives_options[:storage]\n end\n end",
"def ensure_hook(key,&block)\n if block_given? then\n @ensure_hooks[key] = block\n else\n @ensure_hooks.delete(key)\n end\n end",
"def query_cache_store(key)\n raise NotImplementedError\n end",
"def defineSave(&block)\n\t \traise SwapDmi::CacheReconfigureError.new if @readyFlag\n @save = block\n self\n end",
"def cache(key)\n if !@cache_client\n # no cache client\n return yield self\n end\n\n if result = @cache_client.get(key)\n # cache hit\n result\n else\n #cache miss\n result = yield self\n @cache_client.set(key, result)\n result\n end\n end",
"def cache key\n begin\n if expired?(key)\n content = Proc.new { yield }.call\n set( key, content )\n end\n content ||= get( key )\n return content\n rescue LocalJumpError\n return nil\n end\n end",
"def retrieve_then_add(key=nil)\n if key.class == String && block_given?\n return @j_del.java_method(:retrieveThenAdd, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(key,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling retrieve_then_add(key)\"\n end",
"def unless_cached(opts={})\n partial_key = opts[:key].present? ? opts[:key] : caller.first.match(/`[^']*/).to_s[1..-1]\n key = \"#{self.base_redis_key}_#{partial_key}\"\n\n self.class.unless_cached_base(key, opts) do\n yield\n end\n end",
"def add_then_retrieve(key=nil)\n if key.class == String && block_given?\n return @j_del.java_method(:addThenRetrieve, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(key,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling add_then_retrieve(key)\"\n end",
"def fetch(key); end",
"def store(key, value)\n value = apply_store_hook(key, value)\n key = aliases[key] || key\n super(key, value) unless @frozen_keys.include?(key)\n end",
"def key=(key); end",
"def stored_key(key)\n h(key)\n end",
"def fetch(key, ttl = nil, req_options = nil)\n req_options = req_options.nil? ? CACHE_NILS : req_options.merge(CACHE_NILS) if cache_nils\n val = get(key, req_options)\n return val unless block_given? && not_found?(val)\n\n new_val = yield\n add(key, new_val, ttl_or_default(ttl), req_options)\n new_val\n end",
"def delete(key, &block); end",
"def set_key(key, &block)\n @callbacks[key.ord] = block\n end",
"def persist(key); end"
] | [
"0.68902004",
"0.65900046",
"0.65330905",
"0.6531008",
"0.6495434",
"0.64840317",
"0.6365966",
"0.63627434",
"0.6342997",
"0.6243094",
"0.61999434",
"0.6132791",
"0.6023812",
"0.6022675",
"0.60095876",
"0.600445",
"0.5999143",
"0.59828645",
"0.5979067",
"0.59119284",
"0.59112036",
"0.5864317",
"0.5837497",
"0.58092314",
"0.57780963",
"0.5740346",
"0.5672676",
"0.5672676",
"0.565428",
"0.5633692",
"0.56183314",
"0.5590685",
"0.5572923",
"0.5567293",
"0.5562464",
"0.55566156",
"0.55487776",
"0.55350614",
"0.5524058",
"0.55051965",
"0.54997617",
"0.54986215",
"0.54850817",
"0.54847074",
"0.5484461",
"0.5479432",
"0.5449684",
"0.54474735",
"0.5444852",
"0.5439928",
"0.5438038",
"0.54214215",
"0.5392207",
"0.5391434",
"0.5391434",
"0.5390254",
"0.53753334",
"0.5371255",
"0.53666127",
"0.5365404",
"0.5335619",
"0.53289485",
"0.5326688",
"0.53259146",
"0.5315871",
"0.5303386",
"0.529107",
"0.52897084",
"0.5280232",
"0.527821",
"0.5274644",
"0.52704895",
"0.5270457",
"0.5265447",
"0.52596134",
"0.5256828",
"0.52516466",
"0.5247736",
"0.52468437",
"0.52456963",
"0.52451336",
"0.5242137",
"0.52256835",
"0.5225314",
"0.5222246",
"0.5220545",
"0.5220288",
"0.5215478",
"0.52122843",
"0.5210905",
"0.52086",
"0.52081037",
"0.5200124",
"0.5199554",
"0.51955825",
"0.51935804",
"0.5191186",
"0.5190949",
"0.51899016",
"0.5182292"
] | 0.6650979 | 1 |
def play until false loop do | def notify_players
if board.in_check?(@player.color)
puts "#{@player.color} is in Check"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n\t# while $game_end == false\n\t\t9.times { \n\t\t\tif $game_end == false\n\t\t\t\tturns\n\t\t\tend\n\t\t}\nend",
"def play\n while true\n speel_game\n break unless speel_opnieuw?\n end\n puts \"Bedankt voor het spelen!\"\nend",
"def play\n #turns = 0\n until over?\n turn\n end\nend",
"def play\n\t\tgame_loop\n\tend",
"def play\n display_welcome_message\n loop do \n human.choose #.choose is an instance method on the Player class, since human is an object of the Player class\n computer.choose\n display_winner\n break unless play_again? #could put play again loop here, but easier to not have double loop here\n end \n display_goodbye_message\n end",
"def play\n while(true)\n answer1 = @human.choose\n answer2 = @computer.choose\n puts self.win?(answer1,answer2)\n self.continue?\n end\n end",
"def play_until_victory \n\tuntil victory == true \n\t\t first_player_plays\n\t\t second_player_plays\n\tend\n end",
"def play\n until over? do\n turn;\n end\n\n if won?\n puts \"Congratulations #{winner}!\";\n replay\n elsif draw?\n puts \"Cat's Game!\";\n replay\n end\n end",
"def play\nuntil over? do\n turn\n end\nif won?\n puts \"Congratulations #{winner}!\"\nelsif draw?\nputs \"Cats Game!\"\nend\nend",
"def play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end",
"def play()\n until over?() == true\n turn()\n end\n if draw?() != true\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end",
"def play\n until over? do\n turn\n end\n if draw?\n puts \"Cat's Game!\"\n else\n puts \"Congratulations #{winner}!\"\n end\nend",
"def play\n until over? == true\n turn\n end\n\n if won? != false\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end",
"def play\n\n until over?\n turn\n end\n\n if self.won?\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n puts \"Cat's Game!\"\n end\n\n end",
"def play\n until over? !=false\n turn\n end\n if won? != false\n puts \"Congratulations #{winner}!\"\n elsif draw? == true\n puts \"Cats Game!\"\n end \nend",
"def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end",
"def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end",
"def play\n until over?\n turn\n end\n if winner\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end",
"def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end",
"def play\r\n turn until over?\r\n \r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n \r\n else\r\n puts \"Cat's Game!\"\r\n end\r\nend",
"def play\n until over?\n turn\n end\n if draw?\n puts \"Cat's Game!\"\n elsif won?\n puts \"Congratulations #{winner}!\"\n end\nend",
"def play\n turn until over?\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end",
"def play\nturn until over?\nif won?\n puts \"Congratulations #{winner}!\"\nelsif draw? == true\n puts \"Game over! Thanks for playing.\"\nend\nend",
"def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end",
"def play\n choice = ask_menu_option\n choice == '1' ? setup : load\n continue = 1\n while continue == 1\n round_sequence\n if ask_play_again == 'y'\n reset\n else\n continue = 0\n puts 'Goodbye!'\n puts \"\\n\\n\"\n end\n end\n end",
"def play\n\t\n\t\tuntil over?\n\t\tturn\n\t\tend\n\t\t\n\t\tif won? \n\t\t\twinner\n\t\telsif draw? \n\t\t\tputs \"The game was a Draw!\"\n\t\telse \n\t\t\tputs \"Unexpected Error Occured\" \n\t\tend\n\tend",
"def play\n reset\n loop do\n break if @guesses == 0 || @win == true\n status_message\n enter_number\n evaluation_message\n end\n lose_message if @guesses == 0 && @win == false\n end",
"def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n\n else draw?\n puts \"Cat's Game!\"\n\n end\n end",
"def play_against_human\r\n while @running\r\n turn(:X)\r\n result?\r\n break if !@running\r\n turn(:O)\r\n result?\r\n end\r\n end",
"def play\n until over?\n @board.display\n turn\n end\n @board.display\n puts draw? ? \"Cat's Game!\" : \"Congratulations #{winner}!\"\n end",
"def play\n until self.over? do\n turn\n end\n\n if self.won?\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n puts \"Cat's Game!\"\n end\n end",
"def play\n take_turn until @master.game_over?\n @master.show_board\n @robot.speak\n end",
"def play\n\n until self.over?\n self.turn\n end\n\n if self.won?\n self.board.display\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n self.board.display\n puts \"Cat's Game!\"\n end\n end",
"def game_loop\n end",
"def endless_loop?; end",
"def play; end",
"def play\n # counter = 0\n # until counter == 9\n # turn\n # counter += 1\n # end\n\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end",
"def playback_loop\n loop do\n if handle_progress?\n @threads << ::MMPlayer::Thread.new { handle_progress }\n end\n handle_eof if handle_eof?\n sleep(0.05)\n end\n true\n end",
"def play\n until over?|| draw?\n @board = turn\n end\n unless winner.nil?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end",
"def loop; end",
"def play\n # checks if the game is over after every turn\n until over?\n # plays the first few turns of the game\n turn\n end\n\n # checks if the game is won after every turn\n if won?\n puts \"Congratulations #{winner}!\"\n # checks if the game is draw after every turn\n elsif draw?\n puts \"Cats Game!\" # prints \"Cats Game!\" on a draw\n end\n\n end",
"def play(board)\n until over?(board) do\n turn(board)\n end\n\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n elsif draw?(board)\n puts \"Cat's Game!\"\n end\nend",
"def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end",
"def infinite_loop?; end",
"def play!\n print_welcome()\n\n until @win || @lose\n print_current_status()\n letter_or_word = ask_player_letter_or_word()\n\n case letter_or_word\n when \"L\"\n letter_guess()\n when \"W\"\n word_guess()\n else\n puts \"There is an error in the program\"\n end\n\n if @lose == true\n print_lose\n elsif @win == true\n print_win\n end\n end\n end",
"def game_loop\n end",
"def beginGameLoop\n @gameLoop.play\n end",
"def play(board)\n until over?(board) do\n turn(board)\n end\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n elsif draw?(board)\n puts \"Cat's Game!\"\n end\nend",
"def play\n\n while @game_complete == false\n\n # starting game text to help the player create a mental picture of the environment\n @new_player_name = \"Mr Developer\" if @debug\n player_set_up unless @debug || @starting_game_text == false\n puts starting_game_text unless @debug || @starting_game_text == false\n @starting_game_text = false\n \n slow_type(\"\\nYou are in #{find_room_by_id(@current_room_id).name}\")\n main_menu = TTY::Prompt.new\n\n choices = [\n { name: 'Move Player', value: 1 },\n { name: 'Look At', value: 2 },\n { name: 'Pick Up', value: 3 },\n { name: 'Use Item', value: 4 },\n { name: 'Talk To', value: 5 },\n { name: 'Quit', value: 6 },\n ]\n attr = main_menu.select(slow_type(\"What would you like to do?\"), choices)\n\n # gets user input\n \n if attr == 1\n player_move\n \n elsif attr == 2\n look_at\n\n elsif attr == 3\n pick_up\n\n elsif attr == 4\n use_item\n\n elsif attr == 5\n talk_to\n \n else attr == 6\n @game_complete = true\n end\n\n end\n end",
"def play\n \n end",
"def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end",
"def keep_playing(code)\n puts \"Code at beginning of keep_playing is #{code}\"\n while code != \"Dead\"\n puts \"Code at beginning of while loop is #{code}\"\n next_scene = @@scenes[code]\n next_scene.set_player(@player)\n code = next_scene.play #this is really bad. This play function ends up doing two things\n puts \"Code at end of while loop is #{code}\"\n end\n end",
"def on\n loop do\n while @count < @playlist.size\n self.play_music\n self.wait\n end\n if (@repeat) # If @repeat is true, resets playlist and loops through again\n @count = 0\n else\n break\n end\n end\n @count = 0\n end",
"def play\n while !over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end",
"def play_single_round\n loop do\n clear\n deal_initial_cards\n show_cards\n turn_cycle\n update_score\n show_result\n break if someone_won_tournament?\n quit_early unless play_again?\n reset\n end\n end",
"def play\n display_welcome_message\n loop do\n number_of_games = 0\n loop do\n computer.choose(@human)\n human.choose\n display_moves\n increment_game_count\n puts\n display_winner\n display_score\n update_win_history\n number_of_games += 1\n puts\n break if first_to_score?(10)\n end\n display_final_outcome\n reset_game\n break unless play_again?\n end\n display_goodbye_message\n end",
"def game_play\n until game_over\n graphic\n guess\n end\n end",
"def play \n end",
"def play\n while !over?()\n turn()\n end\n\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cat's Game!\"\n end\n end",
"def play(board)\n until over?(board) do\n turn(board)\n end\n\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n else\n puts \"Cats Game!\"\n end\nend",
"def play\n until board.king_in_checkmate?(:white) || board.king_in_checkmate?(:black) || board.stalemate?\n display.render\n input = get_start\n @board.piece_in_hand = @board[input]\n make_move(input)\n @board.switch_players!\n end\n display.render\n if board.king_in_checkmate?(:white)\n puts \"White is in Checkmate\\nBlack wins!\"\n elsif board.king_in_checkmate?(:black)\n puts \"Black is in Checkmate\\nWhite wins!\"\n else\n puts \"Stalemate!\"\n end\n rescue BadInputError, BadMoveError\n @board.drop_piece\n retry\n end",
"def play\n \t@fragment = \"\"\n until @losses.keys.length == 1\n system(\"clear\")\n update_status\n play_round\n check_status\n puts \"Next round in 5 seconds...\".bold\n sleep(5)\n end\n final_status\n end",
"def play_game(game)\n keep_playing = true\n while keep_playing\n game.play_round\n keep_playing = game.play_again?\n end\n end",
"def play\n @board.display\n while true\n\n # begin\n coords = get_input\n perform_move(coords) if valid_move_sequence?(coords)\n @board.display\n # rescue ArgumentError => e\n # puts \"Could not execute move sequence.\"\n # puts \"Error was: #{e.message}\"\n #\n # end\n\n end\n end",
"def play\n end",
"def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cats Game!\"\n end\nend",
"def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end",
"def play(board)\n until over?(board) == true\n turn(board)\n break if won?(board) != false\n\n end\n puts \"Congratulations #{winner(board)}!\" if won?(board) != false\n puts \"Cats Game!\" if draw?(board) == true\nend",
"def run\n start_game\n game_loop\n end_game\n end",
"def play\n\t\t\twhile !win && @turns < TURNS\n\t\t\t\tturn\n\t\t\tend\n\t\t\t# counter increments at start of turn, so must be less than max turns\n\t\t\tif win\n\t\t\t\tplay_again\n\t\t\telse\n\t\t\t\tputs \"\\n Sorry, you ran out of turns. The word was #{@secret_word}\"\n\t\t\t\tplay_again\n\t\t\tend\n\t\tend",
"def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else draw?\n puts \"Cat's Game!\"\n end\n end",
"def play\n\tend",
"def play(board)\n until over?(board)\n turn(board)\n end\n\n if won?(board)\n congratulate(winner(board))\n elsif draw?(board)\n draw_message\n end\n\nend",
"def game_loop\n again = true\n\n while again\n bet\n deal\n player_action\n dealer_action\n reveal_final_hand\n print_player_outcomes\n remove_players\n\n again = play_again?\n linebreak\n end\n\n exit_message\n\n end",
"def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{ winner }!\"\n elsif draw?\n puts \"Cat's Game!\"\n else\n puts \"Game over\"\n end\n end",
"def play\n while !over?\n \t turn\n end\n if won?\n \t puts \"Congratulations \"+ winner() +\"!\"\n else\n \t puts \"Cat's Game!\"\n end\n end",
"def run\n player1 = Player.new(\"You\")\n player2 = Player.new(\"Computer\")\n rps = RockPaperScissors.new\n\t\tbegin\n\t\t\tputs \"---------Play Rock Paper Scissors!----------------\"\n\n\t\t\tplayer1.choose_by_input\n\t\t\tplayer2.choose_by_rand\n\n\t\t\tputs \"#{player1.name} picked #{player1.gesture}, and #{player2.name} picked #{player2.gesture}\"\n\n\t\t\trps.arbitrate(player1, player2)\n\n\t\t\tputs \"Do you want to play again? (Y/N)\"\n\t\t\tplay=gets.chomp.downcase\n\t\t\tplay = ( play =='y') ? TRUE: FALSE\n\n\t\tend while play==TRUE\n\tend",
"def loop\n end",
"def loop\n end",
"def loop\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n end\r\n end",
"def start()\n while true\n @room = @room.play()\n end\n end",
"def play(board)\n until over?(board)\n turn(board);\n end\n if draw?(board);\n puts \"Cat's Game!\"\n elsif won?(board);\n puts \"Congratulations #{winner(board)}!\"\n end\nend",
"def play\r\n return if self.finished?\r\n self.update\r\n end",
"def play(board)\n until over?(board)\n turn(board)\n end\nif won?(board)\n puts \"Congratulations #{winner(board)}!\"\nelsif draw?(board)\n puts 'Cats Game!'\nend\nend",
"def war\n \n until winner?(self.player1,self.player2)\n 4.times do \n player1.play\n player2.play\n end\n end\n\n handle_winner(self.player1,self.player2)\n\n end",
"def play\n while(true)\n system('clear')\n render_board\n board_update\n sleep(5)\n end\n end",
"def play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end",
"def play(board)\n until over?(board)\n turn(board)\n end\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n elsif scratch?(board)\n puts \"Cats Game!\"\n end\nend",
"def play(board)\n display_board(board)\n until over?(board)\n turn(board)\n end\n if won?(board) != false\n puts \"Congratulations #{winner(board)}!\"\n elsif draw?(board)\n puts \"Cats Game!\"\n else\n nil\n end\n #replay\nend",
"def keep_playing\n until @player_1_score == @player_victory or @player_2_score == @player_victory \n set_weapon_p1(choose_weapons)\n set_weapon_p2(choose_weapons)\n display_winner_one_game(determine_winner_one_game)\n accumulate_series_score(determine_winner_one_game)\n display_scoreboard\n end\n end",
"def play(&blk)\n start_playing\n blk.call\n ensure\n stop_playing\n end",
"def play\n @board.print_board\n 9.times do |turns|\n if turn\n break\n end\n end\n end",
"def part1\n 2.times do\n \n 6.times do\n play :G4\n play :E4\n play :E2\n sleep 0.5\n end\n \n 2.times do\n play :A4\n play :E4\n play :E2\n sleep 0.5\n end\n end\nend",
"def play(board)\n until over?(board)\n turn(board)\n end\n\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n elsif draw?(board)\n puts \"Cats Game!\"\n end\nend",
"def run\n play_round until game_over?\n puts \"#{winner} wins!\"\n end",
"def play(board)\n turn(board) until over?(board)\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n elsif draw?(board)\n puts \"Cat's Game!\"\n end\nend"
] | [
"0.7760705",
"0.7715208",
"0.7688533",
"0.76789904",
"0.7612812",
"0.7521134",
"0.75184214",
"0.7391951",
"0.73531836",
"0.7338305",
"0.7336207",
"0.7334072",
"0.7314915",
"0.72655636",
"0.7262928",
"0.7254327",
"0.72448736",
"0.72273165",
"0.7197829",
"0.719666",
"0.7184366",
"0.71463615",
"0.7144907",
"0.7118939",
"0.71150184",
"0.7111868",
"0.7071218",
"0.70695543",
"0.7068708",
"0.70640934",
"0.70568573",
"0.705048",
"0.70503604",
"0.70479983",
"0.704027",
"0.70225984",
"0.7002454",
"0.6988139",
"0.69748384",
"0.6955307",
"0.6954149",
"0.6951283",
"0.69453084",
"0.6933126",
"0.69281137",
"0.6922742",
"0.6919421",
"0.6908341",
"0.6905657",
"0.6903873",
"0.68998766",
"0.68915594",
"0.6890658",
"0.6877802",
"0.6876598",
"0.6869029",
"0.68653727",
"0.6865314",
"0.68600374",
"0.6859535",
"0.6856964",
"0.684956",
"0.6842594",
"0.68356043",
"0.6829393",
"0.682045",
"0.6809282",
"0.68039525",
"0.6799392",
"0.6798326",
"0.6789129",
"0.6788456",
"0.6786274",
"0.67825437",
"0.67800325",
"0.67777044",
"0.6766451",
"0.6763863",
"0.6762796",
"0.6762796",
"0.676251",
"0.676251",
"0.676251",
"0.676251",
"0.67565536",
"0.674952",
"0.67489547",
"0.6745003",
"0.67435616",
"0.67391956",
"0.6736388",
"0.67240363",
"0.6713335",
"0.67129385",
"0.67116535",
"0.67090917",
"0.6705129",
"0.66950846",
"0.6693473",
"0.66854227",
"0.668526"
] | 0.0 | -1 |
================== sending invoices ============================= | def send_invoices
change_date
@options = session[:invoice_options] || {}
[
:s_username, :s_first_name, :s_last_name, :s_number, :s_period_start, :s_period_end,
:s_issue_date, :s_sent_email, :s_sent_manually, :s_paid, :s_invoice_type
].each do |key|
@options[key] = params[key].try(:to_s).try(:strip) || @options[key].to_s
end
@invoices = Invoice.for_send(corrected_user_id, @options)
MorLog.my_debug("*************Invoice sending, found : #{@invoices.size.to_i}", 1)
@number = 0
not_sent = 0
params[:email_or_not] = 1
session[:invoice_options] = @options
email_from = Confline.get_value('Email_from', correct_owner_id)
if @invoices.size.to_i > 0
@invoices.each { |invoice|
user = invoice.user
attach = []
params[:id] = invoice.id
prepaid = invoice.invoice_type.to_s == 'prepaid' ? 'Prepaid_' : ''
@invoice = user.send_invoice_types.to_i
if @invoice.to_i != 0
if (user.email).length > 0
@invoice -= if @invoice >= 512
xlsx = {
file: export_invoice_to_xlsx,
content_type: 'application/octet-stream',
filename: "#{_('invoice_xlsx')}.xlsx"
}
attach << xlsx
512
else
0
end
if !(user.postpaid == 0 && invoice.invoicedetails.first.try(:name).to_s == "Manual Payment")
if (@invoice % 2) == 1
@invoice = Confline.get_value("#{prepaid}Invoice_default",
correct_owner_id).to_i
end
@invoice -= if @invoice >= 256
calls_cvs = {}
calls_cvs[:file] = get_prepaid_user_calls_csv(user, invoice)
calls_cvs[:content_type] = 'text/csv'
calls_cvs[:filename] = "#{_('Calls')}.csv"
attach << calls_cvs
256
else
0
end
@invoice -= if @invoice >= 128
csv = {}
csv[:file] = generate_invoice_by_cid_csv
csv[:content_type] = 'text/csv'
csv[:filename] = "#{_('Invoice_by_CallerID_csv')}.csv"
attach << csv
128
else
0
end
@invoice -= if @invoice >= 64
csv = {}
csv[:file] = generates_invoice_destinations_csv
unless csv[:file]
redirect_to :root unless performed?
return false
end
csv[:content_type] = 'text/csv'
csv[:filename] = "#{_('Invoice_destinations_csv')}.csv"
attach << csv
64
else
0
end
@invoice -= if @invoice >= 32
pdf = {}
pdf[:file] = generate_invoice_by_cid_pdf
pdf[:content_type] = 'application/pdf'
pdf[:filename] = "#{_('Invoice_by_CallerID_pdf')}.pdf"
attach << pdf
32
else
0
end
@invoice -= if @invoice >= 16
csv = {
file: generate_invoice_detailed_csv,
content_type: 'text/csv',
filename: "#{_('Invoice_detailed_csv')}.csv"
}
attach << csv
16
else
0
end
@invoice -= if @invoice >= 8
pdf = {
file: generate_invoice_detailed_pdf,
content_type: 'application/pdf',
filename: "#{_('Invoice_detailed_pdf')}.pdf"
}
attach << pdf
8
else
0
end
end
@invoice -= if @invoice >= 4
csv = {
file: generate_invoice_csv,
content_type: 'text/csv',
filename: "#{_('Invoice_csv')}.csv"
}
attach << csv
4
else
0
end
if @invoice >= 2
pdf = {
file: generate_invoice_pdf,
content_type: 'application/pdf',
filename: "#{_('Invoice_pdf')}.pdf"
}
attach << pdf
end
variables = email_variables(user)
email= Email.where(["name = 'invoices' AND owner_id = ?", user.owner_id]).first
MorLog.my_debug("Try send invoice to : #{user.address.email}, Invoice : #{invoice.id}, User : #{user.id}, Email : #{email.id}", 1)
# @num = EmailsController.send_email_with_attachment(email, email_from,
# user, attach, variables)
variables = Email.email_variables(user)
email.body = nice_email_sent(email, variables)
@num = EmailsController.send_invoices(email, user.email.to_s,
email_from, attach,
invoice.number.to_s)
MorLog.my_debug ("Invoice email was send to : #{user.address.email} ? : #{@num}")
if @num == 'true'
@number += 1
invoice.sent_email = 1
invoice.save
Action.create_email_sending_action(user, 'email_sent', email)
else
not_sent += 1
Action.create_email_sending_action(user, 'error', email,
{er_type: 1, err_message: @num})
end
else
not_sent += 1
email= Email.where(["name = 'invoices' AND owner_id = ?", user.owner_id]).first
Action.create_email_sending_action(user, 'error', email, {er_type: 1})
end
end
}
end
flash[:notice] = _('ERROR') + ': ' + @num[1].to_s if @num && @num[0] == 0
if @number.to_i > 0
flash[:status] = _('Invoices_sent') + ': ' + @number.to_s
else
flash[:notice] = _('Invoices_not_sent') + ': ' + not_sent.to_s if not_sent.to_i > 0
end
flash[:notice] = _('No_invoices_found_in_selected_period') if @invoices.size.to_i == 0
redirect_to(action: :invoices) unless performed?
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoice\n NotificationsMailer.invoice\n end",
"def send_freshbooks_invoice!\n raise SignalCloud::ClientInvoiceNotCreatedError.new unless self.has_invoice?\n \n response = FreshBooks.account.invoice.sendByEmail( invoice_id: self.freshbooks_invoice_id )\n raise SignalCloud::FreshBooksError.new( 'Could not send invoice: %s (%i)' % [ response['error'], response['code'] ], response['code'] ) unless response.success?\n\n self.freshbooks_invoice_id = response['invoice_id']\n self.sent_at = DateTime.now\n self.save!\n end",
"def send_invoice\n if payment_at_changed? && payment_at.present?\n payable.try(:payment_completed!, self)\n if payable_type == 'UserGroup'\n UserMailer.payment_completed(user, self).deliver\n end\n end\n end",
"def settle\n self.send_freshbooks_invoice!\n end",
"def seller_invoices\n logger.info(\"Will send email of SELLER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_seller_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def buyer_invoices\n logger.info(\"Will send email of BUYER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_buyer_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def send_email(_invoice)\n code = '$ok'\n from = nil\n to = nil\n\n # Search offer & items\n @sale_offer = SaleOffer.find(_invoice)\n @items = @sale_offer.sale_offer_items.order(:id)\n\n title = t(\"activerecord.models.sale_offer.one\") + \"_\" + @sale_offer.full_no + \".pdf\"\n pdf = render_to_string(filename: \"#{title}\", type: 'application/pdf')\n from = !current_user.nil? ? User.find(current_user.id).email : User.find(@sale_offer.created_by).email\n to = !@sale_offer.client.email.blank? ? @sale_offer.client.email : nil\n\n if from.blank? || to.blank?\n code = \"$err\"\n else\n # Send e-mail\n Notifier.send_sale_offer(@sale_offer, from, to, title, pdf).deliver\n end\n\n code\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def invoice\n\t\t@post = Post.find(params[:id])\n\t\t@request= Request.find_by(post_id:@post.id)\n\t\t@payment = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"success\")\n\t\t@payment1 = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"refund\")\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.pdf do\n render pdf: \"invoice\",\n template: \"posts/_form.html.erb\",\n layout: \"pdf.html\",\n disposition: 'attachment'\n end\n end\n\tend",
"def fulfillment_new_invoice(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"def new_invoice(user_id, payment_id)\n @user = User.find_by_id(user_id)\n @payment = Payment.find_by_id(payment_id)\n\n mail :to => recipient(@user.email), :subject => \"New 25c Invoice!\"\n end",
"def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end",
"def create\n @invoices ||= Array.new\n @cart_ids = params[:cart]\n @carts = Cart.where(id: @cart_ids)\n invoice_service = InvoiceService.new\n checkig_accoutn_service = CheckingAccountService.new\n license_service = LicenseService.new\n @carts.each do |cart|\n @invoice = Invoice.new\n @checking_account = CheckingAccount.new\n @invoice.attributes = {user_id: current_user.id, script_id: cart.script_id, value: cart.price.value, invoice_status_id: 1, script_file: invoice_service.generate_invoice_script_file(cart.script), notes: '', pay_date: nil, ship_date: nil, shipped_to: current_user.email, shipped_via: 'email', pay_method_id: 1, workplace_id: cart.workplace_id}\n @invoices.push(@invoice)\n cart.update_attribute(:full_sale, true)\n end\n respond_to do |format|\n if @invoices.each(&:save)\n @invoices.each do |i|\n invoice_service.create_download_file(i)\n invoice_service.send_invoice(i.user_id, i)\n checkig_accoutn_service.initialize_checking_account(i)\n license_service.initialize_license(i)\n end\n flash[:cart_ids] = @cart_ids\n format.html { redirect_to final_buys_path }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def customer_receipt(invoice) \n @invoice = invoice\n mail(:to => invoice.customer.email, :subject => \"Invoice #{@invoice.invoice_number} receipt\")\n end",
"def do_email\n @invoice = Factura.find(params[:id])\n @email = params[:email]\n \n Notifier.invoice(@email, @invoice).deliver\n \n flash[:notice] = \"The invoice has been sent successfully.\"\n redirect_to \"/facturas/#{@invoice.id}\"\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 update\n @invoice = Invoice.find(params[:id])\n @invoice.timestamp = Time.now\n @invoice.update_totals\n\n\n# #if the invoice is paid, let's add them to the email marketing list\n# if @invoice.paid = true then\n# @cust = Customer.find_by_id(@invoice.customer_id)\n# url = \"http://allinnetworks.com/index.php?option=com_acymailing>ask=sub&task=optin&hiddenlists=1,8&user[email]=\" + @cust.email + \"&user[name]=\" + @cust.firstname + \" \" + @cust.lastname\n# @doc = Nokogiri::XML(open(url))\n# end\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def successfully_charged(invoice, user)\n @subscription = invoice.lines.data.first\n @user = user\n @subscription_plan = @subscription.plan.name\n @subscription_amount = format_amount(invoice.total)\n @subscription_start = format_timestamp(@subscription.period.start)\n @subscription_end = format_timestamp(@subscription.period.end)\n # Mail invoice \n mail to: user.email, subject: \"Grapevine Payment Receipt\"\n end",
"def save_invoice\n @invoice = InvoiceForm.new(params[:address])\n @user = current_user\n @order = Order.find(params[:id])\n @country = Country.where(short: @user.account.country_short).first\n @price_plan = Country.get_price_plan_by_country_and_id(@user.account.country_short, @order.price_plan_id)\n\n if @invoice.valid?\n\n @order.update_attributes(\n kind: 'invoice',\n state: 'success',\n raw_data: params[:address],\n completed_at: Time.now.utc\n )\n\n current_expire_date = 1.year.ago.utc\n\n if @order.upgrade or @order.renewal\n begin\n current_expire_date = @user.account.current_subscription.expires_at\n rescue => e\n end\n end\n\n subscription = @user.account.add_subscription(@price_plan, @order)\n # If we do not have a current subscription we must activate this one.\n if @user.account.current_subscription.nil?\n subscription.activate\n end\n\n @order.transactions.create!(:action => \"invoice request\", :success => true, :amount => @order.price_in_cents, :params => params[:address])\n @user.account.finish_registration()\n @price_plan.mark_promotion_code_for_usage(@order)\n\n agents = User.get_agent_profiles_for_country(@user.account.country_short)\n agents.each do |agent|\n begin\n NotificationMailer.invoice_payment(agent, @user, @order, @price_plan).deliver\n rescue => e\n NotificationMailer.oddity(\"Could not send invoice mail to agent. #{@order.order_number}, Error: #{e}\").deliver\n end\n end\n\n # Makes sure the member role is set and that trial and or\n # restricted is removed\n begin\n account = current_user.account\n account.users.each do |user|\n user.set_as_member\n end\n rescue\n end\n\n # If the country does not have automatic activation the account\n # gets awaiting status true and the users recives restricted\n # access on account confirmation\n if @country.allow_direct_access\n subscription.activate\n @user.account.remove_restrictions_for_users\n else\n @user.account.set(:awaiting_access, true)\n if current_expire_date < Time.now.utc\n @user.account.restrict_access_for_users\n end\n end\n\n redirect_to( action: 'success', id: @order )\n else\n render( action: 'invoice', layout: 'registration')\n end\n end",
"def invoice\n if @invoice.should_be_delivered? then\n @invoice.set_delivered \n end\n \n respond_to do |wants|\n wants.html do\n redirect_to survey_report_path(@survey)\n end\n end\n end",
"def make_the_payment\n\n session[:purchasable] = nil\n if @order and @order.invoices.last\n @invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n end \t\n\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n @invoice.accept_cash_or_cheque_or_bank_payment(params[:invoicing_info][:payment_medium]) \n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \t\n @current_object.invoice = @invoice\n @current_object.save\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,@order.id])\n if @order.instance_of? CompetitionsUser\n note = \"no notes created\"\n note = @order.competition.timing.note if @order.competition.timing\n start_date = @order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = @order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if invoice\n\n p \"fdfgffggfdgfgd\"\n\n \n p \"i got the invoice and creating pdf\"\n\n create_pdf(invoice.id,invoice.number,start_date,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,invoice.final_amount.to_i,0,false,end_date)\n end \n else\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n end\n elsif @order.instance_of? ExhibitionsUser\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n\n # email= UserMailer.create_send_invoice(invoice,@current_user)\n # UserMailer.deliver(email)\n\n p \"sending the emaillll\"\n email= UserMailer.create_send_invoice(invoice,@current_user)\n #UserMailer.deliver(email)\n\n rescue\n end\n session[:total_entry] = nil \n if @invoice.purchasable_type == \"Order\"\n session[:cart]=nil\n end\n end",
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/invoices'})\n response.invoices.each_with_index do | response_invoice, index |\n invoices[index].invoice_id = response_invoice.invoice_id if response_invoice && response_invoice.invoice_id\n end\n response\n end",
"def index\n @invoices = current_brand.invoices.where(is_template: false).order(id: :asc)\n @plan_billing = PlanBilling.find_by(user_id: current_brand.user_id)\n @contacts = current_brand.client_contacts.all\n @status = Status.all\n\n puts \"client name and email\"\n @invoices = @invoices.client_name_email(params[:client_name_email]) if params[:client_name_email].present?\n puts \"item name and description\"\n @invoices = @invoices.item_name_description(params[:item_name_desc]) if params[:item_name_desc].present?\n puts \"invoices number\"\n @invoices = @invoices.invoice_number(params[:invoice_no]) if params[:invoice_no].present?\n puts \"invoice_status\"\n @invoices = @invoices.invoice_status(params[:invoice_status_id]) if params[:invoice_status_id].present?\n\n\n @invoice_email = InvoiceEmail.new\n # puts @invoices.as_json\n end",
"def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end",
"def make_the_payment_paypal\n #here i need to refresh the order because the total entry field is changed\n order=CompetitionsUser.find(session[:order].id)\n if order and order.invoices.last\n @invoice = order.generate_invoice_extra_entry(@current_user,{\"payment_medium\"=>\"paypal\"} )\n else\n @invoice = order.generate_invoice(@current_user, {\"payment_medium\"=>\"paypal\"}) \n end \t\n @invoice.validating(\"paypal\")\n session[:current_object].invoice = @invoice\n session[:current_object].save\n p session[:userid]\n if session[:userid].blank?\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,order.id])\n \n else\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",session[:userid],order.id])\n \n end\n \n if order.instance_of? CompetitionsUser\n note = \"no note created\"\n note = order.competition.timing.note if order.competition.timing \n \n start_date = order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n p \"the invoice is blank\"\n p invoice\n if invoice \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n else\n p \"i dont have invoice created\"\n end\n elsif order.instance_of? ExhibitionsUser\n note = \"no note created\"\n note = order.exhibition.timing.note if order.exhibition.timing \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n email= UserMailer.create_send_invoice(invoice,@current_user)\n UserMailer.deliver(email)\n rescue => e\n logger.info \"there is error while sending the email\"\n logger.info e\n end\n end",
"def rebuild_invoice\n end",
"def transaction_fee_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, amountPaid: 32.00, poliId: \"345678976543\").transaction_fee_invoice\n end",
"def print_generate_invoices_info\n puts \"\\n==============================2.TEST generateInvoices====================================\"\n end",
"def invoice_events\n require_event_type('invoice')\n subscription_id = params['data']['object']['subscription']\n subscription = Subscription.find_by_stripe_subscription_id(subscription_id)\n stripe_invoice_id = params['data']['object']['id']\n invoice = Invoice.where(:stripe_invoice_id => stripe_invoice_id).first\n if (invoice)\n invoice.update_attributes(:body => params['data']['object'])\n else\n Invoice.create({\n :subscription_id => subscription.id,\n :company_id => subscription.company_id,\n :stripe_invoice_id => stripe_invoice_id,\n :body => params['data']['object']\n })\n end\n invoice_hook = params['type'].split('.')[1]\n subscription.update_state_for_invoice_hook(invoice_hook, params['data']['object'])\n subscription.record_event_for_invoice_hook(invoice_hook, params['data']['object'])\n head :no_content\n end",
"def invoice\n @greeting = \"Hi\"\n\n mail to: \"ajayashok.01@gmail.com\"\n end",
"def email_demo_invoice\r\n if params[:email] =~ /^([a-zA-Z0-9_\\-\\.&]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$/\r\n @document = Invoice.demo # HARDCODED: A Demo Invoice\r\n return if @document.nil?\r\n\r\n account = Account.demo\r\n to = params[:email]\r\n from = @app_config['system_email']\r\n message = \"This is a demo invoice that somebody sent from http://www.fluttervoice.co.za. Please let us know of any abuse.\"\r\n summary_url = \"http://#{base_url(account)}/summary/\" + \"show\".obfuscate + \"/\" + @document.id.to_s.obfuscate\r\n\r\n invoice_html = construct_email_html_for_document(@document)\r\n\r\n if DocumentMailer.deliver_invoice(to, from, \"\", account, @document, invoice_html, summary_url, message, @app_config)\r\n log_email(\"Demo\", @document, to, 0)\r\n render :text => \"\", :status => 200\r\n else\r\n render :text => \"Can't send.\", :status => 200\r\n end\r\n else\r\n render :text => \"Malformed email\", :status => 200\r\n end\r\n end",
"def booking_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, order: Order.first).booking_invoice\n end",
"def invoice (company, recipient)\n invoice_common (company)\n\n # layout variables\n @title = \"¡Ya puedes pagar tu cuenta AgendaPro!\"\n\n mail(\n from: filter_sender(),\n reply_to: filter_sender(\"cuentas@agendapro.cl\"),\n to: recipient,\n subject: @title,\n template_path: \"mailers/agendapro\"\n )\n end",
"def si_generate_invoice_from_order\n supplier = params[:supplier]\n orders = params[:order]\n invoice_no = params[:offer_no]\n invoice_date = params[:offer_date] # YYYYMMDD\n internal_no = params[:internal_no]\n posted_at = params[:posted_at] # YYYYMMDD\n company = params[:company]\n invoice = nil\n invoice_item = nil\n code = ''\n first = true\n\n orders = orders.split(\",\")\n\n # Format offer_date\n invoice_date = (invoice_date[0..3] + '-' + invoice_date[4..5] + '-' + invoice_date[6..7]).to_date\n posted_at = (posted_at[0..3] + '-' + posted_at[4..5] + '-' + posted_at[6..7]).to_date\n\n if orders.count == 1\n # Only one order\n if orders[0] != '0'\n purchase_order = PurchaseOrder.find(orders[0]) rescue nil\n purchase_order_items = purchase_order.purchase_order_items rescue nil\n if !purchase_order.nil? && !purchase_order_items.nil?\n # Try to save new invoice\n invoice = new_invoice(purchase_order, invoice_no, invoice_date, internal_no, posted_at, company)\n # One order only: Must save purchase_order_id, work_order_id & charge_account_id\n invoice.purchase_order_id = purchase_order.id\n invoice.work_order_id = purchase_order.work_order_id\n invoice.charge_account_id = purchase_order.charge_account_id\n # One order only: Discount must be saved as well\n invoice.discount_pct = purchase_order.discount_pct\n invoice.discount = purchase_order.discount\n if invoice.save\n # Try to save new invoice items\n purchase_order_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # purchase_order_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n end # invoice.save?\n else\n # Purchase order or items not found\n code = '$err'\n end # !purchase_order.nil? && !purchase_order_items.nil?\n else\n # Purchase order 0\n code = '$err'\n end # orders[0] != '0'\n else\n # Loop thru orders and create invoice\n orders.each do |note|\n if note != '0'\n purchase_order = PurchaseOrder.find(note) rescue nil\n purchase_order_items = purchase_order.purchase_order_items rescue nil\n if !purchase_order.nil? && !purchase_order_items.nil?\n # If it's first order, must initialize new invoice; if not, update already initialized one\n if first\n invoice = new_invoice(purchase_order, invoice_no, invoice_date, internal_no, posted_at, company)\n invoice.remarks = I18n.t(\"activerecord.attributes.supplier_invoice.purchase_orders\") + ': ' + purchase_order.order_no\n first = false\n else\n invoice.discount = invoice.discount + purchase_order.discount\n invoice.remarks = invoice.remarks + ', ' + purchase_order.order_no\n end\n if invoice.save\n # Try to save new invoice items\n purchase_order_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # purchase_order_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n break\n end # invoice.save?\n else\n # Purchase order or items not found\n code = '$err'\n end # !purchase_order.nil? && !purchase_order_items.nil?\n else\n # Purchase order 0\n code = '$err'\n end # note != '0'\n end # orders.each do |note|\n end # orders.count == 1\n\n if code == ''\n code = I18n.t(\"ag2_purchase.supplier_invoices.generate_invoice_ok\", var: invoice.id.to_s)\n end\n\n @json_data = { \"code\" => code }\n render json: @json_data\n end",
"def update_invoice_status\n invoices = self.invoices\n invoices.each do |invoice|\n invoice.received = true\n invoice.save\n end\n end",
"def print_invoice\n @invoice = Invoice.find_by_id params[:invoice_id]\n puts \"The invoce inspect: #{@invoice}\\n\"\n respond_to do |format|\n format.html # do\n # pdf = SalesInvoicePdf.new(@sales_order, view_context)\n # send_data pdf.render, filename:\n # \"#{@sales_order.printed_sales_invoice_code}.pdf\",\n # type: \"application/pdf\"\n # end\n format.pdf do\n pdf = InvoicePdf.new(@invoice, view_context,CONTINUOUS_FORM_WIDTH,FULL_CONTINUOUS_FORM_LENGTH)\n send_data pdf.render, filename:\n \"#{@invoice.printed_code}.pdf\",\n type: \"application/pdf\"\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n @invoice = Invoice.new invoice_params\n customer = Customer.find_or_create_by(name: params[:customer_name])\n @invoice.customer = customer\n @invoice.save!\n\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transmit\n tpl = Template.find(params[\"template_id\"])\n tpl.load(params[:id])\n \n tpl.object.status = InvoiceStatus.find_by_name('invoiced')\n tpl.object.save!\n \n #Notification.deliver_invoice_email(self, tpl)\n Notification.deliver_invoice_fax(self, tpl)\n \n log = SystemLog.create({ \n :log_type => SystemLogType.find_by_name('notification'),\n :loggable_id => params[:id],\n :loggable_type => 'Invoice',\n :subject => 'Invoice sent',\n :msg => 'Invoiced client', \n :created_by => self.current_user.account \n })\n \n action = RAction.new(\n :component_id => 'log_' + tpl.object.id.to_s,\n :msg => 'Inserted log',\n :verb => 'insert',\n :data => {:log => log.to_h},\n :success => true\n ) \n res = RResponse.new\n res.add_action(action)\n res.data[:status] = tpl.object.status.name \n res.success = true\n res.msg = 'Transmitted invoice ' + \" pdf2html success: \"\n respond(res) \n end",
"def print\n @inv = PurchaseOrder.where(\"invoice_number='#{@inv.invoice_number}' AND is_history IS FALSE\").last\n if @inv.can_print_inv?\n @inv.print_invoice_date = Time.now\n if @inv.print_inv\n PurchaseOrder.send_notifications(@inv)\n render :pdf => \"#{@inv.invoice_number}\",\n :disposition => 'inline',\n :layout=> 'layouts/invoice.pdf.erb',\n :template => 'order_to_payments/invoices/inv_template.pdf.erb',\n :page_size => 'A4',\n :lowquality => false\n else\n something_wrong\n end\n else\n forbidden\n end\n end",
"def invoice\n\tparams['invoice']\n end",
"def si_generate_invoice\n supplier = params[:supplier]\n notes = params[:request]\n invoice_no = params[:offer_no]\n invoice_date = params[:offer_date] # YYYYMMDD\n internal_no = params[:internal_no]\n posted_at = params[:posted_at] # YYYYMMDD\n company = params[:company]\n invoice = nil\n invoice_item = nil\n code = ''\n first = true\n\n # notes.split(\",\").map(&:to_i) # Convert to array, map each element to int\n notes = notes.split(\",\")\n\n # Format offer_date\n invoice_date = (invoice_date[0..3] + '-' + invoice_date[4..5] + '-' + invoice_date[6..7]).to_date\n posted_at = (posted_at[0..3] + '-' + posted_at[4..5] + '-' + posted_at[6..7]).to_date\n\n if notes.count == 1\n # Only one note\n if notes[0] != '0'\n receipt_note = ReceiptNote.find(notes[0]) rescue nil\n receipt_note_items = receipt_note.receipt_note_items rescue nil\n if !receipt_note.nil? && !receipt_note_items.nil?\n # Try to save new invoice\n invoice = new_invoice(receipt_note, invoice_no, invoice_date, internal_no, posted_at, company)\n # One note only: Must save receipt_note_id, work_order_id & charge_account_id\n invoice.receipt_note_id = receipt_note.id\n invoice.work_order_id = receipt_note.work_order_id\n invoice.charge_account_id = receipt_note.charge_account_id\n # One note only: Discount must be saved as well\n invoice.discount_pct = receipt_note.discount_pct\n invoice.discount = receipt_note.discount\n if invoice.save\n # Try to save new invoice items\n receipt_note_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # receipt_note_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n end # invoice.save?\n else\n # Receipt note or items not found\n code = '$err'\n end # !receipt_note.nil? && !receipt_note_items.nil?\n else\n # Receipt note 0\n code = '$err'\n end # note != '0'\n else\n # Loop thru notes and create invoice\n notes.each do |note|\n if note != '0'\n receipt_note = ReceiptNote.find(note) rescue nil\n receipt_note_items = receipt_note.receipt_note_items rescue nil\n if !receipt_note.nil? && !receipt_note_items.nil?\n # If it's first note, must initialize new invoice; if not, update already initialized one\n if first\n invoice = new_invoice(receipt_note, invoice_no, invoice_date, internal_no, posted_at, company)\n invoice.remarks = I18n.t(\"activerecord.attributes.supplier_invoice.receipt_notes\") + ': ' + receipt_note.receipt_no\n first = false\n else\n invoice.discount = invoice.discount + receipt_note.discount\n invoice.remarks = invoice.remarks + ', ' + receipt_note.receipt_no\n end\n if invoice.save\n # Try to save new invoice items\n receipt_note_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # receipt_note_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n break\n end # invoice.save?\n else\n # Receipt note or items not found\n code = '$err'\n end # !receipt_note.nil? && !receipt_note_items.nil?\n else\n # Receipt note 0\n code = '$err'\n end # note != '0'\n end # notes.each do |note|\n end # notes.count == 1\n\n if code == ''\n code = I18n.t(\"ag2_purchase.supplier_invoices.generate_invoice_ok\", var: invoice.id.to_s)\n end\n\n @json_data = { \"code\" => code }\n render json: @json_data\n end",
"def send_invoice_payment_request\n @update_invoice_to_payment_request = PurchaseOrder.find(params[:id])\n if @update_invoice_to_payment_request.update_is_create_payment_request_and_create_payment_request(current_user)\n if @update_invoice_to_payment_request\n flash[:notice] = \"Early Payment Request has been created.\"\n respond_to do |format|\n format.js{\n render :js => \"window.location= '#{order_to_payments_invoices_path}'\"\n }\n end\n end\n end\n end",
"def pay_invoice\n # NOTE it's best to add the `amount_due` to the invoice form\n # this method of determine the amount due will report an incorrect amount for foreign currencies\n # TODO link to netsuite bug ID\n # https://dashboard.suitesync.io/docs/netsuite-configuration#adding-amount-remaining-to-the-netsuite-invoice-form\n\n amount_due_string = amount_due_for_invoice(ns_invoice)\n\n # NOTE you'll need to handle zero decimal currencies here if you collect in multiple currencies\n # Example: https://gist.github.com/iloveitaly/968ba7dd8b2d2cde7807e86c6ac32ee6\n\n amount_due = BigDecimal.new(amount_due_string)\n amount_due_in_cents = (amount_due * 100.0).to_i\n\n begin\n charge = Stripe::Charge.create(\n amount: amount_due_in_cents,\n\n # NOTE charges are hardcoded to USD, but the correct currency can be extracted from the Invoice\n currency: 'usd',\n\n customer: self.stripe_customer.id,\n source: self.payment_source,\n\n # this description will be added to the memo field of the NetSuite CustomerPayment\n description: \"NetSuite Automatic Payment for #{ns_invoice.tran_id}\",\n\n metadata: {\n # this metadata field instructs SuiteSync to create a CustomerPayment and apply it to the associated invoice\n # https://dashboard.suitesync.io/docs/charges#charge-for-a-invoice\n netsuite_invoice_id: self.ns_invoice.internal_id\n\n # more metadata fields can be added to pass custom data over to the CustomerPayment\n }\n )\n\n puts \"Charge created #{charge.id} for invoice #{ns_invoice.tran_id} (#{ns_invoice.internal_id})\"\n\n true\n rescue Stripe::CardError => e\n update_memo(ns_invoice, \"Stripe Payment Error: #{e.message}\")\n\n return false\n end\n end",
"def link_to_and_marshall_invoice\n #an invoice can only be transacted once\n payments = PaymentNotification.where(:reference_code => self.reference_code)\n \n unless payments.count == 0\n \n matches = Invoice.where(:reference_code => self.reference_code).order('id asc') #oldest first in case there are multi.\n \n if matches.count==0\n SystemMessage.new(:message => \"POSSIBLE ATTACK!! : No Invoice with reference_code found : #{self.reference_code}.\", \n :reference_class_type => \"PaymentNotification\",\n :reference_id => self.id,\n :calling_method => \"PaymentNotification.link_to_and_marshall_invoice\",\n :priority => \"WARN\"\n ).save\n else\n #find the referenced invoice and discard if invoice is already handled.\n if matches.count > 1 \n #we will use the first (original?) invoice in case it's by back/refresh issue with browser\n invoice_object = matches.first\n SystemMessage.new(:message => \"Duplicate Invoice reference_code found : #{self.reference_code}, using first in resultset Invoice[#{invoice_object.id}] \",\n :reference_class_type => \"PaymentNotification\", \n :reference_id => self.id, \n :calling_method => \"PaymentNotification.link_to_and_marshall_invoice\", \n :priority => \"WARN\").save\n else\n invoice_object= Invoice.find_by_id( matches )\n end\n puts \"**** Invoice object : #{invoice_object.inspect} class:#{invoice_object.class}\"\n if invoice_object.status == 'paid'\n # we don't want to re-apply this transaction.\n SystemMessage.new(:message => \"Duplicate Payment Transaction :(# #{self.transaction_id}/internal_id:#{self.id}) Invoice #{invoice_object.id} is already paid.\", \n :reference_class_type => \"PaymentNotification\",\n :reference_id => self.id,\n :calling_method => \"PaymentNotification.link_to_and_marshall_invoice\",\n :priority => \"WARN\"\n ).save\n else\n \n if self.payment_status==\"APPROVED\"\n invoice_updated = false \n self.invoice_id = invoice_object.id\n self.save\n invoice_object.reservation_carts.each do |cart|\n cart.status='paid'\n cart.reservation.locked = true\n if cart.reservation.save\n if cart.save\n unless invoice_updated\n # TODO: create a good payment\n #new_payment = Payment.new(:invoice_id=>invoice_object.id, :payment_method=>\"FirstData\", :refcode=>self.transaction_id, :status=>self.params[:status], :payment_amount=>self.params.[:chargetotal])\n #new_payment.save\n \n invoice_object.status=\"paid\"\n invoice_object.payment_type=\"FirstData\"\n invoice_object.payment_date=self.params[:txndate_processed]\n invoice_object.save\n end\n end\n end\n end\n else\n # do nothing more than link it up, we need them to see all transactions attempted\n self.invoice_id = invoice_object.id \n end\n invoice_object.save\n self.save\n end\n \n end #end of nilcheck fallthrough\n end #end of making sure we don' already have a linked notification\n end",
"def customer_payment_authorization(invoice) \n @invoice = invoice\n mail(:to => invoice.customer.email, :subject => \"Invoice #{@invoice.invoice_number} ready for payment\")\n end",
"def send_invoice_to_user(participation_request)\n @user = participation_request.user\n @structure = participation_request.structure\n @invoice = participation_request.invoice\n @participation_request = participation_request.decorate\n\n mail to: @user.email,\n subject: \"Votre facture du cours du #{ @participation_request.day_and_hour } avec #{ @structure.name }\"\n end",
"def create\n get_current_user\n @types = Type.find_by_typename('invoice_terms')\n @terms = 'none'\n \n @terms = @types.type_value_string \n \n \n @shipments = Invoice.get_ready_shipments(@current_user.id, params[:customer_id], params[:start_date], params[:stop_date])\n @count = 0\n \n @shipments.each do |sh|\n @invoice = Invoice.new(params[:invoice])\n @invoice.shipment_id = sh.id\n @invoice.ship_amount = sh.ship_amount\n @invoice.ship_charge = sh.shipping_charge\n @invoice.total_amount = sh.ship_amount.to_f + sh.shipping_charge.to_f\n @types = Type.find_by_typename('invoice_number')\n \n @invno = @types.type_value_integer + 1\n @types.type_value_integer = @invno\n @types.save\n \n @invoice.invoice_number = @invno\n @invoice.invoice_status = 'NEW'\n @invoice.invoice_terms = @terms\n @invoice.invoice_date = Date.today.to_date\n @invoice.user_id = @current_user.id \n @count += 1\n @invoice.save\n \n @shipment = Shipment.find(sh.id)\n @shipment.ship_status = 'invoiced'\n @shipment.save\n end\n\n respond_to do |format|\n message = @count.to_s + ' - Invoice(s) were successfully created.'\n format.html { redirect_to('/invoice_generator', :notice => message) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n\n end\n end",
"def collect_invoice(shop_id, order_id, invoice)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/invoices\", body: invoice).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def invoice_confirmation\n # Invoice Confirmation for WebMoney\n render text: WebMoney.invoice_confirmation(params[:LMI_MERCHANT_ID], params[:LMI_PAYMENT_AMOUNT], params[:ORDER_ID])\n end",
"def create\n \n \n @invoice_item = @invoice.invoice_item.new(invoice_item_params)\n @invoice_item.save\n respond_with(@invoice)\n\n end",
"def set_incominginvoice\n @incominginvoice = Incominginvoice.find(params[:id])\n end",
"def generate\n invoice.generate!\n flash[:notice] = \"The invoice has been generated and assigned the identifier #{invoice.identifier}\"\n respond_with(invoice)\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def create\n respond_to do |format|\n begin \n @group_purchase = GroupPurchase.find(params[:group_purchase_id])\n @group_purchase.members << Member.where(id: params[:invoice][:debtor]).first\n @invoice = Invoice.new(params[:invoice])\n @invoice.group_purchase = @group_purchase\n num_members = @group_purchase.members.length\n @group_purchase.invoices.each do |charge|\n charge.balance = charge.group_purchase.balance/(num_members-1)\n end\n if @invoice.save\n format.html { redirect_to group_purchase_path(@group_purchase), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\", notice: 'An error occurred.' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n rescue\n format.html {redirect_to new_group_purchase_invoice_path, notice: 'Invalid email.'}\n end\n end\n end",
"def invoice!\n if self.chosen_presenter && self.rate \n Xero.invoice_booking(self)\n end\n end",
"def create\n @customer = Customer.find_by_id(params[:customer_id])\n #@customer = Customer.find_by_id(@invoice.customer_id)\n @invoice = Invoice.new(params[:invoice])\n #@invoice.customer_id = @customer.id\n if @invoice.category.nil? then @invoice.category = \"Redmond\" end\n if @invoice.paid.nil? then @invoice.paid = false end\n\n @invoice.timestamp = Time.now\n @invoice.date = Time.now\n @invoice.employee = current_user.email\n #@invoice.ticket_id = params[:invoice_id].to_i if params[:invoice_id]\n\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def receive_payment(transaction)\n self.credit(transaction.amount)\n self.save!\n transaction.subscription.reload # reloaded to that the paid_through date is correct\n transaction.message = \"now paid through #{self.paid_through}\"\n\n begin\n Freemium.mailer.deliver_invoice(transaction)\n rescue => e\n transaction.message = \"error sending invoice\"\n end\n end",
"def create\n flash[:notice] = 'The invoice was successfully created.' if invoice.save\n respond_with(invoice)\n end",
"def initiate_send_invoice(start_status, authorized = nil, options = {})\n result = nil\n assert_difference('ApiToken.count') do\n result = browsal_request(:send_invoice, start_status, authorized, options) do |api, api_token, current_url, token_url|\n if api.response.code != '201'\n puts api.response.body\n end\n api.assert_response :created \n case start_status\n when nil, 'login', 'send_invoice'\n assert_match %r{^http://[^/]*/browsals/#{ api_token.guid }/send_invoice$}, current_url\n else\n assert_match %r{^http://[^/]*/browsals/#{ api_token.guid }/#{ start_status }$}, current_url\n end\n end\n end\n result\n end",
"def index\n @incominginvoices = Incominginvoice.all\n end",
"def set_invoice\n # @invoice = Invoice.find(params[:id])\n end",
"def create_invoice\n # create an invoice from order object, i.e. with eventbooking attached\n return InvoiceCreateFromOrder.new(self.order, self).perform\n end",
"def all_invoices\n @gateway.get_invoices.invoices\n end",
"def customer_status_updated(invoice) \n @invoice = invoice\n mail(:to => invoice.customer.email, :subject => 'Order status update')\n end",
"def invoices_include_pending(parameters = {})\n invoices(true, parameters)\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n # @invoice.sender_address = SenderAddress.new(invoice_params[:sender_address])\n # @invoice.client_address = ClientAddress.new(invoice_params[:client_address])\n if @invoice.save\n render :show, status: :created, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def shipping_invoice_ready(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.shipping_email, :subject => 'Order ready for shipping')\n end",
"def load_voices\n # TODO\n end",
"def print_invoice_for(payment)\n @data.payment = payment\n @data.invoice = Invoice.create_for_payment(payment, Invoice::INVOICE_TYPE)\n print_common\n end",
"def invoice_is_ready invoice = Invoice.first\n @invoice = invoice\n mail(to: @invoice.user.email, subject: \"You Invoice is ready\") do |format|\n format.text\n format.mjml\n end\n end",
"def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend",
"def create_invoice\n invoice_data = {\n payplan_id: self.payplan.id, \n payertype: \"fiz\", \n paymenttype: \"creditcard\", \n service_handle: self.payplan.service_handle \n }\n if self.status\n if self.payplan_id == Payplan.favorite_free_id\n invoice = Invoice.create(invoice_data.merge!(status: \"Оплачен\"))\n payment = invoice.get_payment.update(paymentdate: Date.today, status: \"Оплачен\")\n else\n invoice = Invoice.create(invoice_data)\n end\n end\nend",
"def build_invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def set_invoice\n @invoice = Invoice.where(:invoice_id => params[:id])\n # @invoice = Invoice.find(params[:id])\n end",
"def settlement\n @invoice = Invoice.find(params[:invoice_id])\n end",
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n\n if @invoice.doc_invoice\n if @invoice.confirmation\n @invoice.update_attributes(:doc_number => @invoice.invoice_number, :total_htva => @invoice.total_htva_deposit, :total_tva => @invoice.total_tva_deposit, :total_tvac => @invoice.total_tvac_deposit)\n elsif @invoice.after_event\n @invoice.update_attributes(:doc_number => @invoice.invoice_number, :total_htva => @invoice.total_htva_final, :total_tva => @invoice.total_tva_final, :total_tvac => @invoice.total_tvac_final)\n end\n elsif @invoice.doc_credit\n @invoice.update_attributes(:doc_number => @invoice.credit_number)\n end\n \n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoice_params\n params.require(:invoice).permit(:client_id, :description, :currency_id, :amount, :status, :has_drawdown, :partial_payment, :document, :purchase_order, :extra, :contact, :reason, :message, :invoice_number, :payment_type, :expiration_date, :billing_date, invoice_contacts_attributes: [:contact_id, :_destroy])\n end",
"def receipt bill\n \n @bill = bill\n \n headers={:to => bill.contract.user.email1,\n :subject => \"#{CFG['domain']} - Recibo para a fatura N##{@bill.id}.\"}\n headers['bcc']= bill.contract.user.email2 if bill.contract.user.email2\n\n mail(headers)\n end",
"def payment\n @invoice = BitcoinInvoice.find_by_notification_key(params[:id])\n #if @invoice.status != BitcoinInvoice::NEW\n # redirect_to root_path, :alert => 'Cannot pay more than once!' and return\n #end\n end",
"def invoice_pdf\n @course = Course.find(params[:id])\n @user = current_user\n path = \"#{Rails.root}/tmp/invoice_course_id_#{@course.id}_user_id_#{@user.id}.pdf\"\n send_data File.read(path),:filename => \"invoice.pdf\",:type => \"application/pdf\"\n UserMailer.delay(:queue => 'tracking').course_payment(@user, @course, @price)\n end",
"def place_settlement\n @invoice = Invoice.find(params[:invoice_id])\n\n #check settlment parms\n #create a new invoice_items describing the payment via cc or something\n @invoice.charge params[:amount], params[:payment_method], params[:note]\n\n flash[:notice] = \"Settlement Placed\"\n render \"settlement\"\n end",
"def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end",
"def customer_new_invoice\n @invoice = Invoice.new\n @services = []\n customer_id = params[:customer_id]\n @customer = Customer.find_by_id(customer_id)\n @company = Company.find_by_id(current_user.company_id)\n end",
"def build_invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def invoice_params\n params.require(:invoice).permit(:invoiced_at, :subtotal, :total, :notes, :ccid)\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n #@invoice.type_invoice = 'Venda'\n\n respond_to do |format|\n @invoice.status = 'ABERTA'\n @invoice.form_receipt = 'NÃO INFORMADO'\n @invoice.installments = '1'\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Criado com sucesso.' }\n format.json { render :show, status: :created, location: @invoice }\n #sweetalert_success('Dados cadastrados com sucesso!', 'Sucesso!', useRejections: false)\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_approved_email_invoice\n settings.fetch('send_mail',{}).fetch('approved_email_attach_invoice', false)\n end",
"def create\n @invoice = current_user.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Uw factuur is opgeslagen.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { @invoice.build_company\n @invoice.items.build\n @invoice.build_relation\n render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_receipt\n\t\tif ConfigData.get(:receipts, :active).to_s == \"true\"\n\t\t\tputs \"Sending receipt\" if @verbose\n\t\t\tapi_key = ConfigData.get(:receipts, :mailgun_private_api_key)\n\t\t\tdomain = ConfigData.get(:receipts, :mailgun_domain)\n\n\t\t\turl = \"https://api:#{ api_key }@api.mailgun.net/v3/#{ domain }/messages\"\n\t\t\tnew_ids = self.new_puzzle_ids.sort\n\t\t\tmessage = \"Delivered #{ new_ids.length } \"\n\t\t\tif new_ids.length == 1\n\t\t\t\tmessage << \"puzzle \"\n\t\t\telse\n\t\t\t\tmessage << \"puzzles \"\n\t\t\tend\n\t\t\tmessage << \"with IDs: #{ new_ids.join(\", \") }.\"\n\n\t\t\tRestClient.post(url,\n\t\t\t\tfrom: \"Crossword Delivery <crossword_receipts@#{ domain }>\",\n\t\t\t\tto: ConfigData.get(:receipts, :email),\n\t\t\t\tsubject: \"Crossword Delivery Scheduled!\",\n\t\t\t\ttext: message)\n\t\tend\n\n\tend",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def set_invoice\n @invoice = Invoice.find(params[:id])\n end",
"def add_invoice_data(request, money, options)\r\n\r\n#\r\n#\tStart with the basic transaction amount.\r\n#\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_INVOICE_ID, options[:order_id])\r\n request.Set(RocketGate::GatewayRequest::AMOUNT, amount(money))\r\n request.Set(RocketGate::GatewayRequest::CURRENCY, options[:currency] || currency(money))\r\n\r\n#\r\n#\tAdd optional pass-through data.\r\n#\r\n request.Set(RocketGate::GatewayRequest::UDF01, options[:udf01])\r\n request.Set(RocketGate::GatewayRequest::UDF02, options[:udf02])\r\n\r\n#\r\n#\tAdd optional tracking data.\r\n# \r\n request.Set(RocketGate::GatewayRequest::MERCHANT_ACCOUNT, options[:merchant_account])\r\n request.Set(RocketGate::GatewayRequest::BILLING_TYPE, options[:billing_type])\r\n request.Set(RocketGate::GatewayRequest::AFFILIATE, options[:affiliate])\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_SITE_ID, options[:site_id])\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_DESCRIPTOR, options[:descriptor])\r\n end",
"def invoice_params\n params.permit(:deliver_address, :contactor, :contact_phone, :delivered)\n end",
"def index\n respond_with(invoices)\n end"
] | [
"0.7500561",
"0.7233134",
"0.7184405",
"0.7183869",
"0.71239305",
"0.7119951",
"0.70375514",
"0.70187014",
"0.6966581",
"0.6958223",
"0.6949742",
"0.6936296",
"0.6897574",
"0.68448067",
"0.68393326",
"0.6816709",
"0.6802644",
"0.6801469",
"0.6792376",
"0.6742171",
"0.6741441",
"0.672622",
"0.67058986",
"0.665355",
"0.66368675",
"0.6632808",
"0.6628032",
"0.6626071",
"0.662126",
"0.66175604",
"0.66041774",
"0.6601977",
"0.65996987",
"0.65926206",
"0.6577139",
"0.65737605",
"0.65537256",
"0.655317",
"0.6547602",
"0.65320843",
"0.652779",
"0.65259963",
"0.6507126",
"0.6499298",
"0.64853483",
"0.6482484",
"0.64755106",
"0.6469941",
"0.6469666",
"0.6426773",
"0.642275",
"0.64195377",
"0.6417963",
"0.6408844",
"0.6401779",
"0.6360832",
"0.63505006",
"0.6330232",
"0.6328791",
"0.63268816",
"0.6321767",
"0.63168097",
"0.63098264",
"0.63094264",
"0.63079935",
"0.6301087",
"0.6285808",
"0.62674123",
"0.6259566",
"0.625504",
"0.6248988",
"0.6248704",
"0.62458766",
"0.6245542",
"0.6216884",
"0.62149006",
"0.62145454",
"0.62081665",
"0.6203053",
"0.61972326",
"0.618852",
"0.61874884",
"0.61841726",
"0.6183802",
"0.61834234",
"0.6181005",
"0.61771274",
"0.6166351",
"0.6165613",
"0.61647207",
"0.61520857",
"0.61520857",
"0.61520857",
"0.61520857",
"0.61520857",
"0.61520857",
"0.61520857",
"0.614596",
"0.61370265",
"0.6133444"
] | 0.82193315 | 0 |
================= generate invoices =============================== | def generate_invoices_status
MorLog.my_debug " ********* \n for period #{session_from_date} - #{session_till_date}"
change_date
MorLog.my_debug "for period #{session_from_date} - #{session_till_date}"
unless params[:invoice]
dont_be_so_smart
redirect_to(:root) && (return false)
end
owner_id = correct_owner_id
if params[:date_issue].present?
issue_date = Time.mktime(params[:date_issue][:year],
params[:date_issue][:month],
params[:date_issue][:day])
end
type = %W[postpaid prepaid user].include?(params[:invoice][:type].downcase)? params[:invoice][:type] : 'postpaid'
from_time = Time.parse(session_from_datetime_no_timezone)
till_time = Time.parse(session_till_datetime_no_timezone)
if type == 'user'
@user = User.where(['users.id = ?', params[:s_user_id]]).first if params[:s_user_id]
unless @user
flash[:notice] = _('User_not_found')
redirect_to(action: :generate_invoices) && (return false)
end
valid_period = validate_period_user(@user, till_time)
else
valid_period = validate_period(type, till_time)
end
redirect_to(action: :generate_invoices) && (return false) unless valid_period
if from_time > till_time
flash[:notice] = _('Date_from_greater_thant_date_till')
redirect_to(action: :generate_invoices) && (return false)
end
invoice_type_confline = (type == 'prepaid' && (admin? || accountant?)) ? 'Prepaid_' : ''
invoice_number_type = Confline.get_value("#{invoice_type_confline}Invoice_Number_Type", owner_id).to_i
unless [1, 2].include?(invoice_number_type)
flash[:notice] = _('Please_set_invoice_params')
usertype = session[:usertype].to_s
unless accountant?
if %w(reseller partner).include?(usertype)
redirect_to(controller: 'functions', action: "#{usertype}_settings") && (return false)
else
redirect_to(controller: 'functions', action: 'settings') && (return false)
end
else
redirect_to(action: 'generate_invoices') && (return false)
end
end
BackgroundTask.create(
task_id: 5,
owner_id: owner_id,
created_at: Time.now,
status: 'WAITING',
user_id: params[:s_user_id].present? ? params[:s_user_id].to_i : -2,
data1: session_from_datetime_no_timezone,
data2: session_till_datetime_no_timezone,
data3: type,
data4: issue_date.to_s,
data5: params[:currency]
)
system("/usr/local/mor/mor_invoices elasticsearch &")
flash[:status] = _('bg_task_for_generating_invoice_successfully_created')
if admin?
redirect_to(controller: 'functions', action: 'background_tasks') && (return false)
else
redirect_to(action: 'invoices') && (return false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate\n invoices.each do |invoice|\n if date_range.in_range?(invoice.issue_date)\n items << InvoiceItem.new(invoice.customer_id, invoice.issue_date, invoice.total)\n end\n end\n end",
"def print_generate_invoices_info\n puts \"\\n==============================2.TEST generateInvoices====================================\"\n end",
"def rebuild_invoice\n end",
"def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end",
"def generate_invoice_items\n if self.project_id.present? && self.payment_profile_id.present? && @start_date.present? && @end_date.present?\n project = Project.find(self.project_id)\n payment_profile = PaymentProfile.find(self.payment_profile_id)\n total_cost_cents = 0;\n\n default_currency = project.account.account_setting.default_currency\n invoice_currency = self.currency || project.account.account_setting.default_currency\n\n # Get mins tracked\n mins_tracked = Timing.minute_duration_submitted_for_period_by_project(project.id, @start_date, @end_date)\n\n # Generate cost\n if payment_profile.rate_card_payment_profiles.present?\n payment_profile.rate_card_payment_profiles.each do |rate_card_payment_profile|\n cost_per_min = rate_card_payment_profile.rate_card.cost_per_min_for_client(project.client_id, project.account)\n mins_for_rate_card = (mins_tracked / 100.0) * rate_card_payment_profile.percentage\n total_cost_cents += mins_for_rate_card * cost_per_min\n end\n end\n\n # Create new invoice item with correct values\n invoice_item_instance = InvoiceItem.new(:quantity => 1, :name => payment_profile.name, :payment_profile_id => payment_profile.id)\n invoice_item_instance.amount_cents = Currency.convert_amount(default_currency, invoice_currency, total_cost_cents)\n return invoice_item_instance\n end\n nil\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def generate_invoice!\n self.invoice ||=\n Invoice.create!( \n customer: self.customer,\n cost_total: self.cost\n )\n end",
"def load_voices\n # TODO\n end",
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/invoices'})\n response.invoices.each_with_index do | response_invoice, index |\n invoices[index].invoice_id = response_invoice.invoice_id if response_invoice && response_invoice.invoice_id\n end\n response\n end",
"def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end",
"def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend",
"def build_pending_invoices\n next_occurrences.map do |issue_date|\n invoice = self.becomes(Invoice).dup\n \n invoice.period = nil\n invoice.period_type = nil\n invoice.starting_date = nil\n invoice.finishing_date = nil\n invoice.max_occurrences = nil\n\n self.items.each do |item|\n nitem = Item.new(item.attributes)\n nitem.id = nil\n item.taxes.each do |tax|\n nitem.taxes << tax\n end\n invoice.items << nitem\n end\n\n invoice.recurring_invoice = self\n invoice.issue_date = issue_date\n invoice.due_date = invoice.issue_date + days_to_due.days if days_to_due\n invoice.sent_by_email = false\n invoice.meta_attributes = meta_attributes\n\n invoice.items.each do |item|\n item.description.sub! \"$(issue_date)\", invoice.issue_date.strftime('%Y-%m-%d')\n item.description.sub! \"$(issue_date - period)\", (invoice.issue_date - period.send(period_type)).strftime('%Y-%m-%d')\n item.description.sub! \"$(issue_date + period)\", (invoice.issue_date + period.send(period_type)).strftime('%Y-%m-%d')\n end\n\n invoice\n end\n end",
"def all_invoices\n @gateway.get_invoices.invoices\n end",
"def create_invoices_for_week\n InvoiceGenerator.create_invoices_for_week(self)\n end",
"def generate_invoice_items(tariff, invoice, bill, cf, user_id)\n # Should prorate\n should_prorate, prev_reading_tariff = should_prorate?(tariff)\n if should_prorate\n # Must prorate\n prorate_consumption_and_apply_tariffs('I', tariff, prev_reading_tariff, invoice, bill, cf, user_id)\n else\n # Current tariff only\n save_invoice_items(tariff, invoice, bill, cf, user_id)\n end # should_prorate\n end",
"def generate_invoices\n companies = Company.all\n\n companies.each do |company|\n\n last = company.last_bill\n last ||= company.created_at.prev_month.to_date\n\n actual = last.next_month.end_of_month\n\n while actual < Date.today\n\n counter = 0\n company.users.each do |user|\n\n if user.role != ROOT\n last_period = user.periods.where(\"created_at <= :end_of_last_month\",{:end_of_last_month => actual}).order(\"created_at DESC\").first\n \n if !last_period.nil?\n unless last_period.state <= STATE[:inactive] && last_period.created_at <= actual.prev_month\n counter+=1\n end\n end\n end\n\n end\n\n if counter > 0\n bill = company.bills.build\n bill.value = counter\n bill.state = -1\n bill.month = actual\n bill.save\n end\n\n company.last_bill = actual\n company.save\n\n actual = actual.next_month.end_of_month\n end\n end\n \n redirect_to backoffice_bills_path\n end",
"def build_invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end",
"def create\n @invoices ||= Array.new\n @cart_ids = params[:cart]\n @carts = Cart.where(id: @cart_ids)\n invoice_service = InvoiceService.new\n checkig_accoutn_service = CheckingAccountService.new\n license_service = LicenseService.new\n @carts.each do |cart|\n @invoice = Invoice.new\n @checking_account = CheckingAccount.new\n @invoice.attributes = {user_id: current_user.id, script_id: cart.script_id, value: cart.price.value, invoice_status_id: 1, script_file: invoice_service.generate_invoice_script_file(cart.script), notes: '', pay_date: nil, ship_date: nil, shipped_to: current_user.email, shipped_via: 'email', pay_method_id: 1, workplace_id: cart.workplace_id}\n @invoices.push(@invoice)\n cart.update_attribute(:full_sale, true)\n end\n respond_to do |format|\n if @invoices.each(&:save)\n @invoices.each do |i|\n invoice_service.create_download_file(i)\n invoice_service.send_invoice(i.user_id, i)\n checkig_accoutn_service.initialize_checking_account(i)\n license_service.initialize_license(i)\n end\n flash[:cart_ids] = @cart_ids\n format.html { redirect_to final_buys_path }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoice\n NotificationsMailer.invoice\n end",
"def invoices(reload = false)\n self.cache(CostAgent::Invoice, :all, reload) do\n (self.api(\"invoices\")/\"invoice\").collect do |invoice|\n items = (invoice/\"invoice-item\").collect do |item|\n price = (item/\"price\").first.inner_text.to_f\n quantity = (item/\"quantity\").first.inner_text.to_f\n cost = price * quantity\n project = self.project((item/\"project-id\").first.inner_text.to_i)\n InvoiceItem.new(\n :id => (item/\"id\").first.inner_text.to_i,\n :invoice_id => (item/\"invoice-id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :item_type => (item/\"item-type\").first.inner_text,\n :description => (item/\"description\").first.inner_text,\n :price => price,\n :quantity => quantity,\n :cost => cost)\n end\n project = self.project((invoice/\"project-id\").first.inner_text.to_i)\n Invoice.new(\n :id => (invoice/\"id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :description => (invoice/\"description\").first.inner_text,\n :reference => (invoice/\"reference\").text,\n :amount => (invoice/\"net-value\").text.to_f,\n :status => (invoice/\"status\").text,\n :date => DateTime.parse((invoice/\"dated-on\").text),\n :due => DateTime.parse((invoice/\"due-on\").text),\n :items => items)\n end\n end\n end",
"def generate\n invoice.generate!\n flash[:notice] = \"The invoice has been generated and assigned the identifier #{invoice.identifier}\"\n respond_with(invoice)\n end",
"def invoices\n return Xero.get_invoices(self)\n end",
"def si_generate_invoice\n supplier = params[:supplier]\n notes = params[:request]\n invoice_no = params[:offer_no]\n invoice_date = params[:offer_date] # YYYYMMDD\n internal_no = params[:internal_no]\n posted_at = params[:posted_at] # YYYYMMDD\n company = params[:company]\n invoice = nil\n invoice_item = nil\n code = ''\n first = true\n\n # notes.split(\",\").map(&:to_i) # Convert to array, map each element to int\n notes = notes.split(\",\")\n\n # Format offer_date\n invoice_date = (invoice_date[0..3] + '-' + invoice_date[4..5] + '-' + invoice_date[6..7]).to_date\n posted_at = (posted_at[0..3] + '-' + posted_at[4..5] + '-' + posted_at[6..7]).to_date\n\n if notes.count == 1\n # Only one note\n if notes[0] != '0'\n receipt_note = ReceiptNote.find(notes[0]) rescue nil\n receipt_note_items = receipt_note.receipt_note_items rescue nil\n if !receipt_note.nil? && !receipt_note_items.nil?\n # Try to save new invoice\n invoice = new_invoice(receipt_note, invoice_no, invoice_date, internal_no, posted_at, company)\n # One note only: Must save receipt_note_id, work_order_id & charge_account_id\n invoice.receipt_note_id = receipt_note.id\n invoice.work_order_id = receipt_note.work_order_id\n invoice.charge_account_id = receipt_note.charge_account_id\n # One note only: Discount must be saved as well\n invoice.discount_pct = receipt_note.discount_pct\n invoice.discount = receipt_note.discount\n if invoice.save\n # Try to save new invoice items\n receipt_note_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # receipt_note_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n end # invoice.save?\n else\n # Receipt note or items not found\n code = '$err'\n end # !receipt_note.nil? && !receipt_note_items.nil?\n else\n # Receipt note 0\n code = '$err'\n end # note != '0'\n else\n # Loop thru notes and create invoice\n notes.each do |note|\n if note != '0'\n receipt_note = ReceiptNote.find(note) rescue nil\n receipt_note_items = receipt_note.receipt_note_items rescue nil\n if !receipt_note.nil? && !receipt_note_items.nil?\n # If it's first note, must initialize new invoice; if not, update already initialized one\n if first\n invoice = new_invoice(receipt_note, invoice_no, invoice_date, internal_no, posted_at, company)\n invoice.remarks = I18n.t(\"activerecord.attributes.supplier_invoice.receipt_notes\") + ': ' + receipt_note.receipt_no\n first = false\n else\n invoice.discount = invoice.discount + receipt_note.discount\n invoice.remarks = invoice.remarks + ', ' + receipt_note.receipt_no\n end\n if invoice.save\n # Try to save new invoice items\n receipt_note_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # receipt_note_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n break\n end # invoice.save?\n else\n # Receipt note or items not found\n code = '$err'\n end # !receipt_note.nil? && !receipt_note_items.nil?\n else\n # Receipt note 0\n code = '$err'\n end # note != '0'\n end # notes.each do |note|\n end # notes.count == 1\n\n if code == ''\n code = I18n.t(\"ag2_purchase.supplier_invoices.generate_invoice_ok\", var: invoice.id.to_s)\n end\n\n @json_data = { \"code\" => code }\n render json: @json_data\n end",
"def si_generate_invoice_from_order\n supplier = params[:supplier]\n orders = params[:order]\n invoice_no = params[:offer_no]\n invoice_date = params[:offer_date] # YYYYMMDD\n internal_no = params[:internal_no]\n posted_at = params[:posted_at] # YYYYMMDD\n company = params[:company]\n invoice = nil\n invoice_item = nil\n code = ''\n first = true\n\n orders = orders.split(\",\")\n\n # Format offer_date\n invoice_date = (invoice_date[0..3] + '-' + invoice_date[4..5] + '-' + invoice_date[6..7]).to_date\n posted_at = (posted_at[0..3] + '-' + posted_at[4..5] + '-' + posted_at[6..7]).to_date\n\n if orders.count == 1\n # Only one order\n if orders[0] != '0'\n purchase_order = PurchaseOrder.find(orders[0]) rescue nil\n purchase_order_items = purchase_order.purchase_order_items rescue nil\n if !purchase_order.nil? && !purchase_order_items.nil?\n # Try to save new invoice\n invoice = new_invoice(purchase_order, invoice_no, invoice_date, internal_no, posted_at, company)\n # One order only: Must save purchase_order_id, work_order_id & charge_account_id\n invoice.purchase_order_id = purchase_order.id\n invoice.work_order_id = purchase_order.work_order_id\n invoice.charge_account_id = purchase_order.charge_account_id\n # One order only: Discount must be saved as well\n invoice.discount_pct = purchase_order.discount_pct\n invoice.discount = purchase_order.discount\n if invoice.save\n # Try to save new invoice items\n purchase_order_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # purchase_order_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n end # invoice.save?\n else\n # Purchase order or items not found\n code = '$err'\n end # !purchase_order.nil? && !purchase_order_items.nil?\n else\n # Purchase order 0\n code = '$err'\n end # orders[0] != '0'\n else\n # Loop thru orders and create invoice\n orders.each do |note|\n if note != '0'\n purchase_order = PurchaseOrder.find(note) rescue nil\n purchase_order_items = purchase_order.purchase_order_items rescue nil\n if !purchase_order.nil? && !purchase_order_items.nil?\n # If it's first order, must initialize new invoice; if not, update already initialized one\n if first\n invoice = new_invoice(purchase_order, invoice_no, invoice_date, internal_no, posted_at, company)\n invoice.remarks = I18n.t(\"activerecord.attributes.supplier_invoice.purchase_orders\") + ': ' + purchase_order.order_no\n first = false\n else\n invoice.discount = invoice.discount + purchase_order.discount\n invoice.remarks = invoice.remarks + ', ' + purchase_order.order_no\n end\n if invoice.save\n # Try to save new invoice items\n purchase_order_items.each do |i|\n if i.balance != 0 # Only items not billed yet\n invoice_item = new_invoice_item(invoice, i)\n if !invoice_item.save\n # Can't save invoice item (exit)\n code = '$write'\n break\n end # !invoice_item.save?\n end # i.balance != 0\n end # purchase_order_items.each do |i|\n # Update totals\n invoice.update_column(:totals, SupplierInvoice.find(invoice.id).total)\n else\n # Can't save invoice\n code = '$write'\n break\n end # invoice.save?\n else\n # Purchase order or items not found\n code = '$err'\n end # !purchase_order.nil? && !purchase_order_items.nil?\n else\n # Purchase order 0\n code = '$err'\n end # note != '0'\n end # orders.each do |note|\n end # orders.count == 1\n\n if code == ''\n code = I18n.t(\"ag2_purchase.supplier_invoices.generate_invoice_ok\", var: invoice.id.to_s)\n end\n\n @json_data = { \"code\" => code }\n render json: @json_data\n end",
"def build_invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def invoice\n\t\t@post = Post.find(params[:id])\n\t\t@request= Request.find_by(post_id:@post.id)\n\t\t@payment = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"success\")\n\t\t@payment1 = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"refund\")\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.pdf do\n render pdf: \"invoice\",\n template: \"posts/_form.html.erb\",\n layout: \"pdf.html\",\n disposition: 'attachment'\n end\n end\n\tend",
"def generate_invoice\n @patient = Patient.find(params[:id])\n @user_patients = @patient.user_patients.where(\"archive is null\")\n respond_to do |format|\n format.html\n format.pdf do\n pdf = HmsPdfDocument.new(SessionsHelper::FOR_PATIENT, @user_patients, view_context)\n @user_patients.update_all :archive => SessionsHelper::ARCHIVE\n send_data pdf.render, filename: \"invoice_summary_#{@patient.id}.pdf\", type: \"application/pdf\"\n end\n end\n end",
"def collect_invoice(shop_id, order_id, invoice)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/invoices\", body: invoice).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def generate_invoice\n\n @vid = params[:vid].to_i\n months_before = params[:months_before].to_i\n @months_before = months_before\n sql = \"select date_trunc('month', current_date - INTERVAL '#{months_before} month') as start_date, date_trunc('month', current_date - INTERVAL '#{months_before} month')+'1month'::interval-'1day'::interval as end_date;\"\n @previous_month_dates = Reservation.find_by_sql(sql)\n start_date = @previous_month_dates[0][:start_date]\n end_date = @previous_month_dates[0][:end_date]\n @s = start_date\n @e = end_date\n\n #@reserve_venues have all data remember it.\n @reserve_venues = Reservation.where(\"created_at >= :start_date AND created_at <= :end_date AND venue_id = :vid\",\n {:start_date => start_date, :end_date => end_date,:vid => params[:vid].to_i })\n find_venue = \"select name,id,address,multiplier from venues where id IN(#{params[:vid].to_i})\"\n @venue_names = Venue.find_by_sql(find_venue)\n\n gr_kids =\"select count(charity_id) as gr_kids from reservations where charity_id ='1' AND venue_id = #{params[:vid].to_i} AND created_at >= '#{@s}' AND created_at <= '#{@e}'\"\n world_kids =\"select count(charity_id) as world_kids from reservations where charity_id ='2' AND venue_id = #{params[:vid].to_i} AND created_at >= '#{@s}' AND created_at <= '#{@e}' \"\n\n @gr_kids = Reservation.find_by_sql(gr_kids)\n @world_kids=Reservation.find_by_sql(world_kids)\n\n end",
"def show\r\n # default dates\r\n start_date = Date.today - 1.year\r\n end_date = Date.today\r\n if (to = isDate params[:dateTo])\r\n if (from = isDate params[:dateFrom])\r\n #only change if both are good dates\r\n if from < to\r\n start_date = from\r\n end_date = to\r\n end\r\n end\r\n end\r\n @start_date = start_date\r\n @end_date = end_date\r\n @billing_site = set_billing_site\r\n @meters = @billing_site.meters.order(:id)\r\n @retail_plans = @billing_site.retail_plans.order(:id)\r\n @invoices = []\r\n\r\n # select from the associated Imported invoices those between start and end date\r\n importedInvoices = @billing_site.invoices(true).where(actable_type: ImportedInvoice,\r\n start_date: start_date..end_date)\r\n\r\n #if there are imported invoices in system find their generated ones\r\n if !importedInvoices.blank?\r\n importedInvoices.each do |importedInvoice|\r\n generatedInvoices = @billing_site.invoices(true).where(actable_type: GeneratedInvoice,\r\n start_date: importedInvoice.start_date,\r\n end_date: importedInvoice.end_date)\r\n invoiceHash = {}\r\n\r\n invoiceHash[:Imported] = importedInvoice\r\n # process generated invoices, add values to hash\r\n generatedValues = []\r\n if !generatedInvoices.blank?\r\n generatedInvoices.each do |generatedInvoice|\r\n hash = {}\r\n hash[:id] = generatedInvoice.id\r\n\r\n # float needed for frontend\r\n hash[:total] = generatedInvoice.total.to_f\r\n generatedValues.push([generatedInvoice.created_at, hash])\r\n end\r\n invoiceHash[:GeneratedValues] = generatedValues\r\n else\r\n invoiceHash[:GeneratedValues] = []\r\n end\r\n @invoices.push(invoiceHash)\r\n end\r\n else\r\n @invoices =[]\r\n end\r\n end",
"def invoice_for(description, amount, tab_options = {}, invoice_options = {})\n tab(description, amount, tab_options)\n\n invoice(invoice_options)\n end",
"def print_invoice_for(payment)\n @data.payment = payment\n @data.invoice = Invoice.create_for_payment(payment, Invoice::INVOICE_TYPE)\n print_common\n end",
"def invoices\n @invoices ||= InvoiceProxy.new(self)\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def build_invoice\n # if status is nil then this is a new record and need to build out the invoice\n if self.id.blank?\n # pulls the fees and methods from the group / provider\n # fills in the invoice record with the provider specific information\n self.created_date ||= DateTime.now.strftime(\"%d/%m/%Y\")\n self.balance_owed_amount ||= 0\n\n #get the group or provider associated to the new record\n @object = self.invoiceable_type.classify.constantize.find(self.invoiceable_id)\n self.invoice_method = @object.invoice_method\n self.payment_terms = @object.payment_terms\n self.flat_fee = @object.flat_fee\n self.dos_fee = @object.dos_fee\n self.claim_percentage = @object.claim_percentage\n self.balance_percentage = @object.balance_percentage\n self.cob_fee = @object.cob_fee\n self.denied_fee = @object.denied_fee\n self.setup_fee = @object.setup_fee\n self.admin_fee = @object.admin_fee\n self.discovery_fee = @object.discovery_fee\n\n # build the detail records and calculate the invoice if the detail records dont exist\n # when create is called, the detail records exist and calculate invoice will be called with the before save callback\n if self.invoice_details.blank?\n build_detail_fee_based if self.invoice_method != PERCENT\n build_detail_claims\n build_detail_balance_bills\n build_detail_setup\n\n # calculate the charges for the invoice\n calculate_invoice\n end\n end\n end",
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def invoice\n\tparams['invoice']\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def send_invoices\n change_date\n @options = session[:invoice_options] || {}\n\n [\n :s_username, :s_first_name, :s_last_name, :s_number, :s_period_start, :s_period_end,\n :s_issue_date, :s_sent_email, :s_sent_manually, :s_paid, :s_invoice_type\n ].each do |key|\n @options[key] = params[key].try(:to_s).try(:strip) || @options[key].to_s\n end\n\n @invoices = Invoice.for_send(corrected_user_id, @options)\n\n MorLog.my_debug(\"*************Invoice sending, found : #{@invoices.size.to_i}\", 1)\n\n @number = 0\n not_sent = 0\n\n params[:email_or_not] = 1\n session[:invoice_options] = @options\n email_from = Confline.get_value('Email_from', correct_owner_id)\n\n if @invoices.size.to_i > 0\n @invoices.each { |invoice|\n user = invoice.user\n attach = []\n params[:id] = invoice.id\n prepaid = invoice.invoice_type.to_s == 'prepaid' ? 'Prepaid_' : ''\n @invoice = user.send_invoice_types.to_i\n if @invoice.to_i != 0\n if (user.email).length > 0\n @invoice -= if @invoice >= 512\n xlsx = {\n file: export_invoice_to_xlsx,\n content_type: 'application/octet-stream',\n filename: \"#{_('invoice_xlsx')}.xlsx\"\n }\n attach << xlsx\n 512\n else\n 0\n end\n\n if !(user.postpaid == 0 && invoice.invoicedetails.first.try(:name).to_s == \"Manual Payment\")\n if (@invoice % 2) == 1\n @invoice = Confline.get_value(\"#{prepaid}Invoice_default\",\n correct_owner_id).to_i\n end\n\n @invoice -= if @invoice >= 256\n calls_cvs = {}\n calls_cvs[:file] = get_prepaid_user_calls_csv(user, invoice)\n calls_cvs[:content_type] = 'text/csv'\n calls_cvs[:filename] = \"#{_('Calls')}.csv\"\n attach << calls_cvs\n 256\n else\n 0\n end\n\n @invoice -= if @invoice >= 128\n csv = {}\n csv[:file] = generate_invoice_by_cid_csv\n csv[:content_type] = 'text/csv'\n csv[:filename] = \"#{_('Invoice_by_CallerID_csv')}.csv\"\n attach << csv\n 128\n else\n 0\n end\n\n @invoice -= if @invoice >= 64\n csv = {}\n csv[:file] = generates_invoice_destinations_csv\n\n unless csv[:file]\n redirect_to :root unless performed?\n return false\n end\n\n csv[:content_type] = 'text/csv'\n csv[:filename] = \"#{_('Invoice_destinations_csv')}.csv\"\n attach << csv\n 64\n else\n 0\n end\n\n @invoice -= if @invoice >= 32\n pdf = {}\n pdf[:file] = generate_invoice_by_cid_pdf\n pdf[:content_type] = 'application/pdf'\n pdf[:filename] = \"#{_('Invoice_by_CallerID_pdf')}.pdf\"\n attach << pdf\n 32\n else\n 0\n end\n\n @invoice -= if @invoice >= 16\n csv = {\n file: generate_invoice_detailed_csv,\n content_type: 'text/csv',\n filename: \"#{_('Invoice_detailed_csv')}.csv\"\n }\n attach << csv\n 16\n else\n 0\n end\n\n @invoice -= if @invoice >= 8\n pdf = {\n file: generate_invoice_detailed_pdf,\n content_type: 'application/pdf',\n filename: \"#{_('Invoice_detailed_pdf')}.pdf\"\n }\n attach << pdf\n 8\n else\n 0\n end\n end\n\n @invoice -= if @invoice >= 4\n csv = {\n file: generate_invoice_csv,\n content_type: 'text/csv',\n filename: \"#{_('Invoice_csv')}.csv\"\n }\n attach << csv\n 4\n else\n 0\n end\n\n if @invoice >= 2\n pdf = {\n file: generate_invoice_pdf,\n content_type: 'application/pdf',\n filename: \"#{_('Invoice_pdf')}.pdf\"\n }\n attach << pdf\n end\n\n variables = email_variables(user)\n email= Email.where([\"name = 'invoices' AND owner_id = ?\", user.owner_id]).first\n MorLog.my_debug(\"Try send invoice to : #{user.address.email}, Invoice : #{invoice.id}, User : #{user.id}, Email : #{email.id}\", 1)\n # @num = EmailsController.send_email_with_attachment(email, email_from,\n # user, attach, variables)\n variables = Email.email_variables(user)\n email.body = nice_email_sent(email, variables)\n\n @num = EmailsController.send_invoices(email, user.email.to_s,\n email_from, attach,\n invoice.number.to_s)\n\n MorLog.my_debug (\"Invoice email was send to : #{user.address.email} ? : #{@num}\")\n if @num == 'true'\n @number += 1\n invoice.sent_email = 1\n invoice.save\n Action.create_email_sending_action(user, 'email_sent', email)\n else\n not_sent += 1\n Action.create_email_sending_action(user, 'error', email,\n {er_type: 1, err_message: @num})\n end\n else\n not_sent += 1\n email= Email.where([\"name = 'invoices' AND owner_id = ?\", user.owner_id]).first\n Action.create_email_sending_action(user, 'error', email, {er_type: 1})\n end\n end\n }\n end\n\n flash[:notice] = _('ERROR') + ': ' + @num[1].to_s if @num && @num[0] == 0\n if @number.to_i > 0\n flash[:status] = _('Invoices_sent') + ': ' + @number.to_s\n else\n flash[:notice] = _('Invoices_not_sent') + ': ' + not_sent.to_s if not_sent.to_i > 0\n end\n flash[:notice] = _('No_invoices_found_in_selected_period') if @invoices.size.to_i == 0\n redirect_to(action: :invoices) unless performed?\n return false\n end",
"def index\n @invoice_rows = @invoice.invoice_rows\n end",
"def list_invoices\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Invoices\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page])\n if params[:search]\n @invoices = Factura.search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page]) \n end\n\n \n else\n errPerms()\n end\n end",
"def invoice_item\n Zapi::Models::InvoiceItem.new\n end",
"def index\n @order_invoices = OrderInvoice.all\n end",
"def create_invoice\n self.invoice = match.invoices.create unless invoice\n end",
"def invoice\n raise \"deprecated as we use has_many :invoices association\"\n end",
"def create_invoice\n # create an invoice from order object, i.e. with eventbooking attached\n return InvoiceCreateFromOrder.new(self.order, self).perform\n end",
"def generate_pdf\n respond_with(invoice)\n end",
"def construct_freshbooks_invoice_data\n # Capture appropriate data from ledger and activities\n invoice_lines = []\n self.ledger_entries.debits.select( 'narrative, value, count(*) as quantity' ).group(:narrative, :value).each do |entry|\n invoice_lines << { line: { \n name: entry.narrative,\n description: '%s at %0.4f' % [entry.narrative, -entry.value.to_f],\n unit_cost: -entry.value,\n quantity: entry.quantity\n }}\n end\n \n # Create a new invoice data structure\n invoice_data = { client_id: self.organization.accounting_gateway.freshbooks_id, return_uri: 'http://www.signalcloudapp.com' }\n invoice_data[:lines] = invoice_lines unless invoice_lines.empty?\n invoice_data[:po_number] = self.purchase_order unless self.purchase_order.blank?\n invoice_data[:notes] = 'This invoice is provided for information purposes only. No payment is due.' if self.balance >= 0\n \n return invoice_data\n end",
"def initialize(invoice)\n raise ArgumentError, \"Received #{invoice.class} object (expected instance of Invoice)\" unless invoice.is_a?(MnoEnterprise::Invoice)\n @invoice = invoice\n @pdf = nil\n @data = {}\n\n #===============================\n # Initialize formatting\n #===============================\n @format = {}\n @format[:header_size] = 120\n @format[:footer_size] = 100\n @format[:top_margin] = 36\n @format[:bottom_margin] = 36\n\n #===============================\n # Data hash\n #===============================\n @data = {}\n\n # Invoice details\n @data[:invoice_reference] = @invoice.slug\n\n # Customer details\n invoicable = @invoice.organization\n [:name, :email, :current_credit].each do |detail|\n @data[\"customer_#{detail}\".to_sym] = invoicable.respond_to?(detail) ? invoicable.send(detail) : nil\n end\n\n # Billing Address - Kept at the invoice level for audit purpose\n @data[:customer_billing_address] = @invoice.billing_address\n\n # Financial values\n @data[:invoice_price] = @invoice.price\n @data[:invoice_currency] = @invoice.price.currency.to_s\n @data[:invoice_currency_name] = @invoice.price.currency.name\n @data[:invoice_credit_paid] = @invoice.credit_paid\n @data[:invoice_total_payable] = @invoice.total_payable\n @data[:invoice_tax_payable] = @invoice.tax_payable\n @data[:invoice_tax_pips] = (@invoice.tax_pips_applied || 0)\n @data[:invoice_total_payable_with_tax] = @data[:invoice_total_payable] + @data[:invoice_tax_payable]\n @data[:invoice_fully_paid] = (@data[:invoice_total_payable].zero? || @data[:invoice_total_payable].negative?)\n\n # Last App billing (Account Situation)\n @data[:invoice_previous_total_due] = @invoice.previous_total_due\n @data[:invoice_previous_total_paid] = @invoice.previous_total_paid\n\n # Split billing summary in the event that one group\n # has a large number of items (greater than 25).\n # This prevents blank pages being added to the invoice\n # by the pdf generator due to items not fitting on the page.\n @invoice.billing_summary.each do |item|\n item[:label] = 'Adjustments' if item[:label] == 'Platform Usage'\n while item[:lines].count > 25\n @invoice.billing_summary << {\n label: \"#{item[:label]} cont'd.\",\n price_tag: '',\n lines: item[:lines].slice!(25, 50)\n }\n end\n end.sort! do |a, b|\n a_label = a[:label].in?(['Adjustments', \"Adjustments cont'd.\"]) ? 'zzzzzzz' + a[:label] : a[:label]\n b_label = b[:label].in?(['Adjustments', \"Adjustments cont'd.\"]) ? 'zzzzzzz' + b[:label] : b[:label]\n a_label <=> b_label\n end\n\n # Billing details\n @data[:billing_report] = @invoice.billing_summary.map do |item|\n item_label = item[:label]\n price_label = format_price item\n\n (item[:lines] || []).each do |item_line|\n item_label += \"<font size='4'>\\n\\n</font><font size='8'><color rgb='999999'><i>#{Prawn::Text::NBSP * 3}#{item_line[:label]}</i></color></font>\"\n price_label += \"<font size='4'>\\n\\n</font><font size='8'><color rgb='999999'>#{format_price(item_line)}</color></font>\"\n end\n\n [item_label, item[:name], item[:usage], price_label]\n end\n\n # Billing period\n @data[:period_started_at] = @invoice.started_at.utc.to_date\n @data[:period_ended_at] = (@invoice.ended_at.utc - 1.minute).to_date # '- 1 minute' to avoid midnight (which belongs to following day)\n @data[:period_month] = @invoice.ended_at.strftime(\"%B\")\n next_period = @data[:period_ended_at] + 1.month\n @data[:period_charge_date] = Date.new(next_period.year,next_period.month,2)\n end",
"def generateConcreteCharges\r\n\t #For each charge factories asscociated with retail plans, generate concrete charge and total them\r\n\t self.retail_plan.charge_factories.each do |charge_factory| \r\n\t generated_concrete_charges = charge_factory.specific.concreteCharge(self)\r\n\t #Put each generated_concrete_charge to GeneratedInvoice\r\n\t generated_concrete_charges.each do |generated_concrete_charge|\t \t\r\n\t\t self.concrete_charges << generated_concrete_charge\r\n\t\t self.total += generated_concrete_charge.amount\r\n\t end\r\n\t end\r\n\tend",
"def invoices_by_id_select\n \n end",
"def index\n @invoices = User.find(current_user.id).invoices\n end",
"def invoices_report\n @d = ActiveRecord::Base.connection.execute(\"\nselect c.customer_id, c.name, o.order_id, o.order_date,p.description, ol.product_id, sum(ol.ordered_quantity) as quantity, p.standard_price, sum(p.standard_price*ol.ordered_quantity) as total from customers c inner join orders o on c.customer_id = o.customer_id inner join order_lines ol on ol.order_id = o.order_id inner join products p on p.product_id = ol.product_id where p.id <= 8 group by c.name\n\")\n end",
"def new\n @invoice = current_organization.invoices.new(:client => @client)\n @invoice.invoice_lines.build\n @clients = current_organization.clients\n @next_invoice_number = current_organization.next_invoice_number\n @previous_invoice_number = current_organization.previous_invoice_number\n end",
"def invoice_created\n invoice_id = object['id']\n invoice_start = Time.at(object['period_start'].to_i)\n invoice_end = Time.at(object['period_end'].to_i)\n range = invoice_start..invoice_end\n user.bill_date_range_to_invoice(range, invoice_id)\n end",
"def lines\n invoice_lines\n end",
"def index\n @invoices = current_brand.invoices.where(is_template: false).order(id: :asc)\n @plan_billing = PlanBilling.find_by(user_id: current_brand.user_id)\n @contacts = current_brand.client_contacts.all\n @status = Status.all\n\n puts \"client name and email\"\n @invoices = @invoices.client_name_email(params[:client_name_email]) if params[:client_name_email].present?\n puts \"item name and description\"\n @invoices = @invoices.item_name_description(params[:item_name_desc]) if params[:item_name_desc].present?\n puts \"invoices number\"\n @invoices = @invoices.invoice_number(params[:invoice_no]) if params[:invoice_no].present?\n puts \"invoice_status\"\n @invoices = @invoices.invoice_status(params[:invoice_status_id]) if params[:invoice_status_id].present?\n\n\n @invoice_email = InvoiceEmail.new\n # puts @invoices.as_json\n end",
"def create\n ActiveRecord::Base.transaction do\n @invoice = Invoice.new invoice_params\n customer = Customer.find_or_create_by(name: params[:customer_name])\n @invoice.customer = customer\n @invoice.save!\n\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_invoices(options = {})\n\n request_params = {}\n\n request_params[:InvoiceID] = options[:invoice_id] if options[:invoice_id]\n request_params[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:IDs] = Array(options[:invoice_ids]).join(\",\") if options[:invoice_ids]\n request_params[:InvoiceNumbers] = Array(options[:invoice_numbers]).join(\",\") if options[:invoice_numbers]\n request_params[:ContactIDs] = Array(options[:contact_ids]).join(\",\") if options[:contact_ids]\n request_params[:page] = options[:page] if options[:page]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Invoices\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/Invoices'})\n end",
"def generate_user_invoice_reports\n generate_invoice = true\n if params[:date_end].blank? || params[:date_start].blank? or params[:company][:id].blank?\n flash[:error] = t(:flash_select_fields)\n generate_invoice = false\n else\n if (params[:date_end].to_date - params[:date_start].to_date).to_i < 0\n flash[:error] = t(:flash_invoice_date)\n generate_invoice = false\n end\n end\n respond_to do |format|\n if generate_invoice == true\n Invoice.create_invoice(params)\n format.html {redirect_to :action => 'index'}\n format.xml { head :ok }\n else\n @companies = Company.getcompanylist(current_user.company_id)\n format.html {render :action=>'new'}\n format.xml { render :xml => @companies}\n end\n end\n end",
"def index\n respond_with(invoices)\n end",
"def generate\n @id = params[:id]\n @collection = Collection.find(@id) \n collection = @collection \n\n if !@collection.contact_id.nil?\n\n if collection.contact.name.nil?\n @name = collection.contact.fname.to_s + \"\" + collection.contact.lname.to_s\n else\n @name = collection.contact.name\n end\n @amountinpp = Pplan.where(:contact_id => collection.contact_id).where(:sale_id => collection.sale_id).sum :amount\n @amount_collected = Collection.where(:sale_id => collection.sale_id).where(:contact_id => collection.contact_id).sum :amount\n @collection_current = collection.amount\n @id = collection.id\n\n@invoice = Invoice.create(:sale_id => collection.sale_id, :name => @name, :contact_id => collection.contact_id, :amount_collected => @amount_collected, :amount_pplan => @amountinpp, :collection_current => @collection_current)\n\n @collection.update(:invoicing_status => 1, :invoice_id => @invoice.id) \n end\n\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n\n# render inline: \"Done!\"\n end",
"def sales_invoice\n sales_invoices.order(:date, :id).first\n end",
"def url\n '/api/invoices'\n end",
"def make_the_payment\n\n session[:purchasable] = nil\n if @order and @order.invoices.last\n @invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n end \t\n\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n @invoice.accept_cash_or_cheque_or_bank_payment(params[:invoicing_info][:payment_medium]) \n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \t\n @current_object.invoice = @invoice\n @current_object.save\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,@order.id])\n if @order.instance_of? CompetitionsUser\n note = \"no notes created\"\n note = @order.competition.timing.note if @order.competition.timing\n start_date = @order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = @order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if invoice\n\n p \"fdfgffggfdgfgd\"\n\n \n p \"i got the invoice and creating pdf\"\n\n create_pdf(invoice.id,invoice.number,start_date,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,invoice.final_amount.to_i,0,false,end_date)\n end \n else\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n end\n elsif @order.instance_of? ExhibitionsUser\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n\n # email= UserMailer.create_send_invoice(invoice,@current_user)\n # UserMailer.deliver(email)\n\n p \"sending the emaillll\"\n email= UserMailer.create_send_invoice(invoice,@current_user)\n #UserMailer.deliver(email)\n\n rescue\n end\n session[:total_entry] = nil \n if @invoice.purchasable_type == \"Order\"\n session[:cart]=nil\n end\n end",
"def invoice_lines_from_order(order)\n invoice = self\n order.order_lines.each do |ol|\n # order_lines are static_document_lines, so they can be assigned to an invoice\n # at the same time, ensuring that the invoice always reflects the order 100%.\n ol.invoice = invoice\n ol.save\n end\n return invoice\n end",
"def invoices\n Invoice.where(email: email)\n end",
"def invoice\n @invoice ||= Invoice.find(params[:id])\n end",
"def invoice_list\n @list_result=ChargeBee::Invoice.invoices_for_subscription(@subscription_id,\n { :limit => 20 })\n end",
"def make_the_payment_paypal\n #here i need to refresh the order because the total entry field is changed\n order=CompetitionsUser.find(session[:order].id)\n if order and order.invoices.last\n @invoice = order.generate_invoice_extra_entry(@current_user,{\"payment_medium\"=>\"paypal\"} )\n else\n @invoice = order.generate_invoice(@current_user, {\"payment_medium\"=>\"paypal\"}) \n end \t\n @invoice.validating(\"paypal\")\n session[:current_object].invoice = @invoice\n session[:current_object].save\n p session[:userid]\n if session[:userid].blank?\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,order.id])\n \n else\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",session[:userid],order.id])\n \n end\n \n if order.instance_of? CompetitionsUser\n note = \"no note created\"\n note = order.competition.timing.note if order.competition.timing \n \n start_date = order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n p \"the invoice is blank\"\n p invoice\n if invoice \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n else\n p \"i dont have invoice created\"\n end\n elsif order.instance_of? ExhibitionsUser\n note = \"no note created\"\n note = order.exhibition.timing.note if order.exhibition.timing \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n email= UserMailer.create_send_invoice(invoice,@current_user)\n UserMailer.deliver(email)\n rescue => e\n logger.info \"there is error while sending the email\"\n logger.info e\n end\n end",
"def create\n @invoice = current_user.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Uw factuur is opgeslagen.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { @invoice.build_company\n @invoice.items.build\n @invoice.build_relation\n render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @invoices = Invoice.all\n @invoice = Invoice.find(params[:id])\n end",
"def create\n get_current_user\n @types = Type.find_by_typename('invoice_terms')\n @terms = 'none'\n \n @terms = @types.type_value_string \n \n \n @shipments = Invoice.get_ready_shipments(@current_user.id, params[:customer_id], params[:start_date], params[:stop_date])\n @count = 0\n \n @shipments.each do |sh|\n @invoice = Invoice.new(params[:invoice])\n @invoice.shipment_id = sh.id\n @invoice.ship_amount = sh.ship_amount\n @invoice.ship_charge = sh.shipping_charge\n @invoice.total_amount = sh.ship_amount.to_f + sh.shipping_charge.to_f\n @types = Type.find_by_typename('invoice_number')\n \n @invno = @types.type_value_integer + 1\n @types.type_value_integer = @invno\n @types.save\n \n @invoice.invoice_number = @invno\n @invoice.invoice_status = 'NEW'\n @invoice.invoice_terms = @terms\n @invoice.invoice_date = Date.today.to_date\n @invoice.user_id = @current_user.id \n @count += 1\n @invoice.save\n \n @shipment = Shipment.find(sh.id)\n @shipment.ship_status = 'invoiced'\n @shipment.save\n end\n\n respond_to do |format|\n message = @count.to_s + ' - Invoice(s) were successfully created.'\n format.html { redirect_to('/invoice_generator', :notice => message) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n\n end\n end",
"def customer_new_invoice\n @invoice = Invoice.new\n @services = []\n customer_id = params[:customer_id]\n @customer = Customer.find_by_id(customer_id)\n @company = Company.find_by_id(current_user.company_id)\n end",
"def invoice\n @ipn['invoice']\n end",
"def index\n @user_invoices = UserInvoice.all\n end",
"def format_one_invoice\n index = rand(0..(@b2b_partners_list_invoices.length-1))\n\n @documentID = @b2b_partners_list_invoices[index][\"PEDC_ID_CLIENTE\"]\n @random_invoice = @b2b_partners_list_invoices[index]\nend",
"def index\n @invoices = current_organization.invoices.paginate(:all, :order => 'number DESC', :page => params[:page])\n end",
"def index\n @customer_invoices = CustomerInvoice.all\n end",
"def index\n if params[:project_id].nil?\n @invoices = Invoice.all\n else\n @project=Project.find(params[:project_id])\n @invoices=@project.invoices\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def create_invoice_packages\n \n Caboose.log(\"Creating invoice packages...\")\n \n store_config = self.site.store_config \n if !store_config.auto_calculate_packages \n InvoicePackage.custom_invoice_packages(store_config, self)\n return\n end\n \n # Make sure all the line items in the invoice have a quantity of 1\n extra_line_items = []\n self.line_items.each do |li| \n if li.quantity > 1 \n (1..li.quantity).each{ |i| \n extra_line_items << li.copy \n }\n li.quantity = 1\n li.save\n end \n end\n extra_line_items.each do |li| \n li.quantity = 1 \n li.save \n end \n \n # Make sure all the items in the invoice have attributes set\n self.line_items.each do |li| \n v = li.variant\n next if v.downloadable\n Caboose.log(\"Error: variant #{v.id} has a zero weight\") and return false if v.weight.nil? || v.weight == 0\n next if v.volume && v.volume > 0\n Caboose.log(\"Error: variant #{v.id} has a zero length\") and return false if v.length.nil? || v.length == 0\n Caboose.log(\"Error: variant #{v.id} has a zero width\" ) and return false if v.width.nil? || v.width == 0\n Caboose.log(\"Error: variant #{v.id} has a zero height\") and return false if v.height.nil? || v.height == 0 \n v.volume = v.length * v.width * v.height\n v.save\n end\n \n # Reorder the items in the invoice by volume\n line_items = self.line_items.sort_by{ |li| li.quantity * (li.variant.volume ? li.variant.volume : 0.00) * -1 }\n \n # Get all the packages we're going to use \n all_packages = ShippingPackage.where(:site_id => self.site_id).reorder(:flat_rate_price).all \n \n # Now go through each variant and fit it in a new or existing package \n line_items.each do |li| \n next if li.variant.downloadable\n \n # See if the item will fit in any of the existing packages\n it_fits = false\n self.invoice_packages.all.each do |op|\n it_fits = op.fits(li)\n if it_fits \n li.invoice_package_id = op.id\n li.save \n break\n end\n end \n next if it_fits\n \n # Otherwise find the cheapest package the item will fit into\n it_fits = false\n all_packages.each do |sp|\n it_fits = sp.fits(li.variant) \n if it_fits \n op = InvoicePackage.create(:invoice_id => self.id, :shipping_package_id => sp.id)\n li.invoice_package_id = op.id\n li.save \n break\n end\n end\n next if it_fits\n \n Caboose.log(\"Error: line item #{li.id} (#{li.variant.product.title}) does not fit into any package.\") \n end \n end",
"def index\n @service_invoices = ServiceInvoice.all\n end",
"def generate_invoice_csv\n if @invoice.is_a?(Fixnum)\n invoice = Invoice.includes([:tax, :user]).where(id: params[:id]).first\n else\n invoice = @invoice\n end\n\n user = invoice.user\n @invoices_status = user.get_invoices_status\n status = (@invoices_status[1] == 4)\n\n if not_authorized_generate_pdf_or_csv(user, status) == 1\n redirect_to :root unless performed?\n return false\n end\n\n sep, dec = user.csv_params\n nice_number_hash = {:change_decimal => session[:change_decimal], :global_decimal => session[:global_decimal]}\n\n dc, ex = manage_exchange_rates(invoice)\n\n csv_string = [\"number#{sep}user_id#{sep}period_start#{sep}period_end#{sep}issue_date#{sep}price (#{dc})#{sep}price_with_tax (#{dc})#{sep}accounting_number\"]\n csv_string << \"#{invoice.number.to_s}#{sep}\" +\n \"#{nice_user(user)}#{sep}\" +\n \"#{nice_date(invoice.period_start, 0)}#{sep}\" +\n \"#{nice_date(invoice.period_end, 0)}#{sep}\" +\n \"#{nice_date(invoice.issue_date)}#{sep}\" +\n \"#{invoice.nice_invoice_number(invoice.converted_price(ex), nice_number_hash).to_s.gsub(\".\", dec).to_s}#{sep}\" +\n \"#{invoice.nice_invoice_number(invoice.converted_price_with_vat(ex), nice_number_hash).to_s.gsub(\".\", dec).to_s}#{sep}\" +\n \"#{user.accounting_number}\"\n\n # my_debug csv_string\n prepaid, prep = invoice_type(invoice, user)\n\n filename = invoice.filename(prep, 'csv', nil, dc)\n\n if params[:email_or_not]\n return csv_string.join(\"\\n\")\n else\n if params[:test].to_i == 1\n render :text => ([\"Filename: #{filename}\"] + csv_string).join(\"\\n\")\n else\n send_data(csv_string.join(\"\\n\"), :type => 'text/csv; charset=utf-8; header=present', :filename => filename)\n end\n end\n end",
"def invoices(include_pending = false, parameters = {})\n return [] unless stripe_id?\n\n invoices = []\n\n parameters = { limit: 24 }.merge(parameters)\n\n stripe_invoices = Stripe::Invoice.list(\n { customer: stripe_id }.merge(parameters),\n stripe_options\n )\n\n # Here we will loop through the Stripe invoices and create our own custom Invoice\n # instances that have more helper methods and are generally more convenient to\n # work with than the plain Stripe objects are. Then, we'll return the array.\n stripe_invoices&.data&.each do |invoice|\n invoices << Invoice.new(self, invoice) if invoice.paid || include_pending\n end\n\n invoices\n end",
"def index\n @page_name = 'Invoice History'\n @invoices = Invoice.all\n end",
"def invoice(number)\n add_field 'x_invoice_num', number\n end",
"def initialize(invoices)\n @collection = invoices.map{|invoice| Invoice.new(invoice) }\n end",
"def create\n @project = Project.find(params[:invoice][:project_id])\n @invoice = Invoice.new(params[:invoice])\n @invoice.remaining_sum=@invoice.total_sum\n @invoice.invoice_num=@invoice.create_invoice_num\n @invoice.invoice_ref=@invoice.create_invoice_ref\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(@invoice, :notice => 'Facture créé avec succes.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_generated_invoice\r\n if !params[:invoice][\"invoice_id\"].blank?\r\n #Based on the selection of imported invoice from the user\r\n imported_invoice = ImportedInvoice.find(params[:invoice][:invoice_id])\r\n @invoice = GeneratedInvoice.new(imported_invoice.attributes.except!(\"file\"))\r\n if @invoice.save\r\n respond_to do |format|\r\n format.html { render :show, notice: 'Invoice was successfully generated.' }\r\n format.json { render :show, status: :created, location: @invoice }\r\n return\r\n end\r\n else\r\n respond_to do |format|\r\n format.html { render :generateNew }\r\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\r\n return\r\n end\r\n end\r\n else\r\n flash[:error] = \"Some Fields Are Missing, Please Fill in All Required Items!\"\r\n redirect_to generateNew_invoices_path\r\n end\r\n end",
"def create_invoice\n run_task :create_invoice do\n line_items = create_xero_line_items(@proposal.invoice_lines)\n if line_items.empty?\n logger.debug 'Not creating an invoice because there are no invoice lines'\n current_state[:status] = 'not required because no invoice lines'\n return false\n end\n\n logger.debug 'Creating new invoice'\n\n spec = {\n 'Type' => 'ACCREC',\n 'Contact' => {\n 'ContactID' => find_or_create_xero_contact(@export.invoice_contact_name)\n },\n 'Date' => @export.date.strftime('%Y-%m-%d'),\n 'DueDate' => @export.date.strftime('%Y-%m-%d'),\n 'InvoiceNumber' => @export.invoice_number,\n 'Reference' => @export.invoice_reference || @export.reference,\n 'CurrencyCode' => @export.currency,\n 'Status' => 'AUTHORISED',\n 'LineItems' => line_items\n }\n\n invoice = @api.post('Invoices', spec)['Invoices'].first\n\n logger.debug \"Invoice created with ID #{invoice['InvoiceID']} for #{invoice['AmountDue']}\"\n current_state[:status] = 'invoice created'\n current_state[:invoice_id] = invoice['InvoiceID']\n current_state[:amount] = invoice['AmountDue']\n end\n end",
"def invoices\n ChargeBee::Invoice.invoices_for_customer(chargebee_id).map(&:invoice)\n end",
"def index\n\n # get the agency\n @agency = Agency.find(session[:agencyId])\n\n # get the invoices\n @invoices = @agency.agency_invoices\n\n if !params[:invoice_id].nil?\n\n # if an invoice is selected, view it\n @invoice = @invoices.select {|i| i.id == params[:invoice_id].to_i}[0]\n @details = @invoice.agency_invoice_details.paginate(:page => params[:page], :per_page => 16)\n\n end\n\n respond_to do |format|\n\n format.html\n\n format.pdf { send_data(render_pdf('PORTRAIT', { :action => 'invoice.rpdf', :layout => 'pdf_invoice' }), :filename => \"invoice.pdf\" ) }\n #format.test { render :action => 'invoice.rpdf', :layout => 'pdf_invoice.html' }\n\n end\n\n end"
] | [
"0.76258516",
"0.75981605",
"0.7328746",
"0.7234681",
"0.723045",
"0.72195935",
"0.7205239",
"0.7142577",
"0.71110326",
"0.7075352",
"0.70709187",
"0.6981617",
"0.6968688",
"0.6959774",
"0.6930603",
"0.69261795",
"0.69030565",
"0.6875517",
"0.6847351",
"0.68450534",
"0.67519313",
"0.67330277",
"0.672372",
"0.67067975",
"0.6701904",
"0.6694699",
"0.66846526",
"0.66759956",
"0.6636584",
"0.66301167",
"0.6619831",
"0.661778",
"0.6582272",
"0.65820444",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6562161",
"0.6559837",
"0.65544325",
"0.6548705",
"0.65449774",
"0.65427935",
"0.65357566",
"0.6533844",
"0.65049523",
"0.6486707",
"0.6486691",
"0.64817226",
"0.64646155",
"0.6453218",
"0.64394414",
"0.6434246",
"0.64253145",
"0.6415096",
"0.64142996",
"0.6406604",
"0.6403862",
"0.63951975",
"0.6374219",
"0.6368343",
"0.63639593",
"0.63533866",
"0.6341982",
"0.63295674",
"0.6321232",
"0.6316222",
"0.63001716",
"0.62973654",
"0.6294047",
"0.62935877",
"0.6293511",
"0.6292098",
"0.6286868",
"0.62822986",
"0.6268514",
"0.6262656",
"0.6261891",
"0.62618613",
"0.62556225",
"0.62454325",
"0.6231094",
"0.62263405",
"0.6226126",
"0.6220632",
"0.6214433",
"0.62140924",
"0.6211165",
"0.62102437",
"0.62097406",
"0.6205115",
"0.61975676",
"0.6197504",
"0.61919665",
"0.6175679",
"0.6174724"
] | 0.0 | -1 |
================================ end of PDF ======================================================================== | def generate_invoice_csv
if @invoice.is_a?(Fixnum)
invoice = Invoice.includes([:tax, :user]).where(id: params[:id]).first
else
invoice = @invoice
end
user = invoice.user
@invoices_status = user.get_invoices_status
status = (@invoices_status[1] == 4)
if not_authorized_generate_pdf_or_csv(user, status) == 1
redirect_to :root unless performed?
return false
end
sep, dec = user.csv_params
nice_number_hash = {:change_decimal => session[:change_decimal], :global_decimal => session[:global_decimal]}
dc, ex = manage_exchange_rates(invoice)
csv_string = ["number#{sep}user_id#{sep}period_start#{sep}period_end#{sep}issue_date#{sep}price (#{dc})#{sep}price_with_tax (#{dc})#{sep}accounting_number"]
csv_string << "#{invoice.number.to_s}#{sep}" +
"#{nice_user(user)}#{sep}" +
"#{nice_date(invoice.period_start, 0)}#{sep}" +
"#{nice_date(invoice.period_end, 0)}#{sep}" +
"#{nice_date(invoice.issue_date)}#{sep}" +
"#{invoice.nice_invoice_number(invoice.converted_price(ex), nice_number_hash).to_s.gsub(".", dec).to_s}#{sep}" +
"#{invoice.nice_invoice_number(invoice.converted_price_with_vat(ex), nice_number_hash).to_s.gsub(".", dec).to_s}#{sep}" +
"#{user.accounting_number}"
# my_debug csv_string
prepaid, prep = invoice_type(invoice, user)
filename = invoice.filename(prep, 'csv', nil, dc)
if params[:email_or_not]
return csv_string.join("\n")
else
if params[:test].to_i == 1
render :text => (["Filename: #{filename}"] + csv_string).join("\n")
else
send_data(csv_string.join("\n"), :type => 'text/csv; charset=utf-8; header=present', :filename => filename)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_document; end",
"def end_document; end",
"def on_end_document\n end",
"def finalize_standard_report\n render_pdf\n end",
"def close\n @pdf_doc.close\n @pdf_doc.isClosed\n end",
"def flush\n @scrap.start_new_page\n oldy = @scrap.y\n render @scrap\n height = (oldy - @scrap.y) + 36 # whops magic number\n if ((@pdf.y - height) < @pdf.bounds.bottom)\n @pdf.start_new_page\n end\n render @pdf\n @pdf.move_down(20)\n @buffer = []\n end",
"def Close()\n\t\t#Terminate document\n\t\tif (@state==3)\n\t\t\treturn;\n\t\tend\n\t\tif (@page==0)\n\t\t\tAddPage();\n\t\tend\n\t\t#Page footer\n\t\t@in_footer=true;\n\t\tFooter();\n\t\t@in_footer=false;\n\t\t#Close page\n\t\tendpage();\n\t\t#Close document\n\t\tenddoc();\n\tend",
"def on_end_document\n STDOUT << \"on_end_document\\n\"\n STDOUT.flush\n end",
"def build_footer\n @pdf.number_pages(\n '<page> / <total>',\n start_count_at: 1,\n at: [@pdf.bounds.right - 50, 0],\n align: :right,\n size: 12\n ) unless @pdf.page_count == 1\n end",
"def newpage\n if (@filetype == :pdf)\n CGContextFlush(@ctx)\n CGPDFContextEndPage(@ctx)\n CGPDFContextBeginPage(@ctx, nil)\n else\n puts \"WARNING: newpage only valid when using PDF output\"\n end\n end",
"def end_of_section\n\t$report_file.puts(\"-------END OF SECTION-------\")\n\t$report_file.puts\nend",
"def hcfa1500_pdf\n @claim = Claim.find(params[:claim_id])\n @patient = Claim.patientdetail(params[:visitid],params[:claim_id]).first\n @referal_provider = Claim.claim_referal(@patient.patient_id).first\n @secondary_policy = Policy.find_by_patient_id_and_carrier_type(@patient.patientid,'Secondary')\n @secondary_policy.decrypt_demographics if @secondary_policy\n @selected_procedure_codes = Patient.selected_procedure_codes(params[:visitid])\n @selected_icd_codes = Visit.selected_icd_codes_for_cpt(@selected_procedure_codes.collect{|x|x.charge_entry_id}) if @selected_procedure_codes != []\n\n @selected_diagnosis_codes = Patient.ordered_visit_diag_codes(params[:visitid])\n @practice = Practice.find(session[:practice_id])\n @visit = Visit.find(params[:visitid])\n @doctor = @visit.doctor\n @place_of_service = PLACE_OF_SERVICE_CODES\n @location = @visit.location\n\n @pdf = PDF::Writer.new\n @pdf.select_font \"Courier\"\n\n helvetica = 'Helvetica'\n helvetica_Bold = 'Helvetica-Bold'\n helvetica_Bold_Oblique = 'Helvetica-BoldOblique'\n\n\n unless (params[:official])\n @pdf.fill_color Color::RGB::Gray90\n\n for x1, y1, x2, y2 in Hcfa1500Constants::GREYAREAWITHOUTERLINE\n @pdf.rectangle(x1, y1, x2, y2).close_fill_stroke\n end\n\n for x1, y1, x2, y2 in Hcfa1500Constants::GREYAREA\n @pdf.rectangle(x1, y1, x2, y2).close_fill\n end\n\n @pdf.fill_color Color::RGB::Black\n \n for x1, y1, x2, y2 in Hcfa1500Constants::DOTTEDHORIZONTALLINE\n while x1 <= x2-3\n @pdf.line(x1, y1, x1+3, y2)\n x1+=6\n end\n end\n\n for x1, y1, x2, y2 in Hcfa1500Constants::DOTTEDVERTICALLINE\n while y1 <= y2-2\n @pdf.line(x1, y1, x2, y1+2)\n y1+=4\n end\n end\n\n for x1, y1, x2, y2 in Hcfa1500Constants::DASHLINES\n @pdf.line(x1, y1, x2, y2).stroke_style(:pattern ==[2,1])\n end\n \n for width, lines in Hcfa1500Constants::LINES\n for x1, y1, x2, y2 in lines\n @pdf.line(x1, y1, x2, y2)\n end\n end\n\n draw_special \n for x, y in Hcfa1500Constants::CHECKBOXES\n @pdf.rectangle(x, y, 10, 10).stroke#, stroke=1\n end\n \n for font, size, label in Hcfa1500Constants::LABELS\n for x, y, text in label\n @pdf.select_font font\n @pdf.add_text(x,y,text, size)\n end\n end\n end\n\n carrier_address = ''\n if (@patient.carrier_address and @patient.carrier_city and @patient.carrier_state and @patient.carrier_zipcode)\n carrier_address += @patient.carrier_apt_suite + \" \" if @patient.carrier_apt_suite\n carrier_address += @patient.carrier_address_line1.to_s + \" , \" if @patient.carrier_address_line1 \n carrier_address += @patient.carrier_address + \", \" + @patient.carrier_city + \", \" + @patient.carrier_state + \" \" + @patient.carrier_zipcode\n assign_carrier(@patient.car_name,@patient.carrier_pobox,carrier_address)\n end\n\n @pdf.select_font \"Courier\"\n populate_hcfa\n send_data @pdf.render,\n :filename => @patient.first_name + \"_\" + @patient.last_name + \"-\" + @visit.treated_at.strftime(\"%Y%m%d\") + \".pdf\",\n :type => \"application/pdf\"\n end",
"def generate\n add_intro\n add_blood_pressure_intro\n add_blood_pressure_list\n add_blood_pressure_outro\n add_medications_intro\n add_medications_list\n add_about\n\n @pdf\n end",
"def add_page_footer\n @pdf.repeat :all do\n @pdf.bounding_box([0, @pdf.bounds.bottom], width: 540, height: @format[:footer_size]) do\n @pdf.move_down 50\n @pdf.stroke_color '999999'\n @pdf.stroke_horizontal_rule\n @pdf.move_down 10\n @pdf.font_size(8) do\n @pdf.text \"<color rgb='999999'>#{t('footer.author', platform_name: MnoEnterprise.app_name)}</color>\", inline_format: true\n @pdf.text \"<color rgb='999999'>#{t('footer.charges', currency_name: @data[:invoice_currency_name], currency: @data[:invoice_currency])}</color>\", inline_format: true\n @pdf.text \" \", inline_format: true\n @pdf.text \"<color rgb='999999'>#{t('footer.address')}</color>\", inline_format: true\n end\n end\n end\n end",
"def endPage()\n @device.endPage() ;\n end",
"def process_pdf\n\t\tif before_generate_pdf.blank?\n\t\t\tself.ready_for_pdf_generation = nil\n\t\telse\n\t\t\tself.ready_for_pdf_generation = Time.now.to_i \n\t\tend\n\tend",
"def pdf1\n \n \n @company =Company.find(1)\n @cabecera =\"Facturacion\"\n @abajo =\"Viatico\"\n \n @cout = Cout.find(params[:id])\n \n Prawn::Document.generate(\"app/pdf_output/#{@cout.id}.pdf\" ,:page_size => \"A4\",:margin=> 2 ) do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_1(pdf)\n pdf = build_pdf_body_1(pdf)\n build_pdf_footer_1(pdf)\n @lcFileName = \"app/pdf_output/#{@cout.id}.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+@lcFileName\n #send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n send_file(@lcFileName, :type => 'application/pdf', :disposition => 'inline')\n end",
"def end\n end",
"def pdf\n @viatico = Viatico.find(params[:id])\n company =@viatico.company_id\n @company =Company.find(company)\n \n \n $lcFecha1= @viatico.fecha1.strftime(\"%d/%m/%Y\") \n $lcMon = @viatico.get_moneda(1)\n $lcPay= \"\"\n $lcSubtotal=0\n $lcIgv=0\n $lcTotal=sprintf(\"%.2f\",@viatico.inicial)\n\n $lcDetracion=0\n $lcAprobado= @viatico.get_processed \n\n\n $lcEntrega5 = \"FECHA :\"\n $lcEntrega6 = $lcFecha1\n\n Prawn::Document.generate(\"app/pdf_output/#{@viatico.id}.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header(pdf)\n pdf = build_pdf_body_2(pdf)\n build_pdf_footer(pdf)\n $lcFileName = \"app/pdf_output/#{@viatico.id}.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName\n \n send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n\n\n end",
"def paragraph_end; end",
"def end; end",
"def end; end",
"def end; end",
"def end_document\n # postprocess @text to remove trailing spaces on lines\n @text = @text.split(\"\\n\").map(&:strip).join(\"\\n\")\n # remove trailing whitespace at end of buffer\n @text.strip!\n end",
"def end\n end",
"def pdf\n \n \n @company =Company.find(1)\n @cabecera =\"Facturacion\"\n @abajo =\"Viatico\"\n \n @cout = Cout.find(params[:id])\n \n Prawn::Document.generate(\"app/pdf_output/#{@cout.id}.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header(pdf)\n pdf = build_pdf_body(pdf)\n build_pdf_footer(pdf)\n @lcFileName = \"app/pdf_output/#{@cout.id}.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+@lcFileName\n #send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n send_file(@lcFileName, :type => 'application/pdf', :disposition => 'inline')\n end",
"def show\n respond_to do |format|\n format.html\n format.pdf do\n receipt_pdf = Prawn::Document.new(:background => \"app/assets/images/saffron.png\", page_layout: :landscape)\n receipt_pdf.text \"BHARTIYA JANTA PARTY\", align: :center, :size => 25, style: :bold\n receipt_pdf.text \"Central Office\", align: :center, :size => 14, style: :italic\n receipt_pdf.text \"11 Ashok Road, New Delhi-110001 \", align: :center, :size => 14\n receipt_pdf.image Rails.root.join(\"app/assets/images/bjp.png\"), :at => [20,550], :width => 50\n receipt_pdf.move_down 30\n receipt_pdf.text \"No: #{@post.title}\", style: :bold\n receipt_pdf.text \"Date...............\", align: :right, :top_margin => 100\n receipt_pdf.move_down 5\n receipt_pdf.text \"Received with thanks from Sh/Smt/M/s..........................................................................................................................................................\"\n receipt_pdf.move_down 15\n receipt_pdf.text \"Address..........................................................................................................................................................................................................\"\n receipt_pdf.move_down 15\n receipt_pdf.text \"Rs...................................................................................................................................................................................................................\"\n receipt_pdf.move_down 15\n receipt_pdf.text \"vide cash/cheque no.....................................................dt................................................drawn on...........................................as donation.\"\n receipt_pdf.move_down 20\n receipt_pdf.text \"Rs................................\", :size => 25, style: :bold\n receipt_pdf.text \"For Treasurer\", align: :right\n receipt_pdf.move_down 30\n receipt_pdf.text \"Donation to the Party are exempt from Income Tax u/s 80GGB for Companies and u/s 80 GGC for Others as per Income Tax Act, 1961\", style: :bold, :size => 13\n receipt_pdf.move_down 10\n receipt_pdf.text \"PAN No.: AAABB015F\", :size => 10, style: :bold\n receipt_pdf.text \"Regn. No.: 56/R/1/89/Dt. 19 sept 1989\", :size => 8, style: :bold, align: :right\n send_data receipt_pdf.render, filename: \"show.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end",
"def footer\n end",
"def add_page_body\n payment_enabled = Settings.dashboard.payment.enabled\n\n @pdf.stroke_color '999999'\n\n #===============================\n # Invoice Reference\n #===============================\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"F0F0F0\"\n @pdf.fill_rounded_rectangle [310,@pdf.cursor], 230, 50, 5\n @pdf.fill_color = original_color\n\n @pdf.text_box t(:your_reference), at: [310,@pdf.cursor], width: 65, height: 13, align: :center, valign: :center,\n style: :bold_italic, size: 7\n\n @pdf.text_box @data[:invoice_reference], at: [310,@pdf.cursor], width: 230, height: 50, align: :center, valign: :center,\n style: :bold\n end\n\n #===============================\n # Customer information\n #===============================\n @pdf.text @data[:customer_name], align: :left, inline_format: true\n\n if @data[:customer_email]\n @pdf.text \"<color rgb='999999'>#{@data[:customer_email]}</color>\", align: :left, inline_format: true\n end\n\n if @data[:customer_billing_address]\n @pdf.move_down 5\n @pdf.text \"<color rgb='999999'>#{@data[:customer_billing_address]}</color>\", align: :left, inline_format: true, style: :italic, size: 9\n end\n\n #===============================\n # Disclaimer\n #===============================\n @pdf.move_down 55\n @pdf.text t('customer_invoice_disclaimer'), color: 'a94442'\n\n #===============================\n # Summary\n #===============================\n @pdf.move_down 15\n @pdf.font_size(20) { @pdf.text t('summary'), style: :bold }\n @pdf.stroke_horizontal_rule\n @pdf.move_down 10\n\n summary_data_amount = @data[:invoice_price]\n summary_data_amount = @data[:invoice_total_payable_with_tax] if payment_enabled\n\n summary_data = []\n summary_data << [t('invoice_date'), t('invoice_due_date'), t('total_payable') + (@data[:invoice_tax_pips] >= 0 ? \"\\n<font size='8'><i>(#{t('including_tax')})</i></font>\" : '')]\n summary_data << [@data[:period_ended_at].strftime(\"%B %e, %Y\"), @data[:period_charge_date].strftime(\"%B %e, %Y\"), money(summary_data_amount)]\n\n # Draw Table background\n bg_height = @data[:invoice_tax_pips] >= 0 ? 58 : 50\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"d1e17c\"\n @pdf.fill_rounded_rectangle [0,@pdf.cursor], 540, bg_height, 5\n @pdf.fill_color = original_color\n end\n\n # Draw Table\n @pdf.table(summary_data) do |t|\n t.header = true\n t.width = 540\n # t.column_widths = [435,105]\n t.column_widths = [215,215,110]\n t.cell_style = { borders: [] }\n t.row(0).font_style = :bold\n\n t.cell_style = { padding: [5, 5, 5, 10], inline_format: true }\n t.cells.style do |c|\n if c.column == 2\n c.align = :center\n elsif c.column == 1\n c.align = :left\n end\n end\n end\n\n @pdf.move_down 10\n @pdf.indent(5) do\n @pdf.font_size(8) do\n @pdf.text \"<color rgb='999999'> #{t('charging_details.bank_statement', invoice_reference: @data[:invoice_reference])}</color>\", inline_format: true\n @pdf.text \"<color rgb='999999'> #{t('charging_details.currency', currency_name: @data[:invoice_currency_name], currency: @data[:invoice_currency])}</color>\", inline_format: true\n if @data[:invoice_fully_paid]\n @pdf.text \"<color rgb='999999'> #{t('charging_details.no_payments')}</color>\", inline_format: true\n else\n @pdf.text \"<color rgb='999999'> #{t('charging_details.with_payment', charge_date: @data[:period_charge_date].strftime(\"%B,%e %Y\"), platform_name: MnoEnterprise.app_name)}</color>\", inline_format: true\n end\n end\n end\n\n #===============================\n # Credit Remaining\n # ---\n # Only if greater than zero\n #===============================\n if @data[:customer_current_credit] && @data[:customer_current_credit].positive?\n @pdf.move_up 23\n\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"67BBE9\"\n @pdf.fill_rounded_rectangle [445,@pdf.cursor], 95, 50, 5\n @pdf.fill_color = original_color\n\n @pdf.text_box t('credit_remaining'), at: [445,@pdf.cursor], width: 95, height: 23, align: :center, valign: :center,\n style: :bold, size: 10\n\n @pdf.text_box money(@data[:customer_current_credit]), at: [445,@pdf.cursor], width: 95, height: 37, align: :center, valign: :bottom\n end\n\n @pdf.move_down 40\n end\n\n if payment_enabled\n #===============================\n # Account Situation\n #===============================\n @pdf.move_down 30\n @pdf.font_size(20) { @pdf.text t('account_situation'), style: :bold }\n @pdf.stroke_horizontal_rule\n @pdf.move_down 10\n\n # Situation Data\n situation_data = []\n # Header\n situation_data << [\n '',\n '',\n t('summary_section.due_last_month'),\n '',\n t('summary_section.paid'),\n '',\n t('summary_section.this_month'),\n '',\n t('summary_section.credit'),\n '',\n t('summary_section.total')\n ]\n\n #Content\n situation_data << [\n '',\n '',\n money(@data[:invoice_previous_total_due]),\n '-',\n money(@data[:invoice_previous_total_paid]),\n '+',\n money(@data[:invoice_price]),\n '-',\n money(@data[:invoice_credit_paid]),\n '=',\n money(@data[:invoice_total_payable])\n ]\n\n # Draw background\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"F0F0F0\"\n @pdf.fill_rounded_rectangle [0,@pdf.cursor], 540, 50, 5\n @pdf.fill_color = original_color\n end\n\n # Draw left background\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"E0E0E0\"\n @pdf.fill_rounded_rectangle [0,@pdf.cursor], 80, 50, 5\n @pdf.fill_color = original_color\n @pdf.move_down 21\n if @data[:invoice_tax_pips] >= 0\n @pdf.text_box t('excluding_tax'), at: [12,@pdf.cursor]\n else\n @pdf.text_box t('details'), at: [20,@pdf.cursor]\n end\n end\n\n # Draw table\n @pdf.table(situation_data) do |t|\n t.header = true\n t.width = 540\n t.column_widths = [75,18,75,18,75,18,75,18,75,18,75]\n t.row(0).font_style = :bold\n t.row(0).size = 8\n t.row(0).height = 22\n t.row(1).height = 25\n\n t.cell_style = {\n borders: [],\n overflow: :shrink_to_fit,\n align: :center\n }\n\n # Color the '+','-' and '=' characters\n t.cells.style do |c|\n if c.row == 1 && c.column.odd?\n c.text_color = \"a8a8a8\"\n end\n end\n end\n\n #=================================\n # Account Situation - Tax Section\n #=================================\n if @data[:invoice_tax_pips] >= 0\n\n #-----------------\n # Tax row\n #-----------------\n @pdf.move_down 8\n\n table_data = []\n table_data << [\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n t('tax'),\n '+',\n money(@data[:invoice_tax_payable]),\n ]\n\n # Draw table background\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"F0F0F0\"\n @pdf.fill_rounded_rectangle [368,@pdf.cursor], 172, 24, 5\n @pdf.fill_color = original_color\n end\n\n # Draw left background\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"FAB451\"\n @pdf.fill_rounded_rectangle [368,@pdf.cursor], 80, 24, 5\n @pdf.fill_color = original_color\n end\n\n @pdf.table(table_data) do |t|\n t.header = true\n t.width = 540\n t.column_widths = [75,18,75,18,75,18,75,18,75,18,75]\n t.row(0).height = 25\n\n t.cell_style = {\n borders: [],\n overflow: :shrink_to_fit,\n align: :center\n }\n\n # Color the '+','-' and '=' characters\n t.cells.style do |c|\n if c.row == 0 && c.column.odd?\n c.text_color = \"a8a8a8\"\n end\n end\n end\n\n #-----------------\n # Total (incl. Tax)\n #-----------------\n @pdf.move_down 5\n\n table_data = []\n table_data << [\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n t('total_including_tax'),\n '=',\n money(@data[:invoice_total_payable_with_tax]),\n ]\n\n # Draw table background\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"F0F0F0\"\n @pdf.fill_rounded_rectangle [368,@pdf.cursor], 172, 24, 5\n @pdf.fill_color = original_color\n end\n\n # Draw left background\n @pdf.float do\n original_color = @pdf.fill_color\n @pdf.fill_color \"DAE173\"\n @pdf.fill_rounded_rectangle [368,@pdf.cursor], 80, 24, 5\n @pdf.fill_color = original_color\n end\n\n @pdf.table(table_data) do |t|\n t.header = true\n t.width = 540\n t.row(0).font_style = :bold\n t.column_widths = [75,18,75,18,75,18,75,18,75,18,75]\n t.row(0).height = 25\n\n t.cell_style = {\n borders: [],\n overflow: :shrink_to_fit,\n align: :center\n }\n\n # Color the '+','-' and '=' characters\n t.cells.style do |c|\n if c.row == 0 && c.column.odd?\n c.text_color = \"a8a8a8\"\n end\n end\n end\n end\n end\n\n #===============================\n # Details\n #===============================\n @pdf.start_new_page\n @pdf.font_size(20) { @pdf.text t('details'), style: :bold }\n @pdf.stroke_horizontal_rule\n @pdf.move_down 10\n\n app_details_data = []\n app_details_data << [\n t('details_section.product'),\n t('details_section.type'),\n t('details_section.usage'),\n t('details_section.price') + (@data[:invoice_tax_pips] >= 0 ? \"\\n<font size='8'><i>(#{t('excluding_tax')})</i></font>\" : '')\n ]\n app_details_data += @data[:billing_report]\n\n @pdf.table(app_details_data) do |t|\n t.header = true\n t.width = 540\n t.row_colors = [\"FFFFFF\", \"F0F0F0\"]\n t.column_widths = [240,100,100,100]\n t.cell_style = { borders: [:bottom],\n border_width: 1,\n border_color: \"999999\",\n inline_format: true\n }\n t.row(0).borders = [:bottom]\n t.row(0).border_width = 2\n t.row(0).font_style = :bold\n end\n\n #===============================\n # Payment Information\n #===============================\n if payment_information = Settings.dashboard&.organization_management&.billing&.invoice_payment_information.presence\n @pdf.start_new_page\n @pdf.font_size(20) { @pdf.text t('payment_information'), style: :bold }\n @pdf.stroke_horizontal_rule\n @pdf.move_down 10\n @pdf.font_size(10) { @pdf.text payment_information }\n end\n end",
"def rpt_facturas_all2_pdf\n\n $lcFacturasall = '0'\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n @cliente = params[:customer_id] \n\n @facturas_rpt = @company.get_facturas_day_cliente(@fecha1,@fecha2,@cliente) \n\n\n Prawn::Document.generate(\"app/pdf_output/rpt_factura.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_rpt(pdf)\n pdf = build_pdf_body_rpt(pdf)\n build_pdf_footer_rpt(pdf)\n $lcFileName = \"app/pdf_output/rpt_factura_all.pdf\" \n end \n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/rpt_factura.pdf\", :type => 'application/pdf', :disposition => 'inline')\n end",
"def end() end",
"def doctype_end\n end",
"def draw_final_page(cc)\n draw_page cc\n cc.target.finish\n end",
"def at_end; end",
"def rpt_stocks2\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n @categoria =params[:products_category_id]\n @estado = params[:estado]\n \n @namecategoria= @company.get_categoria_name(@categoria) \n @movements = @company.get_stocks_inventarios2(@fecha1,@fecha2,@categoria,@estado) \n \n Prawn::Document.generate(\"app/pdf_output/stocks2.pdf\") do |pdf| \n pdf.font_families.update(\"Open Sans\" => {\n :normal => \"app/assets/fonts/OpenSans-Regular.ttf\",\n :italic => \"app/assets/fonts/OpenSans-Italic.ttf\",\n })\n\n pdf.font \"Open Sans\",:size =>6\n pdf = build_pdf_header2(pdf)\n pdf = build_pdf_body2(pdf)\n build_pdf_footer2(pdf)\n $lcFileName = \"app/pdf_output/stocks2.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/stocks2.pdf\", :type => 'application/pdf', :disposition => 'inline')\n MovementDetail.delete_all \n end",
"def generate_pdf\n\t\t\t\n\n\t\tfile_name = get_file_name\n\t\tfile_name = \"test\"\n\t \n\t ac = ActionController::Base.new\n\t \n\t pdf = ac.render_to_string pdf: file_name,\n template: \"#{ Auth::OmniAuth::Path.pathify(self.class.name).pluralize}/pdf/show.pdf.erb\",\n locals: {:object => self},\n layout: \"pdf/application.html.erb\",\n quiet: true,\n header: {\n \thtml: {\n \t\ttemplate:'/layouts/pdf/header.html.erb',\n \t\tlayout: '/layouts/pdf/empty_layout.html.erb',\n \t\tlocals: {:object => self}\n \t}\n },\n footer: {\n \t\thtml: { \n \t\t\ttemplate:'/layouts/pdf/footer.html.erb',\n \t\t\tlayout: '/layouts/pdf/empty_layout.html.erb',\n \t\tlocals: {:object => self}\n }\n } \n\n save_path = Rails.root.join('public',\"#{file_name}.pdf\")\n\t\tFile.open(save_path, 'wb') do |file|\n\t\t file << pdf\n\t\tend\n\n\t Tempfile.open(file_name) do |f| \n\t\t f.binmode\n\t\t f.write pdf\n\t\t f.close \n\t\t #IO.write(\"#{Rails.root.join(\"public\",\"test.pdf\")}\",pdf)\n\t\t response = Cloudinary::Uploader.upload(File.open(f.path), :public_id => file_name, :upload_preset => \"report_pdf_files\")\n\t\t puts \"response is-------------------------------------------------------------->: #{response}\"\n\t\t self.latest_version = response['version'].to_s\n\t\t self.pdf_url = response[\"url\"]\n\t\tend\n\n\t\tself.skip_pdf_generation = true\n\t\t\n\t\t#self.save\t\t\n\t\tafter_generate_pdf\n\n\tend",
"def build_footer\n pad(10) do\n pdf_writer.y = pdf_writer.absolute_bottom_margin + 10\n add_text \"Copyright 2010 - Sand Bridge Software\", :font_size => 8\n end\n end",
"def build_footer\n pad(10) do\n pdf_writer.y = pdf_writer.absolute_bottom_margin + 10\n add_text \"Copyright 2010 - Sand Bridge Software\", :font_size => 8\n end\n end",
"def build_footer\n pad(10) do\n pdf_writer.y = pdf_writer.absolute_bottom_margin + 10\n add_text \"Copyright 2010 - Sand Bridge Software\", :font_size => 8\n end\n end",
"def pdfout(content, file: 'output.pdf', width: 7, height: 7)\n \"\"\"\n pdf('#{file}', width=#{width}, height=#{height})\n #{content}\n dev.off()\n \"\"\"\nend",
"def create\n @statement = Statement.new(statement_params)\n @test = @statement.test.id\n\n path_to_file = \"#{Rails.root}/app/assets/images/cert#{@statement.id}.pdf\"\n\n pdf = CombinePDF.load \"#{@statement.test.certificate.path}\" \n\n if !pdf.pages.empty?\n\n #a = \"Привет\".encode(\"UTF-8\")\n\n # create a textbox and add it to the existing pdf on page 2 #{@statement.fio} #{@statement.position} \n pdf.pages[0].textbox @statement.position, height: 60, width: 450, y: 400, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 16\n pdf.pages[0].textbox @statement.place, height: 60, width: 450, y: 380, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 16\n #Суспеснкого районе г . Казани ниже\n pdf.pages[0].textbox @statement.phone, height: 60, width: 450, y: 360, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 16\n pdf.pages[0].textbox @statement.name, height: 60, width: 450, y: 320, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 35\n pdf.pages[0].textbox @statement.fio, height: 60, width: 450, y: 280, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 35\n # output the new pdf which now contains your dynamic data\n pdf.save path_to_file\n File.open(path_to_file) do |f|\n @statement.certificate = f\n end\n File.delete(path_to_file) if File.exist?(path_to_file)\n end\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to root_path, notice: 'Statement was successfully created.' }\n else\n format.html { render :new}\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ending\n if File.exist?('CREDITS.md')\n @io.puts IO.read('CREDITS.md')\n @io.puts\n end\n\n if File.exist?('AUTHORS.md')\n @io.puts IO.read('AUTHORS.md')\n @io.puts\n end\n\n if File.exist?('LICENSE.md')\n @io.puts IO.read('LICENSE.md')\n @io.puts\n end\n @io.puts\n @io.puts \"Documentation generated #{Time.now.strftime('%Y-%m-%d %H:%M')}\"\n @io.puts\n @io.close\n end",
"def end\n end",
"def end\n end",
"def to_pdf_data; end",
"def fee_reciepts_export_pdf\n parameters={:search => params[:search] ,:filename => filename, :controller_name => controller_name, :action_name => action_name}\n opts = {\n :margin => {:left => 10, :right => 10, :bottom => 5}, \n :template=>\"delayed_pdfs/fee_reciepts/fee_reciepts_export_pdf.html\",\n :layout => \"layouts/pdf.html\"\n } \n GenerateReportPdf.export_pdf('finance_transaction','fee_reciepts_export_to_pdf', parameters, opts)\n flash[:notice]=\"#{t('pdf_report_is_in_queue')}\"\n redirect_to :controller => :report, :action=>:pdf_reports,:model=>'finance_transaction',:method=>'fee_reciepts_export_to_pdf'\n end",
"def printout\n raise WedgieError, \"can't print #{content_type}\" unless content_type == 'text/x-clinical'\n pdf = FPDF.new('P','mm','A4')\n pdf.SetFont('Arial','',10)\n clinical_objects.each do |obj|\n pdf.AddPage\n obj.gen_pdf(pdf)\n end\n return pdf\n end",
"def output_pdf\n siz = @report.size.to_i\n if siz < 500 || Dialog.confirm(\"Cela demandera environ #{siz / 250} secondes\")\n path = ask_path('.pdf')\n path ? build_and_save_pdf(path) : 'Annulé'\n else\n 'Annulé'\n end\n rescue\n pdf_error\n end",
"def after_generate_pdf\n\t\tsend_notifications\n\tend",
"def after_generate_pdf\n\t\tsend_notifications\n\tend",
"def rebuild_pdf\n page_paths = (1..document.page_count).map {|i| \"#{document.slug}_#{i}.pdf\" }\n #`pdftk #{page_paths.join(' ')} cat output #{@pdf}`\n `pdftailor stitch --output #{@pdf} #{page_paths.join(' ')} 2>&1`\n\n if File.exists? @pdf\n asset_store.save_pdf(document, @pdf, access)\n File.open( @pdf,'r') do | fh |\n document.update_file_metadata( fh.read )\n end\n end\n end",
"def write_footer\n @openfile.write(\"\\n</Document>\\n</kml>\")\n end",
"def end_section\n end",
"def endpage\n respond_to do |format|\n format.html { render :endpage }\n end\n end",
"def index\n @salaries = Salary.order('period_id asc')\n @title = 'Rincian Daftar Gaji Dosen'\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: 'Rincian Daftar Gaji Dosen',\n template: 'salaries/index.pdf.erb',\n layout: 'pdf.html.erb'\n # render :pdf => 'Kurikulum Teknik Elektro', :layout => 'Kurikulum Teknik Elektro.html'\n end\n end\n end",
"def page_de_garde\n h = @pdf.bounds.top * 0.6\n @pdf.bounding_box([0, h], :width => @pdf.bounds.right, :height => 100) do \n \n @pdf.font_size(30) { @pdf.text @organism_name.capitalize, :align=>:center }\n @pdf.font_size(18) { @pdf.text 'Grand livre', :align=>:center }\n @pdf.text \"Du compte #{from_account.number} au compte #{to_account.number}\", align: :center\n @pdf.text \"Du #{I18n::l from_date} au #{I18n::l to_date}\", align: :center\n end\n h = @pdf.bounds.top * 0.1\n @pdf.bounding_box [0, h], :width => @pdf.bounds.right, :height => 100 do\n @pdf.text \"Note : Les comptes sans reports ni mouvements sur la période ne sont pas repris\",\n style: :italic\n end\n end",
"def generate_print_pdf\n marks = self.mark_hash\n extra_marks = self.extra_marks\n total_mark = self.get_total_mark\n overall_comment = self.overall_comment\n submission = self.submission\n grouping = submission.grouping\n assignment = grouping.assignment\n\n # Make folder for temporary files\n workdir = \"tmp/print/#{self.id}\"\n FileUtils.mkdir_p(workdir)\n\n # Constants used for PDF generation\n logo_width = 80\n line_space = 12\n annotation_size = 20\n\n # Generate front page\n Prawn::Document.generate(\"#{workdir}/front.pdf\") do\n # Add MarkUs logo\n image Rails.root.join('app/assets/images/markus_logo_big.png'),\n at: [bounds.width - logo_width, bounds.height],\n width: logo_width\n\n font_families.update(\n 'Open Sans' => {\n normal: Rails.root.join('vendor/assets/stylesheets/fonts/OpenSansEmoji.ttf'),\n bold: Rails.root.join('vendor/assets/stylesheets/fonts/OpenSans-Bold.ttf')\n }\n )\n font 'Open Sans'\n\n # Title\n formatted_text [{\n text: \"#{assignment.short_identifier}: #{assignment.description}\", size: 20, styles: [:bold]\n }]\n move_down line_space\n\n # Group members\n grouping.accepted_students.includes(:user).find_each do |student|\n text \"#{student.user_name} - #{student.first_name} #{student.last_name}\"\n end\n move_down line_space\n\n # Marks\n assignment.ta_criteria.order(:position).find_each do |criterion|\n mark = marks.dig(criterion.id, :mark)\n if criterion.is_a? RubricCriterion\n formatted_text [{ text: \"#{criterion.name}:\", styles: [:bold] }]\n indent(10) do\n criterion.levels.order(:mark).find_each do |level|\n styles = level.mark == mark ? [:bold] : [:normal]\n formatted_text [{\n text: \"• #{level.mark} / #{criterion.max_mark} #{level.name}: #{level.description}\",\n styles: styles\n }]\n end\n end\n else\n formatted_text [{\n text: \"#{criterion.name}: #{mark || '-'} / #{criterion.max_mark}\",\n styles: [:bold]\n }]\n text criterion.description if criterion.description.present?\n end\n end\n\n extra_marks.each do |extra_mark|\n text \"#{extra_mark.description}: #{extra_mark.extra_mark}#{extra_mark.unit == 'percentage' ? '%' : ''}\"\n end\n move_down line_space\n\n formatted_text [{ text: \"#{I18n.t('results.total_mark')}: #{total_mark} / #{assignment.max_mark}\",\n styles: [:bold] }]\n move_down line_space\n\n # Annotations and overall comments\n formatted_text [{ text: Annotation.model_name.human.pluralize, styles: [:bold] }]\n submission.annotations.order(:annotation_number).includes(:annotation_text).each do |annotation|\n text \"#{annotation.annotation_number}. #{annotation.annotation_text.content}\"\n end\n move_down line_space\n\n formatted_text [{ text: Result.human_attribute_name(:overall_comment), styles: [:bold] }]\n if overall_comment.present?\n text overall_comment\n else\n text I18n.t(:not_applicable)\n end\n end\n\n # Copy all PDF submission files to workspace\n input_files = submission.submission_files.where(\"filename LIKE '%.pdf'\").order(:path, :filename)\n grouping.access_repo do |repo|\n input_files.each do |sf|\n contents = sf.retrieve_file(repo: repo)\n FileUtils.mkdir_p(File.join(workdir, sf.path))\n f = File.open(File.join(workdir, sf.path, sf.filename), 'wb')\n f.write(contents)\n f.close\n end\n end\n\n combined_pdf = CombinePDF.new\n # Simultaneouly do two things:\n # 1. Generate combined_pdf, a concatenation of all PDF submission files\n # 2. Generate annotations.pdf, a PDF containing only markers for annotations.\n # These will be overlaid onto combined_pdf.\n Prawn::Document.generate(\"#{workdir}/annotations.pdf\", skip_page_creation: true) do\n total_num_pages = 0\n input_files.each do |input_file|\n # Process the submission file\n input_pdf = CombinePDF.load(File.join(workdir, input_file.path, input_file.filename))\n combined_pdf << input_pdf\n\n num_pages = input_pdf.pages.size\n num_pages.times do\n start_new_page\n end\n\n # Create markers for the annotations.\n # TODO: remove where clause after investigating how PDF annotations might have a nil page attribute\n input_file.annotations.where.not(page: nil).order(:annotation_number).each do |annotation|\n go_to_page(total_num_pages + annotation.page)\n width, height = bounds.width, bounds.height\n x1, y1 = annotation.x1 / 1.0e5 * width, annotation.y1 / 1.0e5 * height\n\n float do\n transparent(0.5) do\n fill_color 'AAAAAA'\n fill_rectangle([x1, height - y1], annotation_size, annotation_size)\n end\n\n bounding_box([x1, height - y1], width: annotation_size, height: annotation_size) do\n move_down 5\n text annotation.annotation_number.to_s, color: '000000', align: :center\n end\n end\n end\n\n total_num_pages += num_pages\n end\n end\n\n # Combine annotations and submission files\n annotations_pdf = CombinePDF.load(\"#{workdir}/annotations.pdf\")\n combined_pdf.pages.zip(annotations_pdf.pages) do |combined_page, annotation_page|\n combined_page.fix_rotation # Fix rotation metadata, useful for scanned pages\n combined_page << annotation_page\n end\n\n # Finally, insert cover page at the front\n combined_pdf >> CombinePDF.load(\"#{workdir}/front.pdf\")\n\n # Delete old files\n FileUtils.rm_rf(workdir)\n combined_pdf\n end",
"def pdftk; end",
"def rpt_product_all\n @company=Company.find(params[:company_id]) \n @products = @company.get_products2\n \n Prawn::Document.generate(\"app/pdf_output/stocks1.pdf\") do |pdf| \n\n pdf.font_families.update(\"Open Sans\" => {\n :normal => \"app/assets/fonts/OpenSans-Regular.ttf\",\n :italic => \"app/assets/fonts/OpenSans-Italic.ttf\",\n })\n\n pdf.font \"Open Sans\",:size =>6\n \n pdf = build_pdf_header(pdf)\n pdf = build_pdf_body(pdf)\n build_pdf_footer(pdf)\n $lcFileName = \"app/pdf_output/stocks1.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName\n #send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n send_file(\"app/pdf_output/stocks1.pdf\", :type => 'application/pdf', :disposition => 'inline')\n end",
"def dump_pdf(start_state)\n puts \"parsed script:\\n\\n#{start_state.describe_state_machine}\"\n start_state.generate_pdf(\"_SKIP_parseScript#{@@counter}.pdf\")\n @@counter+=1\n end",
"def rpt_ccobrar4_pdf\n $lcxCliente =\"0\"\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n @facturas_rpt = @company.get_pendientes_day(@fecha1,@fecha2) \n \n Prawn::Document.generate(\"app/pdf_output/rpt_pendientes4.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_rpt4(pdf)\n pdf = build_pdf_body_rpt4(pdf)\n build_pdf_footer_rpt4(pdf)\n $lcFileName = \"app/pdf_output/rpt_pendientes4.pdf\" \n end \n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/rpt_pendientes4.pdf\", :type => 'application/pdf', :disposition => 'inline')\n \n end",
"def generate_pdf\n\t\t\n\t\tfile_name = get_pdf_file_name\n\n\t\tac = ActionController::Base.new\n\n\t\tpdf = ac.render_to_string pdf: file_name,\n\t template: \"#{ Auth::OmniAuth::Path.pathify(self.class.name).pluralize}/pdf/show.pdf.erb\",\n\t locals: {:receipt => self, :organization => self.payable_to_organization},\n\t layout: \"pdf/application.html.erb\",\n \tquiet: true,\n\t header: {\n\t \thtml: {\n\t \t\ttemplate:'/layouts/pdf/receipt_header.pdf.erb',\n\t \t\tlayout: \"pdf/application.html.erb\",\n\t \t\tlocals: {:receipt => self, :organization => self.payable_to_organization}\n\t \t}\n\t },\n\t footer: {\n\t \t\thtml: { \n\t \t\t\ttemplate:'/layouts/pdf/receipt_footer.pdf.erb',\n\t \t\t\tlayout: \"pdf/application.html.erb\",\n\t \t\tlocals: {:receipt => self, :organization => self.payable_to_organization}\n\t }\n\t } \n\n #save_path = Rails.root.join('public',\"#{file_name}.pdf\")\n\t\t#File.open(save_path, 'wb') do |file|\n\t\t# file << pdf\n\t\t# self.pdf_urls = [save_path]\n\t\t# self.pdf_url = save_path\n\t\t#end\n\t\tTempfile.open(file_name) do |f| \n\t\t f.binmode\n\t\t f.write pdf\n\t\t f.close \n\t\t #IO.write(\"#{Rails.root.join(\"public\",\"test.pdf\")}\",pdf)\n\t\t response = Cloudinary::Uploader.upload(File.open(f.path), :public_id => file_name, :upload_preset => \"report_pdf_files\")\n\t\t puts \"response is: #{response}\"\n\t\t self.latest_version = response['version'].to_s\n\t\t self.pdf_url = response[\"secure_url\"]\n\t\tend\n\t\tself.skip_pdf_generation = true\n\t\t\n\t\tafter_generate_pdf\n\n\tend",
"def export\n pdftk.fill_form PdfFormController::PDF_PATH, PdfFormController::OUTPUT_PATH, attributes\n end",
"def download_pdf\n pdf_type = 'Return'\n return_pdf(pdf_type)\n end",
"def end_of_chapter\n end",
"def finish\n if @write_options then\n write_options\n exit\n end\n\n @op_dir ||= 'doc'\n\n @rdoc_include << \".\" if @rdoc_include.empty?\n root = @root.to_s\n @rdoc_include << root unless @rdoc_include.include?(root)\n\n @exclude = self.exclude\n\n finish_page_dir\n\n check_files\n\n # If no template was specified, use the default template for the output\n # formatter\n\n unless @template then\n @template = @generator_name\n @template_dir = template_dir_for @template\n end\n\n if @locale_name\n @locale = RDoc::I18n::Locale[@locale_name]\n @locale.load(@locale_dir)\n else\n @locale = nil\n end\n\n self\n end",
"def rpt_purchase2_all\n \n @company =Company.find(1)\n @fecha1 =params[:fecha1]\n @fecha2 =params[:fecha2]\n @tiporeporte =params[:tiporeporte]\n \n supplier_select = params[:cbox1]\n proveedor = params[:supplier_id]\n \n \n if supplier_select == \"1\"\n @rpt_detalle_purchase = @company.get_purchases_day_tipo(@fecha1,@fecha2,@tiporeporte) \n else\n @rpt_detalle_purchase = @company.get_purchases_day_tipo2(@fecha1,@fecha2,@tiporeporte,proveedor) \n end \n \n Prawn::Document.generate \"app/pdf_output/orden_1.pdf\" , :page_layout => :landscape do |pdf| \n \n pdf.font \"Helvetica\"\n pdf = build_pdf_header9(pdf)\n pdf = build_pdf_body9(pdf)\n build_pdf_footer9(pdf)\n $lcFileName = \"app/pdf_output/orden_1.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName\n \n send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n \n\n end",
"def generate_pdf!\n PDFGenerator.generate_invoice(self, pdf_template, pdf_template_locals)\n self.generated = true\n save\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n\n end",
"def render\n generate_content\n @pdf.render\n end",
"def destroy\n @pdf.pdf.purge\n @pdf.jpegs.purge\n @pdf.destroy\n redirect_to pdfs_url, notice: (t '.notice')\n end",
"def pdf_job\n\t\tunless self.ready_for_pdf_generation.blank?\n\t\t\tgenerate_pdf\n\t\t\tself.ready_for_pdf_generation = nil\n\t\t\tself.save(validate: false)\n\t\tend\n\tend",
"def finalize\n end",
"def render\n @pdf.render\n end",
"def find_page_end\n \n end",
"def pdf_list_benefits_nnw1\n @insurance = load_insurance\n @rotation = @insurance.rotations.last\n\n respond_to do |format|\n format.pdf do\n pdf = ListBenefitsNNW1Pdf.new(@rotation, view_context)\n send_data pdf.render,\n filename: \"#{@insurance.number}_list_benefits_nnw1.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\" \n end\n end \n end",
"def notify_end_document\n @state = :end_document\n notify(:end_document)\n end",
"def footer\n \n @renderer.footer()\n \n end",
"def generate_pdf\n\n @company_info = CompanyInfo.first\n @so_header = self.so_header\n content= product1= product2= product_description =''\n in_contact_title = in_contact_address1 = in_contact_address2 = in_contact_state = in_contact_czip = ''\n ship_contact_title = ship_contact_address1 = ship_contact_address2 = ship_contact_state = ship_contact_czip = ''\n\n if self.so_header.present?\n so = CommonActions.address(self.so_header)\n in_contact_title = '<span>'+so['b_c_title'].to_s+'</span>'\n in_contact_address1 = so['b_c_address_1'].to_s+' '\n in_contact_address2 = so['b_c_address_2'].to_s+' '\n in_contact_state = so['b_c_state'].to_s+' '\n so['b_c_country']= so['b_c_country'].present? ? so['b_c_country'] : ''\n so['b_c_zipcode']= so['b_c_zipcode'].present? ? so['b_c_zipcode'] : ''\n in_contact_czip = so['b_c_country'].to_s+' '+so['b_c_zipcode']\n ship_contact_title = '<span>'+so['s_c_title'].to_s+'</span>'\n ship_contact_address1 = so['s_c_address_1'].to_s+' '\n ship_contact_address2 = so['s_c_address_2'].to_s+' '\n ship_contact_state = so['s_c_state'].to_s+' '\n so['s_c_country']= so['s_c_country'].present? ? so['s_c_country'] : ''\n so['s_c_zipcode']= so['s_c_zipcode'].present? ? so['s_c_zipcode'] : ''\n ship_contact_czip = so['s_c_country'].to_s+' '+so['s_c_zipcode']\n end\n\n i = 1\n j = 1\n flag = 1\n flag2 = 1\n sub_total = 0.0\n\n s_sub_total = 0.0\n len = self.so_shipments.includes(:so_line, :receivable_so_shipment).length\n if len > 0\n sub_total+= self.so_shipments.includes(:so_line, :receivable_so_shipment).sum(\"so_shipped_cost\").to_f\n s_sub_total+= sub_total + self.receivable_freight.to_f\n\n self.so_shipments.includes(:so_line, :receivable_so_shipment).each_with_index do |so_shipment, index|\n if so_shipment.so_line.item_revision.present?\n product_description= '<td>'+so_shipment.so_line.item_revision.item_description+'</td>'\n end\n if so_shipment.so_line.item.item_part_no == so_shipment.so_line.item_alt_name.item_alt_identifier\n product1 = '<tr><th scope=\"row\">'+so_shipment.so_line.item.item_part_no+ '</th></tr>'\n else\n product1 = 'tr><th scope=\"row\">'+so_shipment.so_line.item.item_part_no+ '</th></tr>'\n product2 = '<tr><th scope=\"row\">'+so_shipment.so_line.item_alt_name.item_alt_identifier+'</th></tr>'\n end\n\n\n if i== 1\n content += ' <section><article class=\"ff\"><div class=\"ms_image\"><div class=\"ms_image-wrapper\"><img alt=Report_heading src=http://erp.chessgroupinc.com/'+@company_info.logo.joint.url(:original)+' /> </div><div class=\"ms_image-text\"><h3> '+@company_info.company_address1+' <br> '+@company_info.company_address2+' </h3><h5><span> P:</span> '+@company_info.company_phone1+' <br><span> F: </span> '+@company_info.company_fax\n content +=' </h5></div></div><div class=\"ms_image-2\"><h2> Invoice</h2><div class=\"ms_image-5\"><div class=\"ms_image-6\"><h4> Date</h4><h5> '+self.created_at.strftime(\"%m/%d/%Y\")+' </h5><div class=\"space\"></div><h4> Chess S.O.#</h4> <h5> '+@so_header.so_identifier+' </h5> </div><div class=\"ms_image-6 ms_image-7\"><h4> Inv No</h4><h5> '+self.receivable_identifier+' </h5><div class=\"space\"></div><h4> Customer P.O.#</h4> <h5> '+@so_header.so_header_customer_po\n content +=' </h5> </div><div class=\"clear\"></div></div></div></article>'\n if flag ==1\n content += '<article class=\"art-01\"><div class=\"ms_text-wra\"><h2></h2><div class=\"ms_text\"><h1 class=\"ms_heading\">Bill To :</h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'+in_contact_title.to_s+''+in_contact_address1.to_s+''+in_contact_address2.to_s+''+in_contact_state.to_s+''+in_contact_czip.to_s+'</h2></div></div></div><div class=\"ms_text-wra-02\"><h2></h2><div class=\"ms_text-2\"><h1 class=\"ms_heading\">Ship To : </h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'\n content += ship_contact_title.to_s+''+ship_contact_address1.to_s+''+ship_contact_address2.to_s+''+ship_contact_state.to_s+''+ship_contact_czip.to_s+'</div></div></div></article>'\n flag =0;\n end\n\n if flag2 ==1\n content += '<article class=\"art-01 art-04 \"><table width=\"640\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr align=\"center\" class=\"hea\"><td width=\"72\">ORDERED</td><td width=\"75\">SHIPPED</td><td width=\"67\">P/N</td><td width=\"224\">DESCRIPTION</td><td width=\"95\">PRICE/E</td><td width=\"107\">TOTAL</td></tr>'\n flag2=0;\n else\n content += '<article class=\"art-01 hei \"><table width=\"640\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr align=\"center\" class=\"hea\"><td width=\"72\">ORDERED</td><td width=\"75\">SHIPPED</td><td width=\"67\">P/N</td><td width=\"224\">DESCRIPTION</td><td width=\"95\">PRICE/E</td><td width=\"107\">TOTAL</td></tr>'\n end\n end\n\n content += ' <tr class=\"h-pad\" valign=\"top\" align=\"left\"><td>'+so_shipment.so_line.so_line_quantity.to_s+'</td><td> '+so_shipment.so_shipped_count.to_s+'</td><td><table width=\"100%\" border=\"0\">'+product1+''+product2+'</table></td>'+product_description+'<td> '+so_shipment.so_line.so_line_sell.to_s+'</td><td>'+so_shipment.so_shipped_cost.to_s+'</td></tr>'\n\n if i==10\n content += '</table></article>'\n content += '<article ><div class=\"footer\"><div class=\"page\"><h3>Page</h3><span>'+j.to_s+' </span></div><div class=\"original\"><table width=\"250\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><th width=\"169\" align=\"right\" scope=\"row\">SUB TOTAL :</th><td width=\"131\" align=\"right\">'+sub_total.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">FREIGHT :</th><td align=\"right\">'+self.receivable_freight.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">TOTAL :</th><td align=\"right\">'+s_sub_total.to_s+' </td></tr></table></div></div></article> </section>'\n content += ' <div style=\"page-break-after: always; \"> </div>'\n end\n\n if len == index+1 && i != 10\n # j = 1\n # j+=1\n content += '</table></article>'\n content += '<article ><div class=\"footer\"><div class=\"page\"><h3>Page</h3><span>'+j.to_s+'</span></div><div class=\"original\"><table width=\"250\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><th width=\"169\" align=\"right\" scope=\"row\">SUB TOTAL :</th><td width=\"131\" align=\"right\">'+sub_total.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">FREIGHT :</th><td align=\"right\">'+self.receivable_freight.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">TOTAL :</th><td align=\"right\">'+s_sub_total.to_s+' </td></tr></table></div></div></article> </section>'\n content += '<div style=\"page-break-after: always;\"> </div>'\n end\n\n i +=1\n\n if i==11\n j+=1\n i= 1\n content\n end\n\n end\n content\n else\n content = '<section>\n <article class=\"ff\"><div class=\"ms_image\"><div class=\"ms_image-wrapper\"><img alt=Report_heading src=http://erp.chessgroupinc.com/'+@company_info.logo.joint.url(:original)+' /> </div><div class=\"ms_image-text\"><h3> '+@company_info.company_address1+' <br> '+@company_info.company_address2+' </h3><h5><span> P:</span> '+@company_info.company_phone1+' <br><span> F: </span> '+@company_info.company_fax+' </h5></div></div><div class=\"ms_image-2\"><h2> Invoice</h2><div class=\"ms_image-5\"><div class=\"ms_image-6\"><h4> Date</h4><h5> '+self.created_at.strftime(\"%m/%d/%Y\")+' </h5><div class=\"space\"></div><h4> Chess S.O.#</h4> <h5> </h5> </div><div class=\"ms_image-6 ms_image-7\"><h4> Inv No</h4><h5> '+self.receivable_identifier+' </h5><div class=\"space\"></div><h4> Customer P.O.#</h4> <h5> </h5> </div><div class=\"clear\"></div></div></div></article>\n <article class=\"art-01\"><div class=\"ms_text-wra\"><h2></h2><div class=\"ms_text\"><h1 class=\"ms_heading\">Bill To :</h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'+in_contact_title.to_s+''+in_contact_address1.to_s+''+in_contact_address2.to_s+''+in_contact_state.to_s+''+in_contact_czip.to_s+'</h2></div></div></div><div class=\"ms_text-wra-02\"><h2></h2><div class=\"ms_text-2\"><h1 class=\"ms_heading\">Ship To : </h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'+ship_contact_title.to_s+''+ship_contact_address1.to_s+''+ship_contact_address2.to_s+''+ship_contact_state.to_s+''+ship_contact_czip.to_s+'</div></div></div></article>\n <article class=\"art-01 art-04 \"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"640\"><tbody><tr align=\"center\" class=\"hea\"><td width=\"72\">ORDERED</td><td width=\"75\">SHIPPED</td><td width=\"67\">P/N</td><td width=\"224\">DESCRIPTION</td><td width=\"95\">PRICE/E</td><td width=\"107\">TOTAL</td></tr> <tr valign=\"top\" align=\"left\" class=\"h-pad\"><td></td><td></td><td><table border=\"0\" width=\"100%\"><tbody><tr><th scope=\"row\"></th></tr></tbody></table></td><td></td><td></td><td></td></tr></tbody></table></article>\n <article ><div class=\"footer\"><div class=\"page\"><h3>Page</h3><span>1 </span></div><div class=\"original\"><table width=\"250\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><th width=\"169\" align=\"right\" scope=\"row\">SUB TOTAL :</th><td width=\"131\" align=\"right\">'+sub_total.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">FREIGHT :</th><td align=\"right\">'+self.receivable_freight.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">TOTAL :</th><td align=\"right\">'+s_sub_total.to_s+' </td></tr></table></div></div></article> </section>\n </section><div style=\\\"page-break-after: always;\\\"> </div>'.html_safe\n end\n html = %'<!DOCTYPE html><html><head><title>Member Spotlight</title><style>@charset \"utf-8\";body{font-family:Arial,Helvetica,sans-serif;font-size:14px}*{margin:0;padding:0}.clear{clear:both}.ms_wrapper{height:auto; width:640px; margin: 0 0 0 40px;}.ms_wrapper section{height:auto;width:640px}.ms_wrapper .ms_heading{font-size:14px;margin:7px 0 0;padding:0 0 10px;text-decoration:underline}.ms_wrapper .ms_image{float:left;font-size:22px;height:93px;margin:21px 0 0;text-align:center;width:310px}.ms_wrapper .ms_heading-3{text-decoration:underline;font-size:14px;margin:0 0 4px;padding:0 0 10px;float:left}article.art-01{margin:0;padding:3px 0 0}.ms_image-6 h5{font-size:14px!important}.ms_image-6 h4{font-size:13px;margin:0;text-decoration:underline}.ms_text-wra{float:left}.ms_text-wra-02{float:right}.space{margin:5px 0}.ms_image-5{ height: 69px;border:1px solid maroon;border-radius:12px;padding:4px 34px}.ms_wrapper .ms_image-2{float:right;font-size:22px;height:119px;text-align:center;width:310px}.ms_wrapper article{float:left;width:100%;min-height:121px}.ms_text-6>h2{font-size:14px}.h-pad2{float:left;margin:29px 0 0!important}.h-pad>td{border-bottom:1px dashed #444;font-size:13px;margin:0;padding:10px 0;text-align:center}.h-pad2 strong{float:left;font-size:11px;font-weight:400;margin:0;width:100%}.art-08 td{border:1px solid #444;font-size:12px;padding:5px 0}.ms_wrapper .ms_text{ height: 104px !important;float:left;font-size:15px;min-height:104px;line-height:23px;width:300px;margin:0}.ms_wrapper .ms_offers{float:left;margin:12px 0 0;padding:10px 0 0;text-align:center}.ms_wrapper .ms_sub-heading{color:#000;font-size:11px;line-height:16px;margin:10px 0 0}.ms_sub-heading>span{float:left;font-size:13px;margin:0 0 5px;width:100%}.ms_text strong,.ms_text-2 strong{float:left;font-size:13px;font-weight:400;line-height:19px;width:100%}.ms_text1 strong{float:left;font-size:14px;line-height:19px;width:100%;margin:1px 0;text-align:center;font-weight:700}.ms_text-6.ms-33 .ms_sub-heading{font-size:17px}.ms_text-6.ms-33{text-align:center}.ms_image-2 h3{color:navy;font-size:21px;font-weight:400;margin:17px 0 0;text-decoration:underline}.ms_text-6>h3{float:left;margin:0;padding:18px 0 0;font-size:14px}.ms_text-6{float:left;margin:0;width:212px}.hea td{border:1px solid #444;font-size:14px;font-weight:700;padding:9px 0}.ms_image-2 h2{color:#111;font-size:20px;font-weight:700;margin:2px 0}.ms_image-6{float:left}.ms_image-7{float:right}.ms_image-2 h5{color:maroon;font-size:16px;font-weight:700;margin:0}.ms_text-3-wrapper{float:left}.ms_text-3-wrapper .ms_text-3{width:126px;float:left}.ms_text-3-wrapper .ms_text-5{width:204px;float:left;text-align:center}.ms_text-3-wrapper .ms_text-4{float:left;width:91px}article.art-02{margin:18px 0 0;padding:7px 0 0;border:1px solid #555;border-radius:15px}.ms_text-5>strong{font-weight:400}.ms_text-3-wrapper .ms_text-3 strong,.ms_text-3-wrapper .ms_text-4 strong{float:left;font-size:14px;font-weight:400;line-height:19px;width:100%;margin:6px 0;text-align:center}.ms_text-3-wrapper .ms_sub-heading{border-bottom:1px solid #555;font-size:13px;margin:21px 0 12px;padding:0 0 12px;text-align:center}.ms_sub{font-size:15px;text-align:center;text-decoration:underline;margin:2px 0 10px}.ms_text{border-bottom:1px solid #555;border-top:1px solid #555;float:left;padding:0 0 10px;width:310px}.ms_text-wra h2,.ms_text-wra-02 h2{font-size:16px}.ms_text-2{border-bottom:1px solid #555;border-top:1px solid #555;float:right;min-height:104px;height: 104px !important;padding:0 0 10px;width:300px}.ms_text-7>strong{float:none}.ms_text-7.ms_text-8{border-bottom:1px solid #555;padding:0 0 9px}.ms-1{float:left!important;text-align:right;width:95px!important}.ms_text-7.ms_text-9 strong{font-size:14px;font-weight:700}.ms_text-7{float:left;margin:4px 0;width:90%}.ms_text1{float:left;margin:12px 28px 0;width:42%}.ms-5{color:maroon}.ms-2{margin:0 0 0 38px}.ms_text-55{float:left;padding:0 3px 11px;width:310px}.ms_wrapper .ms_image2{margin:0 20px 0 0;border:1px solid #ccc;padding:20px 0;text-align:center;font-size:22px}.ms_image2 h2{font-size:17px;margin:0}.ms_image2 strong{color:maroon;float:left;font-size:22px;margin:0 0 8px;width:100%}.original td{font-size:14px;font-weight:700;color:maroon}.ms_image2 p{font-size:18px;margin:0;color:navy}.footer{float:left;margin:10px 0 0;width:640px}.page{float:left;margin:0 0 0 20px}.page h3{float:left;font-size:14px;font-weight:700;margin:0 21px 0 0}.page h4{font-size:12px;font-weight:400;margin:5px 0 12px;text-align:center}.original th{color:maroon}.original{border:2px solid maroon;border-radius:12px;float:right;padding:10px}.original h3{font-size:14px;font-weight:700;margin:12px 0 0}.original h4{font-size:12px;font-weight:400;margin:5px 0 12px;text-align:center}.ms_image-wrapper{float:left;height:69px;margin:20px 0 0 3px;width:150px}.ms_image-wrapper img{width:128px}.ms_image-text span{font-weight:700}.ms_image-text{float:right;margin:6px 10px 0 0;width:120px}.ms_image-text h2{font-size:13px;margin:19px 0 8px;text-decoration:underline}.ms_image-text h3{border-bottom:1px solid #555;font-size:9px;font-weight:400;margin:12px 0 6px;padding:0 0 7px}.ms_image-text h5{border-bottom:1px solid #555;font-size:9px;font-weight:400;margin:0;padding:0 0 7px}.page-center{float:left;margin:8px 36px;width:394px}.page-center h3{font-size:14px;font-weight:700;margin:12px 0 0}.page-center h4{font-size:12px;font-weight:400;margin:5px 0 12px;text-align:center}.h-pad th{font-weight:400}.foot{background-color:#fff}.top-003{position:fixed;top:0;background-color:#fff}.art-01.to-003{padding:130px 0 0}.art-01.art-04{height:444px;padding:0 0 20px}.art-01.hei{height:575px}</style></head><body><div class=\"ms_wrapper\" >#{content}</div><div style=\"page-break-after: always;\"> </div> </body></html>'\n\n\n # if Rails.env == \"production\"\n # # html = \"http://erp.chessgroupinc.com/po_headers/#{self.po_header.id}/purchase_report\"\n # end\n kit = PDFKit.new(html, :page_size => 'A4' )\n # Get an inline PDF\n pdf = kit.to_pdf\n p pdf\n # Save the PDF to a file\n path = Rails.root.to_s+\"/public/invoice_report\"\n if File.directory? path\n path = path+\"/\"+self.so_header.so_identifier.to_s+\".pdf\"\n kit.to_file(path)\n else\n Dir.mkdir path\n path = path+\"/\"+self.so_header.so_identifier.to_s+\".pdf\"\n kit.to_file(path)\n end\n\n\n end",
"def testem_page\n testem_fields(\n \"#{Prawn::DATADIR}/images/reports/CEM2030-2012_Page_01.pdf\"\n # \"#{Rails.root}/app/assets/images/reports/testem_fields.pdf\"\n # \"#{Rails.root}/app/assets/pdfs/testem.png\"\n )\n start_new_page\n end",
"def finish\r\n #\r\n end",
"def finalize(flatten)\n @pdf_stamper.setFormFlattening flatten\n @pdf_stamper.close\n @file_reader.close\n @byte_stream.toByteArray\n end",
"def rpt_stocks1\n @company=Company.find(params[:company_id]) \n @fecha1= \"2017-01-01 00:00:00\"\n @fecha2 = params[:fecha1]\n @categoria = params[:products_category_id]\n @namecategoria= @company.get_categoria_name(@categoria) \n @movements = @company.get_stocks_inventarios4(@categoria)\n \n Prawn::Document.generate(\"app/pdf_output/stocks1.pdf\") do |pdf| \n\n pdf.font_families.update(\"Open Sans\" => {\n :normal => \"app/assets/fonts/OpenSans-Regular.ttf\",\n :italic => \"app/assets/fonts/OpenSans-Italic.ttf\",\n })\n\n pdf.font \"Open Sans\",:size =>6\n \n pdf = build_pdf_header(pdf)\n pdf = build_pdf_body(pdf)\n build_pdf_footer(pdf)\n $lcFileName = \"app/pdf_output/stocks1.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName\n #send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n send_file(\"app/pdf_output/stocks1.pdf\", :type => 'application/pdf', :disposition => 'inline')\n end",
"def output_pdf_data\n options = {\n delinearize: true,\n recompile: true,\n decrypt: false\n }\n\n pdf.delinearize! if pdf.linearized?\n pdf.send(:compile, options)\n pdf.send(:output, options)\n end",
"def save_ctacte_pdf_to(filename,entity)\n require 'prawn'\n \n pdf = Prawn::Document.new(:left_margin => 35, :top_margin => 35,:page_size => \"LETTER\",\n :page_layout => :portrait)\n offset = 0\n\n pdf.repeat(:all, :dynamic => true) do\n pdf.draw_text (\"Cuenta corriente de \" + entity.first.try(:cliente).razonsocial + \" impreso el \" + Date.today.strftime(\"%d/%m/%Y\")) , :at => [5,745],:style => :bold, :size => 10\n pdf.draw_text \"Hoja Nro.: \" + pdf.page_number.to_s.rjust(4,\"0\"), :at => [300, 745],:style => :bold, :size => 8\n end\n data = [[\"Fecha\",\"Tipo Cp\",\"Numero\",\"Importe\",\"Fecha Vto\",\"impreso\"],[] ]\n saldo = 0\n entity.each do |r|\n data << [r.fecha.blank? ? '' : r.fecha.strftime(\"%d/%m/%Y\"),\n r.type,\n r.numero,\n r.total_comprobante,\n r.fechavto.blank? ? '' : r.fechavto.strftime(\"%d/%m/%Y\"),\n r.printed_at.blank? ? '' : r.printed_at.strftime(\"%d/%m/%Y\")]\n saldo += r.total_comprobante \n end\n data << [\"\" ,\"Totales\",\"\",saldo.to_s,\"\",\"\" ]\n\n pdf.table(data, :column_widths => [65, 100, 60, 65, 65, 65],\n :cell_style => { :font => \"Times-Roman\",\n :size => 10,:padding => [2,3,4,2],\n :align => :left,\n :valign => :center },\n :header => true ,\n :row_colors => [\"F0F0F0\", \"FFFFCC\"]\n ) do\n column(2...3).align = :right\n row(0).column(0..6).align = :center\n end\n pdf.render_file(filename)\nend",
"def process(pdf, resume)\n Font.configure(pdf, resume[:font])\n Name.generate(pdf, resume[:name])\n Headline.generate(pdf, resume[:headline])\n Output.plain(:creating_social_media_links)\n SocialMediaLogoSet.generate(pdf, resume[:social_media_logo_set])\n Output.plain(:creating_technical_skills_section)\n TechnicalSkills.generate(pdf, resume[:technical_skills])\n Output.plain(:creating_employment_history_section)\n EmploymentHistory.generate(pdf, resume[:employment_history])\n Output.plain(:creating_education_history_section)\n EducationHistory.generate(pdf, resume[:education_history])\n end",
"def rpt_facturas_all_pdf\n\n $lcFacturasall = '1'\n\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n \n\n @facturas_rpt_1 = @company.get_facturas_day(@fecha1,@fecha2,\"1\") \n @facturas_rpt_2 = @company.get_facturas_day(@fecha1,@fecha2,\"2\") \n# respond_to do |format|\n# format.html \n# format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n# end \n\n Prawn::Document.generate(\"app/pdf_output/rpt_factura.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_rpt(pdf)\n pdf = build_pdf_body_rpt(pdf)\n build_pdf_footer_rpt(pdf)\n\n\n $lcFileName = \"app/pdf_output/rpt_factura_all.pdf\" \n end \n\n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/rpt_factura.pdf\", :type => 'application/pdf', :disposition => 'inline')\n\n end",
"def pdf\n #render layout: false\n Car.find(params[:id])\n Prawn::Document.generate(\"app/assets/pdf/#{@car.targa}.pdf\") do |f|\n f.text \"Hello Worldd!\"\n end\n end",
"def rpt_stocks3\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n \n @movements = @company.get_movement_stocks(@fecha1,@fecha2) \n \n Prawn::Document.generate(\"app/pdf_output/stocks3.pdf\") do |pdf| \n pdf.font \"Helvetica\"\n pdf = build_pdf_header2(pdf)\n pdf = build_pdf_body2(pdf)\n build_pdf_footer2(pdf)\n $lcFileName = \"app/pdf_output/stocks3.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/stocks3.pdf\", :type => 'application/pdf', :disposition => 'inline')\n end",
"def toPDF()\n doc = Prawn::Document.new(:compress => true, :page_size => [500, 280])\n doc.font 'Times-Roman'\n \n # Les images pour le background, le logo, la signature du tresorier\n doc.image \"public/images/recus/recu.png\", :at => [0, 200]\n doc.image \"public/images/recus/logo112x87.png\", :at => [370, 195], :fit => [56, 44]\n doc.image \"public/images/recus/signature_recu.png\", :at => [280, 80], :fit => [147,42]\n\n # Boite avec les informations principales du recu\n doc.bounding_box([5,180], :width => 500) do\n doc.text \"Date: \" + DateTime.now.strftime('%Y-%m-%d')\n \n doc.move_down 42\n annee = DateTime.now.strftime('%Y')\n doc.text \"Reçu pour abonnement à la piscine Dixie \" + annee, :style => :bold\n doc.text \"Receipt for Dixie pool registration \" + annee, :style => :bold\n \n doc.move_down 10\n doc.text \"Nom/Name: \" + nom\n doc.text \"Montant perçu/Amount paid: \" + sprintf('$%6.2f', @famille.paiementTotal)\n end\n \n # Boite avec les coordonnes de la piscine. En haut a droite avec le logo dedans\n doc.bounding_box([220, 195], :width => 210, :height => 45) do\n doc.stroke_bounds\n doc.bounding_box([2, 43], :width => 210) do\n doc.text \"Association Piscine Dixie Inc.\"\n doc.text \"CP 34045\"\n doc.text \"Lachine, Qc, H8S 4H4\"\n end\n end\n \n # Sous la signature\n doc.draw_text \"Trésorier / Treasurer\", :at => [300, 30]\n \n return doc\n end",
"def do_eof; end",
"def pdf_processing(json_information_message)\n puts \"Handling pdf processing for \"\n puts json_information_message['email']\n sleep 5.0\n puts \"pdf processing done\"\n end",
"def show\n respond_to do |format|\n format.html\n format.pdf do\n render :pdf => \"file_name\",\n :layout => 'pdf.html.erb',\n :page_size => 'Letter',\n :footer => {:right => '[page] de [topage]', :font_size => 7}\n end\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.pdf do\n render :pdf => \"file_name\",\n :layout => 'pdf.html.erb',\n :page_size => 'Letter',\n :footer => {:right => '[page] de [topage]', :font_size => 7}\n end\n end\n end"
] | [
"0.7499543",
"0.7499543",
"0.71484303",
"0.71289474",
"0.6847863",
"0.6818039",
"0.6768234",
"0.6695455",
"0.66131705",
"0.6513222",
"0.64334816",
"0.6389421",
"0.63696873",
"0.6354285",
"0.63372016",
"0.62761074",
"0.6250081",
"0.62422544",
"0.6223955",
"0.6174627",
"0.6121069",
"0.6121069",
"0.6121069",
"0.61018074",
"0.60956913",
"0.6078336",
"0.60749835",
"0.60689586",
"0.60682",
"0.6046977",
"0.60422033",
"0.6036767",
"0.6019644",
"0.6014834",
"0.5993072",
"0.59745157",
"0.5973333",
"0.5973333",
"0.5973333",
"0.59692436",
"0.595776",
"0.5939815",
"0.59394205",
"0.59394205",
"0.5927796",
"0.5912242",
"0.59024775",
"0.5898642",
"0.5898407",
"0.5898407",
"0.58971626",
"0.5890634",
"0.58831537",
"0.58827275",
"0.5875132",
"0.5873399",
"0.58653694",
"0.58641714",
"0.5856977",
"0.58485466",
"0.5845915",
"0.5842831",
"0.5837621",
"0.58353245",
"0.5834819",
"0.5831359",
"0.58262086",
"0.58239377",
"0.58117926",
"0.58117926",
"0.58117926",
"0.58117926",
"0.58117926",
"0.58117926",
"0.58117926",
"0.5806897",
"0.58057576",
"0.58055854",
"0.5804328",
"0.5802918",
"0.57877666",
"0.5780502",
"0.57763433",
"0.5767951",
"0.5766378",
"0.57569396",
"0.57538974",
"0.5752844",
"0.57528245",
"0.5741749",
"0.57387596",
"0.573268",
"0.5732543",
"0.57289153",
"0.5725477",
"0.5719951",
"0.57175744",
"0.57145107",
"0.57127726",
"0.57121277",
"0.57121277"
] | 0.0 | -1 |
Based on what params user selected or if they were not passed based on params saved in session return user_id, that should be filtered for financial statements. if user passed clear as param return nil Params +session_options+ hash including :user_id, might be nil Return +user_id+ integer or nil | def financial_statements_user_id(session_options)
not_params_clear = !params[:clear]
params_user_id, session_user_id = [params[:s_user_id], session_options.try(:[], :s_user_id)]
if current_user.usertype == 'user'
user_id = current_user_id
elsif params_user_id && not_params_clear
user_id = params_user_id || 'all'
user_id = -1 if params[:s_user].present? && params_user_id.to_i == -2
elsif session_options && session_user_id && not_params_clear
user_id = session_user_id
else
user_id = nil
end
user_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user_id\n if (params[:user_id])\n return params[:user_id].to_i\n else\n return params[:id].to_i\n end\n end",
"def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end",
"def get_user_from_session\r\n return User.find(session[:user_id]) if session[:user_id]\r\nend",
"def session_params\n session[:user_id]\n end",
"def user_id\n query_params&.dig(:user_id)\n end",
"def user_from_session\n if session[:user] && session[:user][:id]\n User.find_by_id(session[:user][:id])\n else\n nil\n end\n end",
"def user_id\n case @params.event\n when 'conversation_started', 'subscribed'\n @params.user.id\n when 'unsubscribed', 'delivered', 'seen', 'failed'\n @params.user_id\n when 'message'\n @params.sender.id\n else\n @params.dig(:user, :id)\n end\n end",
"def user_id\n @logged_in_user = User.find_by(id: params[:id])\n @user_id = @logged_in_user.id\n end",
"def user_id_param\n query_params&.dig(:user_id)\n end",
"def actual_user\n User.find_by_id(session[:user_id])\n end",
"def find_user\n if session[:merchant_id]\n @login_user = User.find_by(id: session[:user_id])\n end\n end",
"def user_id\n if (id = (@opts[:user_id] || @opts['user_id'])) && id.respond_to?(:to_s)\n if (id = id.to_s).size > 0 && id != '0'\n return id\n end\n end\n end",
"def current_user\n# If it is included to determine that there is a value passed to the session's user_id key value\n# @current_user instance variable undefine? then assign its value using ||=\n# At user find, by passing in the parameters, the current session and assigned :user_id\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"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 find_user\n return nil if session[:user_id].nil?\n User.find(session[:user_id])\n end",
"def find_user\n return nil if session[:user_id].nil?\n User.find(session[:user_id])\n end",
"def find_user\n if !current_user.nil?\n @user=User.find(current_user.id)\n session[:admin_id]=@user.id\n elsif !current_member.nil?\n @user=Member.find(current_member.id)\n session[:admin_id]=@user.user_id\n end\n end",
"def user_id_params\n @user_id = User.find_by(id: params[:id])\n @user_id\n end",
"def is_session_user?\n id_or_username = params[:user_id]\n case id_or_username\n # if the id/username is for the current user, or the id is not provided then use the current user\n when session_user_id, nil\n true\n else\n false\n end\n end",
"def current_user\n# if session[:user_id]\n# u = User.find([:user_id])\n# end\n#\n# if u\n# u\n# else\n# false\n# end\n# exact same\n\nsession [:user_id] && User.find(session[:user_id])\n end",
"def current_user\n @current_user||= User.find(session[:user_id]) if session[:user_id]\n\n #here User.find(session[:user_id]) this will fetch the user based on the active session's user_id \n #as the above line will hit the database numerous time. We don't want that so to restrict it we created a local variable to store the user once find\n #|| this pipeline symbol is for checking \nend",
"def current_user\n User.find_by_id(session[:user_id]) if session[:user_id] \n end",
"def user_id\n instance_variable_get(:@prepared_arguments).dig(:user_id)\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 valid_session\n {user_id: @user.id}\n end",
"def session_user\n return @session_user if defined? @session_user\n if session.has_key? :user_id\n @session_user ||= User.find_by_id(session[:user_id])\n end\n end",
"def current_user\n # find_by will give me nil\n # nil is falsey\n # User.find will error out if ther is no user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n if session[:user_id] == nil\n return {}\n end\n\n # ruby - implicit return\n return run_sql(\"SELECT * FROM users WHERE id = #{session[:user_id]};\")[0]\nend",
"def find_user\n if !current_user.nil?\n @user=User.find(current_user.id)\n session[:admin_id]=@user.id\n elsif !current_member.nil?\n @user=Member.find(current_member.id)\n session[:admin_id]=@user.user_id\n end\n return @user\n end",
"def get_account_type_from_session\r\n return User.where(id: session[:user_id]).pluck(:account_type_id).join.to_i if session[:user_id]\r\nend",
"def when_current_user_is(user, options = {})\n current_user =\n case user\n when Symbol\n create :user, user\n when User\n user\n when nil\n # need spire for requests but current_user should still be nil\n session[:spire] = build(:user).spire\n nil\n else raise ArgumentError, 'Invalid user type'\n end\n if options.key? :view\n assign :current_user, current_user\n else session[:user_id] = current_user.try :id\n end\nend",
"def user_id\n @values.fetch('userId') { \n @values['userId'] = nil\n }\n end",
"def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end",
"def current_user\n User.find_by_id(session[:user_id]) if session[:user_id].present?\n end",
"def getUserID\n if signed_in? \n if params[:id].empty?\n uid = current_user.id\n else\n uid = params[:id]\n end\n @user = User.find(uid)\n else\n redirect_to pages_home_path\n end\n end",
"def user_filter_options(model) #:nodoc:\r\n table_name = @tables.first[1]\r\n if session[table_name]\r\n DcFilter.get_filter(session[table_name][:filter]) || model\r\n else\r\n model\r\n end\r\nend",
"def user_filter_options(model) #:nodoc:\r\n table_name = @tables.first[1]\r\n if session[table_name]\r\n DcFilter.get_filter(session[table_name][:filter]) || model\r\n else\r\n model\r\n end\r\nend",
"def user_param\n params[:user_id]\n end",
"def user_param\n params[:user_id]\n end",
"def login( user )\n session[:user_id] = user ? user.id : nil\n end",
"def hubssolib_get_user_data\n user = self.hubssolib_current_session ? self.hubssolib_current_session.session_user : nil\n\n if (user && user.user_id)\n return user\n else\n return nil\n end\n end",
"def current_user\n current_user ||= User.find(session[:user_id]) if session[:user_id]\n# OrderSummary.db_selection(current_user)\n return current_user\n end",
"def logged_in_user\n if session[:user]\n if session[:user].to_i < 1\n @logged_in_user = Person.new\n elsif !@logged_in_user || @logged_in_user.id != session[:user].to_i\n @logged_in_user = Person.find session[:user].to_i\n end\n end\n \n @logged_in_user\n end",
"def user_from_session\n if session[:current_user_id].present?\n @current_user ||= User.find(session[:current_user_id])\n elsif session[:current_auditor_id].present?\n @current_user ||= Auditor.find(session[:current_auditor_id])\n elsif session[:current_super_user_id].present?\n @current_user ||= SuperUser.find(session[:current_super_user_id])\n end\n end",
"def user_id\n\t\t@user_id || nil\n\tend",
"def find_current_user #for madlib/user connection - am i using this?\n @user_found = User.find_by(id: session[:user_id])\n end",
"def current_user\n if session[:user_id]\n puts \"session user_id #{session[:user_id]}\"\n User.find(session[:user_id])\n end\nend",
"def logged_in_user_id\n session[:user_id]\n end",
"def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end",
"def current_user\n if (user_id = session[:user_id])\n if @current_user != nil\n @current_user\n elsif session[:user_type_string] == \"UserAdmin\"\n @current_user = UserAdmin.find_by(id: session[:user_id])\n elsif session[:user_type_string] == \"UserProfessore\"\n @current_user = UserProfessore.find_by(id: session[:user_id])\n elsif session[:user_type_string] == \"UserStudente\"\n @current_user = UserStudente.find_by(id: session[:user_id])\n else\n nil\n end\n elsif (user_id = cookies.signed[:user_id])\n if cookies.signed[:user_type_string] == \"UserAdmin\"\n user = UserAdmin.find_by(id: user_id)\n elsif cookies.signed[:user_type_string] == \"UserProfessore\"\n user = UserProfessore.find_by(id: user_id)\n elsif cookies.signed[:user_type_string] == \"UserStudente\"\n user = UserStudente.find_by(id: user_id)\n end\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def request_user\n # request_valid? is called first which creates a @session instance\n # variable which acts like the global session object of a normal request.\n @request_user ||= User.find(@session[:user_id]) if request_valid?\n end",
"def current_user\n# if there is a current user rtn that if not then rtn nil\n@current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def set_current_user\n @current_user =\n if session.key? :user_id\n User.active.find_by id: session[:user_id]\n elsif request.env.key? 'fcIdNumber'\n User.active.find_by spire: request.env['fcIdNumber']\n end\n session[:user_id] = @current_user.id if @current_user.present?\n end",
"def current_user\n\n#return this @current user, only if he exists, if not, find him based on the current id stored in session\n@current_user ||= User.find(session[:user_id]) if session[:user_id] #return this user if there is a user id stored in our session hash\n\nend",
"def correct_owner_id\n return 0 if accountant? or admin?\n return session[:user_id] if reseller?\n return session[:owner_id]\n end",
"def find_user\n @user = User.find(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] #if a session id exist return the user to @current_user\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] \n #this code will return nil rather than throwing an exception. \n #'||=' memoization technique is a minor performance optimization.\n #if @current_user exist, do not run the code after '||=' else do so, ensuring we will hit database once. \n end",
"def find_current_user\n # adding if to prevent rails from checking user when logged out\n if is_logged_in?\n #save to a variable\n @current_user = User.find(session[:user_id]);\n else\n @current_user = nil\n end\n end",
"def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.where.not(id: self.user_id).near([self.latitude, self.longitude], 25, units: :km).map(&:id)\n\tend\n\tblack_list = BlockUser.blocked_user_ids(self.user_id)\n \tcontent_black_list = ShoutReportHistory.where(reportable_id: self.id).where(reportable_type: 'Shout').map(&:reporter_id)\n \treturn_user_ids = return_user_ids - black_list - content_black_list\n\n \t# only user pusher for online users\n \tonline_users_ids = User.where(id: return_user_ids).where(pusher_private_online: true).map(&:id)\n \treturn online_users_ids\n end",
"def current_user\n if session[:user_id] # if there is a session id, the current user is the one whose session id is the same as the user id \n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user_id\n session[:user_id]\n end",
"def valid_session\n {:user_id => @user.id}\n end",
"def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end",
"def current_user\n\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n end",
"def find_current_user\n @currentUser = User.find_by_id(session[:user_id])\n end",
"def user_params\n admin_access? && admin_user_filter || normal_user_filter\n end",
"def find_current_user\n if session[:current_user_id]\n @user = User.find_by(id: session[:current_user_id])\n else\n @user = nil\n end\n end",
"def get_user_from_id\n #convert URL id to integer and set into instance var user_id\n @user_id = params[:id].to_i\n #look up the user based on id and cast into instance var\n @user = User.find_by_id(@user_id)\n #if no user found redirect back to previous page with error\n if !@user\n flash[:error] = \"User does not exist\"\n custom_redirect_back\n end\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #debugger\n #User.find_by(session[:user_id]) if session[:user_id]\n end",
"def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if (id = session[:user_id]) #goes through is id is true\n @current_user ||= User.find_by(id: id)\n elsif (id = cookies.signed[:user_id])\n user = User.find_by(id: id)\n #so a logged in user doesnt get logged in again\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end # finding this way to not throw error if nill but the if \n end",
"def current_user_unique_id\n return current_user.id unless current_user.nil?\n request.session_options[:id]\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user # Check the current user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def set_user\n logger.debug 'In set_user, session[:uid]=' + session[:uid].to_s\n logger.debug 'In set_user, params[:vk_id]' + params[:vk_id].to_s\n if !session[:uid].nil?\n logger.debug 'Searching for player with vk_id ' + session[:uid].to_s\n @user = User.find_by_vk_id session[:uid]\n elsif !params[:vk_id].nil?\n logger.debug 'Searching for player with vk_id ' + params[:vk_id].to_s\n @user = User.find_by_vk_id params[:vk_id]\n else\n logger.error 'User is not logged in'\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n #memoization\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n rescue ActiveRecord::RecordNotFound\n session.delete(:user_id)\n @current_user = nil\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] #find user in database based on id, if not already logged in. \n \n end",
"def current_user\n@current_user ||= User.find_by(id: session[:user_id])\nend",
"def user_id(transition)\n user_id = transition.args.last[:user_id] if transition.args.present?\n user_id ||= 0\n end",
"def current_user\n if session[:user] != nil\n # return the user id\n return session[:user]\n else\n return false\n end\nend",
"def query_user_id\n @attributes[:query_user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #this way so if no session we don't .find nil\n end",
"def set_appointments_user\n @user = User.find_by(id: params[:user])\n if @user\n @user_id = @user.id # provide the default value for the user filter select to the view\n else\n @user_id = nil\n end\n end",
"def find_user\n @user= User.where(id: params[:id]).first\n end",
"def current_user\n # if current_user is et use it otherwise ask the data store\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def return_to_current_user\n\t\tparams[:id] = params[:id].eql?(current_user.id) ? params[:id] : current_user.id\n\tend",
"def user_id\n @user_id ||= self.user ? self.user.to_global_id : nil\n end",
"def user_or_farmer\n if session[:farmer_id]\n \"farmer\"\n elsif session[:user_id]\n \"user\"\n else\n \"error\"\n end\n end",
"def correct_user\n #@user = User.find(params[:id])\n @user ||= User.find_by(id: session[:user_id])\n redirect_to(root_url) unless current_user?(@current_user)\n end",
"def user_id\n config.present? ? config[:user_id] : ''\n end",
"def user_session_params\n # params[:user_session]\n params\n end",
"def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend",
"def find_user_by_session(sess_id)\n return unless sess_id\n session_options = ActionController::Base.session_options\n sess = CGI::Session.new(request.cgi,{\n 'session_id' => sess_id,\n 'new_session' => false,\n 'secret' => session_options[:secret],\n 'database_manager' => session_options[:database_manager],\n 'session_key' => session_options[:session_key],\n 'prefix' => session_options[:prefix],\n 'tmpdir' => session_options[:tmpdir],\n 'cache' => session_options[:cache],\n 'no_cookies' => true #undocumented ruby feature, critical for us.\n })\n if(sess[:user_id])\n User.find(sess[:user_id])\n else\n nil\n end\n end",
"def user\n find_user params._id\n end",
"def get_user_or_current_user(id)\n id = params[:id]\n if id == current_user.id\n return current_user\n end\n user = User.find_by_id(id)\n if user.nil?\n return current_user\n else\n return user\n end\n\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] \n #return this user if session[:user_id] that is stored in our session hash if so then find the user in our database and display it, \n # the @current_user is handy if the user already exist and we do not want the user id keep heiting the database every time \n end",
"def show\n\n\t\t# Check if a ID paramaters is recevied\n \t\tif params.has_key?(:id) \n\n \t\t\t# Check if the ID exists in the company table\n\t\t\tif is_valid_id params[:id].to_i\n\n\n\t\t\t\tsession[:comp_id] = params[:id]\n\t\t\t\t@user = User.find(@company.user_id)\n\n\t\t\t# If not then redirect to login\n\t\t\telse\n\t\t\t\tredirect_to login_path\n\t\t\tend\n\t\t# If not then redirect to login\n\t\telse\n\t\t\tredirect_to login_path\n\t\tend\n\tend"
] | [
"0.6422591",
"0.62700105",
"0.62198734",
"0.6164427",
"0.6103503",
"0.60974437",
"0.6082344",
"0.6071978",
"0.6061947",
"0.60134",
"0.60076153",
"0.5993115",
"0.59782684",
"0.59635365",
"0.5921999",
"0.5921999",
"0.58947784",
"0.58933336",
"0.5872266",
"0.58480287",
"0.58438665",
"0.58368456",
"0.582542",
"0.5756548",
"0.57507014",
"0.5735138",
"0.5733289",
"0.5723629",
"0.5723612",
"0.57219225",
"0.572152",
"0.56959903",
"0.5694056",
"0.56789744",
"0.5677127",
"0.5675784",
"0.5675784",
"0.567568",
"0.567568",
"0.56740505",
"0.5673909",
"0.56706065",
"0.56674796",
"0.5663517",
"0.5629982",
"0.562887",
"0.5628526",
"0.5599383",
"0.5599016",
"0.55932266",
"0.55869716",
"0.55841124",
"0.5584033",
"0.5575598",
"0.55636466",
"0.55627084",
"0.55576",
"0.555631",
"0.5552914",
"0.5548682",
"0.5541572",
"0.5541106",
"0.55366164",
"0.55315256",
"0.5521553",
"0.5518713",
"0.55171204",
"0.5506228",
"0.55058557",
"0.55041045",
"0.5498162",
"0.54960084",
"0.54932535",
"0.5492458",
"0.5492458",
"0.5487876",
"0.54747",
"0.5473744",
"0.54693866",
"0.5468889",
"0.54685575",
"0.54668117",
"0.5466703",
"0.5465849",
"0.54628956",
"0.5462891",
"0.54622346",
"0.5459034",
"0.54584837",
"0.5452227",
"0.54470164",
"0.544627",
"0.5445275",
"0.5442095",
"0.5441667",
"0.54358983",
"0.54333985",
"0.5428555",
"0.5424435",
"0.5422182"
] | 0.8250601 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.