query
stringlengths 7
6.41k
| document
stringlengths 12
28.8k
| metadata
dict | negatives
sequencelengths 30
30
| negative_scores
sequencelengths 30
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
GET /property_between_floor_slaps GET /property_between_floor_slaps.json | def index
@property_between_floor_slaps = PropertyBetweenFloorSlap.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end",
"def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end",
"def create\n @property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params)\n\n respond_to do |format|\n if @property_between_floor_slap.save\n format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' }\n format.json { render :show, status: :created, location: @property_between_floor_slap }\n else\n format.html { render :new }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend",
"def index\n @floor_plans = @location.floor_plans\n end",
"def surface_bounds\n\n sql = \"select \"\\\n \"min(surface_longitude) as min_longitude, \"\\\n \"min(surface_latitude) as min_latitude, \"\\\n \"max(surface_longitude) as max_longitude, \"\\\n \"max(surface_latitude) as max_latitude \"\\\n \"from well where \"\\\n \"surface_longitude between -180 and 180 and \"\\\n \"surface_latitude between -90 and 90 and \"\\\n \"surface_longitude is not null and \"\\\n \"surface_latitude is not null\"\n\n corners = @gxdb[sql].all[0]\n\n {\n name: \"surface_bounds\",\n location: {\n type: \"polygon\",\n coordinates: [[\n [corners[:min_longitude], corners[:min_latitude]], #LL\n [corners[:min_longitude], corners[:max_latitude]], #UL\n [corners[:max_longitude], corners[:max_latitude]], #UR\n [corners[:max_longitude], corners[:min_latitude]], #LR\n [corners[:min_longitude], corners[:min_latitude]] #LL\n ]]\n }\n }\n end",
"def index\n if params[:ax] && params[:ay] && params[:bx] && params[:by]\n @properties = Property.find_by_coordinates(\n upper_x: params[:ax],\n upper_y: params[:ay],\n bottom_x: params[:bx],\n bottom_y: params[:by]\n )\n else\n @properties = Property.all #in this case is much necessary to implement pagination system\n end\n\n respond_with :api, :v1, @properties, status: :ok\n end",
"def bounds\n \t@data['bounds']\n end",
"def index\n return render status: :bad_request, json: {message: \"Missing required param 'latitude'.\"} if params[:latitude].blank?\n return render status: :bad_request, json: {message: \"Missing required param 'longitude'.\"} if params[:longitude].blank?\n\n range = params[:range].blank? ? 10000 : params[:range]\n start_time = params[:start_time].blank? ? Time.now : params[:start_time]\n end_time = params[:end_time].blank? ? 1.day.from_now : params[:end_time]\n\n near = ParkingPlace.near([params[:latitude], params[:longitude]], range, :units => :km)\n\n time_slots = TimeSlot\n .includes(:parking_place).references(:parking_place).merge(near)\n .where('start_time <= ? AND end_time >= ?', start_time, end_time)\n .paginate(:page => params[:page], :per_page => params[:per_page])\n\n render json: time_slots, each_serializer: TimeSlotIndexSerializer\n end",
"def index\n \tif @current_user\n \t\tsetting_distance = Setting.first.mile_for_list\n # raise setting_distance.inspect\n \t\tif params[:lat].present? && params[:lon].present?\n # @property = Property.where.not(is_active: false,status:'Sold').order(\"id DESC\").includes(:property_detail).distance(params[:lat].to_f,params[:lon].to_f,distance)\n @property = Property.where.not(is_active: false,status:'Sold').includes(:property_detail).order(\"id DESC\").near(\"#{params[:lat]},#{params[:lon]}\",setting_distance)\n\n # @property = Property.where(is_active: true).distance(params[:lat].to_f,params[:lon].to_f,distance)\n \t\t\t# @property.delete_if {|x| x.status == \"Sold\" || x.is_active == false }\n \t\telse\n \t\t\t@property = Property.where(status: \"For Sale\",is_active: true).order(\"id DESC\").includes(:property_detail)\n \t\tend\n \t\tif @property.present?\n \t\t\trender :file => 'api/v1/property/index'\n \t\telse\n \t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n \t\tend\n \tend\n end",
"def elevators_at_floor(floor)\n\t\televators.select{|elevator| elevator.floor.eql? floor}\n\tend",
"def get_bounds\n [ @min, @max ]\n end",
"def midtown_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], [])\nend",
"def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end",
"def compute_bounds(stations)\n north = south = stations.first['lat']\n east = west = stations.first['lon']\n stations.each do |station|\n lat = station['lat']\n lon = station['lon']\n north = lat if lat > north\n south = lat if lat < south\n east = lon if lon > east\n west = lon if lon < west\n end\n [[north,west],[south,east]]\nend",
"def show\n @companies = Company.where('floor_id = ?', @floor.id)\n @spaces = MeetingRoom.where('floor_id = ?', @floor.id)\n end",
"def houses\n @request[:property_type] = 'houses'\n self\n end",
"def hanover_roads\n hanover_north = 43.7031803975023\n hanover_east = -72.28413820266724\n hanover_south = 43.69828604529516\n hanover_west = -72.29262471199036\n OverpassGraph.get_roads(hanover_north, hanover_east, hanover_south, hanover_west, [], [])\nend",
"def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end",
"def show\n @rooms = Room.all.where(floor_id: @floor.id)\n\n # преобразование массива точек в строку для SVG.js (для полигонов этажей):\n # @showPointsOfFloor = []\n # polygons_ids = Polygon.all.where(imageable_id: @floor.id).map{ |i| i.id }\n # polygons_ids.each do |i|\n # @showPointsOfFloor << Point.all.where(polygon_id: i)\n # .sort_by{ |j| j[:priority] }\n # .map{ |j| \"#{j.ox}, #{j.oy}\" }\n # .join(\" \")\n # end\n\n # преобразование массива точек в строку для SVG.js (для полигонов аудиторий):\n @showPointsOfRooms = []\n @showNamesOfRooms = []\n polygons_ids = Polygon.all.where(imageable_id: Room.all.where(floor_id: @floor.id))\n polygons_ids.each do |i|\n @showPointsOfRooms << Point.all.where(polygon_id: i.id )\n .sort_by{ |j| j[:priority] }\n .map{ |j| \"#{j.ox}, #{j.oy}\" }\n .join(\" \")\n @showNamesOfRooms << Room.all.where(id: i.imageable_id)[0].name\n end\n end",
"def ranges\n attributes.fetch(:ranges)\n end",
"def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end",
"def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end",
"def get_around_estates\n\n\t\t# center_x = 121.7155930000\n\t\t# center_y = 25.1215410000\n\t\t# delta_x = 0.00772495\n\t\t# delta_y = 0.01102129\n\n\t\tcenter_x = params[:center_x].to_f\n \tcenter_y = params[:center_y].to_f\n \tdelta_x = params[:delta_x].to_f\n \tdelta_y = params[:delta_y].to_f\n\n\n \tcritera = \"x_long IS NOT NULL and y_lat IS NOT NULL\"\n \tborder = \"and x_long > #{center_x - delta_x} and x_long < #{center_x + delta_x} and y_lat > #{center_y - delta_y} and y_lat < #{center_y + delta_y}\" \n\n \titems = Realestate.select(\"id, estate_group, x_long, y_lat\").where(\"#{critera} #{border}\").paginate(:page => 1, :per_page => 10)\n\n \trender :json => items\n\n\tend",
"def range_from_params(json)\n return ::Time.now,::Time.now if json.empty?\n obj = JSON(json)\n min = ::Time.parse(obj['start'].to_s).at_beginning_of_day\n max = ::Time.parse(obj['end'].to_s).at_end_of_day\n min,max = max,min if min > max\n return min, max\n end",
"def screen_params_for_range_limit\n if (params['range_end'].nil?) ||\n (params['range_start'].nil?) ||\n (params['range_start'].to_i > params['range_end'].to_i)\n render plain: \"Calls to range_limit should have a range_start \" +\n \"and a range_end parameter, and range_start \" +\n \"should be before range_end.\", status: 406\n end\n end",
"def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end",
"def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend",
"def getInArea\n max=params[:max]||100\n\tlimit=params[:limit]||200\n\tif params[:mcc] then mcc=\" mcc=\"+params[:mcc]+\" AND \" else mcc=\"\" end\n\tif params[:mnc] then mnc=\" mnc=\"+params[:mnc]+\" AND \" else mnc=\"\" end\n if params[:BBOX]\n bbox=params[:BBOX].split(',')\n r=Rect.new bbox[0].to_f,bbox[1].to_f,bbox[2].to_f,bbox[3].to_f\n else\n r=Rect.new -180.to_f,-90.to_f,180.to_f,90.to_f\n end\n @cells=Cell.find_by_sql(\"SELECT * from cells where \"+mcc+mnc+\" lat>=\"+r.minLat.to_s+\" and lat<=\"+r.maxLat.to_s+\" and lon>=\"+r.minLon.to_s+\" and lon<=\"+r.maxLon.to_s+\" LIMIT \"+limit.to_s)\n if params[:fmt]==\"xml\"\n render(:action=>\"listXml\",:layout=>false)\n elsif params[:fmt]==\"txt\"\n\t\theaders['Content-Type'] = \"text/plain\" \n render(:action=>\"listCsv\",:layout=>false)\n else\n render(:action=>\"listKml\",:layout=>false)\n end\n end"
] | [
"0.69060063",
"0.61157036",
"0.5888169",
"0.5649257",
"0.5491359",
"0.5422482",
"0.5376796",
"0.5331189",
"0.53073645",
"0.52703154",
"0.5230716",
"0.52174205",
"0.52156436",
"0.52033854",
"0.51998276",
"0.5193905",
"0.51654613",
"0.51582396",
"0.5149543",
"0.510811",
"0.51012236",
"0.5085275",
"0.5085275",
"0.50812286",
"0.50643563",
"0.50605315",
"0.5056479",
"0.50534093",
"0.50363153",
"0.50339663"
] | 0.78588855 | 0 |
POST /property_between_floor_slaps POST /property_between_floor_slaps.json | def create
@property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params)
respond_to do |format|
if @property_between_floor_slap.save
format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' }
format.json { render :show, status: :created, location: @property_between_floor_slap }
else
format.html { render :new }
format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @property_between_floor_slaps = PropertyBetweenFloorSlap.all\n end",
"def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end",
"def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end",
"def create\n @shooting_range = ShootingRange.new(params[:shooting_range])\n\n respond_to do |format|\n if @shooting_range.save\n format.html { redirect_to(@shooting_range, :notice => 'Shooting range was successfully created.') }\n format.xml { render :xml => @shooting_range, :status => :created, :location => @shooting_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shooting_range.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @blank_wall = BlankWall.new(blank_wall_params)\n budget_range = blank_wall_params[:budget_range].split(\",\")\n @blank_wall.min_budget = budget_range[0]\n @blank_wall.max_budget = budget_range[1]\n respond_to do |format|\n if @blank_wall.save\n format.html { redirect_to @blank_wall, notice: 'Blank wall was successfully created.' }\n format.json { render :show, status: :created, location: @blank_wall }\n else\n format.html { render :new }\n format.json { render json: @blank_wall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property_between_floor_slap.update(property_between_floor_slap_params)\n format.html { redirect_to @property_between_floor_slap , notice: 'Property between floor slap was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_between_floor_slap }\n else\n format.html { render :edit }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_mid_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def create\n @floor = Floor.new(params[:floor])\n\n respond_to do |format|\n if @floor.save\n format.html { redirect_to @floor, notice: 'Floor was successfully created.' }\n format.json { render json: @floor, status: :created, location: @floor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @property_between_floor_slap.destroy\n respond_to do |format|\n format.html { redirect_to property_between_floor_slaps_url, notice: 'Property between floor slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_mid_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_range_overlap_for_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(1.0, segment.send(:range_overlap, 2.0..4.0))\n end",
"def build_geographies\n build_start_or_end_area unless start_or_end_area\n build_trip_within_area unless trip_within_area\n end",
"def create\n @floor = Floor.new(floor_params)\n\n respond_to do |format|\n if @floor.save\n editorData = @floor.editor_data\n editorData = editorData.split(\"<END>\").map{|i| i.split(\"<NEXT>\")}\n editorData.each do |obj|\n if obj[0] == 'submain'\n object = Room.new(name: obj[1],\n description: obj[2],\n capacity: obj[3],\n computers: obj[4],\n roomtype_id: Roomtype.all.where(id: obj[5].to_i)[0],\n floor_id: @floor.id)\n object.save\n elsif obj[0] == 'main'\n object = @floor\n end\n polygon = Polygon.new(imageable: object)\n polygon.save\n points = obj[6].split(\" \").map{|i| i.split(\",\")}\n for i in 0 ... points.size\n point = Point.create(ox: points[i][0].to_f,\n oy: points[i][1].to_f,\n priority: i,\n polygon: polygon\n )\n point.save\n end\n end\n\n format.html { redirect_to @floor, notice: t('flash.floor.create') }\n format.json { render :show, status: :created, location: @floor }\n else\n format.html { render :new }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_mid_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def create\n @salary_range = SalaryRange.new(params[:salary_range])\n\n respond_to do |format|\n if @salary_range.save\n format.html { redirect_to @salary_range, notice: 'Salary range was successfully created.' }\n format.json { render json: @salary_range, status: :created, location: @salary_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @salary_range.errors, status: :unprocessable_entity }\n end\n end\n end",
"def houses\n @request[:property_type] = 'houses'\n self\n end",
"def test_mid_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left' # Forces single front corridor\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_mid_left_one_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_top_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_top_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def floor_params\n params.require(:floor).permit(:building_id, :floor)\n end",
"def test_range_overlap_for_non_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(0.0, segment.send(:range_overlap, 4.0..5.0))\n end",
"def setBoundaries(boundaries)\n @boundaries = boundaries\n end",
"def create\n @arrival_range = ArrivalRange.new(params[:arrival_range])\n\n respond_to do |format|\n if @arrival_range.save\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully created.' }\n format.json { render json: @arrival_range, status: :created, location: @arrival_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def create\n @pharmacy_range = PharmacyRange.new(params[:pharmacy_range])\n\n respond_to do |format|\n if @pharmacy_range.save\n format.html { redirect_to(@pharmacy_range, :notice => 'PharmacyRange was successfully created.') }\n format.xml { render :xml => @pharmacy_range, :status => :created, :location => @pharmacy_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pharmacy_range.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def define_bounds\n\tminLat = 900\n\tminLng = 900\n\tmaxLat = -900\n\tmaxLng = -900\n\t\n\t@locations.map do |location|\n\t\tif location.lat < minLat\n\t\t\tminLat = location.lat\n\t\tend\n\t\tif location.lng < minLng\n\t\t\tminLng = location.lng\n\t\tend\n\t\tif location.lat > maxLat\n\t\t\tmaxLat = location.lat\n\t\tend\n\t\tif location.lng > maxLng\n\t\t\tmaxLng = location.lng\n\t\tend\n\tend\n\t@marker_bounds[\"n\"] = maxLat\n\t@marker_bounds[\"s\"] = minLat\n\t@marker_bounds[\"e\"] = maxLng\n\t@marker_bounds[\"w\"] = minLng\n\t@marker_bounds[\"maxLat\"] = maxLat\n\t@marker_bounds[\"minLat\"] = minLat\n\t@marker_bounds[\"maxLng\"] = maxLng\n\t@marker_bounds[\"minLng\"] = minLng\nend",
"def create\n @fixture = @league.fixture.new(fixture_params)\n\n respond_to do |format|\n if @fixture.home == @fixture.away\n format.html {redirect_to new_fixture_path(league_id: @league)}\n flash[:notice] = \"Home team and away team cannot be the same\"\n \n elsif @fixture.save\n format.html { redirect_to @league, notice: 'Fixture was successfully created.' }\n format.json { render :show, status: :created, location: @fixture }\n\n if @fixture.homegoals > @fixture.awaygoals\n @fixture.home.update_attribute(:MP, @fixture.home.MP + 1)\n @fixture.home.update_attribute(:W, @fixture.home.W + 1)\n @fixture.home.update_attribute(:Pts, @fixture.home.Pts + 3)\n\n @fixture.away.update_attribute(:MP, @fixture.away.MP + 1)\n @fixture.away.update_attribute(:L, @fixture.away.L + 1)\n\n elsif @fixture.homegoals < @fixture.awaygoals\n @fixture.away.update_attribute(:MP, @fixture.away.MP + 1)\n @fixture.away.update_attribute(:W, @fixture.away.W + 1)\n @fixture.away.update_attribute(:Pts, @fixture.away.Pts + 3)\n\n @fixture.home.update_attribute(:MP, @fixture.home.MP + 1)\n @fixture.home.update_attribute(:L, @fixture.home.L + 1)\n else\n @fixture.away.update_attribute(:MP, @fixture.away.MP + 1)\n @fixture.away.update_attribute(:D, @fixture.away.D + 1)\n @fixture.away.update_attribute(:Pts, @fixture.away.Pts + 1)\n\n @fixture.home.update_attribute(:MP, @fixture.home.MP + 1)\n @fixture.home.update_attribute(:D, @fixture.home.D + 1)\n @fixture.home.update_attribute(:Pts, @fixture.home.Pts + 1)\n end\n\n else\n format.html {redirect_to new_fixture_path(league_id: @league)}\n flash[:notice] = @fixture.errors.full_messages.to_sentence\n end\n end\n end",
"def test_top_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def screen_params_for_range_limit\n if (params['range_end'].nil?) ||\n (params['range_start'].nil?) ||\n (params['range_start'].to_i > params['range_end'].to_i)\n render plain: \"Calls to range_limit should have a range_start \" +\n \"and a range_end parameter, and range_start \" +\n \"should be before range_end.\", status: 406\n end\n end"
] | [
"0.6934517",
"0.68359023",
"0.65886587",
"0.55116165",
"0.5449827",
"0.5305369",
"0.5082544",
"0.50723386",
"0.5067619",
"0.50580436",
"0.50201815",
"0.50010294",
"0.49929175",
"0.49878052",
"0.49708432",
"0.4954112",
"0.49523896",
"0.49491084",
"0.49345988",
"0.49335435",
"0.4928445",
"0.49142134",
"0.49101967",
"0.48856503",
"0.48794472",
"0.48666015",
"0.48507547",
"0.48369616",
"0.48314998",
"0.48266935"
] | 0.6978419 | 0 |
PATCH/PUT /property_between_floor_slaps/1 PATCH/PUT /property_between_floor_slaps/1.json | def update
respond_to do |format|
if @property_between_floor_slap.update(property_between_floor_slap_params)
format.html { redirect_to @property_between_floor_slap , notice: 'Property between floor slap was successfully updated.' }
format.json { render :show, status: :ok, location: @property_between_floor_slap }
else
format.html { render :edit }
format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end",
"def update\n @floor = Floor.find(params[:id])\n params[:floor][:location_id] = params[:floor][:loc_id]\n params[:floor].delete :loc_id\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to floors_path, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to @floor, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor.update(floor_params)\n format.html { redirect_to floors_path, notice: I18n.t('floors.update') }\n format.json { render :show, status: :ok, location: @floor }\n else\n format.html { render :edit }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end",
"def update\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n if @location_property.update_attributes(params[:location_property])\n format.html { redirect_to @location_property, notice: 'Location property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to location_path(@location), notice: 'Floor plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor_stage.update(floor_stage_params)\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_stage }\n else\n format.html { render :edit }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@opportunity = Opportunity.find(params[:id])\n #@floor = @opportunity.floor\n #@building = @floor.building\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n flash[:notice] = 'Opportunity was successfully updated.'\n format.html { redirect_to(opportunity_path(@opportunity)) }\n format.xml { head :ok }\n else\n flash[:error] = 'Opportunity could not be updated.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @min_num_bathrooms = args[:min_num_bathrooms] if args.key?(:min_num_bathrooms)\n @min_num_bedrooms = args[:min_num_bedrooms] if args.key?(:min_num_bedrooms)\n end",
"def update\n respond_to do |format|\n if @property_closet.update(property_closet_params)\n format.html { redirect_to @property_closet, notice: 'Property closet was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_closet }\n else\n format.html { render :edit }\n format.json { render json: @property_closet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shooting_range = ShootingRange.find(params[:id])\n\n respond_to do |format|\n if @shooting_range.update_attributes(params[:shooting_range])\n format.html { redirect_to(@shooting_range, :notice => 'Shooting range was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shooting_range.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to @floor_plan, notice: 'Floor plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_plan }\n else\n format.html { render :edit }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to :back, notice: 'Floor plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property_interior_closure.update(property_interior_closure_params)\n format.html { redirect_to @property_interior_closure, notice: 'Property interior closure was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_interior_closure }\n else\n format.html { render :edit }\n format.json { render json: @property_interior_closure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @rectangle = args[:rectangle] if args.key?(:rectangle)\n @strict_restriction = args[:strict_restriction] if args.key?(:strict_restriction)\n end",
"def update\n if @api_v1_property.update(api_v1_property_params)\n render :show, status: :ok, location: @api_v1_property\n else\n render json: @api_v1_property.errors, status: :unprocessable_entity\n end\n end",
"def create\n @property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params)\n\n respond_to do |format|\n if @property_between_floor_slap.save\n format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' }\n format.json { render :show, status: :created, location: @property_between_floor_slap }\n else\n format.html { render :new }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stolen_property.update(stolen_property_params)\n format.html { redirect_to @stolen_property, notice: 'Stolen property was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_property }\n else\n format.html { render :edit }\n format.json { render json: @stolen_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roadmap = Roadmap.find(@roadmap_step.roadmap_id)\n\n respond_to do |format|\n if @roadmap_step.update(roadmap_step_params)\n format.html { redirect_to @roadmap, notice: 'Roadmap step was successfully updated.' }\n format.json { render :show, status: :ok, location: @roadmap_step }\n else\n format.html { render :edit }\n format.json { render json: @roadmap_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wall_plate.update(wall_plate_params)\n format.html { redirect_to @wall_plate, notice: 'Wall plate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wall_plate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @building = args[:building] if args.key?(:building)\n @city = args[:city] if args.key?(:city)\n @floor = args[:floor] if args.key?(:floor)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n @section = args[:section] if args.key?(:section)\n @simple_name = args[:simple_name] if args.key?(:simple_name)\n end",
"def update\n respond_to do |format|\n if @horizontal_property.update(horizontal_property_params)\n format.html { redirect_to @horizontal_property.act, notice: 'Horizontal property was successfully updated.' }\n format.json { render :show, status: :ok, location: @horizontal_property.act }\n else\n format.html { render :edit }\n format.json { render json: @horizontal_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_property.update(line_property_params)\n format.html { redirect_to @line_property, notice: 'Line property was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_property }\n else\n format.html { render :edit }\n format.json { render json: @line_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @bounding_marker = args[:bounding_marker] if args.key?(:bounding_marker)\n @conjoined_category = args[:conjoined_category] if args.key?(:conjoined_category)\n @distance_to_next_lane = args[:distance_to_next_lane] if args.key?(:distance_to_next_lane)\n @flow = args[:flow] if args.key?(:flow)\n @lane_connection = args[:lane_connection] if args.key?(:lane_connection)\n @lane_divider_crossing = args[:lane_divider_crossing] if args.key?(:lane_divider_crossing)\n @lane_follows_segment_begin_fraction = args[:lane_follows_segment_begin_fraction] if args.key?(:lane_follows_segment_begin_fraction)\n @lane_follows_segment_end_fraction = args[:lane_follows_segment_end_fraction] if args.key?(:lane_follows_segment_end_fraction)\n @lane_number = args[:lane_number] if args.key?(:lane_number)\n @lane_token = args[:lane_token] if args.key?(:lane_token)\n @metadata = args[:metadata] if args.key?(:metadata)\n @restriction = args[:restriction] if args.key?(:restriction)\n @shared = args[:shared] if args.key?(:shared)\n @stop_line = args[:stop_line] if args.key?(:stop_line)\n @surface = args[:surface] if args.key?(:surface)\n @type = args[:type] if args.key?(:type)\n @width = args[:width] if args.key?(:width)\n end",
"def update\n respond_to do |format|\n if @floor_ammenity.update(floor_ammenity_params)\n format.html { redirect_to @floor_ammenity, notice: 'Ammenity was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_ammenity }\n else\n format.html { render :edit }\n format.json { render json: @floor_ammenity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n if @mini_map_road.update_attributes(params[:mini_map_road])\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"def update\n respond_to do |format|\n if @property_sector.update(property_sector_params)\n format.html { redirect_to @property_sector, notice: 'Property sector was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_sector }\n else\n format.html { render :edit }\n format.json { render json: @property_sector.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @arrival_range = ArrivalRange.find(params[:id])\n\n respond_to do |format|\n if @arrival_range.update_attributes(params[:arrival_range])\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6611928",
"0.64026827",
"0.6253212",
"0.6180711",
"0.59178376",
"0.58830047",
"0.5867793",
"0.581085",
"0.5779907",
"0.57641405",
"0.5741139",
"0.57381433",
"0.56444305",
"0.5617428",
"0.5576063",
"0.5557531",
"0.5538262",
"0.55241364",
"0.551262",
"0.5512446",
"0.5505184",
"0.5502735",
"0.5500453",
"0.5497089",
"0.5496625",
"0.54917157",
"0.5487882",
"0.5485683",
"0.5484792",
"0.5475621"
] | 0.69383144 | 0 |
DELETE /property_between_floor_slaps/1 DELETE /property_between_floor_slaps/1.json | def destroy
@property_between_floor_slap.destroy
respond_to do |format|
format.html { redirect_to property_between_floor_slaps_url, notice: 'Property between floor slap was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to location_path(@location) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to floors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to floors_url, notice: I18n.t('floors.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_property = LocationProperty.find(params[:id])\n @location_property.destroy\n\n respond_to do |format|\n format.html { redirect_to location_properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_granularity.destroy\n respond_to do |format|\n format.html { redirect_to location_granularities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to @floor.building, notice: t('flash.floor.delete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.photos.delete_all\n @property.features_properties.delete_all\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor_ammenity.destroy\n respond_to do |format|\n format.html { redirect_to floor_ammenities_url, notice: 'Ammenity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to(floors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shooting_range = ShootingRange.find(params[:id])\n @shooting_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(shooting_ranges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @income_loss_house_property.destroy\n respond_to do |format|\n format.html { redirect_to income_loss_house_properties_url, notice: 'Income loss house property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to runner_home_path, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @r_property_definition.destroy\n respond_to do |format|\n format.html { redirect_to r_property_definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_property.destroy\n respond_to do |format|\n format.html { redirect_to line_properties_url, notice: 'Line property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadmap_step.destroy\n respond_to do |format|\n format.html { redirect_to roadmap_steps_url, notice: 'Roadmap step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @horizontal_property.destroy\n respond_to do |format|\n format.html { redirect_to act_path(@act), notice: 'Horizontal property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @area_attribute.destroy\n respond_to do |format|\n format.html { redirect_to area_attributes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_closet.destroy\n respond_to do |format|\n format.html { redirect_to property_closets_url, notice: 'Property closet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n debug('Removing location')\n crm('configure', 'delete', @resource[:name])\n @property_hash.clear\n end",
"def destroy\n @property_detail.destroy\n respond_to do |format|\n format.html { redirect_to property_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor_stage.destroy\n respond_to do |format|\n format.html { redirect_to floor_stages_url, notice: 'Stage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ride_level.destroy\n respond_to do |format|\n format.html { redirect_to ride_levels_url, notice: 'Ride level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcellular_location = SubcellularLocation.find(params[:id])\n @subcellular_location.destroy\n\n respond_to do |format|\n format.html { redirect_to subcellular_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n head :no_content\n end"
] | [
"0.6767104",
"0.6629417",
"0.65859383",
"0.6548821",
"0.65027034",
"0.6496672",
"0.6478902",
"0.64782614",
"0.6418464",
"0.6389761",
"0.63772845",
"0.63682294",
"0.63654083",
"0.63643336",
"0.6358095",
"0.634887",
"0.6343281",
"0.6322753",
"0.6319015",
"0.63171756",
"0.6308039",
"0.62873155",
"0.62790143",
"0.6263358",
"0.625515",
"0.6240062",
"0.6237045",
"0.62345713",
"0.6210892",
"0.62071127"
] | 0.78118306 | 0 |
Unregisters the webhook with Jive | def unregister_webhook
require "open-uri"
require "net/http"
require "openssl"
return if self.add_on.nil? # Can't do it without a token!
return if self.oauth_token.nil? # Can't do it without a token!
uri = URI.parse("#{self.add_on.jive_url}/api/core/v3/webhooks/#{self.webhook_id}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{self.oauth_token.access_token}"
response = http.request(request)
# Need 2XX status code
if !response.code.to_i.between?(200, 299)
errors[:base] << "#{request.inspect} => #{response.body}"
return false
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribe_request_hook(name)\n EasyPost::Hooks.unsubscribe(:request, name)\n end",
"def delete_webhook(target_url)\n Uploadcare::Webhook.delete(target_url)\n end",
"def unsubscribe_response_hook(name)\n EasyPost::Hooks.unsubscribe(:response, name)\n end",
"def unregisterHook\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n #redirect_to :controller=>\"room\", :action=> 'registerHook' #, :params[:registerHook].url => url, :params[:registerHook].token=>token\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n result = am.unregisterHook()\n flash[:result] = \"unregisterHook result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n end",
"def destroy\n @webhook_endpoint.destroy\n respond_to do |format|\n format.html { redirect_to webhook_endpoints_url, notice: 'Webhook endpoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unsubscribe_all_request_hooks\n EasyPost::Hooks.unsubscribe_all(:request)\n end",
"def destroy\n @bitpay_webhook.destroy\n respond_to do |format|\n format.html { redirect_to bitpay_webhooks_url, notice: 'Bitpay webhook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m_webhook.destroy\n respond_to do |format|\n format.html { redirect_to m_webhooks_url, notice: 'M webhook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unsubscribe\n unregister\n end",
"def unregister_stripe_webhook_if_necessary\n return unless previous_changes.include?(:stripe_secret_key)\n\n # secret key was changed\n\n # if we HAD a secret key\n if previous_changes[:stripe_secret_key][0].present?\n domain = default_url_options[:host]\n manager = StripeWebhook::Manager.new(previous_changes[:stripe_secret_key][0], domain)\n manager.unregister_callback\n end\n end",
"def unregister\n user_to_be_removed = @event.users.find(current_user)\n if user_to_be_removed\n @event.users.delete(user_to_be_removed)\n end\n #flash[:notice] = \"Unregistered for #{@event.title}\"\n respond_to do |format|\n format.js\n end\n end",
"def deregister_inbound_handler(handler)\n\t\t@inbound_handlers.delete(handler)\n\tend",
"def unregister\n client.post('/v1/push/deregister', body: {\n uuid: user_id, device_id: id, push_type: type\n })\n end",
"def delete_webhook(id)\n make_json_api_request :delete, \"v2/#{account_id}/webhooks/#{id}\"\n end",
"def un_register\n unless @unregistered\n @unregistered = true\n RightLinkLog.info(\"SEND [un_register]\")\n @amq.fanout('registration', :no_declare => @options[:secure]).publish(@serializer.dump(UnRegister.new(@identity)))\n end\n true\n end",
"def unsubscribe_all_response_hooks\n EasyPost::Hooks.unsubscribe_all(:response)\n end",
"def unregister\n puts \"APN::Device.unregister\"\n http_delete(\"/api/device_tokens/#{self.token}\")\n end",
"def app_uninstalled\n puts(\"yolo\")\n # data = request.body.read\n # # env[\"HTTP_X_SHOPIFY_HMAC_SHA256\"]\n # puts(\"Putsing REQUESTXXXXX\")\n # verified = verify_webhook(data, ENV[\"HTTP_X_SHOPIFY_HMAC_SHA256\"])\n json_obj = request.params.to_json\n # other_obj = request.to_json\n\n # puts(\"inspect\")\n # puts(params.inspect)\n\n puts(\"about to put the request params:\")\n # puts(json_obj)\n # puts(other_obj)\n\n if hmac_valid?(request.raw_post)\n puts(\"Valid hmac!!!\")\n puts(\"Valid hmac!!!2\")\n shop_domain = params['uninstall']['myshopify_domain']\n\n uninstall_call({\"shop_domain\" => shop_domain})\n\n return \"Complete\"\n else\n puts(\"not valid\")\n return head :unauthorized\n end\n end",
"def unsubscribe()\n end",
"def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end",
"def remove(domain, action)\n fail Mailgun::ParameterError('Domain not provided to remove webhook from') unless domain\n fail Mailgun::ParameterError('Action not provided to identify webhook to remove') unless action\n @client.delete(\"domains/#{domain}/webhooks/#{action}\").to_h['message'] == 'Webhook has been deleted'\n rescue Mailgun::CommunicationError\n false\n end",
"def user_cleaned_hook(hook_data)\n unsubscribe_hook(hook_data)\n end",
"def unregister_middleware(key); end",
"def unregister\n @is_registered = false\n self\n end",
"def destroy_omniauth\n return redirect_to root_url unless is_admin\n\n shop_name = current_organization.oauth_uid\n token = current_organization.oauth_token\n current_organization.clear_omniauth\n Shopify::Webhooks::WebhooksManager.queue_destroy_webhooks(current_organization.uid, shop_name, token) unless shop_name.blank? || current_organization.uid.blank? || token.blank?\n\n redirect_to root_url\n end",
"def on_twitter_engine_unregister_user(e, who)\n pre = '<Twitter::Engine>'\n @log.info(\"#{pre} Unregistering user: #{who} (xmpp).\")\n end",
"def delete_webhook\n # find the next sprint using that webhook, and recreate webhook in that sprint.user's name\n # delete webhook if no other sprint is using that webhook\n if webhook\n webhook.sprints.count > 1 ? webhook.sprints.where.not(user: user)[0].post_webhook : webhook.destroy\n end\n user.delete_wh_by_sprint(self)\n end",
"def unsubscribe; end",
"def unsubscribe\n end",
"def destroy\n @registration_request.destroy\n\n head :no_content\n end"
] | [
"0.6840325",
"0.6647022",
"0.64943475",
"0.64802325",
"0.6425156",
"0.6414358",
"0.64120054",
"0.64065605",
"0.63679594",
"0.6276741",
"0.62552524",
"0.62387514",
"0.623862",
"0.62308806",
"0.61917335",
"0.6186117",
"0.6183866",
"0.6099072",
"0.60828346",
"0.6080911",
"0.60728943",
"0.6064133",
"0.6033521",
"0.60170585",
"0.60161984",
"0.59966135",
"0.5994762",
"0.5983008",
"0.5964398",
"0.5954033"
] | 0.7900918 | 0 |
Registers the webhook with Jive | def register_webhook
require "open-uri"
require "net/http"
require "openssl"
uri = URI.parse("#{self.add_on.jive_url}/api/core/v3/webhooks")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
#http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{self.oauth_token.access_token}"
body = {
"callback" => self.callback,
"object" => self.object,
}
body["events"] = self.events if !self.events.to_s.empty?
request.body = body.to_json
response = http.request(request)
# Need 2XX status code
if !response.code.to_i.between?(200, 299)
errors[:base] << "#{request.inspect} => #{response.body}"
return false
end
json_body = JSON.parse(response.body)
self.webhook_id = json_body["id"]
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_webhook(project_id_or_key, name, hook_url, params = {})\n params[:name] = name\n params[:hook_url] = hook_url\n post(\"projects/#{project_id_or_key}/webhooks\", params)\n end",
"def webhook\n @config = ZipMoney::Configuration \n @_webhook = ZipMoney::WebHook if @_webhook.nil?\n @_webhook\n end",
"def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end",
"def webhooks\n @webhooks ||= WebhookRegistry.new\n end",
"def initialize webhook\n @nfe_webhook = @nfe_account.nfe_webhook\n @webhook = webhook\n \n response = update\n end",
"def create\n Webhook.log(params)\n \n render text: \"\\nhello chargify\\n\\n\", layout: false, status: 200, :content_type => 'application/xml'\n\n # respond_to do |format|\n # if @webhook.save\n # format.html { redirect_to @webhook, notice: 'Webhook was successfully created.' }\n # format.json { render json: @webhook, status: :created, location: @webhook }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @webhook.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def webhook\r\n WebhookController.instance\r\n end",
"def create_hook!\n hook = client.create_hook(\n full_name,\n 'web',\n {\n url: Constants::HOOK_URL,\n content_type: 'json'\n },\n {\n events: ['release'],\n active: true\n }\n )\n\n self.github_hook_id = hook.id\n end",
"def send_webhook!(tag)\n response = Net::HTTP.post(\n URI(\"https://webhook.site/b069a239-60dd-47ec-9dba-1f4295639a8d\"),\n { tag: tag.name }.to_json,\n \"Content-Type\": \"application/json\"\n )\n\n raise WebhookError unless response.is_a?(Net::HTTPSuccess)\n end",
"def webhook(request)\n WebHook.new(request, self)\n end",
"def register_webhook!(trigger, name, url)\n trigger = trigger.to_s.camelize(:lower).to_sym\n raise ArgumentError, \"Invalid hook trigger #{trigger}\" unless ALLOWED_HOOKS.include?(trigger)\n if trigger == :function\n response = client.fetch_function(name)\n # if it is either an error (which has no results) or there is a result but\n # no registered item with a URL (which implies either none registered or only cloud code registered)\n # then create it.\n if response.results.none? { |d| d.has_key?(\"url\") }\n response = client.create_function(name, url)\n else\n # update it\n response = client.update_function(name, url)\n end\n warn \"Webhook Registration warning: #{response.result[\"warning\"]}\" if response.result.has_key?(\"warning\")\n warn \"Failed to register Cloud function #{name} with #{url}\" if response.error?\n return response\n else # must be trigger\n response = client.fetch_trigger(trigger, name)\n # if it is either an error (which has no results) or there is a result but\n # no registered item with a URL (which implies either none registered or only cloud code registered)\n # then create it.\n if response.results.none? { |d| d.has_key?(\"url\") }\n # create it\n response = client.create_trigger(trigger, name, url)\n else\n # update it\n response = client.update_trigger(trigger, name, url)\n end\n\n warn \"Webhook Registration warning: #{response.result[\"warning\"]}\" if response.result.has_key?(\"warning\")\n warn \"Webhook Registration error: #{response.error}\" if response.error?\n return response\n end\n end",
"def create_webhook(post_url, include_received_email, events)\n include_received_email = include_received_email ? true : false\n url = \"v2/#{account_id}/webhooks\"\n\n make_json_api_request :post, url, private_generate_resource(\n \"webhooks\",\n {\n \"post_url\" => post_url,\n \"include_received_email\" => include_received_email,\n \"events\" => events\n }\n )\n end",
"def webhook\n\t\tpayload = {event: params, company_id: params[:company_id]}\n\t\tBraintree::WebhookService.new.instrument(payload)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def create\n @m_webhook = MWebhook.new(m_webhook_params)\n\n respond_to do |format|\n if @m_webhook.save\n format.html { redirect_to @m_webhook, notice: 'M webhook was successfully created.' }\n format.json { render :show, status: :created, location: @m_webhook }\n else\n format.html { render :new }\n format.json { render json: @m_webhook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def on(webhook, &block)\n webhooks.on(webhook, &block)\n end",
"def send_incoming_webhook(key, feature, channel_id)\n payload = $redis.get(\"payload:#{key}\")\n if payload.nil?\n payload = {\n :text => \"\"\n }\n attachments = []\n attachments << build_attachment(key, feature)\n payload[:attachments] = attachments\n $redis.setex(\"payload:#{key}\", 60*60*24, payload.to_json)\n else\n payload = JSON.parse(payload)\n end\n payload[:channel] = channel_id\n HTTParty.post(ENV[\"INCOMING_WEBHOOK_URL\"], :body => payload.to_json)\nend",
"def create\n @webhook_endpoint = WebhookEndpoint.new(webhook_endpoint_params)\n\n respond_to do |format|\n if @webhook_endpoint.save\n format.html { redirect_to @webhook_endpoint, notice: 'Webhook endpoint was successfully created.' }\n format.json { render :show, status: :created, location: @webhook_endpoint }\n else\n format.html { render :new }\n format.json { render json: @webhook_endpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def create_webhook(channel_id, name: :undef, avatar: :undef)\n avatar_data = if avatar != :undef && !avatar.nil?\n \"data:#{avatar.content_type};base64,#{Base64.encode64(avatar.io.read)}\"\n else\n :undef\n end\n json = filter_undef({ name: name, avatar: avatar_data })\n route = Route.new(:POST, '/channels/%{channel_id}/webhooks', channel_id: channel_id)\n request(route, json: json)\n end",
"def add_hook(url)\n post(\"/hooks\", :body => {:url => url})\n end",
"def set_webhook\n @webhook = Webhook.find(params[:id])\n end",
"def set_webhook\n @webhook = Webhook.find(params[:id])\n end",
"def create(domain, action, url = '')\n res = @client.post(\"domains/#{domain}/webhooks\", id: action, url: url)\n res.to_h['webhook']['url'] == url && res.to_h['message'] == 'Webhook has been created'\n end",
"def create\n if !valid_signatures?\n render json: { message: \"Invalid sigs\" }, status: 400\n return\n end\n #idempotent\n if !WebhookEvent.find_by(source: params[:source], external_id: external_id).nil?\n render json: { message: \"Already processed #{ external_id }\"}\n return\n end\n\n event = WebhookEvent.create(webhook_params)\n ProcessEventsJob.perform_later(event.id) \n render json: params\n end",
"def webhook url\n @webhook_uri = url\n end",
"def send_webhook\n config = Rails.application.config_for(:webhooks)\n\n return unless config.webhooks\n\n config.webhooks.each do |_k, webhook|\n next if webhook.nil?\n\n url = URI(webhook)\n headers = { 'content-type' => 'application/json' }\n payload = {\n 'job_id' => id,\n 'job_type' => kind,\n 'status' => status,\n 'results' => results.count\n }.to_json\n res = Net::HTTP.post(URI(url), payload, headers)\n\n res.code\n end\n end",
"def create_webhook(target_url, event: 'file.uploaded', is_active: true, signing_secret: nil)\n options = { target_url: target_url, event: event, is_active: is_active, signing_secret: signing_secret }\n Uploadcare::Webhook.create(**options.compact)\n end",
"def create_webhook(access_token:, events:)\n client(token: access_token).post(\n 'v1/webhooks',\n {\n url: \"#{ENV['APP_URL']}/webhooks\",\n events: events\n }.to_json\n )\n end",
"def create\n @hook = Hook.new(params[:hook])\n @hook.save\n respond_with(@hook)\n end",
"def create(id, url=default_webhook_url)\n params = {:id => id, :url => url}\n Mailgun.submit :post, webhook_url, params\n end"
] | [
"0.6617718",
"0.656444",
"0.65150595",
"0.64781016",
"0.64551556",
"0.6398318",
"0.63663626",
"0.63569754",
"0.63287765",
"0.63153994",
"0.6296852",
"0.6244124",
"0.62091345",
"0.61630535",
"0.6134478",
"0.61271334",
"0.6125525",
"0.6123998",
"0.6104226",
"0.6083307",
"0.60763174",
"0.60763174",
"0.6062172",
"0.606017",
"0.6048484",
"0.60398114",
"0.6007024",
"0.5992883",
"0.5989739",
"0.59872854"
] | 0.8315143 | 0 |
Refresh one feed source and return the updated feed items | def refresh
FeedSource.find(params[:feed_source_id]).refresh
feed_sources = params[:feed_sources]
@feed_source_titles = {}
FeedSource.find(feed_sources).each { |source| @feed_source_titles[source.id] = source.title}
@feed_items = FeedItem.where("feed_source_id IN (?)", feed_sources).order(pub_date: :desc).limit(20).offset(0)
@feed_items = @feed_items.sort_by{ |item| item.pub_date.to_i }.reverse
render :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_feed(feed)\n FeedRefreshManager.refresh feed, self\n end",
"def refresh\n Feed.update_all\n # @feeds = Feed.all\n # feed_array = []\n # @feeds.each do |f|\n # EntryFeed.create_from_feed(f)\n # end\n\n redirect_to blogs_path\n flash[:notice] = \"Blogs successfully updated\"\n end",
"def feed_items(feed_title) \n # update last_viewed_at \n @client.query \"UPDATE feeds SET last_viewed_at = now() where title = '#{e feed_title}'\"\n query = \"SELECT items.title, guid, feed, feed_title, pub_date, word_count, starred, unread from items where items.feed_title = '#{e feed_title}' order by pub_date asc\"\n @client.query(query)\n end",
"def refresh\n # FIXME\n end",
"def update\n @feed = current_user.feeds.find params[:id]\n current_user.refresh_feed @feed\n\n head :ok\n rescue => e\n handle_error e\n end",
"def refresh\n fetch_api_data\n self\n end",
"def feed!\n http_fetch(feed_url)\n end",
"def update_from_feed(auth_feed=nil)\n # If there are existing entries, then create a feed \n # object using the most recent entry's data and use Feedzirra's update method\n # to only fetch those new entries\n if entries.any?\n feed = Feedzirra::Feed.update(create_feed_for_update)\n add_entries(feed.new_entries) if valid_parse_result(feed) && !feed.is_a?(Array) && feed.updated?\n else\n # Fetch whole feed (may not be entire feed - depends on source)\n feed = auth_feed || Feedzirra::Feed.fetch_and_parse(feed_url_s)\n # Can return error status code on parse error\n add_entries(feed.entries) if valid_parse_result(feed)\n end\n # Save latest feed attributes for updates\n if valid_parse_result(feed)\n update_attributes(:etag => feed.etag, :last_modified => feed.last_modified, :feed_url_s => feed.feed_url)\n end\n end",
"def refresh(force=false)\n # check headers and etag and last modified\n raise \"Missing feed_url\" if feed_url.nil?\n ff = Feedbase::FetchFeed.new(feed_url)\n headers = ff.headers\n if !force \n if last_etag && (headers[:etag] == last_etag)\n puts \"-- #{feed_url} -- ETag cache hit\"\n return\n end\n end\n data = ff.fetch \n params = data[:feed_params].merge(:alpha_title => make_alpha_title(data[:feed_params][:title])) \n if params[:feed_url] != self[:feed_url]\n if x = self.class.filter(:feed_url => params[:feed_url]).first\n raise Redirected.new(\"Redirected to existing feed: #{x.feed_url}\")\n end\n end\n params.delete(:feed_url) \n begin Sequel::DatabaseError\n update params\n rescue StandardError # PGError\n puts \"The offending record is #{self.inspect}\"\n raise\n end\n\n Feedbase::FeedDownload.create({feed_id: feed_id}.merge(data[:download_params])) \n items_created = data[:items].\n select {|item| Feedbase::Item[:guid => item[:guid]].nil?}.\n map { |item|\n params = {\n feed_id: feed_id,\n title: item[:title].encode(\"utf-8\"), \n guid: item[:guid], \n link: item[:link],\n content: item[:content],\n author: item[:author],\n word_count: item[:word_count],\n pub_date: item[:pub_date]\n }\n Feedbase::Item.create params\n }\n # caller can extract an item count from this\n items_created\n end",
"def update_from_feed()\n\t\t\n\t@links = Link.all \n\n\t@links.each do |link| \n\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(link.url)\n\n\t\tputs \"pulling feeds\"\n\t\tfeed.entries.each do |entry|\n\n\t\t\tif entry.published > link.updated_at\n\n\t\t\t\tif entry.url =~ /^#{URI::regexp}$/\n\t\t\t\t\tfind_keywords(entry.url, link.tags)\n\t\t\t\t\tputs entry.url\t\n\t\t\t\telse\n\t\t\t\t\tputs \"bad url\"\n\t\t\t\t\tputs entry.url\t\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\tend\n\t\tend\n\n\tend\n\nend",
"def refresh\n load if changed?\n end",
"def refresh\n do_refresh\n end",
"def refresh\n do_refresh\n end",
"def refresh\n response = Clever.request :get, url\n refresh_from response[:data]\n self\n end",
"def update!\n raise(RuntimeError, \"can't fetch without a uri.\") unless @uri\n\n res = @http.get(@uri, \"Accept\" => \"application/atom+xml\")\n\n if @etag and res['etag'] == @etag\n # we're already all up to date\n return self\n elsif res.code == \"410\"\n raise Atom::FeedGone, \"410 Gone (#{@uri})\"\n elsif res.code != \"200\"\n raise Atom::HTTPException, \"Unexpected HTTP response code: #{res.code}\"\n end\n\n # we'll be forgiving about feed content types.\n res.validate_content_type([\"application/atom+xml\",\n \"application/xml\",\n \"text/xml\"])\n\n @etag = res[\"ETag\"] if res[\"ETag\"]\n\n xml = res.body\n\n coll = REXML::Document.new(xml)\n\n update_el = REXML::XPath.first(coll, \"/atom:feed/atom:updated\", { \"atom\" => Atom::NS } )\n\n # the feed hasn't been updated, don't do anything.\n if update_el and self.updated and self.updated >= Time.parse(update_el.text)\n return self\n end\n\n coll = self.class.parse(coll.root, self.base.to_s)\n merge! coll\n\n if abs_uri = next_link\n @next = self.class.new(abs_uri.to_s, @http)\n end\n\n if abs_uri = previous_link\n @prev = self.class.new(abs_uri.to_s, @http)\n end\n\n self\n end",
"def update!\n # Don't do anything if this option is set\n return if self.configurations[:disable_update_from_remote]\n\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n FeedTools.feed_cache.initialize_cache()\n end\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n raise \"Your feed cache system is incorrectly set up. \" +\n \"Please see the documentation for more information.\"\n end\n if self.http_headers.blank? && !(self.cache_object.nil?) &&\n !(self.cache_object.http_headers.nil?)\n @http_headers = YAML.load(self.cache_object.http_headers)\n @http_headers = {} unless @http_headers.kind_of? Hash\n elsif self.http_headers.blank?\n @http_headers = {}\n end\n if self.expired? == false\n @live = false\n else\n load_remote_feed!\n \n # Handle autodiscovery\n if self.http_headers['content-type'] =~ /text\\/html/ ||\n self.http_headers['content-type'] =~ /application\\/xhtml\\+xml/\n\n autodiscovered_url = nil\n ['atom', 'rss', 'rdf'].each do |type|\n autodiscovered_url =\n FeedTools::HtmlHelper.extract_link_by_mime_type(self.feed_data,\n \"application/#{type}+xml\")\n break unless autodiscovered_url.nil?\n end\n \n if autodiscovered_url != nil\n begin\n autodiscovered_url = FeedTools::UriHelper.resolve_relative_uri(\n autodiscovered_url, [self.href])\n rescue Exception\n end\n if self.href == autodiscovered_url\n raise FeedAccessError,\n \"Autodiscovery loop detected: #{autodiscovered_url}\"\n end\n self.feed_data = nil\n \n self.href = autodiscovered_url\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(autodiscovered_url)\n end\n self.update!\n else\n html_body = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"html/body\"\n ])\n if html_body != nil\n raise FeedAccessError,\n \"#{self.href} does not appear to be a feed.\"\n end\n end\n else\n ugly_redirect = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"redirect/newLocation/text()\"\n ], :select_result_value => true)\n if !ugly_redirect.blank?\n if self.href == ugly_redirect\n raise FeedAccessError,\n \"Ugly redirect loop detected: #{ugly_redirect}\"\n end\n self.feed_data = nil\n self.href = ugly_redirect\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(ugly_redirect)\n end\n self.update!\n end\n end\n \n # Reset everything that needs to be reset.\n @xml_document = nil\n @encoding_from_feed_data = nil\n @root_node = nil\n @channel_node = nil\n @id = nil\n @title = nil\n @subtitle = nil\n @copyright = nil\n @link = nil\n @time_to_live = nil\n @entries = nil\n \n if self.configurations[:lazy_parsing_enabled] == false\n self.full_parse()\n end\n end\n end",
"def refresh\n response = Clever.request :get, url, nil, headers\n refresh_from response[:data]\n\n @links = response[:links].map do\n |link| { :\"#{link[:rel]}\" => link[:uri] }\n end.reduce({}, :merge)\n self\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def cache_feeds\n puts \"Caching feeds... (can be slow)\"\n feeds = Conf.feeds.map do |uri|\n # silly to need this, but if the feed fails to fetch,\n # don't kill the ruby thread ...\n begin\n feed = FeedTools::Feed.open( uri )\n { :uri => uri, :title => feed.title, \n :items => feed.items.map { |item| { :title => item.title, :author => item.author.name, :published => item.published, :link => item.link } } }\n rescue FeedTools::FeedAccessError\n puts uri\n next\n end\n end\n feeds.each { |feed|\n new = CachedFeed.find_or_initialize_by_uri( feed[:uri] )\n new.parsed_feed = feed\n new.save!\n }\n end",
"def feed\n @feeddata\n end",
"def refresh\n do_refresh\n self\n end",
"def refresh\n @data = read_data\n end",
"def refresh \n @result, @processedMovies, @errors = Movie.refresh_listings\n end",
"def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end",
"def refresh\n end",
"def update_from_feed(feed_url)\n\t\tputs \"pulling feeds\"\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(feed_url)\n\t\t# feed.last_modified - if it's been modified since last time\n\t\tfeed.entries.each do |entry|\n\t\t\t# if the post occured after it was last checked\n\t\t\tfind_keywords(entry.url)\n\t\t\tputs entry.url\n\t\t\t# call the keyword check and save on the actual post url\t\n\t\tend\nend",
"def index\n @feed_sources = FeedSource.all\n end",
"def refresh_all\n success_count = 0\n error_count = 0\n Topic.find_all_external.each do |topic|\n permalink = topic.permalink\n begin\n refresh_topic(topic)\n success_count += 1\n rescue\n log.error \"Error refreshing news for '#{permalink}': #{$!}\"\n error_count += 1\n end\n end #each\n if error_count > 0\n STDERR.puts \"*** #{error_count} errors occurred while refreshing \" +\n \"the news data.\"\n STDERR.puts \"See the intranet log for details.\"\n end #if\n log.info \"#{success_count} news topics were updated successfully.\"\n end",
"def refresh!\n load if changed?\n end"
] | [
"0.73419046",
"0.6547046",
"0.6506305",
"0.6465421",
"0.64161277",
"0.6409836",
"0.6389569",
"0.6370014",
"0.63508123",
"0.63415533",
"0.6319646",
"0.6308639",
"0.6308639",
"0.6303377",
"0.62841046",
"0.62739736",
"0.6230807",
"0.6220272",
"0.6220272",
"0.6210587",
"0.61971664",
"0.6152941",
"0.615167",
"0.61497784",
"0.61359155",
"0.6120495",
"0.61023414",
"0.60840863",
"0.60592896",
"0.60578537"
] | 0.82401633 | 0 |
Store page title options that are used on I18n interpolation. | def page_title_options
@page_title_options ||= {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title=(t)\n @options[:title] = t\n end",
"def page_title(options = {})\n return \"\" if @page.title.blank?\n\n options = {\n prefix: \"\",\n suffix: \"\",\n separator: \"\"\n }.update(options)\n title_parts = [options[:prefix]]\n title_parts << if response.status == 200\n @page.title\n else\n response.status\n end\n title_parts << options[:suffix]\n title_parts.reject(&:blank?).join(options[:separator]).html_safe\n end",
"def title\n options.fetch(:title)\n end",
"def render_page_title options={}\n default_options = {\n :prefix => \"\",\n :seperator => \"|\"\n }\n default_options.update(options)\n unless current_page.title.blank?\n h(\"#{default_options[:prefix]} #{default_options[:seperator]} #{current_page.title}\")\n else\n h(\"\")\n end\n end",
"def page_title\n if @title.present?\n I18n.t('page_title', :page_title => @title, :blog_title => blog_title)\n else\n I18n.t('home_title', :blog_title => blog_title)\n end\n end",
"def page_title!(title)\n @_page_title = title\n end",
"def set_page_title(title)\n @page_title = title\n end",
"def title\n return @options[:title]\n end",
"def page_title(value = nil, default: true, **opt)\n @page_title = nil if opt.present?\n @page_title = page_value(value, **opt) if value\n @page_title ||= page_value(:title, **opt, default: default)\n end",
"def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end",
"def set_page_title(title, opts={})\n @page_title = title\n @page_title_override = title if opts[:override]\n @_no_auto_title = true if opts[:no_auto_title]\n end",
"def set_titles\n DynamicUrl.all.each do |url|\n if request.host == url.url\n @title = url.title\n @subtitle = url.subtitle\n end\n end\n\n # set default title if title could not be fetched\n @title ||= MySettings.title\n @subtitle ||= MySettings.subtitle\n end",
"def title(page_title)\n content_for(:title) do\n \"#{page_title} - #{MySettings.company_full_name}\"\n end\n end",
"def set_page_title(title)\n\t\t@page_title = @current_action.titleize + title\n\tend",
"def title(page_title, show_title: true)\n content_for(:title) { h(page_title.to_s) }\n @show_title = show_title\n end",
"def page_title(title=nil)\n # DEPRECATED: setting title\n if title\n page_title!(title)\n else\n @_page_title\n end\n end",
"def title(value = nil)\n value ? options[:title] = value : options[:title]\n end",
"def title=(title)\n title = nil unless title.present?\n settings.title = title\n end",
"def page_title\n @page_title || TaliaCore::SITE_NAME\n end",
"def page_title(title = nil)\n if title\n content_for(:page_title) { title }\n else\n content_for?(:page_title) ? content_for(:page_title) : APP_CONFIG[:site_name] # or a hard-coded default\n end\n end",
"def title(page_title, show_title = true)\n content_for(:title) { h(page_title.to_s) }\n @show_title = show_title\n end",
"def page_title=(title)\n @content_for_page_title = title\n end",
"def set_page_title(hash, order = nil, type = :title)\n @page_title = page_meta_string_builder(type, hash, order)\n end",
"def title(title, global=true)\n global ? (before << \"Backend.app.setTitle(#{title.to_json});\") : config[:title] = title\n end",
"def title\n @title ||= Utilities.longest_common_substring_in_array(titles.values) \n @title = titles[:og_title] unless title_ok?\n @title = titles[:html_title] unless title_ok?\n @title = titles[:from_doc] unless title_ok?\n\n @title\n end",
"def page_meta_title(value = nil, default: true, **opt)\n @page_meta_title = nil if opt.present?\n @page_meta_title = page_value(value, **opt) if value\n @page_meta_title ||= page_value(:label, **opt, default: default)\n end",
"def title(page_title)\n\t\t\tmode = \"[DEV] \" unless ::Rails.env.production?\n\t\t\tcontent_for(:title) { mode.to_s + page_title + \" | \" }\n\t\tend",
"def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend",
"def page_title\n title = \"Amplify\"\n title.prepend(\"#{@page_title} | \") if @page_title\n title\n end",
"def title=(title)\n title = nil if title.blank?\n @settings.title = title\n end"
] | [
"0.731271",
"0.73069143",
"0.7233398",
"0.72106487",
"0.716158",
"0.7127059",
"0.709165",
"0.7079146",
"0.7051273",
"0.7026661",
"0.69825894",
"0.6956374",
"0.68932176",
"0.6877517",
"0.68723416",
"0.6852441",
"0.68501896",
"0.68482125",
"0.6831096",
"0.67903167",
"0.6788046",
"0.6786792",
"0.67839396",
"0.6774203",
"0.67703056",
"0.67603725",
"0.6753015",
"0.6752929",
"0.6743295",
"0.6729598"
] | 0.84882396 | 0 |
Override in the subclass to provide a place to do initialization of game logic, load files, set up state, etc | def game_setup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @tileset = Gosu::Image.load_tiles(\"media/tileset.png\", TILE_WIDTH, TILE_HEIGHT, tileable: true)\n\n # Load images here so they will only be loaded once per game\n @enemyAnimation = *Gosu::Image.load_tiles(\"media/enemy_char.png\", Enemy::WIDTH, Enemy::HEIGHT)\n @portalAnimation = *Gosu::Image.load_tiles(\"media/portal.png\", Portal::WIDTH, Portal::HEIGHT)\n @diamondImg = Gosu::Image.new(\"media/diamond.png\")\n\n # Load all the stages in to an array\n @stages = Dir.glob('stages/*').select { |e| File.file? e }\n @finalStage = false\n end",
"def initialize(*args)\n super\n @game = Game.new\n\n @changelog = self.load_changelog\n\n @mods = config[:mods]\n @channel_name = config[:channel]\n @settings_file = config[:settings]\n @games_dir = config[:games_dir]\n\n @idle_timer_length = config[:allowed_idle]\n @invite_timer_length = config[:invite_reset]\n\n @idle_timer = self.start_idle_timer\n\n @game_timer_minutes = nil\n @game_timer = nil\n end",
"def initialize\n\t \t# loading or not loading should be the key here.\n end",
"def initialize()\n original_dir = Dir.pwd\n Dir.chdir(__dir__)\n\n classes_before = ObjectSpace.each_object(Class).to_a\n Dir[\"../model/game/*\"].each {|file|\n require_relative file\n }\n Dir.chdir(original_dir)\n\n classes_after = ObjectSpace.each_object(Class).to_a\n @modes_loaded = classes_after - classes_before\n\n @game_started = false\n @observer_views = []\n @players = []\n @clients_players = Hash.new\n @board = nil\n @clients_board = nil\n @player_playing = nil\n @clients_player_playing_index = nil\n @AI_players = 0\n # http://docs.ruby-lang.org/en/2.0.0/Hash.html\n @game_history = Hash.new(-1)\n @turn = 1\n @online_mode = false\n @player_name = nil\n @player_id = 1\n @save_requests_received = Hash.new(0)\n @turn_which_save_was_requested = -1\n @continuing_game = false\n end",
"def initialise(loadfile)\n\n # Initialise steps\n\n phases = Phases.new\n $commands = Commands.new\n \n if $testing == 1\n require_relative 'Testing.rb'\n require_relative '../Extra/Parser.rb'\n end\n \n if $debugplay == 1\n $debug.debugplay\n end\n \n # Initialise graphics if graphics mode is on\n #if $graphics == 1\n #require 'RMagick'\n require_relative '../Graphics/GraphicsHandler.rb'\n #graphicsinit\n #end\n \n #system(\"unzip ../Resources/Images.zip\")\n \n \n # Load game\n if $loadgame == true\n loadgame(loadfile)\n end\n \n # Set command authentication levels\n IO.foreach(\"cards.txt\") { |line| puts line }\n \nend",
"def initialize_game\n setup_boards\n end",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def initialize \n # Keep track of hooks and what object owns what\n @hooks = {}\n @cmds = {}\n @modules = {}\n\n # Prevent access to hooks when other things are\n # editing or using them.\n @hooks_mutex = Mutex.new\n end",
"def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end",
"def on_init; end",
"def on_init; end",
"def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end",
"def post_init\n end",
"def load_game\n require './game/setup.rb'\n end",
"def initialize(parent_wnd)\r\n super(parent_wnd)\r\n \r\n @core_game = nil\r\n @splash_name = File.join(@resource_path, \"icons/mariazza_title_trasp.png\")\r\n @algorithm_name = \"AlgCpuMariazza\" \r\n #core game name (created on base class)\r\n @core_name_class = 'CoreGameMariazza'\r\n \r\n # game commands\r\n @game_cmd_bt_list = []\r\n\r\n ## NOTE: don't forget to initialize variables also in ntfy_base_gui_start_new_game\r\n end",
"def initialize\n @imgs = {}\n @global_imgs = {}\n @tilesets = {}\n @global_tilesets = {}\n @sounds = {}\n @global_sounds = {}\n @songs = {}\n @global_songs = {}\n @fonts = {}\n @global_fonts = {}\n\n @prefix = File.expand_path(File.dirname($0)) + '/data/'\n @img_dir = 'img/'\n @tileset_dir = 'tileset/'\n @sound_dir = 'sound/'\n @song_dir = 'song/'\n @font_dir = 'font/'\n @separator = '_'\n @retro_images = false\n end",
"def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end",
"def initialize!\n $sfxengine = SoundEngine.new\n\n GameMode.enter_name_input =\n Text.new(\n Settings.winX/2,\n Settings.winY/2,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"\")\n GameMode.enter_name_headline =\n Text.new(\n Settings.winX/2,\n Settings.winY*0.35,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"enter name\")\n\n GameMode.fader = Rect.new(0, 0, Settings.winX, Settings.winY)\n GameMode.fader.colors = ColorList.new(4) { |i| Color.new(0, 0, 0, 0.8) }\n\n @ingame_timer = Timer.new\n @external_timer = Timer.new\n @engine_running = true\n @score_object = Score.new\n\n $gfxengine.prepare # TODO put to end, remove things mouse depends on!\n @mouse = Mouse.new(100, 100, Settings.mousedef)\n @score_object.cur_level = 0\n start_level @score_object.cur_level\n @textbuffer = \"\"\n GameMode.set_mode(GameMode::NORMAL)\n end",
"def run_init_script; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def loadGame()\n\nend",
"def Init()\n end",
"def post_init\n\tend",
"def post_init\n end",
"def at_init\n\n\t\tend",
"def init\n\t\t## Pathfind\n\t\t#@pathfind = Pathfind.new\n\n\t\t## Add player\n\t\t@player = Player.new #spawn: @room.get_spawn\n\n\t\t## Song controller\n\t\t@song = SongController.new\n\n\t\t## Only load one level\n\t\t@level = load_level @level_name\n\n\t\t#@room = @levels[@level_name].rooms.first unless (@levels[:first].nil?)\n\t\t@room = @level.get_room @room_name\n\t\t@player.move_to_spawn @room.get_spawn\n\n\t\tputs \"Level: #{@level.name}\"\n\t\tputs \" Room: #{@room.name}\"\n\t\tputs \"INSTANCE_COUNT:\\n\\tsolid:\\t\\t#{@room.instances[:solid].size}\"\n\t\tputs \"\\tpassable:\\t#{@room.instances[:passable].size}\"\n\n\t\t## Init Pathfinder\n\t\t#@pathfind.pathfind_init\n\t\t## Add Solid blocks to pathfind grid (bootstrap it)\n\t\t#@pathfind.add_solids @room.get_instances(:solid)\n\n\t\ttracker0 = Tracker.new pos: @player.pos, track: @player\n\t\ttracker1 = Tracker.new pos: @player.pos, track: tracker0\n\t\ttracker2 = Tracker.new pos: @player.pos, track: tracker1\n\t\ttracker3 = Tracker.new pos: @player.pos, track: tracker2\n\t\ttracker4 = Tracker.new pos: @player.pos, track: tracker3\n\t\ttracker5 = Tracker.new pos: @player.pos, track: tracker4\n\n\t\t@entities = [\n\t\t\t@player,\n\t\t\tEnemy.new,\n\t\t\ttracker0, tracker1, tracker2, tracker3, tracker3, tracker4, tracker5\n\t\t]\n\n\t\t## Move camera to player\n\t\t$camera.center_on x: @player.pos(:x), y: @player.pos(:y)\n\n\t\t## Font for FPS display\n\t\t@font_fps = Gosu::Font.new 32\n\n\t\t## For consequtive updating of entities, instead of all at once\n\t\t#@update_entity_index = 0\n\tend",
"def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end"
] | [
"0.7197501",
"0.6927094",
"0.68548703",
"0.68363637",
"0.67903966",
"0.6709493",
"0.6681035",
"0.66754824",
"0.6657464",
"0.6593433",
"0.6593433",
"0.6568565",
"0.6536359",
"0.6532853",
"0.65298796",
"0.6522084",
"0.6518121",
"0.6491702",
"0.64911246",
"0.64601445",
"0.64601445",
"0.64601445",
"0.64601445",
"0.6441526",
"0.6423529",
"0.6421361",
"0.64070183",
"0.63972855",
"0.63967264",
"0.6387362"
] | 0.7465463 | 0 |
Called on an instance of the subclass, this will run the game_setup method and then begin the show loop on the delegate | def game_start
game_setup
@console_delegate.show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_setup\n end",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def viewDidLoad \n super\n self.new_game \n self.init_views\n\n end",
"def run\n game = Game.new\n game.game_start\nend",
"def run\r\n @log.debug \"Run the tester...\"\r\n @dlg_box = CupSingleGameWin.new(@options)\r\n @dlg_box.create\r\n end",
"def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend",
"def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend",
"def beginGameLoop\n @gameLoop.play\n end",
"def run\n start_game\n game_loop\n end_game\n end",
"def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end",
"def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end",
"def game_loop\n end",
"def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def start\n main_loop\n end",
"def start\n # start a new game using @config\n end",
"def main\n raise 'You forgot to call super in initialize of your scene' unless @object_to_dispose\n # Store the last scene and store self in $scene\n @__last_scene = $scene if $scene != self\n $scene = self\n yield if block_given? # Ensure we call the on_scene_switch in call_scene\n # Tell the interface is running\n @running = true\n # Main processing\n main_begin\n main_process\n main_end\n # Reset $scene unless it was already done\n $scene = @__last_scene if $scene == self\n Scheduler.start(:on_scene_switch, self.class)\n end",
"def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\t@screen.flip()\n end\n end",
"def play\n\t\tgame_loop\n\tend",
"def setup_display\n gameboard.build_display\n build_white_side\n build_black_side\n end",
"def game_loop\n end",
"def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend",
"def play\n \n end",
"def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end",
"def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end",
"def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end",
"def play\n #calls to all the methods that produce game!\n end",
"def run \n Engine::play(Beginning)\nend",
"def start_run\n # Abstract\n end",
"def start_run\n # Abstract\n end"
] | [
"0.68360984",
"0.6639908",
"0.6451325",
"0.62993324",
"0.61970586",
"0.6163759",
"0.6157443",
"0.6131971",
"0.6095512",
"0.6061154",
"0.6006015",
"0.60039425",
"0.5999125",
"0.5988099",
"0.5987031",
"0.59720844",
"0.59613466",
"0.59466904",
"0.5942263",
"0.59374255",
"0.5935373",
"0.5887371",
"0.58749026",
"0.5868839",
"0.585444",
"0.5838807",
"0.58384335",
"0.5825603",
"0.5811942",
"0.5811942"
] | 0.77794194 | 0 |
Gets the chat property value. The chat between the user and Teams app. | def chat
return @chat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chat_info\n return @chat_info\n end",
"def chat\n @_chat || payload && payload['chat']\n end",
"def chat=(value)\n @chat = value\n end",
"def chat\n @_chat ||=\n if payload\n if payload.is_a?(Hash)\n payload['chat'] || payload['message'] && payload['message']['chat']\n else\n payload.try(:chat) || payload.try(:message).try!(:chat)\n end\n end\n end",
"def chat_id\n return @chat_id\n end",
"def chat_id\n return @chat_id\n end",
"def chat_type\n return @chat_type\n end",
"def chat_display_name\n return @chat_display_name\n end",
"def chat_info=(value)\n @chat_info = value\n end",
"def chat_id=(value)\n @chat_id = value\n end",
"def chat_id=(value)\n @chat_id = value\n end",
"def set_chat\n @chat = Chat.get_one(params[:app_token], params[:number])\n end",
"def chat_type=(value)\n @chat_type = value\n end",
"def conversation_member_user\n return @conversation_member_user\n end",
"def conversation_person\n\t\treturn nil unless (mode? :conversation)\n\t\treturn @talking_to\n\tend",
"def set_chat\n @chat = @application.chats.find_by!(number: params[:id])\n end",
"def chat_params\n params[:chat]\n end",
"def property_conversation property, account\n # super\n unless valid_conversation_target? account\n raise ArgumentError, \"Account must be a tenant or system account, was: #{account}\"\n end\n conversations_about(property).find_for(account).first\n end",
"def conversation_id\n return @conversation_id\n end",
"def conversation_id\n return @conversation_id\n end",
"def teamchat?\n return @teamchat\n end",
"def has_chatter=(value)\n @has_chatter = value\n end",
"def property_conversations\n @property_conversations ||= sender.conversations_about(property)\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end"
] | [
"0.71748775",
"0.7054701",
"0.7045065",
"0.7031462",
"0.7023305",
"0.7023305",
"0.67733926",
"0.6639497",
"0.6575313",
"0.6302959",
"0.6302959",
"0.6287643",
"0.5960013",
"0.5855995",
"0.5847797",
"0.58272797",
"0.57949525",
"0.57499456",
"0.57348585",
"0.57348585",
"0.5711575",
"0.5625744",
"0.55913454",
"0.5562799",
"0.5562799",
"0.5562799",
"0.5562799",
"0.5562799",
"0.5562799",
"0.5562799"
] | 0.7338721 | 0 |
Sets the chat property value. The chat between the user and Teams app. | def chat=(value)
@chat = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_chat\n @chat = Chat.get_one(params[:app_token], params[:number])\n end",
"def set_chat\n @chat = @application.chats.find_by!(number: params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def chat_info=(value)\n @chat_info = value\n end",
"def chat_id=(value)\n @chat_id = value\n end",
"def chat_id=(value)\n @chat_id = value\n end",
"def set_chat\n @chat = Chat.find(params[:id])\n end",
"def chat_type=(value)\n @chat_type = value\n end",
"def set_chat_message\n @chat_message = ChatMessage.find(params[:id])\n end",
"def set_chat_room\n @chat_room = current_user.chat_rooms.find(params[:id])\n \n end",
"def set_chat_room\n @chat_room_user = ChatRoomUser.find(chat_room_user_params)\n end",
"def set_smpl_chat\n @smpl_chat = SmplChat.find(params[:id])\n end",
"def set_chat\n @chat_room = ChatRoom.find(params[:id])\n end",
"def has_chatter=(value)\n @has_chatter = value\n end",
"def chat\n @_chat || payload && payload['chat']\n end",
"def set_chatroom\n @chatroom = Chatroom.find(params[:chatroom_id])\n end",
"def set_coffee_chat\n @coffee_chat = CoffeeChat.find(params[:id])\n end",
"def set_direct_chat\n @direct_chat = DirectChat.find(params[:id]) rescue nil\n return res_with_error(\"Chat not found\", :not_found) unless @direct_chat\n end",
"def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end",
"def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end"
] | [
"0.75856173",
"0.7266743",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.7255754",
"0.71931034",
"0.7139131",
"0.7139131",
"0.7018493",
"0.6961826",
"0.67970365",
"0.6774398",
"0.66801286",
"0.6664401",
"0.66429245",
"0.6637469",
"0.65708447",
"0.65598893",
"0.6543329",
"0.65381527",
"0.64922804",
"0.64922804"
] | 0.8534229 | 0 |
Instantiates a new userScopeTeamsAppInstallation and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.userScopeTeamsAppInstallation"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize\n @initted = false\n @h_steam_user = @@dll_SteamAPI_GetHSteamUser.call\n return if (@steam_user_stats = @@dll_SteamInternal_FindOrCreateUserInterface.call(@h_steam_user, STEAMUSERSTATS_INTERFACE_VERSION)) == 0\n return if (@steam_apps = @@dll_SteamInternal_FindOrCreateUserInterface.call(@h_steam_user, STEAMAPPS_INTERFACE_VERSION)) == 0\n\n @initted = true\n end",
"def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end",
"def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsAppXAppAssignmentSettings\"\n end",
"def initialize(*args)\n super\n\n @apps = {}\n fields = %w[AppID name StateFlags Universe installdir LastUpdated\n UpdateResult SizeOnDisk buildid LastOwner BytesToDownload BytesDownloaded\n AutoUpdateBehavior AllowOtherDownloadsWhileRunning UserConfig\n MountedDepots\n ]\n \n options[:steam_home].gsub!('~', ENV['HOME'])\n Dir.glob(\"#{options[:steam_home]}/steam/SteamApps/*.acf\") do |file|\n acf = SteamCodec::ACF::loadFromFile(File.open(file))\n @apps[acf.get('AppID')] = fields.map do |field|\n [field.downcase, acf.get(field)]\n end.to_h\n end\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.iosVppAppAssignmentSettings\"\n end",
"def teams_app_settings=(value)\n @teams_app_settings = value\n end",
"def user_set_to_default_app_type\n return if @current_user.app_type_valid?\n\n current_user.app_type_id = all_user_app_type_ids.first\n current_user.save\n end",
"def init_teams\n init_org if @org.blank?\n @team = Team.where('name is NOT NULL').first_or_create(name: 'development', org_id: @org.id)\n end",
"def initialize(bot:, user:)\n super\n @settings = user.student_settings\n end",
"def initial_onboarding_user_api_token\n ENV[\"FASTLANE_CI_INITIAL_ONBOARDING_USER_API_TOKEN\"]\n end",
"def add_default_team_memberships\n if transaction_include_action?(:create)\n team_memberships.create!(employee_id: company.employees.solo_employee.id)\n team_memberships.create!(employee_id: company.employees.out_of_office_employee.id)\n end\n end",
"def init\n init_oauth_access_token\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.aadUserConversationMember\"\n end",
"def initialize(user = nil, scope)\n @user = user\n @scope = scope\n end",
"def default_options\n { \"token_credential_uri\" => self.class::TOKEN_CREDENTIAL_URI,\n \"audience\" => self.class::AUDIENCE,\n \"scope\" => self.class::SCOPE }\n end",
"def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsUniversalAppXContainedApp\"\n end",
"def init_settings\n merge_in_user_settings(copy_hash(DEFAULT_SETTINGS))\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end",
"def initialize(company, product_family, product, teams, team, user, time_period)\n self.company = company\n self.teams = teams\n self.team = team\n self.user = user\n self.product_family = product_family\n self.product = product\n self.time_period = time_period\n end",
"def add_user_to_org(org_id, app_id, user_id)\n app_user = Application\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsUniversalAppX\"\n end",
"def initialize(options = {})\n requires!(options, :global_user_name, :global_password, :term_type)\n super\n end",
"def new\n @app_user = @app.app_users.build\n end",
"def initialize(api_user, api_secret, workflow=nil)\n\n @api_user = api_user\n @api_secret = api_secret\n @workflow = nil \n @min = 0.9 \n\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.application\"\n end",
"def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend",
"def init_usersettings\n UserSetting.create(:user => self)\n end"
] | [
"0.54527813",
"0.52849585",
"0.5226986",
"0.51630723",
"0.51314735",
"0.5057966",
"0.50249255",
"0.5002965",
"0.50024647",
"0.49959233",
"0.4945063",
"0.4878081",
"0.48780555",
"0.48567334",
"0.48553476",
"0.48341924",
"0.48106268",
"0.48098832",
"0.47992164",
"0.479649",
"0.47846857",
"0.47554588",
"0.47512",
"0.47380596",
"0.47124124",
"0.46949703",
"0.46791098",
"0.46760303",
"0.46587422",
"0.46470279"
] | 0.74524724 | 0 |
GPS version Returns an array of projects that are similar if project exists | def project_exists
if self.check_project_exists == true
return (Project.select{ |proj| proj.project_type == self.project_type } && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.02), (self.street1.to_f + 0.02))} && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02 ))})
else
return []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_omnibus_projects\n # iterate through min/max versions for all product names\n # and collect the name for both versions\n projects = %w{ 0.0.0 1000.1000.1000 }.collect do |v|\n @version = v\n omnibus_project\n end\n # remove duplicates and return multiple known names or return the single\n # project name\n projects.uniq || projects\n end",
"def check_project_exists\n\n # if latitude is within +/- 2 ten-thounsandths of another project's latitude it is the same\n (Project.select{ |proj| proj.project_type == self.project_type }.count > 0 && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.002), (self.street1.to_f + 0.002))}.count > 0 && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02))}.count > 0)\n end",
"def projects\n map(&:projects).flatten.uniq.sort\n end",
"def ring_projects\n @ring_projects ||= [\n ObsProject.new(\"#{name}#{RINGS_PREFIX}0-Bootstrap\", '0'),\n ObsProject.new(\"#{name}#{RINGS_PREFIX}1-MinimalX\", '1'),\n ObsProject.new(\"#{name}#{RINGS_PREFIX}2-TestDVD\", '2') ]\n end",
"def check_projects\n # Nasledujici kod si vyzaduje urcitou pozornost a vysvetleni komentarem. Jeho smyslem je z pole @projects_current\n # odebrat vsechny projekty, ktere jsou jiz hotove (pocet odpracovanych dni je vetsi nebo roven poctu dni potrebnemu\n # k dokonceni projektu) a tyto projekty umistit do pomocneho pole currently_done.\n # V podmince bloku metody reject! vyuzivame toho, ze pokud jeste neni odpracovan dostatecny pocet dni, bude hned\n # prvni cast podminky vyhodnocena jako false a diky zkracenemu vyhodnocovani vyrazu se druha cast podminky vubec\n # neprovede. V pripade, ze uz je odpracovano dostatecne mnozstvi dni, pridani zkoumaneho projektu do currently_done\n # se provede a vyslednou hodnotou celeho bloku bude objekt currently_done samotny, coz v podminkovem kontextu\n # znamena pravdivou hodnotu, a tedy projekt bude metodou reject! odebran z @projects_current.\n # Pokud vam takovato konstrukce pripada ponekud slozita a nepruhledna, nevadi, muzete si predstavit, ze bychom\n # misto toho pouzili nasledujici kod -- vysledek by byl stejny:\n # currently_done = @projects_current.select { |project| project.man_days_done >= project.man_days }\n # @projects_current.reject! { |project| project.man_days_done >= project.man_days }\n currently_done = []\n @projects_current.reject! { |project| project.man_days_done >= project.man_days && currently_done << project }\n\n currently_done.each do |project|\n project.state = :done\n @projects_done << project\n @budget += project.price\n end\n end",
"def check_by_project\n _r = false\n # global_project_breakdown returns multidimensional array containing different project in each line\n # Each line contains 5 elements: Project Id, max_order_total, max_order_price, Net amount sum by project & Item net price\n a = global_project_breakdown(purchase_order_items.order(:project_id))\n d = a.detect { |f| (f[1] > 0 && (f[3] > f[1])) || (f[2] > 0 && (f[4] > f[2])) }\n _r = d.nil? ? false : true\n end",
"def project_versions(project,issues)\n issues.collect(&:fixed_version).compact.uniq\n end",
"def compute_knowns\n Set.new(@files.map { |f| Albacore::Project.new f }.map { |p| p.id })\n end",
"def find_projects\n \turi = URI(BASE_URL+\"projects.json?limit=100\")\n \treq = Net::HTTP::Get.new(uri)\n \treq['Authorization']=BASIC_AUTHORIZATION\n \tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n \t http.request(req)\n \t}\n\n \tprojects_full_json = JSON.parse(res.body)[\"projects\"]\n \tres = []\n \tprojects_full_json.each do |json_project|\n \t\tp = ProjectForm.new(json_project)\n \t\tres << p\n \tend\n\n \tres.each do |project|\n #Recorremos los proyectos, si no existen los creamos, en otro caso los actualizamos.\n project_db = Project.find_or_create_by(:identifier=>project.identifier)\n\n project_db.update(\n :name => project.name,\n :description => project.description,\n :identifier => project.identifier,\n :trackers=>[]\n );\n\n correspond = Correspond.where(:id_remote=>project.id,:remote_type=>0).first_or_create\n correspond.id_local=project_db.id\n correspond.remote_type=0\n correspond.save\n\n if(!project_db.errors.empty?)\n puts project_db.errors.full_messages\n end\n end\n return res\n end",
"def ring_projects\n @ring_projects ||= strategy.rings.each_with_index.map do |r,idx|\n ObsProject.new(\"#{rings_project_name}:#{idx}-#{r}\", \"#{idx}-#{r}\")\n end\n end",
"def projects\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:proj, RDF.type, Ruta::Class.project],\n [:proj, RDF::FOAF.member, :mir],\n [:mir, Ruta::Property.has_member, uri]\n )\n projs = []\n query.each_solution { |sol| projs.push(sol.proj.as(Organisation)) }\n projs\n end",
"def cross_project\n []\n end",
"def projects_by_path\n strong_memoize(:projects_by_path) do\n Project.eager_load(:route, namespace: [:route])\n .where_full_path_in(unique_project_paths)\n .index_by(&:full_path)\n end\n end",
"def projects_tracked\n timings = Timing.for_period_of_time(self.id, 1.month.ago, Time.now)\n if timings.present?\n timings.map(&:project_id).uniq\n else\n []\n end\n end",
"def projects(params = nil)\n params = params.merge({ :current_user => @options[:current_user]})\n params = params.except(:manufacturer_id, :catg_slug, :office_id, :max_matches)\n params[:order] ||= 'recently_active'\n\n @projects_response = ProjectsIndexPresenter.new(params[:current_user], params).response\n projects = @projects_response[:projects] || []\n projects\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def projects_supported\n @pledges = Pledge.all\n project_list = {}\n @pledges.each do |pledge|\n if pledge.user_id == self.id\n if project_list.has_key?(pledge.project_id)\n project_list[pledge.project_id] += pledge.dollar_amount\n else\n project_list[pledge.project_id] = pledge.dollar_amount\n end\n end\n end\n return project_list\n end",
"def show\n @projects = @dataset.experiments.collect { |experiment| experiment.project }.uniq\n end",
"def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end",
"def projects\n PivotalTracker::Project.all\n end",
"def is_a_conditional_version_project?(project_name)\n @version_projects ||= group_conditional_custom_field.possible_values\n @version_projects.include?(project_name)\n end",
"def reachable_projects\n path.ascend.find_all { |p| p.exist? && p.directory? }.flat_map do |dir|\n dir.children.select { |p| p.extname == '.xcodeproj' }\n end\n end",
"def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end",
"def find_projects\n #binding.pry\n ProjectBacker.all.select do |element|\n element.backer == self\n end\n end",
"def project_all\n prj = { '_id' => 0 }\n prj.merge!(make_grp_prj_periods[1])\n prj.merge!(make_grp_prj_nodes[1])\n prj.merge!(project_bookingnet)\n prj.merge!(project_baselist) unless @sensitivity >= 2\n prj.merge!(project_standardcost) unless @sensitivity >= 1\n { '$project' => prj }\n end",
"def reachable_projects\n path.ascend.find_all{ |p| p.directory? }.flat_map do |dir|\n dir.children.select{ |p| p.extname == '.xcodeproj' }\n end\n end",
"def open_projects\n Project.where(status: :open, service_id: services)\n end",
"def assign_new_projects\n # IMPLEMENTUJTE TUTO METODU\n # Pro kazdeho volneho programatora hledejte projekt k prideleni nasledovne:\n # - Pokud existuje nejaky projekt v @projects_waiting, vyberte prvni takovy.\n # (Nezapomente mu zmenit stav a presunout jej do @projects_current.)\n # - Pokud ne, vyberte takovy projekt z @projects_current, na kterem zbyva\n # nejvice nedodelane prace.\n @programmers.each_with_index do |prg,i|\n if @programmers[i].project == nil #programator bez projektu\n if @projects_waiting.length > 0\n cur_prj=@projects_waiting.shift\n cur_prj.state=:current\n @programmers[i].project=cur_prj\n @projects_current << cur_prj\n else\n if @projects_current.length >0\n #p \"vyber ten kde je nejvic prace\"\n #p @projects_current\n @projects_current.sort! { |a,b| (a.man_days-a.man_days_done) <=> (b.man_days-b.man_days_done) }\n # @projects_current.sort_by! {|rem| -(rem.man_days - rem.man_days_done) }\n @programmers[i].project=@projects_current[0] if @projects_current.length >0\n end\n end\n end\n end\n end",
"def find_all_issues\n version_id_sql = \"project_id =\\\"#{@project.id}\\\" \" + \\\n \"AND name = \\\"#{@version}\\\"\"\n # obtaining the unique ID from the chosen project version\n version = Version.all(conditions: [version_id_sql]).at(0).id.to_s \\\n if Version.all(conditions: [version_id_sql]) != []\n issues_sql = \"project_id = \\\"#{@project.id}\\\" \" + \\\n \"AND fixed_version_id = \\\"#{version}\\\"\"\n populate_issues_array(issues_sql)\n end",
"def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end"
] | [
"0.6690948",
"0.6394917",
"0.5990774",
"0.5943927",
"0.5851132",
"0.5848677",
"0.5834253",
"0.5830118",
"0.57999",
"0.5787687",
"0.5622428",
"0.56071115",
"0.56039155",
"0.5595532",
"0.55241996",
"0.5422615",
"0.5381047",
"0.53718483",
"0.53706586",
"0.5354612",
"0.5352882",
"0.5342946",
"0.5293814",
"0.5279979",
"0.5276979",
"0.5258821",
"0.5254504",
"0.52481335",
"0.52318716",
"0.52317464"
] | 0.64128435 | 1 |
GPS version check for projects that have similar streets reversing street order as necessary. | def check_project_exists
# if latitude is within +/- 2 ten-thounsandths of another project's latitude it is the same
(Project.select{ |proj| proj.project_type == self.project_type }.count > 0 && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.002), (self.street1.to_f + 0.002))}.count > 0 && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02))}.count > 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_build_vers(loc_ver,rem_ver)\n if loc_ver.to_s.match(/No/)\n result = 0\n else\n if rem_ver.to_s.match(/-/) and !rem_ver.to_s.match(/beta/)\n if $verbose == 1\n puts \"Local build date: \"+loc_ver.to_s\n puts \"Remote build date: \"+rem_ver.to_s\n end\n if rem_ver.to_time > loc_ver.to_time\n result = 0\n else\n result = 1\n end\n else\n if $verbose == 1\n puts \"Local build version: \"+loc_ver\n puts \"Remote build version: \"+rem_ver\n end\n if loc_ver !~ /No/\n loc_ver = Versionomy.parse(loc_ver)\n rem_ver = Versionomy.parse(rem_ver)\n if rem_ver > loc_ver\n result = 0\n else\n result = 1\n end\n else\n result = 2\n end\n end\n end\n if result == 0\n puts \"Remote version of build is newer than local\"\n else\n if result == 1\n puts \"Local version of build is up to date\"\n else\n puts \"Local version could not be accurately determined\"\n end\n end\n return result\nend",
"def nmap_version_at_least?(test_ver=nil)\n raise ArgumentError, \"Cannot compare a Float, use a String or Integer\" if test_ver.kind_of? Float\n unless test_ver.to_s[/^([0-9]+(\\x2e[0-9]+)?)/n]\n raise ArgumentError, \"Bad Nmap comparison version: #{test_ver.inspect}\"\n end\n test_ver_str = test_ver.to_s\n tnum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n installed_ver = get_nmap_ver()\n vtag = installed_ver.split[2] # Should be [\"Nmap\", \"version\", \"X.YZTAG\", \"(\", \"http..\", \")\"]\n return false if (vtag.nil? || vtag.empty?)\n return false unless (vtag =~ /^([0-9]+\\x2e[0-9]+)/n) # Drop the tag.\n inum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n return true if inum_arr[0] > tnum_arr[0]\n return false if inum_arr[0] < tnum_arr[0]\n inum_arr[1].to_i >= tnum_arr[1].to_i\nend",
"def project_exists\n\n if self.check_project_exists == true\n return (Project.select{ |proj| proj.project_type == self.project_type } && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.02), (self.street1.to_f + 0.02))} && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02 ))})\n else\n return []\n end\n end",
"def direction_touching_number?\n return false unless @confirmed[:street_direction] && @confirmed[:street_number]\n\n @confirmed[:street_direction].min - 1 == @confirmed[:street_number].max\n end",
"def breaking_changes?(version)\n\t\t\tDownloadTV::VERSION.split(\".\").zip(version.split(\".\")).find_index { |x, y| y > x }&.< 2\n\t\tend",
"def address_correlate\n return nil unless (self.community.respond_to?(:launch_date) && Community.find_by_name(\"Lexington\").respond_to?(:launch_date))\n return nil if self.community.launch_date.to_date < Community.find_by_name(\"Lexington\").launch_date.to_date\n likeness = 0.94\n addr = []\n street = self.community.street_addresses\n street.each do |street_address|\n st_addr = street_address.address\n test = st_addr.jarowinkler_similar(address.split(\",\").first)\n if test > likeness\n likeness = test\n addr.clear\n addr << street_address\n elsif test == likeness\n addr << street_address\n end\n end\n\n if addr.empty?\n addr << create_st_address\n end\n\n addr.first\n end",
"def assigned_version_roadways\n version = assigned_version\n\n if version # you need to ensure that there is even an inspection that was moved through assigned\n typed_version = TransamAsset.get_typed_version(version)\n\n if version.respond_to? :reify # if the highway structure returns a version you can use its version to find the versions associated with roadways\n return typed_version.roadways\n else # otherwise you have a highway structure that is \"live\" ie what is the DB right now and you have to figure out what versions of roadways are associated\n # given the time of assignment\n # you know that if a roadway wasnt updated since the time of assignment that those roadways were like that at assignment. they can be included in roadways of the assigned version\n time_of_assignment = assigned_inspection_version.created_at\n results = typed_version.roadways.where('updated_at <= ?', time_of_assignment).to_a\n\n # therefore you only need to check roadways updated after time of assignment\n # for those roadways, you find the version that is closest and before the time of assignment\n # versions save the object BEFORE the change\n # therefore to get the version at time of assignment you need the first version that happened after the time of assignment\n typed_version.roadways.where('updated_at > ?', time_of_assignment).each do |roadway|\n ver = roadway.versions.where('created_at > ?', time_of_assignment).where.not(event: 'create').order(:created_at).first\n results << ver.reify if ver\n end\n return results\n end\n end\n end",
"def assume_parts\n # Check if unit is in street number\n # 1) If street number has - or / unit is the smallest length\n # 2) If street number is all nums except 1 letter, letter is unit\n search_for_unit_in_street_num if @parts[:unit].nil? && @parts[:street_number]\n\n # Search for the street_name elsewhere\n search_for_street_name if @parts[:street_name].nil?\n\n # set puerto rico as the state\n @parts[:state] = @parts[:country] if @parts[:state].nil? && @parts[:country] == 'pr'\n\n return if @parts[:bus].nil? || @parts[:bus].empty?\n\n search_for_label_in_bus if @parts[:street_label].nil?\n search_for_state_in_bus if @parts[:state].nil?\n\n end",
"def test_rbs_have_matching_osm_tests\n # List of tests that don't have a matching OSM test for a valid reason\n # No \"Warn\" will be issued for these\n # input the ruby file name, eg `xxxx.rb` NOT `test_xxx_rb`\n noMatchingOSMTests = ['ExampleModel.rb',\n 'autosize_hvac.rb',\n # Not enabled\n 'afn_single_zone_ac.rb']\n\n base_dir = $ModelDir\n all_ruby_paths = Dir.glob(File.join(base_dir, '*.rb'));\n all_ruby_filenames = all_ruby_paths.map{|p| File.basename(p)};\n\n all_ruby_filenames.each do |filename|\n if !noMatchingOSMTests.include?(filename)\n # Check if there is a matching OSM file\n matching_osm = File.join(base_dir, filename.sub('.rb', '.osm'))\n\n # If you want to be stricter than warn, uncomment this\n # assert File.exists?(matching_osm), \"There is no matching OSM test for #{filename}\"\n\n if File.exists?(matching_osm)\n v = OpenStudio::IdfFile.loadVersionOnly(matching_osm)\n # Seems like something we should definitely fix anyways, so throwing\n if not v\n fail \"Cannot find versionString in #{matching_osm}\"\n end\n\n # If there is a version, check that it's not newer than current bindings\n model_version = v.get.str\n\n if Gem::Version.new(model_version) > Gem::Version.new($SdkVersion)\n # Skip instead of fail\n skip \"Matching OSM Model version is newer than the SDK version used (#{model_version} versus #{$SdkVersion})\"\n end\n else\n # If there isn't a matching, we warn, but we'll still run it\n # It might make sense if you have just added it recently\n warn \"There is no matching OSM test for #{filename}\"\n end\n end\n end\n end",
"def compare_versions(local_version,depot_version,mode)\n if local_version.match(/-/)\n local_version = local_version.split(/-/)[1]\n end\n if depot_version.match(/-/)\n depot_version = depot_version.split(/-/)[1]\n end\n puts \"Current: \"+local_version\n puts \"Available: \"+depot_version\n if mode =~ /up|check/\n avail_fw = compare_ver(local_version,depot_version)\n if avail_fw.to_s != local_version.to_s\n puts \"Depot patch level is newer than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n else\n if depot_version.to_i < local_version.to_i\n puts \"Depot patch level is lower than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n end\n if mode == \"check\"\n exit\n end\n return update_available\nend",
"def street_areSame?(street)\n if(@street == street)\n true\n else\n false\n end\nend",
"def check_addresses\n\n if location = @found_params.entities.detect {|entity| entity.name == \"from\"} || @ride.start_address\n if @ride.start_address\n address = @ride.start_address\n else\n address = geocode(location.value)\n end\n\n @ride.start_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @start_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n @time = UberService.new(@ride).time_estimates\n @time = @time / 60 if @time.class == Fixnum\n\n end\n\n if location = @found_params.entities.detect {|entity| entity.name == \"to\"} || @ride.end_address\n if @ride.end_address\n address = @ride.end_address\n else\n address = geocode(location.value)\n end\n\n @ride.end_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @end_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n end\n\n if (location = @found_params.entities.detect {|entity| entity.name == \"address\"}) && (@ride.end_address || @ride.start_address)\n\n address = geocode(location.value)\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n nice_address = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n if @ride.start_address\n @ride.end_address = address\n @end_address_nice = nice_address\n else\n @ride.end_address = address\n @start_address_nice = nice_address\n end\n\n @ride.save\n end\n\n if !@ride.end_address.nil? && !@ride.start_address.nil?\n @price = UberService.new(@ride).price_estimates\n end\n end",
"def compare_versions\n if @local_version && \n (@local_version.to_machine_format >= @website_version.to_machine_format)\n display_versions\n puts \"You have the most recent version.\"\n puts \"Exiting...\"\n exit 0\n end\nend",
"def test_version\n check_current_version(current_ways(:visible_way).id)\n check_current_version(current_ways(:used_way).id)\n check_current_version(current_ways(:way_with_versions).id)\n end",
"def gotPoint(lat,lon)\n\n nearby_place_found = false\n\n # call get_close_places to get nearby OSM places\n # (as per the grid squares)\n get_close_places(lat,lon).each do |place|\n\n #for each place\n plat,plon,name = place\n\n if is_close([lat, lon], [plat.to_f, plon.to_f])\n #It's vaguely close by. Let's do the actual distance calculation\n dist = spherical_distance([lat, lon], [plat.to_f, plon.to_f])\n if dist < Buffer\n nearby_place_found = true\n break\n end\n end\n end\n if not nearby_place_found\n #No nearby places found (which is the intersting case!)\n $missingcount+=1\n puts \"gpx point \" + $count.to_s + \" - No nearby place. \" + lat.to_s + \" \" + lon.to_s #+ \" \" + shortest_dist.to_s + \"km (\" + shortest_place.to_s + \" \" + splat.to_s + \" \" + splon.to_s + \")\"\n\n #Write a waypoint to the output GPX file\n File.open(OutputGPX, 'a') {|f| f.write( \"<wpt lat=\\\"\" + lat.to_s + \"\\\" lon=\\\"\" + lon.to_s + \"\\\"></wpt>\\n\" ) }\n\n end\nend",
"def highway_structure_version_roadways\n typed_version = TransamAsset.get_typed_version(highway_structure_version)\n if state == 'final'\n if highway_structure_version.respond_to? :reify\n typed_version.roadways\n else\n time_of_finalization = versions.last.created_at\n results = typed_version.roadways.where('updated_at <= ?', time_of_finalization).to_a\n\n typed_version.roadways.where('updated_at > ?', time_of_finalization).each do |roadway|\n ver = roadway.versions.where('created_at > ?', time_of_finalization).where.not(event: 'create').order(:created_at).first\n results << ver.reify if ver\n end\n return results\n end\n else\n return highway_structure.roadways\n end\n end",
"def needs_geocoding?\n self.new_record? || self.city_changed? || self.street_address_changed?\n end",
"def prerelease?(version)\n !!PRERELEASE_STRINGS.detect do |string|\n version.match(/[^\\w]#{string}[^\\w]/)\n end\n end",
"def sputnik?(expected_version = nil)\n Sputnik.new(ua).match? && detect_version?(full_version, expected_version)\n end",
"def solution_correct?\n current = params[:solution].strip\n current.gsub!(/\\/\\*[\\w\\s]*\\*\\//,\"\") \n current.gsub!(/--.*\\n/,\"\")\n existing = format_str(@lesson.solution.strip)\n current = format_str(current.strip)\n if existing == current\n return true\n else\n existing_arr = existing.split\n current_arr = current.split\n len= existing_arr.length\n err =[]\n j=0 \n for i in 0..len\n if existing_arr[i]!=current_arr[i]\n err[j]= existing_arr[i]\n j=j+1 \n end\n end\n return err\n end \n end",
"def no_change_in_version?\n latest_resolvable_version <= existing_version\n end",
"def valid_address?( delta = 1.0 )\n @required = [:ups_account, :ups_user, :ups_password]\n \n state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state\n \n @data = String.new\n b = Builder::XmlMarkup.new :target => @data\n \n b.instruct!\n b.AccessRequest {|b|\n b.AccessLicenseNumber @ups_account\n b.UserId @ups_user\n b.Password @ups_password\n }\n b.instruct!\n b.AddressValidationRequest {|b|\n b.Request {|b|\n b.RequestAction \"AV\"\n b.TransactionReference {|b|\n b.CustomerContext \"#{@city}, #{state} #{@zip}\"\n b.XpciVersion API_VERSION\n }\n }\n b.Address {|b|\n b.City @city\n b.StateProvinceCode state\n b.PostalCode @zip\n }\n }\n \n \t get_response \"https://wwwcie.ups.com/ups.app/xml/AV\"\n \n \t\tif REXML::XPath.first(@response, \"//AddressValidationResponse/Response/ResponseStatusCode\").text == \"1\" && REXML::XPath.first(@response, \"//AddressValidationResponse/AddressValidationResult/Quality\").text.to_f >= delta\n \t\t return true\n \t\telse\n \t\t return false\n \t\tend\n end",
"def compare_for_near_match(guess_index)\n (0..3).each do |code_index|\n next unless guess[guess_index] == code[code_index]\n\n key.push(\"O\")\n code[code_index] = 0\n break\n end\n end",
"def routes_are_correct?\n @solution.each do |route|\n return false if route.demand > @vehicle_capacity\n end\n return true\n end",
"def scanSameNameWithDifferentSimilarTrackCount()\n problemCount = 0;\n SimilarTracksVersionControl.find(:all, :conditions => [\"version = ? and status = ? and similar_track_count > ?\" , 1, 1, 0]).each do |strack|\n puts \"track_id:\" + strack.track_id.to_s();\n \n\n scs = SimilarTracksVersionControl.find(:all, :order => \"similar_track_count desc\", :limit => 1, :conditions => [\"track_name = ? and track_artist_id = ? and track_id != ? and status = ? and similar_track_count > ?\", strack.track_name, strack.track_artist_id, strack.track_id, 1, 0]);\n status = 0;\n if (scs != nil and !scs.empty?)\n sc = scs.first;\n puts \"matched track_id:\" + sc.track_id.to_s();\n if (strack.similar_track_count < sc.similar_track_count)\n strack.same_name_with_different_similar_track_count_fix = sc.track_id;\n strack.status = 200;\n strack.save();\n puts \"need fix:\" + strack.similar_track_count.to_s + \" < \" + sc.similar_track_count.to_s;\n problemCount = problemCount + 1;\n end\n\n end\n \n \n end #end of loop\n puts \"total needs fix:\" + problemCount.to_s();\n \n end",
"def srss?\n lat != 0.0 && long != 0.0 #there should not be an airfield, somewhere in the ocean\n end",
"def in_same_release_line?(other)\n major == other.major &&\n # minor and patch always match if one or the other is nil (~>-like behavior)\n ( minor.nil? || other.minor.nil? || minor == other.minor ) &&\n ( patch.nil? || other.patch.nil? || patch == other.patch )\n end",
"def suitable_for_all?\n<<<<<<< HEAD:app/models/project.rb\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n=======\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/models/project.rb\n end",
"def internal_or_core?(pin); end",
"def remove_duplicate_direction\n spl = @parts[:street_name].split\n return unless @parts[:street_direction].include? spl.first\n\n @parts[:street_name] = spl[1..].join\n end"
] | [
"0.56617856",
"0.5622213",
"0.53688985",
"0.52612925",
"0.52385014",
"0.5199634",
"0.5196009",
"0.5139134",
"0.5099616",
"0.5096459",
"0.50687355",
"0.500505",
"0.4997049",
"0.49902913",
"0.4971103",
"0.4854134",
"0.48421282",
"0.48408216",
"0.48359808",
"0.48330972",
"0.48234797",
"0.47994715",
"0.47903886",
"0.47710383",
"0.47677606",
"0.4761987",
"0.47616184",
"0.47557905",
"0.47421023",
"0.47405288"
] | 0.65193725 | 0 |
Details: Finish the solution so that it sorts the passed in array of numbers. If the function passes in an empty array or null/nil value then it should return an empty array. For example: solution([1, 2, 10, 50, 5]) should return [1,2,5,10,50] solution(nil) should return [] | def solution(nums)
nums.to_a.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_array(nums)\n nums.nil? ? [] : nums.sort\nend",
"def my_sort(nums, sorted=[])\n\t# get min\n\t# Remove min from nums\n\t# recursion until nums.size == 0 with new nums and new sorted\n\t# Return sorted\n\n\tmin = nums.min\n\tsorted << min\n\n\tnums.delete_if {|n| n == min}\n\n\tif nums.size > 0\n\t\tmy_sort nums, sorted\n\telse\n\t\tsorted\n\tend\nend",
"def sort some_array\n\trecursive_sort some_array, []\nend",
"def sort some_array\n\trecursive_sort some_array, []\nend",
"def sort_nums_ascending(arr)\n return arr.sort\nend",
"def sort some_array\n recursive_sort some_array, []\nend",
"def sort some_array\n recursive_sort some_array, []\nend",
"def sorting(numbers)\n numbers.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def take_array(array)\r\n array.sort\r\nend",
"def sort1(array)\n\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 sort some_array\n\tsorted_array = []\n\trecursive_sort some_array, sorted_array\nend",
"def sort(arr)\n recursive_sort(arr, [])\n# This is called a \"wrapper\", a method that wraps up another method,\n# in this case the recursive_sort method. The sort method takes\n# one argument, the given array, which in turn is passed into the\n# recursive sort method along with an empty array as the second\n# argument.\nend",
"def merge_sort(arr)\n return arr if arr.length <= 1\nend",
"def using_sort(array)\n sorted_array=array.sort\nend",
"def recursive_sort_wrap some_array\n recursive_sort some_array, []\nend",
"def sort_array_asc(integers)\n integers.sort\nend",
"def sort arr\n recursive_sort arr, []\nend",
"def sort arr\n recursive_sort arr, []\nend",
"def merge_sort numbers, si=0, ei=nil\n\n # TODO: your cool code goes here\n\nend",
"def sort array # This \"wraps\" recursive_sort.\n recursive_sort array, []\nend",
"def sort(to_sort)\n # if the array is of length 0 or 1, consider it is already sorted\n if to_sort.length <= 1\n then return to_sort\n end\n\n # otherwise split the remaining elements in two\n # I had to look this line on the web (sourcerefactormycode.com)\n second_array = to_sort.slice!((to_sort.length / 2.0).round..to_sort.length)\n\n # recursive method call on both arrays\n first_sorted_array = sort(to_sort)\n second_sorted_array = sort(second_array)\n\n # merge the two sorted arrays together\n return merge(first_sorted_array, second_sorted_array)\nend",
"def lomuto(array)\n lomuto_sort(array, 0, array.length - 1)\nend",
"def merge_sort(numbers)\n # Base case\n # Rearrangement is no longer possible, there's only 1 element in `numbers`!\n return numbers if numbers.size == 1\n\n # Partition unsorted elements into groups\n # Continue until n sublists, each containing 1 element (i.e. all reached base case)\n mid = numbers.size / 2\n left = numbers[0...mid] # alternatively: numbers.take(mid)\n right = numbers[mid..-1] # alternatively: numbers.drop(mid)\n\n # Recursively break down sublists into smaller problems\n # until each list has 1 element\n left_nums = merge_sort(left)\n right_nums = merge_sort(right)\n\n # Merge individual sublists to produce sorted sublists when\n # left_nums && right_nums are available\n merge(left_nums, right_nums)\nend",
"def custom_sort (unsorted, sorted = [])\n return sorted.uniq if unsorted.length == 0\n smallest = unsorted[0]\n unsorted.each {|x| smallest = x if x <= smallest}\n\n unsorted.each {|x| sorted << x if x <= smallest }\n\n unsorted.delete(smallest)\n custom_sort(unsorted, sorted)\nend",
"def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n sort(less) + [middle] + sort(more)\nend"
] | [
"0.79653484",
"0.66269785",
"0.6622227",
"0.6622227",
"0.6503862",
"0.64985967",
"0.64985967",
"0.64849895",
"0.64233613",
"0.64233613",
"0.63996476",
"0.6398528",
"0.6390439",
"0.6390439",
"0.6390439",
"0.6373231",
"0.6340254",
"0.6340031",
"0.63360506",
"0.6335004",
"0.63138276",
"0.6281494",
"0.6281494",
"0.62318563",
"0.623105",
"0.6217705",
"0.6201818",
"0.61959875",
"0.6182997",
"0.61746687"
] | 0.7088003 | 1 |
GET /regionextras GET /regionextras.json | def index
@regionextras = Regionextra.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end",
"def region\n @regions = @company.companyregions\n respond_with @regions\n end",
"def regions\n client.get_stats('/stats/regions')\n end",
"def show\n render json: @region\n end",
"def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end",
"def get_regions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_regions ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/regions/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def region\n @region ||= client.regions.get_from_uri(info[:region])\n end",
"def region\n @region ||= client.regions.get_from_uri(info[:region]) unless info[:region].nil?\n end",
"def regions\n @attributes[:regions]\n end",
"def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end",
"def index\n @regiones = Region.all\n\n render json: @regiones\n end",
"def region() ; info[:region] ; end",
"def region() ; info[:region] ; end",
"def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def regions(for_select = true)\n fetch_array_for $regions, for_select\n end",
"def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @region }\n end\n end",
"def index\n @especies_regiones = EspecieRegion.all\n end",
"def query_tax_region_jurisdictions(options={})\n path = \"/api/v2/compliance/taxregionjurisdictions\"\n get(path, options)\n end",
"def regions\n Vultr::Resource::Region.new(@faraday)\n end",
"def especies_por_region\n snib = Geoportal::Snib.new\n snib.params = params\n snib.especies\n self.resp = snib.resp\n end",
"def get_aws_region\n\n\n begin\n\n url = 'http://169.254.169.254/latest/dynamic/instance-identity/document'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n\n hashOfLookupValues = JSON.parse(response)\n lookupRegion = hashOfLookupValues[\"region\"]\n\n rescue\n logonFailed('Unable to perform region lookup. Is this an EC2 instance? and does it have access to http://169.254.169.254')\n end\n\n return lookupRegion\n\n end",
"def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend",
"def query_tax_regions(options={})\n path = \"/api/v2/compliance/taxregions\"\n get(path, options)\n end",
"def _region_states(region_id)\n get('region/states', region_id)\n end",
"def getVendorsAndRegions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end",
"def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend",
"def get_regions()\n\t\t{\"include_regions\"=>@include_regions,\"exclude_regions\"=>@exclude_regions}\n\tend",
"def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end",
"def find_region_by_service(id)\n self.class.get(\"/services/#{id}/regions.json?apikey=#{apikey}\") \n end"
] | [
"0.71900696",
"0.67239195",
"0.66143936",
"0.6611175",
"0.64833874",
"0.64386183",
"0.6378065",
"0.6367327",
"0.63036364",
"0.6268304",
"0.6228991",
"0.6211672",
"0.6211672",
"0.62070656",
"0.6194856",
"0.61833453",
"0.61815906",
"0.6171834",
"0.61537635",
"0.6150054",
"0.61448056",
"0.60963225",
"0.60608184",
"0.6008888",
"0.6007783",
"0.5971935",
"0.59665895",
"0.5958612",
"0.5958567",
"0.59136677"
] | 0.72709906 | 0 |
POST /regionextras POST /regionextras.json | def create
@regionextra = Regionextra.new(regionextra_params)
respond_to do |format|
if @regionextra.save
format.html { redirect_to @regionextra, notice: 'Regionextra was successfully created.' }
format.json { render :show, status: :created, location: @regionextra }
else
format.html { render :new }
format.json { render json: @regionextra.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regionextra_params\n params.require(:regionextra).permit(:RegionID, :Name, :value)\n end",
"def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end",
"def create\n @region = Region.new(region_params)\n\n if @region.save\n render json: @region, status: :created, location: @region\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end",
"def create_region\n Region.create!(params[:record])\n render :json => {}\n end",
"def update\n respond_to do |format|\n if @regionextra.update(regionextra_params)\n format.html { redirect_to @regionextra, notice: 'Regionextra was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionextra }\n else\n format.html { render :edit }\n format.json { render json: @regionextra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @region = Region.new(region_params)\n @regions = Region.where('active_status=? and del_status=?', true, false)\n respond_to do |format|\n if @region.save\n format.js { flash[:success] = \"#{@region.region_desc} added successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully created.\" }\n format.json { render :show, status: :created, location: @region }\n else\n format.js { render :new }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @regionextras = Regionextra.all\n end",
"def create_region\n @region = @company.companyregions.new(region_params)\n if @region.save\n render json: @region.as_json, status: :ok\n else\n render json: {region: @region.errors, status: :no_content}\n end\n end",
"def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to regions_path, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @region = Region.new(params[:region])\n \n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, flash: {success: \"Region was successfully created!\"}}\n format.json { render json: @region, status: :created, location: @region }\n else\n format.html { render action: \"new\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end",
"def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def especies_por_region\n snib = Geoportal::Snib.new\n snib.params = params\n snib.especies\n self.resp = snib.resp\n end",
"def create\n @region = Region.new(params[:region])\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, notice: 'Region was successfully created.' }\n format.json { render json: @region, status: :created, location: @region }\n else\n format.html { render action: \"new\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def region\n @regions = @company.companyregions\n respond_with @regions\n end",
"def region_params\n params.require(:region).permit(:name, :website, :info)\n end",
"def region_params\n params.require(:region).permit(Region::REGISTRABLE_ATTRIBUTES +\n [region_areas_attributes: RegionArea::REGISTRABLE_ATTRIBUTES])\n end",
"def create(attributes = {})\n # Add the region\n @regions << Region.new(attributes)\n \n @regions.last\n end",
"def update_region\n Region.find(params[:record][:id]).update_attributes(params[:record])\n render :json => {}\n end",
"def destroy\n @regionextra.destroy\n respond_to do |format|\n format.html { redirect_to regionextras_url, notice: 'Regionextra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def especie_region_params\n params[:especie_region]\n end",
"def region_params\n params.require(:region).permit(:name)\n end",
"def create\n @regionenvironment = Regionenvironment.new(regionenvironment_params)\n\n respond_to do |format|\n if @regionenvironment.save\n format.html { redirect_to @regionenvironment, notice: 'Regionenvironment was successfully created.' }\n format.json { render :show, status: :created, location: @regionenvironment }\n else\n format.html { render :new }\n format.json { render json: @regionenvironment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n @world_region = WorldRegion.new(world_region_params)\n\n respond_to do |format|\n if @world_region.save\n format.html { redirect_to @world_region, notice: 'World region was successfully created.' }\n format.json { render :show, status: :created, location: @world_region }\n else\n format.html { render :new }\n format.json { render json: @world_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n @especie_region = EspecieRegion.new(especie_region_params)\n\n respond_to do |format|\n if @especie_region.save\n format.html { redirect_to @especie_region, notice: 'Especie region was successfully created.' }\n format.json { render action: 'show', status: :created, location: @especie_region }\n else\n format.html { render action: 'new' }\n format.json { render json: @especie_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(cnpj, branch, contractId, body)\n self.class.post(\"/aldebaran-carriers/carriers/#{cnpj}/contracts/#{branch}/#{contractId}/regions\", :basic_auth => @auth, :body => body.to_json)\n end",
"def create\n \n @regional = Regional.new(regional_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @regional.save\n format.html { redirect_to @regional, notice: 'Regional was successfully created.' }\n format.json { render :show, status: :created, location: @regional }\n else\n format.html { render :new }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6437806",
"0.6351956",
"0.6259945",
"0.61845803",
"0.60703605",
"0.60580385",
"0.60164356",
"0.5906255",
"0.58810335",
"0.5846377",
"0.5806539",
"0.5758439",
"0.5758439",
"0.57405806",
"0.5724111",
"0.571648",
"0.56633353",
"0.5647524",
"0.5631641",
"0.5614036",
"0.5608624",
"0.5580406",
"0.5531731",
"0.55294245",
"0.5501573",
"0.54915833",
"0.548991",
"0.5465243",
"0.5456323",
"0.5455803"
] | 0.67595834 | 0 |
PATCH/PUT /regionextras/1 PATCH/PUT /regionextras/1.json | def update
respond_to do |format|
if @regionextra.update(regionextra_params)
format.html { redirect_to @regionextra, notice: 'Regionextra was successfully updated.' }
format.json { render :show, status: :ok, location: @regionextra }
else
format.html { render :edit }
format.json { render json: @regionextra.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @region = Region.find(params[:id])\n\n if @region.update(region_params)\n head :no_content\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end",
"def update_region\n Region.find(params[:record][:id]).update_attributes(params[:record])\n render :json => {}\n end",
"def update\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n format.html { redirect_to @region, flash: {success: \"Region was successfully updated!\"}}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @especie_region.update(especie_region_params)\n format.html { redirect_to @especie_region, notice: 'Especie region was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @especie_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @regionenvironment.update(regionenvironment_params)\n format.html { redirect_to @regionenvironment, notice: 'Regionenvironment was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionenvironment }\n else\n format.html { render :edit }\n format.json { render json: @regionenvironment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @region.update(region_params)\n format.js { flash[:success] = \"#{@region.region_desc} updated successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully updated.\" }\n format.json { render :show, status: :ok, location: @region }\n else\n format.js { render :edit }\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @region = args[:region] if args.key?(:region)\n end",
"def edit\n @region = Region.find_by_given_name(params[:region_name])\n @data = SolarSystem.where(region_id: @region.id).to_json(:except => [:region_id, :created_at, :updated_at])\n end",
"def update!(**args)\n @region_type = args[:region_type] if args.key?(:region_type)\n @regions = args[:regions] if args.key?(:regions)\n end",
"def update_region_of_service(*args)\n raise ArgumentError.new('The method `update_region_of_service` requires 2 arguments (service-id and region-code).') if args.size != 2\n self.class.put(\"/services/#{args[0]}/regions/#{args[-1]}.json?apikey=#{apikey}\", :body => {})\n end",
"def update\n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n flash[:notice] = 'Region was successfully updated.'\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @region.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update!(**args)\n @allowed_regions = args[:allowed_regions] if args.key?(:allowed_regions)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n\n @regions = Region.all\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_cloud_regions_with_http_info(moid, cloud_regions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.patch_cloud_regions ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling CloudApi.patch_cloud_regions\"\n end\n # verify the required parameter 'cloud_regions' is set\n if @api_client.config.client_side_validation && cloud_regions.nil?\n fail ArgumentError, \"Missing the required parameter 'cloud_regions' when calling CloudApi.patch_cloud_regions\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(cloud_regions)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.patch_cloud_regions\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#patch_cloud_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @region = Region.find(params[:region_id])\n respond_to do |format|\n if @city.update(city_params)\n format.js\n else\n format.js { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @regional.update(regional_params.keep_if{|p,q| q.class != ActionController::Parameters})\n @regional.address.update(regional_params[:address_attributes]) \n @regional.contact.update(regional_params[:contact_attributes])\n format.html { redirect_to @regional, notice: 'Regional was successfully updated.' }\n format.json { render :show, status: :ok, location: @regional }\n else\n format.html { render :edit }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @world_region.update(world_region_params)\n format.html { redirect_to @world_region, notice: 'World region was successfully updated.' }\n format.json { render :show, status: :ok, location: @world_region }\n else\n format.html { render :edit }\n format.json { render json: @world_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_associated_regions\n Region.transaction(requires_new: true) do\n regions = Region.all\n regions.each do |region|\n region.recipe.ingredients.each do |ingredient|\n if ingredient.model.to_s == LandmarkSet.name && self.name == ingredient.attributes[:name]\n # Re-save the region so its geometry is updated.\n region.save!\n end\n end\n end\n end\n end",
"def update\n @pc_region = PcRegion.find(params[:id])\n\n respond_to do |format|\n if @pc_region.update_attributes(params[:pc_region])\n format.html { redirect_to @pc_region, notice: 'Pc_region was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pc_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sub_region = SubRegion.find(params[:id])\n\n respond_to do |format|\n if @sub_region.update_attributes(params[:sub_region])\n flash[:notice] = 'SubRegion was successfully updated.'\n format.html { redirect_to(@sub_region) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sub_region.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_region.update(user_region_params)\n @user_regions = UserRegion.all\n format.js { render :file=> 'user_regions/update_user_region.js.erb', notice: 'region was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_region }\n else\n format.html { render :edit }\n format.json { render json: @user_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end",
"def update!(**args)\n @disallowed_regions = args[:disallowed_regions] if args.key?(:disallowed_regions)\n end",
"def update\n respond_to do |format|\n if @regional.update(regional_params)\n format.html { redirect_to @regional, notice: I18n.t('messages.updated') }\n format.json { render :show, status: :ok, location: @regional }\n else\n format.html { render :edit }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_region.update(location_region_params)\n format.html { redirect_to(admin_location_regions_url, notice: 'Location region was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @location_region.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6586227",
"0.6577751",
"0.64481485",
"0.6431758",
"0.6291979",
"0.628427",
"0.623349",
"0.623349",
"0.61646736",
"0.6111565",
"0.60827404",
"0.6052583",
"0.603586",
"0.6031507",
"0.5999401",
"0.5952492",
"0.5939089",
"0.5910816",
"0.5901486",
"0.58903587",
"0.585253",
"0.5852369",
"0.5835801",
"0.5813839",
"0.5806399",
"0.5788464",
"0.5770221",
"0.57673746",
"0.5752853",
"0.5750001"
] | 0.6898627 | 0 |
DELETE /regionextras/1 DELETE /regionextras/1.json | def destroy
@regionextra.destroy
respond_to do |format|
format.html { redirect_to regionextras_url, notice: 'Regionextra was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end",
"def destroy\n @region.destroy\n\n head :no_content\n end",
"def destroy\n @region = Region.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region = Region.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url flash: {success: \"Region was successfully deleted!\"}}\n format.json { head :no_content }\n end\n end",
"def destroy\n @region.destroy\n respond_to do |format|\n format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region.destroy\n respond_to do |format|\n format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region.destroy\n respond_to do |format|\n format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especie_region.destroy\n respond_to do |format|\n format.html { redirect_to especies_regiones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub_region = SubRegion.find(params[:id])\n @sub_region.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_regions_url) }\n format.xml { head :ok }\n end\n end",
"def delete(client, region = 'AWS_REGION')\r\n super\r\n api_id = get_id_for_api(@api_name)\r\n if api_id\r\n options = {\r\n rest_api_id: api_id\r\n }\r\n @client.delete_rest_api(options)\r\n puts \"Deleted API: #{@api_name} ID:#{api_id}\"\r\n else\r\n puts \"API Gateway Object #{@api_name} not found. Nothing to delete.\"\r\n end\r\n true\r\n end",
"def destroy\n @gce_region.destroy\n respond_to do |format|\n format.html { redirect_to gce_regions_url, notice: 'Gce region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region_utility.destroy\n respond_to do |format|\n format.html { redirect_to region_utilities_url, notice: 'Region utility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pc_region = PcRegion.find(params[:id])\n @pc_region.destroy\n\n respond_to do |format|\n format.html { redirect_to pc_regions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @world_region.destroy\n respond_to do |format|\n format.html { redirect_to world_regions_path, notice: 'World region 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 destroy\n @regionenvironment.destroy\n respond_to do |format|\n format.html { redirect_to regionenvironments_url, notice: 'Regionenvironment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region = parent.regions.find(params[:id])\n @region.destroy\n \n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n respond_to do |format|\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @region_master.destroy\n respond_to do |format|\n format.html { redirect_to region_masters_url, notice: \"Region master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region = RegionTemplate.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to(region_templates_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @join_region_to_place.destroy\n respond_to do |format|\n format.html { redirect_to edit_place_path(@place), notice: 'Le région a été retirée.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regional.destroy\n respond_to do |format|\n format.html { redirect_to regionals_url, notice: 'Regional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_region.destroy\n respond_to do |format|\n format.html { redirect_to user_regions_url, notice: 'User region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @locations_region = Locations::Region.find(params[:id])\n @locations_region.destroy\n respond_to do |format|\n format.js { \n index\n render 'index'\n }\n end\n end",
"def destroy\n @regional.destroy\n respond_to do |format|\n format.html { redirect_to regionais_url, notice: I18n.t('messages.destroyed') }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @join_region_to_place.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_place_path(@place), notice: 'La région a été retirée.' }\n format.json { head :no_content }\n end\n end",
"def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.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 delete\n super \"/templates/#{template_id}.json\", {}\n end"
] | [
"0.74677545",
"0.7150684",
"0.7055704",
"0.6934371",
"0.6837629",
"0.6837629",
"0.6837629",
"0.67998534",
"0.6740191",
"0.66453683",
"0.662495",
"0.6567241",
"0.6561294",
"0.65553993",
"0.6547393",
"0.654193",
"0.65335745",
"0.6477611",
"0.6430961",
"0.6404991",
"0.63848144",
"0.63839436",
"0.6359358",
"0.63361615",
"0.6295705",
"0.62942946",
"0.627642",
"0.62465286",
"0.62445503",
"0.62418735"
] | 0.7439709 | 1 |
=begin need function that takes and argument that argument will be an array reference value to check against if the next number is bigger than reference value it becomes the reference value at the end of iterating over each item the reference value the largest number =end | def max_value(our_array)
reference = -100000
our_array.each do |number|
if number > reference
reference = number
end
end
reference
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_max_number(any_array)\n\treference = any_array[1]\n\tany_array.each do |number|\n\t\tif number > reference\n\t\treference = number\n\t\tend\n\tend \n\treference\nend",
"def find_greatest(numbers)\n saved_number = numbers[0]\n\n numbers.each do |num|\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend",
"def greatest_number(num_array)\n saved_number = num_array[0]\n\n num_array.each do |num|\n\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend",
"def part6(in_array)\n themax = in_array[2]\n in_array.each do |item|\n if item > themax\n themax = item\n end\n end\n themax\nend",
"def max(array)\n result = array.first\n\n array.each do |num|\n if num > result\n result = num\n end\n end\n puts result\nend",
"def find_max(some_array)\n max = some_array[0]\n some_array.each do |number|\n if number > max\n max = number\n end\n end\n max\nend",
"def largest(array)\n index = 0 #1\n greatest_num = array[index] #5 \n while index < array.length #0 < 5 1 < 5\n if array[index] > greatest_num #if 5 > 5 17 > 5\n greatest_num = array[index] # 17 \n end\n index += 1\n end\n greatest_num\nend",
"def find_greatest(numbers)\n saved_number = nil\n\n\n numbers.each do |num|\n saved_number ||= num\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n\nsaved_number\nend",
"def find_greatest(numbers)\n saved_number = nil\n\n numbers.each do |num|\n saved_number = numbers[0]\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n p saved_number\nend",
"def find_greatest(numbers)\n saved_number = nil\n\n numbers.each do |num|\n saved_number ||= num # assign to first value\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend",
"def max(arr)\n greatest = array[0]\n arr.each do |num|\n if num > greatest\n greatest = num\n end\n end\n greatest\nend",
"def maximum(arr, &prc)\n return nil if arr.empty?\n current_ele = nil\n current_max = nil\n arr.each do |ele|\n value = prc.call(ele)\n if current_max == nil || value >= current_max\n current_max = value\n current_ele = ele\n end\n end\n current_ele\nend",
"def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend",
"def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend",
"def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend",
"def max_by(array)\n largest_item = nil\n array.each do |elem|\n largest_item ||= elem\n largest_item = elem if yield(elem) > yield(largest_item)\n end\n largest_item\nend",
"def maximum( arr, &prc )\n return nil if arr.length == 0\n\n test_case = arr.inject(0) {|x,ele| x = prc.call(ele) if prc.call(ele) > x }\n p test_case\n arr.reverse.each do |ele|\n if prc.call(ele) == test_case\n return ele\n end\n end\n\nend",
"def find_max_value(array)\nx = 0 \n array.length.times { |index|\n if array[index] > x \n x = array[index]\n end\n }\n x\n end",
"def find_max_num(numbers)\n if numbers.length == 0 \n \tputs \"No numbers were passed.\" \n elsif numbers.length > 0\n max_num = numbers[0]\n \tfor i in 1..numbers.length - 1 # So I don't over-run the array, and start at the 2nd position to compare against max at postion [0]\n if max_num < numbers[i] \n max_num = numbers[i] \n end\n i += 1\n \tend\n puts \"Looked through an array of lenght #{numbers.length}.\"\n puts \"The largest value is #{max_num}\"\n end\nend",
"def next_largest_number (array, given_number)\n array.find {|number| number > given_number}\nend",
"def largest_integer(list_of_numbers)\n # Return nil if the array doesn't have any element.\n return nil if list_of_numbers.length == 0\n # Define the variable to the first element of the array.\n largest_number = list_of_numbers[0]\n # Take the first number!! and store inside defined variable.\n list_of_numbers.each do |number|\n # Go ahead and take the next one\n # Compare that one with the stored number in the variable.\n if largest_number < number\n # Whichever is larger, keep that number inside the variable.\n largest_number = number\n end\n # Continue this process until the array is empty.\n end\n # Return the largest number.\n largest_number\nend",
"def max(arr)\n return nil if arr.empty?\n result = arr[0]\n arr[1...-1].each do |item|\n if item > result\n result = item\n end\n end\n return result\nend",
"def find_max_value(array)\n x = array[0]\narray.length.times {|index|\n if array[index] > x\n x = array[index]\n end\n\n}\nx\nend",
"def largest_integer(array)\n large = array[0]\n array.each do |n|\n if n > large\n large = n\n end\n end\n large\nend",
"def new_max array_of_elements\n\ti = 0\n\tlargest = array_of_elements[0]\n\twhile i < array_of_elements.length do\n\t\tif array_of_elements[i] > largest\n\t\t\tlargest = array_of_elements[i]\n\t\tend\n\t\ti += 1\n\tend\n\tlargest\nend",
"def lis(array)\n helper = Array.new(array.length, 1)\n (1..array.length - 1).each do |array_index|\n (0..array_index).each do |inner_value|\n if array[inner_value] < array[array_index]\n helper[array_index] = [helper[inner_value] + 1, helper[array_index]].max\n end\n end\n end\n helper.max\nend",
"def largest_integer(list_of_nums) #define method largest_integer with argument list_of_nums\n max = list_of_nums[0] #set the max as the first position of the array\n list_of_nums.each do |num| #iterate over each number of the array\n \tif \n \t\tmax < num # if max is less than a given number\n \t\tnum = max # the number is equal to max\n \tend # close the if statement\nend # close the method definition\n return max #return the max number\nend",
"def largest(array)\nend",
"def max_in_array_loop(arr)\n max = arr[0]\n arr.each do |x|\n if x > max\n max = x\n end\n end\n max\nend",
"def find_max(some_array)\n max = nil\n some_array.each do |val|\n \tif max.nil?\n max=val\n elsif val>max\n max=val\n end\n end\n max\nend"
] | [
"0.80275106",
"0.76950336",
"0.7690046",
"0.76097184",
"0.7540231",
"0.7538304",
"0.75273305",
"0.7512896",
"0.75111955",
"0.7472626",
"0.74536985",
"0.74472046",
"0.74168944",
"0.74168944",
"0.74168944",
"0.74026215",
"0.7386269",
"0.73623466",
"0.7346802",
"0.73148793",
"0.7313436",
"0.7309608",
"0.73079985",
"0.72955525",
"0.7288448",
"0.7282105",
"0.72694165",
"0.7259465",
"0.7237961",
"0.7228702"
] | 0.7971969 | 1 |
Overwrites slug_exists? from Slug. We allow duplicate slugs on different published_at dates. | def slug_exists?
Article.on(published_at).where(slug: slug).exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_slug_needed?\n !slug || slug_text != slug.name\n end",
"def should_generate_new_friendly_id?\n slug.blank? || permalink_changed?\n end",
"def auto_generate_slug\n return true unless self.slug.nil?\n return true if self.respond_to?(:published?) && !self.published?\n self.slug = self.interpolate_slug\n end",
"def stale_slug?\n !((permanent_slug? && slug && !slug.empty?) || (slug_source_value.nil? || slug_source_value.empty?))\n end",
"def new_with_slugs?\n if localized?\n # We need to check if slugs are present for the locale without falling back\n # to a default\n new_record? && _slugs_translations.fetch(I18n.locale.to_s, []).any?\n else\n new_record? && _slugs.present?\n end\n end",
"def make_slugged_title\n return true unless self.published?\n return true unless self.slug.to_s.blank?\n self.slug = self.title.to_slug\n end",
"def should_generate_new_friendly_id?\n slug.blank?\n end",
"def should_generate_new_friendly_id?\n slug.blank?\n end",
"def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end",
"def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end",
"def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end",
"def should_generate_new_friendly_id?\n slug.blank? || name_changed?\n end",
"def should_generate_new_friendly_id?\n title_changed? || custom_slug_changed?\n end",
"def should_generate_new_friendly_id?\n slug.blank?\n end",
"def should_generate_new_friendly_id?\n slug.blank?\n end",
"def pages_slug_validation\n return unless catalog\n\n return unless catalog.pages.exists?(slug: slug)\n\n errors.add :slug, I18n.t(\"validations.item_type.pages_slug\")\n end",
"def found_using_outdated_friendly_id?\n finder_slug.id != slug.id\n end",
"def should_generate_new_friendly_id?\n\t name_changed?||self.slug.nil?\n\tend",
"def should_generate_new_friendly_id?\n\t\tslug.blank?\n\tend",
"def slug_unique_in_clinic?\n Department.in_clinic(self).where(slug: slug).count == 0\n end",
"def persisted_with_slug_changes?\n if localized?\n changes = _slugs_change\n return (persisted? && false) if changes.nil?\n\n # ensure we check for changes only between the same locale\n original = changes.first.try(:fetch, I18n.locale.to_s, nil)\n compare = changes.last.try(:fetch, I18n.locale.to_s, nil)\n persisted? && original != compare\n else\n persisted? && _slugs_changed?\n end\n end",
"def is_most_recent?\n sluggable.slug == self\n end",
"def is_most_recent?\n sluggable.slug == self\n end",
"def remember_if_slug_has_changed\n @slug_was_changed = slug_changed?\n end",
"def slug_uniqueness\n if name? and slug? and Quotum.where(slug: slug).where.not(id: id).exists?\n errors.add(:name, \"is unavailable\")\n end\n end",
"def uses_slug_cache?\n friendly_id_config.cache_column?\n end",
"def uses_slug_cache?\n friendly_id_config.cache_column?\n end",
"def uses_slug_cache?\n friendly_id_config.cache_column?\n end",
"def should_generate_new_friendly_id?\n new_record? || self[:slug].blank?\n end",
"def bad_slug?(object)\n params[:id] != object.to_param\n end"
] | [
"0.7531849",
"0.70434123",
"0.7031356",
"0.6907691",
"0.69001466",
"0.6841139",
"0.66248775",
"0.6604771",
"0.66036475",
"0.66036475",
"0.66036475",
"0.6590974",
"0.6581869",
"0.6568581",
"0.6568581",
"0.6549414",
"0.65259534",
"0.65133417",
"0.6489964",
"0.64785665",
"0.6469195",
"0.63282835",
"0.63282835",
"0.630929",
"0.6302727",
"0.62969583",
"0.62969583",
"0.62969583",
"0.62864375",
"0.6260826"
] | 0.8027041 | 1 |
START Feed Action Tests | def test_get_feed
get :feed
assert_response :success
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mp3_feed_works\n get \"/podcast_feed/all/mp3/rss.xml\"\n assert last_response.ok?\n end",
"def fetch_test_feed\n logger.info 'FeedManager: env is test, fetching test data'\n data = Feedzirra::Feed.parse File.open(Rails.root.join('test', 'test_feeds', 'valid_feed.xml'), 'r').read\n return Feed.new :title => data.title,\n :items => data.entries,\n :url => data.url,\n :feed_url => data.feed_url,\n :valid => true\n\n end",
"def run_actions; end",
"def feed\n end",
"def test02_post_open_news_251RepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\trepostPopulate251\n\t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def start\n test_btc\n test_email\n end",
"def test_ID_25890_published_posts_01\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n publish_post_if_not_found(\"Sports\",\"Basketball\")\n end",
"def feed\n\n end",
"def test04_post_open_news_250RepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\trepostPopulate250\n\t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def refresh_feed\n open_feeds_menu\n expect(page).to have_css '#refresh-feed'\n find('#refresh-feed').click\n # Ensure entries have finished loading\n expect(page).to have_no_css 'div#loading'\nend",
"def test1Action\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n }\n )\n end",
"def action_run\n end",
"def atest_ID_25891_scheduled_posts_02\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n sleep 5\n go_to_scheduled_tab_on_your_post_page\n verify_text \"Your Posts\",\"Current Drafts\", \"Scheduled Posts\", \"Published Posts\", \"Scheduled\"\n assert $profile_edit_post.exists?\n assert $profile_delete.exists?\n assert $count_of_scheduled.exists?\n end",
"def test_00120_profilepage_check_new_activity_feed\n @topicdetail_page = @topiclist_page.go_to_topic(\"A Watir Topic\")\n title = \"Test q created by Watir - #{get_timestamp}\"\n @topicdetail_page.create_conversation(type: :question,\n title: title,\n details: [{type: :text, content: \"Watir test description\"}])\n\n @profile_page.goto_profile\n @browser.wait_until { !@profile_page.question_list_in_activity_pane.activity_at_title(title).nil? }\n activity_card = @profile_page.question_list_in_activity_pane.activity_at_title(title)\n activity_card.click_conv_link\n @browser.wait_until { @convdetail_page.convdetail.present? }\n assert @convdetail_page.root_post_title.text =~ /#{title}/ \n end",
"def test_00130_profilepage_check_activity_feed_link\n @profile_page.goto_profile\n @browser.wait_until { @profile_page.profile_activity_item.present? }\n\n @browser.wait_until { @profile_page.question_list_in_activity_pane.activity_list.size > 0 }\n activity_card = @profile_page.question_list_in_activity_pane.activity_list[0]\n conv = activity_card.conv_title\n activity_card.click_conv_link\n\n @browser.wait_until { @convdetail_page.convdetail.present? }\n assert @convdetail_page.convdetail.text.include? conv\n end",
"def create_feed\n end",
"def create_feed\n end",
"def create_feed\n end",
"def create_feed\n end",
"def subscribe_feed(url)\n open_feeds_menu\n find('#add-subscription').click\n expect(page).to have_css '#subscribe-feed-popup'\n within '#subscribe-feed-popup' do\n fill_in 'Feed', with: url\n find('#subscribe-submit').click\n end\n\n # Ensure entries have finished loading\n expect(page).to have_no_css 'div#loading'\nend",
"def test03_post_open_news_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def feed( category, message, feedOptions = nil )\n feedTask = FeedTask.new( @web, self, category, message, feedOptions )\n feedTask.perform()\n end",
"def test02_flag_repost_article_TC_24323\n\t\trepostArticlePop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T2: FAILED! User unable to flag post.\"\n\t\tend\n\tend",
"def test03_post_open_news_251RepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepostPopulate251\n\t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def helper_start_test(message, encoded_message = nil)\n post '/start', { message: message }, session\n\n assert_equal 302, last_response.status\n assert_flash 'Time started.'\n assert_time_start(encoded_message || message)\n\n # follow redirect back to actions page\n get last_response['Location']\n\n assert_all_actions\n assert_displayed_flash 'Time started.'\n end",
"def test05_post_open_news_250RepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepostPopulate250\n\t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end",
"def begin_lights_test\n puts 'Invoker: start test'\n @on_start.execute if @on_start.is_a? Command\n\n puts 'Invoker: ...loading last tests...'\n\n puts 'Invoker: starting last tests'\n @on_finish.execute if @on_finish.is_a? Command\n end",
"def run_app_tests\n end",
"def run_test\n # Add your code here...\n end"
] | [
"0.6573332",
"0.6347964",
"0.6263043",
"0.624825",
"0.61992455",
"0.6184532",
"0.61655474",
"0.6161431",
"0.6106196",
"0.60878974",
"0.6031313",
"0.5993742",
"0.59935594",
"0.5933913",
"0.5873512",
"0.5824045",
"0.5824045",
"0.5824045",
"0.5824045",
"0.57848823",
"0.5769436",
"0.57563376",
"0.5713681",
"0.57117707",
"0.5705145",
"0.5699973",
"0.5693046",
"0.5681883",
"0.56438524",
"0.5628632"
] | 0.6938861 | 0 |
Class method version of Gorilla::Unitnormalize, to handle, e.g., Enumerable, Numeric, and Range objects. | def normalize input, &block
case input
when Range
normalize(input.min, &block)..normalize(input.max, &block)
when Enumerable
input.map { |unit| normalize unit, &block }
when Numeric
normalize Unit.new(input), &block
else # Unit, etc.
input.normalize(&block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to(unit)\n unit = Unit.get(unit) if unit.is_a?(Symbol)\n self.normalize + unit.denormalize\n end",
"def normalize\n divide(magnitude)\n end",
"def normalized; end",
"def normalize\n self / self.norm\n end",
"def normalize; end",
"def normalize!\n\t\t\tmagnitude = self.mag\n\t\t\t@elem.collect! {|elem| elem / magnitude}\n\t\t\treturn self\n\t\tend",
"def normalize!; end",
"def normalize(type); end",
"def normalize!; length = 1.0; self; end",
"def normalize\n end",
"def normalize!\n\t\t\tmag = self.mag\n\t\t\t@elements = @elements.collect {|elem| elem / mag }\n\t\t\treturn self\n\t\tend",
"def normalize( value )\n value\n end",
"def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\t\t\tunitq[3] /= magnitude\n\t\t\treturn unitq\n\t\tend",
"def normalize\n @value = case @kind\n when 'fixed' then @value*1024\n when 'enum', 'range' then @value.map{ |v| v*1024 }\n end if @unit == 'GB'\n end",
"def normalize(min, max, val)\n\t\t(val - min) / (max - min)\n\tend",
"def unnormalized; end",
"def normalized=(_arg0); end",
"def normalize!\n end",
"def normalized\n @value\n end",
"def normalized\n @normalized ||= valid_range? ? range : normalized_range(range)\n rescue Exception => e \n # puts e.message\n value\n end",
"def normalize(min, max)\n map { |v| v.respond_to?(:-) ? (v - min) / (max - min) : v }\n end",
"def normalize!\n self.replace self.normalize\n end",
"def normalize!\n normalize self\n end",
"def normalize(x)\n if x.ndim == 2\n s = Numo::SFloat::Math.sqrt((x**2).sum(axis: 1))\n x / s.reshape(s.shape[0], 1)\n elsif x.ndim == 1\n s = Numo::SFloat::Math.sqrt((x**2).sum)\n x / s\n end\nend",
"def normalize!\n end",
"def normalize(domain); end",
"def normalize(value)\n Array(attrs[:normalize]).each do |method|\n next unless method.is_a?(Symbol)\n\n value = value.send(method) if value.respond_to?(method)\n end\n\n value\n end",
"def normalize\n mag = self.magnitude\n Vector.new @x/mag, @y/mag, @z/mag\n end",
"def normalize!\n total_items = @items.size\n raise \"No items set\" if total_items == 0\n total_sum = @items.values.map{|x| x[:value] }.inject(:+).to_f\n\n @items.each_pair do |key, values|\n @items[key][:normalized] = values[:value] / total_sum\n end\n @normalized = true\n end",
"def normalize\n x_alize(true)\n end"
] | [
"0.6815934",
"0.67310166",
"0.67151874",
"0.6477827",
"0.64341897",
"0.64118713",
"0.6294422",
"0.6287442",
"0.6274068",
"0.62591845",
"0.6256661",
"0.6229033",
"0.62161964",
"0.60913044",
"0.60724473",
"0.60711014",
"0.606446",
"0.60351926",
"0.60207754",
"0.60141015",
"0.6013581",
"0.5951011",
"0.5925667",
"0.59202975",
"0.5907483",
"0.58795595",
"0.5870629",
"0.5859555",
"0.5844761",
"0.583997"
] | 0.7427953 | 0 |
Returns whether a unit was defined as metric. ==== Example class Coolness true end Coolness.new(1, :megaFonzie).metric? => true | def metric?
unit and self.class.rules[unit][:metric] || false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metric?\n @metric\n end",
"def metric_ton? = unit == 'metric-ton'",
"def metrics?\n @metrics\n end",
"def pixel_per_meter? = unit == 'pixel-per-meter'",
"def metricModel? \n model = Sketchup.active_model\n\n # Get the length Units of the active model from the unitsOptions\n # 0=inches,1=feet,2=mm,3=cm,4=m\n unit = model.options[\"UnitsOptions\"][\"LengthUnit\"]\n return !(unit==0 || unit==1)\nend",
"def unit?(unit)\n @units.include?(unit)\n end",
"def meter_per_second? = unit == 'meter-per-second'",
"def metrics?\n public? && @metrics\n end",
"def unit?\n !@unit.nil?\n end",
"def has_metric(types)\n has_gauges(:metric, types, kind_class_name: 'analyzing/metric')\n end",
"def valid_metric?(metric)\n @metrics.keys.include? metric\n end",
"def is_units?(); @type == GRT_UNITS; end",
"def earth_mass? = unit == 'earth-mass'",
"def grain? = unit == 'grain'",
"def units?\n return units.any?\n end",
"def carat? = unit == 'carat'",
"def scored?\n metric_type_codename == :score ||\n metric_type_codename == :wiki_rating\nend",
"def is_base_unit?\n Dimensions::BASE_QUANTITIES.map {|base| base.remove_underscores }.include? self.measures\n end",
"def is_benchmark_unit?\n @factor == 1.0\n end",
"def include_metrics?\n include_metrics.nil? || include_metrics\n end",
"def metric_with_unit(unit)\n metrics.select {|m| Unit.new(m) <=> Unit.new(unit)}\n end",
"def revolution_per_meter? = unit == 'revolution-per-meter'",
"def in_unit?(unit)\n unit = Unit.find(unit) if unit.is_a?(Numeric)\n units.include?(unit)\n end",
"def megapixel? = unit == 'megapixel'",
"def http_metrics?\n http_metrics\n end",
"def metrics\n standard.unit.convert_to_metric imperials\n end",
"def solar_mass? = unit == 'solar-mass'",
"def megahertz? = unit == 'megahertz'",
"def kilogram? = unit == 'kilogram'",
"def constructs_units?\n each_constructable_item do |item, base, name|\n return true if base == \"unit\"\n end\n\n false\n end"
] | [
"0.8225088",
"0.81232244",
"0.73423445",
"0.7090844",
"0.6979925",
"0.6822958",
"0.6769892",
"0.6758768",
"0.6748588",
"0.667046",
"0.66321015",
"0.66016424",
"0.6527534",
"0.6502581",
"0.64179325",
"0.63817996",
"0.633297",
"0.6319842",
"0.6311718",
"0.6305567",
"0.62871915",
"0.6259649",
"0.6252295",
"0.618203",
"0.61642414",
"0.6160685",
"0.6119553",
"0.60963213",
"0.6075501",
"0.60711443"
] | 0.89512295 | 0 |
Get exception status detail | def status_details(exception)
StatusDetails.new(message: exception&.message, trace: exception&.backtrace&.join("\n"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n return 404 if NOT_FOUND_ERRORS.include? @exception.class.to_s\n @exception.respond_to?(:http_status) ? @exception.http_status : 500\n end",
"def get_http_status exception\n http_status = nil\n if defined?(ActionDispatch::ExceptionWrapper) &&\n ActionDispatch::ExceptionWrapper.respond_to?(\n :status_code_for_exception\n )\n http_status =\n ActionDispatch::ExceptionWrapper.status_code_for_exception(\n exception.class.name\n )\n end\n\n http_status\n end",
"def exception_details(e, msg); end",
"def status_code_for_exception(exception)\n Egregious.status_code_for_exception(exception)\n end",
"def status_message\n data.status_message\n end",
"def status_message\n @data[:status_message]\n end",
"def http_status exception\n http_status = nil\n if defined?(ActionDispatch::ExceptionWrapper) &&\n ActionDispatch::ExceptionWrapper.respond_to?(\n :status_code_for_exception\n )\n http_status =\n ActionDispatch::ExceptionWrapper.status_code_for_exception(\n exception.class.name\n )\n end\n\n http_status\n end",
"def stack_status_reason\n data[:stack_status_reason]\n end",
"def status\n inspect\n end",
"def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end",
"def inspect\n \"#<Rapture::HTTP::HTTPException @code=#{@code} @message=#{message.inspect}>\"\n end",
"def status_code\n STATUS_CODE\n end",
"def status_code\n data.status_code\n end",
"def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end",
"def http_status\n self[:status_code]\n end",
"def extract_information_from(env)\n exception = env['action_dispatch.exception']\n exception_wrapper = ActionDispatch::ExceptionWrapper.new(env, exception)\n @rescue_response = ActionDispatch::ExceptionWrapper.rescue_responses[exception.class.name]\n @message = exception.message\n @status_code = exception_wrapper.status_code\n end",
"def status_message; end",
"def status\n info[\"Status\"]\n end",
"def to_s\n @error_status.to_s\n end",
"def status status\n yield\n ActiveRecord::Base.connection_pool.with_connection do \n @log.update(success_status: status, is_error: 0, error_status: nil, error_message: nil)\n end\n rescue => e\n ActiveRecord::Base.connection_pool.with_connection do \n @log.update(success_status: 0, is_error: 1, error_status: status, error_message: e.to_s)\n end\n Rails.logger.debug \"Exception at status \" + status.to_s + \" : \" + e.message + \" --- \" + e.backtrace.to_s\n raise\n ensure\n # call to request url\n # request_url(repo, status, caller_locations(2,2)[0].label)\n end",
"def status_code\n self.status.to_i\n end",
"def status\n info['status']\n end",
"def exit_status_from_exception; end",
"def status_line\n\t\tst = self.status || self.derived_status_code\n\t\treturn STATUS_LINE_FORMAT % [ st, HTTP::STATUS_NAME[st] ]\n\tend",
"def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end",
"def status(exception)\n exception.is_a?(RSpec::Expectations::ExpectationNotMetError) ? Status::FAILED : Status::BROKEN\n end",
"def status_code\n attributes[:status_code]\n end",
"def last_error\n if current_status && current_status.error_class.present?\n {\n error_class: current_status.error_class,\n error_message: current_status.error_message,\n error_trace: current_status.error_backtrace\n }.with_indifferent_access\n else\n super\n end\n end",
"def getStatusCode\n @_statusCode\n end",
"def exception_info(e)\n backtrace = Array(e.backtrace)[0, 500]\n\n res = {\n 'class' => e.class.to_s,\n 'message' => e.message,\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(\"#{e.class}#{backtrace[0]}\")\n }\n\n if original = (e.respond_to?(:original_exception) && e.original_exception)\n remote_backtrace = []\n remote_backtrace << original.message\n if original.backtrace\n remote_backtrace.concat(Array(original.backtrace)[0,500])\n end\n res['remote_backtrace'] = remote_backtrace.join(\"\\n\")\n end\n\n res\n end"
] | [
"0.7047844",
"0.6799808",
"0.676369",
"0.6662642",
"0.66613734",
"0.6559857",
"0.6522813",
"0.65098566",
"0.6508267",
"0.64736664",
"0.64581007",
"0.6454799",
"0.6428949",
"0.64248025",
"0.64009047",
"0.63842976",
"0.634557",
"0.63399905",
"0.6338014",
"0.63068277",
"0.6290832",
"0.6285498",
"0.6256946",
"0.6242243",
"0.6238268",
"0.6237118",
"0.6224932",
"0.62199754",
"0.6207325",
"0.618327"
] | 0.81669265 | 0 |
Retrieve all CPEs and their associated variants. The 'live' field in the output indicates whether any advisory has been shipped for that CPE and variant. This API does not require authentication. :apiurl: /api/v1/security/cpes :apimethod: GET :apiresponseexample: file:publican_docs/Developer_Guide/api_examples/cpes.json | def cpes
@variants = Variant.all.group_by{|variant| variant.cpe || ''}.sort_by{|cpe,v| cpe}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cps = Cp.all\n end",
"def index\n @capexes = Capex.all\n end",
"def index\n @pcs = Pc.all\n end",
"def vpcs\n @vpcs ||= init_vpcs\n end",
"def get_variants\n return [] if is_pdc?\n get_variants_by_package.values.flatten.uniq\n end",
"def cpe\n\t\t\t\t\twhere(:reference_name => \"cpe\").select('DISTINCT value')\n\t\t\t\tend",
"def index\n @c_povolanis = CPovolani.all\n end",
"def index\n @cepas = Cepa.all\n end",
"def index\n @csps = Csp.all\n end",
"def nested_cpes(children)\n cpes = []\n children.each do |child|\n if child.has_key?('cpe_match')\n child['cpe_match'].each do |cpe_match|\n cpes << cpe_match['cpe23Uri'] if cpe_match.has_key?('cpe23Uri')\n cpes << cpe_match['cpe22Uri'] if cpe_match.has_key?('cpe22Uri')\n end\n elsif child.has_key?('children')\n cpes.push *nested_cpes(child['children']).flatten\n end\n end\n cpes\n end",
"def get_cages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CagesApi.get_cages ...'\n end\n # resource path\n local_var_path = '/inventory/cages'\n\n # query parameters\n query_params = {}\n query_params[:'AmsProtocolId'] = opts[:'ams_protocol_id'] if !opts[:'ams_protocol_id'].nil?\n query_params[:'AmsResearcherId'] = opts[:'ams_researcher_id'] if !opts[:'ams_researcher_id'].nil?\n query_params[:'AmsMouseId'] = opts[:'ams_mouse_id'] if !opts[:'ams_mouse_id'].nil?\n query_params[:'AmsRackId'] = opts[:'ams_rack_id'] if !opts[:'ams_rack_id'].nil?\n query_params[:'AmsRoomId'] = opts[:'ams_room_id'] if !opts[:'ams_room_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CageList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CagesApi#get_cages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_available_cartridges\n args = Hash.new\n args['--porcelain'] = true\n args['--with-descriptors'] = true\n result = execute_direct(@@C_CONTROLLER, 'cartridge-list', args, false)\n result = parse_result(result)\n cart_data = JSON.parse(result.resultIO.string)\n cart_data.map! {|c| OpenShift::Cartridge.new(YAML.load(c))}\n end",
"def index\n @vpcs = Vpc.order(:name).all\n end",
"def index\n @vas_responses = VasResponse.all\n end",
"def index\n @search = Scomp.search(params[:q])\n @scomps = @search.result\n end",
"def index\n @pecas = Peca.find :all, :order => :produto_id\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pecas }\n end\n end",
"def index\n @socio_cpfs = SocioCpf.all\n end",
"def get_computes(request)\n # --- Get User's VMs ---\n vmpool = VirtualMachinePoolOCCI.new(\n @client,\n POOL_FILTER)\n\n # --- Prepare XML Response ---\n rc = vmpool.info\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return to_occi_xml(vmpool, :code=>200, :verbose=>request.params['verbose'])\n end",
"def index\n @selected_options_of_pcs = SelectedOptionsOfPc.all\n end",
"def index\n @socio_spcs = SocioSpc.all\n end",
"def get_copays\n raise InvalidVBSRequestError, request_data.errors unless request_data.valid?\n\n response = request.post('/Prod/GetStatementsByEDIPIAndVistaAccountNumber', request_data.to_hash)\n\n ResponseData.build(response: response).handle\n end",
"def index\n @prod_cotis = ProdCoti.all\n end",
"def cpes_affected\n vendor_data = @entry.dig('cve', 'affects', 'vendor', 'vendor_data') || []\n vendor_data.map do |vendor_data_entry|\n vendor_name = vendor_data_entry['vendor_name']\n vendor_data_entry\n .fetch('product', {})\n .fetch('product_data', [])\n .map {|product_data_entry| \"#{vendor_name}:#{product_data_entry['product_name']}\"}\n end.flatten.uniq\n end",
"def get_all_peptide_members \n raise \"This Ensembl::Compara::Member is not a gene!\" unless self.source_name == \"ENSEMBLGENE\"\n return Ensembl::Compara::Member.find_all_by_gene_member_id(self.member_id) \n end",
"def index\n @pe_exchange_products = PeExchangeProduct.all.page(params[:page]).per(params[:per_page])\n respond_to do |format|\n format.html\n format.json { render json:\n list_json(@pe_exchange_products, :include => [:pe_product])\n }\n end\n end",
"def list_pucs\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:pucs_page] = params['page']\n\n\t\t render_list_pucs\n\n\t\t return \n\telse\n\t\tsession[:pucs_page] = nil\n\tend\n\n\tlist_query = \"@puc_pages = Paginator.new self, Puc.count, @@page_size,@current_page\n\t @pucs = Puc.find(:all,\n\t\t\t\t :limit => @puc_pages.items_per_page,\n\t\t\t\t :offset => @puc_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_pucs\nend",
"def get_comps(zpid,count)\n url_s=@@zillow_webservice_url+'GetComps.htm?zws-id='+@zwsid+'&zpid='+zpid.to_s+'&count='+count.to_s\n fetch_result(url_s)\n end",
"def get_vpcs\n resp = client.describe_vpcs\n return resp.vpcs.map { |vpc| vpc.vpc_id }\n end",
"def index\n @proccs = Procc.all\n end",
"def get_results\n response = @api.get(@cloud.url(:result, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @results = []\n response.each do |res|\n @results.push(CopyleaksApi::ResultRecord.new(res))\n end\n @results\n end"
] | [
"0.5546804",
"0.54726803",
"0.53062415",
"0.5253674",
"0.5248795",
"0.52337486",
"0.510101",
"0.4996687",
"0.4957536",
"0.49566272",
"0.49063808",
"0.48832402",
"0.48682535",
"0.4859834",
"0.48554453",
"0.48535448",
"0.48460883",
"0.48076898",
"0.47946066",
"0.47735325",
"0.47474113",
"0.47127032",
"0.47086978",
"0.46998695",
"0.46939018",
"0.46867868",
"0.46862468",
"0.46816865",
"0.4677226",
"0.46753383"
] | 0.5975741 | 0 |
Creates a SUBSCRIBE frame. Sets `ack` header to 'auto' unless it is already set to 'client' or 'clientindividual'. | def subscribe_frame d, h
h[:ack] = 'auto' unless ['client', 'client-individual'].include?(h[:ack])
create_frame 'SUBSCRIBE', [{:id => OnStomp.next_serial}, h, {:destination => d}]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_ack_with_symbol_11\n if @conn.protocol != Stomp::SPL_11\n assert true\n return\n end\n sid = @conn.uuid()\n queue = make_destination()\n @conn.subscribe queue, :ack => :client, :id => sid\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_11\"\n msg = @conn.receive\n assert_nothing_raised {\n # ACK has two REQUIRED headers: message-id, which MUST contain a value \n # matching the message-id for the MESSAGE being acknowledged and \n # subscription, which MUST be set to match the value of the subscription's \n # id header.\n @conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']\n }\n checkEmsg(@conn)\n end",
"def subscribe dest, ack=false\n send_frame \"SUBSCRIBE\", {:destination=>dest, :ack=>(ack ? \"client\" : \"auto\")}\n end",
"def test_client_ack_with_symbol_10\n if @conn.protocol != Stomp::SPL_10\n assert true\n return\n end\n queue = make_destination()\n @conn.subscribe queue, :ack => :client\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_10\"\n msg = @conn.receive\n assert_nothing_raised {\n # ACK has one required header, message-id, which must contain a value \n # matching the message-id for the MESSAGE being acknowledged.\n @conn.ack msg.headers['message-id']\n }\n checkEmsg(@conn)\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def test_client_ack_with_symbol_12\n if @conn.protocol != Stomp::SPL_12\n assert true\n return\n end\n sid = @conn.uuid()\n queue = make_destination()\n @conn.subscribe queue, :ack => :client, :id => sid\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_11\"\n msg = @conn.receive\n assert_nothing_raised {\n # The ACK frame MUST include an id header matching the ack header \n # of the MESSAGE being acknowledged.\n @conn.ack msg.headers['ack']\n }\n checkEmsg(@conn)\n end",
"def subscribe\n @conn.subscribe(@queue_name, @headers)\n @@log.debug(\"subscribe to: #{@queue_name}\")\n @@log.debug(\"headers: #{@headers.inspect}\")\n end",
"def ack_frame *args\n create_ack_or_nack 'ACK', args\n end",
"def ack(subscription_headers, message)\n #p [:ack, message.headers[\"message-id\"]]\n if message.headers[\"message-id\"].to_s.strip != \"\" && subscription_headers[\"ack\"].to_s == \"client\"\n SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }\n connection.ack message.headers[\"message-id\"], { }\n else\n SMQueue.dbg { [:smqueue, :ack, :not_acknowledging, message].inspect }\n end\n if ENV['PAUSE_SMQUEUE']\n $stderr.print \"press enter to continue> \"\n $stderr.flush\n $stdin.gets\n end\n end",
"def api_create_and_send(master, side_table = nil)\n data = { subscriber: make_hash }\n data[:subscriberMessage] = master.subscriber_message_data\n data[:subscriber][:allowResubscribe] = true\n data[:sideTable] = side_table.payload_hash unless side_table.nil?\n\n path = '/composite/subscribeAndSend'\n attrs = data[:subscriber][:attributes][:attributes]\n # attrs has the form [ {name: :attr1, value: 'val1'}, {name: ...}, ...]\n email = attrs.select {|h| h[:name] == :email}.first[:value]\n master_id = master.subscriber_message_data[:masterId]\n info(\"Yesmail: subscribeAndSend #{email} to master #{master_id}\")\n handler.post(data, path)\n end",
"def subscription_opts\n { manual_ack: true, block: true }\n end",
"def create_subscription(sender)\n PsegRecurring::Subscription.new(@credentials).send_subscription(sender)\n end",
"def ack(opts={})\n\t\t\t# Set delivery tag\n\t\t\tdelivery_tag = opts.delete(:delivery_tag)\n\t\t\tdelivery_tag ||= self.delivery_tag\n\t\t\traise Bunny::AcknowledgementError, \"No delivery tag received\" unless delivery_tag\n\t\t\t\n client.send_frame(\n Qrack::Protocol09::Basic::Ack.new({:delivery_tag => delivery_tag, :multiple => false}.merge(opts))\n )\n\n\t\t\t# reset delivery tag\n\t\t\tself.delivery_tag = nil if self.delivery_tag == delivery_tag\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def acknowledge subscription, *ack_ids\n subscriber.acknowledge subscription: subscription_path(subscription), ack_ids: ack_ids\n end",
"def subscribe(params = {})\n @connection ||= stub_connection\n @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n @subscription.singleton_class.include(ChannelStub)\n @subscription.subscribe_to_channel\n @subscription\n end",
"def subscribe(subscription)\n raise \"subscribe is only valid on ZMQ::SUB sockets\" unless @socktype == ZMQ::SUB\n @data_socket.setsockopt ZMQ::SUBSCRIBE, subscription\n end",
"def subscribe(subscription)\n raise \"subscribe is only valid on ZMQ::SUB sockets\" unless @socktype == ZMQ::SUB\n @data_socket.setsockopt ZMQ::SUBSCRIBE, subscription\n end",
"def ack(opts = {})\n # Set delivery tag\n if delivery_tag.nil? and opts[:delivery_tag].nil?\n raise Bunny::AcknowledgementError, \"No delivery tag received\"\n else\n self.delivery_tag = opts[:delivery_tag] if delivery_tag.nil?\n end\n\n opts = {:delivery_tag => delivery_tag, :multiple => false}.merge(opts)\n\n client.send_frame(Qrack::Protocol::Basic::Ack.new(opts))\n\n # reset delivery tag\n self.delivery_tag = nil\n end",
"def subscribe(args = {})\n :no_response\n end",
"def subscribe(routing_key, options = {}, &block)\n q = bind_queue(routing_key)\n options = options.merge(manual_ack: true)\n\n q.subscribe(options) do |delivery_info, metadata, payload|\n block.call(delivery_info, metadata, payload)\n @channel.ack(delivery_info.delivery_tag)\n end\n end",
"def subscribe(subscription)\n consumer_queue = \"#{subscription.consumer.id}@#{subscription.channel}\"\n queue = subscription_channel.queue(consumer_queue, :arguments => {'x-expires' => Push.config.amqp.queue_ttl * 1000})\n fanout = subscription_channel.fanout(subscription.channel, :auto_delete => true)\n\n subscription.on_delete {\n logger.debug \"AMQP unbinding `#{consumer_queue}`\"\n # The AMQP server automatically deletes and unbinds this queue after the\n # number of seconds specified in the 'x-expires' argument above.\n }\n\n logger.debug \"AMQP binding `#{consumer_queue}` to exchange `#{subscription.channel}`\"\n queue.bind(fanout).subscribe(:ack => true) do |metadata, payload|\n logger.debug \"AMQP acking payload `#{payload}`\"\n metadata.ack\n subscription.process_message(payload)\n end\n\n # Install signal handlers to deal with cleaning up potentially long running\n # connections when we kill the server for reboots, etc.\n Signal.trap('TERM'){ subscription.delete }\n end",
"def subscribe_client(client,email)\n cursor = parse \"BEGIN msf.acm_utils.manage_tocs(:publication, :cno, :action, :email, :cur_status, :status_dt, :r_str); end;\"\n cursor.bind_param ':cno', client.to_s\n cursor.bind_param ':email', email ||= ''\n cursor.bind_param ':action', 'ADD'\n exec cursor do\n cursor[':r_str'] == 'Ok'\n end\n end",
"def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params['hub.verify_token']\n \n content_type 'text/plain', :charset => 'utf-8'\n unless callback and topic and verify\n throw :halt, [400, \"Bad request: Expected 'hub.callback', 'hub.topic', and 'hub.verify'\"]\n end\n throw :halt, [400, \"Bad request: Empty 'hub.callback' or 'hub.topic'\"] if (callback.empty? or topic.empty?)\n # anchor part in the url not allowed by the spec\n throw :halt, [400, \"Bad request: Invalid URL\"] if (callback.include?('#') or topic.include?('#'))\n \n throw :halt, [400, \"Bad request: Unrecognized mode\"] unless ['subscribe', 'unsubscribe'].include?(mode)\n\n # Processing optional secret\n secret = params['hub.secret'] ? params['hub.secret'] : ''\n \n # remove invalid verify modes \n verify = Array(verify.split(',')).delete_if { |x| not ['sync','async'].include?(x) }\n throw :halt, [400, \"Bad request: Unrecognized verification mode\"] if verify.empty?\n # For now, only using the first preference of verify mode\n verify = verify[0]\n #throw :halt, [400, \"Bad request: Unrecognized verification mode\"] unless ['sync', 'async'].include?(verify)\n begin\n hash = Topic.to_hash(topic)\n tp = DB[:topics].filter(:url => hash).first\n throw :halt, [404, \"Not Found\"] unless tp[:id]\n \n state = (verify == 'async') ? 1 : 0\n query = { 'hub.mode' => mode,\n 'hub.topic' => topic,\n 'hub.lease_seconds' => 0, # still no subscription refreshing support\n 'hub.challenge' => gen_id}\n query['hub.verify_token'] = vtoken if vtoken\n if verify == 'sync'\n MyTimer.timeout(Config::GIVEUP) do\n res = HTTPClient.get_content(callback, query)\n opts = \"m=#{mode} c=#{callback} t=#{topic} v=#{verify} -> res=#{res.inspect}\"\n raise \"do_verify(#{opts})\" unless res and res == query['hub.challenge']\n end\n state = 0\n end\n \n # Add subscription\n # subscribe/unsubscribe to/from ALL channels with that topic\n cb = DB[:subscriptions].filter(:topic_id => tp[:id], :callback => Topic.to_hash(callback))\n cb.delete if (mode == 'unsubscribe' or cb.first)\n if mode == 'subscribe'\n raise \"DB insert failed\" unless DB[:subscriptions] << {\n :topic_id => tp[:id], :callback => Topic.to_hash(callback), \n :vtoken => vtoken, :vmode => verify, :secret => secret, :state => state }\n end\n throw :halt, verify == 'async' ? [202, \"202 Scheduled for verification\"] : \n [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [409, \"Subscription verification failed: #{e.to_s}\"]\n end\n end",
"def gen_subscriber\n subscriber = @context.socket(ZMQ::SUB)\n\n subscriber.setsockopt(ZMQ::RCVTIMEO, @wait_timeout * 10**3)\n subscriber.connect(@subscriber_endpoint)\n\n subscriber\n end",
"def subscribe(subject, opts={}, &callback)\n sid = nil\n sub = nil\n synchronize do\n sid = (@ssid += 1)\n sub = @subs[sid] = Subscription.new\n end\n sub.subject = subject\n sub.callback = callback\n sub.received = 0\n sub.queue = opts[:queue] if opts[:queue]\n sub.max = opts[:max] if opts[:max]\n\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n @flush_queue << :sub\n\n # Setup server support for auto-unsubscribe when receiving enough messages\n unsubscribe(sid, opts[:max]) if opts[:max]\n\n sid\n end",
"def subscribe(subscription)\n queue = connection.queue \"#{subscription.consumer.id}@#{subscription.channel}\",\n :auto_delete => true,\n :arguments => {'x-expires' => Push.config.amqp.queue_ttl * 1000}\n fanout = connection.exchange(subscription.channel, :auto_delete => true, :type => :fanout)\n queue.bind(fanout)\n\n # Cleanup is handled automatically for us by the timeout that we set on the \n # client connection queue. There's also no channel clean-up since we're not \n # running this inside of a concurrent run-time environment.\n\n # Try popping a message off the queue, deal with Bunny idiosyncracies, and \n # pass the message into the subscription object for further processing.\n subscription.process_message(self.class.process_message(queue.pop))\n end",
"def ack(msg)\n return unless msg.sub\n msg.sub.synchronize do\n ack_proto = STAN::Protocol::Ack.new({\n subject: msg.proto.subject,\n sequence: msg.proto.sequence\n }).to_proto\n nats.publish(msg.sub.ack_inbox, ack_proto)\n end\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def subscribe(subject, opts={}, &callback)\n return unless subject and not draining?\n sid = (@ssid += 1)\n sub = @subs[sid] = { :subject => subject, :callback => callback, :received => 0 }\n sub[:queue] = opts[:queue] if opts[:queue]\n sub[:max] = opts[:max] if opts[:max]\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n # Setup server support for auto-unsubscribe\n unsubscribe(sid, opts[:max]) if opts[:max]\n sid\n end",
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_obj.properties[:delivery_tag] })\n end\n end"
] | [
"0.55870736",
"0.55790424",
"0.54074484",
"0.5380273",
"0.53647137",
"0.5324904",
"0.5308",
"0.5260508",
"0.5181441",
"0.49778032",
"0.49193686",
"0.49107003",
"0.48726657",
"0.481885",
"0.47889104",
"0.4776266",
"0.4776266",
"0.47730666",
"0.47506678",
"0.47465703",
"0.47461888",
"0.47458687",
"0.4738096",
"0.46930036",
"0.46860835",
"0.46416408",
"0.46056908",
"0.46017775",
"0.4588609",
"0.45835155"
] | 0.6750201 | 0 |
Creates an ACK frame | def ack_frame *args
create_ack_or_nack 'ACK', args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ack(opts={})\n\t\t\t# Set delivery tag\n\t\t\tdelivery_tag = opts.delete(:delivery_tag)\n\t\t\tdelivery_tag ||= self.delivery_tag\n\t\t\traise Bunny::AcknowledgementError, \"No delivery tag received\" unless delivery_tag\n\t\t\t\n client.send_frame(\n Qrack::Protocol09::Basic::Ack.new({:delivery_tag => delivery_tag, :multiple => false}.merge(opts))\n )\n\n\t\t\t# reset delivery tag\n\t\t\tself.delivery_tag = nil if self.delivery_tag == delivery_tag\n end",
"def send_ack\n sock.put('+')\n vprint_status('Sending ack...')\n end",
"def nack_frame *args\n create_ack_or_nack 'NACK', args\n end",
"def ack(opts = {})\n # Set delivery tag\n if delivery_tag.nil? and opts[:delivery_tag].nil?\n raise Bunny::AcknowledgementError, \"No delivery tag received\"\n else\n self.delivery_tag = opts[:delivery_tag] if delivery_tag.nil?\n end\n\n opts = {:delivery_tag => delivery_tag, :multiple => false}.merge(opts)\n\n client.send_frame(Qrack::Protocol::Basic::Ack.new(opts))\n\n # reset delivery tag\n self.delivery_tag = nil\n end",
"def ack msgid\n send_frame \"ACK\", 'message-id'=> msgid\n end",
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_obj.properties[:delivery_tag] })\n end\n end",
"def ack(msg_info)\n end",
"def ACK08=(arg)",
"def ACK05=(arg)",
"def ACK01=(arg)",
"def acknowledge_frame sequence_number\n @stats[:acks_sent] += 1\n\n puts \"Acking #{sequence_number}\"\n\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n\n # Can we write out something in our buffer?\n if expected_frame == sequence_number\n cur_seq_num = sequence_number\n\n while cur_seq_num < max_frame and not @buffer[cur_seq_num].nil? do\n # Get contents of the buffer\n buffer = @buffer[cur_seq_num]\n break if buffer == \"\"\n\n # Write out the buffer\n puts \"WRITING #{@current_frame}\"\n @file.write buffer\n\n # Clear memory\n @buffer[cur_seq_num] = \"\"\n @buffer_len -= 1 if @options[:implementation] == :selective_repeat\n\n # Consider the next frame\n cur_seq_num += 1\n @current_frame += 1\n @next_frame += 1 \n @delivered += @options[:frame_size]\n end\n end\n\n# if (@delivered % (@options[:frame_size] * @options[:window_size])) == 0\n blah_frame = @next_frame % (@options[:window_size] * 2)\n blah_frame = (@options[:window_size]*2) if blah_frame == 0 and max_frame == (@options[:window_size]*2)\n if blah_frame == max_frame\n puts \"Window received.\"\n receive_next_window\n end\n\n if drop_ack? and not done?\n puts \"Dropping Ack\"\n @stats[:acks_dropped] += 1\n return\n end\n\n if (sequence_number+1) == (@options[:window_size] * 2)\n @socket.puts \"ACK 0 #{@number}\"\n else\n @socket.puts \"ACK #{sequence_number+1} #{@number}\"\n end\n\n if @next_frame == @total_frames\n puts \"Delivered\"\n done\n\n unless @file.is_a? StringIO\n stop_timeout\n @file.close\n @file = nil\n end\n end\n end",
"def test_creating_receive_ACK_message\n test_string = @mf.hex_string_to_string(\"82 00 82\")\n test_message = @msg_fac.new_incoming_message(test_string)\n assert_kind_of(HAIthermo::Message::ReceiveACK, test_message)\n end",
"def ACK10=(arg)",
"def ACK07=(arg)",
"def ACK04=(arg)",
"def ACK06=(arg)",
"def ack\n unless acked?\n @acked = true\n @connection.future(:ack, delivery_info.delivery_tag).value\n end\n end",
"def ACK09=(arg)",
"def ACK03=(arg)",
"def screencast_frame_ack(session_id:)\n {\n method: \"Page.screencastFrameAck\",\n params: { sessionId: session_id }.compact\n }\n end",
"def nacknowledge_frame sequence_number\n @stats[:naks_sent] += 1\n\n # Already acked?\n return if @buffer[sequence_number] == \"\"\n\n @buffer[sequence_number] = nil\n\n # If GO_BACK_N algorithm, then we expect to receive all of the\n # frames again\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n\n if @options[:implementation] == :go_back\n next_frame = ((@window * @options[:window_size]) + (sequence_number % @options[:window_size]))\n @next_frame = [next_frame, @next_frame].min\n @current_frame = @next_frame\n\n # Undo work done\n \n max_frame = @options[:window_size] * ((@window % 2) + 1)\n (expected_frame+1..max_frame).each do |i|\n @buffer[i] = nil\n end\n end\n\n if drop_ack?\n @stats[:naks_dropped] += 1\n puts \"Dropped NAK\"\n return\n end\n\n puts \"NAK #{sequence_number}\"\n @socket.puts \"NAK #{sequence_number} #{@number}\"\n\n # we received a response, so good\n reset_timeout\n end",
"def ACK02=(arg)",
"def emitack(event, object, ack)\n @ws.send(get_emit_ack_object(event, object, increment_cnt).to_json)\n @acks[@cnt] = [event, ack]\n end",
"def test_client_ack_with_symbol_12\n if @conn.protocol != Stomp::SPL_12\n assert true\n return\n end\n sid = @conn.uuid()\n queue = make_destination()\n @conn.subscribe queue, :ack => :client, :id => sid\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_11\"\n msg = @conn.receive\n assert_nothing_raised {\n # The ACK frame MUST include an id header matching the ack header \n # of the MESSAGE being acknowledged.\n @conn.ack msg.headers['ack']\n }\n checkEmsg(@conn)\n end",
"def receive_acknowledgement sequence_number\n @stats[:acks_received] += 1\n\n frame_acknowledged = sequence_number-1\n if frame_acknowledged == -1\n frame_acknowledged = (@options[:window_size] * 2) - 1\n end\n puts \"Frame #{frame_acknowledged} ACK'd\"\n\n perform_acknowledgement frame_acknowledged\n end",
"def ack(subscription_headers, message)\n #p [:ack, message.headers[\"message-id\"]]\n if message.headers[\"message-id\"].to_s.strip != \"\" && subscription_headers[\"ack\"].to_s == \"client\"\n SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }\n connection.ack message.headers[\"message-id\"], { }\n else\n SMQueue.dbg { [:smqueue, :ack, :not_acknowledging, message].inspect }\n end\n if ENV['PAUSE_SMQUEUE']\n $stderr.print \"press enter to continue> \"\n $stderr.flush\n $stdin.gets\n end\n end",
"def ack?\n Capp::TCP_ACK == flags & Capp::TCP_ACK\n end",
"def replyWithAck?(pduPacket)\n\n Utils_visiona.verifyInput(CFDP::PDUPacket, pduPacket.class)\n return unless isclass2?\n\n status = (@finishType.nil? ? 1 : 2)\n sourceID = MYID\n destinationID = DESTINATIONID\n direction = 0\n\n # This is a received PDU.\n case pduPacket.pduPayload\n when CFDP::PDUEOF\n \n # I only receive EOF packets in DOWNLINK events\n return unless @type.eql?(\"DOWNLINK\")\n direction = 1\n sourceID = destinationID\n destinationID = MYID\n when CFDP::PDUFinished\n\n # I only receive FINISHED packets in UPLINK events\n return unless @type.eql?(\"UPLINK\")\n # use default values from function start\n else\n return\n end\n\n ackPdu = CFDP.generatePDU(\"ACK\", directiveCode:pduPacket.pduPayload.class.class_variable_get(:@@fdCode),\n directiveSubtypeCode:0, conditionCode:pduPacket.pduPayload.conditionCode, transactionStatus:status,\n direction:direction, transmissionMode:0, sourceID:sourceID, destinationID:destinationID,\n sequenceNumber:pduPacket.pduHeader.sequenceNumber)\n\n writeLog(\"Generated ACK PDU: #{ackPdu.pack.to_s}\")\n CFDP::CFDPEngine.instance.insertIntoBuffer(ackPdu)\n end",
"def ack=(ack)\n raise 'Invalid ack flag. true or false expected' unless\n [true, false].include? ack\n @message[:ack] = ack\n end",
"def ack(msg)\n return unless msg.sub\n msg.sub.synchronize do\n ack_proto = STAN::Protocol::Ack.new({\n subject: msg.proto.subject,\n sequence: msg.proto.sequence\n }).to_proto\n nats.publish(msg.sub.ack_inbox, ack_proto)\n end\n end"
] | [
"0.65102285",
"0.6487016",
"0.6350764",
"0.63146967",
"0.62166655",
"0.6072652",
"0.6046227",
"0.5995287",
"0.58656776",
"0.58335435",
"0.5818466",
"0.5782469",
"0.5761721",
"0.57331836",
"0.5656255",
"0.5650389",
"0.56393814",
"0.5625183",
"0.55410886",
"0.54408187",
"0.5410028",
"0.53984857",
"0.5388187",
"0.5344132",
"0.53255504",
"0.5302028",
"0.52966887",
"0.5261811",
"0.52455074",
"0.52369714"
] | 0.780006 | 0 |
Creates an NACK frame | def nack_frame *args
create_ack_or_nack 'NACK', args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ack_frame *args\n create_ack_or_nack 'ACK', args\n end",
"def gen_packet type, payload\n length = payload.size\n number = Thread.current[:number]\n Thread.current[:number] = number + 1\n \"@ABCD\" + [type,length,number].pack('CS>I>').force_encoding(ENCODING) + payload\nend",
"def nacknowledge_frame sequence_number\n @stats[:naks_sent] += 1\n\n # Already acked?\n return if @buffer[sequence_number] == \"\"\n\n @buffer[sequence_number] = nil\n\n # If GO_BACK_N algorithm, then we expect to receive all of the\n # frames again\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n\n if @options[:implementation] == :go_back\n next_frame = ((@window * @options[:window_size]) + (sequence_number % @options[:window_size]))\n @next_frame = [next_frame, @next_frame].min\n @current_frame = @next_frame\n\n # Undo work done\n \n max_frame = @options[:window_size] * ((@window % 2) + 1)\n (expected_frame+1..max_frame).each do |i|\n @buffer[i] = nil\n end\n end\n\n if drop_ack?\n @stats[:naks_dropped] += 1\n puts \"Dropped NAK\"\n return\n end\n\n puts \"NAK #{sequence_number}\"\n @socket.puts \"NAK #{sequence_number} #{@number}\"\n\n # we received a response, so good\n reset_timeout\n end",
"def generate(frame)\n bytes = Buffer.new\n length = 0\n\n frame[:flags] ||= []\n frame[:stream] ||= 0\n\n case frame[:type]\n when :data\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n\n when :headers\n if frame[:priority]\n frame[:flags] += [:priority] if !frame[:flags].include? :priority\n end\n\n if frame[:flags].include? :priority\n bytes << [frame[:priority] & RBIT].pack(UINT32)\n length += 4\n end\n\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n\n when :priority\n bytes << [frame[:priority] & RBIT].pack(UINT32)\n length += 4\n\n when :rst_stream\n bytes << pack_error(frame[:error])\n length += 4\n\n when :settings\n if frame[:stream] != 0\n raise CompressionError.new(\"Invalid stream ID (#{frame[:stream]})\")\n end\n\n frame[:payload].each do |(k,v)|\n if !k.is_a? Integer\n k = DEFINED_SETTINGS[k]\n\n if k.nil?\n raise CompressionError.new(\"Unknown settings ID for #{k}\")\n end\n end\n\n bytes << [k & RBYTE].pack(UINT32)\n bytes << [v].pack(UINT32)\n length += 8\n end\n\n when :push_promise\n bytes << [frame[:promise_stream] & RBIT].pack(UINT32)\n bytes << frame[:payload]\n length += 4 + frame[:payload].bytesize\n\n when :ping\n if frame[:payload].bytesize != 8\n raise CompressionError.new(\"Invalid payload size \\\n (#{frame[:payload].size} != 8 bytes)\")\n end\n bytes << frame[:payload]\n length += 8\n\n when :goaway\n bytes << [frame[:last_stream] & RBIT].pack(UINT32)\n bytes << pack_error(frame[:error])\n length += 8\n\n if frame[:payload]\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n end\n\n when :window_update\n bytes << [frame[:increment] & RBIT].pack(UINT32)\n length += 4\n\n when :continuation\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n end\n\n frame[:length] = length\n bytes.prepend(commonHeader(frame))\n end",
"def create_packet\n lock = (@type == :ack ? true : false)\n payload = @pool.get_payload(@hwaddr,lock)\n return :noboot if payload[:netboot] == 'false'\n params = {\n\top: $DHCP_OP_REPLY,\n\txid: @msg.xid,\n\tchaddr: @msg.chaddr,\n\tyiaddr: payload[:ipaddr],\n\tsiaddr: IPAddr.new(payload[:dhcp_server].join('.')).to_i,\n\tfname: payload[:filename],\n\toptions: [\n\t REPLY_TYPES[@type],\n\t ServerIdentifierOption.new({payload: payload[:dhcp_server]}),\n\t DomainNameOption.new({payload: payload[:domainname]}),\n\t DomainNameServerOption.new({payload: payload[:dns_server]}),\n\t IPAddressLeaseTimeOption.new({payload: payload[:lease_time]}),\n\t SubnetMaskOption.new({payload: payload[:subnet_mask]}),\n\t RouterOption.new({payload: payload[:gateway]})\n\t]\n }\n Message.new(params).pack\n end",
"def create_packet(lookup_host, transaction_ID) \n packet = [transaction_ID, FLAGS, QUESTIONS, ANSWERS, AUTHORITY_RRS, ADDITIONAL_RRS].pack(\"S>S>S>S>S>S>\")\n packet += encode_lookup_host(lookup_host)\n packet += [TYPE_A, CLASS_IN].pack(\"S>S>\")\n \n return packet\nend",
"def makePacket(destIP, sourceIP, type, seqNum, ackNum)\n\tpacket = Packet.new\n\n\tpacket.destIP = destIP\n\tpacket.sourceIP = sourceIP\n\tpacket.type = type\n\tpacket.seqNum = seqNum\n\tpacket.ackNum = ackNum\n\n\tif(type == 0)\n\t\tpacket.data = \"This is ack #{ackNum}\"\n\telsif(type == 1)\n\t\tpacket.data = \"This is packet #{seqNum}\"\n\telse\n\t\tpacket.data = \"This is an EOT\"\n\tend\n\t\t\n\n\treturn packet\nend",
"def push(packet); end",
"def write_frame_nonblock frame\n ser = serializer.frame_to_bytes frame\n push_write_buffer ser, frame\n end",
"def push(b)\n \n timeNow = Time.now\n \n if (@time - timeNow) > @tio\n @state = :idle \n end\n \n @time = timeNow\n \n case @state\n when :idle\n \n if b == Frame::FRAME_CHAR\n @state = :fsize_b1\n @rx = \"\"\n @info = \"\"\n end\n \n when :fsize_b1\n \n checksum_init\n checksum_next(b)\n @rx << b\n \n if (b & 0xf0) != 0xa0\n \n if b != FRAME::FRAME_CHAR\n\n log_error \"first byte of frame is invalid\"\n @state = :start_frame;\n \n end\n \n else\n \n @frame_size = ( (b & 0x7) << 8 )\n @segment = ( ((b & 0x8) == 0x8) ? true : false )\n @state = :fsize_b2\n \n end\n \n when :fsize_b2\n\n checksum_next(b)\n @rx << b\n\n @frame_size |= b \n\n if @frame_size < 6\n log_error \"frame will be too short\"\n @state = :start_frame\n else\n @state = :dest_b1\n end\n \n when :dest_b1\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @dest = OneByte.new(b >> 1)\n @state = :src_b1\n else\n @state = :dest_b2\n end\n \n when :dest_b2\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @dest = TwoByte.new(@rx[-2].to_i >> 1, b >> 1)\n @state = :src_b1\n else\n @state = :dest_b3\n end\n \n when :dest_b3\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n log_error \"invalid address length\"\n @state = :idle\n else\n @state = :dest_b4\n end\n \n when :dest_b4\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n @dest = FourByte.new((@rx[-4].to_i << 8) | @rx[-3].to_i, (@rx[-2].to_i << 8) | b)\n @state = :src_b1\n else\n log_error \"invalid address length\"\n @state = :idle\n end\n \n when :src_b1\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @src = OneByte.new(b >> 1)\n @state = :control\n else\n @state = :src_b2\n end\n \n when :src_b2\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @src = TwoByte.new(@rx[-2].to_i >> 1, b >> 1)\n @state = :control\n else\n @state = :src_b3\n end\n \n when :src_b3\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n log_error \"invalid address length\"\n @state = :idle\n else\n @state = :src_b4\n end\n \n when :src_b4\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n @src = FourByte.new((@rx[-4].to_i << 8) | @rx[-3].to_i, (@rx[-2].to_i << 8) | b)\n @state = :control\n else\n log_error \"invalid address length\"\n @state = :idle\n end\n \n when :control\n \n checksum_next(b)\n @rx << b\n @control = b\n @state = :hcs_b1\n \n when :hcs_b1\n \n checksum_next(b)\n @rx << b \n @state = :hcs_b2\n \n when :hcs_b2\n \n checksum_next(b)\n @rx << b \n \n if @fcs != 0xf0b8\n \n log_error \"invalid HCS\"\n @state = :start_frame\n \n elsif @frame_size == @rx.size\n \n @state = :end_frame\n \n else\n \n @state = :info\n \n end\n \n when :info\n \n checksum_next(b)\n @rx << b \n @info << b \n \n if @rx.size == (@frame_size - 2)\n \n @state = :fcs_b1\n \n end\n \n when :fcs_b1\n \n checksum_next(b)\n @rx << b \n @state = :fcs_b2\n \n when :fcs_b2\n \n checksum_next(b)\n @rx << b \n @state = :end_frame\n \n when :end_frame\n \n if b == Frame::FRAME_CHAR\n \n if @fcs == 0xf0b8\n \n begin\n \n f = Frame.from_decoder(self)\n \n # todo enforce rules for which frames are allowed certain fields\n \n yield(f) if block_given?\n \n rescue => e\n log_error \"#{e.exception}: #{e.message}\"\n log_error e.backtrace.join(\"\\n\")\n end\n \n else\n \n log_error \"invalid fcs\"\n \n end\n \n else\n \n log_error \"expecting end of frame\"\n \n end\n \n @state = :idle\n \n end\n \n self\n \n end",
"def pack\n end",
"def build(args={})\n klass = FRAME_TYPE_MAP[args[:type].to_i]\n if(klass == FrameType::Response)\n klass.new(:response => args[:data])\n elsif(klass == FrameType::Error)\n klass.new(:error => args[:data])\n elsif(klass == FrameType::Message)\n unpacked = args[:data].unpack(\"Q>s>a16a#{args[:size]}\")\n klass.new(\n Hash[*([:timestamp, :attempts, :message_id, :message].zip(unpacked).flatten)]\n )\n else\n raise TypeError.new \"Unknown frame type received: #{args[:type].inspect} - #{klass.inspect}\"\n end\n end",
"def build_packet\n return [@request_id, @command_type, @string1, @string2].pack(\"VVa#{@string1.length}a2\")\n end",
"def make_websocket_frame( opts={} )\n\t\topts = TEST_WEBSOCKET_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_WEBSOCKET_HEADERS )\n\n\t\tMongrel2.log.debug \"WebSocket frame, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def make_websocket_frame( opts={} )\n\t\topts = TEST_WEBSOCKET_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_WEBSOCKET_HEADERS )\n\n\t\tMongrel2.log.debug \"WebSocket frame, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def generate\n blake160_bin = [blake160[2..-1]].pack(\"H*\")\n type = [\"01\"].pack(\"H*\")\n bin_idx = [\"P2PH\".each_char.map { |c| c.ord.to_s(16) }.join].pack(\"H*\")\n payload = type + bin_idx + blake160_bin\n ConvertAddress.encode(@prefix, payload)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_frame\n @frame = Sprite.new(@viewport)\n end",
"def create\n @net_rack = NetRack.new(net_rack_params)\n\n respond_to do |format|\n if @net_rack.save\n format.html { redirect_to @net_rack, notice: 'Net rack was successfully created.' }\n format.json { render :show, status: :created, location: @net_rack }\n else\n format.html { render :new }\n format.json { render json: @net_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def basic_nack(delivery_tag, multiple: false, requeue: false)\n write_bytes FrameBytes.basic_nack(@id, delivery_tag, multiple, requeue)\n nil\n end",
"def send_packet(payload); end",
"def assemble\n [length / 0x100, length % 0x100,\n @type_value,\n @flags_value,\n @stream_id].pack(\"nCCCN\") << @payload\n end",
"def make_header\n\t\t\theader = nil\n\t\t\tlength = self.payload.size\n\n\t\t\tself.log.debug \"Making wire protocol header for payload of %d bytes\" % [ length ]\n\n\t\t\t# Pack the frame according to its size\n\t\t\tif length >= 2**16\n\t\t\t\tself.log.debug \" giant size, using 8-byte (64-bit int) length field\"\n\t\t\t\theader = [ self.flags, 127, length ].pack( 'c2q>' )\n\t\t\telsif length > 125\n\t\t\t\tself.log.debug \" big size, using 2-byte (16-bit int) length field\"\n\t\t\t\theader = [ self.flags, 126, length ].pack( 'c2n' )\n\t\t\telse\n\t\t\t\tself.log.debug \" small size, using payload length field\"\n\t\t\t\theader = [ self.flags, length ].pack( 'c2' )\n\t\t\tend\n\n\t\t\tself.log.debug \" header is: 0: %02x %02x\" % header.unpack('C*')\n\t\t\treturn header\n\t\tend",
"def pack tl, tm, th, ch, cl, n\nraw = [tl, tm, th, ch, cl, n].pack \"NnnCCa6\"\nret = new raw\nret.freeze\nret\nend",
"def ACK05=(arg)",
"def packed()\n header = self.version.chr + \n @type.chr + \n @seq_no.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@session_id,4) + \n TacacsPlus.pack_int_net(@length,4)\n return(header)\n end",
"def create_frame\n @current_frame = {\n :vlocks => {},\n :parent_frame => current_frame\n }\n end"
] | [
"0.6508923",
"0.5741221",
"0.5615624",
"0.561104",
"0.5471409",
"0.5460339",
"0.5451302",
"0.52467227",
"0.520806",
"0.51764727",
"0.5139951",
"0.5100133",
"0.50859934",
"0.5026159",
"0.50260675",
"0.5025573",
"0.5017612",
"0.5017612",
"0.5017612",
"0.5017612",
"0.501504",
"0.5011796",
"0.5007915",
"0.49981746",
"0.49924988",
"0.49922708",
"0.49894997",
"0.4977957",
"0.4973086",
"0.49618968"
] | 0.7034159 | 0 |
Creates a heartbeat frame (serialized as a single "\n" character) | def heartbeat_frame
OnStomp::Components::Frame.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_heartbeat(sequence)\n send_packet(Opcodes::HEARTBEAT, sequence)\n end",
"def save_heartbeat\n timestamp = Time.now.to_i\n store.zadd(\"hb:#{@client.uid}\", timestamp, [Time.now.to_s(:db), @payload].to_json)\n end",
"def handle_heartbeat(_payload)\n send_packet(OPCODES[:HEARTBEAT], @session.seq)\n end",
"def heartbeat\n me = WORKER_TEMPLATE.dup\n me['name'] = id\n @heartbeat_entry ||= write(me, @heartbeat_refresh + 10)\n @heartbeat_entry.renew(@heartbeat_refresh) unless @heartbeat_entry.canceled?\n end",
"def create\n @heartbeat = Heartbeat.new(params[:heartbeat])\n\n respond_to do |format|\n if @heartbeat.save\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully created.' }\n format.json { render json: @heartbeat, status: :created, location: @heartbeat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_heartbeat(packet)\n end",
"def create\n @heartbeat = Heartbeat.new(heartbeat_params)\n\n if @heartbeat.save\n render json: @heartbeat, status: :created, location: @heartbeat\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def start_heartbeat\n @hb_received_at = Time.now\n send_heartbeat\n @heartbeat_timer = @reactor.periodical_timer(@heartbeat_interval) { send_heartbeat }\n end",
"def set_heartbeat_timer(buffer)\n # Cancel @disconnect_timer.\n SockJS.debug \"Cancelling @disconnect_timer as we're about to send a heartbeat frame in 25s.\"\n @disconnect_timer.cancel if @disconnect_timer\n @disconnect_timer = nil\n\n @alive_checker.cancel if @alive_checker\n\n # Send heartbeat frame after 25s.\n @heartbeat_timer ||= EM::Timer.new(25) do\n # It's better as we know for sure that\n # clearing the buffer won't change it.\n SockJS.debug \"Sending heartbeat frame.\"\n begin\n self.finish\n rescue Exception => error\n # Nah these exceptions are OK ... let's figure out when they occur\n # and let's just not set the timer for such cases in the first place.\n SockJS.debug \"Exception when sending heartbeat frame: #{error.inspect}\"\n end\n end\n end",
"def make_websocket_frame( opts={} )\n\t\topts = TEST_WEBSOCKET_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_WEBSOCKET_HEADERS )\n\n\t\tMongrel2.log.debug \"WebSocket frame, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def make_websocket_frame( opts={} )\n\t\topts = TEST_WEBSOCKET_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_WEBSOCKET_HEADERS )\n\n\t\tMongrel2.log.debug \"WebSocket frame, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def alive\n @heartbeat = Heartbeat.create(heartbeats_params)\n if @heartbeat.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create heartbeat' }, status: :internal_server_error\n end\n end",
"def send_tick\n msg = Erlang::Encoder.new\n msg.write_4 0\n msg.write ''\n send_data msg\n end",
"def pong(str)\n heartbeat(0b10001010, str)\n end",
"def heartbeat(method, str)\n raise Midori::Error::PingPongSizeTooLarge if str.size > 125\n @connection.send_data [method, str.size, str].pack(\"CCA#{str.size}\")\n end",
"def send_message(sock,msg)\n msg.ftime = DateTime.now\n body = msg.to_yaml + CRLF\n sock.write(body)\n end",
"def test_simulate_status_frame_with_timestamp\n\t\tmqtt_client = SinapseEPDSimulatorVodafone.new(:host => $MQTT_broker, :port => $normal_port, :username => $MQTT_user, :password => $MQTT_password)\n\t\tmqtt_client.connect()\n\t\t\n\t\t# Simulating EPD\n\t\t#result = mqtt_client.simulate_status_frame\n\t\t#assert_equal result[0], {:topic => \"LU/LUM/SEN\", :message => \"FFFFFF;30;1;90;150;220;60;0;60;60;0;60;50\"} # RAE: To Improve\n\n\t\t# EPD with data\n\t\ttimestamp = Time.now.to_i\n\t\tstatus_parameters = {\n\t\t\tid_radio: \"123456\",\n\t\t\ttemp: 30,\n\t\t\tstat: 1,\n\t\t\tdstat: 75,\n\t\t\tvoltage: 220,\n\t\t\tcurrent: 120,\n\t\t\tactive_power: 75,\n\t\t\treactive_power: 0,\n\t\t\tapparent_power: 75,\n\t\t\taggregated_active_energy: 150,\n\t\t\taggregated_reactive_energy: 0,\n\t\t\taggregated_apparent_energy: 150,\n\t\t\tfrequency: 50,\n timestamp: timestamp\n\t\t}\n\n\t\tresult = mqtt_client.simulate_status_frame(\"LU/LUM/SEN\", status_parameters)\n\t\tmsg_result = \"123456;30;1;75;120;220.0;75.0;0.0;75.0;150;0;150;50;\" + timestamp.to_s + \";\"\n\t\tassert_equal result[0], {:topic => \"LU/LUM/SEN\", :message => msg_result} # RAE: To Improve\n\n\t\tmqtt_client.disconnect()\n\n\tend",
"def heartbeat\n end",
"def heartbeat\n request(Resources::RESOURCE_HEARTBEAT, HTTP_METHOD_POST)\n end",
"def new\n @heartbeat = Heartbeat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heartbeat }\n end\n end",
"def make_headline(timestamp_str)\n\n delimiter = \": \"\n subject_width = @column - TIMESTAMP_STR_MAX_WIDTH - delimiter.size - 1\n\n subject = @repo.read(Textrepo::Timestamp.parse_s(timestamp_str))[0]\n prefix = '# '\n subject = prefix + subject.lstrip if subject[0, 2] != prefix\n\n ts_part = \"#{timestamp_str} \"[0..(TIMESTAMP_STR_MAX_WIDTH - 1)]\n sj_part = truncate_str(subject, subject_width)\n\n ts_part + delimiter + sj_part\n end",
"def send_text_frame message\n log_system_debug \"sending text frame: payload_length=#{message.bytesize}\" if $oversip_debug\n\n frame = \"\".encode ::Encoding::BINARY\n\n # byte1 = OPCODE_TO_INT[:text] | 0b10000000 => 129\n #\n # - FIN bit set.\n # - RSV1-3 bits not set.\n # - opcode = 1\n frame << 129\n\n length = message.bytesize\n if length <= 125\n frame << length # since rsv4 is 0\n elsif length < 65536 # write 2 byte length\n frame << 126\n frame << [length].pack('n')\n else # write 8 byte length\n frame << 127\n frame << [length >> 32, length & 0xFFFFFFFF].pack(\"NN\")\n end\n\n if message.encoding == ::Encoding::BINARY\n frame << message\n else\n frame << message.force_encoding(::Encoding::BINARY)\n end\n\n @connection.send_data frame\n true\n end",
"def frame(text, char)\n width = text.max { |a,b| a.length <=> b.length }.size + 4\n output = \"\" << \"#{char}\" * width << \"\\n\"\n text.each { |line| output << \"#{char} #{line}\" << \"%0#{width - line.size - 2}s\" % char << \"\\n\" }\n output << \"#{char}\" * width\nend",
"def fmt(data)\n pkt = \"<190>1 \"\n pkt += \"#{data[:t].strftime(\"%Y-%m-%dT%H:%M:%S+00:00\")} \"\n pkt += \"#{@hostname} \"\n pkt += \"#{data[:token]} \"\n pkt += \"#{@procid} \"\n pkt += \"#{@msgid} \"\n pkt += \"#{@structured_data} \"\n pkt += data[:msg]\n \"#{pkt.size} #{pkt}\"\n end",
"def build_heartbeat_config_file_for(node)\n write_to_file_for(\"heartbeat\", node) do\n servers = \"#{node.node_entry}\\n#{get_next_node(node).node_entry}\" rescue \"\"\n open(Application.heartbeat_config_file).read.strip ^ {:nodes => servers}\n end\n end",
"def beat\n Logger.trace \"beat heart #{Zensu.node.id} #{Time.now.to_i}\"\n remote_publish(\"zensu.heartbeat\", Zensu.node.id, Zensu.config.router_endpoint, Time.now.to_i.to_s)\n end",
"def cov_header(timestamp, metrics_h)\n now = Time.at(timestamp)\n <<-EOP\nCreated: #{now}\nTotal Coverage: #{metrics_h['covered_percent']}\nStrength: #{metrics_h['covered_strength']}\nCovered lines: #{metrics_h['covered_lines']}\nTotal lines: #{metrics_h['total_lines']}\nEOP\nend",
"def heartbeat_entry\n \"#{name} #{ip} #{Application.managed_services}\"\n end",
"def welcome_message\n bolt = <<~BOLT\n `.::-`\n `.-:///////-.`\n `-:////:. `-:///:- /ooo. .ooo/\n `.-:///::///:-` `-//: ymmm- :mmmy .---.\n :///:-. `.:////. -//: ymmm- :mmmy +mmm+\n ://. ///. -//: ymmm--/++/- `-/++/:` :mmmy-:smmms::-\n ://. ://. .://: ymmmdmmmmmmdo` .smmmmmmmmh: :mmmysmmmmmmmms\n ://. ://:///:-. ymmmh/--/hmmmy -mmmd/-.:hmmm+:mmmy.-smmms--.\n ://:.` .-////:-` ymmm- ymmm:hmmm- `dmmm/mmmy +mmm+\n `-:///:-..:///:-.` ymmm- ommm/dmmm` hmmm+mmmy +mmm+\n `.-:////:-` ymmm+ /mmmm.ommms` /mmmh:mmmy +mmmo\n `-.` ymmmmmhhmmmmd: ommmmhydmmmy`:mmmy -mmmmdhd\n oyyy+shddhs/` .+shddhy+- -yyyo .ohddhs\n\n\n BOLT\n example_cmd = if Bolt::Util.windows?\n \"Invoke-BoltCommand -Command 'hostname' -Targets localhost\"\n else\n \"bolt command run 'hostname' --target localhost\"\n end\n prev_cmd = String.new(\"bolt\")\n prev_cmd << \" #{@argv[0]}\" unless @argv.empty?\n\n message = <<~MSG\n 🎉 Welcome to Bolt #{VERSION}\n 😌 We're here to help bring order to the chaos\n 📖 Find our documentation at https://bolt.guide\n 🙋 Ask a question in #bolt on https://slack.puppet.com/\n 🔩 Contribute at https://github.com/puppetlabs/bolt/\n 💡 Not sure where to start? Try \"#{example_cmd}\"\n\n We only print this message once. Run \"#{prev_cmd}\" again for help text.\n MSG\n\n $stdout.print \"\\033[36m#{bolt}\\033[0m\"\n $stdout.print message\n end",
"def heartbeat\n if check_heartbeat_acks\n unless @last_heartbeat_acked\n # We're in a bad situation - apparently the last heartbeat wasn't ACK'd, which means the connection is likely\n # a zombie. Reconnect\n LOGGER.warn('Last heartbeat was not acked, so this is a zombie connection! Reconnecting')\n\n # We can't send anything on zombie connections\n @pipe_broken = true\n reconnect\n return\n end\n\n @last_heartbeat_acked = false\n end\n\n send_heartbeat(@session ? @session.sequence : 0)\n end"
] | [
"0.599535",
"0.5900252",
"0.57715",
"0.56977063",
"0.5687411",
"0.5641977",
"0.5555416",
"0.554638",
"0.54458064",
"0.54110134",
"0.54101676",
"0.5333949",
"0.5303429",
"0.52913487",
"0.5267683",
"0.5169766",
"0.51461494",
"0.5113312",
"0.5075621",
"0.50172395",
"0.50087696",
"0.49981984",
"0.4971725",
"0.49707156",
"0.49109426",
"0.49019283",
"0.48917514",
"0.48852098",
"0.48599398",
"0.48583513"
] | 0.65995765 | 0 |
tyear, tmonth, tweek assigned where setting spent_on attributes these attributes make time aggregations easier | def spent_on=(date)
super
self.tyear = spent_on ? spent_on.year : nil
self.tmonth = spent_on ? spent_on.month : nil
self.tweek = spent_on ? spent_on.cweek : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n self.spent_from = date\n self.spent_to = self.spent_from.advance(:hours=>hours) if self.spent_from && hours\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end",
"def spent_on=(date)\n super\n if spent_on.is_a?(Time)\n self.spent_on = spent_on.to_date\n end\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end",
"def spent_hours_for_issue_and_user_this_month\n return @spent_hours_for_issue_and_user_this_month if defined?(@spent_hours_for_issue_and_user_this_month)\n\n @spent_hours_for_issue_and_user_this_month = nil\n\n return @spent_hours_for_issue_and_user_this_month if issue_id.blank? || user_id.blank?\n\n date_filter = Date.today\n\n @spent_hours_for_issue_and_user_this_month = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def spent_hours_for_user_this_month\n return @spent_hours_for_user_this_month if defined?(@spent_hours_for_user_this_month)\n\n @spent_hours_for_user_this_month = nil\n\n return @spent_hours_for_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n @spent_hours_for_user_this_month = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def spent_hours_for_issue_and_user_previous_month\n return @spent_hours_for_issue_and_user_previous_month if defined?(@spent_hours_for_issue_and_user_previous_month)\n\n @spent_hours_for_issue_and_user_previous_month = nil\n\n return @spent_hours_for_issue_and_user_previous_month if issue_id.blank? || user_id.blank?\n\n date_filter = Date.today.prev_month\n\n @spent_hours_for_issue_and_user_previous_month = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def spent_hours_for_issue_this_month\n return @spent_hours_for_issue_this_month if defined?(@spent_hours_for_issue_this_month)\n\n @spent_hours_for_issue_this_month = nil\n\n return @spent_hours_for_issue_this_month if issue_id.blank?\n\n date_filter = Date.today\n\n @spent_hours_for_issue_this_month = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def set_attributes\n @total=0\n @week_total=0\n days=(@finish-@start).to_i + 1 #/60/60/24+1 \n if (7-@start.wday) < days and days < 8\n @total+=total_hours(@start.wday,@finish.wday)\n @week_total=@total\n else\n @total+=total_hours(@start.wday,6)\n days -= (7-@start.wday)\n @total+=total_hours(0,@finish.wday)\n days-=(@finish.wday+1)\n @week_total=@total if days==0\n week_total=total_hours(0,6)\n @total+=week_total * days / 7\n @week_total=week_total if days != 0\n end\n end",
"def group_matter_time_spent(col)\n total_data,table_headers,conditions,data = {},{},{},[]\n if params[:report][:summarize_by] == \"lead_lawyer\"\n ehrs,bhrs,rhrs = 0,0,0\n col.group_by(&:employee_user_id).each do |label,matters|\n \n key = nil\n matters.each do|matter|\n key = matter.get_lawyer_name unless key\n est_hours = matter.estimated_hours ? matter.estimated_hours : 0\n bill_hours = 0\n matter.time_entries.select{|obj| obj.is_billable}.each do|e|\n actual_duration = @dur_setng_is_one100th ? one_hundredth_timediffernce(e.actual_duration) : one_tenth_timediffernce(e.actual_duration)\n bill_hours += actual_duration\n end\n \n rem_hours = (est_hours - bill_hours).abs\n ehrs += est_hours\n bhrs += bill_hours\n rhrs += rem_hours\n data << [matter.name,matter.contact ? matter.contact.name : \"\",matter.contact ? matter.contact.accounts[0] ? matter.contact.accounts[0].name : \"\" : \"\",matter.matter_no,matter.matter_category,matter.matter_status ? matter.matter_status.alvalue : \"\",rounding(est_hours),rounding(bill_hours),rounding(rem_hours)]\n end\n \n conditions[key] = [rounding(ehrs),rounding(bhrs),rounding(rhrs)]\n total_data[key] = data\n sum_hrs(conditions,key)\n ehrs,bhrs,rhrs = 0,0,0\n data = []\n \n end\n column_widths = {0=> 100,1=> 100,2=> 100,3=> 60,4=> 50,5=> 50,6=> 60,7=> 60,8=> 100}\n table_headers = [t(:label_matter),t(:label_client),t(:label_Account),t(:text_matter_id),t(:label_type),t(:label_status),t(:text_estimated_hours),\"#{t(:label_billable)} #{t(:text_hour)}\",\"#{t(:text_projected)} #{t(:text_hour)}\"]\n elsif params[:report][:summarize_by] == \"client\"\n ehrs,bhrs,rhrs = 0,0,0\n col.group_by(&:contact_id).each do |label,matters|\n key = nil\n matters.each do|matter|\n key = matter.contact ? matter.contact.name : nil unless key\n est_hours = matter.estimated_hours ? matter.estimated_hours : 0\n bill_hours = 0\n matter.time_entries.select{|obj| obj.is_billable}.each do|e|\n bill_hours += e.actual_duration\n end\n rem_hours = (est_hours - bill_hours).abs\n ehrs += est_hours\n bhrs += bill_hours\n rhrs += rem_hours\n data << [matter.name,matter.get_lawyer_name,matter.contact ? matter.contact.get_account ? matter.contact.get_account.name : \"\" : \"\",matter.matter_no,matter.matter_category,matter.matter_status.lvalue,rounding(est_hours),rounding(bill_hours),rounding(rem_hours)]\n end\n\n conditions[key] = [rounding(ehrs),rounding(bhrs),rounding(rhrs)]\n total_data[key] = data\n sum_hrs(conditions,key)\n ehrs,bhrs,rhrs = 0,0,0\n data = []\n\n end\n column_widths = {0=> 100,1=> 100,2=> 100,3=> 60,4=> 50,5=> 50,6=> 60,7=> 60,8=> 100}\n table_headers = [t(:label_matter),t(:text_select_lawyer),\"#{t(:label_Account)}\",t(:text_matter_id),t(:label_type),t(:label_status),t(:text_estimated_hours),\"#{t(:label_billable)} #{t(:text_hour)}\",\"Projected hours\"]\n elsif params[:report][:summarize_by] == \"account\"\n ehrs,bhrs,rhrs = 0,0,0\n matters = col.collect do |matter|\n est_hours = matter.estimated_hours ? matter.estimated_hours : 0\n bill_hours = 0\n matter.time_entries.select{|obj| obj.is_billable}.each do|e|\n bill_hours += e.actual_duration\n end\n rem_hours = (est_hours - bill_hours).abs\n account = matter.contact ? matter.contact.get_account ? matter.contact.get_account.name : \"None\" : \"None\"\n [matter.name,matter.get_lawyer_name,matter.contact ? matter.contact.name : \"\",matter.matter_no,matter.matter_category,matter.matter_status.lvalue,rounding(est_hours),rounding(bill_hours),rounding(rem_hours),account]\n end\n matters_hash = {}\n matters.each do |matter|\n key = matter.pop\n if matters_hash.has_key?(key)\n matters_hash[key] << matter\n else\n matters_hash[key] = [matter]\n end\n end\n matters_hash.each do |label,matters|\n matters.each do |matter|\n ehrs += matter[-3].to_f\n bhrs += matter[-2].to_f\n rhrs += matter[-1].to_f\n end\n conditions[label] = [rounding(ehrs),rounding(bhrs),rounding(rhrs)]\n total_data[label] = matters\n sum_hrs(conditions,label)\n end\n \n column_widths = {0=> 100,1=> 100,2=> 100,3=> 60,4=> 50,5=> 50,6=> 60,7=> 60,8=> 100}\n table_headers = [t(:label_matter),t(:text_select_lawyer),t(:label_client),t(:text_matter_id),t(:label_type),t(:label_status),t(:text_estimated_hours),\"#{t(:label_billable)} #{t(:text_hour)}\",\"Projected hours\"]\n elsif params[:report][:summarize_by] == \"lit_type\"\n ehrs,bhrs,rhrs = 0,0,0\n col.group_by(&:matter_category).each do |label,matters|\n matters.each do|matter|\n est_hours = matter.estimated_hours ? matter.estimated_hours : 0\n bill_hours = 0\n matter.time_entries.select{|obj| obj.is_billable}.each do|e|\n bill_hours += e.actual_duration\n end\n rem_hours = (est_hours - bill_hours).abs\n ehrs += est_hours\n bhrs += bill_hours\n rhrs += rem_hours\n data << [matter.name,matter.contact ? matter.contact.name : \"\",matter.get_lawyer_name,matter.contact ? matter.contact.get_account ? matter.contact.get_account.name : \"\" : \"\",matter.matter_no,matter.matter_status.lvalue,rounding(est_hours),rounding(bill_hours),rounding(rem_hours)]\n end\n label = label.try(:capitalize)\n conditions[label] = [rounding(ehrs),rounding(bhrs),rounding(rhrs)]\n total_data[label] = data\n sum_hrs(conditions,label)\n ehrs,bhrs,rhrs = 0,0,0\n data = []\n\n end\n column_widths = {0=> 100,1=> 100,2=> 100,3=> 60,4=> 50,5=> 50,6=> 60,7=> 60,8=> 100}\n table_headers = [t(:label_matter),t(:label_client),t(:text_select_lawyer),\"#{t(:label_Account)}\",t(:text_matter_id),t(:label_status),t(:text_estimated_hours),\"#{t(:label_billable)} #{t(:text_hour)}\",\"Projected hours\"]\n end\n alignment = {0=> :left,1=> :left,2=> :left,3=> :center,4=> :center,5=>:center,6=> :center,7=> :center,8=> :center} if params[:format] == \"pdf\"\n [total_data,table_headers,conditions,column_widths,alignment]\n end",
"def worktype_tracking(begda,endda)\n teams=Team.find(:all)\n curdate = begda\n wt_total = []\n until curdate > endda do\n teams.each do |team|\n wt_team_month = calculate_worktype_distribution(curdate,team.id)\n # get the total time and calculate percentages\n sum_of_times_booked = 0\n wt_team_month.keys.each do |wt|\n sum_of_times_booked += wt_team_month[wt][:daysbooked]\n end\n\n wt_team_month.keys.each do |wt|\n perc = (wt_team_month[wt][:daysbooked] / sum_of_times_booked)*100\n wt_total << { :month => Date::ABBR_MONTHNAMES[curdate.month], \n :team_id => team.id,\n :worktype_id => wt,\n :daysbooked => wt_team_month[wt][:daysbooked],\n :perc => perc} \n end\n end\n\n curdate = curdate >> 1\n end\n return wt_total\n end",
"def monthly_timesheet\n \n end",
"def trend_points_for_creation_date(obj)\n if obj.created_at > 1.day.ago then 50\n elsif obj.created_at > 1.week.ago then 25\n elsif obj.created_at > 2.weeks.ago then 10\n elsif obj.created_at > 3.weeks.ago then 3\n else 0\n end\nend",
"def print\n current_ts = Timesheet.find(params[:current_ts_id])\n if params[:weekof].present?\n weekof = Date.parse(params[:weekof]) \n else\n weekof = Date.today\n end\n name = User.current.firstname\n wage = User.current.wage.amount.to_s\n current = Date.today\n\n #TODO change the name of the default scopes on TimeEntry for dates, they need to express that the collection includes the dates indicated.\n usrtiments = TimeEntry.foruser(User.current).after(weekof).before(weekof + 6.days) #this use of before and after is cool\n\n mon = (usrtiments.select {|t| t.spent_on == weekof}).inject(0) {|sum, x| sum + x.hours}\n tue = (usrtiments.select {|t| t.spent_on == (weekof + 1)}).inject(0) {|sum, x| sum + x.hours} \n wed = (usrtiments.select {|t| t.spent_on == (weekof + 2)}).inject(0) {|sum, x| sum + x.hours}\n thu = (usrtiments.select {|t| t.spent_on == (weekof + 3)}).inject(0) {|sum, x| sum + x.hours}\n fri = (usrtiments.select {|t| t.spent_on == (weekof + 4)}).inject(0) {|sum, x| sum + x.hours}\n sat = (usrtiments.select {|t| t.spent_on == (weekof + 5)}).inject(0) {|sum, x| sum + x.hours}\n sun = (usrtiments.select {|t| t.spent_on == (weekof + 6)}).inject(0) {|sum, x| sum + x.hours}\n\n hours = mon + tue + wed + thu + fri + sat + sun\n status =\"\"\n\n #need to check for valid datetime instead of nil\n if current_ts.paid != nil\n status = \"Paid\"\n elsif current_ts.paid == nil && current_ts.submitted != nil\n status = \"Submitted, but not paid\"\n else\n status = \"Not submitted and not paid\"\n end\n\n if hours == 0 || hours > 100\n #flash[:warning] = 'You do not have any hours for the specified week! Add hours to print a timecard.'\n flash[:warning] = 'Error, error! Either you are printing a timesheet with no need for payment or you got some wiring loose and logged too many hours.'\n redirect_to :action => 'employee_index' #potential problem with this when admin uses it\n else #method in timesheethelper\n send_data (generate_timesheet_pdf(name, wage, current, weekof, mon, tue, wed, thu, fri, sat, sun,status),\n :filename => name + \"_timecard_from_\" + weekof.to_s + \"_to_\" + (weekof + 6.days).to_s + \".pdf\",\n :type => \"application/pdf\")\n end\n end",
"def spent_hours_for_issue_and_user\n return @spent_hours_for_issue_and_user if defined?(@spent_hours_for_issue_and_user)\n\n @spent_hours_for_issue_and_user = nil\n\n return @spent_hours_for_issue_and_user if issue_id.blank? || user_id.blank?\n\n @spent_hours_for_issue_and_user = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:user_id => self.user_id).\n sum(:hours)\n end",
"def spent_hours_for_user_previous_month\n return @spent_hours_for_user_previous_month if defined?(@spent_hours_for_user_previous_month)\n\n @spent_hours_for_user_previous_month = nil\n\n return @spent_hours_for_user_previous_month if user_id.blank?\n\n date_filter = Date.today.prev_month\n\n @spent_hours_for_user_previous_month = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def calculate_week_time\n week_begin = DateTime.now.utc.beginning_of_week\n deadline = DateTime.now.utc.end_of_week\n self.commits.where(\"begin_time > ? and end_time < ?\", week_begin, deadline).sum(:spent_time)\n end",
"def setup_timetable\n # Create a hash of free times for output rendering\n @free_times = [{}, {}, {}, {}, {}, {}, {}]\n @person.free_times.each do |ft|\n ft.start_time.step(ft.end_time + (ft.end_time % Timetable::INTERVAL), Timetable::INTERVAL) do |time|\n css_class = ft.css_class.present? ? ft.css_class : 'good'\n @free_times[ft.day_of_week][time] = css_class\n end\n end\n # raise @free_times.inspect\n end",
"def revenue_data(kind = '')\n range = case kind.presence || 'this_year'\n when 'this_year'\n Date.today.beginning_of_year..Date.today\n when 'past_year'\n 1.year.ago.beginning_of_year.to_date..1.year.ago.end_of_year.to_date\n when '6_months_ago'\n 5.months.ago.beginning_of_month.to_date..Date.today\n end\n range.select{|d| d.day == 1}.map{|d| [d.strftime('%Y-%m'), mentor_payments.where(payment_at: d.beginning_of_day..d.end_of_month.end_of_day).sum('payments.amount')] }.to_h\n end",
"def deviation_hours_for_issue_and_user_this_month\n return @deviation_hours_for_issue_and_user_this_month if defined?(@deviation_hours_for_issue_and_user_this_month)\n\n @deviation_hours_for_issue_and_user_this_month = nil\n\n return @deviation_hours_for_issue_and_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.deviation_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @deviation_hours_for_issue_and_user_this_month = cf.format.cast_total_value(cf, total)\n end",
"def calculated_spend_by_month\n return if !organisation.respond_to?(:payments) || organisation.payments.count == 0\n res_hsh = {}\n group_by = case ActiveRecord::Base.connection.adapter_name\n when 'MySQL'\n # https://github.com/django/django/blob/master/django/db/backends/mysql/base.py#L207\n \"CAST(DATE_FORMAT(date, '%Y-%m-01 00:00:00') AS DATETIME)\"\n else # PostgreSQL\n # https://github.com/django/django/blob/master/django/db/backends/postgresql_psycopg2/operations.py#L35\n \"DATE_TRUNC('month', date)\"\n end\n ft_sums = organisation.payments.sum(:value, :conditions => {:date_fuzziness => nil}, :group => group_by).to_a\n fuzzy_sums = organisation.payments.all(:select => 'SUM(value) AS value, date, date_fuzziness', :conditions => \"date_fuzziness IS NOT NULL\", :group => 'date, date_fuzziness')\n\n fuzzy_sums.each{ |fs| ft_sums += fs.averaged_date_and_value }\n\n ft_sums.each do |ft_sum|\n res_hsh[ft_sum.first.to_date.beginning_of_month] = res_hsh[ft_sum.first.to_date.beginning_of_month].to_f + ft_sum.last\n end\n\n months_with_vals = res_hsh.sort\n \n first_month, last_month = months_with_vals.first, months_with_vals.last\n spend_by_month_array(first_month.first, last_month.first, months_with_vals)\n end",
"def group_time_accounted_hash(params,tcol)\r\n lookup_activities = current_company.company_activity_types\r\n activities = ReportsHelper.get_lookups(lookup_activities)\r\n conditions,data,total_data,table_headers = {},[],{},[]\r\n duration,billamount,discount,override,finalamount = 0,0,0,0,0\r\n if params[:report][:selected] == \"matter\"\r\n\r\n tcol.group_by(&:matter_id).each do|label,col|\r\n key = nil\r\n client = nil\r\n col.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n if !key and obj.matter\r\n key = obj.matter.clipped_name\r\n client = \" Contact : \" + (obj.matter.contact ? obj.matter.contact.name : \"\")\r\n end\r\n duration += actual_duration.to_f if actual_duration\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n discount += obj.billing_percent if obj.billing_percent\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n\r\n\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n end\r\n next unless key\r\n total_data[key] = data\r\n conditions[key] = client\r\n\r\n data = []\r\n end\r\n conditions[:entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 80, 2 => 80 , 3 => 120 , 4 => 60 , 5 => 60 , 6 => 60 ,7 => 70 , 8 => 60 , 9 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"Rate/hr($)\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n alignment = { 0 => :right, 1 => :right} if params[:format] == \"pdf\"\r\n elsif params[:report][:selected] == \"contact\"\r\n tcol.group_by(&:contact_id).each do|label,col|\r\n key = nil\r\n\r\n col.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n if !key and obj.contact\r\n key = obj.contact.name\r\n\r\n end\r\n duration += actual_duration.to_f if actual_duration\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n discount += obj.billing_percent if obj.billing_percent\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),obj.matter ? obj.matter.clipped_name : \"\",actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n end\r\n next unless key\r\n total_data[key] = data\r\n\r\n data = []\r\n end\r\n conditions[:entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 80, 2 => 80 , 3 => 60 , 4 => 80 , 5 => 60 , 6 => 60 ,7 => 60 , 8 => 70 , 9 => 60,10 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:text_matter),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"#{t(:label_rate_hr)}\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n end\r\n\r\n [total_data,conditions,table_headers,column_widths, alignment]\r\n\r\n end",
"def total_timesheet\n if self.shifts.any?\n hours = self.shifts.sum(:time_worked)\n if hours > 40\n self.reg_hours = 40\n self.ot_hours = hours - 40\n ot_rate = job.pay_rate * 1.5\n self.gross_pay = job.pay_rate * self.reg_hours + self.ot_hours * ot_rate\n else\n pay = job.pay_rate * hours\n self.reg_hours = hours\n self.ot_hours = 0\n self.gross_pay = pay\n self.total_bill = pay * job.mark_up\n \n end\n end\n end",
"def date_spent=(date_spent)\n\t write_attribute(:date_spent, date_spent)\n \t self.month_name = Date::MONTHNAMES[date_spent.month]\n\t self.month_id = date_spent.strftime(\"%m\").to_i\n\t self.week_id = date_spent.strftime(\"%w\").to_i\n\t self.year = date_spent.strftime(\"%y\").to_i\n end",
"def monthly_stake\n bets.not_combo.monthly_stake + combo_bets.monthly_stake\n end",
"def group_time_billed(tcol)\r\n conditions,data,total_data,table_headers = {},[],{},[]\r\n #Grouping by Lawyer\r\n hours,billedhrs,amt = 0,0,0\r\n tcol.group_by(&:employee_user_id).each_value do|col|\r\n \r\n key = nil\r\n array = []\r\n #Grouping by Time entry to calculate total hours billed for particular tima entry date for individual lawywer\r\n col.group_by(&:time_entry_date).each do |label,gcol|\r\n\r\n t_hours,billable_hours,famount = 0,0,0\r\n \r\n gcol.each do|obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n key = obj.performer.try(:full_name).try(:titleize) unless key\r\n t_hours += actual_duration.to_f\r\n if obj.is_billable #if billable\r\n billable_hours += actual_duration.to_f\r\n end\r\n famount += obj.final_billed_amount\r\n \r\n end\r\n if t_hours == billable_hours\r\n billpercent = \"100 %\"\r\n elsif billable_hours == 0\r\n billpercent = \"\"\r\n else\r\n billpercent = ((billable_hours/t_hours.to_f) * 100).roundf2(2).to_s + \" %\"\r\n end\r\n hours += t_hours\r\n billedhrs += billable_hours\r\n amt += famount\r\n data << [label.to_s,t_hours,billable_hours,billpercent,famount]\r\n unless conditions[key]\r\n conditions[key] = [t_hours,billable_hours,famount]\r\n else\r\n conditions[key][0] += t_hours\r\n conditions[key][1] += billable_hours\r\n conditions[key][2] += famount\r\n end #storing each tables result data\r\n end\r\n total_data[key] = data\r\n data = []\r\n end\r\n conditions[:expenses] = [hours,billedhrs,amt]\r\n column_widths = { 0 => 100, 1 => 100, 2 => 100 , 3 => 100,4 => 100 }\r\n alignment = { 0 => :center, 1 => :center, 2 => :center , 3 => :center,4 => :center }\r\n table_headers = [t(:label_date),\"#{t(:text_hour)} #{t(:text_accounted)}\",t(:text_hoursbilled),t(:text_hoursbilledpercent),t(:text_amt)]\r\n [total_data,conditions,table_headers,column_widths,alignment]\r\n end",
"def flight_miles_tally\n get_tally_by_flight_column_name(\"flight_miles\")\n end",
"def billable_hours_for_issue_and_user_this_month\n return @billable_hours_for_issue_and_user_this_month if defined?(@billable_hours_for_issue_and_user_this_month)\n\n @billable_hours_for_issue_and_user_this_month = nil\n\n return @billable_hours_for_issue_and_user_this_month if issue_id.blank? || user_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.billable_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @billable_hours_for_issue_and_user_this_month = cf.format.cast_total_value(cf, total)\n end",
"def performance\n # QUOTES\n @quotes_count = Quote.where(created_at: [1.year.ago..Time.zone.now]).group_by_month(:created_at, time_zone: Time.zone).count\n @quotes_one_year_ago = Quote.where(created_at: [2.year.ago..1.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n @quotes_two_years_ago = Quote.where(created_at: [3.year.ago..2.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n\n @quotes_one_year_ago = align_chartkick_dates(@quotes_one_year_ago, 1)\n @quotes_two_years_ago = align_chartkick_dates(@quotes_two_years_ago, 2)\n\n @quote_dates = [\n {name: Time.now.year, data: @quotes_count},\n {name: 1.year.ago.year, data: @quotes_one_year_ago},\n {name: 2.years.ago.year, data: @quotes_two_years_ago}\n ]\n\n\n # ORDERS\n @orders_count = Order.where(created_at: [1.year.ago..Time.zone.now]).group_by_month(:created_at, time_zone: Time.zone).count\n @orders_one_year_ago = Order.where(created_at: [2.year.ago..1.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n @orders_two_years_ago = Order.where(created_at: [3.year.ago..2.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n\n @orders_one_year_ago = align_chartkick_dates(@orders_one_year_ago, 1)\n @orders_two_years_ago = align_chartkick_dates(@orders_two_years_ago, 2)\n\n @order_dates = [\n {name: Time.now.year, data: @orders_count},\n {name: 1.year.ago.year, data: @orders_one_year_ago},\n {name: 2.years.ago.year, data: @orders_two_years_ago},\n ]\n\n end",
"def worktype_cumul(begda,endda)\n teams=Team.find(:all)\n wt_total = []\n teams.each do |team|\n curdate = begda\n wt_team = {}\n until curdate > endda do\n wt_month = calculate_worktype_distribution(curdate,team.id)\n wt_month.keys.each do |wt|\n if wt_team[wt].nil?\n wt_team[wt] = { :daysbooked => wt_month[wt][:daysbooked] }\n else\n\t wt_team[wt][:daysbooked] = wt_team[wt][:daysbooked] + wt_month[wt][:daysbooked] \n end\n end\n curdate = curdate >> 1\n end\n # get the total time and calculate percentages\n sum_of_times_booked = 0\n wt_team.keys.each do |wt|\n sum_of_times_booked += wt_team[wt][:daysbooked]\n end\n\n wt_team.keys.each do |wt|\n perc = (wt_team[wt][:daysbooked]/sum_of_times_booked)*100\n wt_total << { :team_id => team.id,\n :worktype_id => wt,\n :daysbooked => wt_team[wt][:daysbooked],\n :perc => perc }\n end\n end\n return wt_total\n end",
"def spent_hours_for_user\n return @spent_hours_for_user if defined?(@spent_hours_for_user)\n\n @spent_hours_for_user = nil\n\n return @spent_hours_for_user if user_id.blank?\n\n @spent_hours_for_user = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).sum(:hours)\n end"
] | [
"0.6525233",
"0.6523704",
"0.6403977",
"0.6160838",
"0.5894229",
"0.5734933",
"0.5646814",
"0.56262475",
"0.5550448",
"0.552101",
"0.54953843",
"0.5461707",
"0.54507524",
"0.5431598",
"0.5400899",
"0.5361746",
"0.53082275",
"0.5303204",
"0.53031826",
"0.5294604",
"0.52906287",
"0.5284",
"0.52670085",
"0.5261265",
"0.52589804",
"0.5232539",
"0.5231633",
"0.522925",
"0.521262",
"0.5180549"
] | 0.66099507 | 0 |
GET /stay_times GET /stay_times.json | def index
@stay_times = StayTime.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end",
"def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end",
"def index\n render json: {time: Time.now}\n end",
"def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end",
"def index\n @mealtimes = Mealtime.all\n end",
"def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def show\n render json: @timer\n end",
"def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), status: :ok\n end",
"def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end",
"def index\n @timers = Timer.all\n\n render json: @timers\n end",
"def index\n\n @hurdle_times = HurdleTime.order('time, hurdle_match_id, lane')\n\n if params[:hurdle_match_id]\n @hurdle_times = @hurdle_times.where(:hurdle_match_id => params[:hurdle_match_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hurdle_times }\n end\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def index\n @location_times = LocationTime.all\n end",
"def open_appointments\n date = Date.parse(params[:date])\n clinic = Clinic.find(params[:clinic_id])\n doctor = Doctor.find(params[:doctor_id])\n # @times = doctor.open_appointment_times(date)\n @times = clinic.open_appointment_times(date, doctor)\n if @times.is_a?(Hash)\n render json: {status: 1, error: @times[:error]}\n else\n render json: { status: 0, times: @times }\n end\n #@appointment = Appointment.new\n #render json: {open_times: @open_times}\n # render json: {times: [\n # {time: '8:00 AM', enabled: true, selected: false, index: 0},\n # {time: '8:30 AM', enabled: false, selected: false, index: 1},\n # {time: '9:00 AM', enabled: true, selected: false, index: 2},\n # {time: '9:30 AM', enabled: true, selected: false, index: 3},\n # {time: '10:00 AM', enabled: false, selected: false, index: 4},\n # {time: '10:30 AM', enabled: false, selected: false, index: 5},\n # {time: '11:00 AM', enabled: false, selected: false, index: 6},\n # {time: '11:30 AM', enabled: true, selected: false, index: 7},\n # {time: '12:00 PM', enabled: true, selected: false, index: 8},\n # {time: '12:30 PM', enabled: true, selected: false, index: 9},\n # {time: '1:00 PM', enabled: false, selected: false, index: 10},\n # {time: '1:30 PM', enabled: true, selected: false, index: 11},\n # {time: '2:00 PM', enabled: false, selected: false, index: 12},\n # {time: '2:30 PM', enabled: false, selected: false, index: 13},\n # {time: '3:00 PM', enabled: true, selected: false, index: 14},\n # {time: '3:30 PM', enabled: true, selected: false, index: 15},\n # {time: '4:00 PM', enabled: true, selected: false, index: 16},\n # {time: '4:30 PM', enabled: false, selected: false, index: 17},\n # {time: '5:00 PM', enabled: true, selected: false, index: 18},\n # {time: '5:30 PM', enabled: true, selected: false, index: 19}]}\n\n end",
"def index\n date_range = unix_date(params[:date])\n @timeslots = Timeslot.where('start_time >= ? and start_time <= ?', date_range[:beginning_of_day], date_range[:end_of_day])\n # render :json => @timeslots.as_json(only: [])\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def index\n @timeslots = Timeslot.all\n end",
"def index\n @timeslots = Timeslot.all\n end",
"def index\n @allocated_times = AllocatedTime.all\n end",
"def index\n @session_times = SessionTime.all\n end",
"def index\n @cooking_times = CookingTime.all\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clock_time }\n end\n end",
"def index\n @clock = @employee.clock_in_out\n render json: @clock\n end",
"def index\n @wait_times = WaitTime.all\n end",
"def index\n schedules = Schedule.where(trip_id: params[:trip_id])\n respond_with schedules\n end",
"def index\n @working_start_times = WorkingStartTime.all\n end",
"def index\n @meeting_times = MeetingTime.order(:time).all\n end",
"def index\n @time_of_days = TimeOfDay.all\n end"
] | [
"0.66211087",
"0.63165516",
"0.6313331",
"0.6311019",
"0.62858325",
"0.6283367",
"0.62432575",
"0.6238713",
"0.62150556",
"0.6213193",
"0.6212546",
"0.6203579",
"0.62031066",
"0.616202",
"0.61575663",
"0.6142375",
"0.61341816",
"0.612905",
"0.6113712",
"0.6113712",
"0.6102728",
"0.6096498",
"0.60754645",
"0.6056405",
"0.6045273",
"0.60075766",
"0.59995395",
"0.59892344",
"0.5986988",
"0.59824556"
] | 0.75969326 | 0 |
POST /stay_times POST /stay_times.json | def create
@stay_time = StayTime.new(stay_time_params)
respond_to do |format|
if @stay_time.save
format.html { redirect_to @stay_time, notice: 'Stay time was successfully created.' }
format.json { render :show, status: :created, location: @stay_time }
else
format.html { render :new }
format.json { render json: @stay_time.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stay_time_params\n params.require(:stay_time).permit(:arrive_date, :leave_date, :nationality, :country_stay, :day_stay)\n end",
"def index\n @stay_times = StayTime.all\n end",
"def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end",
"def create\n @time_gap = TimeGap.new(params[:time_gap])\n\n respond_to do |format|\n if @time_gap.save\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully created.' }\n format.json { render json: @time_gap, status: :created, location: @time_gap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n busy_shifts = params[:busy_shift]\n if busy_shifts\n busy_shifts[:day].length.times do |index|\n day = busy_shifts[:day][index]\n start_time = busy_shifts[:start_time][index]\n end_time = busy_shifts[:end_time][index]\n @busy_shifts = current_user.busy_shifts.create(:day => day, :start_time => start_time, :end_time => end_time)\n end\n render json: current_user.busy_shifts\n else\n render json: {errors: \"Could not create busy shifts there was a error\"}\n end\n end",
"def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_stay_time\n @stay_time = StayTime.find(params[:id])\n end",
"def create\n @working_time = WorkingTime.new(params[:working_time])\n\n respond_to do |format|\n if current_user.time_tables[0].working_times << @working_time\n format.html { redirect_to time_tables_path }\n format.json { render json: @working_time, status: :created, location: @working_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.create(params[:schedule])\n\n # TODO can improve it to use nested attributes\n params[:pill_time].each do |pill_time|\n @schedule.pill_times.build(pill_time)\n end\n\n @pill_times = @schedule.pill_times\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule,\n status: :created,\n location: [@patient, @schedule] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @workSegment = @workday.workSegments.last\n puts @workSegment.workday.dayDate\n # if @workSegment.timePunches.count == 0\n # @currentStatus = false\n # else\n # @lastTimePunch = @workSegment.timePunches.last\n # @currentStatus = @lastTimePunch.status\n # end\n\n @time_punch = @workSegment.timePunches.new(punch: Time.current, status: true)\n\n respond_to do |format|\n if @time_punch.save\n format.html { redirect_to dashboard_path, notice: 'Time punch was successfully created.' }\n # format.json { render :show, status: :created, location: @time_punch }\n else\n format.html { redirect_to dashboard_path, notice: 'clock record was not created(from tp controller).' }\n # format.json { render json: @time_punch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_tracker = TimeTracker.new({ started_at: Time.current, status: 'running' }.merge(time_tracker_params))\n\n respond_to do |format|\n if @time_tracker.save\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully created.' }\n format.json { render :show, status: :created, location: @time_tracker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timeslot = Timeslot.new(timeslot_params)\n @timeslot.save!\n render :json => @timeslot.as_json\n end",
"def create\n @stime = Stime.new(stime_params)\n\n respond_to do |format|\n if @stime.save\n format.html { redirect_to @stime, notice: 'Stime was successfully created.' }\n format.json { render :show, status: :created, location: @stime }\n else\n format.html { render :new }\n format.json { render json: @stime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cooking_time = CookingTime.new(cooking_time_params)\n\n respond_to do |format|\n if @cooking_time.save\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cooking_time }\n else\n format.html { render action: 'new' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @allocated_time = AllocatedTime.new(allocated_time_params)\n\n respond_to do |format|\n if @allocated_time.save\n format.html { redirect_to @allocated_time, notice: 'Allocated time was successfully created.' }\n format.json { render :show, status: :created, location: @allocated_time }\n else\n format.html { render :new }\n format.json { render json: @allocated_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def open_appointments\n date = Date.parse(params[:date])\n clinic = Clinic.find(params[:clinic_id])\n doctor = Doctor.find(params[:doctor_id])\n # @times = doctor.open_appointment_times(date)\n @times = clinic.open_appointment_times(date, doctor)\n if @times.is_a?(Hash)\n render json: {status: 1, error: @times[:error]}\n else\n render json: { status: 0, times: @times }\n end\n #@appointment = Appointment.new\n #render json: {open_times: @open_times}\n # render json: {times: [\n # {time: '8:00 AM', enabled: true, selected: false, index: 0},\n # {time: '8:30 AM', enabled: false, selected: false, index: 1},\n # {time: '9:00 AM', enabled: true, selected: false, index: 2},\n # {time: '9:30 AM', enabled: true, selected: false, index: 3},\n # {time: '10:00 AM', enabled: false, selected: false, index: 4},\n # {time: '10:30 AM', enabled: false, selected: false, index: 5},\n # {time: '11:00 AM', enabled: false, selected: false, index: 6},\n # {time: '11:30 AM', enabled: true, selected: false, index: 7},\n # {time: '12:00 PM', enabled: true, selected: false, index: 8},\n # {time: '12:30 PM', enabled: true, selected: false, index: 9},\n # {time: '1:00 PM', enabled: false, selected: false, index: 10},\n # {time: '1:30 PM', enabled: true, selected: false, index: 11},\n # {time: '2:00 PM', enabled: false, selected: false, index: 12},\n # {time: '2:30 PM', enabled: false, selected: false, index: 13},\n # {time: '3:00 PM', enabled: true, selected: false, index: 14},\n # {time: '3:30 PM', enabled: true, selected: false, index: 15},\n # {time: '4:00 PM', enabled: true, selected: false, index: 16},\n # {time: '4:30 PM', enabled: false, selected: false, index: 17},\n # {time: '5:00 PM', enabled: true, selected: false, index: 18},\n # {time: '5:30 PM', enabled: true, selected: false, index: 19}]}\n\n end",
"def create\n @work_time = WorkTime.new(work_time_params)\n\n respond_to do |format|\n if @work_time.save\n format.html { redirect_to @work_time, notice: 'Work time was successfully created.' }\n format.json { render :show, status: :created, location: @work_time }\n else\n format.html { render :new }\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_time_request\n TimeRequest.create(\n time: [ Time.new(2000, 1, 1, 14, 0, 0, \"+00:00\").utc, Time.new(2000, 1, 1, 13, 0, 0, \"+00:00\").utc, Time.new(2000, 1, 1, 12, 0, 0, \"+00:00\").utc ].sample,\n reservation: Reservation.all.sample,\n check_in: [true, false].sample,\n status: 'pending'\n )\nend",
"def create\n @wait_time = WaitTime.new(params[:wait_time])\n\n respond_to do |format|\n if @wait_time.save\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully created.' }\n format.json { render json: @wait_time, status: :created, location: @wait_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stay_time.update(stay_time_params)\n format.html { redirect_to @stay_time, notice: 'Stay time was successfully updated.' }\n format.json { render :show, status: :ok, location: @stay_time }\n else\n format.html { render :edit }\n format.json { render json: @stay_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stop_time = StopTime.new(params[:stop_time])\n\n respond_to do |format|\n if @stop_time.save\n format.html { redirect_to @stop_time, notice: 'Stop time was successfully created.' }\n format.json { render json: @stop_time, status: :created, location: @stop_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stop_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wait_time = WaitTime.new(wait_time_params)\n\n respond_to do |format|\n if @wait_time.save\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully created.' }\n format.json { render :show, status: :created, location: @wait_time }\n else\n format.html { render :new }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meal_time = MealTime.new(params[:meal_time])\n\n respond_to do |format|\n if @meal_time.save\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully created.' }\n format.json { render json: @meal_time, status: :created, location: @meal_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_registration = TimeRegistration.create(time_registration_params)\n respond_to do |format|\n if @time_registration.save\n format.json { render :show, status: :created, location: @time_registration }\n else\n format.json { render json: @time_registration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_of_day = TimeOfDay.new(time_of_day_params)\n\n respond_to do |format|\n if @time_of_day.save\n format.html { redirect_to @time_of_day, notice: 'Time of day was successfully created.' }\n format.json { render :show, status: :created, location: @time_of_day }\n else\n format.html { render :new }\n format.json { render json: @time_of_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @downtime = Downtime.new(downtime_params)\n\n respond_to do |format|\n if @downtime.save\n format.html { redirect_to @downtime, notice: 'Downtime was successfully created.' }\n format.json { render action: 'show', status: :created, location: @downtime }\n else\n format.html { render action: 'new' }\n format.json { render json: @downtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meeting_time = MeetingTime.new(meeting_time_params)\n\n respond_to do |format|\n if @meeting_time.save\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully created.' }\n format.json { render action: 'show', status: :created, location: @meeting_time }\n else\n format.html { render action: 'new' }\n format.json { render json: @meeting_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end",
"def stay_night_params\n params.require(:stay_night).permit(:today, :city_id, :hotel_id, :rate, :comment)\n end",
"def create\n @nursing_time = NursingTime.new(params[:nursing_time])\n\n respond_to do |format|\n if @nursing_time.save\n format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully created.' }\n format.json { render json: @nursing_time, status: :created, location: @nursing_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nursing_time.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6601063",
"0.6519595",
"0.62858284",
"0.6268728",
"0.6266317",
"0.62011385",
"0.617307",
"0.6168958",
"0.6111555",
"0.60858476",
"0.60694796",
"0.6050281",
"0.6019576",
"0.60107577",
"0.5925939",
"0.5908032",
"0.5900547",
"0.58972186",
"0.5892104",
"0.5891286",
"0.5875553",
"0.58427113",
"0.5817103",
"0.58074206",
"0.58049953",
"0.5779078",
"0.57777137",
"0.57768315",
"0.5767359",
"0.57642305"
] | 0.7005587 | 0 |
PATCH/PUT /stay_times/1 PATCH/PUT /stay_times/1.json | def update
respond_to do |format|
if @stay_time.update(stay_time_params)
format.html { redirect_to @stay_time, notice: 'Stay time was successfully updated.' }
format.json { render :show, status: :ok, location: @stay_time }
else
format.html { render :edit }
format.json { render json: @stay_time.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.find(params[:id])\n @pill_times = @schedule.pill_times\n\n # TODO can improve it to use nested attributes\n if params[:pill_time]\n params[:pill_time].each_with_index do |pill_time, idx|\n if @pill_times[idx]\n @pill_times[idx].update_attributes(pill_time)\n else\n @pill_times.create(pill_time)\n end\n end\n end\n\n # remove unused pill times\n if params[:pill_time]\n diff = @pill_times.size - params[:pill_time].size\n @pill_times.destroy(@pill_times.last(diff)) if diff > 0\n end\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n if @time_gap.update_attributes(params[:time_gap])\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @timing\n else\n render json: { error: 'error: could not update timing' }\n end\n end",
"def update\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n if @meal_time.update_attributes(params[:meal_time])\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooking_time.update(cooking_time_params)\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n if @working_time.update_attributes(params[:working_time])\n format.html { redirect_to time_tables_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stime.update(stime_params)\n format.html { redirect_to @stime, notice: 'Stime was successfully updated.' }\n format.json { render :show, status: :ok, location: @stime }\n else\n format.html { render :edit }\n format.json { render json: @stime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:task][:time] = parse_task_time(params[:task][:time], params[:anytime][:anytime])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n if @wait_time.update_attributes(params[:wait_time])\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n if @time_off_request.update_attributes(params[:time_off_request])\n format.html { redirect_to admin_time_off_requests_url, notice: 'Time off request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_off_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_clock.update(time_clock_params)\n format.html { redirect_to time_sheet_index_path(@time_clock), notice: 'Time clock entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_clock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n if @service_time.update_attributes(params[:service_time])\n format.html { redirect_to @service_time, notice: 'Service time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @teetime.update(teetime_params)\n\n render json: @teetime,status: :ok\n\n else\n\n render json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @timeslot.update(timeslot_params)\n render :show, status: :ok, location: @timeslot\n else\n render json: @timeslot.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @can_edit\n\n # Clear out all other blocks\n @timetable.free_times.destroy_all\n times = JSON::Parser.new(params[:times]).parse\n\n # There's an array for each day of the week\n times.each_with_index do |day, i|\n # Each day of the week then has a list of blocks\n day.each_with_index do |block, j|\n unless block.empty?\n # Each block has a start time and an end time for a free block\n @timetable.free_times.create(:start_time => block[0], :end_time => block[1], :day_of_week => i, :weight => block[2], :css_class => block[3])\n end\n end\n end\n\n @person ||= get_person\n @timetable.update_attributes(:updated_by_person_id => @my.id)\n @timetable.touch\n return if @signup\n\n flash[:notice] = I18n.t('timetable.save_confirm')\n\n elsif !@can_edit\n flash[:notice] = I18n.t('timetable.not_allowed_update')\n end\n\n respond_to do |format|\n format.html { redirect_to(person_timetable_path(@timetable.person, @timetable)) }\n format.js\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @time_slot.update(time_slot_params)\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_slot }\n else\n format.html { render :edit }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n if @one_time_stop.update_attributes(params[:one_time_stop])\n format.html { redirect_to @one_time_stop, notice: 'One time stop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_time_stop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @where_to_stay = WhereToStay.find(params[:id])\n\n respond_to do |format|\n if @where_to_stay.update_attributes(params[:where_to_stay])\n format.html { redirect_to @where_to_stay, notice: 'Where to stay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @where_to_stay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timeslot = current_event.timeslots.find(params[:id])\n respond_to do |format|\n @timeslot.start_time_will_change!\n @timeslot.slot_date_will_change!\n if @timeslot.update_attributes(params[:timeslot])\n flash[:notice] = \"Timeslot was successfully updated.\"\n format.html { redirect_to(timeslots_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @timeslot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @downtime.update(downtime_params)\n format.html { redirect_to @downtime, notice: 'Downtime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @downtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poi_time.update(poi_time_params)\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_time }\n else\n format.html { render :edit }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timeslot.update(timeslot_params)\n format.html { redirect_to @timeslot, notice: 'Timeslot was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeslot }\n else\n format.html { render :edit }\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_time.update(location_time_params)\n format.html { redirect_to @location_time, notice: 'Location time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @time_slot.update(time_slot_params)\n render :show, status: :ok, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @wait_time.update(wait_time_params)\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { render :show, status: :ok, location: @wait_time }\n else\n format.html { render :edit }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @working_start_time.update(working_start_time_params)\n format.html { redirect_to @working_start_time, notice: 'Working start time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @working_start_time.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6653054",
"0.66524994",
"0.6601323",
"0.6582362",
"0.6573549",
"0.65660256",
"0.6546499",
"0.6529287",
"0.6527774",
"0.6489228",
"0.6447293",
"0.64378303",
"0.6422342",
"0.641576",
"0.6414202",
"0.6411619",
"0.6408857",
"0.6397323",
"0.639375",
"0.6386395",
"0.6381744",
"0.63801914",
"0.6353734",
"0.63528013",
"0.6350535",
"0.6349531",
"0.6335187",
"0.633248",
"0.63109475",
"0.62985986"
] | 0.7227714 | 0 |
DELETE /stay_times/1 DELETE /stay_times/1.json | def destroy
@stay_time.destroy
respond_to do |format|
format.html { redirect_to stay_times_url, notice: 'Stay time was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n respond_to do |format|\n format.html { redirect_to time_gaps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @meal_time = MealTime.find(params[:id])\n @meal_time.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hurdle_time = HurdleTime.find(params[:id])\n @hurdle_time.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooking_time.destroy\n respond_to do |format|\n format.html { redirect_to cooking_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stime.destroy\n respond_to do |format|\n format.html { redirect_to stimes_url, notice: 'Stime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_time = ServiceTime.find(params[:id])\n @service_time.destroy\n\n respond_to do |format|\n format.html { redirect_to service_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wait_time = WaitTime.find(params[:id])\n @wait_time.destroy\n\n respond_to do |format|\n format.html { redirect_to wait_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_time.destroy\n respond_to do |format|\n format.html { redirect_to meeting_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_clock.destroy\n respond_to do |format|\n format.html { redirect_to time_sheet_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_of_day.destroy\n respond_to do |format|\n format.html { redirect_to time_of_days_url, notice: 'Time of day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @where_to_stay = WhereToStay.find(params[:id])\n @where_to_stay.destroy\n\n respond_to do |format|\n format.html { redirect_to where_to_stays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allocated_time.destroy\n respond_to do |format|\n format.html { redirect_to allocated_times_url, notice: 'Allocated time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_off_request = TimeOffRequest.find(params[:id])\n @time_off_request.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_time_off_requests_url}\n format.json { head :ok }\n end\n end",
"def destroy\n @stay_night.destroy\n respond_to do |format|\n format.html { redirect_to stay_nights_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @one_time_stop = OneTimeStop.find(params[:id])\n @one_time_stop.destroy\n\n respond_to do |format|\n format.html { redirect_to one_time_stops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @working_start_time.destroy\n respond_to do |format|\n format.html { redirect_to working_start_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day_timeslot.destroy\n respond_to do |format|\n format.html { redirect_to day_timeslots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stop_time = StopTime.find(params[:id])\n @stop_time.destroy\n\n respond_to do |format|\n format.html { redirect_to stop_times_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order_break_time.destroy\n respond_to do |format|\n format.html { redirect_to order_break_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disatance_and_time.destroy\n respond_to do |format|\n format.html { redirect_to disatance_and_times_url, notice: 'Disatance and time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poi_time.destroy\n respond_to do |format|\n format.html { redirect_to poi_times_url, notice: 'Poi time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cal_time.destroy\n respond_to do |format|\n format.html { redirect_to cal_times_url, notice: 'Cal time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_trial.destroy\n respond_to do |format|\n format.html { redirect_to '/admin', notice: 'Time trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = current_firm.all_time_entries.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to params[:ret] || firm_time_entries_path(current_firm) }\n format.json { head :ok }\n end\n end"
] | [
"0.7226604",
"0.69612134",
"0.6939054",
"0.6817791",
"0.681168",
"0.6803863",
"0.67897755",
"0.6786757",
"0.6783543",
"0.6771888",
"0.6769168",
"0.6741878",
"0.67337954",
"0.6730354",
"0.66895",
"0.6688952",
"0.6681023",
"0.66767806",
"0.66705346",
"0.6667793",
"0.66658086",
"0.66479504",
"0.66271615",
"0.66242707",
"0.6619212",
"0.6610823",
"0.6597983",
"0.6596513",
"0.6596408",
"0.6595423"
] | 0.74384403 | 0 |
Returns a list of open hours grouped by same days | def grouped_open_hours
open_hours = []
start_day = nil
end_day = nil
current_period = nil
standard_hours.sort.each_with_index do |o, i|
if not o.open?
period = "Stengt"
else
period = I18n.l(o.open_time, format: :time) + " - " + I18n.l(o.close_time, format: :time)
end
# Track day
if start_day == nil
start_day = o.day
current_period = period
end
# Previous group ended, add it
if period != current_period
day = I18n.t("days.#{start_day}")
if end_day != nil
day += " - " + I18n.t("days.#{end_day}")
end
# Hverdager custom string
if start_day == "monday" and end_day == "friday"
day = "Hverdager"
end
open_hours.append([day, current_period])
current_period = period
start_day = o.day
end_day = nil
end
# Update period end
if start_day != o.day
end_day = o.day
end
# Last day closes period
if i >= standard_hours.count - 1
day = I18n.t("days.#{start_day}")
if end_day != nil
day += " - " + I18n.t("days.#{o.day}")
end
open_hours.append([day, current_period])
end
end
open_hours
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouped_office_hours\n merged_hours.map { |hash_list|\n days = if hash_list.length == 1\n hash_list.first[:day]\n elsif hash_list.length > 1\n \"#{hash_list.first[:day]} - #{hash_list.last[:day]}\"\n end\n {:hours => hash_list.first[:hours],\n :day => days }\n }.delete_if {|hash| hash[:hours].blank? }\n end",
"def opening_hours\n hours = @data[:godziny_pracy]\n keys = {weekdays: :dni_robocze, saturdays: :soboty, sundays: :niedz_i_sw}\n Hash[\n keys.map do |h, x|\n value = unless hours[x].nil?\n [hours[x][:godziny].to_s, hours[x][:uwagi].to_s]\n end\n\n [h, value]\n end\n ]\n end",
"def group_by_hour\n group_by { |e| e.timestamp.hour }\n end",
"def each_open_day\n each do |day, times|\n unless times.empty?\n yield day, times\n end\n end\n end",
"def get_hours_array hours\n hours_array = []\n hours.each { |h| hours_array << h.date }\n return hours_array\n end",
"def show\n @open_hours = Hash.new\n @place.open_times.each do |schedule|\n @open_hours[schedule.day] = \"#{schedule.open_time.strftime('%l:%M %P')} - #{schedule.close_time.strftime('%l:%M %P')}\"\n end\n end",
"def grid\n Date::DAYNAMES.map do |name|\n daily_hours = send(name.downcase)\n HOURS.map do |hour|\n daily_hours.include? hour\n end\n end\n end",
"def open_close_times(date)\n open_close = @open_close[as_string(date)] || @open_close[as_sym(date)] || @default_open_close\n open_close.collect { |h| Time.parse(\"#{as_string(date)} #{h}\") }\n end",
"def show_opening_hours(times, formatted_times, event_date)\n result = 'Not Open Today'\n event_day = transformToFourSquareDay(event_date.in_time_zone.wday)\n times.each_with_index do |time, index|\n unless time.days.index(event_day).nil?\n result = formatted_times[index].open[0].renderedTime\n end\n end\n result\n end",
"def hours_in_day(*hours)\n @test_time = @time if @test_time.nil?\n x_in_list_of_y(@test_time.hour, Configuration.parse_range(hours).flatten)\n end",
"def trucks_currently_open\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_open_now = []\n trucks.each do |truck|\n if date.strftime('%H:%M') <= truck[\"end24\"] && \n date.strftime('%H:%M') > truck[\"start24\"]\n trucks_open_now << truck[\"applicant\"]\n end \n end\n p trucks_open_now\n end",
"def hours\n @hours ||= []\n return @hours if !@hours.empty?\n src['hours'].each{|h| @hours << Stormglass::Hour.new(h) }\n @hours\n end",
"def hourly_totals(emoji)\n hour_zero = self.last_hour.where(emoji: emoji).pluck(:created_at).size\n hour_one = self.last_hour_plus_one.where(emoji: emoji).pluck(:created_at).size\n hour_two = self.last_hour_plus_two.where(emoji: emoji).pluck(:created_at).size\n hour_three = self.last_hour_plus_three.where(emoji: emoji).pluck(:created_at).size\n hour_four = self.last_hour_plus_four.where(emoji: emoji).pluck(:created_at).size\n some_days = [hour_zero, hour_one, hour_two, hour_three, hour_four]\n end",
"def closed(day)\n week.each do |weekday,hours_array|\n if day == weekday \n week[weekday] = [\"closed\"]\n \n end\n end\n end",
"def open?\n return false if close_today?\n today = self.time_tables.find_by(day_of_week: Time.now.wday)\n (today.opened_at...today.closed_at).include?(Time.now.hour)\nend",
"def hour_events(selected_day, hour, events)\n h = hour.split(\":\")\n hour_end = \"#{h[0]}:59\"\n events.select { |e| e.start_time.to_date == selected_day && (e.start_time.to_time.strftime(\"%H:%M\") >= hour) && (e.start_time.to_time.strftime(\"%H:%M\") < hour_end) }\n end",
"def open_slots_for_select(date)\n open_slots(date).map do |slot|\n [\"#{slot.starts_at.strftime('%d/%m/%Y, %H:%M ')}\", slot.starts_at]\n end\n end",
"def index\n @open_hours = OpenHour.all\n end",
"def next_weeks_open_house_dates(open_house_dow)\n now = Time.now\n dates = []\n (0...7).each do |day_offset|\n days = day_offset*24*60*60\n date = now + days\n if open_house_dow.include?(date.wday)\n dates << now + days\n end\n end\n dates\n end",
"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 hour_of_day(*hours)\n merge(hour: hours)\n end",
"def days\n return self.day_shifts.keys\n end",
"def group_by_day\n\n\tend",
"def get_worked_hours_hash hours_array, hash\n first_hour_pos = 0\n hours_array.each do |hour|\n if is_different_day? hour.day, hours_array[first_hour_pos].day\n current_day = hours_array[first_hour_pos]\n first_hour_pos = hours_array.index(hour)\n worked_hours = get_worked_hours(current_day, hours_array[first_hour_pos - 1])\n hash = build_hash hash, current_day, worked_hours, hours_array[first_hour_pos - 1]\n elsif hours_array.index(hour) == hours_array.size - 1\n worked_hours = get_worked_hours(hours_array[first_hour_pos], hours_array[hours_array.size - 1])\n hash = build_hash hash, hours_array[first_hour_pos], worked_hours, hours_array[hours_array.size - 1]\n end\n end\n return hash\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def group_by_day\n group_by { |e| e.timestamp.strftime '%Y-%m-%d' }\n end",
"def hours_for(hours)\n return 'closed' if hours.blank?\n\n hours.reduce '' do |memo, time_range|\n midnight = Time.current.midnight\n start_time = midnight.since(time_range.begin).strftime(TIME_FORMAT).strip\n end_time = midnight.since(time_range.end).strftime(TIME_FORMAT).strip\n\n memo + \"#{memo.empty? ? '' : ', '}#{start_time} to #{end_time}\"\n end\n end",
"def remaining_hours_by_day\n values_by_day(0, true) { |x| model.remaining_hours_for_day_number(x) }\n end",
"def trucks_open_today\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_today = []\n trucks.each do |truck|\n if date.strftime(\"%A\") == truck[\"dayofweekstr\"]\n trucks_today << truck[\"applicant\"]\n end \n end\n p trucks_today\n end",
"def hours( calculator )\n a = []\n a << terse_hours( calculator.total ) if ( @report.include_totals )\n a << terse_hours( calculator.committed ) if ( @report.include_committed )\n a << terse_hours( calculator.not_committed ) if ( @report.include_not_committed )\n return a\n end"
] | [
"0.70517796",
"0.69048524",
"0.6768556",
"0.6492265",
"0.64917797",
"0.63770425",
"0.63338524",
"0.6316042",
"0.6208983",
"0.61528325",
"0.61422634",
"0.6134684",
"0.6125631",
"0.60609424",
"0.60586065",
"0.60343283",
"0.601223",
"0.59675455",
"0.5867969",
"0.581537",
"0.581267",
"0.5801489",
"0.57857394",
"0.576555",
"0.5741301",
"0.57211304",
"0.5716467",
"0.57102394",
"0.57062435",
"0.56804526"
] | 0.8231436 | 0 |
GET /graphium/cities GET /graphium/cities.json | def index
@graphium_cities = Graphium::City.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n neo = Neography::Rest.new\n r = neo.execute_query(\"START n=node(*) RETURN n;\")\n r[\"data\"].shift # first node is wacky\n @cities = r[\"data\"].map { |node|\n OpenStruct.new(node[0][\"data\"].merge(id: node[0][\"self\"].match(/node\\/(\\d+)$/)[1].to_i))\n }\n end",
"def cities\n CS.get :us, :ca\n end",
"def city\n fetch('dune.cities')\n end",
"def cities\n cities = CS.cities(params[:id], :GB)\n if cities.blank?\n country = ISO3166::Country.find_country_by_alpha3(params[:id])\n cities = country_cites(country)\n return(render json: { message: I18n.t(:invalid_country) }) if cities.blank?\n end\n render json: cities\n end",
"def city\n fetch('world_cup.cities')\n end",
"def get_list_cities\n City.get_all_cities\n end",
"def city\n fetch('dnd.cities')\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def print_city_list\n\n # simply call the print_vertices function of the graph API\n @query.get_graph.each_key { |city| puts \"#{get_city_info(city,\"name\")}\"}\n\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 @cities = CITIES\n end",
"def cities\n galleries.map do |c|\n c.city\n end\n end",
"def get_cities\n cities = {}\n doc = nil\n retry_if_exception do\n doc = Nokogiri::HTML( easy_curl(@host_url) )\n end\n return [] if not doc\n a_cities = doc.css(\"ul[class='s-dropdown afh-dd-city'] li a\")\n a_cities.each do |city|\n city_name = city.text\n city_code = city['href'].scan(/\\w+(?=\\/changecity)/).pop\n next if not city_code\n cities[city_code] = city_name\n end\n cities\nend",
"def index\n\n if params[:region_id]\n\n @regions = Region.where(id: params[:region_id])\n render json: @regions, include: [:cities], show_children: true\n\n elsif params[:ip]\n\n @iprange = Iprange.find_by_ip params[:ip]\n\n if @iprange\n\n render json: @iprange.city, include: [:region], show_parent: true\n\n else\n throw ActiveRecord::RecordNotFound\n end\n\n else\n\n @cities = City.all\n\n render json: @cities\n\n end\n end",
"def geo\n\t\tciudad = params[:id]\n\t\t@ubication = City.where(id: ciudad)\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @ubication }\n\t\tend\n\tend",
"def getAllCities\r\n result = []\r\n @vertex.each_value do |city|\r\n result << city.name\r\n end\r\n return result\r\n end",
"def show\n render json: @city\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 test_get_all_cities\n \n test_map = ' { \"metros\" : [ {\n \"code\" : \"LON\" ,\n \"name\" : \"London\",\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"PAR\" ,\n \"name\" : \"Paris\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"LIM\" ,\n \"name\" : \"Lima\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1 \n } , {\n \"code\" : \"MOW\" ,\n \"name\" : \"Moscow\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } ] ,\n \"routes\" : [ {\n \"ports\" : [\"LON\" , \"PAR\"] ,\n \"distance\" : 2410\n } , {\n \"ports\" : [\"LON\" , \"MOW\"] ,\n \"distance\" : 4323\n } , {\n \"ports\" : [\"LIM\" , \"PAR\"] ,\n \"distance\" : 4323\n } ] } '\n graph = Graph.new()\n graph.parse_json_string(test_map)\n \n result = graph.get_all_cities()\n \n assert_equal( result.scan(/[A-Z]*, [A-Z]{3}/).size, 4)\n assert_equal( result.include?(\"London, LON\"), true )\n assert_equal( result.include?(\"Moscow, MOW\"), true )\n assert_equal( result.include?(\"Lima, LIM\"), true )\n assert_equal( result.include?(\"Paris, PAR\"), true )\n \n end",
"def cities()\n sql = \"SELECT cities.* FROM cities WHERE country_id = $1\"\n values = [@id]\n cities = SqlRunner.run(sql, values)\n result = City.map_items(cities)\n return result\n end",
"def cities\n galleries.map {|g| g.city}\n end",
"def cities\n gallaries.map{|place| place.city}\n\n end",
"def index\n if params[:country]\n country = Country.find_by_id(params[:country])\n if !country.nil?\n @cities = country.cities\n else\n flash[:error] = t(:country_not_found)\n @cities = nil\n end\n else\n return redirect_to countries_path\n end\n\n respond_to do |format|\n# format.html # index.html.erb\n format.json { render json: @cities }\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 set_graphium_city\n @graphium_city = Graphium::City.find(params[:id])\n end",
"def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend",
"def index\n @user = User.find(params[:id])\n @cities = @user.cities\n render :index\n end",
"def index\n get_paginated_cities\n if @cities.to_json \n History.create(:name => 'Kota', :status => 'Completed')\n render json: @cities.to_json\n else\n History.create(:name => 'Kota', :status => 'Failed')\n end\n end",
"def index\n @state = State.find(params[:state_id])\n @cities = City.where(:state_id => params[:state_id]).paginate(:page => params[:page], :per_page => 10, :order => 'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cities }\n end\n end",
"def cities\n galleries.map do |gallery|\n gallery.city\n end\n #undefined method `city' for \"New York\":String\n end"
] | [
"0.7350134",
"0.7333397",
"0.7067631",
"0.7065568",
"0.68672746",
"0.68098557",
"0.67984647",
"0.6751429",
"0.6747969",
"0.6618983",
"0.6499412",
"0.6432094",
"0.6423962",
"0.6411681",
"0.6357759",
"0.634278",
"0.62999105",
"0.6293347",
"0.6292854",
"0.626926",
"0.62361985",
"0.6232503",
"0.6226957",
"0.6221416",
"0.6219626",
"0.6207247",
"0.6199186",
"0.6172965",
"0.6166889",
"0.61650217"
] | 0.7864492 | 0 |
POST /graphium/cities POST /graphium/cities.json | def create
@graphium_city = Graphium::City.new(graphium_city_params)
respond_to do |format|
if @graphium_city.save
format.html { redirect_to @graphium_city, notice: 'City was successfully created.' }
format.json { render :show, status: :created, location: @graphium_city }
else
format.html { render :new }
format.json { render json: @graphium_city.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end",
"def graphium_city_params\n params.require(:graphium_city).permit(:name, :state, :state_code, :country, :country_code, :population, :osm_node_id)\n end",
"def index\n @graphium_cities = Graphium::City.all\n end",
"def create\n @city = City.create(params[:city])\n get_data\n end",
"def index\n neo = Neography::Rest.new\n r = neo.execute_query(\"START n=node(*) RETURN n;\")\n r[\"data\"].shift # first node is wacky\n @cities = r[\"data\"].map { |node|\n OpenStruct.new(node[0][\"data\"].merge(id: node[0][\"self\"].match(/node\\/(\\d+)$/)[1].to_i))\n }\n end",
"def visit(city)\n marshaled_cities = Marshal.dump(cities + [city])\n IO.write(\"cities\", marshaled_cities)\n end",
"def create\n @city = City.new(city_params)\n\n if @city.save\n render json: @city, status: :created, location: @city\n # 'city model was successfully created.'\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end",
"def create\n @city = City.new(params[:city])\n @city.state_id = params[:state_id]\n \n respond_to do |format|\n if @city.save\n format.html { redirect_to country_state_cities_path, :notice => t('controller_message.inserted') }\n format.json { render :json => @city, :status => :created, :location => @city }\n else\n @state = State.find(params[:state_id])\n @country = Country.find(@state.country_id)\n format.html { render :action => \"new\" }\n format.json { render :json => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def store_all_cities(json_obj)\n cities = json_obj['metros'].each{ |city|\n timezone = city['timezone']\n country = city['country']\n name = city['name']\n code = city['code']\n population = city['population']\n continent = city['continent']\n coordinates = city['coordinates']\n region = city['region']\n linked_cities = []\n new_node = Node.new(code,name,country,continent,timezone,coordinates,population,region, linked_cities)\n node_hash[code] = new_node\n continent_hash[continent] << name\n }\n end",
"def create\n @sitecity = Sitecity.new(params[:sitecity])\n\n respond_to do |format|\n if @sitecity.save\n format.html { redirect_to @sitecity, notice: t(:sitecity_create_success) }\n format.json { render json: @sitecity, status: :created, location: @sitecity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitecity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cities=State.find_by_id(params[:body][:id]).cities.select(\"id, name\")\n render :json=>success1(:cities=>@cities)\n end",
"def create\n @city = City.new(params[:city])\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render json: @city, status: :created, location: @city }\n else\n format.html { render action: \"new\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cities\n cities = CS.cities(params[:id], :GB)\n if cities.blank?\n country = ISO3166::Country.find_country_by_alpha3(params[:id])\n cities = country_cites(country)\n return(render json: { message: I18n.t(:invalid_country) }) if cities.blank?\n end\n render json: cities\n end",
"def create\n @region = Region.find(params[:region_id])\n @city = @region.cities.create(city_params)\n\n respond_to do |format|\n if @city.save\n format.js { flash[:success] = \"#{@city.city_desc} added successfully\" }\n else\n format.js { render :new }\n end\n end\n end",
"def create\n @city = City.new(:name => city_params[:name].strip, :state_id => city_params[:state_id])\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render action: 'show', status: :created, location: @city }\n else\n format.html { render action: 'new' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_graphium_city\n @graphium_city = Graphium::City.find(params[:id])\n end",
"def create\n unless params[:country_id]\n @city = City.new(params[:city])\n @city.step=\"2\"\n state = State.find_by_id(params[:city][:state_id]) if params[:city][:state_id]\n @city.state = state\n if @city.save\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@city.errors)\n end\n end\n end",
"def create\n @city = City.new(city_params)\n # respond json: @city\n respond_to do |format|\n if @city.save\n format.html { redirect_to dashboard_index_path, notice: 'City was successfully created.' }\n format.json { render action: 'show', status: :created, location: @city }\n else\n format.html { render action: 'new' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city = City.new(city_params)\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city = City.new(city_params)\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city = City.new(city_params)\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n\nCity.create(\n name: params[:city][:name],\n population: params[:city][:population],\n best_food: params[:city][:best_food],\n image_url: params[:city][:image_url],\n must_see: params[:city][:must_see],\n image_url_see: params[:city][:image_url_see]\n)\n\nredirect_to cities_path\n\nend",
"def create\n @city = City.new(city_params)\n @city.use_for_api=@city.attributes.slice('name', 'city_id', 'lat', 'lng', 'zip_code').to_a.detect { |a| !a[1].blank? }[0]\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def populate\n json = params[:cities]\n cities = populate_database(json)\n cities.each{ |city|\n if(City.find_by_name(city.name).nil?)\n City.create({:name => city.name,:state => city.state,:lat => city.lat,:lng => city.lng,:link => api_city_url(city.name)})\n photos = get_images_url(city.lat,city.lng)\n photos.each{ |photo|\n #url_photo = photo['photo_file_url'].sub! 'http', 'https'\n CityImage.create({:url =>photo['photo_file_url'],:city_id => city.name})\n }\n end\n }\n render json: cities.to_json\n end",
"def create\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to(cities_path, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @city, :status => :created, :location => @city }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @world_city = WorldCity.new(world_city_params)\n\n respond_to do |format|\n if @world_city.save\n format.html { redirect_to @world_city, notice: 'World city was successfully created.' }\n format.json { render :show, status: :created, location: @world_city }\n else\n format.html { render :new }\n format.json { render json: @world_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city = City.new(city_params)\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n @page_title = 'New City'\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @locality = Locality.new(params[:locality])\n @provinces = Province.all\n\n respond_to do |format|\n if @locality.save\n format.html { redirect_to @locality, :notice => 'Locality was successfully created.' }\n format.json { render :json => @locality, :status => :created, :location => @locality }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @locality.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @country = Country.find_by_id(params[:city][:country_id])\n if !@country.nil?\n @region = @country.regions.find_by_id(params[:city][:region_id])\n if !@region.nil?\n @city = City.new(params[:city])\n else\n flash[:notice] = \"Region not found\"\n return redirect_to country_path(@country)\n end\n else\n flash[:notice] = \"Country not found\"\n return redirect_to countries_path\n end\n\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render json: @city, status: :created, location: @city }\n else\n format.html { render action: \"new\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.72843736",
"0.6981593",
"0.66361165",
"0.635568",
"0.63230383",
"0.6254943",
"0.60747796",
"0.60582554",
"0.6043469",
"0.599677",
"0.5981062",
"0.5971438",
"0.5939756",
"0.59395474",
"0.5933267",
"0.59171426",
"0.5915548",
"0.5906117",
"0.5881162",
"0.5881162",
"0.5881162",
"0.5857475",
"0.58512735",
"0.5784638",
"0.57739186",
"0.5756959",
"0.57410485",
"0.5741036",
"0.5686764",
"0.5681673"
] | 0.7155015 | 1 |
PATCH/PUT /graphium/cities/1 PATCH/PUT /graphium/cities/1.json | def update
respond_to do |format|
if @graphium_city.update(graphium_city_params)
format.html { redirect_to @graphium_city, notice: 'City was successfully updated.' }
format.json { render :show, status: :ok, location: @graphium_city }
else
format.html { render :edit }
format.json { render json: @graphium_city.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n if @city.update(city_params)\n render json: @city\n # 'city was successfully updated.'\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @city = City.find(params[:id])\n if @city.update_attributes(:name=>params[:body][:name],:step=>\"1\")\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@city.errors)\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @city = City.find(params[:id])\n @city.update_attributes(params[:city])\n get_data\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 # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end",
"def update\n respond_to do |format|\n \n if @city.update(:name => city_params[:name].strip, :state_id => city_params[:state_id])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to country_state_city_path, :notice => t('controller_message.updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to dashboard_index_path, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end",
"def update\n @city = City.find_by_id(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, notice: t(:city_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n cities = @video_marketing_campaign_form.cities.present? ? Geobase::Locality.joins(\"LEFT OUTER JOIN geobase_regions ON geobase_regions.id = geobase_localities.primary_region_id\").where(\"geobase_localities.id in (#{@video_marketing_campaign_form.cities.to_s.gsub(/(\\[|\\])|\"/, '')})\").order(\"geobase_regions.name ASC, geobase_localities.name ASC\") : []\n @cities_json = cities.map { |e| {id: e.id, text: \"#{e.name}, #{e.try(:primary_region).try(:code).try(:split, '<sep/>').try(:first).to_s.gsub('US-', '')}\"} }\n respond_to do |format|\n if @video_marketing_campaign_form.update(video_marketing_campaign_form_params)\n format.html { redirect_to @video_marketing_campaign_form, notice: 'Video marketing campaign form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video_marketing_campaign_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.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 @ge_city_api.update(ge_city_api_params)\n format.html { redirect_to @ge_city_api, notice: 'Ge city api was successfully updated.' }\n format.json { render :show, status: :ok, location: @ge_city_api }\n else\n format.html { render :edit }\n format.json { render json: @ge_city_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def update\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to(cities_path, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_geonode = Admin::Geonode.find(params[:id])\n\n respond_to do |format|\n if @admin_geonode.update_attributes(params[:admin_geonode])\n format.html { redirect_to @admin_geonode, notice: 'Geonode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_geonode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update\n put :update\n end"
] | [
"0.6442021",
"0.61399406",
"0.60396487",
"0.6007295",
"0.59603",
"0.5939284",
"0.59242314",
"0.5900325",
"0.5857155",
"0.5848182",
"0.58433634",
"0.5836922",
"0.58034754",
"0.57885444",
"0.578303",
"0.57777816",
"0.57711077",
"0.5769961",
"0.57688624",
"0.57521904",
"0.57385767",
"0.57368433",
"0.57328576",
"0.5711346",
"0.5711346",
"0.5704357",
"0.5696424",
"0.56940126",
"0.56834763",
"0.5668725"
] | 0.651353 | 0 |
DELETE /graphium/cities/1 DELETE /graphium/cities/1.json | def destroy
@graphium_city.destroy
respond_to do |format|
format.html { redirect_to graphium_cities_url, notice: 'City was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete path\n make_request(path, \"delete\", {})\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 delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n\n respond_to do |format|\n format.html { redirect_to country_state_cities_url, :notice => t('controller_message.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to cities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n\n head :no_content\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n\n respond_to do |format|\n format.html { redirect_to cities_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @sitecity = Sitecity.find_by_url(params[:id])\n @sitecity.destroy\n\n respond_to do |format|\n format.html { redirect_to sitecities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n\n respond_to do |format|\n format.html { redirect_to(countries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visit.destroy\n\n head :no_content\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n get_data\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @ge_city_api.destroy\n respond_to do |format|\n format.html { redirect_to ge_city_apis_url, notice: 'Ge city api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end",
"def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend"
] | [
"0.6828938",
"0.67404467",
"0.6609387",
"0.65831393",
"0.6540373",
"0.6499345",
"0.6491838",
"0.6472032",
"0.6430665",
"0.642744",
"0.641377",
"0.6393286",
"0.6391623",
"0.6378624",
"0.63537174",
"0.6353204",
"0.6331599",
"0.63308287",
"0.6330156",
"0.6270522",
"0.62668324",
"0.6263925",
"0.62561506",
"0.62561506",
"0.62561506",
"0.62561506",
"0.62559634",
"0.6255823",
"0.62451774",
"0.6241527"
] | 0.73883075 | 0 |
Link to kata: Description: Fix the function I created this function to add five to any number that was passed in to it and return the new value. It doesn't throw any errors but it returns the wrong number. Can you help me fix the function? Answer: | def addFive(num)
num + 5
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_five num\n num + 5\nend",
"def add_ten(number)\n number += 10\nend",
"def sum_3_5(number) \r\n\tsum3 = 0\r\n\tsum5 = 0\r\n\tsum15 = 0\r\n\t0.step(number-1,3) do |num|\r\n\t\tsum3 += num\r\n\tend\r\n\t0.step(number-1,5) do |num|\r\n\t\tsum5 += num\r\n\tend\r\n\t0.step(number-1,15) do |num|\r\n\t\tsum15 += (num)\r\n\tend\r\n\treturn sum3 + sum5 - sum15\r\nend",
"def add_numbers(input_number)\n $number += input_number\n return $number\nend",
"def multiply_by_five(n)\n n.to_i * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def multiply_by_five(n)\n n * 5\nend",
"def sum_of_fifth n\r\n n.to_s.split(\"\").map! {|i| (i.to_i)**5}.inject(:+)\r\nend",
"def number_adder(n)\n n += 10\nend",
"def add_up(num)\n return (1..num).inject(:+)\nend",
"def addFive(num=5)\n return 5 + num\nend",
"def multiply_by_five(n)\r\n n * 5\r\n end",
"def round_to_next_5(n)\n while n%5 != 0\n n+=1\n end\n return n\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend",
"def times_three_and_plus_five(number)\n number * 3 + 5\n end"
] | [
"0.76271623",
"0.70259476",
"0.70219594",
"0.6982283",
"0.69683284",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6938488",
"0.6888496",
"0.68528074",
"0.68372726",
"0.68290305",
"0.6823146",
"0.68139154",
"0.67745787",
"0.67745787",
"0.67745787",
"0.67745787",
"0.67745787",
"0.67745787",
"0.67745787",
"0.67745787",
"0.66956985"
] | 0.76390034 | 0 |
GET /productors GET /productors.json | def index
@productors = Productor.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def products\n request :public, :get, :products\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @product }\n end\n end",
"def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end",
"def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def show\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end",
"def show\n render json: @product\n end",
"def products\n run(:get,\"/school_products\", [200])\n end",
"def index\n \tproducts = Product.all\n \trender json: products\n \tend",
"def show\n render json: @product\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 index\n @products = Product.all\n @users = Product.find(:all)\n #--------amazon cloud search-----------------------------------------------------------\n #searcher = CloudSearch::Searcher.new\n #@resp = searcher.with_fields(:id, :actor, :director, :title, :year, :text_relevance)\n # .with_query(\"star wars\")\n # .search\n #--------------------------------------------------------------------------------------\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n format.xml { render :xml => @products }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def show\n @product = Product.find(params[:id])\n json_response(params)\n end",
"def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end",
"def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end",
"def show\n render json: @product, status: 200\n end",
"def index\n render :json => Producto.all\n end",
"def index\n if current_user.admin?\n @products = Product.all\n else\n if current_user.private?\n @products = Product.where(owner_id: current_user.private_id)\n elsif current_user.business?\n @products = Product.where(owner_id: current_user.business_id)\n end\n\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @product_owner = ProductOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_owner }\n end\n end",
"def show\n @product = Product.find(params[:id])\n @donor = Donor.all\n @event = Event.all\n @category = Category.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = @user.products.find(params[:id])\n # was @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @productonegocio }\n end\n end",
"def show\n render :json => Producto.find(params[:id])\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @products = Product.where(:supplier_id => @supplier.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @supplier }\n end\n end",
"def index\n @produtors = Produtor.all\n end"
] | [
"0.6741463",
"0.67171097",
"0.671549",
"0.6692232",
"0.6658295",
"0.6645084",
"0.6617059",
"0.65588254",
"0.65062225",
"0.63921005",
"0.6380967",
"0.63795066",
"0.63716406",
"0.6369781",
"0.63629127",
"0.63590723",
"0.6352903",
"0.6352829",
"0.63419574",
"0.6332381",
"0.6330889",
"0.6325905",
"0.6320308",
"0.6308383",
"0.6301289",
"0.6300187",
"0.6297863",
"0.6280767",
"0.62799627",
"0.626767"
] | 0.724601 | 0 |
POST /productors POST /productors.json | def create
@productor = Productor.new(productor_params)
respond_to do |format|
if @productor.save
format.html { redirect_to @productor, notice: 'Productor was successfully created.' }
format.json { render :show, status: :created, location: @productor }
else
format.html { render :new }
format.json { render json: @productor.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n price: product[:price],\n desc: product[:desc])\n if !@product.save\n render json: @product.errors.full_messages, status: 422\n end\n end\n render 'api/products/index'\n else\n @product = Product.new(product_params)\n if @product.save\n render 'api/products/show'\n else\n render json: @product.errors.full_messages, status: 422\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n \n @orden_product = OrdenProduct.new(orden_product_params)\n \n respond_to do |format|\n if @orden_product.save\n format.html { redirect_to @orden_product, notice: 'Orden product was successfully created.' }\n format.json { render :show, status: :created, location: @orden_product }\n else\n format.html { render :new }\n format.json { render json: @orden_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.user = current_api_v1_user\n respond_to do |format|\n if @product.save\n params[:product][:properties].try(:each) do |k,v|\n @product.product_properties.create(property: Property.find(k), value: v)\n end\n params[:product][:colors].try(:each) do |c|\n @product.colors.create(name: c[:name].downcase, code: c[:code])\n end\n params[:product][:photos].try(:each) do |c|\n @product.photos.create(image: c)\n end\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = @person.products.build(params[:model])\n\n respond_to do |format|\n if @product.save\n format.json { render :json => @product, :status => :created}\n else\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.new(product_params)\n if product.save\n render json: ProductSerializer.new(product).serialized_json\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n @manufacturers = Manufacturer.all\n @categories = Category.all\n respond_to do |format|\n if @product.save\n \n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @productonegocio = Productonegocio.new(params[:productonegocio])\n\n respond_to do |format|\n if @productonegocio.save\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully created.' }\n format.json { render json: @productonegocio, status: :created, location: @productonegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_owner = ProductOwner.new(params[:product_owner])\n\n respond_to do |format|\n if @product_owner.save\n format.html { redirect_to @product_owner, notice: 'Product owner was successfully created.' }\n format.json { render json: @product_owner, status: :created, location: @product_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = current_user.products.new(name: product_params[:name],description:product_params[:description],price:product_params[:price])\n @product.brand = Brand.find_by(brandName: product_params[:brand])\n @product.categories = Category.where(category:product_params[:category])\n respond_to do |format|\n if @product.save \n format.html { redirect_to new_product_location_path(@product), notice: \"Product was successfully created.\"}\n format.json { render json: @product}\n \n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return unless product_params\n render json: Product.create_product(\n @product_params,\n category_list,\n @current_user.id\n ).simple_info, status: :created\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def create\n @product_owner = ProductOwner.new(product_owner_params)\n\n respond_to do |format|\n if @product_owner.save\n format.html { redirect_to @product_owner, notice: 'Product owner was successfully created.' }\n format.json { render :show, status: :created, location: @product_owner }\n else\n format.html { render :new }\n format.json { render json: @product_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produtor = Produtor.new(produtor_params)\n\n respond_to do |format|\n if @produtor.save\n format.html { redirect_to @produtor, notice: 'Produtor was successfully created.' }\n format.json { render :show, status: :created, location: @produtor }\n else\n format.html { render :new }\n format.json { render json: @produtor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n if @product.save\n render json: {id: @product.id}\n else\n render json: {msg: @product.errors.full_messages.first}, status: :unprocessable_entity\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 create\n newProduct = Product.new(products_params)\n if newProduct.save\n msg = { status: 201 , product: newProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end",
"def create\n @product = current_user.products.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.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 @product = current_vendor.vendor_products.new(vendor_product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to vendor_products_url, notice: 'product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = @productable.products.find(params[:product_id])\n ids = params[:products]\n reals = @productable.products.map(&:id) # Make a lambda with this\n present_prod = ids.select { |n| reals.include?(n) } # And this\n if @product.update(product_relations: present_prod)\n render json: @product, status: 200\n else\n render json: @product.errors, status: 422\n end\n end",
"def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n current_user.user_info.products.push @product\n Shopify.create @product\n format.html { redirect_to :action => 'index' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n #@product = Product.create(vendor_id: @vendor.id)\n #@vendor = Vendor.all\n #@product = @vendor.products.create(product_date :Time.now, vendor_id: @vendor.id)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end",
"def create\n @product = current_user.products.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6713027",
"0.6615665",
"0.65932584",
"0.65732664",
"0.6542138",
"0.6514128",
"0.6510743",
"0.6489597",
"0.64563674",
"0.6453787",
"0.64093566",
"0.6408194",
"0.637801",
"0.63757545",
"0.63692707",
"0.6295044",
"0.62853426",
"0.6271232",
"0.6265685",
"0.62552404",
"0.62497705",
"0.6225839",
"0.6207268",
"0.6206341",
"0.61838675",
"0.6175494",
"0.6174121",
"0.61680895",
"0.6161545",
"0.6149875"
] | 0.69069326 | 0 |
Returns Allows us to get individual returns from the API | def returns(periodKey)
self.class.get(url("returns", periodKey), headers: @headers )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returns\n parsed {\n @returns\n }\n end",
"def find_returns\n\t\tbus = Bus.find(params[:bus_id])\n\t\t@return_buses = bus.find_returns(params[:dep_id] == '0' ? true : false).select{|rb| (!rb.maximum_seats || rb.available_tickets(params[:dep_id] == '0' ? 'to_waterloo' : 'from_waterloo') > 0) && rb.date == params[:ret_date].to_date}.collect{|rb| [(params[:dep_id] != '0' ? 'UW Campus' : rb.destination.name) + ', ' + ((params[:dep_id] == '0') ? rb.arrive_time.strftime(\"%k:%M\") : rb.depart_time.strftime(\"%k:%M\")), rb.id]}\n\n\t\trender :partial => \"tickets/buying5\"\n\tend",
"def returned(options = {})\n options = { returned_date: Date.current }.merge(options)\n request_params = {\n 'orderID' => order_id,\n 'cartItems' => { 'CartItem' => cart_items.map(&:to_hash) },\n 'returnedDate' => xml_date(options[:returned_date])\n }\n\n response = TaxCloud.client.request :returned, request_params\n TaxCloud::Responses::Returned.parse response\n end",
"def find_vat_returns_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VatReturnApi.find_vat_returns ...'\n end\n # resource path\n local_var_path = '/vat_returns'\n\n # query parameters\n query_params = {}\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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 = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<VatReturn>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VatReturnApi#find_vat_returns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def results\n response['data']\n end",
"def returned(options = {})\n options = { :returned_date => Date.today }.merge(options)\n request_params = {\n 'orderID' => order_id,\n 'cartItems' => { 'CartItem' => cart_items.map(&:to_hash) },\n 'returnedDate' => options[:returned_date]\n }.merge(TaxCloud.auth_params)\n\n TaxCloud.client.request :returned, :body => request_params\n end",
"def results\n return error if error?\n return response if response?\n end",
"def fetch\n fetch_response.results\n end",
"def return_all\n market_details = return_names.collect do |value|\n url = URI.parse \"http://search.ams.usda.gov/farmersmarkets/v1/data.svc/mktDetail?id=#{value['id']}\"\n result = JSON.parse(Net::HTTP.get(url) )\n value = value.merge(result.delete('marketdetails'))\n value\n end\n market_details\n end",
"def new_order_returns\n record.new_order_returns\n end",
"def index\n @gst_returns = GstReturn.all\n end",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend"
] | [
"0.69270486",
"0.65126646",
"0.6433455",
"0.6315461",
"0.6242207",
"0.6183215",
"0.61437607",
"0.60923105",
"0.6080625",
"0.6005776",
"0.5913505",
"0.5892927",
"0.58929265",
"0.58929265",
"0.58929265",
"0.58929265",
"0.58929265",
"0.58929265",
"0.58929265",
"0.58929265",
"0.5892831",
"0.5892831",
"0.5892831",
"0.5892831",
"0.5892831",
"0.5891673",
"0.5891673",
"0.5891673",
"0.5891673",
"0.5891673"
] | 0.7180429 | 0 |
this determines the reading order from the stub_object_type (default ltr unless the object type contains one of the possible "rtl" designations) | def book_reading_order
return 'right-to-left' if stub_object_type.include?('rtl') || stub_object_type.include?('r-l')
'left-to-right'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_order = locale_info(:layout, :orientation, :line_order)",
"def text_direction\n I18n.translate(:'bidi.direction') == 'right-to-left' ? 'rtl' : 'ltr'\n # in ../locale/he.yml add\n # he:\n #bidi:\n #direction: right-to-left\n # then in ../locale/root.yml add\n # root:\n #bidi:\n # direction: left-to-right\n end",
"def text_direction\n I18n.translate(:'bidi.direction') == 'right-to-left' ? 'rtl' : 'ltr'\n # in ../locale/he.yml add\n # he:\n #bidi:\n #direction: right-to-left\n # then in ../locale/root.yml add\n # root:\n #bidi:\n # direction: left-to-right\n end",
"def language_direction\n \"ltr\"\n end",
"def direction\n # For future reference\n # Hebrew - U+05D0 to U+05EA, U+05F0 to U+05F2, U+05BE, U+05C0, U+05C3, U+05F3, U+05F4, U+05B0 to U+05C4, U+0591 to U+05AF.\n # Arabic - U+0600 to U+06FF, U+0750 to U+077F, U+FB50 to U+FDFF, U+FE70 to U+FEFF, U+10E60 to U+10E7F.\n # ltrChars = 'A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF'+'\\u2C00-\\uFB1C\\uFDFE-\\uFE6F\\uFEFD-\\uFFFF',\n # rtlChars = '\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC',\n\n dir = options[:font][:direction]\n if dir == :auto\n if /[\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC]/.match(text_content)\n 'right-to-left'\n else\n 'left-to-right'\n end\n else\n dir\n end\n end",
"def polarity\n ORDERING[@direction] || ORDERING[:asc]\n end",
"def rtl?\n t(\"site.direction\", :default => \"ltr\") == \"rtl\"\n end",
"def guess_byte_order\n # Assume native, since we don't know what type of file we have.\n :native\n end",
"def character_order = locale_info(:layout, :orientation, :character_order)",
"def text_direction_css\n rtl_languages = [:he]\n if rtl_languages.include?(I18n.locale.to_sym)\n 'direction-rtl'\n else\n 'direction-ltr'\n end\n end",
"def directionality\n return @directionality\n end",
"def fallback_sort_order(direction)\n \"#{resource_handler.model.table_name}.id #{direction}\"\n end",
"def bit_order\n @bit_order ||= parent.respond_to?(:bit_order) ? parent.bit_order : :lsb0\n end",
"def text_direction\n I18n.t(\"languages.#{locale}.direction\", default: 'ltr')\n end",
"def default_ordering(field_name)\n case field_name\n when \"status\"; return(\"ascending\")\n when \"from\"; return(\"ascending\")\n when \"subject\"; return(\"ascending\")\n when \"date\"; return(\"descending\")\n end \n end",
"def page_progression_direction(val)\n raise assert unless ['rtl', 'ltr', 'default'].member? val\n @book.page_progression_direction = val\n end",
"def detect_standard_refmode_readings fact_type, entity_role, value_role\n forward_reading = reverse_reading = nil\n fact_type.all_reading.each do |reading|\n if reading.text =~ /^\\{(\\d)\\} has \\{\\d\\}$/\n if reading.role_sequence.all_role_ref.detect{|rr| rr.ordinal == $1.to_i}.role == entity_role\n forward_reading = reading\n else\n reverse_reading = reading\n end\n elsif reading.text =~ /^\\{(\\d)\\} is of \\{\\d\\}$/\n if reading.role_sequence.all_role_ref.detect{|rr| rr.ordinal == $1.to_i}.role == value_role\n reverse_reading = reading\n else\n forward_reading = reading\n end\n end\n end\n trace :mode, \"Didn't find standard forward reading\" unless forward_reading\n trace :mode, \"Didn't find standard reverse reading\" unless reverse_reading\n [forward_reading, reverse_reading]\n end",
"def ol_depth(node)\n depth = node.ancestors(\"ul, ol\").size + 1\n type = :alphabet\n type = :arabic if [2, 7].include? depth\n type = :roman if [3, 8].include? depth\n type = :alphabet_upper if [4, 9].include? depth\n type = :roman_upper if [5, 10].include? depth\n ol_style(type)\n end",
"def modo_ord!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n\n\n type = ModoOrd\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 453:3: ( 'asc' | 'desc' )\n # at line 453:3: ( 'asc' | 'desc' )\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == 0x61 )\n alt_15 = 1\n elsif ( look_15_0 == 0x64 )\n alt_15 = 2\n else\n raise NoViableAlternative( \"\", 15, 0 )\n\n end\n case alt_15\n when 1\n # at line 453:4: 'asc'\n match( \"asc\" )\n\n\n when 2\n # at line 453:10: 'desc'\n match( \"desc\" )\n\n\n end\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__, 50 )\n\n\n end",
"def bit_order\n @bit_order ||= if parent\n parent.bit_order\n else\n :lsb0\n end\n end",
"def direction_for_solr\n DIRECTIONS[@direction] || \n raise(\n ArgumentError,\n \"Unknown sort direction #{@direction}. Acceptable input is: #{DIRECTIONS.keys.map { |input| input.inspect } * ', '}\"\n )\n end",
"def directionality=(value)\n @directionality = value\n end",
"def is_rtl_locale\n I18n.locale.to_s.eql?(\"he\")\n end",
"def sort_direction\n params[\"order\"][\"0\"][\"dir\"] == \"desc\" ? \"desc\" : \"asc\"\n end",
"def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_table_def\n WHERE tablename in (#{tables_for_sql})\n GROUP BY tablename\n SQLT\n RailsRedshiftReplicator.connection.exec(sql.squish).entries\n end\n end",
"def list_type\n case @node.name\n when 'ol' then :ordered\n when 'ul' then :unordered\n end\n end",
"def original_order\n end",
"def normalize_order!\n @order = @order.map do |order_by|\n case order_by\n when Direction\n order_by\n when Property\n # TODO: if the property's resource doesn't match\n # self.resource, append the property's resource to @links\n # eg:\n #if property.resource != self.resource\n # @links << discover_path_for_property(property)\n #end\n\n Direction.new(order_by)\n when Symbol, String\n Direction.new(@properties[order_by])\n else\n raise ArgumentError, \"Order #{order_by.inspect} not supported\"\n end\n end\n end",
"def line_order\n [:controller_files, :model_files, :view_files, :lib_files, :controller_specs, :model_specs, :view_specs]\n end",
"def <=>(object)\n return -1 if object.language.nil?\n # Put Chinese when sorting\n return -1 if object.language.code == 'chi'\n return 1 if object.language.code == 'eng'\n return self.name <=> object.name\n end"
] | [
"0.526763",
"0.52128154",
"0.52128154",
"0.51135576",
"0.50958973",
"0.5048924",
"0.49184984",
"0.4907119",
"0.48280075",
"0.47610536",
"0.47595844",
"0.4753641",
"0.47307527",
"0.4727238",
"0.4699162",
"0.46970668",
"0.46337548",
"0.4633393",
"0.46326482",
"0.46310407",
"0.46213794",
"0.46093085",
"0.4604951",
"0.45762008",
"0.45712945",
"0.4554964",
"0.4553219",
"0.45480022",
"0.4524421",
"0.45019838"
] | 0.7757093 | 0 |
GET /investments GET /investments.json | def index
@investments = Investment.all
respond_to do |format|
format.html
format.json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end",
"def show\n render json: @investment, root: false\n end",
"def index\n @investables = Investable.all\n end",
"def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end",
"def index\n @investments = Investment.all.paginate(:page => params[:page], :per_page => 30)\n end",
"def index\n @investigations = Investigation.all\n end",
"def index\n @investment_funds = InvestmentFund.all\n end",
"def show\n @investment = Investment.find(params[:id])\n end",
"def show\n @investigation = Investigation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @investigation }\n end\n end",
"def show\n @investment_type = InvestmentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @investment_type }\n end\n end",
"def index\n @investors = params[:q].present? ? Investor.search(params[:q]) : Investor.all\n @investors = @investors.includes(:investment_group, :consultant).ordered.\n page(params[:page]).references(:investment_group, :consultant)\n end",
"def index\n @investigadores = Investigador.all\n end",
"def index\n @individual_company_investments = IndividualCompanyInvestment.all\n end",
"def index\r\n @fixed_deposit_investments = FixedDepositInvestment.all\r\n end",
"def index\n @wallet_id = params[:wallet_id]\n @investment_funds = InvestmentFund.where(\"wallet_id = ?\", @wallet_id)\n end",
"def create\n @investment = Investment.new(investment_params)\n\n if @investment.save\n render json: @investment, status: :created\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end",
"def index\n @fund_company_investments = FundCompanyInvestment.all\n end",
"def show\n @player_investment = PlayerInvestment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_investment }\n end\n end",
"def show\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invest }\n end\n end",
"def index\n @investigaciones = Investigacion.search.page params[:page]\n end",
"def index \n\n\n @investigateds = Investigated.all\n total_count = @investigateds.count\n respond_to do |format|\n format.html { }\n format.json { render json: { total: total_count, investigateds: @investigateds.map { |s| {id: s.id, name: s.name, lastname1: s.lastname1 } } } }\n end\n end",
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def new\n @investigation = Investigation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investigation }\n end\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def index\n @investments = Investment.all\n @user=User.find(session[:user_id])\n puts \"the user id is #{@user.id}\"\n @investment=@user.investments.first\n #puts \"the investment id is #{@investment.id}\"\n #puts \"this is id #{@user.id}\"\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end"
] | [
"0.7938945",
"0.7190257",
"0.71611875",
"0.6985033",
"0.69051164",
"0.6877576",
"0.68006974",
"0.67372435",
"0.66845745",
"0.6632461",
"0.6598962",
"0.6554188",
"0.6550055",
"0.6512522",
"0.6326754",
"0.6315476",
"0.6315378",
"0.6278007",
"0.62501585",
"0.62358487",
"0.6231864",
"0.6149841",
"0.6149087",
"0.6141594",
"0.6141594",
"0.6141594",
"0.6141594",
"0.6141594",
"0.6125379",
"0.6101372"
] | 0.8015847 | 0 |
Record has a fixed barcode length | def shift_barcode_length
return unless record.barcode_length
shift_fixed_length(record.barcode_length)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n barcode.two_dimensional? ? encoding.first.length : encoding.length\n end",
"def length\n barcode.two_dimensional? ? encoding.first.length : encoding.length\n end",
"def barcode\n str_order = order.id.to_s.rjust(5, '0')\n str_cardinality = 1.to_s.rjust(3, '0')\n str_order + str_cardinality\n end",
"def barcode(length: 8, bits: 10)\n rand(bits**length).to_s(bits).rjust(length, '0')\n end",
"def is_corrected_barcode?(barcode_id, is)\n is != barcode_id && is.length != 4 && is.length != 8\n end",
"def trailer_arquivo_posicao_394_a_400(sequencial)\n\t\t\t\t\t\t\"#{sequencial}\".adjust_size_to(6, '0', :right)\n\t\t\t\t\tend",
"def width\n barcode.encoding.length * xdim\n end",
"def data520\n max_length = 1879\n @thesis.abstract&.each_line do |line|\n # skip any blank lines. Mostly if multiple linebreaks were added to the text.\n next if line.strip.empty?\n\n # if the line length is valid for 520, add it\n if line.length < max_length\n @record.append(MARC::DataField.new(\n '520', '3', ' ',\n ['a', line.encode(options: :xml).strip]\n ))\n # split lines that remain too long into valid size strings\n else\n part = line.chars.to_a.each_slice(max_length).map(&:join)\n part.each do |part_line|\n @record.append(MARC::DataField.new(\n '520', '3', ' ',\n ['a', part_line.encode(options: :xml).strip]\n ))\n end\n end\n end\n end",
"def barcode\n return if not_registered\n barcode_string.to_i(2)\n end",
"def pad_length\n offset = (lp_value_name.abs_offset + lp_value_name.to_binary_s.length) % 4\n (4 - offset) % 4\n end",
"def paper_white_area() barcode_bit_area -1 end",
"def pad_record(text_line)\n flow_type = Inflector.underscore(self.class.to_s).split(\"_\")[0].upcase()\n record_type = text_line.slice(0..1).upcase()\n\n\n #remove x-tra spaces to right, i.e where the passed in text-line > schema required length\n if text_line.length() > RecordPadder.required_record_length(flow_type, record_type, text_line.length)\n text_line.slice!(RecordPadder.required_record_length(flow_type, record_type, text_line.length)..text_line.length())\n return text_line\n else\n text_line.ljust(RecordPadder.required_record_length(flow_type, record_type, text_line.length))\n\n end\n\n\n\n end",
"def byte_size(); @data.byte_size + 4; end",
"def barcode\n \"*#{identifier}*\"\n end",
"def illumina_barcode\n self.barcode_type == :illumina ? self.barcode : \"\"\n end",
"def data_length\n super\n end",
"def current_length; end",
"def length_override; end",
"def pad_length\n offset = (lp_data.abs_offset + lp_data.to_binary_s.length) % 4\n (4 - offset) % 4\n end",
"def genbank\n chars = 60\n lines = (length / chars.to_f).ceil\n width = length.to_s.length\n\n s = ''\n (1..lines).each do |i|\n s << \"%#{width}d\" % (chars * (i - 1) + 1)\n s << ' '\n s << to_s[chars * (i - 1), chars].scan(/\\w{1,10}/).join(' ')\n s << \"\\n\"\n end\n s\n end",
"def valid_length?\n specification && specification['length'] - 4 == @code.length\n end",
"def name_record_long(type, ext_ref) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x002a # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x001a # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n\n unknown03 = 0x29\n unknown04 = 0x0017\n unknown05 = 0x3b\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n\n # Column definition\n data += [unknown03].pack(\"C\")\n data += [unknown04].pack(\"v\")\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [0x0000].pack(\"v\")\n data += [0xffff].pack(\"v\")\n data += [@col_min].pack(\"v\")\n data += [@col_max].pack(\"v\")\n\n # Row definition\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [@row_min].pack(\"v\")\n data += [@row_max].pack(\"v\")\n data += [0x00].pack(\"v\")\n data += [0xff].pack(\"v\")\n # End of data\n data += [0x10].pack(\"C\")\n\n [header, data]\n end",
"def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end",
"def custom_barcode\n self.barcode_type == :custom ? self.barcode : \"\"\n end",
"def header_length() 3 end",
"def write_multi_debug code_length\n result = ['4A000004 00000001'] # start at quantity 1\n\n write_amount = zero_pad_int(code_length, 3)\n result + [\"4#{write_amount}0010 00000001\"] # increase by 1\n end",
"def length() end",
"def length() end",
"def length() end",
"def length() end"
] | [
"0.6568643",
"0.6568643",
"0.6193347",
"0.6172301",
"0.60400975",
"0.60082644",
"0.598168",
"0.5893825",
"0.5878259",
"0.57244277",
"0.5696949",
"0.56375873",
"0.56272346",
"0.56210715",
"0.5613167",
"0.55780613",
"0.5565064",
"0.55514145",
"0.55440646",
"0.5540473",
"0.551721",
"0.55153537",
"0.5514645",
"0.5408946",
"0.5386355",
"0.53793395",
"0.53787494",
"0.53787494",
"0.53787494",
"0.53787494"
] | 0.7220451 | 0 |
Determines the public IP address of the running AWS instance | def determine_public_ip
# 169.254.169.254 is the address of the AWS instance metadata service
# See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
`curl --silent -XGET http://169.254.169.254/latest/meta-data/public-ipv4`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_aws_ip(n)\n if node['analytics-cluster']['aws']['use_private_ip_for_ssh']\n n['ec2']['local_ipv4']\n else\n n['ec2']['public_ipv4']\n end\n end",
"def get_aws_ip(n)\n if node['delivery-cluster']['aws']['use_private_ip_for_ssh']\n n['ec2']['local_ipv4']\n else\n n['ec2']['public_ipv4']\n end\n end",
"def public_ip\n @public_ip ||= ssh.exec!(\"curl -s ip.appspot.com\").chomp\n end",
"def get_public_ip\n case host_hash[:hypervisor]\n when /^(ec2|openstack)$/\n if self[:hypervisor] == 'ec2' && self[:instance]\n return self[:instance].ip_address\n elsif self[:hypervisor] == 'openstack' && self[:ip]\n return self[:ip]\n elsif self.instance_of?(Windows::Host)\n # In the case of using ec2 instances with the --no-provision flag, the ec2\n # instance object does not exist and we should just use the curl endpoint\n # specified here:\n # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html\n execute(\"wget http://169.254.169.254/latest/meta-data/public-ipv4\").strip\n else\n execute(\"curl http://169.254.169.254/latest/meta-data/public-ipv4\").strip\n end\n end\n end",
"def get_access_ip\n if @aws_instance_data.public_ip_address\n return @aws_instance_data.public_ip_address\n end\n\n @aws_instance_data.private_ip_address\n end",
"def public_ip_address\n public_ip_addresses.first\n end",
"def public_ipv4\n return ec2_meta_data('public-ipv4')\n end",
"def public_ip\n get('tools/public_ip').body['ipv4'] || get('tools/public_ip').body['ipv6']\n end",
"def public_ip_of(server)\n server[:cloud][:public_ips].first rescue server[:ipaddress]\n end",
"def public_ip_address\n data[:public_ip_address]\n end",
"def ipaddress(node)\n @use_private_ip_for_ssh ? node['ec2']['local_ipv4'] : node['ec2']['public_ipv4']\n end",
"def public_ip() ; info[:public_ip] ; end",
"def public_ip\n # For AWS and OpenStack, the elastic IP is the public IP\n # For vSphere and vCloud, the static_ip is the public IP\n @spec['properties']['vip'] || static_ip\n end",
"def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end",
"def get_public_ip()\n return open('http://ipinfo.io/ip').read.chomp\n end",
"def aws_get_ip (method = :internal, type = :public)\n # allowed methods: :internal (check meta-data inside VM), :aws (ask API)\n # allowed types: :public, :private\n self.aws_describe_instance\n\n if method.equal?(:internal)\n key = type.equal?(:public) ? 'public-ipv4' : 'local-ipv4'\n murl = sprintf('http://169.254.169.254/latest/meta-data/%s', key)\n result = self.aws_get_url(murl)\n else\n key = type.equal?(:public) ? 'ipAddress' : 'privateIpAddress'\n result = @instance_data[key]\n end\n\n result\n end",
"def acquire_ip_address\n unless public_ip = provider.provision_public_ip_address(vpc: vpc?)\n say \"Unable to acquire a public IP. Please check your account for capacity or service issues.\".red\n exit 1\n end\n public_ip\n end",
"def get_public_ip_address\n get_proxy.get_public_ip_address\n end",
"def hostip\n static_network_config[\"ipAddress\"]\n end",
"def address(public_ip)\n addresses(public_ip)[0]\n end",
"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 public_ip_v4_address; end",
"def private_ip_address\n private_ip_addresses.first\n end",
"def aws_instance_elastic_ip_get(opts)\n opts[:instance].elastic_ip\n end",
"def get_ip_address(machine)\n ip = nil\n unless @rs.ignore_private_ip\n machine.config.vm.networks.each do |network|\n key, options = network[0], network[1]\n ip = options[:ip] if key == :private_network\n next if ip\n end\n end\n\n ip || machine.ssh_info[:host]\n end",
"def associate_public_ip(c)\n associate_address_with(Application.public_ip, @instance_id) if master? && Application.public_ip && !Application.public_ip.empty?\n end",
"def local_ipv4\n return ec2_meta_data('local-ipv4')\n end",
"def public_ipv4\n local_ipv4 - localhost_ipv4\n end",
"def instance_external_ip(instance_id)\n return nil unless instance_id && !instance_id.empty?\n capistrano.logger.info(\"Getting Vagrant instance external IP\")\n get_ips_cmd = \"'ifconfig | awk \\\"/inet addr/{print substr(\\\\$2,6)}\\\"'\"\n run_vagrant_command('ssh', instance_id, \"-c #{get_ips_cmd} 2> /dev/null\") do |ips|\n ips = ips.split(/\\r?\\n/) # split on CRLF or LF\n if ips.empty?\n capistrano.logger.error(\"Unable to retrieve IP addresses from Vagrant instance\")\n nil\n else\n original_ips = ips.dup\n ips.delete_if { |x| /^127\\./.match(x) } # Delete the loopback address\n ips.delete_if { |x| /^192\\.168\\.12/.match(x) } # Delete the internally assigned Vagrant address: 192.168.12X.X\n if ips.empty?\n capistrano.logger.error(\"Vagrant instance doesn't appear to have an external IP address. IPs found are: #{original_ips.join(', ')}\")\n nil\n else\n capistrano.logger.info(\"The vagrant instance 'external' IP is #{ips.first}\")\n ips.first\n end\n end\n end\n end",
"def ip\n TestLab::Utility.ip(self.address)\n end"
] | [
"0.8188898",
"0.80910486",
"0.80247253",
"0.80016977",
"0.79642713",
"0.7935058",
"0.77813494",
"0.77796614",
"0.7759515",
"0.7752921",
"0.77118146",
"0.7660461",
"0.7611136",
"0.7594755",
"0.7531203",
"0.7402093",
"0.7347458",
"0.72919375",
"0.7099349",
"0.70677626",
"0.70609796",
"0.69843256",
"0.6943913",
"0.6894272",
"0.686945",
"0.6865772",
"0.6837803",
"0.6818086",
"0.679372",
"0.6773826"
] | 0.9010124 | 0 |
Add host in the specified groups. ==== Attributes +host+ Hostname +groups+ Groups to assign ==== Examples add_groups('pa2web01', ['local', 'web']) add_groups('pa2sql01', ['local', 'mysql', 'heartbeat']) | def add_groups(host, groups=[])
for group in groups
if !GROUPS.key?(group) then
GROUPS[group] = []
end
GROUPS[group].push(host)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_groups(params = {})\n post(\"/groups\", params)\n end",
"def hostgroup_add_member(hostnames: nil, params: {})\n raise ArgumentError, 'Hostnames is required' unless hostnames\n\n params[:all] = true\n\n params[:host] = hostnames if hostnames.kind_of?(Array)\n params[:host] = [hostnames] if hostnames.kind_of?(String)\n\n api_post(method: 'hostgroup_add_member', item: @hostgroup, params: params)\n end",
"def add_group(*args)\n end",
"def add_host(data)\n result = @client.api_request(\n :method => \"hostgroup.massAdd\", \n :params => {\n :groups => [{:groupid => data[:groupid]}],\n :hosts => data[:hostids].map { |h| {:hostid => h} }\n }\n )\n result ? result['groupids'][0].to_i : nil\n end",
"def add_group(group, gid=nil)\n\t\t\tend",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def add_group( group )\n type_check( group, Elements::Group )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @groups[group.name] = group\n end",
"def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend",
"def add(group, name)\n if group.nil? or group.empty? or name.nil? or name.empty?\n raise MuError, \"Ansible::Inventory.add requires both a host group string and a name\"\n end\n lock\n read\n @inv[group] ||= []\n @inv[group] << name\n @inv[group].uniq!\n save!\n unlock\n end",
"def add_hosts_group\n puppet_ip = any_hosts_as?(:loadbalancer) ? loadbalancer.ip : master.ip\n hosts_group = {\n \"name\" => \"Clamps Managed Hosts\",\n \"rule\" => [\"or\", [\"=\", %w[fact id], \"root\"]],\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"hosts\" => {\n \"purge_hosts\" => false,\n \"collect_all\" => true,\n \"host_entries\" => {\n \"puppet\" => { \"ip\" => puppet_ip }\n }\n }\n }\n }\n\n dispatcher.find_or_create_node_group_model(hosts_group)\nend",
"def hostgroup_add(description: nil, all: false, params: {})\n raise ArgumentError, 'description is required' unless description\n\n params[:all] = all\n params[:description] = description\n\n api_post(method: 'hostgroup_add', item: @hostgroup, params: params)\n end",
"def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end",
"def add_group(name)\n unless group_exists?(name)\n self.groups.create(:name => name)\n else\n raise GroupAlreadyExists, \"The group '\" + name + \"' already exists.\"\n end\n end",
"def add_group(groupname, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{groupname}\\\"\", 'destructive') {\n\t\t\t\t\t`/usr/bin/niutil -create . /groups/#{groupname}`\n\n\t\t\t\t\tnewgroupid = gid\n\t\t\t\t\tif(newgroupid == nil)\n\t\t\t\t\t\tlastgid = `/usr/bin/nidump group . | /usr/bin/cut -d: -f3 | /usr/bin/sort -n | /usr/bin/tail -n 1`\n\t\t\t\t\t\tnewgroupid = lastgid.to_i() + 1\n\t\t\t\t\tend\t\t\t\t\n\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} gid #{newgroupid}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} users`\n\t\t\t\t}\n\t\t\tend",
"def add_user_to_groups(user, groups)\n user_groups_operation(user, groups, :add)\n end",
"def add_group( group )\n raise TypeError.new('not a group') unless group.is_a?(Ecore::Group)\n tmp_group_ids = self.group_ids.split(',')\n tmp_group_ids.delete(group.id)\n tmp_group_ids << group.id\n self.group_ids = tmp_group_ids.join(',')\n true\n end",
"def add_group(user)\n cmd_args = [\"'#{user.group}'\"]\n cmd_args.unshift '--system' if user.is_system\n\n groupadd_args = cmd_args.join \"\\s\"\n groupmod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupmod #{groupmod_args}\n else\n /usr/sbin/groupadd #{groupadd_args}\n fi\n HERE\n end",
"def add_group(group_id)\n\t\t\n\t\t# ADD ERROR CHECKING HERE FOR INVALID GROUP -> TEST\n\n\t\tself.group_list |= [group_id]\n\t\tself.update_attribute(:group_list, self.group_list)\n\t\t\n\tend",
"def add_node_group( node, group )\n node_obj = self.get_node_obj( node )\n group = group.to_a\n \n # verify that group(s) exists in dashboard\n group.each do |g|\n unless NodeGroup.find_by_name(g)\n return \"SKIPPED: #{node_obj.name}. No group found for #{g}\"\n end\n end\n \n # obtaining dasboard group objects \n my_groups = []\n group.each { |n| my_groups << self.get_group_obj(n) }\n \n node_obj.node_groups = my_groups\n begin\n node_obj.save!\n return \"#{node_obj.name} added to group(s) #{group.inspect}\"\n rescue Exception => e\n return \"FAILED to add #{node_obj.name} to #{group.inspect} group: #{e.message}\"\n end\n \n end",
"def addHost(host)\n\t\t@hosts.push(host)\n\tend",
"def add_host(new_host)\n @hosts.push(new_host)\n end",
"def add\n @groups = CwaGroups.new\n\n user_name_regex = /^[a-zA-Z0-9-]{3,20}$/\n\n if params[:user_name] !~ ::CwaConstants::USER_REGEX\n flash[:error] = \"You entered an invalid username!\"\n redirect_to :action => :show, :group_name => params[:group_name]\n return\n end\n\n if @groups.add_to_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_add_member(params[:user_name], params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been added to \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem adding \\\"#{params[:user_name]}\\\" to \\\"#{params[:group_name]}\\\". The user probably does not exist.\"\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end",
"def add_group(group)\n login unless authenticated?\n existing_group = find_group(group['name'])\n return existing_group if existing_group\n group = JSON.parse(RestClient.post(resource_url('groups'), group.to_json, :content_type => :json, :cookies => @cookies).body)\n logger.info(\"Added group: #{group['name']}\")\n group\n end",
"def add_group(group_name, filter_argument = nil)\n groups[group_name] = filter_argument\n end",
"def add_hosts(hosts:)\n @hosts = @hosts.+ Array hosts\n\n self\n end",
"def add_group_as_member(group)\n self.groups.push group\n end",
"def group(name, &blk)\n add_child(:groups, Hubcap::Group.new(self, name, &blk))\n end",
"def add_host(host)\r\n if host.class == String\r\n host = Regexp.new(host)\r\n end\r\n unless @hosts.include?(host)\r\n @hosts << host\r\n end\r\n end",
"def add(group, members)\n @group[group] = members(group) | members\n end",
"def add_user_to_group(user, group)\n\t\t\tend"
] | [
"0.68681824",
"0.6770978",
"0.6735424",
"0.6659156",
"0.6440352",
"0.64264405",
"0.63937706",
"0.63391197",
"0.629191",
"0.62590903",
"0.6233617",
"0.6229149",
"0.6226344",
"0.6211744",
"0.62107027",
"0.6054811",
"0.60118145",
"0.59988844",
"0.5995727",
"0.59905773",
"0.598267",
"0.5968895",
"0.591662",
"0.5896774",
"0.58649474",
"0.58449155",
"0.5832916",
"0.5803593",
"0.5795936",
"0.5760855"
] | 0.7607118 | 0 |
Add disk to the virtual machine ==== Attributes +server+ Server object +size+ Disk size in bytes ==== Examples add_disk(server, 5) Add a 5GB disk add_disk(server, 10) Add a 10GB disk | def add_disk(server, size)
host = server.to_s
# Increment disk id
if !DISKS.key?(host) then
DISKS[host] = 0
else
DISKS[host] += 1
end
disk_id = DISKS[host]
disk_filename = ".vagrant/disks/" + host + "_" + disk_id.to_s + ".vdi"
server.vm.provider "virtualbox" do |v|
# Create disk if it not exist
unless File.exist?(disk)
v.customize ["createhd", "--filename", disk_filename, "--size", size * 1024 * 1024]
end
v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_id, '--device', 0, '--type', 'hdd', '--medium', disk]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n message = \"Attaching:\\tStorage to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"#{$vbox_disk_type}\\\" --port 0 --device 0 --type hdd --medium \\\"#{vbox_disk_name}\\\"\"\n execute_command(message,command)\n return\nend",
"def attach_disk(server_id, disk_id)\n with_thread_name(\"attach_disk(#{server_id}, #{disk_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n cloud_error(\"Server `#{server_id}' not found\") unless server\n\n volume = @openstack.with_openstack { @openstack.volume.volumes.get(disk_id) }\n cloud_error(\"Volume `#{disk_id}' not found\") unless volume\n\n device_name = attach_volume(server, volume)\n\n update_agent_settings(server) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'][disk_id] = device_name\n end\n end\n end",
"def attach_disk(disk)\n # Adding a new disk in newer vSphere versions\n # automatically cleans all system snapshots\n # https://github.com/OpenNebula/one/issues/5409\n if snapshots? || one_snapshots?\n error_msg = 'Existing sytem snapshots, cannot change disks. '\n error_msg << 'Please remove all snapshots and try again'\n raise error_msg\n end\n\n spec_hash = {}\n device_change = []\n\n # Extract unmanaged_keys\n unmanaged_keys = disk_keys\n vc_disks = vcenter_disks_get\n\n # Check if we're dealing with a StoragePod SYSTEM ds\n storpod = disk['VCENTER_DS_REF'].start_with?('group-')\n\n # Check if disk being attached is already connected to the VM\n raise 'DISK is already connected to VM' if disk_attached_to_vm(\n disk, unmanaged_keys, vc_disks\n )\n\n # Generate vCenter spec and reconfigure VM\n add_spec = calculate_add_disk_spec(disk)\n device_change << add_spec\n raise 'Could not generate DISK spec' if device_change.empty?\n\n extra_key = \"opennebula.mdisk.#{disk['DISK_ID']}\"\n extra_value = add_spec[:device].key.to_s\n\n spec_hash[:deviceChange] = device_change\n spec_hash[:extraConfig] =\n [{ :key => extra_key, :value => extra_value }]\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)\n\n begin\n if storpod\n # Ask for StorageDRS recommendation\n # to reconfigure VM (AddDisk)\n sm = storagemanager\n\n # Disk id is -1 as I don't know\n # what disk id is going to be set\n disk_locator = [RbVmomi::VIM.PodDiskLocator(:diskId => -1)]\n\n # Disk locator is required for AddDisk\n vmpod_hash = {}\n vmpod_hash[:storagePod] = get_ds\n vmpod_hash[:disk] = disk_locator\n vmpod_config =\n RbVmomi::VIM::VmPodConfigForPlacement(\n vmpod_hash\n )\n\n # The storage pod selection requires initialize\n spod_hash = {}\n spod_hash[:initialVmConfig] = [vmpod_config]\n spod_select =\n RbVmomi::VIM::StorageDrsPodSelectionSpec(\n spod_hash\n )\n storage_spec = RbVmomi::VIM.StoragePlacementSpec(\n :type => :reconfigure,\n :podSelectionSpec => spod_select,\n :vm => self['_ref'],\n :configSpec => spec\n )\n\n # Query a storage placement recommendation\n result = sm\n .RecommendDatastores(\n :storageSpec => storage_spec\n ) rescue nil\n\n if result.nil?\n raise 'Could not get placement '\\\n 'specification for StoragePod'\n end\n\n if !result.respond_to?(:recommendations) ||\n result.recommendations.empty?\n raise 'Could not get placement '\\\n 'specification for StoragePod'\n end\n\n # Get recommendation key to be applied\n key = result.recommendations.first.key ||= ''\n\n if key.empty?\n raise 'Missing Datastore recommendation for StoragePod'\n end\n\n # Apply recommendation\n sm.ApplyStorageDrsRecommendation_Task(\n :key => [key]\n ).wait_for_completion\n\n # Add the key for the volatile disk to the\n # unmanaged opennebula.disk.id variables\n unit_number =\n spec_hash[:deviceChange][0][:device]\n .unitNumber\n controller_key =\n spec_hash[:deviceChange][0][:device]\n .controllerKey\n key =\n get_vcenter_disk_key(\n unit_number,\n controller_key\n )\n spec_hash = {}\n reference = {}\n reference[:key] =\n \"opennebula.disk.#{disk['DISK_ID']}\"\n reference[:value] = key.to_s\n spec_hash[:extraConfig] = [reference]\n @item\n .ReconfigVM_Task(\n :spec => spec_hash\n ).wait_for_completion\n else\n @item\n .ReconfigVM_Task(\n :spec => spec\n ).wait_for_completion\n end\n # Modify extraConfig if disks has a bad key\n sync_extraconfig_disk(spec_hash)\n rescue StandardError => e\n error = \"Cannot attach DISK to VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n end",
"def addDisk(backingFile, sizeInMB, label = nil, summary = nil, options = {})\n # Remove nil keys if any, since the next line may not work\n options.reject! { |_k, v| v.nil? }\n # Merge default values:\n # - persistent is set to true to be backward compatible\n # - thin_provisioned is set to false explicitly since we call to_s on it further, so nil will not work for us\n options = {:persistent => true, :thin_provisioned => false}.merge(options)\n ck, un = available_scsi_units.first\n raise \"addDisk: no SCSI controller found\" unless ck\n\n vmConfigSpec = VimHash.new(\"VirtualMachineConfigSpec\") do |vmcs|\n vmcs.deviceChange = VimArray.new(\"ArrayOfVirtualDeviceConfigSpec\") do |vmcs_vca|\n vmcs_vca << VimHash.new(\"VirtualDeviceConfigSpec\") do |vdcs|\n vdcs.operation = VirtualDeviceConfigSpecOperation::Add\n if sizeInMB < 0\n sizeInMB = -sizeInMB\n else\n vdcs.fileOperation = VirtualDeviceConfigSpecFileOperation::Create\n end\n vdcs.device = VimHash.new(\"VirtualDisk\") do |vDev|\n vDev.key = -100 # temp key for creation\n vDev.capacityInKB = sizeInMB * 1024\n vDev.controllerKey = ck\n vDev.unitNumber = un\n # The following doesn't seem to work.\n vDev.deviceInfo = VimHash.new(\"Description\") do |desc|\n desc.label = label\n desc.summary = summary\n end if label || summary\n vDev.connectable = VimHash.new(\"VirtualDeviceConnectInfo\") do |con|\n con.allowGuestControl = \"false\"\n con.startConnected = \"true\"\n con.connected = \"true\"\n end\n if options[:dependent]\n mode = (options[:persistent] ? VirtualDiskMode::Persistent : VirtualDiskMode::Nonpersistent)\n else\n mode = (options[:persistent] ? VirtualDiskMode::Independent_persistent : VirtualDiskMode::Independent_nonpersistent)\n end\n vDev.backing = VimHash.new(\"VirtualDiskFlatVer2BackingInfo\") do |bck|\n bck.diskMode = mode\n bck.split = \"false\"\n bck.thinProvisioned = options[:thin_provisioned].to_s\n bck.writeThrough = \"false\"\n bck.fileName = backingFile\n begin\n dsn = @invObj.path2dsName(@dsPath)\n bck.datastore = @invObj.dsName2mo_local(dsn)\n rescue\n bck.datastore = nil\n end\n end\n end\n end\n end\n end\n\n logger.info \"MiqVimVm(#{@invObj.server}, #{@invObj.username}).addDisk: calling reconfigVM_Task\"\n taskMor = @invObj.reconfigVM_Task(@vmMor, vmConfigSpec)\n logger.info \"MiqVimVm(#{@invObj.server}, #{@invObj.username}).addDisk: returned from reconfigVM_Task\"\n waitForTask(taskMor)\n end",
"def addVolume(dev, size, type: \"pd-standard\", delete_on_termination: false)\n devname = dev.gsub(/.*?\\/([^\\/]+)$/, '\\1')\n resname = MU::Cloud::Google.nameStr(@mu_name+\"-\"+devname)\n MU.log \"Creating disk #{resname}\"\n\n description = @deploy ? @deploy.deploy_id : @mu_name+\"-\"+devname\n\n newdiskobj = MU::Cloud::Google.compute(:Disk).new(\n size_gb: size,\n description: description,\n zone: @config['availability_zone'],\n# type: \"projects/#{config['project']}/zones/#{config['availability_zone']}/diskTypes/pd-ssd\",\n type: \"projects/#{@project_id}/zones/#{@config['availability_zone']}/diskTypes/#{type}\",\n# Other values include pd-ssd and local-ssd\n name: resname\n )\n\n begin\n newdisk = MU::Cloud::Google.compute(credentials: @config['credentials']).insert_disk(\n @project_id,\n @config['availability_zone'],\n newdiskobj\n )\n rescue ::Google::Apis::ClientError => e\n if e.message.match(/^alreadyExists: /)\n MU.log \"Disk #{resname} already exists, ignoring request to create\", MU::WARN\n return\n else\n raise e\n end\n end\n\n attachobj = MU::Cloud::Google.compute(:AttachedDisk).new(\n device_name: devname,\n source: newdisk.self_link,\n type: \"PERSISTENT\",\n auto_delete: delete_on_termination\n )\n\n MU.log \"Attaching disk #{resname} to #{@cloud_id} at #{devname}\"\n MU::Cloud::Google.compute(credentials: @config['credentials']).attach_disk(\n @project_id,\n @config['availability_zone'],\n @cloud_id,\n attachobj\n )\n\n end",
"def attach_disk(config, prefix, disk_num, size)\n filename = \"#{prefix}#{disk_num}.vdi\"\n config.vm.provider \"virtualbox\" do |vb|\n if !File.exist?(filename) \n vb.customize ['createhd', '--filename', filename, '--size', (size * 1024).floor, '--variant', 'fixed']\n vb.customize ['modifyhd', filename, '--type', 'shareable']\n end\n\n vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', disk_num + 2, '--device', 0, '--type', 'hdd', '--medium', filename]\n end\nend",
"def create_disk(disk_id, size)\n @logger.info(\"create_disk(#{disk_id}, #{size})\")\n storage_account_name = disk_id.storage_account_name\n disk_name = disk_id.disk_name\n @logger.info(\"Start to create an empty vhd blob: blob_name: #{disk_name}.vhd\")\n @blob_manager.create_empty_vhd_blob(storage_account_name, DISK_CONTAINER, \"#{disk_name}.vhd\", size)\n end",
"def attach_disk(instance_id, disk_id)\n @logger.info(\"attach_disk(#{instance_id}, #{disk_id})\")\n disk_name = disk_id.disk_name()\n if instance_id.use_managed_disks?()\n disk_params = {\n :disk_name => disk_name,\n :caching => disk_id.caching(),\n :disk_bosh_id => disk_id.to_s,\n :disk_id => @azure_client2.get_managed_disk_by_name(disk_id.resource_group_name(), disk_name)[:id],\n :managed => true\n }\n else\n disk_params = {\n :disk_name => disk_name,\n :caching => disk_id.caching(),\n :disk_bosh_id => disk_id.to_s,\n :disk_uri => @disk_manager.get_data_disk_uri(disk_id),\n :disk_size => @disk_manager.get_disk_size_in_gb(disk_id),\n :managed => false\n }\n end\n lun = @azure_client2.attach_disk_to_virtual_machine(\n instance_id.resource_group_name(),\n instance_id.vm_name(),\n disk_params\n )\n \"#{lun}\"\n end",
"def attach_disk(instance_id, disk_id)\n @logger.info(\"attach_disk(#{instance_id}, #{disk_id})\")\n disk_name = disk_id.disk_name\n disk_params = if instance_id.use_managed_disks?\n {\n disk_name: disk_name,\n caching: disk_id.caching,\n disk_bosh_id: disk_id.to_s,\n disk_id: @azure_client.get_managed_disk_by_name(disk_id.resource_group_name, disk_name)[:id],\n managed: true\n }\n else\n {\n disk_name: disk_name,\n caching: disk_id.caching,\n disk_bosh_id: disk_id.to_s,\n disk_uri: @disk_manager.get_data_disk_uri(disk_id),\n disk_size: @disk_manager.get_disk_size_in_gb(disk_id),\n managed: false\n }\n end\n lun = @azure_client.attach_disk_to_virtual_machine(\n instance_id.resource_group_name,\n instance_id.vm_name,\n disk_params\n )\n lun.to_s\n end",
"def add_vm_disks(vm_service, disk_specs)\n storage_spec = disk_specs[:storage]\n default_disk_spec = disk_specs[:default] || {}\n attachments_service = vm_service.disk_attachments_service\n disk_specs[:disks].each do |disk_spec|\n attachment = prepare_vm_disk_attachment(default_disk_spec.merge(disk_spec), storage_spec)\n attachments_service.add(attachment)\n end\n end",
"def disk(disk_id, opts = { :root_device => false })\n @disks << disk_id\n @root_device = @disks.length if opts[:root_device]\n end",
"def create_disk(name, size_mb, vm = nil, retries = @retries[\"default\"])\n new_disk = Xml::WrapperFactory.create_instance(\"DiskCreateParams\")\n new_disk.name = name\n new_disk.size_bytes = size_mb * 1024 * 1024 # VCD expects bytes\n new_disk.bus_type = Xml::HARDWARE_TYPE[:SCSI_CONTROLLER]\n new_disk.bus_sub_type = Xml::BUS_SUB_TYPE[:LSILOGIC]\n new_disk.add_locality(vm) if vm\n vdc = get_ovdc\n @logger.info(\"Creating independent disk #{name} of #{size_mb}MB.\")\n @logger.info(\"Disk locality ist set to #{vm.name} #{vm.urn}.\") if vm\n disk = @connection.post(vdc.add_disk_link, new_disk,\n Xml::MEDIA_TYPE[:DISK_CREATE_PARAMS])\n raise ApiRequestError unless disk.respond_to?(:running_tasks)\n # Creating a disk returns a disk with tasks inside\n retries.times do |try|\n return disk if disk.running_tasks.nil? || disk.running_tasks.empty?\n @logger.info(\"Disk #{disk.urn} has running tasks. Waiting for \" +\n \"tasks to finish. Try: #{try}/#{retries} .\" )\n disk.running_tasks.each do |t|\n monitor_task(t)\n end\n disk = @connection.get(disk)\n end\n end",
"def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n _ = @cloud_core.attach_disk(instance_id, disk_id) do |instance, device_name|\n update_agent_settings(instance_id) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'][disk_id] = BlockDeviceManager.device_path(device_name, instance.instance_type, disk_id)\n end\n end\n end\n end",
"def create_disk(size, cloud_properties, server_id = nil)\n volume_service_client = @openstack.volume\n with_thread_name(\"create_disk(#{size}, #{cloud_properties}, #{server_id})\") do\n raise ArgumentError, 'Disk size needs to be an integer' unless size.is_a?(Integer)\n cloud_error('Minimum disk size is 1 GiB') if size < 1024\n\n unique_name = generate_unique_name\n volume_params = {\n # cinder v1 requires display_ prefix\n display_name: \"volume-#{unique_name}\",\n display_description: '',\n # cinder v2 does not require prefix\n name: \"volume-#{unique_name}\",\n description: '',\n size: mib_to_gib(size),\n }\n\n if cloud_properties.key?('type')\n volume_params[:volume_type] = cloud_properties['type']\n elsif !@default_volume_type.nil?\n volume_params[:volume_type] = @default_volume_type\n end\n\n if server_id && @az_provider.constrain_to_server_availability_zone?\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n volume_params[:availability_zone] = server.availability_zone if server&.availability_zone\n end\n\n @logger.info('Creating new volume...')\n new_volume = @openstack.with_openstack { volume_service_client.volumes.create(volume_params) }\n\n @logger.info(\"Creating new volume `#{new_volume.id}'...\")\n @openstack.wait_resource(new_volume, :available)\n\n new_volume.id.to_s\n end\n end",
"def create_disk(size)\n @logger.info(\"create_disk(#{size})\")\n disk_name = \"bosh-disk-#{SecureRandom.uuid}\"\n logger.info(\"Start to create an empty vhd blob: blob_name: #{disk_name}.vhd\")\n @blob_manager.create_empty_vhd_blob(container_name, \"#{disk_name}.vhd\", size)\n disk_name\n end",
"def configure_disks(vb, server, hostname, name)\n vminfo = vm_info(name)\n disks = server['disks'] || {}\n unless vminfo =~ /Storage Controller Name \\(1\\): *SATA Controller/\n # puts \"Attaching SATA Controller\"\n vb.customize [\n 'storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata',\n '--portcount', disks.size\n ]\n # else\n # puts 'SATA Controller already attached'\n end\n\n disks.each_with_index do |disk, i|\n disk_name = disk.first\n disk_size = disk.last['size']\n disk_uuid = disk.last['uuid']\n real_uuid = \"00000000-0000-0000-0000-#{disk_uuid.rjust(12,'0')}\"\n if server['cluster']\n disk_filename = File.join(VAGRANT_ROOT, \"#{disk_name}_#{server['cluster']}.vdi\")\n else\n disk_filename = File.join(VAGRANT_ROOT, \"#{disk_name}.vdi\")\n end\n\n if File.file?(disk_filename)\n # puts \"Disk #{disk_filename} already created\"\n disk_hash = `VBoxManage showmediuminfo \"#{disk_filename}\"`.scan(/(.*): *(.*)/).to_h\n current_uuid = disk_hash['UUID']\n else\n # puts \"Creating disk #{disk_filename}\"\n current_uuid = '0'\n if server['cluster']\n vb.customize [\n 'createhd',\n '--filename', disk_filename,\n '--size', disk_size.to_s,\n '--variant', 'Fixed'\n ]\n vb.customize [\n 'modifyhd', disk_filename,\n '--type', 'shareable'\n ]\n else\n vb.customize [\n 'createhd',\n '--filename', disk_filename,\n '--size', disk_size.to_s,\n '--variant', 'Standard'\n ]\n end\n end\n\n # Conditional for adding disk_uuid\n if server['cluster'] && current_uuid == real_uuid\n # puts \"Attaching shareable disk #{disk_filename}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--mtype', 'shareable'\n ]\n elsif server['cluster']\n # puts \"Attaching shareable disk #{disk_filename}, adding UUID #{real_uuid}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--mtype', 'shareable',\n '--setuuid', real_uuid\n ]\n elsif current_uuid == real_uuid\n # puts \"Attaching normal disk #{disk_filename}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename\n ]\n else\n # puts \"Attaching normal disk #{disk_filename}, adding UUID #{real_uuid}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--setuuid', real_uuid\n ]\n end\n end\nend",
"def add_instance_disk(array, instance, disk)\n if instance.managed_disk?\n disk_type = 'managed'\n disk_location = disk.managed_disk.id\n managed_disk = @managed_disks.find { |d| d.id.casecmp(disk_location).zero? }\n\n if managed_disk\n disk_size = managed_disk.properties.disk_size_gb.gigabytes\n mode = managed_disk.try(:sku).try(:name)\n else\n _log.warn(\"Unable to find disk information for #{instance.name}/#{instance.resource_group}\")\n disk_size = nil\n mode = nil\n end\n else\n disk_type = 'unmanaged'\n disk_location = disk.try(:vhd).try(:uri)\n disk_size = disk.try(:disk_size_gb).try(:gigabytes)\n\n if disk_location\n uri = Addressable::URI.parse(disk_location)\n storage_name = uri.host.split('.').first\n container_name = File.dirname(uri.path)\n blob_name = uri.basename\n\n storage_acct = @storage_accounts.find { |s| s.name.casecmp(storage_name).zero? }\n mode = storage_acct.try(:sku).try(:name)\n\n if @options.get_unmanaged_disk_space && disk_size.nil?\n storage_keys = @sas.list_account_keys(storage_acct.name, storage_acct.resource_group)\n storage_key = storage_keys['key1'] || storage_keys['key2']\n blob_props = storage_acct.blob_properties(container_name, blob_name, storage_key)\n disk_size = blob_props.content_length.to_i\n end\n end\n end\n\n disk_record = {\n :device_type => 'disk',\n :controller_type => 'azure',\n :device_name => disk.name,\n :location => disk_location,\n :size => disk_size,\n :disk_type => disk_type,\n :mode => mode\n }\n\n array << disk_record\n end",
"def provision_and_mount_volume(server, disk_size, device)\n unless provider.find_server_device(server, device)\n say \"Provisioning #{disk_size}Gb persistent disk for inception VM...\"\n provider.create_and_attach_volume(\"Inception Disk\", disk_size, server, device)\n end\n\n # Format and mount the volume\n if aws?\n say \"Skipping volume mounting on AWS 12.10 inception VM until its fixed\", [:yellow, :bold]\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n else\n say \"Mounting persistent disk as volume on inception VM...\"\n run_ssh_command_until_successful server, \"sudo mkfs.ext4 #{device} -F\"\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n run_ssh_command_until_successful server, \"sudo mount #{device} /var/vcap/store\"\n end\n end",
"def create_vbox_hdd(client_name,vbox_disk_name)\n message = \"Creating:\\tVM hard disk for \"+client_name\n command = \"VBoxManage createhd --filename \\\"#{vbox_disk_name}\\\" --size \\\"#{$default_vm_size}\\\"\"\n execute_command(message,command)\n return\nend",
"def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n instance = @ec2_client.instances[instance_id]\n volume = @ec2_client.volumes[disk_id]\n\n device_name = attach_ebs_volume(instance, volume)\n\n update_agent_settings(instance) do |settings|\n settings[\"disks\"] ||= {}\n settings[\"disks\"][\"persistent\"] ||= {}\n settings[\"disks\"][\"persistent\"][disk_id] = device_name\n end\n logger.info(\"Attached `#{disk_id}' to `#{instance_id}'\")\n end\n\n # log registry settings for debugging\n logger.debug(\"updated registry settings: #{registry.read_settings(instance_id)}\")\n end",
"def add_data_disk(vm_name, cloud_service_name, options = {})\n options[:import] ||= false\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n path = \"/services/hostedservices/#{cloud_service_name}/deployments/#{vm.deployment_name}/roles/#{vm_name}/DataDisks\"\n body = Serialization.add_data_disk_to_xml(vm, options)\n Azure::Loggerx.info \"Adding data disk to virtual machine #{vm_name} ...\"\n request = client.management_request(:post, path, body: body)\n request.call\n else\n Azure::Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\".\"\n end\n end",
"def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n instance = @ec2_resource.instance(instance_id)\n volume = @ec2_resource.volume(disk_id)\n\n device_name = attach_ebs_volume(instance, volume)\n\n update_agent_settings(instance) do |settings|\n settings[\"disks\"] ||= {}\n settings[\"disks\"][\"persistent\"] ||= {}\n settings[\"disks\"][\"persistent\"][disk_id] = device_name\n end\n logger.info(\"Attached `#{disk_id}' to `#{instance_id}'\")\n end\n\n # log registry settings for debugging\n logger.debug(\"updated registry settings: #{registry.read_settings(instance_id)}\")\n end",
"def attach_disk_to_vm(vm)\n begin\n start_time = Time.now.to_i\n OOLog.info(\"Attaching Storage disk ....\")\n vm_promise = @compute_client.virtual_machines.create_or_update(@rg_name, @instance_name, vm)\n my_vm = vm_promise.value!\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Storage Disk attached #{duration} seconds\")\n OOLog.info(\"VM: #{my_vm.body.name} UPDATED!!!\")\n return true\n rescue MsRestAzure::AzureOperationError =>e\n OOLog.debug( e.body.inspect)\n if e.body.to_s =~ /InvalidParameter/ && e.body.to_s =~ /already exists/\n OOLog.debug(\"The disk is already attached\")\n else\n OOLog.fatal(e.body)\n end\n rescue MsRestAzure::CloudErrorData =>e\n OOLog.fatal(e.body.message)\n rescue Exception => ex\n OOLog.fatal(ex.message)\n end\n end",
"def attach_disk(opts, disk_name, instance_id)\n Djinn.log_debug('Calling attach_disk with parameters ' \\\n \"#{opts.inspect}, with disk name #{disk_name} and instance id \" +\n instance_id.to_s)\n\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['instance_id'] = instance_id\n options['disk_name'] = disk_name\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instance\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n return JSON.parse(make_call(request, uri))['location']\n end",
"def attach_volumes!(server, volumes_count, size)\n #create a new block storage connection obj\n volume_service = Fog::Volume::OpenStack.new(\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n )\n base = 'sdd'\n volumes_count.times do |i|\n base = base.next!\n #create a new volume\n vol = volume_service.volumes.create(\n :size => size,\n :display_name => \"#{server.name}-#{i}\",\n :description => \"Volume attached to #{server.name} - managed by ankus\"\n )\n vol.reload\n vol.wait_for { status == 'available' }\n server.attach_volume(vol.id, \"/dev/#{base}\")\n vol.wait_for { status == 'in-use' }\n end\n end",
"def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end",
"def attach_disk(vm_id, disk_id)\n with_thread_name(\"attach_disk(#{vm_id}, #{disk_id})\") do\n begin\n # Don't go further if the volume group is already attached\n return if volume_group_attached?(vm_id, disk_id)\n @logger.debug(\"Attaching volume group #{disk_id} to VM #{vm_id}\")\n @vol_group_manager.attach_to_vm(disk_id, vm_id)\n update_agent_settings(vm_id) do |settings|\n settings['disks']['persistent'] ||= {}\n disks = settings['disks']\n drive = \"/dev/sd#{get_drive_letter(disks)}\"\n settings['disks']['persistent'][disk_id] = drive\n end\n rescue => e\n @logger.error(e)\n cloud_error(e.message)\n end\n end\n end",
"def create_disk(disk_id, location, size, storage_account_type)\n @logger.info(\"create_disk(#{disk_id}, #{location}, #{size}, #{storage_account_type})\")\n resource_group_name = disk_id.resource_group_name()\n disk_name = disk_id.disk_name()\n caching = disk_id.caching()\n tags = AZURE_TAGS.merge({\n \"caching\" => caching\n })\n disk_params = {\n :name => disk_name,\n :location => location,\n :tags => tags,\n :disk_size => size,\n :account_type => storage_account_type\n }\n @logger.info(\"Start to create an empty managed disk `#{disk_name}' in resource group `#{resource_group_name}'\")\n @azure_client2.create_empty_managed_disk(resource_group_name, disk_params)\n end",
"def create_disk(size, cloud_properties, vm_id = nil)\n with_thread_name(\"create_disk(#{size})\") do\n begin\n @logger.debug(\"Persistent Disk Size: #{size}\")\n @logger.debug(\"Cloud Properties: #{cloud_properties}\")\n @logger.debug(\"VM Id: #{vm_id}\")\n # Form a name for the volume group\n vol_group_name = \"bosh-peristent-disk-#{vm_id}-#{rand(1000)}\"\n # Create the volume group\n volume_uuid = @vol_group_manager.create_volume_group(vol_group_name)\n @logger.info(\"New volume group created [#{vol_group_name}]\")\n # Create a volume disk\n @vol_group_manager.create_volume_disk(volume_uuid, size,\n @container_uuid)\n @logger.info(\"New volume disk created on volume #{vol_group_name}.\")\n # Return volume group's uuid\n volume_uuid\n rescue => e\n logger.error(e)\n cloud_error(e.message)\n end\n end\n end",
"def add_cdrom_to_vbox_vm(client_name)\n message = \"Attaching:\\tCDROM to VM \"+client_name\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"cdrom\\\" --add \\\"sata\\\" --controller \\\"IntelAHCI\\\"\"\n execute_command(message,command)\n if File.exist?($vbox_additions_iso)\n message = \"Attaching:\\tISO \"+$vbox_additions_iso+\" to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"cdrom\\\" --port 0 --device 0 --type dvddrive --medium \\\"#{$vbox_additions_iso}\\\"\"\n execute_command(message,command)\n end\n return\nend"
] | [
"0.7076035",
"0.693785",
"0.68272406",
"0.67360306",
"0.6712447",
"0.6695081",
"0.65584517",
"0.6548588",
"0.6505648",
"0.64939356",
"0.6481664",
"0.63985795",
"0.6391803",
"0.6383347",
"0.6370955",
"0.63696635",
"0.6250282",
"0.62104225",
"0.6199367",
"0.6185591",
"0.61561674",
"0.6145234",
"0.6138398",
"0.6056799",
"0.60453326",
"0.59942096",
"0.5982586",
"0.5981185",
"0.5933276",
"0.5892831"
] | 0.8375884 | 0 |
GET /membership_contributions GET /membership_contributions.json | def index
@membership_contributions = MembershipContribution.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end",
"def get_contributions(repository)\n Git.contributions GithubAPI.name(@username), repository\n end",
"def index\r\n @contributions = @person.contributions\r\n end",
"def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end",
"def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contributions }\n end\n end",
"def index\n @memberships = @community.memberships\n end",
"def GetMemberships params = {}\n\n params = params.merge(path: 'group_memberships.json')\n APICall(params)\n\n end",
"def shared_contributions\n Contribution.find(:all,\n :select => \"contributions.*\",\n :joins => \"JOIN policies p on (contributions.policy_id = p.id) JOIN permissions e on (p.id = e.policy_id)\",\n :conditions => [ \"e.contributor_id=? AND e.contributor_type = 'Network'\", id ])\n end",
"def index\n @memberships = @user.memberships\n end",
"def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end",
"def display_contributions(repo_full_name)\n repo = Commitchamp::Repo.find_by(full_name: repo_full_name)\n contributors = repo.contributions.order('additions + deletions + commits DESC').limit(10)\n puts \"\\n##Contributions for '#{repo.full_name}'\"\n puts \"\\nUsername | Additions | Deletions | Commits\"\n contributors.each do |x|\n puts \"#{x.user.login} | #{x.additions} | #{x.deletions} | #{x.commits}\"\n end\n puts\n end",
"def contributions_as_hash\n load_contributions unless @contributions\n @contributions\n end",
"def GetMembership id\n\n APICall(path: \"group_memberships/#{id}.json\")\n\n end",
"def list_memberships(user)\n get(\"/#{user}/lists/memberships.json\")\n end",
"def update\n respond_to do |format|\n if @membership_contribution.update(membership_contribution_params)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_contribution }\n else\n format.html { render :edit }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contributions = Contribution.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contributions }\n end\n end",
"def index\n @memberships = current_user.memberships.order('memberships.created_at DESC').limit(10)\n @memberships = @memberships.project_prefix(params[:query]) if params[:query].present?\n # as much as i'd love to add includes(:project), it breaks the join in project_prefix.\n # go ahead, try it and see.\n\n render json: decorate(@memberships)\n end",
"def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contributions }\n end\n end",
"def index\n @memberships = @user.memberships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end",
"def shared_contributions\n list = []\n self.permissions.each do |p|\n p.policy.contributions.each do |c|\n list << c unless c.nil? || c.contributable.nil?\n end\n end\n list\n end",
"def index\n @contributions = Contribution.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @contributions.to_xml }\n end\n end",
"def index\n respond_to do |format|\n format.json do\n @memberships = @project.memberships.order('created_at DESC').limit(10)\n @memberships = @memberships.user_prefix(params[:query]) if params[:query].present?\n\n render json: decorate(@memberships)\n end\n end\n end",
"def memberships\n @list.client.get(\"#{url}/memberships\")\n end",
"def split_contributions(org, repo)\n total_contributors = []\n page = 1\n contributions = @github.contributions_page(org, repo).to_a\n total_contributors.concat(contributions)\n total_contributors\n end",
"def index\n @memberships = Membership.where(user_id: current_user_id).includes(:project)\n project_array = []\n @memberships.each do |membership|\n project_array.push membership.project\n end\n json_response(project_array)\n end",
"def index\n @mission_memberships = MissionMembership.all\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @membership }\n end\n end",
"def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end",
"def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end",
"def index\n @memberships = @organization.memberships.all\n end"
] | [
"0.73480463",
"0.68995786",
"0.68482727",
"0.6628131",
"0.6467863",
"0.6412968",
"0.62731004",
"0.61800843",
"0.60863173",
"0.60760957",
"0.60544586",
"0.60061777",
"0.59870064",
"0.59585655",
"0.59462893",
"0.59455144",
"0.5944579",
"0.5922383",
"0.5919908",
"0.59150016",
"0.5853898",
"0.58313817",
"0.5825985",
"0.5755501",
"0.57485294",
"0.57433563",
"0.5649967",
"0.56472105",
"0.5641865",
"0.5639797"
] | 0.7566682 | 0 |
POST /membership_contributions POST /membership_contributions.json | def create
# byebug
@membership_contribution = MembershipContribution.new(membership_contribution_params)
@membership = MembershipBalance.find_by(params[:membership_id])
respond_to do |format|
if @membership_contribution.save
@a = MembershipContribution.all.last
# @balance = MembershipBalance.find(params)
@amount1 = @membership.balance + @a.amount
@b = MembershipBalance.where(membership_id: @a.membership_id).update_all(balance: @amount1)
format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully created.' }
format.json { render :show, status: :created, location: @membership_contribution }
else
format.html { render :new }
format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end",
"def index\n @membership_contributions = MembershipContribution.all\n end",
"def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end",
"def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end",
"def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end",
"def contribution_params\n params.require(:contribution).permit(:contribution_url, :contribution_category, :user_id, :username, category_ids: [] )\n end",
"def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end",
"def create\n @contribution = Contribution.new(contribution_params)\n session[:contributor] = @contribution.contributor\n session[:email] = @contribution.email\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to contributions_url, notice: '投稿しました' }\n format.json { render :index, status: :created, location: @contribution }\n else\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n format.html { render :index }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render json: @contribution, status: :created, location: @contribution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = Adhocracy::Membership.new(membership_params)\n\n if @membership.save\n render json: @membership, status: :created, location: api_v1_membership_path(@membership)\n else\n render_validation_errors @membership.errors\n end\n end",
"def update\n respond_to do |format|\n if @membership_contribution.update(membership_contribution_params)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_contribution }\n else\n format.html { render :edit }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createContributions(eventContributions)\n eventContributions.each do |contribution|\n contributor = User.find_by_email(contribution[1][\"email\"])\n contributor.setContribution!(self, contribution[1][\"amount\"], contribution[1][\"paid\"])\n end\n end",
"def contribution_params\n params.require(:contribution).permit(:name, :email, :amount, :source, :stripeToken)\n end",
"def create\r\n @contribution = Contribution.new(contribution_params)\r\n @contribution.contributable_type = \"Book\"\r\n @contribution.person = @person\r\n\r\n respond_to do |format|\r\n if @contribution.save\r\n format.html { redirect_to person_contributions_path(@person), notice: 'Contribution was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: person_contributions_path(@contribution) }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def contribution_params\n params.require(:contribution).permit(:text, :contributor, :email)\n end",
"def add_contribution(expense, amount)\n contribution = ExpenseContribution.new(:amount => amount)\n contribution.user = self\n contribution.expense = expense\n contribution.save!\n contribution\n end",
"def increment_contributions\n contributions = self.contributions.nil? ? 0 : self.contributions\n contributions += 1\n self.save\n end",
"def create\n @case_study = CaseStudy.new(params[:case_study].merge(:summary => 'Welcome to your new case study! May it bring joy to your life, and the lives of others.<hr>You can begin adding content by choosing Actions->Edit.'))\n\n respond_to do |format|\n if @case_study.save\n @contribution = @case_study.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render json: @case_study, status: :created, location: @case_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = Membership.new(params[:membership])\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render json: @membership, status: :created, location: @membership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_contribution(expense, amount)\n contribution = ExpenseContribution.new(amount: amount)\n contribution.user = self\n contribution.expense = expense\n contribution.save!\n contribution\n end",
"def create\n @membership = @organization.memberships.build(membership_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:membership][:user_username]\n params[:membership][:user_id] = User.find_by_username(params[:membership].delete('user_username')).try!(:id)\n end\n\n @membership = @project.memberships.create(membership_params)\n respond_with @project, @membership\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contribution_params\n params.require(:contribution).permit(:titulo, :url, :puntos, :text, :tipo, :user_id)\n end",
"def contribution_params\n params.require(:contribution).permit(:titulo, :user_id, :url, :puntos, :text)\n end",
"def create\n redirect_to '/auth/google_oauth2' unless user_is_logged_in?\n\n @contribution = Contribution.new(contribution_params)\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render :show, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if (current_user)\n @contribution = Contribution.new(contribution_params)\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to \"\" }\n format.json { render :index, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n elsif (params[:contribution][:url] != nil && params[:contribution][:text] != nil) || \n (params[:contribution][:url] == nil && params[:contribution][:text] == nil) \n render :json => {:status => \"400\", :error => \"Bad Request\"}, status: :bad_request\n else\n miId = decodeToken(params[:user_token])\n @miuser = User.find(miId) # comprueba que no existe el user con exte token\n params[:contribution][:user_id] = miId\n params[:contribution][:puntos] = 0;\n @contribution = Contribution.new(contribution_params)\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to \"\" }\n format.json { render :show, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end \n end",
"def index\r\n @contributions = @person.contributions\r\n end"
] | [
"0.7063032",
"0.6562812",
"0.64714324",
"0.64046425",
"0.631506",
"0.629244",
"0.6206663",
"0.6166496",
"0.61541796",
"0.6131366",
"0.610208",
"0.6083469",
"0.6061317",
"0.6032376",
"0.6020434",
"0.598938",
"0.59712744",
"0.5959901",
"0.5947049",
"0.59300524",
"0.5919236",
"0.59143215",
"0.5903208",
"0.59020513",
"0.5897907",
"0.58965915",
"0.58787835",
"0.5864185",
"0.58604056",
"0.58596265"
] | 0.6768626 | 1 |
PATCH/PUT /membership_contributions/1 PATCH/PUT /membership_contributions/1.json | def update
respond_to do |format|
if @membership_contribution.update(membership_contribution_params)
format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' }
format.json { render :show, status: :ok, location: @membership_contribution }
else
format.html { render :edit }
format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end",
"def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contribution.update(contribution_params)\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribution }\n else\n format.html { render :edit }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contribution.update(contribution_params)\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribution }\n else\n format.html { render :edit }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n flash[:notice] = 'Contribution was successfully updated.'\n format.html { redirect_to(@contribution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contribution.update(contribution_params)\n format.html { redirect_to contributions_url, notice: '編集しました' }\n format.json { render :show, status: :ok, location: @contribution }\n else\n format.html { render :edit }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @membership ||= Membership.find(params[:id])\n\n respond_to do |format|\n if @membership.update_attributes(params[:membership])\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @membership = Membership.find(params[:id])\n\n respond_to do |format|\n if @membership.update_attributes(params[:membership])\n format.html { redirect_to @membership, :notice => 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_contribution.update(user_contribution_params)\n format.html { redirect_to @user_contribution, notice: 'User contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_contribution }\n else\n format.html { render :edit }\n format.json { render json: @user_contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n flash[:notice] = 'Contribution was successfully updated.'\n format.html { redirect_to contribution_url(@contribution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contribution.errors.to_xml }\n end\n end\n end",
"def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n flash[:notice] = 'Contribution was successfully updated.'\n format.html { redirect_to(@contribution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @research_group_membership.update(research_group_membership_params)\n format.html { redirect_to @research_group_membership, notice: 'Research group membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @research_group_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: \"Membership was successfully updated.\" }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to class_group_memberships_url, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tribal_membership.update(tribal_membership_params)\n format.html { redirect_to @tribal_membership, notice: 'Tribal membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tribal_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end",
"def update\n respond_to do |format|\n if @mission_membership.update(mission_membership_params)\n format.html { redirect_to @mission_membership, notice: 'Mission membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_membership }\n else\n format.html { render :edit }\n format.json { render json: @mission_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @organization_membership\n\n if @organization_membership.update(organization_membership_update_params)\n head :no_content\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @member, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n @membership_contribution = MembershipContribution.new(membership_contribution_params)\n @membership = MembershipBalance.find_by(params[:membership_id])\n respond_to do |format|\n if @membership_contribution.save\n @a = MembershipContribution.all.last\n # @balance = MembershipBalance.find(params)\n @amount1 = @membership.balance + @a.amount\n @b = MembershipBalance.where(membership_id: @a.membership_id).update_all(balance: @amount1)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully created.' }\n format.json { render :show, status: :created, location: @membership_contribution }\n else\n format.html { render :new }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @students_project_membership.update(students_project_membership_params)\n format.html { redirect_to @students_project_membership, notice: 'Students project membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @students_project_membership }\n else\n format.html { render :edit }\n format.json { render json: @students_project_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collaboration.update(collaboration_params)\n format.html { redirect_to @collaboration, notice: 'Collaboration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collaboration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @membership.update_attributes(params[:membership])\n format.html { redirect_to edit_site_url(@membership.site), notice: 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6815647",
"0.67277837",
"0.6674991",
"0.6674991",
"0.66394836",
"0.65078545",
"0.6483071",
"0.64645773",
"0.646334",
"0.6427524",
"0.6405148",
"0.6401074",
"0.63899326",
"0.63718337",
"0.63718337",
"0.63718337",
"0.63718337",
"0.63718337",
"0.6368388",
"0.6347717",
"0.63393384",
"0.6312016",
"0.6300562",
"0.62946707",
"0.627252",
"0.62400573",
"0.6234482",
"0.61900055",
"0.6145808",
"0.613279"
] | 0.74537194 | 0 |
DELETE /membership_contributions/1 DELETE /membership_contributions/1.json | def destroy
@membership_contribution.destroy
respond_to do |format|
format.html { redirect_to membership_contributions_url, notice: 'Membership contribution was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @contribution = Contribution.find(params[:id])\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to contributions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to(contributions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to @community, notice: 'Community membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @research_group_membership.destroy\n respond_to do |format|\n format.html { redirect_to research_group_memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contribution = Contribution.find(params[:id])\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to(contributions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: '投稿を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership ||= Membership.find(params[:id])\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: 'Contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: 'Contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mission_membership.destroy\n respond_to do |format|\n format.html { redirect_to mission_memberships_url, notice: 'Mission membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_contribution.destroy\n respond_to do |format|\n format.html { redirect_to user_contributions_url, notice: 'User contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tribal_membership.destroy\n respond_to do |format|\n format.html { redirect_to tribal_memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @students_project_membership.destroy\n respond_to do |format|\n format.html { redirect_to students_project_memberships_url, notice: 'Students project membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url, notice: \"Membership was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to member_url(@membership.member), notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteMembership id\n \n APICall(path: \"group_memberships/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @membership_clerk.destroy\n respond_to do |format|\n format.html { redirect_to membership_clerks_url, notice: 'Membership clerk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contri_url, notice: 'Ask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.role(@project) == :admin && @membership.admin?\n return respond_to do |format|\n format.json { head :forbidden }\n end\n end\n\n @membership.destroy\n head :no_content\n end",
"def destroy\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url(@membership.site) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @memberships = Membership.where(:project_id => params[:id])\n @memberships.each do |membership|\n membership.destroy\n end\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @collaboration.destroy\n respond_to do |format|\n format.html { redirect_to collaborations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_membership = LabMembership.find(params[:id])\n @user = @lab_membership.user\n @lab_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @colaboration = Colaboration.find(params[:id])\n @colaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to colaborations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @research_group_member.destroy\n respond_to do |format|\n format.html { redirect_to research_group_members_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.73390275",
"0.72188705",
"0.7212978",
"0.7210668",
"0.7210668",
"0.7193398",
"0.7193253",
"0.71769303",
"0.71652806",
"0.71325195",
"0.71325195",
"0.7132139",
"0.71162033",
"0.70957476",
"0.7081842",
"0.70556927",
"0.7054126",
"0.70502704",
"0.7048006",
"0.6959316",
"0.69443154",
"0.6943537",
"0.6898453",
"0.68815833",
"0.6881207",
"0.6839719",
"0.6806857",
"0.6795463",
"0.6793516",
"0.6779638"
] | 0.79422396 | 0 |
Return booking request list where your user ID is equal to the client ID on the booking = Requests you've made on spaces. | def my_booking_requests
my_booking_requests = CONNECTION.exec("SELECT id FROM bookings WHERE client_id='#{@user_id}'")
return my_booking_requests
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend",
"def my_space_requests\n my_space_requests = CONNECTION.exec(\"SELECT id FROM bookings WHERE owner_id='#{@user_id}'\")\n return my_space_requests\n end",
"def recieved_requests\n FriendshipRequest.where(\"requested_user_id = ?\", id)\n end",
"def overlapping_approved_requests\n overlapping_requests.where(status: \"APPROVED\")\n end",
"def booking_params\n params.require(:booking).permit(:user_id, :cancel, :slot_ids[])\n end",
"def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end",
"def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end",
"def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end",
"def index\n #approve_request\n @resource_transportation_bookings = ResourceTransportationBooking.where(:requester_id => \"#{current_user.id}\").order.page(params[:page]).per(5)\n end",
"def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end",
"def list\n search_value = params[\"search\"] || \"\"\n if !current_user.blank?\n @reservation = Reservation.where(\"user_id = ? and itinerary_number like ?\", current_user.id, \"%#{search_value}\")\n end\n end",
"def bookings_requested\n # select * from bookings where patient_id = current_user.id\n @bookings_requested = current_user.bookings\n end",
"def get_requests\r\n \trequests = []\r\n privates = []\r\n privates_end = []\r\n publics = []\r\n\r\n \tservice = User.find_by(id: params[:user_id]).service\r\n \tif service\r\n \t\t#solicitudes con el id del servicio del usuario\r\n \t\t#requests = Request.where(\"(service_id = :service_id) or (service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = :vehicle_type)\",{service_id: service.id, service_type: service.service_type, payment_method: service.payment_method, vehicle_type: service.vehicle_type}).order('created_at DESC').limit(20)\r\n privates = Request.where(\"(service_id = :service_id and status='') or (service_id = :service_id and status='0') or (service_id = :service_id and status='1')\",{service_id: service.id}).order('created_at DESC')\r\n privates_end = Request.where(\"(service_id = :service_id and status='2') or (service_id = :service_id and status='3')\",{service_id: service.id}).order('created_at DESC').limit(20)\r\n publics = Request.where(\"(service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = :vehicle_type)\",{service_id: service.id, service_type: service.service_type, payment_method: service.payment_method, vehicle_type: service.vehicle_type}).order('created_at DESC').limit(20)\r\n requests = privates + privates_end + publics\r\n \telse\r\n \t\trequests = Request.where(user_id: params[:user_id]).order('created_at DESC').limit(20)\r\n \tend\r\n \t\r\n \trender json: requests\r\n end",
"def deletependingbooking(user)\n body = JSON.parse(HTTParty.get('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/bookings').body)\n list = body[\"documents\"]\n\n for el in list\n # pending booking\n if el[\"fields\"][\"user\"][\"stringValue\"] == user.email and el[\"fields\"][\"active\"][\"booleanValue\"]\n name = el[\"name\"]\n city = el[\"fields\"][\"city\"][\"stringValue\"]\n park = el[\"fields\"][\"park\"][\"stringValue\"]\n lockHash = el[\"fields\"][\"lockHash\"][\"stringValue\"]\n\n # free locker\n new_body = JSON.parse(HTTParty.get('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/cities/'+hash_code(city).to_s+'/parks/'+hash_code(city+park).to_s+'/lockers/'+lockHash).body)\n \n new_body.delete(\"createTime\") #useless field\n new_body.delete(\"updateTime\") #useless field\n new_body[\"fields\"][\"user\"][\"stringValue\"] = '\"\"'\n new_body[\"fields\"][\"available\"][\"booleanValue\"] = true\n new_body[\"fields\"][\"open\"][\"booleanValue\"] = false\n \n HTTParty.patch('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/cities/'+hash_code(city).to_s+'/parks/'+hash_code(city+park).to_s+'/lockers/'+lockHash, \n body: JSON.generate(new_body), headers: {\"Content-Type\": \"application/json\"} )\n\n # delete booking\n HTTParty.delete('https://firestore.googleapis.com/v1beta1/'+name)\n end\n end\n end",
"def create\n @booking = Booking.find_by(id: params[:booking_id])\n @user_request = UserRequest.new(user_request_params.merge(booking_id: @booking.id))\n\n if @user_request.save\n @user_request.send_request!(session[:access_token])\n redirect_to action: 'index', controller: 'bookings'\n else\n render action: 'edit'\n end\n end",
"def get_available_requests\n start_f =start_time.to_f\n erg = []\n\n Request.all.each do |t|\n if (start_f.between?(t.start_time.to_f, t.end_time.to_f) and \n ((Geocoder::Calculations.distance_between [t.starts_at_N, t.starts_at_E], \n [starts_at_N, starts_at_E], :units => :km) <= t.start_radius) and\n ((Geocoder::Calculations.distance_between [t.ends_at_N, t.ends_at_E], \n [ends_at_N, ends_at_E], :units => :km) <= t.end_radius)) then \n erg << t\n end\n end\n return erg\n end",
"def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end",
"def get_users_on_flight_reject_requester\n\n\t\t# Then query saved journeys using the 'purchased_flight' identifier\n\t\t# for a list of the the other user id's who are on the flight\n\t\t# \n\t\t# Remove the queryer from the list and remove sensetive information\n\t\t# \n\t\t# Done. Return our model list\n\n\t\tjourney_id = params[\"journeyId\"]\n\t\tuser_id = params[\"userId\"]\n\n\t\tuser_list = User.on_journey(journey_id).reject{ |s| s.id == user_id }\n\n\t\trender json: user_list.as_json(only: [:id, :first_name, :last_name, :email]), status: 200\n\n\tend",
"def showRequests\n \t\t# Ensure user is logged in to view this page\n\t\tif(session.has_key?(\"logged_in\"))\n\t\t\n\t\t\t# If the user is not logged in redirect to homepage\n\t\t\tif(session['logged_in'] != 1) \n\t\t\t\tredirect_to url_for(:controller => :home, :action => :showHome)\n\t\t\tend\n\n\t\t\t# Get user id.\n\t\t\t@userID = session['user_id']\n\n\n\t\t\t# ids of people requesting collaboration.\n\t\t\t@co_ids = Collaboration.where(second_id:@userID)\n\n\t\t\t@num = @co_ids.count\n\n\t\t\t# Arrays to store ids other requesters.\n\t\t\t@requester_ids = Array.new(@num)\n\t\t\t@names = Array.new(@num)\n\t\t\t@messages = Array.new(@num)\n\n\t\t\tfor i in 0..@num-1\n\t\t\t\t@requester_ids[i] = @co_ids[i].first_id\n\t\t\t\t@messages[i] = Collaboration.find_by(first_id:@requester_ids[i], second_id:@userID).message\n\t\t\t\t@names[i] = User.find(@co_ids[i].first_id).username\n\t\t\tend\n\n\t\telse\n\t\t\tredirect_to url_for(:controller => :home, :action => :showHome)\n\t\tend\n\tend",
"def search_requests_by_user(user)\n result= Array.new(@search_requests.values)\n result.delete_if { |search_request| search_request.user != user }\n result\n end",
"def visible_request_ids_for_approver\n visible_states = [ApprovalStates::NOTIFIED_STATE, ApprovalStates::COMPLETED_STATE]\n Request.where(:workflow_id => workflow_ids, :state => visible_states).pluck(:id)\n end",
"def index\n @bookings = Booking.where(consumer_id: current_user).or(Booking.where(consultant_id: current_user))\n\n end",
"def overlapping_requests\n CatRentalRequest\n .where('? >= start_date', self.end_date)\n .where('? <= end_date', self.start_date)\n .where('? IS NULL OR id != ?', self.id, self.id)\n end",
"def friend_request\n @friend_requests = FriendRequest.where(:friend_id=>current_user.id,:status=>\"friend request pending\")\n end",
"def friend_requests\n Friendship.where(friend_id: id, status: false)\n end",
"def bookings()\n sql = \"SELECT * FROM bookings WHERE bookings.gymclass_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|booking| Booking.new(booking)}\n end",
"def booking_same_user_same_tour\n return Booking.where(user_id: user_id).find_by(tour_id: tour_id)\n end",
"def accept_request\n\t\t# Get the trip and user being referenced\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t@accepted_user = User.find_by(_id: trip_params[:user_id])\n\t\t# Check that the trip's driver is the current user and that the user being accepted has \n\t\t# Actually requested the trip and that they have not already been accepted\n\t\t# And that there is still space available\n\t\tif (@trip.driver == current_user.id.to_s) && (@trip.user_requests.include?(@accepted_user.id)) && !(@trip.accepted_users.include?(@accepted_user.id)) && @trip.spaces > 0\n\t\t\t# Remove the user from the trip's request users array into the accepted user array\n\t\t\t@trip.user_requests.delete(@accepted_user.id)\n\t\t\t@trip.accepted_users << @accepted_user.id\n\t\t\t# Reduce the trip's available spots\n\t\t\t@trip.spaces -= 1\n\t\t\t# Run through all of the accepted user's requested trips and remove them \n\t\t\t# from the trip's requested user arrays\n\t\t\t# Ann array to hold trips that need to be deleted from the user object\n\t\t\t@to_delete = []\n\t\t\t@accepted_user.trips_requested.each do |trip_index|\n\t\t\t\t@deleting_trip = Trip.find_by(_id: trip_index)\n\t\t\t\tif @deleting_trip.from_city == @trip.from_city && @deleting_trip.to_city == @trip.to_city\n\t\t\t\t\t# Add this trip to the to delete array so that it can be deleted from the\n\t\t\t\t\t# User's requests\n\t\t\t\t\t@to_delete << trip_index\n\t\t\t\t\t# Delete the user from the other trip's requests\n\t\t\t\t\t@deleting_trip.user_requests.delete(@accepted_user.id)\n\t\t\t\t\t@deleting_trip.save!\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Delete the user's other requests with the same cities\n\t\t\t@accepted_user.trips_requested = @accepted_user.trips_requested - @to_delete\n\t\t\t# Add it to the user's accepted rides\n\t\t\t@accepted_user.trips_accepted << @trip.id.to_s\n\t\t\t@trip.save!\n\t\t\t@accepted_user.save!\n\t\t\tUserMailer.accepted_email(@accepted_user).deliver_now\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\tif !(@trip.driver == current_user.id.to_s)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot accept this request because you are not the driver!'\n\t\t\t\t}, status: 422\n\t\t\telsif (@trip.accepted_users.include?(@accepted_user.id))\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"User has already been accepted!\"\n\t\t\t\t}, status: 422\n\t\t\telsif !(@trip.user_requests.include?(@accepted_user.id))\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"Cannot accept a request that hasn't been made yet!\"\n\t\t\t\t}, status: 422\n\t\t\telsif !(@trip.spaces > 0)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There are no more spaces available!'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend",
"def approver_request_ids\n Request.where(:workflow_id => workflow_ids).pluck(:id).sort\n end",
"def approver_request_ids\n Request.where(:workflow_id => workflow_ids).pluck(:id).sort\n end"
] | [
"0.6396313",
"0.63608074",
"0.57924014",
"0.56113684",
"0.5597698",
"0.55717677",
"0.55717677",
"0.55717677",
"0.5549683",
"0.5516849",
"0.5508632",
"0.55073",
"0.54674083",
"0.5437219",
"0.54329133",
"0.5396922",
"0.5394028",
"0.53838533",
"0.53683054",
"0.5334283",
"0.5326549",
"0.53199726",
"0.5299168",
"0.5298227",
"0.5295392",
"0.52951944",
"0.5267887",
"0.5267294",
"0.5256985",
"0.5256985"
] | 0.6759875 | 0 |
GET /game_ratings GET /game_ratings.json | def index
@game_ratings = GameRating.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end",
"def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end",
"def rating\n response[\"rating\"]\n end",
"def index\n @games = Game.where(user_id: session[:user_id])\n current_user_id = current_user.id\n @current_user_rating = UserRating.find_by(user_id:current_user_id).rating\n end",
"def index\n @ratings = Rating.all\n end",
"def index\n @ratings = Rating.all\n end",
"def index\n @ratings = Rating.all\n end",
"def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end",
"def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end",
"def index\n @games = current_user.games.page params[:page]\n @rated = 100 * (current_user.games.count(:rating).to_f / @games.total_entries) \n authorize! :index, Game # can't pass in @games, apparently\n end",
"def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end",
"def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end",
"def average_rating\n render json: { rating: { avg_rating: @movie.avg_rating } }\n end",
"def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end",
"def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end",
"def index\n respond_with Rating.all\n\n \n end",
"def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end",
"def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end",
"def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end",
"def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end",
"def statistics\n ratings = Restaurant.within(params[:latitude],\n params[:longitude],\n params[:radius]).pluck(:rating)\n render json: {\n count: ratings.length,\n avg: ratings.mean,\n std: ratings.standard_deviation\n }\n end"
] | [
"0.771419",
"0.7032027",
"0.7032027",
"0.7032027",
"0.7023711",
"0.70226836",
"0.69158506",
"0.6869383",
"0.6686899",
"0.66244346",
"0.66244346",
"0.66244346",
"0.662329",
"0.66206205",
"0.65967506",
"0.658551",
"0.65697235",
"0.65697235",
"0.65697235",
"0.6553288",
"0.6545443",
"0.64942974",
"0.646011",
"0.64440644",
"0.64421856",
"0.64347285",
"0.6428864",
"0.64180213",
"0.63888705",
"0.6366948"
] | 0.7501716 | 1 |
POST /game_ratings POST /game_ratings.json | def create
@game_rating = GameRating.new(game_rating_params)
respond_to do |format|
if @game_rating.save
format.html { redirect_to @game_rating, notice: 'Game rating was successfully created.' }
format.json { render :show, status: :created, location: @game_rating }
else
format.html { render :new }
format.json { render json: @game_rating.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end",
"def rating_params\n params.require(:rating).permit(:score, :game_id)\n end",
"def evaluate\n puts params[:rating].inspect.yellow\n params[:ratings].each do |tenant, report|\n participant = @game.participants.find_by(tenant: tenant)\n if participant\n participant.ratings.create!(report: report, rated_at: Time.parse(report[:stopped_at]))\n else\n puts \"Cannot find participant #{tenant}\"\n end\n end\n render json: { status: 'ok' }\n end",
"def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n else\r\n render json: { error: \"Rating creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end",
"def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end",
"def rating_params\n params.require(:rating).permit(:rank, :fragrance_id, :user_id)\n end",
"def create\n @rating = Plugins::CamaleonCmsRating::Rating.new(\n score: params[:score],\n post_id: params[:post_id],\n rater_id: cama_current_user.try(:id)\n )\n\n head @rating.save ? :ok : :bad_request\n end",
"def rating_params\n params.require(:rating).permit(:rating, :user_id, :post_id)\n end",
"def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @game_ratings = GameRating.all\n end",
"def rating_params\n params.require(:rating).permit(\"food\", \"drinks\", \"talks\", \"vibe\")\n end",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def create\n @rating = Rating.new(params[:rating])\n facebook_id = params[:rating][:user_id]\n @user = User.find_by_facebook_id(facebook_id)\n @rating.user_id = @user.id\n dish = Dish.find(params[:rating][:dish_id]) \n @rating.dish_id = dish.id \n \n respond_to do |format|\n if @rating.save\n if @rating.value == 1\n dish.upvotes += 1\n else\n dish.downvotes += 1\n end\n dish.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fragrance = Fragrance.find(params[:fragrance_id])\n @rating = Rating.new(rating_params)\n @rating.user = @current_user\n @rating.fragrance = @fragrance\n\n if @rating.save\n render json: @rating, status: :created\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end",
"def create\n # work around the jquery rating plugin we're using\n if params[:id] and params[:rating].is_a?(String)\n params[:rating] = { :score => params[:rating], :dream_id => params[:id] }\n end\n \n # Slightly ugly, but for now we're letting users overwrite their previous\n # ratings.\n @rating = current_user.ratings.find_or_initialize_by_dream_id(params[:rating])\n @rating.attributes = params[:rating] unless @rating.new_record?\n\n respond_to do |format|\n if @rating.save\n format.html { flash[:notice] = 'Rating was successfully created.'; redirect_to(@rating.dream) }\n format.js { render :text => @rating.dream.ratings.average(:score), :status => :created }\n format.xml { render :xml => @rating, :status => :created, :location => @rating }\n else\n format.html { render :action => \"index\" }\n format.js { render :status => '400 Bad Request' } \n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rating_params\n params.require(:rating).permit(:user_id, :rate, :answer_id)\n end",
"def rating_params\n params.require(:rating).permit(\n :movie_id, :user_id, :score\n )\n end",
"def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end",
"def create\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = UserRating.new(params[:rating])\n user_rating.rating_id = params[:rating_id]\n user_rating.user_id = current_user.id\n\n if user_rating.save\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n if current_user.provider == 'twitter' && current_user.facebook_share\n current_user.twitter.update(\"I've rated an idea on #Idearator ! available on: \" + root_url + \"ideas/\" + idea.id.to_s) rescue Twitter::Error\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea, :notice => 'Your rating has been saved successfully!' }\n format.js\n end\n else\n respond_to do |format|\n format.html { redirect_to idea, :alert => 'Your rating has not been saved, please retry!' }\n format.js\n end\n end\n end",
"def create\n @team_rating = TeamRating.new(params[:team_rating])\n\n respond_to do |format|\n if @team_rating.save\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully created.' }\n format.json { render json: @team_rating, status: :created, location: @team_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rating_params\n\t\tparams.require(:rating).permit(:ratable, :score, :user)\n\tend",
"def rate_post\n render nothing: true\n\n post = Post.find(params[:id])\n\n assert(@post.kind_of?(Post))\n\n if not post.user_ratings.include? current_user.id\n post.user_ratings.push(current_user.id)\n post.save\n else\n redirect_to_back(root_path)\n end\n end",
"def game_params\n params\n .require(:data)\n .require(:attributes)\n .permit(\n :game_id,\n :game_name,\n :rating\n )\n end",
"def create\n @rating_alt = Rating.new(params[:rating_alt])\n\n respond_to do |format|\n if @rating_alt.save\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully created.' }\n format.json { render json: @rating_alt, status: :created, location: @rating_alt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @effort_rating = @opportunity.effort_ratings.new(effort_rating_params)\n\n respond_to do |format|\n if @effort_rating.save\n @opportunity.effort_rating = @opportunity.effort_ratings.average(:rating)\n @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Effort rating was successfully created.' }\n format.json { render :show, status: :created, location: @effort_rating }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rating_params\n params[:rating]\n end",
"def create\n # @user = User.find_or_create_by(user_id: @user.id)\n \n @movie = Movie.find_or_create_by(imdbID: params[:imdbID], poster: params[:poster], title: params[:title])\n @rating = Rating.where(movie_id: @movie.id, user_id: logged_in_user.id).first_or_create do |rating|\n rating.score = rating_params[:score]\n rating.comment = rating_params[:comment]\n end\n render json: @rating\n end",
"def update\n respond_to do |format|\n if @game_rating.update(game_rating_params)\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_rating }\n else\n format.html { render :edit }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rating_params\n params.require(:rating).permit(:value)\n end"
] | [
"0.7197672",
"0.7022388",
"0.6925746",
"0.67633516",
"0.6507356",
"0.6348106",
"0.63153785",
"0.6305905",
"0.6299254",
"0.62990385",
"0.6297955",
"0.6293861",
"0.6279696",
"0.62654066",
"0.6264876",
"0.6251327",
"0.62446856",
"0.62214065",
"0.62188613",
"0.62092495",
"0.6187703",
"0.6183027",
"0.61332226",
"0.61138177",
"0.6101093",
"0.6099651",
"0.60921884",
"0.608915",
"0.6087225",
"0.6042385"
] | 0.7137196 | 1 |
PATCH/PUT /game_ratings/1 PATCH/PUT /game_ratings/1.json | def update
respond_to do |format|
if @game_rating.update(game_rating_params)
format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }
format.json { render :show, status: :ok, location: @game_rating }
else
format.html { render :edit }
format.json { render json: @game_rating.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def update\n @app = App.find(params[:id])\n \n respond_to do |format|\n if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating_alt.update_attributes(params[:rating_alt])\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n if @team_rating.update_attributes(params[:team_rating])\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea_rating.update(idea_rating_params)\n format.html { redirect_to idea_ratings_path(:idea_id => @idea_rating.idea_id), notice: (I18n.t :act_update) }\n format.json { render :show, status: :ok, location: @idea_rating }\n calc_idea_rating\n else\n format.html { render :edit }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end",
"def update\n @recipe.average_rating = @recipe.ratings.average(:rate)\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = current_user.user_ratings.find_by_rating_id(params[:rating_id])\n\n if user_rating.update_attributes(params[:rating])\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :notice => 'Your rating has been updated successfully!' }\n format.js { render text: \"\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :alert => 'Your rating has not been updated, please retry!' }\n format.js { render text: \"\" }\n end\n end\n end",
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def update\n respond_to do |format|\n if @rating_score.update(rating_score_params)\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_score }\n else\n format.html { render :edit }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n if @participant_rating.update_attributes(params[:participant_rating])\n format.html { redirect_to @participant_rating, notice: 'Participant rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tp \"UPDATE rating\"\n if current_user.nil?\n\t\t\tflash.now[:error] = 'You must be signed in to specify a rating.'\n else\n\t\t\t@rating.ratable = @ratable\n\t\t\t@rating.user = current_user\n\t if @rating.update_attributes(score: params[:score])\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.js { render :nothing => true }\n\t\t\t\tend\n\t else\n\t\t\t\tflash[:error] = \"Something went wrong. Please try again.\"\n\t end\n end\n end",
"def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end",
"def update_ratings\n tournament.rater.update_ratings(self)\n end",
"def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end",
"def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n @rating.update_attribute :value, params[:value]\n end",
"def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end",
"def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @review.update(review_params)\n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :ok\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rating_params\n params.require(:rating).permit(:score, :game_id)\n end",
"def update\n respond_to do |format|\n if @engine_rating.update(engine_rating_params)\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @engine_rating }\n else\n format.html { render :edit }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @rating = Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :edit }\n end\n end\n end"
] | [
"0.70348614",
"0.6950785",
"0.6945379",
"0.69256663",
"0.6916264",
"0.6839343",
"0.67661744",
"0.6760663",
"0.6705841",
"0.67040485",
"0.66811776",
"0.6667291",
"0.66468287",
"0.6590141",
"0.6578216",
"0.65491855",
"0.65368575",
"0.6528095",
"0.65101016",
"0.65097815",
"0.65066546",
"0.64822674",
"0.6474212",
"0.64452493",
"0.64313775",
"0.64281845",
"0.639698",
"0.63941044",
"0.6380002",
"0.63640726"
] | 0.7391049 | 0 |
DELETE /game_ratings/1 DELETE /game_ratings/1.json | def destroy
@game_rating.destroy
respond_to do |format|
format.html { redirect_to game_ratings_url, notice: 'Game rating was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating_alt = Rating.find(params[:id])\n @rating_alt.destroy\n\n respond_to do |format|\n format.html { redirect_to rating_alts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @idea_rating.destroy\n respond_to do |format|\n format.html { redirect_to idea_ratings_url, notice: (I18n.t :act_delete) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_rating = TeamRating.find(params[:id])\n @team_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to team_ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(ratings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant_rating = ParticipantRating.find(params[:id])\n @participant_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @building_energy_rating.destroy\n respond_to do |format|\n format.html { redirect_to building_energy_ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant_table_rating.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_table_ratings_url, notice: 'Restaurant table rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating_score.destroy\n respond_to do |format|\n format.html { redirect_to rating_scores_url, notice: 'Rating score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_rating = SchoolRating.find(params[:id])\n @school_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to school_ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m_rating = MRating.find(params[:id])\n @m_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(m_ratings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.destroy\n flash[:success] = \"Rating has been successfully deleted!\"\n redirect_to skate_spot_path(@skate_spot)\n else\n flash[:danger] = \"Deletion unsuccessful. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end",
"def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end",
"def destroy\n @rating.destroy\n respond_to do |format|\n format.html {redirect_to ratings_url, notice: 'Payment was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @album_rating.destroy\n respond_to do |format|\n format.html { redirect_to album_ratings_url, notice: 'Album rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reviews_and_rating.destroy\n respond_to do |format|\n format.html { redirect_to reviews_and_ratings_url, notice: 'Reviews and rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_score = GameScore.find(params[:id])\n @game_score.destroy\n\n respond_to do |format|\n format.html { redirect_to game_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @effort_rating.destroy\n respond_to do |format|\n format.html { redirect_to effort_ratings_url, notice: 'Effort rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @confidence_rating.destroy\n respond_to do |format|\n format.html { redirect_to confidence_ratings_url, notice: 'Confidence rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @engine_rating.destroy\n respond_to do |format|\n format.html { redirect_to engine_ratings_url, notice: 'Engine rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n review = Review.find_by(id: params[:id]).destroy\n render json: review\n end",
"def destroy\n @gym_rat.destroy\n respond_to do |format|\n format.html { redirect_to gym_rats_url, notice: \"Gym rat was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n\n end\n end",
"def destroy\n @user = current_user\n @review_like = ReviewLike.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end",
"def destroy\n @create_rating = CreateRating.find(params[:id])\n @create_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(create_ratings_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7305474",
"0.72226065",
"0.7190627",
"0.71213555",
"0.70387083",
"0.6971562",
"0.68876237",
"0.6873108",
"0.6873108",
"0.6868143",
"0.6737254",
"0.6698981",
"0.6692994",
"0.66805327",
"0.6652504",
"0.66397953",
"0.6626312",
"0.6609389",
"0.66038406",
"0.6589429",
"0.65847033",
"0.65831065",
"0.65513694",
"0.6544706",
"0.65387106",
"0.65330833",
"0.6524488",
"0.6516577",
"0.64800906",
"0.647503"
] | 0.74243283 | 0 |
GET /post316s/1 GET /post316s/1.xml | def show
@post316 = Post316.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post316 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post306 = Post306.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post306 }\n end\n end",
"def show\n @post154 = Post154.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post154 }\n end\n end",
"def show\n @post150 = Post150.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post150 }\n end\n end",
"def show\n @post156 = Post156.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post156 }\n end\n end",
"def show\n @post157 = Post157.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post157 }\n end\n end",
"def show\n @post295 = Post295.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post295 }\n end\n end",
"def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def show\n @post260 = Post260.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post260 }\n end\n end",
"def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end",
"def show\n @post168 = Post168.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post168 }\n end\n end",
"def show\n @post174 = Post174.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post174 }\n end\n end",
"def show\n @post149 = Post149.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post149 }\n end\n end",
"def show\n @post227 = Post227.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post227 }\n end\n end",
"def show\n @post217 = Post217.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post217 }\n end\n end",
"def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end",
"def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end",
"def show\n @post318 = Post318.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post318 }\n end\n end",
"def show\n @post310 = Post310.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post310 }\n end\n end",
"def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end",
"def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end",
"def show\n @post110 = Post110.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post110 }\n end\n end",
"def show\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post275 }\n end\n end",
"def show\n @post350 = Post350.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post350 }\n end\n end",
"def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end",
"def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end",
"def show\n @post470 = Post470.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post470 }\n end\n end",
"def show\n @post139 = Post139.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post139 }\n end\n end",
"def show\n @post183 = Post183.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post183 }\n end\n end",
"def show\n @post276 = Post276.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post276 }\n end\n end",
"def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end"
] | [
"0.65667033",
"0.64826024",
"0.6475384",
"0.6451592",
"0.6415183",
"0.6383217",
"0.6381178",
"0.63731956",
"0.63688684",
"0.6352993",
"0.63419676",
"0.63406247",
"0.6333633",
"0.63286227",
"0.6324045",
"0.6321663",
"0.63183653",
"0.6312433",
"0.6309652",
"0.63031256",
"0.6301286",
"0.6292762",
"0.62917995",
"0.62916595",
"0.6289473",
"0.6289294",
"0.6279389",
"0.62765884",
"0.62760705",
"0.62726945"
] | 0.6583203 | 0 |
GET /post316s/new GET /post316s/new.xml | def new
@post316 = Post316.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post316 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post306 = Post306.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post306 }\n end\n end",
"def new\n @post227 = Post227.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post227 }\n end\n end",
"def new\n @post101 = Post101.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post101 }\n end\n end",
"def new\n @post310 = Post310.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post310 }\n end\n end",
"def new\n @post156 = Post156.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post156 }\n end\n end",
"def new\n @post217 = Post217.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post217 }\n end\n end",
"def new\n @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def new\n @post154 = Post154.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post154 }\n end\n end",
"def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\n end\n end",
"def new\n @post150 = Post150.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post150 }\n end\n end",
"def new\n @post295 = Post295.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post295 }\n end\n end",
"def new\n @post149 = Post149.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post149 }\n end\n end",
"def new\n @post168 = Post168.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post168 }\n end\n end",
"def new\n @post260 = Post260.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post260 }\n end\n end",
"def new\n @post297 = Post297.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post297 }\n end\n end",
"def new\n @post197 = Post197.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post197 }\n end\n end",
"def new\n @post78 = Post78.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post78 }\n end\n end",
"def new\n @post350 = Post350.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post350 }\n end\n end",
"def new\n @post275 = Post275.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post275 }\n end\n end",
"def new\n @post215 = Post215.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post215 }\n end\n end",
"def new\n @post110 = Post110.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post110 }\n end\n end",
"def new\n @post328 = Post328.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post328 }\n end\n end",
"def new\n @post342 = Post342.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post342 }\n end\n end",
"def new\n @post184 = Post184.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post184 }\n end\n end",
"def new\n @post182 = Post182.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post182 }\n end\n end",
"def new\n @post55 = Post55.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def new\n @post105 = Post105.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post105 }\n end\n end",
"def new\n @post50 = Post50.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post50 }\n end\n end",
"def new\n @post139 = Post139.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post139 }\n end\n end",
"def new\n @post74 = Post74.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post74 }\n end\n end"
] | [
"0.7530846",
"0.7428117",
"0.7421778",
"0.7418029",
"0.74089366",
"0.74083734",
"0.7403376",
"0.7396353",
"0.7396012",
"0.73938376",
"0.7392765",
"0.739177",
"0.73851305",
"0.73619413",
"0.7353478",
"0.73423994",
"0.7336948",
"0.7336151",
"0.73351943",
"0.7330803",
"0.7321566",
"0.7318745",
"0.7312947",
"0.73111683",
"0.73100954",
"0.73100114",
"0.7308883",
"0.730667",
"0.72896135",
"0.72838265"
] | 0.7545023 | 0 |
POST /post316s POST /post316s.xml | def create
@post316 = Post316.new(params[:post316])
respond_to do |format|
if @post316.save
format.html { redirect_to(@post316, :notice => 'Post316 was successfully created.') }
format.xml { render :xml => @post316, :status => :created, :location => @post316 }
else
format.html { render :action => "new" }
format.xml { render :xml => @post316.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @post154 = Post154.new(params[:post154])\n\n respond_to do |format|\n if @post154.save\n format.html { redirect_to(@post154, :notice => 'Post154 was successfully created.') }\n format.xml { render :xml => @post154, :status => :created, :location => @post154 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post154.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post168 = Post168.new(params[:post168])\n\n respond_to do |format|\n if @post168.save\n format.html { redirect_to(@post168, :notice => 'Post168 was successfully created.') }\n format.xml { render :xml => @post168, :status => :created, :location => @post168 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post168.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post156 = Post156.new(params[:post156])\n\n respond_to do |format|\n if @post156.save\n format.html { redirect_to(@post156, :notice => 'Post156 was successfully created.') }\n format.xml { render :xml => @post156, :status => :created, :location => @post156 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post156.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post157 = Post157.new(params[:post157])\n\n respond_to do |format|\n if @post157.save\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully created.') }\n format.xml { render :xml => @post157, :status => :created, :location => @post157 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post157.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post306 = Post306.new(params[:post306])\n\n respond_to do |format|\n if @post306.save\n format.html { redirect_to(@post306, :notice => 'Post306 was successfully created.') }\n format.xml { render :xml => @post306, :status => :created, :location => @post306 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post306.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post174 = Post174.new(params[:post174])\n\n respond_to do |format|\n if @post174.save\n format.html { redirect_to(@post174, :notice => 'Post174 was successfully created.') }\n format.xml { render :xml => @post174, :status => :created, :location => @post174 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post174.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post310 = Post310.new(params[:post310])\n\n respond_to do |format|\n if @post310.save\n format.html { redirect_to(@post310, :notice => 'Post310 was successfully created.') }\n format.xml { render :xml => @post310, :status => :created, :location => @post310 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post310.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @post318 = Post318.new(params[:post318])\n\n respond_to do |format|\n if @post318.save\n format.html { redirect_to(@post318, :notice => 'Post318 was successfully created.') }\n format.xml { render :xml => @post318, :status => :created, :location => @post318 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post318.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post260 = Post260.new(params[:post260])\n\n respond_to do |format|\n if @post260.save\n format.html { redirect_to(@post260, :notice => 'Post260 was successfully created.') }\n format.xml { render :xml => @post260, :status => :created, :location => @post260 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post260.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post150 = Post150.new(params[:post150])\n\n respond_to do |format|\n if @post150.save\n format.html { redirect_to(@post150, :notice => 'Post150 was successfully created.') }\n format.xml { render :xml => @post150, :status => :created, :location => @post150 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post150.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend",
"def create\n @post275 = Post275.new(params[:post275])\n\n respond_to do |format|\n if @post275.save\n format.html { redirect_to(@post275, :notice => 'Post275 was successfully created.') }\n format.xml { render :xml => @post275, :status => :created, :location => @post275 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post275.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post217 = Post217.new(params[:post217])\n\n respond_to do |format|\n if @post217.save\n format.html { redirect_to(@post217, :notice => 'Post217 was successfully created.') }\n format.xml { render :xml => @post217, :status => :created, :location => @post217 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post217.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post215 = Post215.new(params[:post215])\n\n respond_to do |format|\n if @post215.save\n format.html { redirect_to(@post215, :notice => 'Post215 was successfully created.') }\n format.xml { render :xml => @post215, :status => :created, :location => @post215 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post215.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def create\n @post272 = Post272.new(params[:post272])\n\n respond_to do |format|\n if @post272.save\n format.html { redirect_to(@post272, :notice => 'Post272 was successfully created.') }\n format.xml { render :xml => @post272, :status => :created, :location => @post272 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post272.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post295 = Post295.new(params[:post295])\n\n respond_to do |format|\n if @post295.save\n format.html { redirect_to(@post295, :notice => 'Post295 was successfully created.') }\n format.xml { render :xml => @post295, :status => :created, :location => @post295 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post295.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post328 = Post328.new(params[:post328])\n\n respond_to do |format|\n if @post328.save\n format.html { redirect_to(@post328, :notice => 'Post328 was successfully created.') }\n format.xml { render :xml => @post328, :status => :created, :location => @post328 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post328.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post184 = Post184.new(params[:post184])\n\n respond_to do |format|\n if @post184.save\n format.html { redirect_to(@post184, :notice => 'Post184 was successfully created.') }\n format.xml { render :xml => @post184, :status => :created, :location => @post184 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post184.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postSyndication_submissionProcessed( syndication_submission_id)\n params = Hash.new\n params['syndication_submission_id'] = syndication_submission_id\n return doCurl(\"post\",\"/syndication_submission/processed\",params)\n end",
"def create\n @post472 = Post472.new(params[:post472])\n\n respond_to do |format|\n if @post472.save\n format.html { redirect_to(@post472, :notice => 'Post472 was successfully created.') }\n format.xml { render :xml => @post472, :status => :created, :location => @post472 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post472.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post276 = Post276.new(params[:post276])\n\n respond_to do |format|\n if @post276.save\n format.html { redirect_to(@post276, :notice => 'Post276 was successfully created.') }\n format.xml { render :xml => @post276, :status => :created, :location => @post276 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post276.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def create\n @post181 = Post181.new(params[:post181])\n\n respond_to do |format|\n if @post181.save\n format.html { redirect_to(@post181, :notice => 'Post181 was successfully created.') }\n format.xml { render :xml => @post181, :status => :created, :location => @post181 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post181.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post297 = Post297.new(params[:post297])\n\n respond_to do |format|\n if @post297.save\n format.html { redirect_to(@post297, :notice => 'Post297 was successfully created.') }\n format.xml { render :xml => @post297, :status => :created, :location => @post297 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post297.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post267 = Post267.new(params[:post267])\n\n respond_to do |format|\n if @post267.save\n format.html { redirect_to(@post267, :notice => 'Post267 was successfully created.') }\n format.xml { render :xml => @post267, :status => :created, :location => @post267 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post267.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post78 = Post78.new(params[:post78])\n\n respond_to do |format|\n if @post78.save\n format.html { redirect_to(@post78, :notice => 'Post78 was successfully created.') }\n format.xml { render :xml => @post78, :status => :created, :location => @post78 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post78.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.59064585",
"0.5880296",
"0.57913655",
"0.578824",
"0.5699257",
"0.56484497",
"0.5628692",
"0.5627111",
"0.5621102",
"0.56096923",
"0.5598626",
"0.55933845",
"0.5591631",
"0.55877405",
"0.55799884",
"0.5578797",
"0.55697846",
"0.55695444",
"0.5567126",
"0.55658454",
"0.55617213",
"0.55605906",
"0.5552973",
"0.55460757",
"0.5544655",
"0.55399513",
"0.55297107",
"0.55287087",
"0.5528404",
"0.5528044"
] | 0.63874596 | 0 |
Place Order POST /orders Recurring order start from the day you place them Assuming Resturant sent belongs to the user region only | def create
order_params = (place_order_params)
order_params[:customer_id] = current_user.customer_id
@order = Order.new(order_params)
if @order.recurring?
if((Time.now + 1.hour).strftime('%H:%M:%S') <= (Time.parse(@order.place_date + ' ' + @order.timeslot.start)).strftime('%H:%M:%S') && !@order.completed? )
# Add the auto generated entry
@order.category = 'single'
@order.created_by = 'auto'
@order.save!
end
# Improve this
if Order.create!(order_params)
render json: @order, status: 201
else
render json: {'errors': ['Order can no be placed']}, status: :unprocessable_entity
end
else
if (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && @order.save!
render json: @order, status: 201
else
render json: {'errorrs': ['Order can not be placed']}, status: :unprocessable_entity
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_order_date\n @booked_quotes = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: nil) + Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Booked\").where(wholesale_order_date: nil)\n for booked_quote in @booked_quotes\n if params[\"place_order-#{booked_quote.id}\"]\n booked_quote.status = \"Ordered\"\n #booked_quote.wholesale_order_date = Date.civil(params[:place_order_on][\"element(1i)\"].to_i, params[:place_order_on][\"element(2i)\"].to_i, params[:place_order_on][\"element(3i)\"].to_i)\n booked_quote.wholesale_order_date = params[\"place_order_on\"]\n booked_quote.save!\n else\n end\n end\n redirect_to \"/wholesale_order_list/#{params[\"place_order_on\"]}\" and return\n end",
"def new_order(params = {})\r\n params = { :created => Date.today, :turnaround_year => \"2007\" }.merge(params)\r\n if self.requesting?\r\n self.requested_orders.build({ :date_requested => Date.today.to_s(:db) }.merge(params))\r\n elsif self.planning?\r\n self.planned_orders.build(params)\r\n else\r\n Order.new(params)\r\n end\r\n end",
"def create_order(options)\n request :account, :post, 'order', options\n end",
"def create\n @order = current_user.orders.build(:order_date => DateTime.now, :status => 'Pending')\n\n respond_to do |format|\n if @order.save\n @cart.line_items.each do |line_item| \n\n @orderitem = @order.order_items.create!(\n record_id: line_item.record_id,\n quantity: line_item.quantity,\n title: line_item.record.title,\n artist: line_item.record.artist,\n price: line_item.record.price,\n year: line_item.record.year,\n )\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end",
"def complete_order\n @tire_listing = TireListing.find(params[:tire_listing_id])\n\n if !@tire_listing.can_do_ecomm?\n redirect_to @tire_listing, notice: \"Those tires are not eligible for online purchase.\"\n end\n\n @ar_months = Date::MONTHNAMES.each_with_index.collect{|m, i| [m, i.to_s.rjust(2, '0')]}\n @ar_years = [*Date.today.year..Date.today.year + 8]\n\n @qty = params[:qty].to_i\n @order = Order.new(:tire_listing_id => @tire_listing.id, :tire_quantity => @qty)\n @order.status = order_status_array[:created]\n @order.calculate_total_order\n @order.buyer_email = @order.buyer_name = @order.buyer_address1 = @order.buyer_city = @order.buyer_state = @order.buyer_zip = \"unknown\" # to prevent null error\n initialize_order\n @order.save\n end",
"def new_order_v1\n begin\n @parsed_json[\"order_items\"] ? order_items = @parsed_json[\"order_items\"] : nil\n @parsed_json[\"location_id\"] ? location_id = @parsed_json[\"location_id\"].to_i : nil\n location = Location.find_by_id(location_id)\n tax = location.tax #look up tax of location manually\n if location.nil? || location_id.nil? || order_items.nil? || tax.nil?\n return render :status => 404, :json => {:status => :failed, :error => \"Resource not found\"}\n end\n ActiveRecord::Base.transaction do\n if Order.is_current(@user.id, location)\n current_order = Order.find_by_user_id_and_location_id_and_is_paid_and_is_cancel(@user.id, location.id, 0, 0)\n ordered_date = current_order.created_at\n if current_order.order_items.length > 0\n ordered_date = Time.now.utc\n end\n\n order_item = OrderItem.add_new_item_v1(order_items, current_order)\n\n # re-calculate sub_price of order\n sub_price = Order.calculate_sub_price(current_order)\n fee = location.service_fee_type=='fixed'? location.fee : sub_price / 100 * location.fee\n\n if !order_item.prize_id.nil? && order_item.is_prize_item == 1\n current_order.update_attributes!(\n :location_id => location.id,\n :tax => tax,\n :fee => fee,\n :created_at => ordered_date,\n :status => 1,\n :sub_price => sub_price\n )\n else\n current_order.update_attributes!(\n :location_id => location.id,\n :tax => tax,\n :fee => fee,\n :created_at => ordered_date,\n :sub_price => sub_price\n )\n end\n\n if current_order.in_order?\n current_order.update_attributes!(:status => 2)\n end\n\n total_price = Order.calculate_total_price(current_order)\n current_order.update_attribute('total_price', total_price)\n\n return render :status => 200,\n :json => {\n :status => :success,\n :order_id => current_order.id,\n :order_item_id => order_item.id,\n :order_item_status => order_item.status\n }\n else # this is a brand-new Order\n today_orders = Order.where('created_at > ?', Time.now.strftime(\"%Y-%m-%d\")+\" 00:00:00\")\n\n new_order = Order.new\n new_order.user_id = @user.id\n new_order.tax = tax\n new_order.location_id = location.id\n new_order.timezone = location.timezone\n new_order.receipt_day_id = Order.next_receipt_no(location)\n new_order.ticket = today_orders.count+1\n order_item = OrderItem.add_new_item_v1(order_items, new_order)\n # if user added a prize item to cart, status of cart would be changed to ordered\n if !order_item.prize_id.nil? && order_item.is_prize_item == 1\n new_order.status = 1\n end\n sub_price = Order.calculate_sub_price(new_order)\n new_order.sub_price = sub_price\n new_order.total_tax = sub_price * tax\n new_order.total_tip = -2\n new_order.tip_percent = 0.16\n new_order.fee = location.service_fee_type=='fixed'? location.fee : sub_price / 100 * location.fee\n new_order.save!\n\n total_price = Order.calculate_total_price(new_order)\n new_order.update_attribute('total_price', total_price)\n # Automatically check the user in at this location (to allow item grading)\n @user.checkin_at(location, false)\n\n return render :status => 200,\n :json => {\n :status => :success,\n :order_id => new_order.id,\n :order_item_id => order_item.id,\n :order_item_status => order_item.status\n }\n end\n end\n rescue\n return render :status => 500, :json => {:status => :failed, :error => \"Internal Service Error\"}\n end\n end",
"def create_order(order)\n @queue.enqueue(order)\n end",
"def schedule_order_date\n @booked_quotes = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: nil) + Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Booked\").where(wholesale_order_date: nil)\n render(:schedule_order_date) and return\n end",
"def create_order(order)\n # response = post(\n # 'peatio/market/orders',\n # {\n # market: order.market.downcase,\n # side: order.side.to_s,\n # volume: order.amount,\n # price: order.price\n # }\n # )\n\n return if order.amount < 1e-8\n od = build_order(order)\n return if od.nil?\n\n# Arke::Log.debug \"Skip order creation #{od.to_json}\\n#{order.inspect}\"\n Ordering.new(od).submit\n @open_orders.add_order(order, od.id) if od.id\n Arke::Log.debug \"Order created #{od.to_json}\"\n\n # @open_orders.add_order(order, response.env.body['id']) if response.env.status == 201 && response.env.body['id']\n\n # response\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n # brb WET code.\n @order[:queue_total] = @order.get_queue_total \n @order[:queue_place] = @order.get_queue_place(@order)\n @order[:wait_time] = StoreConfig.find('avg_wait_time').value\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order()\n\t{\n\t\t\"destination\" => {\n\t\t\t\"name\" => \"hp.jpeng\"\n\t\t},\n\t\t\"orderData\" => {\n\t\t\t\"sourceOrderId\" => [*('A'..'Z')].sample(8).join,\n\t\t\t\"items\" => [{\n\t\t\t\t\"sourceItemId\" => [*('A'..'Z')].sample(8).join,\n\t\t\t\t\"sku\" => \"Flat\",\n\t\t\t\t\"quantity\" => 1,\n\t\t\t\t\"components\" => [{\n\t\t\t\t\t\"code\" => \"Content\",\n\t\t\t\t\t\"path\" => \"https://Server/Path/business_cards.pdf\",\n\t\t\t\t\t\"fetch\" => \"true\",\n\t\t\t\t\t# \"route\" => [{\n\t\t\t\t\t# \t\t\"name\" => \"Print\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\t\t#eventTypeId found within Site Flow -> Events\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Cut\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Laminate\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Finish\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# }]\n\t\t\t\t}],\n\t\t\t}],\n\t\t\t\"shipments\" => [{\n\t\t\t\t\"shipTo\" => {\n\t\t\t\t\t\"name\" => \"John Doe\",\n\t\t\t\t\t\"address1\" => \"5th Avenue\",\n\t\t\t\t\t\"town\" => \"New York\",\n\t\t\t\t\t\"postcode\" => \"12345\",\n\t\t\t\t\t\"state\" => \"New York\",\n\t\t\t\t\t\"isoCountry\" => \"US\",\n\t\t\t\t\t\"email\" => \"johnd@acme.com\",\n\t\t\t\t\t\"phone\" => \"01234567890\"\n\t\t\t\t},\n\t\t\t\t\"carrier\" => {\n\t\t\t\t\t\"code\" => \"customer\",\n\t\t\t\t\t\"service\" => \"shipping\"\n\t\t\t\t}\n\t\t\t}]\n\t\t}\n\t}.to_json()\nend",
"def next_recurring_order\n if actual_order = self.last_active_recurring_order\n self.orders.recurring.find(:all, :conditions => [\"orders.id > ?\", actual_order.id],\n :order => \"orders.id ASC\").first\n end\n end",
"def create\n @order = Order.new(\n quantity:params[:order][:quantity],\n item_id:params[:order][:item_id],\n requester: current_member,\n requested_at:Time.now,\n approver:Member.find(1),\n approved_at: nil,\n deadline: nil,\n returned:false)\n\n respond_to do |format|\n if @order.save\n #it may become negative to simulate real life scenarios\n @item = @order.item\n @item.update(units:@item.units-@order.quantity)\n format.html { redirect_to orders_path, notice: \"Order was successfully created.\" }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_start_order\n @start_order = StartOrder.find(params[:id])\n end",
"def start_recurring_payment\n return unless recurring_period.present?\n run_at = nil\n if recurring_period.to_s.is_i? # each custom days\n run_at = recurring_period.to_i.days.from_now\n # run_at = recurring_period.to_i.minutes.from_now\n else\n case recurring_period\n when 'daily'\n run_at = 1.day.from_now\n when 'weekly'\n run_at = 7.days.from_now\n when 'monthly'\n run_at = 1.month.from_now\n when 'quarterly'\n run_at = 3.months.from_now\n when 'biannually'\n run_at = 6.months.from_now\n when 'yearly'\n run_at = 1.year.from_now\n end\n end\n Delayed::Job.enqueue(LongTasks::RecurringPaymentNotification.new(id), run_at: run_at - 1.day) if run_at && ['tithe', 'partnership'].include?(goal)\n Delayed::Job.enqueue(LongTasks::RecurringPayment.new(id), run_at: run_at) if run_at\n end",
"def create!\n recs = \"<data>\n <event>\n <cid>#{self.customer.cid}</cid>\n <nm>#{self.description}</nm>\n <dur>#{self.duration}</dur>\n <schd>#{self.scheduled ? 1 : 0}</schd>\n <start_epoch>#{self.start_time}</start_epoch>\n <lid>#{self.location.id}</lid>\n <cntid>#{0}</cntid>\n <rid>#{self.worker}</rid>\n <dtl>#{self.summary}</dtl>\n <po>#{self.purchase_order}</po>\n </event>\n </data>\"\n data = Aceroute::call_api(\"order.create\", recs)\n order = data.event\n update_attrs(order)\n return self\n end",
"def create\n cart = Cart.find_by(user_id: @current_user.id)\n order = Order.new(user_id: @current_user.id,\n date: DateTime.now,\n delivery_address: @current_user.role == \"user\" ? @current_user.addresses.find_by(delivery_address: true).address : \"Walk-in-customer\",\n is_cancel: false,\n total_amount: cart.cart_items.sum(:temp_price))\n if (order.save!)\n cart.cart_items.all.each do |cart_item|\n OrderItem.create!(\n order_id: order.id,\n menu_item_id: cart_item.menu_item_id,\n menu_item_name: cart_item.menu_item_name,\n menu_item_price: cart_item.menu_item_price,\n quantity: cart_item.quantity,\n )\n end\n cart.cart_items.destroy_all\n end\n redirect_to customer_order_details_path(order.id)\n end",
"def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_positions\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n if @order.save\n @order_positions.each do |op|\n op.container = @order\n op.save\n p = op.product\n p.availability -= op.amount\n p.save\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order(order)\n build_persisted_order(\n post('/market/orders', order.symbolize_keys.merge(side: SIDES_MAP.fetch(order.fetch(:side))))\n )\n end",
"def create\n @order = WebOrder.new(order_params)\n respond_to do |format|\n if @order.save\n @order.payments.create(total_paid: params[:initial], kind: :initial, date: @order.date) if params[:initial] && params[:initial].to_i != 0\n format.html { redirect_to order_path(@order.id), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { redirect_to new_order_path }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @start_order = StartOrder.new(start_order_params)\n respond_to do |format|\n if @start_order.save\n format.html { redirect_to @start_order, notice: 'Start order was successfully created.' }\n format.json { render :show, status: :created, location: @start_order }\n else\n format.html { render :new }\n format.json { render json: @start_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @order.single?\n if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && (!@order.completed? ) && @order.update(update_order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n else\n if(@order.update(update_order_params))\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n end\n end",
"def new_order_placed\n @order = params[:order]\n mail(to: \"pratap.sai99@gmail.com\", subject: \"New Order Placed\")\n end",
"def create\n @order = current_member.orders.build(order_params)\n @line_items = current_member.line_items.where(\"id in (?)\", params[:line_items])\n @order.status = 'opening'\n @order.total_price = 0\n @line_items.each do |line_item|\n @order.total_price += (line_item.product.price * line_item.quantity)\n end\n @order.receivable = @order.total_price\n\n respond_to do |format|\n if @order.save\n @line_items.each do |line_item|\n line_item.order_id = @order.id\n line_item.save\n end\n format.html { redirect_to @order, notice: '你的订单已经生成,确认无误后可以支付!' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_route\n type = OrderType.find_by_name('route')\n \n hwb = Order.find(params[:id])\n \n data = params[\"route\"]\n data[\"parent_id\"] = params[:id]\n \n data[\"created_by\"] = self.current_user.account # <-- hardcoded to Transmance compnay id\n data[\"order_type_id\"] = type.id\n data[\"bill_to_id\"] = 1 # <-- hacked to Transmanage company id\n data[\"billing_method_id\"] = 1 # <-- read this from db!!!!!!!!!!!!!!\n data[\"shipping_method_id\"] = 1 # <-- hardcoded.\n data[\"pieces\"] = 1\n data[\"declared_value\"] = 0\n data[\"purpose\"] = ''\n data[\"weight\"] = 0\n data[\"shipping_commodity_id\"] = 1\n\n res = {\n :success => false,\n :data => [],\n :msg => ''\n }\n\n Order.transaction do \n # super can handle it from here...\n order = Order.create(data)\n \n # get OrderTypeEntity list\n entities = order.type.entities(:include => [:domain])\n \n case params[\"pickup_mode\"]\n when \"shipper\" \n params[\"shipper\"] = {\"company_id\" => Order.find(params[:id]).find_entity_by_type(\"shipper\").company.id}\n when \"carrier\"\n params[\"shipper\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]} \n end\n \n case params[\"delivery_mode\"]\n when \"carrier\"\n params[\"consignee\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]}\n end\n entities.each do |e| \n data = params[e.name] \n case e.name\n when \"shipper\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['origin_airport_id']} AND company_id = #{params['shipper']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"shipper\"][\"company_id\"], hwb.find_entity_by_type('shipper').location)\n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_in\"] + ' ' + params[\"carrier\"][\"time_in\"]\n when \"consignee\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['destination_airport_id']} AND company_id = #{params['consignee']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"consignee\"][\"company_id\"], hwb.find_entity_by_type('consignee').location) \n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_out\"] + ' ' + params[\"carrier\"][\"time_out\"]\n when \"carrier\" \n data[:company_location_id] = Company.find(params[\"carrier\"][\"company_id\"], :include => [:head_office]).head_office.id \n end\n data[:order_id] = order.id\n data[:order_type_entity_id] = e.id \n oe = OrderEntity.create(data)\n end\n \n res[:success] = true\n res[:data] = {:route => Order.render_route(order)}\n res[:msg] = 'Added order route' \n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def place_order\n @browser.div(:id, \"checkout-step-review\").button(:text, \"Place Order\").click\n seconds = 0.10\n until @browser.text.include?(\"Your order has been received\") do\n sleep 0.10\n seconds += 0.5\n end\n puts \"I waited #{seconds} seconds\"\n #final code dependant assertion\n assert(@browser.button(:title,'Continue Shopping').enabled?)\n # assert_section 'success'\n end",
"def new_order(params)\n camelcase_params!(params)\n call_api('NewOrder', params)\n end",
"def create\n # creates a new order which belongs to the current customer and contains fields which have values equal to\n # parameters accessed from the order_params hash\n @order = current_customer.orders.new(order_params)\n # sets the total_cost of the order to 0\n @order.total_cost = 0\n # calculates the total_cost of the order by calculating the sum of the cost of the line_items which the\n # basket that the current customer owns contains\n current_customer.basket.line_items.each do |item|\n # the total_cost of the order must be increased by the price of the game which the line_item belongs to\n @order.total_cost += item.game.price\n # the order_id of the line_item is equal to the id of the order which is currently being created\n item.order_id = Order.last.id + 1\n # the basket_id of the line_item is set to nil because the line_item is removed from the basket which\n # belongs to the current customer and is added to the order\n item.basket_id = nil\n # the total cost of the basket which the current customer owns is decreased by the price of the game which\n # the line_item belongs to\n current_customer.basket.total_cost -= item.game.price\n # if a game has been released, the delivery_date of the line_item is the next day\n # if a game has not been released, the delivery_date of the line_item is the release_date of the game\n # which the line_item belongs to\n if item.game.release_date <= Date.today\n # the delivery_date of the line_item is the next day\n item.delivery_date = Date.today + 1\n else\n # the delivery_date of the line_item is the release_date of the game which the line_item belongs to\n item.delivery_date = item.game.release_date\n end\n end\n\n respond_to do |format|\n # attempts to save the order\n if @order.save\n # if the order has successfully been saved, each line_item in the basket which the current customer\n # owns is saved because the value of the fields which the line_items contain is updated\n LineItem.transaction do\n current_customer.basket.line_items.each(&:save!)\n end\n # if the order has successfully been saved, the basket which the current customer owns is saved\n # because the total_cost of the basket is updated\n current_customer.basket.save\n # if the order has successfully been saved, the current customer should be redirected to the page which\n # shows the order that the current_customer has made.\n # shows a notice to the customer that the order has successfully been created\n format.html { redirect_to @order, notice: t('.notice') }\n format.json { render :show, status: :created, location: @order }\n else\n # if the order has not successfully been saved, the current customer should not be redirected to another\n # page and should be shown the errors which prevented the order from being saved\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.60226583",
"0.60044086",
"0.5978317",
"0.5932185",
"0.59172076",
"0.58884907",
"0.5885946",
"0.5857208",
"0.5855647",
"0.58469707",
"0.5816737",
"0.57520276",
"0.5719332",
"0.5710581",
"0.57015103",
"0.5701419",
"0.56888866",
"0.56853765",
"0.5673064",
"0.56502813",
"0.564854",
"0.5625553",
"0.5621545",
"0.5621353",
"0.5620566",
"0.5615196",
"0.5601533",
"0.5592171",
"0.5571766",
"0.55565774"
] | 0.71176016 | 0 |
Update order || Category can not be changed || Placed date || Time slot can not be changed |All ids are replaced| PATCH/PUT /orders/1 Assuming Resturant sent belongs to the user region only | def update
if @order.single?
if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && (!@order.completed? ) && @order.update(update_order_params) )
render json: @order, status: 200
else
render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity
end
else
if(@order.update(update_order_params))
render json: @order, status: 200
else
render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if params[:order][:taxis][:taxi_id].blank?\n orders_taxi.destroy if orders_taxi = OrdersTaxi.where([\"order_id = ?\", @order.id]).first\n else\n unless OrdersTaxi.where([\"order_id = ? AND taxi_id = ?\", @order.id, params[:order][:taxis][:taxi_id]]).first\n unless @order.taxis.blank?\n orders_taxi = OrdersTaxi.where([\"order_id = ?\", @order.id]).first\n orders_taxi.destroy\n end\n OrdersTaxi.create(order_id: @order.id, taxi_id: params[:order][:taxis][:taxi_id])\n end\n end\n\n respond_to do |format|\n params[:order][:assigned_at] = Time.now + params[:order][:assigned_at].to_i * 60 unless params[:order][:assigned_at].blank?\n if @order.update(order_params)\n # send_notification(@order) unless @order.assigned_at.blank? || @order.taxis.first.nil?\n format.html { redirect_to orders_path, notice: t(\"activerecord.models.order\") + t(\"messages.updated\") }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_order(order_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n set_groups\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n persist_order_address\n format.html { redirect_to [:admin, @order], notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id].to_s)\n render :status => 401 and return if not_my_vendor?(@order)\n if @order.paid == 1 and not $User.is_technician? then\n GlobalErrors.append(\"system.errors.cannot_edit_completed_order\",@order)\n end\n respond_to do |format|\n if (not @order.paid == 1 or $User.is_technician?) and @order.update_attributes(params[:order])\n format.html { redirect_to(@order, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_update_params)\n format.html { redirect_to @order, notice: 'Замовлення обновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @order\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Заявка была успешно обновлена.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params.except(:order_date))\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @order }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n @orders = Order.all\n @order = Order.find(params[:id])\n\n @order.update_attributes(order_params)\n\n=begin\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n authorize @order\n @company = @order.company\n\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to admin_company_order_path(@company, @order), notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n\n respond_to do |format|\n if @order.update_attributes(order_params)\n format.html { redirect_to [@group, @order], notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_url, notice: 'Dati commessa modificati.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit \n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n @order.save! unless @order.id\n puts \"\\n\\n\\n edit guest_token=[#{cookies.signed[:guest_token]}] order=[#{@order.to_json}] \\n\\n\\n\"\n associate_user \n\n @order.assign_default_addresses!\n puts \"\\n\\n\\n\\n edit assign_default_addresses good bill_address=[#{@order.bill_address}]\\n\\n\\n\\n\";\n @order.bill_address = User.find(1).bill_address.try(:clone) unless @order.bill_address\n puts \"\\n\\n\\n\\n edit bill_address good\\n\\n\\n\\n\";\n \n \n # if @order.next\n # puts \"\\n\\n\\n\\n edit order next good\\n\\n\\n\\n\";\n\n # else\n # puts \"\\n\\n\\n\\n edit order next bad\\n\\n\\n\\n\";\n # end\n \n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n\n if (@order[:state] == 'cart')\n if @order.next\n puts \"\\n\\n\\n\\n edit order next cart good\\n\\n\\n\\n\";\n else\n puts \"\\n\\n\\n\\n edit order next cart bad\\n\\n\\n\\n\";\n end\n else\n puts \"\\n\\n\\n\\n edit order state not eq cart\\n\\n\\n\\n\";\n end \n @order.ship_address = User.find(1).ship_address.try(:clone) unless @order.ship_address\n # @updating_params = {order: { bill_address_attributes: [{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"} ] } }\n \n # \n @order.shipments = Spree::Stock::Coordinator.new(@order).shipments unless @order.shipments&.count > 0\n @order.refresh_shipment_rates\n @order.set_shipments_cost\n @order.apply_free_shipping_promotions\n @order.available_payment_methods\n # @updating_params ||= {}\n # @updating_params[:order] ||= {bill_address_attributes:[{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"}]}\n # @updating_params[:order][:bill_address_attributes] ||= [{}]\n # @updating_params[:order][:bill_address_attributes].first[:city] = \"Kriviy Rih\"\n # @updating_params[:order][:bill_address_attributes].first[:country_id] = \"229\"\n # @updating_params[:order][:bill_address_attributes].first[:state_id] = \"2975\"\n # @updating_params[:order][:bill_address_attributes].first[:zipcode] = \"50015\"\n # if @order.update_from_params(@updating_params, permitted_checkout_attributes, request.headers.env)\n\n # end\n # @order.bill_address = user.bill_address.try(:clone)\n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n puts \"\\n\\n\\n edit shipments=[\"+@order.shipments.to_json+\"]\\n\\n\\n\\n\"\n puts \"\\n\\n\\n edit shipment_total=[\"+@order.shipment_total.to_json+\"]\\n\\n\\n\\n\"\n # puts \"\\n\\n\\n edit client_store_ref_path=[#{client_store_ref_path}] \\n\\n\\n\"\n # puts \"\\n\\n\\n edit packages=[\"+Spree::Stock::Coordinator.packages.to_json+\"]\\n\\n\\n\\n\"\n # flash[:error] = \"order1112=[\"+@order.to_json+\"]\\n\\n available_payment_methods=[\"+@order.available_payment_methods.to_json+\"]\"\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Замовлення поновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params)\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.mobile { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.mobile { render action: 'edit' }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if order.update(order_params)\n format.html { redirect_to order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @order.update(order_params)\n render :show, status: :ok, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n respond_to do |format|\n if @order.update_attributes(order_params.except!(:order_status_detail,:order_detail))\n if order_params[:order_detail].present?\n OrderDetail.process_order_details(@order,order_params[:order_detail])\n end\n OrderStatusDetail.change_order_status(@order, order_params[:order_status_detail])\n format.html { redirect_to @order, notice: 'Orden actualizada exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.71665585",
"0.6944809",
"0.6906992",
"0.6838878",
"0.68093055",
"0.6788424",
"0.6773653",
"0.6767925",
"0.67581916",
"0.6752395",
"0.6752395",
"0.67469424",
"0.67360055",
"0.6722087",
"0.6717004",
"0.6688588",
"0.6687143",
"0.6683587",
"0.6683047",
"0.66819257",
"0.6661239",
"0.6658909",
"0.66506374",
"0.66498125",
"0.6649299",
"0.6649299",
"0.6649299",
"0.6649299",
"0.6649299",
"0.6649299"
] | 0.77046275 | 0 |
get/order/customer_recurring_orders Gets All recurring order that are used to generate auto orders for a customer || Check status | def customer_recurring_orders
# 1 represents
@orders = Order.where(customer_id: current_user.customer_id, category: :recurring)
render json: @orders, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_orders(options)\n request :account, :get, 'allOrders', options\n end",
"def list_customer_orders\n orders = current_user.restaurant.orders.where.not(\"status = ? OR status = ? OR status = ? OR status = ?\", 2, 7, 8, 9)\n\n if orders.where(status: 6).length > 0 || orders.where(status: 0).length > 0\n render json: {orders: orders.as_json(include: :customer), notify: true}, status: :ok\n else\n render json: {orders: orders.as_json(include: :customer), notify: false}, status: :ok\n end\n end",
"def list_orders(code)\n PsegRecurring::Order.new(@credentials).fetch_orders(code)\n end",
"def index\n @orders = Order.all.order(:customer_id, :day_of_week)\n @customer_orders = @orders.select{|order| order.cancelled_on == nil }.group_by{|order| order.customer_id }\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def customer\n @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc)\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def query_order(options)\n request :account, :get, 'order', options\n end",
"def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end",
"def orders_including_customer\n Spree::Order\n .joins(:order_cycle)\n .includes(:customer)\n .for_order_cycle(order_cycle)\n .completed\n .order('customers.name ASC')\n end",
"def list_recurring_details(shopper_reference:, merchant_account: @merchant_account, contract: \"RECURRING\")\n postJSON(\"/Recurring/v12/listRecurringDetails\",\n shopperReference: shopper_reference,\n recurring: { contract: contract },\n merchantAccount: merchant_account\n )\n end",
"def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end",
"def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend",
"def orders\n Reggora::Resources::Order.new(config)\n end",
"def invoiced_orders\n return [] if !is_client?\n client.orders\n end",
"def driver_recurring_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :recurring}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end",
"def get_orders\n orders\n end",
"def next_recurring_order\n if actual_order = self.last_active_recurring_order\n self.orders.recurring.find(:all, :conditions => [\"orders.id > ?\", actual_order.id],\n :order => \"orders.id ASC\").first\n end\n end",
"def monitor_orders()\r\n\t\topen = $future_rest.open_orders symbol: 'BTCUSDT'\r\n\t\t# all orders\r\n\t\tall = $future_rest.all_orders symbol: 'BTCUSDT'\r\n\tend",
"def index\n @orders = current_user.type == 'Referral' ? current_user.orders : Order\n @orders = @orders.success_order.page(params[:page]).per(100).order('orders.created_at DESC')\n end",
"def recurring(money, creditcard, options = {})\r\n requires!(options, :rebill_frequency)\r\n\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_recurring_data(request, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end",
"def index# not :post order. this is a :get index of previous orders.\n @orders = current_refinery_user.orders.order('created_at DESC')\n end",
"def list_orders\n Order.list(@current_user)\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"def order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end",
"def open_orders(options)\n request :account, :get, 'openOrders', options\n end",
"def recurring_charges\n data.recurring_charges\n end"
] | [
"0.6655822",
"0.6456264",
"0.62143826",
"0.60961294",
"0.60788256",
"0.59696996",
"0.595337",
"0.5926247",
"0.58955306",
"0.5890947",
"0.5888247",
"0.5874496",
"0.585628",
"0.58253384",
"0.5813705",
"0.57688797",
"0.57616186",
"0.57507354",
"0.5744033",
"0.57139045",
"0.5691055",
"0.56886965",
"0.56882143",
"0.5641772",
"0.5638083",
"0.561963",
"0.5598266",
"0.5596899",
"0.5581044",
"0.5565462"
] | 0.7130487 | 0 |
get/order/customer_single_orders Get all single order regardless they are manual or auto for a customer | def customer_single_orders
@orders = Order.where(customer_id: current_user.customer_id, category: :single)
render json: @orders, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @orders = Order.where(:customer_id => params[:customer_id])\n @order = @orders.first \n end",
"def customer\n @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc)\n end",
"def all_orders(options)\n request :account, :get, 'allOrders', options\n end",
"def index\n @customers = Customer.where(order_id: params[:order_id])\n @order = Order.find(params[:order_id])\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def customer_order\n @customer_order\n end",
"def get_customer_order\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n array_of_orders = db.execute(\"SELECT customers.id 'Customer Number', customers.last_name 'Last Name', customers.first_name 'First Name', orders.id 'Order Number', products.product_title 'Product', products.product_price 'Price'\n FROM orders, customers, order_products, products\n\n WHERE orders.customer_id = ?\n AND orders.id = ?\n AND order_products.product_id = products.id\", [@customer_id, @id])\n db.close\n end\n array_of_orders\n end",
"def orders\n return [] if !is_client?\n client.orders\n end",
"def list_customer_orders\n orders = current_user.restaurant.orders.where.not(\"status = ? OR status = ? OR status = ? OR status = ?\", 2, 7, 8, 9)\n\n if orders.where(status: 6).length > 0 || orders.where(status: 0).length > 0\n render json: {orders: orders.as_json(include: :customer), notify: true}, status: :ok\n else\n render json: {orders: orders.as_json(include: :customer), notify: false}, status: :ok\n end\n end",
"def orders_including_customer\n Spree::Order\n .joins(:order_cycle)\n .includes(:customer)\n .for_order_cycle(order_cycle)\n .completed\n .order('customers.name ASC')\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end",
"def index\n @orders = Order.paginate(:page => params[:page])\n if params[:customer].present?\n @customer = Customer.find params[:customer]\n @orders = Order.where(customer_id: params[:customer]).page(params[:page])\n else\n @orders = Order.paginate(:page => params[:page])\n end\n end",
"def get_orders\n orders\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def orders\n @title = \"Your Orders\"\n @orders = @customer.orders.paginate(\n :page => params[:page],\n :per_page => 10\n )\n end",
"def invoiced_orders\n return [] if !is_client?\n client.orders\n end",
"def particular_customer_quotes\n offset = 0\n filter = \"%\"\n if (params[:offset].class.to_s != \"NilClass\" && params[:offset].integer?)\n offset = params[:offset].to_i\n end\n if (params[:filter].class.to_s != \"NilClass\")\n filter = \"%\" + params[:filter] + \"%\"\n end\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # it should be this query which is written down\n lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(idClient: params[:no]).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(\"(note like ? OR status.name LIKE ? OR dispatcher.firstName LIKE ? OR dispatcher.lastName LIKE ? OR reference LIKE ? ) AND idClient = ?\", filter, filter, filter, filter, filter, params[:no]).order('DESC').offset(offset).limit(30)\n\n # lstQuotes.each do |quote|\n # # TODO! Format each quote before send it.\n # end\n return render_json_response(lstQuotes, :ok)\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def set_order\n \tcustomer = Customer.find(params[:customer_id])\n \t@order = customer.orders.find(params[:id])\n\n \t#*TEST- Currently using Fictious customer 5 as a test\n \t# @order = Order.find(params[:id])\n\n\n # @order = Order.find(params[:id])\n # respond_with (@orders)\n\n\n end",
"def show\n @order = Order.find @customer.order_id\n end",
"def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end",
"def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end",
"def show\n @customer = Customer.find(@order.customer_id)\n end",
"def show\n @customer = current_user.customers.find(params[:id], :include => :orders)\n @orders = @customer.orders.paginate(:per_page => current_user.profile.orders_per_page, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"def index\n @orders = Order.user_orders current_user\n end",
"def my_orders\n @orders = current_user.orders.all\n end"
] | [
"0.66842574",
"0.6492773",
"0.6374647",
"0.63126725",
"0.6172871",
"0.615013",
"0.61402535",
"0.61110544",
"0.6083359",
"0.6062478",
"0.6053173",
"0.60333455",
"0.6025719",
"0.5997093",
"0.59852153",
"0.5981229",
"0.59235555",
"0.5920914",
"0.5916245",
"0.59034634",
"0.5887789",
"0.5884376",
"0.5875462",
"0.585058",
"0.5820796",
"0.5809613",
"0.5744115",
"0.5738673",
"0.573426",
"0.57172215"
] | 0.73650944 | 0 |
get/order/driver_recurring_orders Gets recurring order that are used to generate auto orders for a driver | def driver_recurring_orders
@orders = Timeslot.joins(:orders).where(orders: { category: :recurring}, timeslots: {region_id: current_user.driver.region_id})
render json: @orders, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_recurring_order\n if actual_order = self.last_active_recurring_order\n self.orders.recurring.find(:all, :conditions => [\"orders.id > ?\", actual_order.id],\n :order => \"orders.id ASC\").first\n end\n end",
"def list_orders(code)\n PsegRecurring::Order.new(@credentials).fetch_orders(code)\n end",
"def query_order(options)\n request :account, :get, 'order', options\n end",
"def get_orders\n orders\n end",
"def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end",
"def last_active_recurring_order\n self.orders.recurring.find(:all, :order => \"orders.id ASC\").select {|o| Date.today >= o.service_period_start_on && Date.today <= o.service_period_end_on}.last\n end",
"def orders\n Reggora::Resources::Order.new(config)\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend",
"def all_orders(options)\n request :account, :get, 'allOrders', options\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def invoiced_orders\n return [] if !is_client?\n client.orders\n end",
"def _wapi_order(order_type_sym, order_hash)\n response = c.soap(order_type_sym, { \n order_type_sym => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' }\n }.update(order_hash).update(creds).update(c.class.uuid_hash) }\n )\n \n result = c.class.decode_soap(response.body)\n if result['result']['code'] == '1000'\n self.orders ||= []\n self.orders << { :user_id => result['user'], :dbpuser_id => result['dbpuser'], :orderid => result['resdata']['orderid'] }\n return self.orders.last\n else\n raise(GoDaddyResellerError.new(result['result']['msg']))\n end\n end",
"def orders\n return [] if !is_client?\n client.orders\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end",
"def paypal_checkout_recurring\n description = \"Pay to buy this domain.\"\n description += \"Domain: \" + (session['domain']['name']+\".\"+session['domain']['type']).downcase\n description += \".billing:\"\n description += \" -period: Month,\"\n description += \" -frequency: 12,\"\n description += \" -amount: \" + session['order_item']['total_price'] +\",\"\n description += \" -currency_code: USD.\"\n\n Paypal.sandbox! if PAYPAL_API[:sandbox]\n request = Paypal::Express::Request.new(\n :username => PAYPAL_API[:username],\n :password => PAYPAL_API[:password],\n :signature => PAYPAL_API[:signature]\n )\n payment_request = Paypal::Payment::Request.new(\n :currency_code => :USD, # if nil, PayPal use USD as default\n :billing_type => :RecurringPayments,\n :billing_agreement_description => description\n )\n response = request.setup(\n payment_request,\n paypal_recurring_url,\n root_url\n )\n #@my_redirect_uri = response.redirect_uri\n\n redirect_to response.redirect_uri\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def order_domain_renewals(order_hash)\n _wapi_order(:OrderDomainRenewals, order_hash)\n end",
"def order\n @order ||= Elong::API::GHotel::Order.new(@client)\n end",
"def get_orders(debtor_handle)\n response = fetch_response(:get_orders, debtor_handle)\n build_entities_from_response(\n Economic::Order,\n response[:order_handle]\n )\n end",
"def partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end",
"def list_recurring_details(shopper_reference:, merchant_account: @merchant_account, contract: \"RECURRING\")\n postJSON(\"/Recurring/v12/listRecurringDetails\",\n shopperReference: shopper_reference,\n recurring: { contract: contract },\n merchantAccount: merchant_account\n )\n end",
"def client_orders\n self.clients.map(&:orders)\n end",
"def recurring_charges\n data.recurring_charges\n end",
"def requests_for_driver\n self.rides.joins(:relationships).where(relationships: {is_driving: false})\n end",
"def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.get_orders ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling OrdersApi.get_orders, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling OrdersApi.get_orders, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/orders'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetOrdersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.get_orders\",\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: OrdersApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.6323658",
"0.5873915",
"0.58131254",
"0.5789864",
"0.57825345",
"0.56828517",
"0.5634773",
"0.5529241",
"0.54923326",
"0.5396034",
"0.53715116",
"0.53293836",
"0.5292301",
"0.52753055",
"0.52412367",
"0.5189769",
"0.5189136",
"0.51814663",
"0.51620156",
"0.5151022",
"0.5144741",
"0.51056546",
"0.5102212",
"0.5061521",
"0.50564206",
"0.5055561",
"0.503333",
"0.5032076",
"0.5019857",
"0.50082976"
] | 0.66845405 | 0 |
get/order/driver_single_orders Get all single order regardless they are manual or auto for a driver | def driver_single_orders
@orders = Timeslot.joins(:orders).where(orders: { category: :single}, timeslots: {region_id: current_user.driver.region_id})
render json: @orders, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_orders\n orders\n end",
"def orders\n return [] if !is_client?\n client.orders\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def all_orders(options)\n request :account, :get, 'allOrders', options\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def pick_orders\n return Order.where(:status => 'ordered', :dropper_id => nil, :picker_id => nil) if self.pickup_boy?\n end",
"def query_order(options)\n request :account, :get, 'order', options\n end",
"def getOrderDetail(orderId)\n try_get(\"https://checkout.google.com/sell/multiOrder?order=#{orderId}&ordersTable=1\")\n return @agent.page.body\n end",
"def invoiced_orders\n return [] if !is_client?\n client.orders\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def high_single_order\n join_users_products_orders.order(\"order_total DESC\").group(\"order_id, users.first_name, users.last_name\").limit(1)\n end",
"def _wapi_order(order_type_sym, order_hash)\n response = c.soap(order_type_sym, { \n order_type_sym => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' }\n }.update(order_hash).update(creds).update(c.class.uuid_hash) }\n )\n \n result = c.class.decode_soap(response.body)\n if result['result']['code'] == '1000'\n self.orders ||= []\n self.orders << { :user_id => result['user'], :dbpuser_id => result['dbpuser'], :orderid => result['resdata']['orderid'] }\n return self.orders.last\n else\n raise(GoDaddyResellerError.new(result['result']['msg']))\n end\n end",
"def order\n @order ||= Elong::API::GHotel::Order.new(@client)\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end",
"def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def order(order_id)\n Order.find(order_id)\n end",
"def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end",
"def orders\n Order.find_all_by_origin_code(\"smnl#{id}\")\n end",
"def get_order(order_id)\n authenticated? do\n query_and_build \"marketplace/orders/#{order_id}\"\n end\n end",
"def client_orders\n self.clients.map(&:orders)\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def index\n @orders = Order.where(:customer_id => params[:customer_id])\n @order = @orders.first \n end",
"def my_pick_orders\n return Order.where(:status => 'ordered', :picker_id => self.id) if self.pickup_boy?\n end",
"def get_orders(debtor_handle)\n response = fetch_response(:get_orders, debtor_handle)\n build_entities_from_response(\n Economic::Order,\n response[:order_handle]\n )\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def orders # return all the associated orders / reader method \n Order.all.select do |order| #select will returnn an array \n order.customer == self #condition true or false \n end \n end"
] | [
"0.599514",
"0.5944234",
"0.58264637",
"0.5820596",
"0.57453036",
"0.5741173",
"0.57253313",
"0.570094",
"0.56805474",
"0.5624305",
"0.5595843",
"0.5519352",
"0.5471493",
"0.5464744",
"0.5426373",
"0.5423127",
"0.54051054",
"0.5386229",
"0.5369818",
"0.5352874",
"0.5347232",
"0.5291574",
"0.5290049",
"0.52791435",
"0.52791435",
"0.5261903",
"0.525392",
"0.5246043",
"0.5242276",
"0.5235885"
] | 0.6335111 | 0 |
put/order/1 Mark a order as complete by driver | def mark_order_complete
order_params = (driver_order_params)
order_params[:payable_attributes][:driver_id] = current_user.customer_id
if @order.single?
if( (Time.now >= Time.parse(@order.place_date + ' ' + @order.timeslot.start) || true) && (@order.pending? ) && @order.update(order_params) )
render json: @order, status: 200
else
render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity
end
else
if(@order.update(order_params))
render json: @order, status: 200
else
render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_complete\n ActiveRecord::Base.transaction do\n find_order\n separate_shipment_costs\n assert_refund_adjustments params['refund_items'], true\n @order.update!\n end\n settle_payments_if_desired\n render text: @settlement_results.to_json\n end",
"def order_complete\n load_order\n if @order.state == 'canceled'\n flash[\"notice\"] = 'This order has been canceled - do not process it!'\n elsif @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n @order.update_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end",
"def order_complete\n load_order\n if @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n \t@order.update_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end",
"def complete_order\n @queue.dequeue\n end",
"def set_as_complete\n mark_as_complete_and_save\n end",
"def order_complete\n load_order\n if @order.state == 'canceled' \n flash[\"notice\"] = 'This order has been canceled - do not process it!'\n elsif @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n \t@order.update_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end",
"def mark_complete\n self.complete = true\n self.save\n end",
"def complete_order\n # Get the current user's last order (i.e. the current order)\n @order = @current_user.orders.last\n\n # Invoke an action in order.rb that 'moves' items from a user's cart to the current order\n @order.add_line_items_from_cart @cart\n\n # Invoke action in order.rb that updates stock levels\n @order.update_inventory\n\n # Destroy the user's cart\n @cart.destroy\n\n # Set a flash notification that the order was successful\n flash[:notification] = \"Order successful!!!\"\n\n # Redirect to orders#show\n redirect_to order_path(@order)\n end",
"def complete_order_service\n\n order_service = OrderService.find(params[:order_service_id])\n order_service.completed = true\n order_service.save\n\n completed = true\n order_service.order.order_services.each do |order_service|\n if !order_service.completed\n completed = false\n end\n end\n if completed\n order_service.order.status = true\n order_service.order.save\n end\n \n redirect_to order_path(order_service.order.id)\n end",
"def mark_as_complete_and_save\n self.complete = true\n save\n end",
"def mark_as_complete(options)\n self.is_complete = options[:is_complete]\n self.is_applicable = true # if item.is_complete\n self.save_with_validation(false)\n end",
"def complete!\n self.completed = true\n self.completed_at = Time.now.utc\n save! # TODO: With a bang?\n end",
"def finish\n @order.finish\n render_update @order\n end",
"def after_save_new_order\n end",
"def orders\n super.complete.order('completed_at DESC, id DESC')\n end",
"def processOrder\n \n end",
"def complete\n @order = Order.find(params[:id])\n @order.update_attributes(:fulfilled => Time.now)\n\n respond_to do |format|\n if @order.update_attributes(:fulfilled => Time.now)\n format.html { redirect_to @order, notice: 'Order was successfully completed.' }\n format.json { render json: @order, status: :updated }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def complete!\n self.status = 'completed'\n self.save\n end",
"def set_to_ordered\n self.status = \"ordered\"\n self.save\n end",
"def complete_order_step(order, order_step)\n original_state = order.state\n order.state = order_step\n\n if !order.next\n order.state = original_state\n order.save(validate: false) # store data from paypal. user will be redirect to 'personal' tab\n end\n end",
"def mark_complete(db, complete, name)\n\tcomplete = \"complete\"\n\tdb.execute(\"UPDATE upper_body SET complete=? WHERE name=?\", [complete, name])\n\tdb.execute(\"UPDATE lower_body SET complete=? WHERE name=?\", [complete, name])\n\tputs \"set #{name} to complete\"\nend",
"def complete!\n self.is_completed = true\n self.save\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 complete!\n # this should change the boolean to true\n self.complete = true\n self.save!\n end",
"def mark_as_delivered(employee)\n order_id = @view.ask_order_id\n # 3. Fetch task from repo\n orders = @order_repository.undelivered_orders\n my_order = orders.find { |order| order.employee.id == employee.id && order.id == order_id }\n # 4. Mark task as done\n my_order.deliver!\n @order_repository.save_to_csv\n end",
"def place_and_complete_kfs_item_order(ordered_by, facility, account = nil, reviewed = false)\n @facility_account = FactoryBot.create(:kfs_facility_account, facility: facility)\n @item = facility.items.create(FactoryBot.attributes_for(:item, facility_account_id: @facility_account.id))\n place_product_order(ordered_by, facility, @item, account)\n\n # act like the parent order is valid\n @order.state = \"validated\"\n\n # purchase it\n @order.purchase!\n\n @order_detail.change_status!(OrderStatus.complete)\n\n od_attrs = {\n actual_cost: 20,\n actual_subsidy: 10,\n price_policy_id: @item_pp.id,\n }\n\n od_attrs[:reviewed_at] = Time.zone.now - 1.day if reviewed\n @order_detail.update_attributes(od_attrs)\n @order_detail\nend",
"def submit_order!\n @customer_order.transaction do\n cache_addresses!\n mark_deliveries_as_pending!\n cache_billing_address! unless @customer_order.anon_billing_address?\n update_subtotal_items!\n assign_submitted_at!\n submitted!\n end\n end",
"def markDone\n if @complete == \"Item incomplete\"\n @complete = \"Item complete\"\n else\n @complete = \"Item complete\"\n end\n end"
] | [
"0.69553185",
"0.6759722",
"0.6741864",
"0.6729067",
"0.6714085",
"0.66975635",
"0.6635356",
"0.6536199",
"0.6515236",
"0.6497",
"0.64500105",
"0.6392472",
"0.63909906",
"0.6379636",
"0.6368655",
"0.63317764",
"0.6310971",
"0.6308635",
"0.6249706",
"0.6230844",
"0.6187945",
"0.61624247",
"0.610265",
"0.610265",
"0.610265",
"0.60813874",
"0.60721946",
"0.6056865",
"0.6055205",
"0.6006179"
] | 0.74576443 | 0 |
xroad_id may be either ClientId or ServerId. | def verify_xroad_instance(xroad_id)
logger.debug("Instance verification: #{xroad_id}")
unless @xroad_instance.eql?(xroad_id.xroad_instance)
raise t("request.incorrect_instance")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_xroad_instance(xroad_id)\n logger.debug(\"Instance verification: #{xroad_id}\")\n\n unless @xroad_instance.eql?(xroad_id.xroad_instance)\n raise t(\"request.incorrect_instance\")\n end\n end",
"def set_mainroad\n @mainroad = Mainroad.find(params[:id])\n end",
"def set_road\n @road = Road.find(params[:id])\n end",
"def ship_address_id=(id)\n check_address_owner(id, :ship)\n end",
"def set_net_id(x)\n $test_logger.log(\"Serial net Id change. New net Id '#{x}'\")\n begin\n @transport.net_id = x\n rescue Exception => e\n $test_logger.log_e(\"Error while changing serial net Id to '#{x}'\", e)\n end\n end",
"def set_qx_runway\n @qx_runway = Qx::Runway.find(params[:id])\n end",
"def set_xservice\n @xservice = Xservice.find(params[:id])\n end",
"def set_roads1\n @roads1 = Roads1.find(params[:id])\n end",
"def midtown_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, ['primary'], [])\nend",
"def server_object_id\n self.parameters[:server_object_id]\n end",
"def client_id=(_arg0); end",
"def server_id\n @host.id\n end",
"def lygneo_id\n @lygneo_id ||= params['lygneo_id'].strip\n end",
"def openid_client_id=(_arg0); end",
"def midtown_no_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], ['primary'])\nend",
"def set_carbondioxide\n @carbondioxide = Carbondioxide.find(params[:id])\n end",
"def client_id; end",
"def set_client_id(id)\n @client_id = id.is_a?(Integer) ? [id].pack(\"N\") : id.to_s\n end",
"def draw_xparam(x, y, xparam_id)\n draw_xparam_name(x + 4, y, xparam_id)\n draw_current_xparam(x + 80, y, xparam_id) if @actor\n end",
"def set_roadwork\n @roadwork = Roadwork.find(params[:id])\n end",
"def set_car_road_order\n @car_road_order = CarRoadOrder.find(params[:id])\n end",
"def openid_client_id; end",
"def xid=(xid)\n netrc['gitsleep.com'] = xid, 'no_password'\n netrc.save\n end",
"def set_xclass\n @xclass = Xclass.find(params[:id])\n end",
"def client_id=(client_id)\n if !client_id.nil? && client_id.to_s.length > 128\n fail ArgumentError, 'invalid value for \"client_id\", the character length must be smaller than or equal to 128.'\n end\n\n if !client_id.nil? && client_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"client_id\", the character length must be great than or equal to 1.'\n end\n\n @client_id = client_id\n end",
"def client_id\n super\n end",
"def set_roadblock\n @roadblock = Roadblock.find(params[:id])\n end",
"def client_id=(client_id); end",
"def client_id=(client_id); end",
"def set_roadmap\n @roadmap = Roadmap.find(params[:id])\n end"
] | [
"0.66138875",
"0.5049378",
"0.50263023",
"0.48848465",
"0.4846459",
"0.47275993",
"0.4703783",
"0.4653071",
"0.46315962",
"0.46029252",
"0.45669642",
"0.45372003",
"0.45358035",
"0.453562",
"0.45174667",
"0.4458038",
"0.44488096",
"0.4443291",
"0.44104835",
"0.44089085",
"0.43954295",
"0.43792486",
"0.43769532",
"0.43716347",
"0.4362944",
"0.436219",
"0.43621713",
"0.4347556",
"0.4347556",
"0.4342721"
] | 0.6561161 | 1 |
GET /agenciamadres/1 GET /agenciamadres/1.xml | def show
@agenciamadre = Agenciamadre.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @agenciamadre }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend",
"def show\n @arrendamientosprorroga = Arrendamientosprorroga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end",
"def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end",
"def show\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_orgao }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end",
"def show\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reputacao_veiculo }\n end\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def show\n @acre = Acre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @acre }\n end\n end",
"def show\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiaos }\n end\n end",
"def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def show\n @ingreso = Ingreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingreso }\n end\n end",
"def show\n @arrendimientospago = Arrendimientospago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendimientospago }\n end\n end",
"def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end",
"def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend",
"def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end",
"def show\n @reputacao_carona = ReputacaoCarona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reputacao_carona }\n end\n end",
"def show\n @retirada = Retirada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @retirada }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end",
"def xres\n get \"xres\"\n end"
] | [
"0.6237832",
"0.62087727",
"0.6183817",
"0.61069185",
"0.6057191",
"0.60394096",
"0.6030785",
"0.60258734",
"0.5999758",
"0.5983949",
"0.59808916",
"0.59781045",
"0.5955818",
"0.59473175",
"0.59176636",
"0.59057117",
"0.5896805",
"0.5892465",
"0.5879226",
"0.58749354",
"0.58702004",
"0.58492666",
"0.58409387",
"0.58361304",
"0.58292526",
"0.5828407",
"0.5825858",
"0.5817497",
"0.5805666",
"0.58053935"
] | 0.6580325 | 0 |
GET /agenciamadres/new GET /agenciamadres/new.xml | def new
@agenciamadre = Agenciamadre.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @agenciamadre }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @arrendamientosprorroga = Arrendamientosprorroga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end",
"def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end",
"def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def new\n @retirada = Retirada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retirada }\n end\n end",
"def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def new\n @adjunto = Adjunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adjunto }\n end\n end",
"def new\n @allergen = Allergen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @allergen }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end",
"def new\n @acre = Acre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acre }\n end\n end",
"def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @ingreso = Ingreso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingreso }\n end\n end",
"def new\n @regiaos = Regiao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiaos }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @association = Association.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @association }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def new\n @pagare = Pagare.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagare }\n end\n end",
"def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n @remocao = Remocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remocao }\n end\n end",
"def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end",
"def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end",
"def new\n @arc = Arc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arc }\n end\n end"
] | [
"0.7245398",
"0.7164518",
"0.71478367",
"0.71264786",
"0.712289",
"0.70754814",
"0.70577675",
"0.7046149",
"0.7043363",
"0.7038602",
"0.70277387",
"0.7027488",
"0.70097184",
"0.70051676",
"0.6998889",
"0.69982636",
"0.69962996",
"0.6978991",
"0.6969443",
"0.69611156",
"0.6948194",
"0.6942272",
"0.69397557",
"0.6939256",
"0.69342285",
"0.69310933",
"0.69305116",
"0.69301355",
"0.69172746",
"0.69105524"
] | 0.7411457 | 0 |
POST /agenciamadres POST /agenciamadres.xml | def create
@agenciamadre = Agenciamadre.new(params[:agenciamadre])
respond_to do |format|
if @agenciamadre.save
format.html { redirect_to(@agenciamadre, :notice => 'Agencia Madre fue creada satisfactoriamente.') }
format.xml { render :xml => @agenciamadre, :status => :created, :location => @agenciamadre }
else
format.html { render :action => "new" }
format.xml { render :xml => @agenciamadre.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end",
"def new\n @agenciamadre = Agenciamadre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @agenciamadre }\n end\n end",
"def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def sfa_advertisement_xml(resources, opts = {})\n doc = Nokogiri::XML::Document.new\n #<rspec expires=\"2011-09-13T09:07:09Z\" generated=\"2011-09-13T09:07:09Z\" type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd http://www.protogeni.net/resources/rspec/ext/emulab/1 http://www.protogeni.net/resources/rspec/ext/emulab/1/ptop_extension.xsd http://company.com/rspec/ext/stitch/1 http://company.com/rspec/ext/stitch/1/ad.xsd \"> \n root = doc.add_child(Nokogiri::XML::Element.new('rspec', doc))\n root.add_namespace(nil, \"http://www.protogeni.net/resources/rspec/2\")\n @@sfa_namespaces.each do |prefix, urn|\n root.add_namespace(prefix.to_s, urn)\n end\n\n root.set_attribute('type', \"advertisement\")\n now = Time.now\n root.set_attribute('generated', now.iso8601)\n root.set_attribute('expires', (now + (opts[:valid_for] || 600)).iso8601)\n\n #root = doc.create_element('rspec', doc)\n #doc.add_child root\n obj2id = {}\n _to_sfa_xml(resources, root, obj2id, opts) \n end",
"def create\n @agencium = Agencium.new(agencium_params)\n\n respond_to do |format|\n if @agencium.save\n format.html { redirect_to @agencium, notice: 'Agencium was successfully created.' }\n format.json { render :show, status: :created, location: @agencium }\n else\n format.html { render :new }\n format.json { render json: @agencium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def create\n @arrendamientosprorroga = Arrendamientosprorroga.new(params[:arrendamientosprorroga])\n\n respond_to do |format|\n if @arrendamientosprorroga.save\n format.html { redirect_to(@arrendamientosprorroga, :notice => 'Arrendamientosprorroga was successfully created.') }\n format.xml { render :xml => @arrendamientosprorroga, :status => :created, :location => @arrendamientosprorroga }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @arrendamientosprorroga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def create\n @acre = Acre.new(params[:acre])\n\n respond_to do |format|\n if @acre.save\n format.html { redirect_to(acres_path, :notice => 'Acre was successfully created.') }\n format.xml { render :xml => @acre, :status => :created, :location => @acre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @acre.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def create\n @relatestagiario = Relatestagiario.new(params[:relatestagiario])\n\n respond_to do |format|\n if @relatestagiario.save\n flash[:notice] = 'RELATÓRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatestagiario) }\n format.xml { render :xml => @relatestagiario, :status => :created, :location => @relatestagiario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @relatestagiario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agenda_reserv_resource = Agenda::ReservResource.new(agenda_reserv_resource_params)\n if @agenda_reserv_resource.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend",
"def create\n @frequencia_orgao = Frequencia::Orgao.new(params[:frequencia_orgao])\n\n respond_to do |format|\n if @frequencia_orgao.save\n format.html { redirect_to(@frequencia_orgao, :notice => 'Orgão criado com sucesso.') }\n format.xml { render :xml => @frequencia_orgao, :status => :created, :location => @frequencia_orgao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @frequencia_orgao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @resultadoconsultum = Resultadoconsultum.new(resultadoconsultum_params)\n\t\n\n\trequire 'nokogiri'\n\t\n\t@doc = Nokogiri::XML(File.open(\"exemplos/emplo.xml\"))\n\n\tcar_tires = @doc.xpath(\"//firstname\")\n\t\n\tdoc = Nokogiri::XML(File.open(\"emplo.xml\"))\n\tdoc.xpath('firstname').each do\n\t\tcar_tires\n\tend\n\n\t \n respond_to do |format|\n if @resultadoconsultum.save\n format.html { redirect_to @resultadoconsultum, notice: car_tires }\n format.json { render :show, status: :created, location: @resultadoconsultum }\n else\n format.html { render :new }\n format.json { render json: @resultadoconsultum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def postEntityAdvertiserUpsell( entity_id, tags, locations, extra_tags, extra_locations, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['extra_tags'] = extra_tags\n params['extra_locations'] = extra_locations\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/upsell\",params)\n end",
"def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t tags = params[:tags].gsub(\" \",\"\").split(\",\")\n @vaga = Vaga.new(params[:vaga])\n\n\t empresa = Empresa.find(session[:user_id])\n\t empresa.nome_empresa = params[:empresa] if params[:empresa]\n\t empresa.save\n\t @vaga.empresa = empresa\n respond_to do |format|\n if @vaga.save\n\t\t @vaga.create_tags(tags)\n format.html { redirect_to(@vaga, :notice => 'Vaga was successfully created.') }\n format.xml { render :xml => @vaga, :status => :created, :location => @vaga }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vaga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @atividade_avaliacao = AtividadeAvaliacao.new(params[:atividade_avaliacao])\n\n respond_to do |format|\n if @atividade_avaliacao.save\n flash[:notice] = 'AtividadeAvaliacao was successfully created.'\n format.html { redirect_to(@atividade_avaliacao) }\n format.xml { render :xml => @atividade_avaliacao, :status => :created, :location => @atividade_avaliacao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @atividade_avaliacao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def agencium_params\n params.require(:agencium).permit(:nombre, :mail, :contraseĮņa)\n end",
"def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end"
] | [
"0.568386",
"0.5615961",
"0.556143",
"0.53071696",
"0.5302942",
"0.5282424",
"0.5253082",
"0.5227075",
"0.51156545",
"0.5100632",
"0.50992155",
"0.5084646",
"0.50764245",
"0.50733185",
"0.5062335",
"0.50605386",
"0.50602293",
"0.50296885",
"0.50226015",
"0.5014628",
"0.496211",
"0.4961978",
"0.49567163",
"0.492388",
"0.49091867",
"0.49033347",
"0.48965797",
"0.48932087",
"0.48878023",
"0.48840344"
] | 0.5974314 | 0 |
get next yahrzeit date on or after "from" date | def next_yahrzeit_date(from=Date.today)
return unless death_date
# TODO: use Marlena rules
h_from = Hebruby::HebrewDate.new(from)
h_death = Hebruby::HebrewDate.new(death_date)
# yahrzeit date from year
h_yahrzeit = Hebruby::HebrewDate.new(h_death.day, h_death.month, h_from.year)
date = Date.jd(h_yahrzeit.jd)
if date < from
h_yahrzeit = Hebruby::HebrewDate.new(h_death.day, h_death.month, h_from.year+1)
date = Date.jd(h_yahrzeit.jd)
end
date
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_yahrzeit_date(from=Date.today)\n return unless death_hebrew_date_day && death_hebrew_date_month\n @next_yahrzeit_date ||= begin\n # TODO: use Marlena rules\n h_from = Hebruby::HebrewDate.new(from)\n # yahrzeit date from year\n h_yahrzeit = Hebruby::HebrewDate.new(death_hebrew_date_day, death_hebrew_date_month, h_from.year)\n date = Date.jd(h_yahrzeit.jd)\n if date < from\n h_yahrzeit = Hebruby::HebrewDate.new(death_hebrew_date_day, death_hebrew_date_month, h_from.year+1)\n date = Date.jd(h_yahrzeit.jd)\n end\n date\n end\n end",
"def next_date\n next_observance.try(:start_on) || 100.years.from_now.to_date\n end",
"def date_of_next(day)\n\t day_required = DateTime.parse(day)\n\t delta = day_required > DateTime.now ? 0 : 7\n\t (day_required + delta)\n\tend",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n Chronic.parse(\"0 next #{day}\").to_datetime\n end",
"def find_next date\n loop do \n \treturn date if include?(date)\n \t# puts \"#{@resolution} : #{date}\"\n \tdate = beginning_of_next @resolution, date\n end\n end",
"def date_of_next(day)\r\n date = Date.parse(day)\r\n delta = date > Date.today ? 0 : 7\r\n date + delta\r\nend",
"def next_date\n @schedule=schedules.where(\"schedules.end >= ?\", DateTime.now).sort_by(&:start).first\n if @schedule.nil?\n return schedules.sort_by(&:start).first\n else\n return @schedule\n end\n end",
"def next_date\n if(!@previous_date)\n @previous_date = @start_date\n return @previous_date\n end\n \n previous = @previous_date>>1\n last_week_start = Time::CommonYearMonthDays[next_date.month] - 7\n case @frequency\n when \"first\"\n next_date = Date.new(d=1, y=next_date.year, m=next_date.month)\n when \"second\"\n next_date = Date.new(d=7, y=next_date.year, m=next_date.month)\n when \"third\"\n next_date = Date.new(d=14, y=next_date.year, m=next_date.month)\n when \"last\"\n next_date = Date.new(d=last_week_start, y=next_date.year, m=next_date.month)\n else\n return (previous_date>>1)\n end\n \n next_date.step(next_date+7, 1) do |date|\n return date if days_of_the_week.any(date.day)\n end\n end",
"def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n end",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\nend",
"def next_scheduled_use_date\n next_date = nil\n\n open_orders.each do |o|\n if o.access_date_start\n next_date ||= o.access_date_start\n if o.access_date_start < next_date\n next_date = o.access_date_start\n end\n end\n end\n next_date\n end",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n\n return date + delta\n end",
"def find_next_date_for_monthly start\n if month_end || (start.month == 2 && month_day > 28) || month_day > 30\n next_date = start.end_of_month\n else\n next_date = Date.new(start.year, start.month, month_day)\n end\n return next_date if next_date <= end_date\n #next_date = next_date + 1.month\n #next_date = next_date.end_of_month if month_end\n nil\n end",
"def find_next_day\n day = @date.to_date + ((@schedule.start_date - @date.to_date) % @schedule.period_num)\n return day\n end",
"def next_available_move_in_date\n \tbookings = self.bookings.where(state: ['booked', 'deposit outstanding']).order(:move_out)\n \t# if self.bookable_date && self.bookable_date <= Date.today\n return nil if bookings.last&.state == 'deposit outstanding'\n if bookings.empty? || bookings.last.move_out&.past?\n Date.tomorrow\n elsif !bookings.last.move_out.nil?\n bookings.last.move_out + 1.day\n end\n end",
"def next(now = @time_source.now, num = 1)\n t = InternalTime.new(now, @time_source)\n\n unless time_specs[:month][0].include?(t.month)\n nudge_month(t)\n t.day = 0\n end\n\n unless interpolate_weekdays(t.year, t.month)[0].include?(t.day)\n nudge_date(t)\n t.hour = -1\n end\n\n unless time_specs[:hour][0].include?(t.hour)\n nudge_hour(t)\n t.min = -1\n end\n\n # always nudge the minute\n nudge_minute(t)\n t = t.to_time\n if num > 1\n recursive_calculate(:next,t,num)\n else\n t\n end\n end",
"def next(from, sec, fin)\n from ||= Time.at(0)\n sec ||= 0\n fin ||= Time.now\n #after is after or equal\n nxt = self.reports.next(from, sec).first\n # or it's the fist from the next second\n nxt ||= self.first(from+1, fin) \n end",
"def next_day\r\n if @next_day.nil?\r\n @next_day = convert_day_to_date(current_day).tomorrow.strftime('%Y%m%d')\r\n end\r\n @next_day\r\n end",
"def next_day(date)\n date + (60 * 60 * 24)\n end",
"def find_next_date_for_yearly start\n if (month == start.month && month_end) || \n (month == start.month && start.month == 2 && month_day > 28) ||\n (month == start.month && month_day > 30)\n return start.end_of_month\n elsif month == start.month\n next_date = Date.new(start.year, month, month_day)\n end\n return next_date if next_date && next_date <= end_date\n #unless next_date.future?\n # next_date = next_date + 1.year\n # next_date = next_date.end_of_month if month_end\n #end\n #next_date\n nil\n end",
"def next_run_time(from, to)\n next_time = cron.next_time(from)\n next_run = next_time.to_local_time.in_time_zone(next_time.zone)\n next_run <= to ? next_run : nil\n end",
"def next_run_time(from, to)\n next_time = cron.next_time(from)\n next_run = next_time.to_local_time.in_time_zone(next_time.zone)\n next_run <= to ? next_run : nil\n end",
"def next_run_time(from, to)\n next_time = cron.next_time(from)\n next_run = next_time.to_local_time.in_time_zone(next_time.zone)\n next_run <= to ? next_run : nil\n end",
"def get_next_date(current_date,date)\n date = date.gsub(\",\",\"\")\n date = date.gsub(\" \",\"-\")\n arr = date.split(\"-\")\n if !((current_date.mday == 31 && (current_date.mon == 1 || current_date.mon == 3 || current_date.mon == 5 || current_date.mon == 7 || current_date.mon == 8 || current_date.mon == 10 || current_date.mon == 12)) || (current_date.mday == 30 && (current_date.mon == 4 || current_date.mon == 6 || current_date.mon == 9 || current_date.mon == 11)) || (current_date.mday == 28 && current_date.mon == 2))\n newDay = arr[2].to_i + 1\n if newDay < 10\n newDay = \"0\" + newDay.to_s()\n end\n newDate = arr[1] + \"-\" + newDay.to_s() + \"-\" + arr[3]\n else\n newDate = arr[1] + \"-\" + arr[2]+ \"-\" + arr[3]\n end\n end",
"def get_next_date_for_next_weekday(week_day)\n DateTime.now + days_to_add(week_day)\nend",
"def find_meetup_date\n Date.new(year, month).next_month.prev_day\n .downto(Date.new(year, month)) do |date|\n return date if correct_date?(date)\n end\n end",
"def next_occurrence(from_date)\n residue = @residue - residue_for(from_date)\n date = move_by from_date, residue.modulo(interval)\n time = Time.new(date.year, date.month, date.day, start_time.hour, start_time.min, start_time.sec)\n if (exx = exclusions.detect {|rule| rule.violated_by? time})\n if stops_by && time > stops_by\n nil\n else\n next_occurrence(move_by time, 1)\n end\n else\n time\n end\n end",
"def end_date\n\t\tself.next.start_date - 1\n\tend",
"def find_next_non_specific(date)\n values = ['first', 'second', 'third', 'fourth']\n\n case @schedule.days_month\n when 'last'\n d = Date.new(date.year, date.month, -1)\n\n return d if @schedule.days_month_day == nil\n\n d -= ((d.wday - @schedule.days_month_day) % 7)\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n return find_next_non_specific(d)\n end\n\n return d\n else\n if @schedule.days_month_day == nil\n if values.index(@schedule.days_month) + 1 < date.day\n months_to_add = @schedule.period_num\n months_since_startdate = (date.year * 12 + date.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n date += months_to_add.months\n end\n \n return Date.new(date.year, date.month, values.index(@schedule.days_month)+1) if @schedule.days_month_day == nil\n end\n \n d = Date.new(date.year, date.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n\n d = Date.new(d.year, d.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n end\n\n return d\n end\n end"
] | [
"0.6988127",
"0.69150674",
"0.6720934",
"0.6713743",
"0.6561058",
"0.654712",
"0.651791",
"0.65158767",
"0.651048",
"0.6485499",
"0.64658606",
"0.64643204",
"0.64403236",
"0.64092857",
"0.640129",
"0.6307372",
"0.6299992",
"0.6291768",
"0.62493706",
"0.6238404",
"0.61948866",
"0.6182775",
"0.6182775",
"0.6182775",
"0.61781466",
"0.6152141",
"0.61020994",
"0.6100601",
"0.6093063",
"0.60847473"
] | 0.70579094 | 0 |
Sets attributes of the load balancer The following attributes can be set: CrossZoneLoadBalancing (enable/disable) ConnectionDraining (enable/disable and timeout) Idle Connection Timeouts Still requires: AccessLog configuration ==== Parameters lb_name Name of the ELB options 'ConnectionDraining': 'Enabled' whether to enable connection draining 'Timeout' max time to keep existing conns open before deregistering instances 'CrossZoneLoadBalancing': 'Enabled' whether to enable cross zone load balancing 'ConnectionSettings': 'IdleTimeout' time (in seconds) the connection is allowed to be idle (no data has been sent over the connection) before it is closed by the load balancer. ==== Returns response: body: 'ResponseMetadata': 'RequestId' Id of request | def modify_load_balancer_attributes(lb_name, options)
attributes = Fog::AWS.serialize_keys 'LoadBalancerAttributes', options
request(attributes.merge(
'Action' => 'ModifyLoadBalancerAttributes',
'LoadBalancerName' => lb_name,
:parser => Fog::Parsers::AWS::ELB::Empty.new
))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_load_balancer_attributes(lb_id, attributes)\n attributes = Fog::AWS.serialize_keys 'Attributes', attributes.map{ |property, value| { :Key => property, :Value => value } }\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyLoadBalancerAttributes.new\n ))\n end",
"def update_attributes(local_config)\n @elb.modify_load_balancer_attributes({\n load_balancer_name: local_config.name,\n load_balancer_attributes: {\n cross_zone_load_balancing: {\n enabled: local_config.cross_zone\n },\n access_log: if local_config.access_log then local_config.access_log.to_aws end,\n connection_draining: {\n enabled: local_config.connection_draining != false,\n timeout: if local_config.connection_draining != false then local_config.connection_draining end\n },\n connection_settings: {\n idle_timeout: local_config.idle_timeout\n }\n }\n })\n end",
"def describe_load_balancer_attributes(lb_id)\n request({\n 'Action' => 'DescribeLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::DescribeLoadBalancerAttributes.new\n })\n end",
"def set_load_balancer_name(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend",
"def set_load_balancer_name(load_balancer_id, load_balancer_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['LoadBalancerName'] = load_balancer_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def name=(new_name=\"\")\n (raise CloudLB::Exception::Syntax, \"Load balancer name must be 128 characters or less\") if new_name.size > 128\n (raise CloudLB::Exception::MissingArgument, \"Must provide a new name\") if new_name.to_s.empty?\n body = {\"name\" => new_name}\n update(body)\n end",
"def describe_load_balancer_attribute(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancerAttribute'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend",
"def add_http_load_balancer(name, ip_address=nil)\n\n add_load_balancer name, 80, ip_address\n\n end",
"def create_load_balancer_policy(lb_name, name, type_name, attributes = {})\n params = {}\n\n attribute_name = []\n attribute_value = []\n attributes.each do |name, value|\n attribute_name.push(name)\n attribute_value.push(value)\n end\n\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeName', attribute_name))\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeValue', attribute_value))\n\n request({\n 'Action' => 'CreateLoadBalancerPolicy',\n 'LoadBalancerName' => lb_name,\n 'PolicyName' => name,\n 'PolicyTypeName' => type_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end",
"def set_load_balancer_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_status\n\t\t\targs[:query]['LoadBalancerStatus'] = optional[:load_balancer_status]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend",
"def remove_load_balancer_properties\n properties = []\n properties << :AccessLoggingPolicy\n properties << :AppCookieStickinessPolicy\n properties << :ConnectionDrainingPolicy\n properties << :CrossZone\n properties << :LBCookieStickinessPolicy\n properties << :LoadBalancerName\n properties << 'Listeners.PolicyNames'\n properties << 'Listeners.SSLCertificateId '\n properties << :Policies\n properties << :Scheme\n properties << :SecurityGroups\n properties << :Subnets\n add_patch Patches::RemoveProperty.new 'AWS::ElasticLoadBalancing::LoadBalancer', properties\n end",
"def populate\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['loadBalancer']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @protocol = data[\"protocol\"]\n @port = data[\"port\"]\n @algorithm = data[\"algorithm\"]\n @connection_logging = data[\"connectionLogging\"][\"enabled\"]\n @status = data[\"status\"]\n @timeout = data[\"timeout\"]\n true\n end",
"def create_elb(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n subnets: elb[:subnets],\n security_groups: elb[:security_groups],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateLoadBalancerName\n puts \"Load Balancer #{elb[:name]} already exists, bypassing\"\n rescue Aws::ElasticLoadBalancing::Errors::Throttling\n puts \"api throttled, retrying\"\n # TODO: Add exponential backoff\n sleep(5)\n retry\n end\n end",
"def enable_availability_zones_for_lb(lb_name, availability_zones)\n link = generate_request(\"EnableAvailabilityZonesForLoadBalancer\",\n :load_balancer_name => lb_name, :availability_zones => availability_zones)\n request_info(link, QElbAvailabilityZonesParser.new)\n rescue Exception\n on_exception\n end",
"def disable_availability_zones_for_load_balancer(availability_zones, lb_name)\n params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])\n request({\n 'Action' => 'DisableAvailabilityZonesForLoadBalancer',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::DisableAvailabilityZonesForLoadBalancer.new\n }.merge!(params))\n end",
"def elastic_load_balancer(name=nil, &block)\n @elastic_load_balancer ||= name ? _elastic_load_balancer(name, &block) : _elastic_load_balancer\n end",
"def describe_load_balancer_attribute(load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancerAttribute'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update_load_balancer_pool_with_http_info(pool_id, lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools/{pool-id}'.sub('{' + 'pool-id' + '}', pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#update_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_load_balancer_listeners(lb_name, listeners)\n params = {}\n\n listener_protocol = []\n listener_lb_port = []\n listener_instance_port = []\n listener_instance_protocol = []\n listener_ssl_certificate_id = []\n listeners.each do |listener|\n listener_protocol.push(listener['Protocol'])\n listener_lb_port.push(listener['LoadBalancerPort'])\n listener_instance_port.push(listener['InstancePort'])\n listener_instance_protocol.push(listener['InstanceProtocol'])\n listener_ssl_certificate_id.push(listener['SSLCertificateId'])\n end\n\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstanceProtocol', listener_instance_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))\n\n request({\n 'Action' => 'CreateLoadBalancerListeners',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end",
"def initialize(load_balancer)\n @connection = load_balancer.connection\n @load_balancer = load_balancer\n @lbmgmthost = @connection.lbmgmthost\n @lbmgmtpath = @connection.lbmgmtpath\n @lbmgmtport = @connection.lbmgmtport\n @lbmgmtscheme = @connection.lbmgmtscheme\n populate\n return self\n end",
"def disable_availability_zones_for_lb(lb_name, availability_zones)\n link = generate_request(\"DisableAvailabilityZonesForLoadBalancer\",\n :load_balancer_name => lb_name, :availability_zones => availability_zones)\n request_info(link, QElbAvailabilityZonesParser.new)\n rescue Exception\n on_exception\n end",
"def createCLB(elbv1, sg_tcp_80_lb, pub_net1_id, pub_net2_id)\n # TODO: Remove CLB by name if create fails to fully create\n\n # Create CLB\n response = elbv1.create_load_balancer(load_balancer_name: 'AutoCLB',\n subnets: [pub_net1_id, pub_net2_id],\n security_groups: [sg_tcp_80_lb],\n listeners: [{ protocol: 'HTTP',\n load_balancer_port: 80,\n instance_protocol: 'HTTP',\n instance_port: 80 }])\n clb_dns_name = response.dns_name\n puts \"clb_dns_name = #{clb_dns_name}\"\n clb_dns_name # return\nend",
"def load_balancer # rubocop:disable AbcSize\n raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?\n @@load_balancers ||= []\n add_lb(@new_resource.f5) if @@load_balancers.empty?\n add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.nil?\n @@load_balancers.find { |lb| lb.name == @new_resource.f5 }\n end",
"def set_load_balancer_h_t_t_p_s_listener_attribute(bandwidth, health_check, listener_port, load_balancer_id, sticky_session, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerHTTPSListenerAttribute'\n\t\targs[:query]['HealthCheck'] = health_check\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['StickySession'] = sticky_session\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :cookie\n\t\t\targs[:query]['Cookie'] = optional[:cookie]\n\t\tend\n\t\tif optional.key? :cookie_timeout\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or greater than 1' unless optional[:cookie_timeout] < 1\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or less than 86400' unless optional[:cookie_timeout] > 86400\n\t\t\targs[:query]['CookieTimeout'] = optional[:cookie_timeout]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than -520' unless optional[:health_check_connect_port] < -520\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_timeout\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or greater than 1' unless optional[:health_check_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or less than 50' unless optional[:health_check_timeout] > 50\n\t\t\targs[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :server_certificate_id\n\t\t\targs[:query]['ServerCertificateId'] = optional[:server_certificate_id]\n\t\tend\n\t\tif optional.key? :sticky_session_type\n\t\t\targs[:query]['StickySessionType'] = optional[:sticky_session_type]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tif optional.key? :x_forwarded_for\n\t\t\targs[:query]['XForwardedFor'] = optional[:x_forwarded_for]\n\t\tend\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend",
"def retrieve_elb(name)\n Clients.elb.describe_load_balancers(\n load_balancer_names: [name],\n ).load_balancer_descriptions[0]\nend",
"def add_load_balancer(name, ports, ip_address)\n\n unless ports.is_a? Array\n ports = [ ports ]\n end\n\n if name.nil?\n name = \"lb#{RandomName.create(5,3)}\"\n end\n\n if ip_address.is_a? String\n ip_address = public_ipaddress \"#{name}-addr\" do\n dns_settings domain_name_label: ip_address\n end\n end\n\n lb = load_balancer name do\n\n if ip_address.nil?\n fics = frontend_ipconfigurations name: name + '-feconf'\n else\n fics = frontend_ipconfigurations name: name + '-feconf',\n public_ipaddress: ip_address\n end\n\n pools = backend_address_pools name: name + '-pool'\n\n ports.each do |port|\n\n p = probes name: name + \"-probe#{port}\",\n protocol: 'Tcp',\n port: port,\n number_of_probes: 2,\n interval_in_seconds: 15\n\n load_balancing_rules name: \"rule#{port}\",\n frontend_ipconfiguration: fics[0],\n backend_address_pool: pools[0],\n protocol: 'Tcp',\n frontend_port: port,\n backend_port: port,\n idle_timeout_in_minutes: 15,\n probe: p[0]\n end\n\n end\n\n end",
"def create_load_balancer_pool_with_http_info(lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool ...'\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#create_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end",
"def create name, type, attributes = {}\n\n attribute_list = []\n\n attributes.each do |attr_name,values|\n [values].flatten.each do |value|\n attribute_list << { \n :attribute_name => attr_name, \n :attribute_value => value.to_s \n }\n end\n end\n\n client.create_load_balancer_policy(\n :load_balancer_name => load_balancer.name,\n :policy_name => name.to_s,\n :policy_type_name => type.to_s,\n :policy_attributes => attribute_list)\n\n LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)\n\n end",
"def add_lb(hostname)\n @@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname))\n end"
] | [
"0.6881987",
"0.63550526",
"0.60747653",
"0.5950793",
"0.58297247",
"0.5668725",
"0.5498494",
"0.54914826",
"0.5449023",
"0.54453933",
"0.5378115",
"0.53044623",
"0.5206537",
"0.5151398",
"0.51446295",
"0.51323014",
"0.507111",
"0.5070972",
"0.50553644",
"0.501969",
"0.5003848",
"0.49969953",
"0.4996103",
"0.4977172",
"0.49646702",
"0.49463516",
"0.49351886",
"0.4897898",
"0.4897376",
"0.4892773"
] | 0.7620888 | 0 |
repair the list this item belongs to | def repair_list
self.class.repair_list(list_scope)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repair_list\n model.repair_list(list_scope)\n end",
"def fix_items\n valid_items = EquipmentModel.where(id: items.keys).collect(&:id)\n self.items = items.select { |em, _count| valid_items.include? em }\n end",
"def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end",
"def remove_item(item)\n # raises WrongListException if item.list != self\n # TODO\n end",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\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 (item,list)\nlist.delete(item)\nlist\nend",
"def unpack\n list_items\n @items.each do |type,list|\n @items.delete(type)\n end\n end",
"def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def remove_item(list_item,user_list)\n user_list.delete(list_item)\n user_list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def add_item_to_list(grocery_list, item)\n grocery_list[item] = nil \n grocery_list\nend",
"def free item\n item.order_book.remove item if item.order_book\n end",
"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 remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def remove_item_list\n if @listing.job? \n ['Filled Position', 'Removed Job']\n elsif @listing.event? \n ['Event Cancelled', 'Event Ended']\n else\n ['Changed Mind', 'Donated Item', 'Gave Away Item', 'Sold Item']\n end\n end",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove_item_from_list(grocery_list, item) \n grocery_list.delete(item) \n grocery_list \nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend",
"def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend",
"def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def destroy\n @list_id = @item.list.id\n @item.destroy\n @items = List.find(@list_id).items.order(\"id ASC\")\n end"
] | [
"0.76052976",
"0.6876154",
"0.63864297",
"0.632772",
"0.61386406",
"0.6077444",
"0.60354894",
"0.60253173",
"0.6018955",
"0.6008113",
"0.5993467",
"0.5975745",
"0.5974182",
"0.59669507",
"0.59631884",
"0.5959673",
"0.59484965",
"0.5943476",
"0.59429574",
"0.59238696",
"0.59087044",
"0.59074485",
"0.5907293",
"0.58968174",
"0.58907706",
"0.5868018",
"0.58616024",
"0.58556736",
"0.58457696",
"0.58376634"
] | 0.76322925 | 0 |
reorder the list this item belongs to | def reorder_list(order)
self.class.repair_list(list_scope.merge(:order => order))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reorder_list(order)\n model.repair_list(list_scope.merge(:order => order))\n end",
"def reorder_queue_items\n queue_items.each_with_index do |queue_item,index|\n queue_item.update_attributes(list_order: index + 1)\n end\n end",
"def reorder(positions)\n\t SortableList.new(self.serial_works.in_order).reorder_list(positions)\n\tend",
"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 original_order\n end",
"def reorder_items(folder)\n # we have to do a sort_by, not order, because the updated attributes have not been saved.\n changed_folder, new, changed_position, unchanged = folder.items.\n sort_by(&:position).\n group_by do |item|\n if item.folder_id_was != item.folder_id\n :changed_folder\n elsif item.position_was.nil?\n :new\n elsif item.position_was != item.position\n :changed_position\n else\n :unchanged\n end\n end.values_at(:changed_folder, :new, :changed_position, :unchanged).map(&:to_a)\n\n # items that will be in this folder\n unmoved_items = unchanged\n # place items whose positions were specified\n changed_position.map {|item| unmoved_items.insert(item.position - 1, item)}\n # add new items at the end\n unmoved_items = unmoved_items + new\n # calculate positions\n unmoved_items.compact.\n select {|item| item.folder_id_was == item.folder_id}.\n each_with_index do |item, position|\n item.position = position + 1\n end\n\n # items that have moved to another folder\n changed_folder.select {|item| item.folder_id_was != item.folder_id}.each do |item|\n item.position = nil\n end\n end",
"def sorted_items(params = {})\n self.items.active.sort do |x1, x2| \n self.items_positions.index(x1.id) <=> self.items_positions.index(x2.id)\n end\n end",
"def sort_my_list\n @tracks.clear\n @artists.clear\n @genres.clear\n @user_list.each do |item|\n @tracks << item['id'] if item['type'] == 'track'\n @artists << item['id'] if item['type'] == 'artist'\n @genres << item['name'].downcase if item['type'] == 'genre'\n end\n end",
"def up_item \n order_op2(true, @item)\n end",
"def reorder_positions\n if position\n position = self.position\n update_attribute(:position, nil)\n self.class.update_all('position = (position - 1)', ['message_id = ? AND kind = ? AND position > ?', message_id, kind, position])\n end\n end",
"def reorder_list(field)\n index = 1\n list_scope(field).order_by(field => 'asc').each do |document|\n next if document.id == id\n\n index += 1 if index == self[field] && persisted?\n document.set(field => index)\n index += 1\n end\n\n if list_scope_changed?(field)\n list_scope_was(field).order_by(field => 'asc').each_with_index do |document, index|\n document.set(field => index + 1)\n end\n end\n end",
"def reorder\n @issue = @project.sprint_items.find(params[:issue_id])\n @issue.becomes(BacklogItem).remove_from_list\n\n @issue.remove_from_list\n\n @issue.sprint_id = @project.sprints.find(params[:id]).id\n @issue.save\n\n if @issue.insert_at(params[:position].to_i)\n render :json => :ok\n else\n render :json => { :errors => @issue.errors }, :status => :entity_unprocessable\n end\n end",
"def perform_reorder_of_children(ordered_ids, current)\n steps = calculate_reorder_steps(ordered_ids, current)\n steps.inject([]) do |result, (source, idx)|\n target = current[idx]\n if source.id != target.id \n source.swap(target, false) \n from = current.index(source)\n current[from], current[idx] = current[idx], current[from]\n result << source\n end\n result\n end\n end",
"def reorder!(order)\n @order = order\n\n @attributes = order!(@attributes, order)\n @name = name!(@attributes)\n\n if @name[-2, 2] == \".,\" # Fix this.\n @name = @name[0..-3]\n end\n\n self\n end",
"def order( items )\n self.parser.order(items) \n end",
"def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end",
"def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end",
"def sorted_line_items\n line_items.includes(:item).order(\"items.name\")\n end",
"def ordered_list; end",
"def update_sort_key\n @item.sort_key = @sortable[@parent.sort_index]\n @item.reversed = @parent.reversed? ? -1 : 1\n end",
"def reprocess_ordering\n orderable_scope.each_with_index do |resource, index|\n resource.update_column(:position, index)\n end\n end",
"def moveup\n papers = venue.papers.where(\"listorder < ?\",self.listorder).order(:listorder)\n \n if papers.length == 1\n self.listorder = papers[0].listorder - 1.0\n elsif papers.length > 1\n self.listorder = (papers[papers.length-1].listorder + papers[papers.length-2].listorder) / 2\n end\n end",
"def reorder\n sibs = siblings\n return if sibs.empty?\n sibs.each do |s|\n if self.ranking >= s.ranking\n self.move_to_left_of(s) and return\n end\n end\n self.move_to_right_of(sibs.last)\n end",
"def sort\n i = 0;\n list_orders = Hash[params[:list].to_a.map {|k| [k, i+=1]}]\n lists = Board.find(params[:board_id]).lists.order(:order)\n lists.each do |list|\n list.order = list_orders[list.id.to_s]\n list.save\n end\n render nothing: true\n end",
"def order_op2(haut, item)\n if haut\n sign = '<'\n name = 'haut'\n else\n sign = '>'\n name = 'bas'\n end\n if item.question.items.exists?([\"position #{sign} ?\", item.position])\n if haut\n item2 = item.question.items.where(\"position #{sign} ?\", item.position).order('position').reverse_order.first\n else\n item2 = item.question.items.where(\"position #{sign} ?\", item.position).order('position').first\n end\n swap_position(item, item2)\n flash[:success] = \"Choix déplacé vers le #{name}.\"\n end\n redirect_to question_manage_items_path(params[:question_id])\n end",
"def reorder_info(info) \n if (info[0][-1][-1]).is_i? == true \n order = [0, 1, 2, 4, 3]\n info.map! do |element|\n order.map {|x| element[x]}\n end\n else \n info \n end\nend",
"def sort\n params[:playlist_item].each_with_index do |id, index|\n PlaylistItem.update_all({position: index+1}, {id: id})\n end\n render nothing: true\n end",
"def reorder\n frm().link(:text=>\"Reorder\").click\n AssignmentsReorder.new(@browser)\n end",
"def reorder\n # delete tracks in front of current_track\n indices = OSX::NSIndexSet.indexSetWithIndexesInRange( OSX::NSRange.new(@current_track_index, @iTunes.queue.tracks.length - @current_track_index) )\n @iTunes.queue.tracks.removeObjectsAtIndexes(indices)\n track_ids = params[:queued_tracks].map {|track_id| track_id.to_i}.reverse\n tracks = track_ids.collect{ |id| @iTunes.find_track(id) }\n @iTunes.queue_tracks(tracks, nil)\n logger.debug \"reordering tracks\"\n\n# doesn't work:\n# @iTunes.queue.tracks.each_with_index do |track,index|\n# next if index == @current_track_index\n# @iTunes.queue.tracks.replaceObjectAtIndex_withObject(index, tracks[index]) \n# end\n\n respond_to do |format|\n format.js { \n reload_state_data \n render( :update ) { | page | \n page.replace(\"queue-box\", :partial => \"queued_tracks/queued_tracks\") \n } \n }\n end\n end",
"def render_items\n @items.reverse_each_with_index do |item, index|\n # Skip if item is already in\n next if item.parent\n\n next_item = @items[index + 1]\n if next_item\n # If there is a nex item isert before it\n next_id = next_item.data[key]\n el = @items.find { |element| element.data[key] == next_id }\n insert_before item, el\n else\n # Else append at the end\n item >> self\n end\n end\n end"
] | [
"0.761894",
"0.72861505",
"0.6808553",
"0.6429333",
"0.63515824",
"0.63418937",
"0.62593096",
"0.6160428",
"0.6114032",
"0.6087117",
"0.6077317",
"0.6066348",
"0.60639775",
"0.60224295",
"0.601586",
"0.5976452",
"0.5976452",
"0.5970553",
"0.5920123",
"0.58942634",
"0.5885365",
"0.5870111",
"0.58479553",
"0.5846487",
"0.58146966",
"0.58032733",
"0.5785813",
"0.5781343",
"0.57728934",
"0.57612485"
] | 0.7510975 | 1 |
Find best matching competition race for category. Iterate through traits (weight, equipment, ages, gender, abilities) until there is a single match (or none). | def best_match_in(event)
logger.debug "Category#best_match_in #{name} in #{event.name}: #{event.categories.map(&:name).join(', ')}"
candidate_categories = event.categories
equivalent_match = candidate_categories.detect { |category| equivalent?(category) }
logger.debug "equivalent: #{equivalent_match&.name}"
return equivalent_match if equivalent_match
candidate_categories = candidate_categories.select { |category| weight == category.weight }
logger.debug "weight: #{candidate_categories.map(&:name).join(', ')}"
candidate_categories = candidate_categories.select { |category| equipment == category.equipment }
logger.debug "equipment: #{candidate_categories.map(&:name).join(', ')}"
candidate_categories = candidate_categories.select { |category| ages_begin.in?(category.ages) }
logger.debug "ages: #{candidate_categories.map(&:name).join(', ')}"
candidate_categories = candidate_categories.reject { |category| gender == "M" && category.gender == "F" }
logger.debug "gender: #{candidate_categories.map(&:name).join(', ')}"
candidate_categories = candidate_categories.select { |category| ability_begin.in?(category.abilities) }
logger.debug "ability: #{candidate_categories.map(&:name).join(', ')}"
return candidate_categories.first if candidate_categories.one?
return nil if candidate_categories.empty?
if junior?
junior_categories = candidate_categories.select { |category| category.junior? }
logger.debug "junior: #{junior_categories.map(&:name).join(', ')}"
return junior_categories.first if junior_categories.one?
if junior_categories.present?
candidate_categories = junior_categories
end
end
if masters?
masters_categories = candidate_categories.select { |category| category.masters? }
logger.debug "masters?: #{masters_categories.map(&:name).join(', ')}"
return masters_categories.first if masters_categories.one?
if masters_categories.present?
candidate_categories = masters_categories
end
end
# E.g., if Cat 3 matches Senior Men and Cat 3, use Cat 3
# Could check size of range and use narrowest if there is a single one more narrow than the others
candidate_categories = candidate_categories.reject { |category| category.all_abilities? }
logger.debug "reject wildcards: #{candidate_categories.map(&:name).join(', ')}"
return candidate_categories.first if candidate_categories.one?
return nil if candidate_categories.empty?
# "Highest" is lowest ability number
highest_ability = candidate_categories.map(&:ability_begin).min
if candidate_categories.one? { |category| category.ability_begin == highest_ability }
highest_ability_category = candidate_categories.detect { |category| category.ability_begin == highest_ability }
logger.debug "highest ability: #{highest_ability_category.name}"
return highest_ability_category
end
candidate_categories = candidate_categories.reject { |category| gender == "F" && category.gender == "M" }
logger.debug "exact gender: #{candidate_categories.map(&:name).join(', ')}"
return candidate_categories.first if candidate_categories.one?
return nil if candidate_categories.empty?
logger.debug "no wild cards: #{candidate_categories.map(&:name).join(', ')}"
return candidate_categories.first if candidate_categories.one?
return nil if candidate_categories.empty?
raise "Multiple matches #{candidate_categories.map(&:name)} for #{name} in #{event.categories.map(&:name).join(', ')}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_match_in(event_categories, result_age = nil)\n debug \"Category#best_match_in for #{name} in #{event_categories.map(&:name).join(', ')}\"\n\n candidate_categories = event_categories.dup\n\n equivalent_matches = candidate_categories.select { |category| equivalent?(category) }\n debug \"equivalent: #{equivalent_matches.map(&:name).join(', ')}\"\n return equivalent_matches.first if one_match?(equivalent_matches)\n\n # Sometimes categories like Beginner and Cat 4 are equivalent but need to\n # be separated if both categories exist\n exact_equivalent = equivalent_matches.detect { |category| category.name == name }\n debug \"exact equivalent: #{exact_equivalent}\"\n return exact_equivalent if exact_equivalent\n\n # If no weight match, ignore weight and match on age and gender\n if candidate_categories.any? { |category| weight == category.weight }\n candidate_categories = candidate_categories.select { |category| weight == category.weight }\n end\n debug \"weight: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n # Eddy is essentially senior men/women for BAR\n if equipment == \"Eddy\"\n highest_senior_category = candidate_categories.detect do |category|\n category.ability_begin == 0 &&\n category.gender == gender &&\n !category.age_group? &&\n (category.equipment == \"Eddy\" || category.equipment.blank?)\n end\n debug \"eddy: #{highest_senior_category&.name}\"\n return highest_senior_category if highest_senior_category\n end\n\n # Equipment matches are fuzzier\n candidate_categories = candidate_categories.select { |category| equipment == category.equipment }\n debug \"equipment: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return candidate_categories.first if candidate_categories.one? && equipment?\n return nil if candidate_categories.empty?\n\n if equipment?\n equipment_categories = candidate_categories.select do |category|\n equipment == category.equipment && gender == category.gender\n end\n debug \"equipment and gender: #{equipment_categories.map(&:name).join(', ')}\"\n return equipment_categories.first if equipment_categories.one?\n end\n\n candidate_categories = candidate_categories.reject { |category| gender == \"M\" && category.gender == \"F\" }\n debug \"gender: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n candidate_categories = if result_age && !senior? && candidate_categories.none? { |category| ages_begin.in?(category.ages) }\n candidate_categories.select { |category| category.ages.include?(result_age) }\n elsif junior? && ages_begin == 0\n candidate_categories.select { |category| ages_end.in?(category.ages) }\n else\n candidate_categories.select { |category| ages_begin.in?(category.ages) }\n end\n debug \"ages: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n unless all_abilities?\n candidate_categories = candidate_categories.select { |category| ability_begin.in?(category.abilities) }\n debug \"ability: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n end\n\n # Edge case for unusual age ranges that span juniors and seniors like 15-24\n if !senior? && ages_begin <= Ages::JUNIORS.end && ages_end > Ages::JUNIORS.end\n candidate_categories = candidate_categories.reject(&:junior?)\n debug \"overlapping ages: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n end\n\n if junior?\n junior_categories = candidate_categories.select(&:junior?)\n debug \"junior: #{junior_categories.map(&:name).join(', ')}\"\n return junior_categories.first if junior_categories.one?\n\n candidate_categories = junior_categories if junior_categories.present?\n end\n\n if masters?\n masters_categories = candidate_categories.select(&:masters?)\n debug \"masters?: #{masters_categories.map(&:name).join(', ')}\"\n return masters_categories.first if masters_categories.one?\n\n candidate_categories = masters_categories if masters_categories.present?\n end\n\n # E.g., if Cat 3 matches Senior Men and Cat 3, use Cat 3\n # Could check size of range and use narrowest if there is a single one more narrow than the others\n unless candidate_categories.all?(&:all_abilities?) || all_abilities?\n candidate_categories = candidate_categories.reject(&:all_abilities?)\n end\n debug \"reject wildcards: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n # \"Highest\" is lowest ability number\n # Choose exact ability category begin if women\n # Common edge case where the two highest categories are Pro/1/2 and Women 1/2\n if candidate_categories.one? { |category| category.ability_begin == ability_begin && category.women? && women? }\n ability_category = candidate_categories.detect { |category| category.ability_begin == ability_begin && category.women? && women? }\n debug \"ability begin: #{ability_category.name}\"\n return ability_category if ability_category.include?(self)\n end\n\n # Edge case for next two matchers: don't choose Junior Open 1/2/3 over Junior Open 3/4/5 9-12 for Junior Open 3/4/5 11-12,\n # but still match Junior Women with Category 1\n\n # Choose highest ability category\n highest_ability = candidate_categories.map(&:ability_begin).min\n if candidate_categories.one? { |category| category.ability_begin == highest_ability && (!category.junior? || category.ages.size <= ages.size) }\n highest_ability_category = candidate_categories.detect { |category| category.ability_begin == highest_ability && (!category.junior? || category.ages.size <= ages.size) }\n debug \"highest ability: #{highest_ability_category.name}\"\n return highest_ability_category if highest_ability_category.include?(self)\n end\n\n # Choose highest ability by gender\n if candidate_categories.one? { |category| category.ability_begin == highest_ability && category.gender == gender && (!category.junior? || category.ages.size <= ages.size) }\n highest_ability_category = candidate_categories.detect { |category| category.ability_begin == highest_ability && category.gender == gender && (!category.junior? || category.ages.size <= ages.size) }\n debug \"highest ability for gender: #{highest_ability_category.name}\"\n return highest_ability_category if highest_ability_category.include?(self)\n end\n\n # Choose highest minimum age if multiple Masters 'and over' categories\n if masters? && candidate_categories.all?(&:and_over?)\n if result_age\n candidate_categories = candidate_categories.reject { |category| category.ages_begin > result_age }\n end\n highest_age = candidate_categories.map(&:ages_begin).max\n highest_age_category = candidate_categories.detect { |category| category.ages_begin == highest_age }\n debug \"highest age: #{highest_age_category&.name}\"\n return highest_age_category if highest_age_category&.include?(self)\n end\n\n # Choose narrowest age if multiple Masters categories\n if masters?\n ranges = candidate_categories.select(&:masters?).map do |category|\n category.ages_end - category.ages_begin\n end\n\n minimum_range = ranges.min\n candidate_categories = candidate_categories.select do |category|\n (category.ages_end - category.ages_begin) == minimum_range\n end\n\n return candidate_categories.first if one_match?(candidate_categories)\n end\n\n # Choose narrowest age if multiple Juniors categories\n if junior?\n ranges = candidate_categories.select(&:junior?).map do |category|\n category.ages_end - category.ages_begin\n end\n\n minimum_range = ranges.min\n candidate_categories = candidate_categories.select do |category|\n (category.ages_end - category.ages_begin) == minimum_range\n end\n\n debug \"narrow junior ages: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n end\n\n candidate_categories = candidate_categories.reject { |category| gender == \"F\" && category.gender == \"M\" }\n debug \"exact gender: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n if wildcard? && candidate_categories.none?(&:wildcard?)\n debug \"no wild cards: #{candidate_categories.map(&:name).join(', ')}\"\n return nil\n end\n\n if candidate_categories.size > 1\n raise \"Multiple matches #{candidate_categories.map(&:name)} for #{name}, result age: #{result_age} in #{event_categories.map(&:name).join(', ')}\"\n end\n end",
"def best_by_type_and_category(type, category = nil)\n conditions = [\"debates.is_live = ? AND debates.priv = ? AND arguments.argument_type = ? AND debates.category_id != ?\",\n true, false, type, Category.practice_debate]\n if category\n conditions[0] += \" AND debates.category_id = ?\"\n conditions << category\n end\n \n Argument.first :joins => :debate, :conditions => conditions, :order => 'arguments.score desc'\n end",
"def match(categories)\n result = []\n for category in categories\n score = score(category)\n result << {value: score, category: category}\n end\n\n highest_value = result.map{|x| x[:value]}.sort.last\n selected_category = nil\n if highest_value > 0\n result.each do |hash|\n if hash[:value] == highest_value\n selected_category = hash[:category]\n end\n end\n end\n\n return selected_category\n\n end",
"def get_team_best_individual_result(gender_type, pool_type, event_type, category_code)\n if has_individual_result?(gender_type, pool_type, event_type, category_code)\n # team.meeting_individual_results\n # .is_not_disqualified\n # .for_gender_type(gender_type)\n # .for_pool_type(pool_type)\n # .for_event_type(event_type)\n # .for_category_code(category_code)\n # .sort_by_timing.first\n team.meeting_individual_results\n .is_not_disqualified\n .for_team_best(pool_type, gender_type, category_code, event_type)\n .sort_by_timing.first\n end\n end",
"def grouped_user_fitness\n grouped_activities.select {|activity| activity.category == \"Health & Fitness\"}\n end",
"def coolest_ability\n coolest_ability = nil\n abilities.each do | current_ability | \n if coolest_ability == nil || current_ability[:coolness] > coolest_ability[:coolness]\n coolest_ability = current_ability\n end\n end\n coolest_ability\n end",
"def scan_for_gender_category_and_event\n # Scan genders, than Category, than events, than pool types\n # An element occurs if at least one meeting individual result is present\n GenderType.individual_only.each do |gender_type|\n PoolType.only_for_meetings.each do |pool_type|\n @event_types.each do |event_type|\n @categories.each do |category_code|\n # If at least on meeting individual result add an element\n next unless MeetingIndividualResult\n .for_season_type(@season.season_type)\n .for_gender_type(gender_type)\n .for_category_code(category_code)\n .for_pool_type(pool_type)\n .for_event_type(event_type)\n .exists?\n\n @single_events << SeasonPonderatedBestsDAO::EventPonderatedBestDAO.new(\n @season,\n gender_type,\n CategoryType.for_season(@season).find_by(code: category_code),\n event_type,\n pool_type,\n @max_results,\n @bests_to_be_ignored\n )\n end\n end\n end\n end\n end",
"def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n # from whole name singularized\n candidates = []\n decorated_category = Cyclopedio::Syntax::NameDecorator.new(category, parse_tree_factory: @parse_tree_factory)\n @nouns.singularize_name(category.name, decorated_category.category_head).each do |name_singularized|\n candidates.concat(candidates_for_name(name_singularized,@category_filters))\n end\n candidate_set = create_candidate_set(category.name,candidates)\n return @category_cache[category] = candidate_set if !candidate_set.empty? || @category_exact_match\n # from simplified name\n candidate_set = candidate_set_for_syntax_trees(decorated_category.category_head_trees,@category_filters)\n return @category_cache[category] = candidate_set unless candidate_set.empty?\n # from original whole name\n candidate_set = candidate_set_for_name(category.name, @category_filters)\n @category_cache[category] = candidate_set\n end",
"def talents\n talents = {}\n unless self.character_talents.empty?\n self.character_talents.each do |talent_tree|\n talent_tree.attributes.each do |key, value|\n if key.match(/talent_[\\d]_[\\d]$/) and !value.nil?\n if talents.has_key?(value) && !talent_tree[\"#{key}_options\"].nil?\n talents[value]['count'] = talents[value]['count'] + 1\n talent_tree[\"#{key}_options\"].each do |opt|\n opt_test = opt.to_i\n if opt_test.is_a? Integer and opt_test > 0\n talents[value]['options'] << Skill.find_by_id(opt).name\n else\n talents[value]['options'] << opt.capitalize\n end\n end\n else\n talents[value] = {}\n talents[value]['count'] = 1\n talents[value]['options'] = Array.new\n unless talent_tree[\"#{key}_options\"].nil?\n unless talent_tree[\"#{key}_options\"].empty?\n talent_tree[\"#{key}_options\"].each do |opt|\n opt_test = opt.to_i\n if opt_test.is_a? Integer and opt_test > 0\n talents[value]['options'] << Skill.find_by_id(opt).name\n else\n talents[value]['options'] << opt.capitalize\n end\n end\n end\n end\n end\n end\n end\n end\n talents\n end\n\n # Build the character cybernetics selection.\n def cybernetics\n cybernetics = Array.new\n items = Array.new\n bonus_arms = {\n :agility => nil,\n :brawn => nil\n }\n bonus_legs = {\n :agility => nil,\n :brawn => nil\n }\n bonus_head = {\n :intellect => nil\n }\n left_leg_active = false\n right_leg_active = false\n arms_active = false\n head_active = false\n bonus_soak = 0\n\n if self.character_cybernetics\n self.character_cybernetics.each do |cyb|\n bonus = nil\n unless cyb.gear_id.nil?\n if cyb.respond_to?(\"#{cyb.gear.name.gsub(/[^0-9a-z\\\\s]/i, '').downcase}\")\n bonus = cyb.send(\"#{cyb.gear.name.gsub(/[^0-9a-z\\\\s]/i, '').downcase}\")\n if bonus\n if !arms_active && (cyb.location == 'left_arm' || cyb.location == 'right_arm')\n bonus_arms = bonus\n arms_active = true\n end\n if cyb.location == 'left_leg'\n left_leg_active = cyb.gear.id\n end\n if cyb.location == 'right_leg'\n right_leg_active = cyb.gear.id\n end\n if left_leg_active == right_leg_active\n bonus_legs = bonus\n end\n if !head_active && cyb.location == 'head'\n bonus_head = bonus\n head_active = true\n end\n if bonus[:soak]\n bonus_soak = bonus[:soak]\n end\n end\n end\n\n items << {\n :name => cyb.gear.name,\n :location => cyb.location,\n :bonus => bonus\n }\n end\n end\n end\n\n cybernetics = {\n :items => items,\n :bonuses => {\n :agility => (bonus_arms[:agility] ? bonus_arms[:agility] : 0) + (bonus_legs[:agility] ? bonus_legs[:agility] : 0),\n :brawn => (bonus_arms[:brawn] ? bonus_arms[:brawn] : 0) + (bonus_legs[:brawn] ? bonus_legs[:brawn] : 0),\n :intellect => (bonus_head[:intellect] ? bonus_head[:intellect] : 0),\n :soak => bonus_soak,\n },\n :legs => left_leg_active == right_leg_active\n }\n\n cybernetics\n end\n\n character_bonus_talents = CharacterBonusTalent.where(:character_id => self.id)\n unless character_bonus_talents.empty?\n character_bonus_talents.each do |bt|\n talent_ranks = RaceTalent.where(:race_id => self.race.id, :talent_id => bt.talent_id).first#.ranks\n unless talent_ranks.nil?\n if talents.has_key?(bt.talent_id)\n talents[bt.talent_id]['count'] = talents[bt.talent_id]['count'] + talent_ranks.ranks\n else\n talents[bt.talent_id] = {}\n talents[bt.talent_id]['count'] = talent_ranks.ranks\n talents[bt.talent_id]['options'] = Array.new\n end\n end\n end\n end\n\n # Include talent alterations from equipped armor.\n if self.armor_modification_bonuses['talents']\n self.armor_modification_bonuses['talents'].each do |armor_talents|\n if talents.has_key?(armor_talents)\n talents[armor_talents]['count'] = talents[armor_talents]['count'] + 1\n else\n talents[armor_talents] = {}\n talents[armor_talents]['count'] = 1\n talents[armor_talents]['options'] = Array.new\n end\n end\n end\n # Include talent alterations from equipped weapons.\n if self.weapon_modification_bonuses['talents']\n self.weapon_modification_bonuses['talents'].each do |weapon_talents|\n if talents.has_key?(weapon_talents)\n talents[weapon_talents]['count'] = talents[weapon_talents]['count'] + 1\n else\n talents[weapon_talents] = {}\n talents[weapon_talents]['count'] = 1\n talents[weapon_talents]['options'] = Array.new\n end\n end\n end\n talents\n end",
"def get_category_to_split_into(meeting_individual_result)\n category_type = meeting_individual_result.category_type\n if category_needs_split?(category_type)\n # Find the swimmer age\n swimmer_age = meeting_individual_result.get_swimmer_age\n element = @distinct_categories.rindex { |e| e.code != category_type.code && e.age_begin <= swimmer_age && e.age_end >= swimmer_age && !e.is_undivided }\n end\n element ? @distinct_categories[element] : find_category_by_code(category_type.code)\n end",
"def scan_for_distinct_bests\n team_distinct_best = RecordX4dDAO.new(@team, RecordType.find_by(code: 'TTB'))\n # Cycle between set genders, pools, events and distinct categories\n @gender_types.each do |gender_type|\n @pool_types.each do |pool_type|\n @event_types.each do |event_type|\n @distinct_categories.each do |category_type|\n record = get_team_best_individual_result(gender_type, pool_type, event_type, category_type.code)\n team_distinct_best.add_record(record) if record\n end\n end\n end\n end\n team_distinct_best\n end",
"def rooms_from_category(category)\n rooms.find_all do |room|\n room.category(:bedroom)\n end\n require \"pry\"; binding.pry\n end",
"def incomplete_or_category(category)\n reset_incomplete_category_courses(category)\n reset_complete_category_courses(category)\n\n temp_set = complete[category].keys.first\n temp_courses = complete[category].values.flatten.uniq\n complete[category] = {}\n complete[category][temp_set] = temp_courses\n end",
"def category\n case self.scorable_type\n when \"GovernmentScore\"\n return \"Government\"\n when \"ParkScore\"\n return \"Parks\"\n when \"SchoolScore\"\n return \"Schools\"\n when \"PoliceScore\"\n return \"Police\"\n when \"PublicScore\"\n return \"Public Works\"\n end\n end",
"def random_item(category)\n if category == 'best-bets'\n # Sample a random Best Bet type from a static list\n ['webofscience', 'googlescholar', 'ieee', 'pubmed', 'morningstar', 'wgsn', 'standards', 'dissertation', 'refworks', 'ibis', 'proquest',\n 'psychinfo', 'sciencemagazine', 'sciencedirect', 'petition', 'compendex', 'jstor', 'software', 'naturejournal'].sample\n elsif category == 'doi-trap'\n # Sample a random DOI from a static list\n ['10.1080/10510974.2013.797483', '10.1111/j.1468-2958.1996.tb00379.x', 'http://dx.doi.org/10.1063/1.2741534', 'DOI: 10.1007/BF02887151',\n '10.1039/C4RA16247A', '10.1002/sce.3730670213', 'DOI: 10.1007/s40596-014-0241-5', '10.1080/15348423.2012.697437',\n 'http://dx.doi.org/10.3168/jds.S0022-0302(86)80552-5', 'DOI: 10.1023/A:1005204727421', '10.1039/C3TA00019B', 'doi:10.1038/leu.2016.163',\n 'DOI: 10.1007/s10853-013-7374-x', 'doi: 10.1016/0167-2738(91)90233-2', 'doi: 10.1179/000705992798268927', '10.1038/nphys3794',\n 'doi: 10.1149/1.1393288', '10.1080/1554480X.2014.926052', '10.1002/adma.201506234', '10.1080/00958972.2016.1176158'].sample\n elsif category == 'result-types'\n # Use a defined searcher for found types\n (QuickSearch::Engine::APP_CONFIG['searchers']).sample.dasherize\n elsif category == 'more-options'\n # Use a result number for more-options\n ['result-1', 'result-2', 'result-3', 'result-4'].sample\n elsif category == 'spelling-suggestion'\n # Use a fake string\n 'spelling suggestion ' + (rand*200).to_i.to_s\n else\n # Use one of the typical options for a searcher click (or anything else we haven't handled above)\n ['heading', 'result-1', 'result-2', 'result-3', 'see-all-results', 'no-results', 'error'].sample\n end \nend",
"def unit_category(u)\n return if u.flags1.left or u.flags1.incoming\n # return if hostile & unit_invisible(u) (hidden_in_ambush or caged+mapblock.hidden or caged+holder.ambush\n return :Dead if u.flags1.dead\n return :Dead if u.flags3.ghostly # hostile ?\n return :Others if !unit_isfortmember(u)\n casteflags = u.race_tg.caste[u.caste].flags if u.caste >= 0\n return :Livestock if casteflags and (casteflags[:PET] or casteflags[:PET_EXOTIC])\n return :Citizens if unit_testflagcurse(u, :CAN_SPEAK)\n :Livestock\n # some other stuff with ui.race_id ? (jobs only?)\n end",
"def get_contestant_name(data, occupation)\n data.each do |season_iteration, stats|\n stats.find do |job|\n if job[\"occupation\"] == occupation\n return job[\"name\"]\n end\n end\n end\nend",
"def best_candidate\n self.by_quality.first\n end",
"def view_by_category\n system \"clear\"\n prompt = TTY::Prompt.new\n prompt.select (\"Choose a category\") do |menu|\n menu.choice \"Action\", -> {show_games_by_category(\"Action\")}\n menu.choice \"Action-Adventure\", -> {show_games_by_category(\"Action-Adventure\")}\n menu.choice \"Adventure\", -> {show_games_by_category(\"Adventure\")}\n menu.choice \"Puzzle\", -> {show_games_by_category(\"Puzzle\")}\n menu.choice \"Role-playing\", -> {show_games_by_category(\"Role-playing\")}\n menu.choice \"Simulation\", -> {show_games_by_category(\"Simulation\")}\n menu.choice \"Sports\", -> {show_games_by_category(\"Sports\")}\n menu.choice \"Strategy\", -> {show_games_by_category(\"Strategy\")}\n end\n end",
"def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n candidates = candidates_for_name(singularize_name(category.name, category.head), @category_filters)\n if !candidates.empty?\n candidate_set = create_candidate_set(category.name,candidates)\n else\n candidate_set = candidate_set_for_syntax_trees(category.head_trees,@category_filters)\n end\n if candidate_set.empty?\n candidates = candidates_for_name(category.name, @category_filters)\n candidate_set = create_candidate_set(category.name,candidates) unless candidates.empty?\n end\n @category_cache[category] = candidate_set\n end",
"def source_results(race)\n if race.discipline == 'Road'\n race_disciplines = \"'Road', 'Circuit'\"\n else\n race_disciplines = \"'#{race.discipline}'\"\n end\n \n # Cat 4/5 is a special case. Can't config in database because it's a circular relationship.\n category_ids = category_ids_for(race)\n category_4_5_men = Category.find_by_name(\"Category 4/5 Men\")\n category_4_men = Category.find_by_name(\"Category 4 Men\")\n if category_4_5_men && category_4_men && race.category == category_4_men\n category_ids << \", #{category_4_5_men.id}\"\n end\n\n Result.find(:all,\n :include => [:race, {:person => :team}, :team, {:race => [{:event => { :parent => :parent }}, :category]}],\n :conditions => [%Q{\n place between 1 AND #{point_schedule.size - 1}\n and (events.type in ('Event', 'SingleDayEvent', 'MultiDayEvent', 'Series', 'WeeklySeries', 'TaborOverall') or events.type is NULL)\n and bar = true\n and events.sanctioned_by = \"#{ASSOCIATION.default_sanctioned_by}\"\n and categories.id in (#{category_ids})\n and (events.discipline in (#{race_disciplines})\n or (events.discipline is null and parents_events.discipline in (#{race_disciplines}))\n or (events.discipline is null and parents_events.discipline is null and parents_events_2.discipline in (#{race_disciplines})))\n and (races.bar_points > 0\n or (races.bar_points is null and events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points is null and parents_events_2.bar_points > 0))\n and events.date between '#{date.year}-01-01' and '#{date.year}-12-31'\n }],\n :order => 'person_id'\n )\n end",
"def cost class_name, race\n\t\tif @prohibits != nil and (@prohibits.include?(race) or @prohibits.include?(class_name))\n\t\t\treturn nil\n\t\tend\n\t\tif !@cost.is_a? Hash\n\t\t\treturn @cost\n\t\tend\n\t\t# Allowed, but discouraged. It's preferable to define racial changes to skill costs through the\n\t\t# race section.\n\t\tif @cost.has_key? \"#{race} #{class_name}\"\n\t\t\treturn @cost[\"#{race} #{class_name}\"]\n\t\tend\n\t\tif @cost.has_key? race\n\t\t\treturn @cost[race]\n\t\tend\n\t\tif @cost.has_key? class_name\n\t\t\treturn @cost[class_name]\n\t\tend\n\n\t\t# Cost not found: This is our way of throwing an error\n\t\treturn nil\n\tend",
"def match\n \n # Identify matching cells, track them\n \n # Match skill names\n i = 0\n \n 5.times do |search_row_i|\n 5.times do |result_row_i|\n # Match skill name (column = 0)\n match_keyword(i, [search_row_i, 0], [result_row_i, 0])\n \n if match_id_exists?(i)\n \n # Match skill years experience\n match_integer(i, [search_row_i, 1], [result_row_i, 1])\n \n # Match skill details\n match_keyword_array(i, [search_row_i, 2], [result_row_i, 2])\n end\n \n i += 1\n end\n end\n \n # Match additional job-related stuff (job type, job location)\n \n \n # Calculate points\n calc_skill_names([[0, 1], [5, 6]], false, 50, 10)\n calc_skill_names([[2, 3, 4], [7, 8, 9], [10, 15, 20], [11, 16, 21]], (pct > 0), 40, 10) \n calc_skill_names([[12, 13, 14], [17, 18, 19], [22, 23, 24]], (pct > 0), 30, 10)\n \n calc_additional_attributes({:years_experience_pct => 5, :skill_details_first_pct => 2.5, :skill_details_additional_pct => 1})\n \n # puts \"---------- PCT: \" + @pct.to_s\n \n end",
"def unit_other_category(u)\n # comment is actual code returned by the df function\n return :Berserk if u.mood == :Berserk # 5\n return :Berserk if unit_testflagcurse(u, :CRAZED) # 14\n return :Undead if unit_testflagcurse(u, :OPPOSED_TO_LIFE) # 1\n return :Undead if u.flags3.ghostly # 15\n\n if df.gamemode == :ADVENTURE\n return :Hostile if u.civ_id == -1 # 2\n if u.animal.population.region_x == -1\n return :Wild if u.flags2.roaming_wilderness_population_source_not_a_map_feature # 0\n else\n return :Hostile if u.flags2.important_historical_figure and n = unit_nemesis(u) and n.flags[:ACTIVE_ADVENTURER] # 2\n end\n return :Hostile if u.flags2.resident # 3\n return :Hostile # 4\n end\n\n return :Invader if u.flags1.active_invader or u.flags1.invader_origin # 6\n return :Friendly if u.flags1.forest or u.flags1.merchant or u.flags1.diplomat # 8\n return :Hostile if u.flags1.tame # 7\n\n if u.civ_id != -1\n return :Unsure if u.civ_id != df.ui.civ_id or u.flags1.resident or u.flags1.visitor or u.flags1.visitor_uninvited # 10\n return :Hostile # 7\n\n elsif u.animal.population.region_x == -1\n return :Friendly if u.flags2.visitor # 8\n return :Uninvited if u.flags2.visitor_uninvited # 12\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Resident if u.flags2.resident # 13\n return :Friendly # 8\n\n else\n return :Friendly if u.flags2.visitor # 8\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Wild if u.animal.population.feature_idx == -1 and u.animal.population.cave_id == -1 # 0\n return :Wild # 11\n end\n end",
"def criminal_skills(roll)\n case roll\n when 1..2\n if @@skills.include? \"Barter\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Barter\" # 1 pt max\n end\n when 3..9\n @@skills << \"Climbing\"\n when 10..13\n @@skills << \"Disguise Artist\"\n when 14..19\n @@skills << \"Dodge\"\n when 20..21\n @@skills << \"Driver\"\n when 22\n if @@skills.include? \"Erotic Arts\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Erotic Arts\" # max 1 skill pt in this area\n end\n when 23..25\n if @@skills.include? \"Forgery\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Forgery\"\n @@literacy = \"Literate\"\n end\n when 26..29\n @@skills << \"Gambler\"\n when 30..31\n @@skills << \"Grapple\"\n when 32\n @@skills << \"Gun Slinger\"\n when 33\n @@skills << \"Gunsmith\"\n when 34..37\n @@skills << \"Junk Crafter\"\n when 38..41\n @@skills << \"Knife Fighter\"\n when 42..47\n @@skills << \"Knife Thrower\"\n when 48..51\n @@skills << \"Lying\"\n when 52\n @@skills << \"Medic\"\n when 53..54\n if @@skills.include? \"Navigate by Stars\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Navigate by Stars\" # max 1 point in this skill\n end\n when 55\n @@skills << \"Negotiating\"\n when 56..66\n @@skills << \"Pick Locks\"\n when 67..77\n @@skills << \"Pick Pocket\"\n when 78\n @@skills << \"Pilot\"\n when 79\n @@skills << \"Relic Knowledge\"\n when 80..81\n @@skills << \"Riding\"\n when 82\n @@skills << \"Sniper\"\n when 83..88\n @@skills << \"Stealth\"\n when 89..91\n @@skills << \"Tracking\"\n when 92..94\n @@skills << \"Unarmed Combat\"\n when 95\n @@skills << \"Wilderness Survival\"\n when 96..100\n @@skills << \"Weapons Expert\"\n # if rolled more than once, take a second level in the same weapon or randomly roll a new weapon -- player's choice. Mutants and cyborgs can choose to apply the weapon expert skill to a mutation or implant, as desired.\n end\nend",
"def getValue category\n case category\n when \"camera\"\n return 0\n when \"design\"\n return 1\n when \"perform\"\n return 2\n when \"general\"\n return 3\n when \"misc\"\n return 4\n end\nend",
"def select_fittest(category, options = {})\n category = case category\n when Category\n category\n when String\n categories.first(:conditions => ['upper(categories.name) = upper(?)', category])\n end\n uhook_select_fittest category, options unless category.nil?\n end",
"def allocateTraits\r\n\r\n\tif $class == \"1\" #Soldier\r\n\t\t$lvl=1\t#character level\r\n\t\t$str=8\t#Strength\r\n\t\t$dex=8\t#dexterity\r\n\t\t$con=8\t#constitution\r\n\t\t$int=8\t#intelligence\r\n\t\t$wis=8\t#wisdom\r\n\t\t$cha=8\t#charisma\t\r\n\t\t$maxVit=10 #vitality\r\n\t\t$vit=10\r\n\t\t$atk=$lvl #base attack\r\n\t\t$defenseBonus=0 \r\n\t\t\r\n\r\n\telsif $class == 2 #Scout\r\n\t\t$lvl=1\t\r\n\t\t$str=8\r\n\t\t$dex=8\r\n\t\t$con=8\r\n\t\t$int=8\r\n\t\t$wis=8\r\n\t\t$cha=8\r\n\t\t$maxVit=8\r\n\t\t$vit=8\r\n\t\t$atk=($lvl*0.75) #base attack\r\n\t\t$defenseBonus=2\r\n\r\n\telsif $class == 3 #Scoundrel\r\n\t\t$str=8\r\n\t\t$dex=8\r\n\t\t$con=8\r\n\t\t$int=8\r\n\t\t$wis=8\r\n\t\t$cha=8\r\n\t\t$maxVit=6\r\n\t\t$vit=6\r\n\t\t$atk=($lvl*0.75) #base attack\r\n\t\t$defenseBonus=4\r\n\t\t\r\n\telse\r\n\t\t$vit = 6\r\n\t\t$maxVit = 6\r\n\t\r\n\r\n\tend\r\n\r\nend",
"def category mt=nil\n return source.category.to_sym unless source.category.blank? \n mt ||= meta_data \n if mt.keys.include?(:season) || mt.keys.include?(:episode)\n return :tv_show\n elsif mt.keys.include?(:edition) || mt.keys.include?(:quality) || mt.keys.include?(:year)\n return :movie\n else\n return :unknown\n end \n end",
"def criterions\n objectives.collect(&:criterion).uniq.sort{|a,b| a.category <=> b.category}\n end"
] | [
"0.5972105",
"0.5694107",
"0.55712306",
"0.5510315",
"0.5304478",
"0.5271997",
"0.5234641",
"0.5234431",
"0.52040195",
"0.51542526",
"0.51541793",
"0.5127752",
"0.509658",
"0.5092023",
"0.5078666",
"0.50630593",
"0.50441486",
"0.50382066",
"0.50222635",
"0.50100756",
"0.49888888",
"0.49848032",
"0.49787775",
"0.49542725",
"0.4952664",
"0.49454138",
"0.49451098",
"0.49250484",
"0.4918887",
"0.49109203"
] | 0.6049323 | 0 |
of sniff Version of the sniffer that uses multiple threads, may be better for bursty but otherwise low traffic environments. | def sniff_queue
queue = Queue.new
# Spin up a thread that just queues packets (a buffer, if you will)
qthread = Thread.new do
@sniffer.each_packet do |pkt|
queue.push pkt unless queue.length > 1000
end
end # of qthread
# Now read each of those packets
loop do
pkt = queue.pop
@event_collector.pkt_count += 1
@event_collector.bytes += pkt.caplen
case pkt
when @tcp_traffic
@tcp_handler.packet(pkt) if @tcp_handler
when @udp_traffic
@udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE!
end
end # of each_packet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multithreaded\n get_value :multithreaded\n end",
"def thread; end",
"def thread; end",
"def thread; end",
"def do_sendtrain(train)\n # send the train\n $threadLock.synchronize {\n\twhile $activeThreads >= $maxThreads\n\t\t$threadCond.wait($threadLock)\t# wait until there is one less thread\n\tend\n\t$activeThreads+=1\n\t$stderr.puts \"activeThreads=#{$activeThreads} GRAB\" if ThreadDebug\n }\n Thread.new {\n\t outputbuffer=[]\n \tbegin\n \t sleepTime=rand(0)*$timeoutTime\n\t $stderr.puts \"Sleeping #{sleepTime} s\" if ThreadDebug\n\t sleep(sleepTime)\t# sleep some random interval amount of time to not run over other threads\n\t responses = Scriptroute::send_train( train )\n\t responses.each { |response|\n\t next unless response.probe\t# this won't be set if the pcap buf overflowed\n\t dst = response.probe.packet.ip_dst\n\t if response.response\n\t r = response.response.packet\n\t icmp_src = r.ip_src\n\t icmp_id = r.ip_id.to_s\n\n\t high = (r.ip_id >> 8 ) & 0xFF\n\t low = r.ip_id & 0xFF\n\t swapped_id = (low << 8) + high\n\n\t resp_type = r.class.to_s.sub(/^Scriptroute::/,'')\n\t resp_type += \"_t=#{r.icmp_type}_c=#{r.icmp_code}\" if resp_type == \"Icmp\"\n\t arrive = response.response.time.to_f.to_s\n\t else\n\t icmp_src = '-'\n\t icmp_id = '-'\n\t resp_type= '-'\n\t arrive = '-'\n\t end\n\t # dst icmpsrc arrive id id(hostorder) type\n\t outputbuffer << sprintf(\"%16s %16s %20s %7s %7s %12s\\n\" % [\n\t\t dst,\n\t\t icmp_src,\n\t\t arrive,\n\t\t icmp_id,\n\t\t swapped_id,\n\t\t resp_type])\n\t }\n\t ensure\n\t $threadLock.synchronize {\n\t\toutputbuffer.each { |l|\t\t# flush output while we have the lock\n\t\t\tputs l\t\t\t# actually print the data\n\t\t}\n\t\t$activeThreads-=1\n\t\t$stderr.puts \"activeThreads=#{$activeThreads} RELEASE\" if ThreadDebug\n\t\traise \"Too many Thread deactivates\" unless $activeThreads>=0\n\t\t$threadCond.signal \t# tell another thread it's their turn to go\n\t }\n\t end\n }\n\nend",
"def sniff(queue = false)\n # sniff_queue if queue # potential optimization, turned off for now\n \n # Now read each packet and process it right away\n @sniffer.each_packet do |pkt|\n @event_collector.pkt_count += 1\n @event_collector.bytes += pkt.caplen\n @event_collector.last_pkt = pkt\n case pkt\n when @tcp_traffic\n @tcp_handler.packet(pkt) if @tcp_handler\n when @udp_traffic\n @udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE!\n end\n end # of each_packet \n end",
"def do_not_thread; true; end",
"def do_not_thread; true; end",
"def do_not_thread; true; end",
"def allowing_other_threads; end",
"def sniff!\n update_urls(check_sniff)\n end",
"def discover_range(range, threads=25)\n\n # Other Potential options\n # - auxiliary/scanner/smb/pipe_auditor\n # - auxiliary/scanner/smb/pipe_dcerpc_auditor\n # - auxiliary/scanner/smb/smb_enumshares\n # - auxiliary/scanner/smb/smb_enumusers\n modules_and_options = [\n {:module_name => \"auxiliary/scanner/http/http_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/http/cert\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/ftp/ftp_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/h323/h323_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/imap/imap_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/portscan/syn\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/portscan/tcp\", :module_options => {}},\n #{:module_name => \"auxiliary/scanner/lotus/lotus_domino_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/mysql/mysql_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/netbios/nbname\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/netbios/nbname_probe\"},\n #{:module_name => \"auxiliary/scanner/pcanywhere/pcanywhere_tcp\", :module_options => {}},\n #{:module_name => \"auxiliary/scanner/pcanywhere/pcanywhere_udp\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/pop3/pop3_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/postgres/postgres_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/smb/smb_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/snmp/snmp_enum\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/ssh/ssh_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/telnet/telnet_version\", :module_options => {}},\n #{:module_name => \"auxiliary/scanner/vmware/vmauthd_version\", :module_options => {}}\n ]\n\n module_list.each do |mod|\n # Merge in default options\n mod[:options] = { \n \"RHOSTS\" => \"#{range}\", \n \"THREADS\" => \"#{threads}\"\n }\n\n # Module specific options\n mod[:options].merge!(mod[:module_options])\n\n # execute the module\n execute_module(mod)\n end\n end",
"def check_sniff\n _, url_meta, resp = perform_request(:get, @sniffing_path)\n @metric.increment(:sniff_requests)\n parsed = LogStash::Json.load(resp.body)\n nodes = parsed['nodes']\n if !nodes || nodes.empty?\n @logger.warn(\"Sniff returned no nodes! Will not update hosts.\")\n return nil\n else\n case major_version(url_meta[:version])\n when 5, 6\n sniff_5x_and_above(nodes)\n when 2, 1\n sniff_2x_1x(nodes)\n else\n @logger.warn(\"Could not determine version for nodes in ES cluster!\")\n return nil\n end\n end\n end",
"def sniff()\n\tstream = PacketFu::Capture.new(:start => true, :iface => 'eth0', :promisc => true)\n\n\tnmap_string = /\\x4E\\x6D\\x61\\x70/\n\tnikto_string = /\\x4E\\x69\\x6B\\x74\\x6F/\n\n\tstream.stream.each do |raw_pkt|\n\t\tpkt = PacketFu::Packet.parse(raw_pkt)\n\t\tif pkt.is_ip? \n\t\t\tif pkt.is_tcp?\n\t\t\t\tdetectTCPIncident(pkt)\n\t\t\tend\n\n\t\t\tif nmap_string.match(pkt.payload)\n\t\t\t\talert(\"Nmap scan\", pkt.ip_saddr(), \"TCP\", pkt.payload)\n\t\t\tend\n\t\t\t\n\t\t\tif nikto_string.match(pkt.payload)\n\t\t\t\talert(\"Nikto scan\", pkt.ip_saddr(), \"TCP\", pkt.payload)\n\t\t\tend\n\n\t\t\tfindCreditCard(pkt)\n\t\tend\n\tend\nend",
"def start_threads\n \n # generate computers cache model shortcuts\n Main.active.clusters.each do |computers|\n computers.each { |c| Main.active.computers_cache[c.id]=c }\n end\n\n # load user names from yppassed\n # TODO: move to user model class?\n #IO.popen(\"ypcat passwd\").each { |line|\n # Main.active.user_list.add(line.split(\":\").values_at(0, 4)) \n #}\n\n refresh = Thread.new {\n session[:old_timestamp] = 0\n\n while true\n puts \"refresh start\"\n # update prectab data\n if Prectab.changed?\n Main.active.computers_cache.each_value {|computer| computer.prectab = [nil,nil]; computer.color_changed; computer.user_changed }\n Debug.log.debug \"working prectab\"\n scatter_prectab(Prectab.now,0)\n scatter_prectab(Prectab.soon,1)\n end\n\n # update computers_cache\n comps = Computer.updated_after session[:old_timestamp]\n comps.each do |computer| \n cache_computer = Main.active.computers_cache[computer.id]\n if cache_computer\n cache_computer.User = computer.user \n cache_computer.Color = computer.color\n end\n end\n session[:old_timestamp] = Time.now.strftime(\"%j%H%M%S\")\n\n # update printers\n @printers.each { |p| p.update_job_count; p.update_accepts; p.update_snmp }\n puts \"refresh end\"\n sleep 20\n end \n }\n \n # read data from scanner and dispatch\n require 'socket'\n begin\n socket = TCPSocket.new('localhost', 7887)\n rescue Errno::ECONNREFUSED\n Main.active.status = [\"Scanner\", t('scanner.no_connection'), \"important\",-1]\n else\n scanner = Thread.new {\n Debug.log.debug \"starting scanner thread ...\"\n while true\n scan = socket.recvfrom(25)\n type, Main.active.scan_string = check_scanner_string(scan[0])\n Debug.log.debug \"Scanner says #{scan} #{type}, #{Main.active.scan_string}\"\n \n case type\n when :card\n accounts = User.find_accounts_by_barcode(Main.active.scan_string)\n fill_accounts(accounts)\n when :matrikel\n accounts = Account.find_accounts_by_barcode(Main.active.scan_string)\n fill_accounts(accounts)\n when :key\n pc = Main.active.computers_cache[Main.active.scan_string]\n puts pc\n unless Main.active.account_list.empty?\n table_register(pc)\n else\n case pc.user\n when \"\"\n Main.active.status = [\"#{pc.id}\", \"ist schon frei\", \"key\",0] \n else\n Main.active.status = [\"#{pc.user}\", \"von <b>#{pc.id}</b> abgemeldet\", \"trashcan_full\",1]\n end\n key_clear(pc)\n end\n else\n Debug.log.debug \"#{type}, #{Main.active.scan_string}\"\n end\n \n sleep 1 # wait some time for next scan atempt\n end\n }\n end\n end",
"def _test_threads\n m = Mutex.new \n threads = []\n @custom_number_of_users.times do\n threads << Thread.new do\n m.synchronize {threaded_mage_checkout}\n threaded_mage_checkout\n end\n end\n threads.each {|x| x.join}\n end",
"def alive?; @locker.synchronize { !! @threads }; end",
"def run\n done = false\n times = []\n threads = ThreadGroup.new\n count_m = Mutex.new\n\n @threads.times do\n Thread.start do\n threads.add Thread.current\n until @num_requests <= 0 do\n count_m.synchronize do\n if @num_requests % @tenths == 0 then\n print @num_requests\n elsif @num_requests % @hundredths == 0 then\n print '.'\n end\n @num_requests -= 1\n end\n $stdout.flush\n times << time_request\n end\n end\n Thread.pass\n end\n\n threads.enclose\n\n threads.list.each { |t| t.join }\n puts\n\n return times\n end",
"def in_new_thread; end",
"def tracer_thread_runner\n while running?\n # Get a random user assigned to this server.\n user = User.where(:enable_tracer => true, :archived => false).select(:id, :connected_at).all.select do |user|\n server_rhash.hash(user.id) == server_tag && user.connected_at\n end.shuffle.first\n\n # If we found a user, schedule a tracer email.\n if user\n user.reload\n ScheduleTracerEmails.new(user, self.num_tracers).delay.run\n end\n\n light_sleep self.tracer_interval\n end\n rescue Exception => e\n Log.exception(e)\n raise e\n ensure\n Log.info(\"Stopping tracer thread.\")\n end",
"def thread_id\n check_connection\n @protocol.thread_id\n end",
"def main\n puts \"Running Netservate #{@version}...\"\n\n # Main loop\n while true do\n begin\n\n # Begin test\n puts \"\\nBeginning network test...\"\n test_time = Time.now.strftime('%c')\n test = Speedtest::Test.new()\n net_results = nil\n\n # Test\n begin\n Timeout.timeout(@config['NETSERVATE']['TEST_TIMEOUT'].to_i || 90) { net_results = test.run }\n rescue\n puts \"Test timed out - assuming failure.\"\n end\n\n # Print/check results\n download_checked = false\n upload_checked = false\n result_text = nil\n if net_results != nil\n download_checked = true if net_results.pretty_download_rate.to_i != 0\n upload_checked = true if net_results.pretty_upload_rate.to_i != 0\n result_text = \"\\nServer: #{net_results.server}\\n\"\\\n \"Download rate: #{download_checked ? net_results.pretty_download_rate : \"n/a\"}\\n\"\\\n \"Upload rate: #{upload_checked ? net_results.pretty_upload_rate : \"n/a\"}\\n\"\\\n \"Latency: #{net_results.latency}\\n\"\\\n \"Time: #{test_time}\\n\"\n puts result_text\n # Store results in array\n if @results.length >= 20\n @results.shift # Remove first result if 20\n end\n @results.push({\n server: net_results.server,\n download: download_checked ? net_results.pretty_download_rate : \"n/a\",\n upload: upload_checked ? net_results.pretty_upload_rate : \"n/a\",\n time: test_time\n })\n else\n result_text = \"\\nServer: Test timed out.\\n\"\\\n \"Download rate: n/a\\n\"\\\n \"Upload rate: n/a\\n\"\\\n \"Latency: n/a\\n\"\\\n \"Time: #{test_time}\\n\"\n puts result_text\n # Store results in array\n if @results.length >= 20\n @results.shift # Remove first result if 20\n end\n @results.push({\n server: \"Test timed out.\",\n download: \"n/a\",\n upload: \"n/a\",\n time: test_time\n })\n end\n\n # Log results\n begin\n logger = Logger.new(\"#{@root_path}/log/netservate.log\", 10, 1024000)\n logger.info result_text\n rescue => error\n puts \"ERROR: \" + error\n end\n\n # Check criteria\n if (net_results == nil) ||\n (net_results.pretty_download_rate.to_f < @config['NETSERVATE']['MIN_DOWNLOAD_SPEED'].to_f && download_checked) ||\n (net_results.pretty_upload_rate.to_f < @config['NETSERVATE']['MIN_UPLOAD_SPEED'].to_f && upload_checked)\n @failed_test_count += 1\n puts \"Test does not meet criteria. (#{@failed_test_count})\"\n\n # If too many fails in a row - send an alert.\n if (@failed_test_count % @config['NETSERVATE']['FAILS_IN_A_ROW'].to_i == 0)\n send_alert(\n subject: \"Netservate Alert\",\n message: \"There have been #{@failed_test_count.to_s} failed network speed tests in a row.\"\n )\n end\n\n # Wait before next loop - Reset if max fail count reached.\n if @failed_test_count < @config['NETSERVATE']['MAX_FAILS_IN_A_ROW'].to_i\n puts \"\\nNext test in #{@fail_wait_time} seconds...\"\n sleep(@fail_wait_time)\n else\n puts \"\\nMax fails in a row reached...\"\n puts \"Next test in #{@wait_time} seconds...\"\n @failed_test_count = 0\n sleep(@wait_time)\n end\n\n else\n @failed_test_count = 0\n puts \"Test meets criteria.\"\n puts \"\\nNext test in #{@wait_time} seconds...\"\n # Wait before next loop\n sleep(@wait_time)\n end\n\n rescue => error\n puts \"ERROR: \" + error\n end\n\n end\n end",
"def sleepy_run; end",
"def silence_single_worker_warning; end",
"def threads\n option :threads, DEFAULT_THREAD_AMOUNT\n end",
"def initialize\n @threads = []\n end",
"def reportOnline(time)\n t =Thread.new{\n puts \"Online report thread = \" + Thread.current.to_s\n sleep(@@threadSleep)\n while true\n sleep(time)\n online\n end\n }\n \n if @@test_messages\n puts \"Online report thread = \" + t.to_s\n end\n @@threadIDs.merge!({t.to_s => \"online report\"})\nend",
"def server_timing; end",
"def use_threads?\n !defined?(VCR)\n end",
"def start_request_supernodes_thread\n Thread.new do \n # read the request interval\n interval = @driver.config['request_interval'].to_i\n # number of supernodes each time\n number = @driver.config['request_number'].to_i\n \n while true\n sleep(interval)\n # get supernodes sockets from supernode table\n socks = @supernode_table.supernodes\n # Sends +RequestSupernodes+ message. Because the number of socks is not\n # so large, and it doesn't wait for the response after sending, it sends\n # messages one by one here instead of using multiple threads.\n request_msg = Protocol::RequestSupernodes.new(number)\n request_msg.ctime = DateTime.now\n socks.each do |sock|\n request_supernodes(sock,request_msg)\n end\n end\n end\n end"
] | [
"0.5767929",
"0.5718602",
"0.5718602",
"0.5718602",
"0.5625441",
"0.55687666",
"0.55488056",
"0.55488056",
"0.55488056",
"0.54524916",
"0.53529274",
"0.5319013",
"0.53042847",
"0.5265917",
"0.52533245",
"0.52300936",
"0.5217938",
"0.52061605",
"0.518276",
"0.5179148",
"0.5173824",
"0.5160587",
"0.51484656",
"0.5145208",
"0.5138541",
"0.51354533",
"0.5129284",
"0.5114301",
"0.5099453",
"0.5098593"
] | 0.5941943 | 0 |
of packet() If the sequence number is valid, update the stream attributes. If not, perform the appropriate response but don't update the stream. Return true if valid and should continue parsing, false if it shouldn't, and a pkt if there is a queued next packet that needs to be injected into the stream. | def validate_sequence_numbers(pkt, state, dir)
expected_seq = dir == :up ? state.seq_up : state.seq_down
# If we don't have an expected sequence number yet, set one
expected_seq = pkt.tcp_seq if expected_seq == 0
# If we did not expect this sequence number, handle dissonance
if pkt.tcp_seq != expected_seq
return nil if pkt.tcp_seq < expected_seq # OS would ignore this packet
# The sequence number is high - save it for later?
if pkt.tcp_seq - expected_seq < FORWARD_WINDOW
segments = dir == :up ? state.segments_up : state.segments_down
segments[pkt.tcp_seq] = pkt
else # This packet is too far in advance, we're aborting on this steram
@event_collector.send(:tcp_stream_end) do
{ :syn_seen => !!state.syn_seen,
:src_ip => @protos.str_ip(pkt.src.to_i),
:dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,
:dst_port => pkt.dport, :rst => false,
:fin => false, :sync => true, :timeout => false }
end
@protos.conclude(state, :up) # Kill the stream in both directions
@protos.conclude(state, :down)
state.app_state = nil # not parsing anymore
#delete_state(state) # don't delete the state, FIN/RST will do it.
end
return nil # in either case, we don't process the packet right now
# Sequence number was what we expected, this is part of our stream
else
# If this was a SYN packet, increase next expected sequence number by 1
# as specified by the TCP RFC.
expected_seq += 1 if pkt.tcp_syn?
# Adjust our next expected sequence number
if dir == :up
state.seq_up = (expected_seq + pkt.tcp_data_len) % 4294967296
else
state.seq_down = (expected_seq + pkt.tcp_data_len) % 4294967296
end
# Do we have a queued packet that we received out of order?
segments = dir == :up ? state.segments_up : state.segments_down
if segments.length > 0
queued_pkt = segments[expected_seq]
segments.reject! { |k,_| k <= expected_seq } # delete all passed segs
if queued_pkt
return queued_pkt
end
end # of if segments.length > 0
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if !@display_name.nil? && @display_name.to_s.length > 255\n return false if !@description.nil? && @description.to_s.length > 1024\n return false if @tcp_closed.nil?\n return false if @tcp_closed > 4320000\n return false if @tcp_closed < 10\n return false if @tcp_opening.nil?\n return false if @tcp_opening > 4320000\n return false if @tcp_opening < 10\n return false if @udp_single.nil?\n return false if @udp_single > 4320000\n return false if @udp_single < 10\n return false if @tcp_finwait.nil?\n return false if @tcp_finwait > 4320000\n return false if @tcp_finwait < 10\n return false if @tcp_first_packet.nil?\n return false if @tcp_first_packet > 4320000\n return false if @tcp_first_packet < 10\n return false if @tcp_closing.nil?\n return false if @tcp_closing > 4320000\n return false if @tcp_closing < 10\n return false if @tcp_established.nil?\n return false if @tcp_established > 4320000\n return false if @tcp_established < 120\n return false if @udp_multiple.nil?\n return false if @udp_multiple > 4320000\n return false if @udp_multiple < 10\n return false if @icmp_error_reply.nil?\n return false if @icmp_error_reply > 4320000\n return false if @icmp_error_reply < 10\n return false if @udp_first_packet.nil?\n return false if @udp_first_packet > 4320000\n return false if @udp_first_packet < 10\n return false if @icmp_first_packet.nil?\n return false if @icmp_first_packet > 4320000\n return false if @icmp_first_packet < 10\n true\n end",
"def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Complete packet'\n end",
"def gtp_session_complete?(sequence_number) \n (@gtp_session[sequence_number][:REQUEST].key?(:req_res) && @gtp_session[sequence_number][:RESPONSE].key?(:req_res))\n end",
"def request_success(packet); end",
"def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Received packet'\n end",
"def parse\n parse_command_and_headers if @frame.command.nil?\n success = if @frame.command\n if @body_length\n parse_binary_body\n else\n parse_text_body\n end\n elsif (match = @buffer.match(/\\A\\n|\\A\\r|\\A\\r\\n/))\n # Ignore heartbeat\n @buffer = match.post_match\n true\n end\n\n # Keep parsing if making progress and there is more data\n parse if success && !@buffer.empty?\n true\n end",
"def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Release packet'\n end",
"def packet(pkt)\n super(pkt)\n \n # Only process packets with length right now\n return nil unless pkt.udp_data.length > 0\n \n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n state = identify_state(pkt, :udp, false)\n state.udp_init(pkt, @event_collector) unless state.layer_4\n @protos.parse(pkt.udp_data, state, dir)\n end",
"def allow?(packet); end",
"def packet(pkt)\n super(pkt)\n ret = nil\n\n # Let's ignore (for now) packets that are simply ACKs and nothing else\n return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or\n pkt.tcp_data_len > 0\n \n # Should we be raising a STREAM event?\n if pkt.tcp_data_len > 0 and @event_collector.stream_capture\n @event_collector.stream_capture.each do |sc|\n if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP\n (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP\n (sc[1].nil? or sc[1] == pkt.sport) and # source port\n (sc[3].nil? or sc[3] == pkt.dport) # destination port\n @event_collector.send(sc[4]) do\n state = identify_state(pkt, :tcp, false)\n { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport }\n end\n end # of if match\n end # of each stream_capture\n end # of if stream event\n\n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n make_state = !(pkt.tcp_fin? or pkt.tcp_rst?)\n state = identify_state(pkt, :tcp, make_state)\n state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst?\n \n # Check to see if we need to prune some state objects\n if pkt.time.to_i > @next_prune\n @next_prune = pkt.time.to_i + 60 # one minute prune interval\n syn_timeout = pkt.time - @event_collector.syn_timeout_delay\n stream_timeout = pkt.time - @event_collector.stream_timeout_delay\n @states.each do |_,chk|\n if chk.last_seen < syn_timeout\n # Is this state only a syn so far?\n if not chk.ack_seen\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i),\n :src_port => chk.sport, :dst_port => chk.dport, :rst => false }\n end\n delete_state(chk)\n \n # Okay, there's been some traffic. Has a full timeout occured?\n elsif chk.last_seen < stream_timeout\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!chk.syn_seen, :timeout => true,\n :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false,\n :dst_port => chk.dport, :src_port => chk.sport, :sync => false,\n :fin => false }\n end\n delete_state(chk)\n end # of if stream_timeout\n end # of syn_timeout\n end\n end\n\n # Is this state brand new? If so, add some TCP-specific information\n state.tcp_init(pkt, @event_collector) unless state.layer_4\n\n # Let's make sure the sequence numbers are what we expect\n ret = validate_sequence_numbers(pkt, state, dir) if state.app_state\n return nil unless ret\n\n # If this is a connection we've seen in its entirety, hand it up to\n # the next stage - the protocol parser (layer 7)\n if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0\n @protos.parse(pkt.tcp_data, state, dir)\n end\n\n # Is this a FIN or a RST? Should we close out this state?\n if pkt.tcp_fin?\n state.fin_up = true if dir == :up\n state.fin_down = true if dir == :down\n @protos.conclude(state, dir) # Signal the end of this direction\n end\n if pkt.tcp_rst? or (state.fin_up and state.fin_down)\n if not state.ack_seen # Explicit connection rejection\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i),\n :dst_ip => @protos.str_ip(pkt.src.to_i),\n :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true }\n end\n else # regular connection termination\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false,\n :fin => (state.fin_up and state.fin_down), :timeout => false }\n end\n @protos.conclude(state, :up) # Signal the end of the stream in\n @protos.conclude(state, :down) # both directions.\n end\n delete_state(state)\n end\n\n # Finally, if we have a queued packet to inject, inject it now. This must\n # be done last!\n packet(ret) if ret.class <= ::Pcap::TCPPacket\n true\n end",
"def valid?\n case packet_smb_version\n when 'SMB1'\n return smb_header.protocol == RubySMB::SMB1::SMB_PROTOCOL_ID &&\n smb_header.command == self.class::COMMAND\n when 'SMB2'\n return smb2_header.protocol == RubySMB::SMB2::SMB2_PROTOCOL_ID &&\n smb2_header.command == self.class::COMMAND\n end\n end",
"def receive_frame sequence_number\n @stats[:frames_received] += 1\n\n # Read in the frame\n to_read = @options[:frame_size]\n if ((@window * @options[:window_size]) + (sequence_number % @options[:window_size]) + 1) * @options[:frame_size] >= @filesize\n to_read = @filesize % @options[:frame_size]\n to_read = @options[:frame_size] if to_read == 0\n end\n\n buffer = @socket.read(to_read)\n\n # Is it from another window? We can ack these\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n min_frame = @options[:window_size] * ((@window % 2))\n if sequence_number >= max_frame or sequence_number < min_frame\n # assume last window\n return :redundant\n end\n\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n if @options[:implementation] == :go_back and sequence_number != expected_frame\n puts \"Out of order frame! #{sequence_number} != #{expected_frame}\"\n return :illegal\n end\n\n if not @buffer[sequence_number].nil?\n # Already have this frame\n puts \"Redundant frame #{sequence_number}\"\n @stats[:redundant_frames] += 1\n return :redundant\n end\n\n reset_timeout\n\n @buffer[sequence_number] = buffer\n @buffer_len += 1 if @options[:implementation] == :selective_repeat\n if @buffer_len > @max_buffer_len\n @max_buffer_len = @buffer_len\n end\n\n return :received\n end",
"def process(packet)\n @init.call(Net::SSH::Packet.new(packet.to_s)) if @init\n type = packet.read_byte\n raise \"expected #{@type}, but got #{type}\" if @type != type\n\n @data.zip(types).each do |expected, _type|\n _type ||= case expected\n when nil then break\n when Numeric then :long\n when String then :string\n when TrueClass, FalseClass then :bool\n end\n\n actual = packet.send(\"read_#{_type}\")\n next if expected.nil?\n raise \"expected #{_type} #{expected.inspect} but got #{actual.inspect}\" unless expected == actual\n end\n end",
"def packet_stream packet # :nodoc:\n payload = packet.payload\n\n return if payload.empty?\n\n source = packet.source\n\n if previous = @incomplete_streams.delete(source) then\n payload = previous << payload\n elsif /\\A....\\x04\\x08/m !~ payload then\n @drb_streams[source] = false\n return\n end\n\n stream = StringIO.new payload\n stream.set_encoding Encoding::BINARY, Encoding::BINARY\n stream\n end",
"def valid?\n return true if skip?\n handler.valid?(value)\n end",
"def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend",
"def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n unless buffer.empty?\n raise ExtraBytesError, \"at end of Publish Release packet\"\n end\n end",
"def checkStream(pkt)\n\terrorDetected = false;\n\t$incident = \"test\"\n\n\t# Check TCP vulnerabilities\n\tif pkt.proto.last == \"TCP\"\n\t\tif checkNull(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"NULL\"\n\t\telsif checkFin(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"FIN\"\n\t\telsif checkXMAS(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"XMAS\"\n\t\tend\n\telse\n\t\tif checkNikto(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"nikto\"\n\t\telsif checkNmap(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Nmap\"\n\t\telsif checkCreditCard(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Credit card leaked\"\n\t\tend\n\tend\n\n\tif errorDetected\n\t\tputs \"#{$incident_number}. ALERT: #{$incident} is detected from #{pkt.ip_saddr} (#{pkt.proto.last}) (#{pkt.payload})!\"\t\n\t\t$incident_number = $incident_number + 1\n\tend\nend",
"def get_packet\n\t\t\t\tfirst_number = read(1).unpack(\"C\")[0]\n\t\t\t\t# get the 'mask' property\n\t\t\t\tpacket_mask = first_number >> 6\n\t\t\t\t# get the 'frame1' property\n\t\t\t\tframe_number = first_number & 0x3F\n\t\t\t\tif frame_number == 0\n\t\t\t\t\t# if frame1 is equal to 0 then 'frame' is equal to 'frame2'\n\t\t\t\t\tframe_number = read(1).unpack(\"C\")[0]\n\t\t\t\telsif frame_number == 1\n\t\t\t\t\t# if frame1 is equal to 1 then 'frame' is equal to 'frame3'\n\t\t\t\t\tframe_number = read(2).unpack(\"n\")[0]\n\t\t\t\tend\n\t\t\t\t# init a 'frame stream' if it doesn't exist yet\n\t\t\t\tif ! @frames_in.has_key? frame_number\n\t\t\t\t\t@frames_in[frame_number] = Frame.new(0,0,0,0)\n\t\t\t\t\tif packet_mask != 0\n\t\t\t\t\t\traise StandardError, \"packet error\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t# for logging purpose\n\t\t\t\t@bytes_in += 1\n\t\t\t\t\n\t\t\t\t# reads the 'time', 'datasize', 'rtmpdatatype' and 'streamid' properties from the socket\n\t\t\t\t# and put them into the 'frame stream' archive\n\t\t\t\t\n\t\t\t\tcase packet_mask\n\t\t\t\twhen 0\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].size = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].data_type = read(1).unpack(\"C\")[0]\n\t\t\t\t\t@frames_in[frame_number].obj = read(4).unpack(\"N\")[0]\n\t\t\t\t\t@bytes_in += 11\n\t\t\t\twhen 1\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].size = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].data_type = read(1).unpack(\"C\")[0]\n\t\t\t\t\t@bytes_in += 7\n\t\t\t\twhen 2\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@bytes_in += 3\n\t\t\t\twhen 3\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\n\t\t\t\tend\n\t\t\t\t# fix the CONNECTION_PACKET bug when its size is larger than 128 bytes (see caution 4.4.6)\n\t\t\t\tif ! @connected\n\t\t\t\t\tdata_length = @frames_in[frame_number].size\n\t\t\t\t\n\t\t\t\t\tif data_length < 129\n\t\t\t\t\t\tdata = read(data_length)\n\t\t\t\t\telsif data_length == 129\n\t\t\t\t\t\tdata = read(data_length+1)\n\t\t\t\t\t\tdata = data[0..-2]\n\t\t\t\t\telse data_length > 129\n\t\t\t\t\t\tdata = read(data_length+1)\n\t\t\t\t\t\tdata = data[0..127] << data[129..-1]\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tdata = read(@frames_in[frame_number].size)\n\t\t\t\tend\n\t\t\t\t# for logging purpose\n\t\t\t\t@bytes_in += data.length\n\t\t\t\t@msg_in += 1\n\t\t\t\t# return a RTMP_PACKET with all its properties (implicit ones included)\n\t\t\t\treturn RTMPPacket.new(\tframe_number,\n\t\t\t\t\t\t\t@frames_in[frame_number].timer,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\t@frames_in[frame_number].data_type,\n\t\t\t\t\t\t\t@frames_in[frame_number].obj)\n\t\tend",
"def needs_initial_response?\n # logger.debug(\"CHC: needs_initial_response '#{p_s_b}'\")\n return false if p_s_b != 'P'\n # logger.debug(\"CHC: needs_initial_response still here\")\n center = queue.center.center\n ret = false\n pmr.signature_lines.each do |sig|\n # logger.debug(\"CHC: stype=#{sig.stype} ptype=#{sig.ptype}\")\n # Set ret to true for any requeue of the primary. The last\n # one will be the requeue to the current location.\n if sig.stype == 'CR' && sig.ptype == '-' && sig.center != center\n # logger.debug(\"CHC: CR line at #{sig.date}\")\n ret = true\n end\n # Set ret to false for any CT from this center.\n if sig.stype == 'CT' && sig.center == center\n # logger.debug(\"CHC: CT line at #{sig.date}\")\n ret = false\n end\n end\n # Ret will be the last toggle from the above two conditions.\n ret\n end",
"def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Acknowledgment packet'\n end",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def valid?\n return false if !@lac.nil? && @lac > 65533\n return false if !@lac.nil? && @lac < 1\n return false if !@cid.nil? && @cid > 268435455\n return false if !@cid.nil? && @cid < 0\n return false if !@signal.nil? && @signal > -25\n return false if !@signal.nil? && @signal < -121\n return false if !@psc.nil? && @psc > 503\n return false if !@psc.nil? && @psc < 0\n return false if !@asu.nil? && @asu > 97\n return false if !@asu.nil? && @asu < -5\n return false if !@ta.nil? && @ta > 63\n return false if !@ta.nil? && @ta < 0\n true\n end",
"def ping\n if @type == :receiving\n # Receive packets\n header = @socket.readline\n header.match /^(\\d+)\\s+(.+)\\s+(.+)$/\n sequence_number = $1.to_i\n check = $2\n file_number = $3.to_i\n\n return if file_number != @number\n\n # ACK anything if we have received the file\n if done?\n response = receive_frame sequence_number\n\n @stats[:acks_sent] += 1\n if (sequence_number+1) == (@options[:window_size] * 2)\n @socket.puts \"ACK 0 #{@number}\"\n else\n @socket.puts \"ACK #{sequence_number+1} #{@number}\"\n end\n\n return\n end\n\n # Receive data\n response = receive_frame sequence_number\n if response == :redundant\n puts \"Reacknowledge!\"\n acknowledge_frame sequence_number\n return\n end\n\n # Perform checksum\n if response != :illegal\n sum = checksum sequence_number\n end\n\n # Append to file and send ACK, or send NAK\n if response == :illegal\n puts \"Out of order frame #{sequence_number}\"\n @stats[:out_of_order] += 1\n\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n\n blah_frame = @next_frame % (@options[:window_size] * 2)\n blah_frame = (@options[:window_size]*2) if blah_frame == 0 and max_frame == (@options[:window_size]*2)\n nacknowledge_frame blah_frame\n elsif sum == check\n acknowledge_frame sequence_number\n else\n puts \"Corruption Detected\"\n @stats[:corrupted] += 1\n nacknowledge_frame sequence_number\n end\n else\n # Respond to acknowledgments\n ack = @socket.readline\n\n if ack.match /^ACK\\s+(\\d+)\\s+(\\d+)$/\n # Respond to ACK\n sequence_number = $1.to_i\n file_number = $2.to_i\n\n return if file_number != @number\n\n receive_acknowledgement sequence_number\n\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n\n blah_frame = @next_frame % (@options[:window_size] * 2)\n blah_frame = (@options[:window_size]*2) if blah_frame == 0 and max_frame == (@options[:window_size]*2)\n if blah_frame == max_frame\n # window has been acknowledged\n send_next_window\n elsif @next_frame == @total_frames\n puts \"MEH\"\n stop_timeout\n end\n elsif ack.match /^NAK\\s+(\\d+)\\s+(\\d+)$/\n # Respond to NAK\n file_number = $2.to_i\n\n return if file_number != @number\n\n sequence_number = $1.to_i\n puts \"Frame #{sequence_number} NAK\"\n receive_nacknowledgement sequence_number\n end\n end\n end",
"def valid?\n @http_response.is_a?(Net::HTTPSuccess) && @errors.blank?\n end",
"def valid_sequence?(input)\n compacted_input = input.compact\n input_valid = compacted_input.all? &method(:valid_number?)\n input_valid && input.length == @length && compacted_input == compacted_input.uniq\n end",
"def parse_response?\n parse_response\n end",
"def catches_packet?(delay)\n (delay + @depth) % ((@range - 1) * 2) == 0\n end",
"def parse\n _magic, command, length, checksum = @buffer.unpack('a4A12Va4')\n payload = @buffer[HEAD_SIZE...HEAD_SIZE + length]\n if Digest::SHA256.digest(Digest::SHA256.digest(payload))[0...4] != checksum\n return if payload.size < length\n raise 'TODO: handle checksum error'\n end\n @buffer = @buffer[HEAD_SIZE + length..-1] || ''\n handler.send \"handle_#{command}\", payload\n !@buffer.empty?\n end"
] | [
"0.54812187",
"0.53521025",
"0.53457576",
"0.53096867",
"0.5280621",
"0.52769667",
"0.52022445",
"0.51943576",
"0.51724285",
"0.5150046",
"0.5149561",
"0.51452684",
"0.5095811",
"0.50434756",
"0.5041339",
"0.5025787",
"0.50133234",
"0.49645808",
"0.4958033",
"0.49557388",
"0.4944676",
"0.4939039",
"0.4939039",
"0.49038693",
"0.48941952",
"0.48826602",
"0.4869741",
"0.4866644",
"0.4855492",
"0.48430368"
] | 0.66046137 | 0 |
GET /wishes/new GET /wishes/new.json | def new
@wish = Wish.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @wish }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end",
"def new\n @like = Like.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @like }\n end\n end",
"def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @dish = Dish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish }\n end\n end",
"def new\n @dish = Dish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish }\n end\n end",
"def new\n @favorite = Favorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @favorite }\n end\n end",
"def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end",
"def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @good }\n end\n end",
"def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end",
"def new\n @thought = Thought.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thought }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def new\n @song_like = SongLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song_like }\n end\n end",
"def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end",
"def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end",
"def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end",
"def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end"
] | [
"0.75034636",
"0.7397594",
"0.712135",
"0.712135",
"0.6997838",
"0.6956595",
"0.69218665",
"0.6855291",
"0.6832216",
"0.6832216",
"0.680942",
"0.6806758",
"0.6797136",
"0.6782294",
"0.67808294",
"0.6780439",
"0.6733088",
"0.67297685",
"0.6728313",
"0.67146295",
"0.67120075",
"0.6707049",
"0.6695522",
"0.6682363",
"0.6677711",
"0.6677711",
"0.6677711",
"0.6677656",
"0.6677656",
"0.6677656"
] | 0.7856075 | 0 |
POST /wishes POST /wishes.json | def create
@wish = current_user.wishes.build(params[:wish])
if @wish.save
flash[:success] = "Wish created!"
redirect_to root_url
else
@feed_items = []
render 'static_pages/home'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n wish = current_user.wishes.new(wish_params)\n if wish.save\n # for each of the keywords param, find the keyword in the keyword database,\n # if not found, create a new keyword and build a new relationship with the wish.\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n\n if wish_params[:image]\n render json: { wish: wish, image: url_for(wish.image) }, status: :created\n else\n render json: { wish: wish, image: '' }, status: :created\n end\n else\n render json: { errors: wish.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \t@wish.save\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end",
"def create\n @wish = Wish.new(wish_params)\n @wish.user = current_user\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wish }\n else\n format.html { render action: 'new' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n @wishes = Wish.where(approved: true).order('random()').page(params[:page])\n\n if @user.save\n redirect_to root_path\n flash[:success] = \"Your wish has been submitted.\"\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Dish.create(dish_params)\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully created.' }\n format.json { render json: @wish_list_item, status: :created, location: @wish_list_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render json: @wishlist, status: :created, location: @wishlist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlistitem = Wishlistitem.new(params[:wishlistitem])\n\n respond_to do |format|\n if @wishlistitem.save\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully created.' }\n format.json { render json: @wishlistitem, status: :created, location: @wishlistitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @like = Like.new(like_params)\n if @like.save\n render json: @like, status: 201\n else\n render json: @like.errors, status: 422\n end\n end",
"def create\n @wishlist = current_user.wishlists.build(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { redirect_to wishlists_url }\n else\n format.html { render action: \"new\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = Wishlist.new(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @like = Like.new(like_params)\n\n respond_to do |format|\n if @like.save\n format.json { render json: @like, status: :created }\n else\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\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 create\n @wishlist = Wishlist.new(name: params[:wishlist][:name],\n user_id: current_user.email,\n shared: params[:wishlist][:shared])\n current_user.wishlists << @wishlist\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :index, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # debugger\n like = Like.new(like_params)\n\n if like.save\n render json: like\n else\n render json: like.errors.full_messages, status: 422\n end\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end",
"def create\n @wanted_item = WantedItem.new(wanted_item_params)\n\n respond_to do |format|\n if @wanted_item.save\n format.html { redirect_to @wanted_item, notice: 'Wanted item was successfully created.' }\n format.json { render :show, status: :created, location: @wanted_item }\n else\n format.html { render :new }\n format.json { render json: @wanted_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @wishes = Wish.all\n end",
"def index\n @wishes = Wish.all\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @favorite_dish = FavoriteDish.new(favorite_dish_params)\n\n respond_to do |format|\n if @favorite_dish.save\n format.html { redirect_to @favorite_dish, notice: 'Favorite dish was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_dish }\n else\n format.html { render :new }\n format.json { render json: @favorite_dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wish_params\n params.require(:wish).permit(:content, :name)\n end",
"def create\n @song_like = SongLike.new(params[:song_like])\n\n respond_to do |format|\n if @song_like.save\n format.html { redirect_to @song_like, notice: 'Song like was successfully created.' }\n format.json { render json: @song_like, status: :created, location: @song_like }\n else\n format.html { render action: \"new\" }\n format.json { render json: @song_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n wishlist = Wishlist.new(wishlist_params)\n wishlist.venue_name = wishlist.venue_name.strip\n wishlist.user_id = current_user.id\n\n respond_to do |format|\n if wishlist.save\n response = render_to_string('wishlists/_wishlist_card', :layout => false, :locals => { :wishlist => wishlist })\n format.json { render json:{ html_data: response } }\n else\n # format.html { render :new }\n format.json { render json: wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wish_list = WishList.new(\n product_id: params[:product_id],\n user_id: params[:user_id]\n )\n respond_to do |format|\n if @wish_list.save\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { render :show, status: :created, location: @wish_list }\n else\n format.html { render :new }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @wish = Wish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish }\n end\n end",
"def create\n @wishlist = current_user.wishlists.build(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6912995",
"0.6840946",
"0.6729906",
"0.6561722",
"0.6483702",
"0.63777417",
"0.63369393",
"0.62611157",
"0.6222567",
"0.6171183",
"0.61618245",
"0.6150779",
"0.6122475",
"0.6095343",
"0.60716784",
"0.6065541",
"0.6029707",
"0.59819096",
"0.5970839",
"0.5970839",
"0.5953641",
"0.5947016",
"0.59468323",
"0.5944307",
"0.5938962",
"0.5930889",
"0.5917928",
"0.5913706",
"0.5881857",
"0.58621514"
] | 0.7107845 | 0 |
PUT /wishes/1 PUT /wishes/1.json | def update
@wish = Wish.find(params[:id])
respond_to do |format|
if @wish.update_attributes(params[:wish])
format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @wish.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish }\n else\n format.html { render :edit }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # wish can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n\n if @wish.update(wish_params)\n if keywords_params[:keyword1]\n @wish.wish_keywords.delete_all\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n @wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n end\n render json: {}, status: :no_content\n else\n render json: { errors: @wish.errors.full_messages }, status: :unprocessable_entity\n end\n end\n end",
"def update\n render json: Like.update(params[\"id\"], params[\"like\"])\n end",
"def update\n @wish.update(wish_params)\n redirect_to wishlist_path(@wish.wishlist_id)\n end",
"def update_likes\n @wish.update(like_params)\n end",
"def set_wish\n @wish = Wish.find(params[:id])\n end",
"def set_wish\n @wish = Wish.find(params[:id])\n end",
"def set_wish\n @wish = Wish.find(params[:id])\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n if @wishlistitem.update_attributes(params[:wishlistitem])\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wish_list_item.update(wish_list_item_params)\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish_list_item }\n else\n format.html { render :edit }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :index, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @like.update(like_params)\n format.json { render json: @like, status: :ok }\n else\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @wishlist = current_user.wishlists.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args, &block)\n self.client.put *args\n end",
"def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wiggle.update(wiggle_params)\n format.html { redirect_to @wiggle, notice: 'Wiggle was successfully updated.' }\n format.json { render :show, status: :ok, location: @wiggle }\n else\n format.html { render :edit }\n format.json { render json: @wiggle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def put(*args)\n request(:put, *args)\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 create\n wish = current_user.wishes.new(wish_params)\n if wish.save\n # for each of the keywords param, find the keyword in the keyword database,\n # if not found, create a new keyword and build a new relationship with the wish.\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n\n if wish_params[:image]\n render json: { wish: wish, image: url_for(wish.image) }, status: :created\n else\n render json: { wish: wish, image: '' }, status: :created\n end\n else\n render json: { errors: wish.errors.full_messages }, status: :unprocessable_entity\n end\n end"
] | [
"0.6478893",
"0.6446402",
"0.6404435",
"0.62265486",
"0.62234676",
"0.61401874",
"0.61304915",
"0.61304915",
"0.61304915",
"0.6079557",
"0.6057336",
"0.6011446",
"0.59815335",
"0.59564936",
"0.5954274",
"0.5932123",
"0.5930394",
"0.58973336",
"0.5880298",
"0.58720905",
"0.58554167",
"0.58490276",
"0.5848239",
"0.58358896",
"0.5815781",
"0.58098555",
"0.58069634",
"0.58017856",
"0.57748634",
"0.5770906"
] | 0.65631545 | 0 |
GET /aktions/1 GET /aktions/1.xml | def show
@aktion = Aktion.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @aktion }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @kontakties = Kontakty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kontakties }\n end\n end",
"def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end",
"def show\n @kontak = Kontak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kontak }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def show\n @transmission = Transmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transmission }\n end\n end",
"def show\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aniversario }\n end\n end",
"def show\n @zorg_voor_jeugd_alias = ZorgVoorJeugdAlias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zorg_voor_jeugd_alias }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end",
"def show\n @kontakty = Kontakty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kontakty }\n end\n end",
"def show\n @aisle = Aisle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aisle }\n end\n end",
"def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end",
"def index\n @amenities = Amenity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @amenities }\n end\n end",
"def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def show\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def show\n @az_tariff = AzTariff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_tariff }\n end\n end",
"def index\n @uitgelichts = Uitgelicht.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uitgelichts }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def show\n @uitgelicht = Uitgelicht.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uitgelicht }\n end\n end",
"def show\n @lek = Lek.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lek }\n end\n end",
"def show\n @aircraft_history = AircraftHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aircraft_history }\n end\n end",
"def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"def show\n @almacen = Almacen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @almacen }\n end\n end",
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def show\n @events_translation = EventsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @events_translation }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def show\n @atividade = Atividade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atividade }\n end\n end",
"def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end"
] | [
"0.6348968",
"0.61060447",
"0.5890238",
"0.583558",
"0.5822921",
"0.5783563",
"0.57820463",
"0.57705635",
"0.5753406",
"0.57525",
"0.5744738",
"0.57319534",
"0.57258654",
"0.57128507",
"0.56969434",
"0.5695478",
"0.56927633",
"0.5690401",
"0.5683251",
"0.56711614",
"0.56680346",
"0.56648344",
"0.56607443",
"0.5660167",
"0.5657242",
"0.5656689",
"0.5652001",
"0.564211",
"0.5637658",
"0.56360006"
] | 0.6412662 | 0 |
GET /aktions/new GET /aktions/new.xml | def new
@aktion = Aktion.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @aktion }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @transmission = Transmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transmission }\n end\n end",
"def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end",
"def new\n @mapping = Mapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mapping }\n end\n end",
"def new\n @arc = Arc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arc }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @zorg_voor_jeugd_alias = ZorgVoorJeugdAlias.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @zorg_voor_jeugd_alias }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end",
"def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end"
] | [
"0.6836664",
"0.66961354",
"0.6647385",
"0.6611461",
"0.6600876",
"0.6588805",
"0.6579335",
"0.6578438",
"0.65678596",
"0.6561316",
"0.6546243",
"0.6540222",
"0.6532622",
"0.6532622",
"0.6532622",
"0.6523455",
"0.65155053",
"0.6515044",
"0.6496029",
"0.64893603",
"0.6485425",
"0.6485425",
"0.6480489",
"0.64758295",
"0.6475738",
"0.64634335",
"0.6445165",
"0.6439437",
"0.6438355",
"0.6433865"
] | 0.7027073 | 0 |
POST /aktions POST /aktions.xml | def create
@aktion = Aktion.new(params[:aktion])
respond_to do |format|
if @aktion.save
flash[:notice] = 'Aktion was successfully created.'
format.html { redirect_to(@aktion) }
format.xml { render :xml => @aktion, :status => :created, :location => @aktion }
else
format.html { render :action => "new" }
format.xml { render :xml => @aktion.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @akt = Akt.new(akt_params)\n\n respond_to do |format|\n if @akt.save\n format.html { redirect_to @akt, notice: 'Акт створено.' }\n format.json { render :show, status: :created, location: @akt }\n else\n format.html do\n prepare_form_data\n render :new\n end\n format.json { render json: @akt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aktuator = Aktuator.new(aktuator_params)\n\n respond_to do |format|\n if @aktuator.save\n format.html { redirect_to @aktuator, notice: 'Aktuator was successfully created.' }\n format.json { render :show, status: :created, location: @aktuator }\n else\n format.html { render :new }\n format.json { render json: @aktuator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def post(action, params={}, options={})\n request(:post, action, params, options)\n end",
"def new\n @aktion = Aktion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aktion }\n end\n end",
"def create\n @kontak = Kontak.new(params[:kontak])\n\n respond_to do |format|\n if @kontak.save\n flash[:peringatan] = 'Kontak was successfully created.'\n format.html { redirect_to :action => \"index\"}\n format.xml { render :xml => @kontak, :status => :created, :location => @kontak }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @kontak.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def test_accueil_et_inscription\n\t\tpost '/accueil', identifiant: '2', date_naiss: '1915-12-19'\n\t\tassert last_response.body.include? 'son inscription'\n\tend",
"def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def post_act(act, params)\n Cloudflare::Util::Component.parse_response(HTTParty.post(Cloudflare::Util::Config.get('host.base_url'), body: get_body(act, params)))\n end",
"def index\n @kontakties = Kontakty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kontakties }\n end\n end",
"def test_should_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :api_key=>'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def akt_params\n params.require(:akt).permit(:contract_id, :from_date, :sum, :number,\n :scan_path, :doc_path, :is_signed, :is_deleted, :preferences, :kind,\n :is_taken_as_original, {scanfiles: []}, {textfiles: []}, :remove_scanfiles, :remove_textfiles, :sum_detail\n )\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @kouteimaster = Kouteimaster.new kouteimaster_params\n flash[:notice] = t 'app.flash.new_success' if @kouteimaster.save\n respond_with @kouteimaster\n end",
"def post(atom)\n @hive_party.post '/atoms', atom.to_h\n end",
"def create\n @early_access_request = EarlyAccessRequest.new(early_access_request_params)\n\n respond_to do |format|\n if @early_access_request.save\n format.html { redirect_to root_path, notice: 'Danke für die Registrierung. Wir melden uns bei dir.' }\n format.json { render :show, status: :created, location: @early_access_request }\n else\n format.html { render :new }\n format.json { render json: @early_access_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_aliases(actions)\n resp = post do |req|\n req.url \"/_aliases\"\n req.body = { :actions => Array.new(actions) }\n end\n resp.body\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def create\n @kontakty = Kontakty.new(params[:kontakty])\n\n respond_to do |format|\n if @kontakty.save\n flash[:notice] = 'Kontakty was successfully created.'\n format.html { redirect_to(@kontakty) }\n format.xml { render :xml => @kontakty, :status => :created, :location => @kontakty }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kontakty.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.5446658",
"0.5281343",
"0.5253184",
"0.5202324",
"0.51885104",
"0.5118851",
"0.5112516",
"0.508409",
"0.5081446",
"0.5081028",
"0.5074932",
"0.50144464",
"0.5013193",
"0.50059336",
"0.49958107",
"0.49835205",
"0.49536613",
"0.4944312",
"0.49390098",
"0.49359998",
"0.4935295",
"0.49211717",
"0.4919084",
"0.49163204",
"0.48989305",
"0.48824215",
"0.48622298",
"0.48609787",
"0.48576885",
"0.48554733"
] | 0.5885438 | 0 |
PUT /aktions/1 PUT /aktions/1.xml | def update
@aktion = Aktion.find(params[:id])
respond_to do |format|
if @aktion.update_attributes(params[:aktion])
flash[:notice] = 'Aktion was successfully updated.'
format.html { redirect_to(@aktion) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @aktion.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n format.html { redirect_to @atom, notice: 'Atom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aktuator.update(aktuator_params)\n format.html { redirect_to @aktuator, notice: 'Aktuator was successfully updated.' }\n format.json { render :show, status: :ok, location: @aktuator }\n else\n format.html { render :edit }\n format.json { render json: @aktuator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n if @arc.update_attributes(params[:arc])\n flash[:notice] = 'Arc was successfully updated.'\n format.html { redirect_to(@arc) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @arc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n @kontak = Kontak.find(params[:id])\n\n respond_to do |format|\n if @kontak.update_attributes(params[:kontak])\n flash[:notice] = 'Kontak was successfully updated.'\n format.html { redirect_to(@kontak) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kontak.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n respond_to do |format|\n if @accesot.update(accesot_params)\n format.html { redirect_to @accesot, notice: 'Accesot was successfully updated.' }\n format.json { render :show, status: :ok, location: @accesot }\n else\n format.html { render :edit }\n format.json { render json: @accesot.errors, status: :unprocessable_entity }\n end\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_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @az_tariff = AzTariff.find(params[:id])\n\n respond_to do |format|\n if @az_tariff.update_attributes(params[:az_tariff])\n format.html { redirect_to(@az_tariff, :notice => 'AzTariff was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_tariff.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 @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n if @aniversario.update_attributes(params[:aniversario])\n format.html { redirect_to(@aniversario, :notice => 'Aniversario was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aniversario.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.5846597",
"0.5741908",
"0.56314933",
"0.56169415",
"0.55770534",
"0.5570146",
"0.5535835",
"0.55105174",
"0.5508029",
"0.54939276",
"0.53676236",
"0.5338769",
"0.5329612",
"0.53254646",
"0.53153676",
"0.530708",
"0.5272382",
"0.5258371",
"0.52416664",
"0.5218568",
"0.52040315",
"0.5196206",
"0.51882565",
"0.51869005",
"0.5170854",
"0.51613235",
"0.51550716",
"0.5154346",
"0.515098",
"0.5136064"
] | 0.58411115 | 1 |
DELETE /aktions/1 DELETE /aktions/1.xml | def destroy
@aktion = Aktion.find(params[:id])
@aktion.destroy
respond_to do |format|
format.html { redirect_to(aktions_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @kontak = Kontak.find(params[:id])\n @kontak.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontaks_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @arc = Arc.find(params[:id])\n @arc.destroy\n\n respond_to do |format|\n format.html { redirect_to(arcs_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @kontakty = Kontakty.find(params[:id])\n @kontakty.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontakties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aniversario = Aniversario.find(params[:id])\n @aniversario.destroy\n\n respond_to do |format|\n format.html { redirect_to(aniversarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invier_acceso = InvierAcceso.find(params[:id])\n @invier_acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(invier_accesos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @almacen = Almacen.find(params[:id])\n @almacen.destroy\n \n respond_to do |format|\n format.html { redirect_to(almacenes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @atom = Atom.find(params[:id])\n @atom.destroy\n\n respond_to do |format|\n format.html { redirect_to(atoms_url) }\n format.xml { head :ok }\n end\n end",
"def delete_entry(aliaz)\n\n end",
"def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @transmission = Transmission.find(params[:id])\n @transmission.destroy\n\n respond_to do |format|\n format.html { redirect_to(transmissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ambit = Ambit.find(params[:id])\n @ambit.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambits_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.67681015",
"0.6438368",
"0.63879585",
"0.6378644",
"0.6357101",
"0.6355549",
"0.63552016",
"0.6332766",
"0.63288426",
"0.62855387",
"0.62809",
"0.62789476",
"0.62674224",
"0.62603086",
"0.6244535",
"0.6224033",
"0.62123626",
"0.6189972",
"0.61838096",
"0.6168901",
"0.616695",
"0.61634123",
"0.6159453",
"0.6158462",
"0.6153194",
"0.61427146",
"0.613922",
"0.61256516",
"0.6123803",
"0.61228985"
] | 0.68998826 | 0 |
Sets flag to make create/update account the default account | def add_default_account(post)
post[:defaultacct] = 'Y'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n self.state ||= 'ACTIVE'\n self.account_user_id ||= Gizmo::Util::Uuid.generate\n self.is_owner ||= false\n end",
"def set_defaults\n self.state ||= 'NEW'\n self.account_id ||= Gizmo::Util::Uuid.generate\n self.account_name ||= self.subdomain\n end",
"def set_default!\n @@default_user = self\n end",
"def set_defaults\n\t\tself.email = self.users.first.email if ['student','school_admin','admin'].include? self.role\n\t\tself.uuid = SecureRandom::uuid()\n\t\tself.active = true\n\tend",
"def set_defaults\n self.state ||= 'NEW'\n self.user_id ||= Gizmo::Util::Uuid.generate\n end",
"def create\n @account = current_user.accounts.new(params[:account])\n \n #respond_to do |format|\n if @account.save\n default_account = Account.count == 1 || (Account.count > 1 && params[:default_account])\n current_user.update_attribute(:default_account, @account.id) if default_account\n\n flash[:notice] = 'Account was successfully created.'\n head :ok\n #format.html { redirect_to(@account) }\n #format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n #format.html { render :action => \"new\" }\n #format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n head :unprocessable_entity\n end\n #end\n end",
"def set_as_default(user)\n current_default = user.addresses.find_by(default: true)\n current_default.update_attribute :default, false\n update_attribute :default, true\n end",
"def set_default\n self.member.payout_methods.active_only.each do |pm|\n pm.update_attribute(:default, false) if pm.default?\n end\n self.update_attribute(:default, true)\n end",
"def assign_default_credit_card\n true\n end",
"def save_default_profile(cc_user)\n PaymentProfile.transaction do\n if self.default == true\n PaymentProfile.update_all( { default: false },\n { payment_profiles: {\n user_id: cc_user.id,\n } }) if cc_user\n end\n self.user = cc_user\n self.save\n end\n end",
"def create_default_admin\n admin_user = User.create!({\n email: 'admin@mindhub.org',\n first_name: 'Admin',\n last_name: 'the Administrator',\n password: 'creativefresno',\n password_confirmation: 'creativefresno',\n remember_me: false\n })\n\n admin_user.update_attribute :admin, true\nend",
"def set_defaults\n self.availability ||=false\n self.email ||= @profile.user.email\n end",
"def set_current_user_to_creator_if_empty(options, current_user:, **)\n if options['contract.default'].creator_id\n true\n else\n options['contract.default'].creator_id = current_user.id\n end\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def make_default!\n result = gateway.customer.update(customer.processor_id, default_payment_method_token: processor_id)\n raise Pay::Braintree::Error, result unless result.success?\n result.success?\n end",
"def make_default!\n result = gateway.customer.update(customer.processor_id, default_payment_method_token: processor_id)\n raise Pay::Braintree::Error, result unless result.success?\n result.success?\n end",
"def default?\n is_default == true or user.accounts.count == 1\n end",
"def create_default_settings\n setting = Setting.new\n setting.user_id = self.id\n setting.save!\n end",
"def set_default\n end",
"def determine_default_account_name\n Cadenero.default_account_name = options[\"default-account-name\"].presence ||\n ask(\"What will be the name for the default account? [Root Account]\").presence ||\n 'Root Account'\n end",
"def default\n asset = ToolbawksAsset.find(params[:id])\n default = (asset.default ? false : true)\n \t\tasset.update_attributes!(:default => default)\n\n \t\t# Render nothing to denote success\n render :text => \"Successfully set the default flag for the asset\"\n end",
"def set_default_role\n update_attribute :roles, [UserRoles::CUSTOMER] if roles.empty?\n end",
"def set_defaults\n self.active ||= true\n end",
"def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end",
"def set_account\n @account = current_user\n end",
"def defaults\n if self.name == \"Alex Ames\" || self.name == \"Ife Runsewe\"\n self.admin ||= true\n else\n self.admin ||= false\n nil #^Leaving a false value on the stack means the model will not be saved.^\n end\n end",
"def create\n super\n acc = Account.create!(:company_name => params[:account][:company_name]) unless flash.blank?\n # Set admin and account_id for User \n resource.update_attributes!({:account_id => acc.id, :is_admin => true, :status => SettingsConfig::ENABLED}) unless flash.blank?\n end",
"def determine_default_user_password\n Cadenero.default_user_password = options[\"default-user-password\"].presence ||\n ask(\"What will be the password for the default user owner of the default account? [change-me]\").presence ||\n 'change-me'\n end",
"def set_default_role!\n clear!\n end"
] | [
"0.71875703",
"0.6926933",
"0.6569838",
"0.6523224",
"0.6505293",
"0.6360575",
"0.6339988",
"0.6300126",
"0.62328976",
"0.6231819",
"0.62196255",
"0.6130573",
"0.61287594",
"0.61264807",
"0.6109155",
"0.61017406",
"0.61017406",
"0.6088548",
"0.60852414",
"0.60523975",
"0.6046835",
"0.60400856",
"0.6036511",
"0.60059804",
"0.6002492",
"0.59981966",
"0.59947324",
"0.5985725",
"0.59785676",
"0.5966026"
] | 0.7921206 | 0 |
Adds profile to post and sets update flag | def add_profile(post, profile)
post[:profile] = profile
post[:profileupdate] = 'Y'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend",
"def set_post\n @profile = Profile.find(params[:id])\n end",
"def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end",
"def update_profile(options={})\n perform_post(\"account/update_profile.#{Twitter.format}\", options)\n end",
"def add_to_profile(profile_name:, profile_data:)\n Faraday.post \"#{@@profile_service_url}/profile/#{profile_name}\", profile_data\n rescue StandardError => e\n puts \"Error adding to profile : #{e.message}\"\n end",
"def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end",
"def update!(**args)\n @profile_name = args[:profile_name] if args.key?(:profile_name)\n @profile_photo_url = args[:profile_photo_url] if args.key?(:profile_photo_url)\n @profile_url = args[:profile_url] if args.key?(:profile_url)\n @takedown_url = args[:takedown_url] if args.key?(:takedown_url)\n end",
"def create\n @profile = Profile.find params[:profile_id]\n @update = @profile.updates.new(update_params)\n\n respond_to do |format|\n if @update.save\n format.html { redirect_to update_path(@update), notice: 'Update was successfully created.' }\n format.json { render :show, status: :created, location: @update }\n else\n format.html { render :new }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end",
"def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end",
"def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end",
"def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end",
"def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end",
"def update\n @profile = current_user.profile\n assign_params_to_attributes\n if @profile.update_attributes(params[:profile])\n if params[:profile][:zip].present?\n current_user.update_attribute(:zip, params[:profile][:zip])\n end\n flash[:notice] = I18n.t('profile.update.notice')\n # redirect_to user_path(current_user)\n redirect_to edit_user_profile_path(current_user, @profile)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.update.error')\n render :action => \"edit\"\n end\n end",
"def update_profile(params)\n post 'account/update_profile', :post => params\n end",
"def create\n post = Post.new(post_params)\n post.author = current_user\n post.receiver = User.find(params[:profile_id])\n binding.pry\n if post.save\n respond_to do |format|\n format.html { redirect_to profile_url(post.receiver) }\n format.json { render json: post }\n end\n else\n flash[:error] = \"There was a problem creating your post!\"\n end\n end",
"def add_user(profile)\n raise \"Invalid ID\" if profile[\"id\"].nil?\n response = client.post \"/profiles/?actor_token=#{CGI.escape client.system_token}&id=#{CGI.escape profile[\"id\"]}\", profile\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new profile_params\n unless current_user.profile\n @profile.user = current_user\n end\n\n respond_to do |format|\n if @profile.save\n if current_user.profile\n AclEntry.set current_user, @profile, :edit\n end\n FeedSubscription.add current_user.profile, @profile\n\n format.html { redirect_to session_path }\n format.xml { render xml: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @profile = args[:profile] if args.key?(:profile)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profiel\n if request.post? and params[:user]\n\n if @me.update_attributes(params[:user])\n # website stuff!\n if params[:user][:profile_website]\n if params[:user][:profile_website][0..6] != \"http://\" and !params[:user][:profile_website].blank?\n @me.update_attribute('profile_website', 'http://' + params[:user][:profile_website])\n end\n end\n flash.now[:notice] = \"Profiel gewijzigd\"\n end\n end\n \n end",
"def update_profile(params)\n post('/account/update_profile.json', params)\n end",
"def save_or_create_profile\n if profile.present?\n profile.actor_id = id\n profile.save!\n else\n create_profile\n end\n end",
"def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update_profile(user)\n create_feed(user, {:title => 'Profile changed', :description => \"#{create_link(user)}'s changed his profile\"})\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end",
"def add_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end"
] | [
"0.67057496",
"0.66889435",
"0.653363",
"0.6407962",
"0.63639706",
"0.63453615",
"0.62816125",
"0.6268229",
"0.6218425",
"0.6208063",
"0.62006456",
"0.6168615",
"0.6160453",
"0.6145818",
"0.61370856",
"0.613005",
"0.6107415",
"0.61013746",
"0.6100688",
"0.60894877",
"0.6085031",
"0.6072899",
"0.60689884",
"0.60536146",
"0.6047476",
"0.604367",
"0.6030735",
"0.60204196",
"0.59859514",
"0.5973005"
] | 0.85272396 | 0 |
Parses profileid and acctid from profile, and adds it parameters, used for profile deletion | def add_profile_parameters(parameters, profile)
profileid, acctid = profile.split('/')
parameters[:profileid] = profileid
parameters[:acctid] = acctid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_params\n params\n .require(:profile)\n .permit(:last_name, :first_name, :address, :phone, :age)\n .merge(:account_id => current_user.id)\n end",
"def profile_params\n params.require(:profile).permit(:profile_first_name, :profile_last_name, :user_id, :profile_preferred_right_id)\n end",
"def profile_params\n params.require(:profile).permit(:id, :name, :description, :cpf, :services, :mobile, :zipcode, :address, :number, :complement, :neighborhood, :city, :state, :profile)\n end",
"def user_profile_params\n params.require(:user_profile).permit(:profile_id)\n end",
"def create_DB_profile\n \n @profile = ProfileId.new\n @profile.user_name = params[:user_name]\n @profile.profile_id = @parsed[\"profileId\"]\n @profile.save\n end",
"def profile_params\n params.require(:profile).permit(:id)\n end",
"def add_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end",
"def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end",
"def profile_params\n params.fetch(:profile, {})\n end",
"def profile_params\n params.require(:profile).permit(:user_id, :first_name, :last_name, :address, :city, :state_id, :zip_code, :phone, :avatar, :gender_id, :slug_id, :twitter, :facebook, :linkedin, :googleplus)\n end",
"def profile_params\n params.require(:profile).permit(:age, :address, :gender, :full_name, :user_id)\n end",
"def profile_params\n params.require(:profile).permit(:username, :address, :suburb, :postcode, :search_radius, :sex, :age, :interests, :user_id)\n end",
"def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end",
"def profile_params\r\n params.fetch(:profile, {})\r\n end",
"def set_profile\n @profile = if params[:id]\n Profile.find_by!(user_id: params[:id])\n else\n Profile.find_by(user: current_user)\n end\n end",
"def profile_params\n params.require(:profile).permit(:profile_name, :camera, :set_password, :wallpaper_id, :call_recording, :spy_recording, :email_access_id, :default_call_duration, :device_mode, :ringtone_id, :access_to_os, :wifi, :gprs, :timezone, :secure_pictures, :internal_setting_id, :status,:password_length, :expiry, :password_type)\n end",
"def set_profile\n id = params[:id]\n @profile = Profile.find(id)\n end",
"def profile_params\n\t\tparams.require(:profile).permit(:user_id, :fname, :lname, :birthday, :nickname, :paypal, :recruitertos, :skype, :country_code, :bio, :avatar, :selected_channel_id)\n end",
"def profile_params\n params.require(:profile).permit(:name, :nick_name, :age, :height, :weight, :add1,\n :add2, :city, :state, :post_code, :birthday, :photo, :place_id)\n end",
"def handle_profile_id(id)\n case id\n when CustomerProfile\n set_fields(:customer_profile_id => id.customer_profile_id.to_s)\n when nil\n nil\n else\n set_fields(:customer_profile_id => id.to_s)\n end\n end",
"def profile_user_params\n params.require(:profile_user).permit(:profile_id, :user_id)\n end",
"def profile_params\n params.require(:profile).permit(:name, :age, :about_me, :profile_image_id, :user_id)\n end",
"def profile_params\n params.require(:profile).permit(:first_name, :last_name, :suffix, :member_id,\n :display_name, :state, :years_of_membership, :in_memoriam,\n :next_gen, :years_for_next_gen, :next_gen_presidents_club,\n :photo, :remote_photo_url, :photo_cache,\n :order)\n end",
"def update_profile!(caller_id, access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/#{caller_id}/user/{{client_id}}/profile\"\n request[:request_body] = to_hash\n end.execute!\n\n json[:user_guid]\n end",
"def profile_params\n params.require(:profile).permit(:name, :phone, :qq, :identity_card, :bank, :bank_address, :bank_account, :bank_account_name)\n end",
"def profile_params\n params.require(:profile).permit(:is_director, :is_assistant, :is_phd, :is_msc, :is_bsc, :is_intern, :username, :current_position, :email2, :website, :linked_in, :research_gate, :google_scholar, :phD_education, :MSc_education, :BSc_education, :phD_alumnus, :MSc_alumnus, :BSc_alumnus, :phD_thesis, :phD_thesis_desc, :MSc_thesis, :MSc_thesis_desc, :BSc_thesis, :BSc_thesis_desc, :entrance_year, :graduation_year, :isAdmin, :intern_title, :intern_desc, :intern_year, :avatar, :user_id, :phD_entrance_year, :phD_graduation_year, :MSc_entrance_year, :MSc_graduation_year, :BSc_entrance_year, :BSc_graduation_year, :guest_entrance_year, :guest_graduation_year, :guest_alumnus)\n end",
"def profile_params\n params.require(:profile).permit(:profile_snum, :first_name, :last_name, :gender, :mariage, :birthday, :email,\n :chinese_id_number, :chinese_passport_number,\n :occupation, :position, :employer,\n :country, :province, :city, :address, :zipcode, :cellphone)\n end",
"def profile_params\n params.require(:profile).permit(:user_id, :name, :phone_number, :address, :city, :state, :country_code, :avatar)\n end",
"def profile_params\n params.require(:profile).permit(:user_id, :name, :surname, :age, :profile_picture, :gender, :relationship_status)\n end",
"def profile_params\n params.require(:profile).permit(:name, :program, :start_year,:avatar,:first_post,:stil_id,:email,:phone)\n end"
] | [
"0.67498636",
"0.65747064",
"0.6551823",
"0.6509432",
"0.6485902",
"0.64439625",
"0.6434388",
"0.64103013",
"0.6394292",
"0.63849723",
"0.633013",
"0.63192815",
"0.63086426",
"0.630434",
"0.6280754",
"0.62768734",
"0.6273976",
"0.62671655",
"0.626039",
"0.6253733",
"0.6248475",
"0.62200564",
"0.6199723",
"0.6197052",
"0.6188651",
"0.6186089",
"0.61744225",
"0.61726534",
"0.6161123",
"0.61519754"
] | 0.82952243 | 0 |
DELETE /list_invites/1 DELETE /list_invites/1.json | def destroy
@list_invite.destroy
respond_to do |format|
format.html { redirect_to list_invites_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invite_list = InviteList.find(params[:id])\n @invite_list.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite_status = InviteStatus.find(params[:id])\n @invite_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to(invites_url) }\n format.xml { head :ok }\n end\n end",
"def remove_invite\n @invited = Dinner.find(params[:id]).invites.find_by(invited_id: params[:user_id])\n @invited.delete\n render json: { message: 'user uninvited' }\n end",
"def destroy\n\t\tredirect_to guild_invites_url, :alert => \"Already used\" and return unless @guild.invites.find(params[:id]).state == \"waiting\"\n\t\t@guild.invites.destroy(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to guild_invites_url, notice: 'Invite was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to event_invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invited.destroy\n respond_to do |format|\n format.html { redirect_to inviteds_url, notice: 'Invited was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite_request = InviteRequest.find(params[:id])\n @invite_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(invite_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite_request.destroy\n render :index\n\n end",
"def delete_invite(token, code)\n request(\n __method__,\n :delete,\n \"#{api_base}/invites/#{code}\",\n Authorization: token\n )\n end",
"def destroy\n @invitee.destroy\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maintain_invite_user = Maintain::InviteUser.find(params[:id])\n @maintain_invite_user.destroy\n\n respond_to do |format|\n format.html { redirect_to maintain_invite_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inv.destroy\n respond_to do |format|\n format.html { redirect_to invs_url, notice: 'Inv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invitee = Invitee.find(params[:id])\n @invitee.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :ok }\n end\n end",
"def delete\n\t\trender json: Investor.delete_by_id(params[:id])\n\tend",
"def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7614332",
"0.7483555",
"0.7483555",
"0.7483555",
"0.7483555",
"0.7312825",
"0.7312825",
"0.72277004",
"0.72108185",
"0.71746373",
"0.7099659",
"0.7077111",
"0.7051402",
"0.7051402",
"0.7051402",
"0.7051402",
"0.6994812",
"0.6852885",
"0.68522215",
"0.6768387",
"0.6764497",
"0.6729345",
"0.67075574",
"0.6670407",
"0.6652794",
"0.66412055",
"0.66271925",
"0.66271925",
"0.66271925",
"0.66271925"
] | 0.7661324 | 0 |
Returns the permissions associated with the role | def permissions
Roles.type_map[role_type].permissions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_permissions\n return @role_permissions\n end",
"def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end",
"def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end",
"def show\n @permissions = @role.permissions\n end",
"def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@permissions\") || @permissions.nil?\n @permissions ||= Permission.where([cond_str, self]).to_a\n end\n\n return @permissions\n end",
"def index\n @role_permissions = RolePermission.all\n end",
"def permissions\n return @permissions\n end",
"def existing_permissions(role)\n role.permissions.where.not(action: CardPermissions::STATELESS_ACTIONS).where.not(filter_by_card_id: nil)\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def get_role_permissions(role_id, options = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_id' if role_id.to_s.empty?\n\n request_params = {\n per_page: options.fetch(:per_page, nil),\n page: options.fetch(:page, nil),\n include_totals: options.fetch(:include_totals, nil)\n }\n get \"#{roles_path}/#{role_id}/permissions\", request_params\n end",
"def role\n permission_type\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def index\n @rolepermissions = Rolepermission.all\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def role_permissions=(value)\n @role_permissions = value\n end",
"def permissions\n @resource_permissions\n end",
"def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def resource_role_scopes\n return @resource_role_scopes\n end",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end",
"def permission_keys\n return @permission_keys if @permission_keys\n\n role_keys = if role(true)\n role_key = \"#{role.cache_key}/permissions\"\n\n keys = Rails.cache.fetch(role_key) do\n role.permission_keys.clone\n end\n\n Rails.cache.write(role_key, keys)\n keys\n else\n []\n end\n\n user_keys = Rails.cache.fetch(permissions_cache_key) do\n user_permission_keys.clone\n end\n\n user_keys = [] unless user_keys\n\n Rails.cache.write(permissions_cache_key, keys) unless new_record?\n\n @permission_keys = (role_keys + user_keys).uniq\n end",
"def roles\n roles_from_users\n end"
] | [
"0.83612496",
"0.7967314",
"0.7944717",
"0.7577825",
"0.7563391",
"0.74145716",
"0.74088514",
"0.72138083",
"0.71344703",
"0.7127846",
"0.7009284",
"0.69980043",
"0.6966114",
"0.69469106",
"0.6939263",
"0.6932439",
"0.68984014",
"0.68984014",
"0.689288",
"0.689288",
"0.68855464",
"0.688029",
"0.68800646",
"0.6867392",
"0.6852364",
"0.68193436",
"0.6737279",
"0.6666258",
"0.66492355",
"0.6635681"
] | 0.81939876 | 1 |
Sets the nearest timeframe | def set_time_frame time, time_slot = 30.minutes
Time.at(((time.to_i / time_slot).round * time_slot) + time_slot).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_timeframe(timeframe)\n timeframe\n end",
"def timeframe=(val)\n raise(ArgumentError, 'timeframe value must be in the days_ago_list') unless days_ago_list.include? val\n\n @timeframe = val\n refresh_data\n\n end",
"def set_timeframe\n @timeframe = Timeframe.find(params[:id])\n end",
"def timeframe\n Sleek::Timeframe.to_range(@timeframe, @timezone) if @timeframe\n end",
"def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end",
"def set_current_time_as_adjusted\n self.adjusted_at = Time.current\n end",
"def set_next_run\n self.next_run_at = Time.zone.now unless self.next_run_at\n end",
"def set(time)\n reset\n @offset = now - time\n end",
"def target_framerate=( framerate )\n\t\t\t\tif framerate\n\t\t\t\t\t@target_frametime = 1000.0 / framerate\n\t\t\t\telse\n\t\t\t\t\t@target_frametime = nil\n\t\t\t\tend\n\t\t\trescue ZeroDivisionError\n\t\t\t\t@target_frametime = nil\n\t\t\tend",
"def post_initialize\n\t\tunless time_frame.active?\n\t\t\t@time_frame = TimeFrame.new( start_date: Changeset_Query.earliest_changeset_date, end_date: Changeset_Query.latest_changeset_date )\n\t\tend\n\tend",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def set_Timeframe(value)\n set_input(\"Timeframe\", value)\n end",
"def with_floating_timezone\n dup.set_tzid(:floating)\n end",
"def set_timezone(timezone); end",
"def set_timezone(timezone); end",
"def set_timezone(timezone); end",
"def set_timezone(timezone); end",
"def set_timezone(timezone); end",
"def set_timespan(doc, object)\n\n # For this import, assume everything is current, even if it isn't marked that way\n\n object.create_timespan if object.timespan.nil?\n object.timespan.update_attribute(:is_current, true)\n\n #puts 'updating timespan:::::' + object.class.to_s\n #if object.respond_to? :feature\n # puts \"Feature PID == #{object.feature.pid}\"\n #end\n #puts \"ERRORS == #{object.errors.inspect}\"\n #result = object.timespan.nil? ? object.create_timespan(:is_current => true) : object.timespan.update_attribute(:is_current, true)\n #puts result.inspect\n\n #if(doc.attributes['isCurrent'])\n # if(doc.attributes['isCurrent']=='yes')\n # object.timespan = Timespan.new(:is_current => true)\n # elsif(doc.attributes['isCurrent']=='no')\n # object.timespan = Timespan.new(:is_current => false)\n # end\n #end\n end",
"def set_timezone\n loc = Location.find(self.location_id)\n self.time_zone, self.localGMToffset = loc.time_zone, loc.localGMToffset\n end",
"def setpoint_to_target\n @setpoint = @freq_target\n end",
"def set_next_run\n self.next_run_at = calc_next_run_at_date\n end",
"def set_start_time\n @start_time = Time.now.to_f\n end",
"def set_start_time\n @start_time = Time.now.to_f\n end"
] | [
"0.67763716",
"0.5833987",
"0.5665923",
"0.5644117",
"0.5591518",
"0.5580752",
"0.5405682",
"0.53374815",
"0.53036475",
"0.52960515",
"0.5290458",
"0.5290458",
"0.5290458",
"0.5290458",
"0.5290458",
"0.5290458",
"0.5290458",
"0.5290458",
"0.5276369",
"0.5274024",
"0.5274024",
"0.5274024",
"0.5274024",
"0.5274024",
"0.52513635",
"0.52122074",
"0.52117354",
"0.5156183",
"0.5119606",
"0.5119606"
] | 0.59649295 | 1 |
Returns the recipe classes in order based on the Gemfile order | def ordered_recipes
return @ordered_recipes if @ordered_recipes
names = Bundler.load.dependencies.map(&:name)
# Setup a hash with the recipe name and the recipe class
recipe_pool = recipes.dup.inject({}) {|memo,recipe| memo[recipe.gem_name] = recipe ; memo }
# Go through the gems in the order they are in the Gemfile, then
# add them to the ordered list
@ordered_recipes = []
names.each do |name|
if recipe_pool[name]
@ordered_recipes << recipe_pool[name]
recipe_pool.delete(name)
end
end
# Add the remaining recipes (load them after everything else)
@ordered_recipes += recipe_pool.values
return @ordered_recipes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end",
"def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end",
"def cookbook_order\n @cookbook_order ||= begin\n ordered_cookbooks = []\n seen_cookbooks = {}\n run_list_expansion.recipes.each do |recipe|\n cookbook = Chef::Recipe.parse_recipe_name(recipe).first\n add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, cookbook)\n end\n logger.debug(\"Cookbooks to compile: #{ordered_cookbooks.inspect}\")\n ordered_cookbooks\n end\n end",
"def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end",
"def find_classes\n puppetClasses = []\n Dir.glob( SpkDashboard::MANIFEST_ROOT + \"/modules/**/*.pp\" ).each do |manifest|\n File.read( manifest ).each do |line|\n foundClass = line.match(/^class (\\S+).*\\{/)\n if foundClass and puppetClasses.include?( foundClass[1] ) == false\n puppetClasses << foundClass[1]\n end\n end\n end\n \n return puppetClasses\n end",
"def requires\n require_items.collect(&:package)\n end",
"def runtime_specific_gems\n []\n end",
"def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end",
"def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end",
"def r(*gems)\n gems.map {|g| require g.to_s}\nend",
"def libraries_order\n order = [:Ruby_]\n order.unshift(:Statistics2_) if has_statistics2?\n order.unshift(:GSL_) if has_gsl?\n order.unshift(:Java_) if has_java?\n order\n end",
"def classes()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << clazz( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend",
"def patch_files\n Dir[File.join( recipe_dir, \"*.patch\" )].sort\n end",
"def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end",
"def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end",
"def recipes\n @_recipes ||= (\n %w[dorc **/*.rake].map { |f| Dir[File.join(DO_PATH, f)] }.flatten +\n %w[./Do ./Dofile].map { |f| File.expand_path(f) } <<\n File.expand_path('../common.rb', __FILE__)\n ).reject { |f| !File.exist?(f) }\n end",
"def recipes_from_cookbook_version(cookbook)\n cookbook.fully_qualified_recipe_names.map do |recipe_name|\n unqualified_name =\n if /::default$/.match?(recipe_name)\n name.to_s\n else\n recipe_name\n end\n\n @recipes[unqualified_name] ||= \"\"\n provides(unqualified_name)\n\n unqualified_name\n end\n end",
"def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end",
"def card_classes\n model_files = Dir.glob(\"#{Rails.root}/app/lib/#{name.underscore}/*.rb\")\n model_names = model_files.map { |fn| File.basename(fn, '.rb').camelize }\n model_names.map { |mn| \"#{name}::#{mn}\".constantize }.sort_by { |c| [c.try(:raw_cost), c.readable_name] }\n end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end",
"def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end",
"def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end",
"def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end",
"def manifest_dependencies()\n as_bundle = Bundle.fromProject(self)\n as_bundle.nil? ? [] : as_bundle.bundles.collect{|b| b.resolve}.compact + as_bundle.imports.collect {|i| i.resolve}.flatten\n end",
"def faker_modules\n FFaker\n .constants\n .reject { |const| UTILS_MODULES.include?(const) }\n .select { |const| FFaker.const_get(const).instance_of?(Module) }\n .sort\n .map { |const| FFaker.const_get(const) }\nend",
"def find_package_cls(package_path, io)\n return [] unless File.extname(package_path) == '.rb'\n\n mod = Module.new\n package_script = io.read package_path\n\n begin\n mod.class_eval package_script, package_path, 1\n rescue Exception => e # rubocop:disable RescueException\n raise ImportScriptError.new package_path, e\n end\n\n # Iterate over all constants/classes defined by the script.\n # If a constant defines a package return it.\n mod.constants.sort\n .map(&mod.method(:const_get))\n .select { |const| !const.nil? && const < Package }\n end",
"def init_gemspecs\n Gem.source_index.map { |_, spec| spec }.sort { |a,b|\n\t(a.name <=> b.name).nonzero? || (b.version <=> a.version)\n }\n end",
"def classes_and_includes_and_extends_for name\n klasses = []\n extends = []\n includes = []\n\n found = @stores.map do |store|\n begin\n klass = store.load_class name\n klasses << klass\n extends << [klass.extends, store] if klass.extends\n includes << [klass.includes, store] if klass.includes\n [store, klass]\n rescue RDoc::Store::MissingFileError\n end\n end.compact\n\n extends.reject! do |modules,| modules.empty? end\n includes.reject! do |modules,| modules.empty? end\n\n [found, klasses, includes, extends]\n end",
"def packages\n Dir[File.join($__HELLO_DIR__, 'packages/*/*.yml')]\n .map do |yml|\n info = YAML.load File.read yml\n info['dir'] = File.dirname yml if info\n info\n end\n .select {|p| p }\n .sort_by {|p| p['priority'] || 10 }\nend"
] | [
"0.663816",
"0.663816",
"0.647818",
"0.6027255",
"0.5872339",
"0.57335997",
"0.57302433",
"0.5720733",
"0.57169104",
"0.5702004",
"0.56983083",
"0.56872267",
"0.56674826",
"0.56643623",
"0.5659114",
"0.5616627",
"0.55957377",
"0.5593597",
"0.5582223",
"0.55817837",
"0.5573044",
"0.5550637",
"0.5548523",
"0.554595",
"0.5539615",
"0.553569",
"0.55277467",
"0.5521404",
"0.5513805",
"0.54956526"
] | 0.79110026 | 0 |
Returns the list of classes that match the current list of roles in the correct run order | def recipe_classes_with_roles(roles)
# Check to make sure some recipes have been added
if ordered_recipes.size == 0
raise Thor::InvocationError, 'no recipes have been defined'
end
if (roles.is_a?(Array) && roles.size == 0) || roles == :all
# Use all classes
role_classes = ordered_recipes
else
# Remove classes that don't fit the roles being used
role_classes = ordered_recipes.reject do |recipe_class|
![roles].flatten.map(&:to_s).include?(recipe_class.class_role)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roles\n Jak.role_klass.where(id: grants.pluck(:role_ids).compact.flatten)\n end",
"def roles\n @run_list.select do |rl|\n rl.start_with?('r_', 'p_', 'base_', 'os_', 'os-')\n end\n end",
"def roles\n self.class.roles.map do |name|\n __send__(name)\n end\n end",
"def get_classes_from_role(role, options)\n certname = options[:certname_for_facts]\n global_config = get_global_config\n global_config = find_facts(certname).merge(global_config)\n get_classes_per_scenario(global_config, role)\n end",
"def the_roles\n roles.each.map{|_r| User::ROLES[_r.to_sym] }\n end",
"def get_role_classes_from_scenario(name)\n role_classes = {}\n # iterate through each roles in a scenario\n get_scenario_data(name)['roles'].each do |role_name, values|\n role_classes[role_name] = (values['classes'] || []) + get_classes_from_groups(values['class_groups'])\n end\n role_classes\n end",
"def find_roles *roles\n role_model.where(:name => roles.flatten)\n end",
"def instances_by_role(*roles)\n roles = roles.flatten.map(&:to_s)\n instances.select { |inst| roles.include?(inst.role.to_s) }\n end",
"def all_roles_with_changes\n (diff_roles + diff_profile.map do |klass|\n roles_that_include(klass)\n end.flatten).uniq\n end",
"def fetch_current_role_names(current_roles)\n current_role_names = []\n ROLES.keys.each do |role_type|\n current_roles.fetch(role_type, []).each do |current_role|\n role_name = get_role_name(role_type, current_role)\n\n break if role_name.nil?\n\n current_role_names << role_name\n end\n end\n current_role_names\n end",
"def run_list\n self.roles.collect { |role| \"role[#{role}]\" } +\n self.recipes.collect { |recipe| \"recipe[#{recipe}]\" }\n end",
"def roles\n return proposed_snapshot.roles if proposed? \n return active_snapshot.roles if active?\n []\n end",
"def components_in_roles( qroles )\n ( qroles & roles ).inject([]) { |m,r| m += space.role( r ) }\n end",
"def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end",
"def get_role_classes_from_scenario(name, scope)\n role_classes = {}\n scope = scope.merge({'scenario' => name})\n # iterate through each roles in a scenario\n scenario_data = get_scenario_data(name, scope)\n (scenario_data['roles'] || []).each do |role_name, values|\n role_classes[role_name] = process_classes(values, scope).uniq\n end\n role_classes\n end",
"def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end",
"def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end",
"def pass_on_roles\n r = self.roles.to_a\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users)).to_a\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles)).to_a\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users)).to_a\n end\n return (r.is_a?(Array) ? r : [r])\n end",
"def roles\n Role.group_roles_from_cache(self)\n end",
"def roles_list(role = nil)\n self.role_symbols\n end",
"def get_role_ids()\n server = Rails.cache.read('discord_bot/servers')&.find { |s| s['id'] == self.discord_server.id }\n\n return [] if server.nil?\n\n roles_config = server['exp_roles_config']\n\n return [] if roles_config.nil?\n\n thresholds = roles_config.sort_by { |r| r[0] }\n acquired_roles = []\n\n while thresholds.count > 0 && self.exp > thresholds.first[0] do\n acquired_roles.push(thresholds.shift)\n end\n\n return acquired_roles\n end",
"def all_roles\n result = Array.new\n \n# for role in self.roles\n# result << role.ancestors_and_self\n# end\n \n for group in self.groups\n result << group.all_roles\n end\n \n result.flatten!\n result.uniq!\n \n return result\n end",
"def roles\n self.dig_for_array(\"roles\")\n end",
"def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end",
"def get_available_roles \n ids = Array.new\n \n current = self.parent_id\n while current\n role = Role.find(current)\n if role\n if not ids.index(role.id)\n ids << role.id\n current = role.parent_id\n end \n end \n end\n return ids\n end",
"def normalize_roles\n self.roles = if self.roles.blank?\n []\n else\n self.class.roles.select { |role_to_check| roles.include?(role_to_check.to_s) }\n end\n end",
"def roles\n Role.all.select do |role|\n role.movie == self\n end\n end",
"def roles\n @declared_roles ||= Hash.new\n end",
"def roles_for(section)\n roles = []\n Section.find_roles.pluck(:name).uniq.each do |role|\n roles += [role] if self.has_role?(role, section)\n end\n roles\n end",
"def find_classes\n puppetClasses = []\n Dir.glob( SpkDashboard::MANIFEST_ROOT + \"/modules/**/*.pp\" ).each do |manifest|\n File.read( manifest ).each do |line|\n foundClass = line.match(/^class (\\S+).*\\{/)\n if foundClass and puppetClasses.include?( foundClass[1] ) == false\n puppetClasses << foundClass[1]\n end\n end\n end\n \n return puppetClasses\n end"
] | [
"0.6776941",
"0.656379",
"0.6520467",
"0.6483397",
"0.64126897",
"0.6331103",
"0.63098425",
"0.6295739",
"0.6293623",
"0.6227268",
"0.6221702",
"0.61961675",
"0.6187308",
"0.61219615",
"0.6045106",
"0.60402143",
"0.60402143",
"0.6031308",
"0.5972891",
"0.5972758",
"0.59591484",
"0.59410137",
"0.59204733",
"0.58812743",
"0.58629346",
"0.5858676",
"0.58525",
"0.5839133",
"0.58215535",
"0.5800889"
] | 0.7155205 | 0 |
Invokes all recipes that implement the passed in role | def invoke_roles(task_name, roles, options={})
role_classes = self.recipe_classes_with_roles(roles)
# Run the taks on each role class
role_classes.each do |recipe_class|
# This class matches the role, so we should run it
recipe = recipe_class.new([], options)
task = recipe_class.tasks[task_name.to_s]
recipe.invoke_task(task)
# Copy back and updated options
options = recipe.options
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tell(role_name, method_name, ...)\n if context == self || context.contains?(self)\n context.dispatch(role(role_name), method_name, ...)\n end\n end",
"def method_missing(meth_name, *args, &block)\n raise \"No method named: #{meth_name}\" unless recipe.respond_to? meth_name\n recipe.send(meth_name, *args, &block)\n end",
"def includes_recipe?(recipe)\n # todo expand roles?\n self.run_list.include?(\"#{recipe}\")\n end",
"def ingredient_by_role(role)\n element.ingredient_by_role(role)\n end",
"def run_list\n self.roles.collect { |role| \"role[#{role}]\" } +\n self.recipes.collect { |recipe| \"recipe[#{recipe}]\" }\n end",
"def for_roles *user_roles, &block\n user_roles = user_roles.flat_uniq\n yield if has_roles?(user_roles) && block\n end",
"def each_role(&block)\n unless block_given?\n return enum_for(:each_role, &block)\n end\n\n each_parent_object(Dependency) do |parent|\n yield(parent, parent.roles_of(self))\n end\n end",
"def current_user_has_role(role_ids_or_syms, &block)\r\n yield block if current_user_has_role?(role_ids_or_syms)\r\n end",
"def role(*roles, &block)\n RoleCondition.new(roles) do\n block.call\n end\n end",
"def find_all_for_role(role)\n roles = role.get_parents\n roles << role\n return find_for_role(roles.collect(&:id))\n end",
"def method_missing(method_id, *args)\n\t\tif match = matches_dynamic_role_check?(method_id)\n\t\t\ttokenize_roles(match.captures.first).each do |check|\n\t\t\t\troles.each do |role|\n\t\t\t\t\treturn true if role.name.downcase == check\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn false\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def method_missing(method, *args)\n begin\n @user.custom_roles.any? { |role| role.send(method.to_sym) }\n rescue NoMethodError\n super\n end\n end",
"def each(&block)\n retractions.each &block\n end",
"def find_by_role(role, single = true, &block)\n find_matching(:role, role, single, block)\n end",
"def accept_role role\n self.roles.push role\n end",
"def run_role(env_vars, extra_vars, role_name, roles_path:, role_skip_facts: true)\n run_via_cli(env_vars, extra_vars, :role_name => role_name, :roles_path => roles_path, :role_skip_facts => role_skip_facts)\n end",
"def recipe_classes_with_roles(roles)\n # Check to make sure some recipes have been added\n if ordered_recipes.size == 0\n raise Thor::InvocationError, 'no recipes have been defined'\n end\n if (roles.is_a?(Array) && roles.size == 0) || roles == :all\n # Use all classes\n role_classes = ordered_recipes\n else\n # Remove classes that don't fit the roles being used\n role_classes = ordered_recipes.reject do |recipe_class|\n ![roles].flatten.map(&:to_s).include?(recipe_class.class_role)\n end\n end \n end",
"def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end",
"def reuse_role_if_possible( name, &block )\n unless @roles.has_key?( name )\n @roles[ name ] = block.call()\n end\n @roles[ name ]\n end",
"def requires_role(role)\n yield if current_user && current_user.has_role?(role)\n end",
"def should_require_role(role, *args)\n args = Hash[*args]\n redirect_url = args.delete :redirect_url\n redirect_url ||= '/login'\n args.each do |action, verb|\n should \"require role for '#{action}' action\" do\n if [:put, :delete].include?(verb) # put and delete require an id even if it is a bogus one\n send(verb, action, :id => 1)\n else\n send(verb, action)\n end\n ensure_flash(/permission/i)\n assert_redirected_to(redirect_url)\n end\n end\n end",
"def recipe args=1\n self.summary.recipe args\n end",
"def role(*args)\n cap_role(*args)\n puppet_role(*args)\n end",
"def execute_items(items, scenario, &block)\n items.each {|item| execute_item(scenario, item, &block)}\n end",
"def method_missing(method_sym, *arguments, &block)\n eigenclass = class << self; self; end\n role = Role.find_by(name: method_sym.to_s.tr('?', ''))\n if role\n eigenclass.class_eval do\n define_method(method_sym) do\n role_id == role.id\n end\n end\n else\n super\n end\n send(method_sym)\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def recipes\n (@run_list.to_set - roles.to_set).to_a\n end",
"def method_missing(meth, *args, &block)\n if meth.to_s == \"to_ary\"\n raise NoMethodError\n end\n\n if args.empty? and rp = role_proxy(meth)\n rp\n elsif task = resolve_task(meth)\n task.run(self, *args, &block)\n else\n if args.last.kind_of? Hash\n opts = args.pop\n else\n opts = {}\n end\n str = ([meth] + args.map{|a| escape(a)}).join(' ')\n exec! str, opts, &block\n end\n end",
"def run_for_app_all_roles(*apps, &block)\n the_app = node[:zz][:app_name]\n the_role = node[:zz][:deploy_role]\n rails_env = node[:zz][:group_config][:rails_env]\n apps.each do |app|\n app_name = app.to_s\n if app_name == the_app\n block.call(the_app.to_sym, the_role.to_sym, rails_env.to_sym)\n end\n end\n end",
"def stub_role_methods(mock_user, roles)\n roles = [roles] unless roles.is_a?(Array)\n Role::ROLES.each do |role_token|\n role = role_token.to_s # allow a symbol to be passed - e.g., pretend_to_be_authenticated(:role => :admin)\n allow(mock_user).to receive(role.downcase+\"?\").and_return roles.include?(role)\n end\n return mock_user\nend"
] | [
"0.5542909",
"0.5435228",
"0.5433466",
"0.5427825",
"0.52657735",
"0.5257147",
"0.5225269",
"0.5148291",
"0.50860053",
"0.50795543",
"0.50388676",
"0.50357753",
"0.4998903",
"0.49958935",
"0.49937195",
"0.49792033",
"0.497508",
"0.4946387",
"0.4942964",
"0.4920764",
"0.49185535",
"0.49175465",
"0.49108756",
"0.4903949",
"0.49024844",
"0.48947963",
"0.48902184",
"0.4878343",
"0.48658624",
"0.4854183"
] | 0.61740804 | 0 |
GET /air_moistures GET /air_moistures.json | def index
@air_moistures = AirMoisture.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def index\n @soil_moistures = SoilMoisture.all\n end",
"def show\n render json: @air_quality\n end",
"def set_air_moisture\n @air_moisture = AirMoisture.find(params[:id])\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def index\n @airplanes = Airplane.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @airplanes }\n end\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def show\n @airlin = Airlin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @airlin }\n end\n end",
"def index\n airlines = Airline.includes(:airplanes).all.page(page).per(per)\n json_response(PageDecorator.decorate(airlines)\n .as_json(airplanes_details: true), :ok)\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def show\n json_response(@airline.decorate.as_json(airplanes_details: true), :ok)\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def show\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ami }\n end\n end",
"def show\n @air_crew = AirCrew.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @air_crew }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end",
"def show\n\n @anime = Finder.find_anime_by_id params[:id]\n @anime ||= KiWi.show_anime params[:id]\n\n # binding.pry\n\n render json: @anime\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index\n @airs = Air.all\n end",
"def index\n @magissues = Magissue.all\n @magazines = Magazine.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @magissues }\n end\n end"
] | [
"0.6477318",
"0.6322574",
"0.6238727",
"0.6140732",
"0.6136393",
"0.61150396",
"0.6083614",
"0.60437167",
"0.60434604",
"0.6033698",
"0.60279095",
"0.6005438",
"0.59941566",
"0.5992053",
"0.5980522",
"0.59371537",
"0.59309715",
"0.5927996",
"0.59212065",
"0.59185755",
"0.59071434",
"0.5899847",
"0.5873909",
"0.5867592",
"0.5846736",
"0.58411145",
"0.5831182",
"0.58149505",
"0.5806449",
"0.58040226"
] | 0.75258315 | 0 |
POST /air_moistures POST /air_moistures.json | def create
@air_moisture = AirMoisture.new(air_moisture_params)
respond_to do |format|
if @air_moisture.save
format.html { redirect_to @air_moisture, notice: 'Air moisture was successfully created.' }
format.json { render :show, status: :created, location: @air_moisture }
else
format.html { render :new }
format.json { render json: @air_moisture.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @air_moistures = AirMoisture.all\n end",
"def create\n @soil_moisture = SoilMoisture.new(soil_moisture_params)\n\n respond_to do |format|\n if @soil_moisture.save\n format.html { redirect_to @soil_moisture, notice: 'Soil moisture was successfully created.' }\n format.json { render :show, status: :created, location: @soil_moisture }\n else\n format.html { render :new }\n format.json { render json: @soil_moisture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_air_moisture\n @air_moisture = AirMoisture.find(params[:id])\n end",
"def create\n @air_quality = AirQuality.new(air_quality_params)\n\n if @air_quality.save\n render json: @air_quality, status: :created, location: @air_quality\n else\n render json: @air_quality.errors, status: :unprocessable_entity\n end\n end",
"def create\n @wi_mn_d_max_t_air = WiMnDMaxTAir.new(wi_mn_d_max_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_max_t_air.save\n format.html { redirect_to @wi_mn_d_max_t_air, notice: 'Wi mn d max t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_max_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_max_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ami = Ami.new(params[:ami])\n\n respond_to do |format|\n if @ami.save\n format.html { redirect_to @ami, notice: 'Ami was successfully created.' }\n format.json { render json: @ami, status: :created, location: @ami }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wi_mn_d_min_t_air = WiMnDMinTAir.new(wi_mn_d_min_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_min_t_air.save\n format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_min_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wi_mn_d_ave_t_air = WiMnDAveTAir.new(wi_mn_d_ave_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_ave_t_air.save\n format.html { redirect_to @wi_mn_d_ave_t_air, notice: 'Wi mn d ave t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_ave_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_ave_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @air = Air.new(air_params)\n @air.room_id = current_user.id\n respond_to do |format|\n if @air.save\n format.html { redirect_to @air, notice: 'Air was successfully created.' }\n format.json { render :show, status: :created, location: @air }\n else\n format.html { render :new }\n format.json { render json: @air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @moon = Moon.new(moon_params)\n\n respond_to do |format|\n if @moon.save\n format.html { redirect_to @moon, notice: 'Moon was successfully created.' }\n format.json { render :show, status: :created, location: @moon }\n else\n format.html { render :new }\n format.json { render json: @moon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def air_moisture_params\n params.require(:air_moisture).permit(:min, :max, :disease_id, :cf)\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\r\n @imobiliaria = Imobiliaria.new(imobiliaria_params)\r\n\r\n respond_to do |format|\r\n if @imobiliaria.save\r\n format.json { render json: @imobiliaria, status: :created }\r\n else \r\n format.json { render json: @imobiliaria.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @mile = Mile.new(mile_params)\n\n respond_to do |format|\n if @mile.save\n format.html { redirect_to @mile, notice: 'Mile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mile }\n else\n format.html { render action: 'new' }\n format.json { render json: @mile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @air_crew = AirCrew.new(params[:air_crew])\n\n respond_to do |format|\n if @air_crew.save\n format.html { redirect_to @air_crew, notice: 'Air crew was successfully created.' }\n format.json { render json: @air_crew, status: :created, location: @air_crew }\n else\n format.html { render action: \"new\" }\n format.json { render json: @air_crew.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iso = Iso.new(iso_params)\n\n respond_to do |format|\n if @iso.save\n format.html { redirect_to @iso, notice: 'Iso was successfully created.' }\n format.json { render action: 'show', status: :created, location: @iso }\n else\n format.html { render action: 'new' }\n format.json { render json: @iso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mi = Mi.new(params[:mi])\n\n respond_to do |format|\n if @mi.save\n format.html { redirect_to @mi, notice: 'Mi was successfully created.' }\n format.json { render json: @mi, status: :created, location: @mi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @airlin = Airlin.new(params[:airlin])\n\n respond_to do |format|\n if @airlin.save\n format.html { redirect_to @airlin, notice: 'Airlin was successfully created.' }\n format.json { render json: @airlin, status: :created, location: @airlin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @airlin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @airline = Airline.new(airline_params)\n\n if @airline.save\n json_response(@airline.decorate.as_json(airplanes_details: true),\n :created)\n else\n json_response(@airline.errors, :unprocessable_entity)\n end\n end",
"def create\n @moussaillon = Moussaillon.new(moussaillon_params)\n\n respond_to do |format|\n if @moussaillon.save\n format.html { redirect_to @moussaillon, notice: 'Moussaillon was successfully created.' }\n format.json { render :show, status: :created, location: @moussaillon }\n else\n format.html { render :new }\n format.json { render json: @moussaillon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @animai = Animai.new(animai_params)\n\n respond_to do |format|\n if @animai.save\n format.html { redirect_to @animai, notice: 'Animai was successfully created.' }\n format.json { render :show, status: :created, location: @animai }\n else\n format.html { render :new }\n format.json { render json: @animai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anime = Pusher.create_anime(params[:anime])\n\n if @anime.valid?\n render json: @anime, status: :created, location: @anime\n else\n render json: @anime.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @air_moisture.update(air_moisture_params)\n format.html { redirect_to @air_moisture, notice: 'Air moisture was successfully updated.' }\n format.json { render :show, status: :ok, location: @air_moisture }\n else\n format.html { render :edit }\n format.json { render json: @air_moisture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plate = Plate.new(params[:plate])\n\n if @plate.save\n render json: @plate, status: :created, location: @plate\n else\n render json: @plate.errors, status: :unprocessable_entity\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 @sky = Sky.new(sky_params)\n\n respond_to do |format|\n if @sky.save\n format.html { redirect_to @sky, notice: 'Sky was successfully created.' }\n format.json { render :show, status: :created, location: @sky }\n else\n format.html { render :new }\n format.json { render json: @sky.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @precious_metal = PreciousMetal.new(params[:precious_metal])\n\n respond_to do |format|\n if @precious_metal.save\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully created.' }\n format.json { render :json => @precious_metal, :status => :created, :location => @precious_metal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @precious_metal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @impressum = Impressum.new(impressum_params)\n\n respond_to do |format|\n if @impressum.save\n format.html { redirect_to @impressum, notice: 'Impressum was successfully created.' }\n format.json { render :show, status: :created, location: @impressum }\n else\n format.html { render :new }\n format.json { render json: @impressum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shot = Shot.new(shot_params)\n\n if @shot.save\n render json: @shot, status: :created, location: @shot\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def create\n @trail = Trail.new(params[:trail])\n respond_to do |format|\n if @trail.save\n\t@trail.lat_map = elevation(@trail.longitude_start, @trail.latitude_start, @trail.longitude_end, @trail.latitude_end)\n\t@trail.gmap = staticmap_uri(@trail.longitude_start + \",\" + @trail.latitude_start + \"|\"+ @trail.longitude_end + \",\" + @trail.latitude_end)\n\t@trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render json: @trail, status: :created, location: @trail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6157518",
"0.6023888",
"0.59428394",
"0.5910758",
"0.5841418",
"0.57893306",
"0.57763255",
"0.5775427",
"0.57316273",
"0.5690711",
"0.56655085",
"0.5650385",
"0.5640944",
"0.56387323",
"0.5595094",
"0.5562408",
"0.555145",
"0.55506915",
"0.5550431",
"0.553902",
"0.55364805",
"0.5507677",
"0.55039716",
"0.5490579",
"0.54795164",
"0.54348767",
"0.54265743",
"0.5419942",
"0.5414127",
"0.54045033"
] | 0.7118669 | 0 |