query
stringlengths 7
9.5k
| document
stringlengths 10
1.07M
| negatives
sequencelengths 19
19
| metadata
dict |
---|---|---|---|
GET /property_between_floor_slaps GET /property_between_floor_slaps.json | def index
@property_between_floor_slaps = PropertyBetweenFloorSlap.all
end | [
"def within_bounds\n min_latitude = Float(params[:sw_latitude])\n max_latitude = Float(params[:ne_latitude])\n min_longitude = Float(params[:sw_longitude])\n max_longitude = Float(params[:ne_longitude])\n limit = 1000 || params[:limit]\n offset = 0 || params[:offset]\n approved = true || params[:approved]\n @trailheads = Trailhead.where(\"latitude > :min_latitude AND latitude < :max_latitude AND longitude > :min_longitude AND longitude < :max_longitude\",\n :min_latitude => min_latitude, :min_longitude => min_longitude, :max_latitude => max_latitude, :max_longitude => max_longitude).limit(limit).offset(offset).approved\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trailheads }\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 property_rooms\n self.dig_for_array(\"propertyRooms\")\n end",
"def rangeSights\n sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: sightings\n end",
"def floor_rooms\n\t\t@rooms[floor_no]\n\tend",
"def list_floorplans_for_building(args = {}) \n get(\"/floorplans.json/#{args[:buildingId]}/floors\", args)\nend",
"def index\n @floor_plans = @location.floor_plans\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 show\n up = bound_params[:uplat]\n down = bound_params[:downlat]\n left = bound_params[:leftlong]\n right = bound_params[:rightlong]\n markers = Marker.find_all_within_bounds(up, down, left, right)\n render :json => markers\n end",
"def energy_level_intervals\n result = {}\n @location = Location.find(params[:location_id])\n start_date = params[:start_date] ? Date.parse(params[:start_date]) : Date.today\n end_date = params[:end_date] ? Date.parse(params[:end_date]) : Date.today\n\n (start_date..end_date).each do |date|\n result[date] = @location.energy_level_intervals(date)\n end\n\n render :json => result\n end",
"def simple_tiles_bounds(options)\n [options[:bounds][:east],\n options[:bounds][:north],\n options[:bounds][:west],\n options[:bounds][:south]]\n end",
"def get_floor_area\n return @total_floor_area\n end",
"def index\n @property_land_shapes = PropertyLandShape.all\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 get_geo\n schools = School.within(2, :origin => [params[:lat], params[:lng]])\n\n @close_schools = []\n schools.each do |school|\n if school.lat != nil\n @close_schools << school\n end\n end\n respond_to do |format|\n format.json\n end\n end",
"def show\n @overlap = Overlap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @overlap }\n end\n end",
"def range\n @data_from_selected_sensor = SensorDatum.where(:sensor_id => params[:sensor_id])\n if params[:start] && params[:end]\n @start_time = Time.parse(params[:start])\n @end_time = Time.parse(params[:end])\n @sensor_datum = @data_from_selected_sensor.where(:created_at => @start_time..@end_time)\n\n elsif params[:start]\n @start_time = Time.parse(params[:start])\n @sensor_datum = @data_from_selected_sensor.where(:created_at => @start_time..Time.now)\n else\n @sensor_datum = { error: 'Please provide a valid date range'}\n end\n json_response(@sensor_datum)\n end",
"def get_contained_agencies(lat, lon)\n agencies = []\n\n AgencyBound.all.each do |bound|\n if lat.between?(bound.lat_min, bound.lat_max) and lon.between?(bound.lon_min, bound.lon_max)\n agencies.push(bound.agency)\n end\n end\n\n return agencies\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def index\n @property_between_floor_slaps = PropertyBetweenFloorSlap.all\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 @building = Building.new(building_params)\n @building.building_levels.build(building_params[:building_levels_attributes]) if params[:floor]\n render json: @building.errors unless @building.save\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 create\n @overlap = Overlap.new(params[:overlap])\n\n respond_to do |format|\n if @overlap.save\n format.html { redirect_to @overlap, notice: 'Overlap was successfully created.' }\n format.json { render json: @overlap, status: :created, location: @overlap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @overlap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def within_bounds\n min_latitude = Float(params[:sw_latitude])\n max_latitude = Float(params[:ne_latitude])\n min_longitude = Float(params[:sw_longitude])\n max_longitude = Float(params[:ne_longitude])\n limit = 1000 || params[:limit]\n offset = 0 || params[:offset]\n approved = true || params[:approved]\n @trailheads = Trailhead.where(\"latitude > :min_latitude AND latitude < :max_latitude AND longitude > :min_longitude AND longitude < :max_longitude\",\n :min_latitude => min_latitude, :min_longitude => min_longitude, :max_latitude => max_latitude, :max_longitude => max_longitude).limit(limit).offset(offset).approved\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trailheads }\n end\n end",
"def create\n @overlap_holding = OverlapHolding.new(overlap_holding_params)\n\n respond_to do |format|\n if @overlap_holding.save\n format.html { redirect_to @overlap_holding, notice: 'Overlap holding was successfully created.' }\n format.json { render :show, status: :created, location: @overlap_holding }\n else\n format.html { render :new }\n format.json { render json: @overlap_holding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property_land_shape = PropertyLandShape.new(property_land_shape_params)\n\n respond_to do |format|\n if @property_land_shape.save\n format.html { redirect_to @property_land_shape, notice: 'Property land shape was successfully created.' }\n format.json { render :show, status: :created, location: @property_land_shape }\n else\n format.html { render :new }\n format.json { render json: @property_land_shape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property_road = PropertyRoad.new(property_road_params)\n\n respond_to do |format|\n if @property_road.save\n format.html { redirect_to @property_road, notice: 'Property road was successfully created.' }\n format.json { render :show, status: :created, location: @property_road }\n else\n format.html { render :new }\n format.json { render json: @property_road.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 new_range\n @job = Job.find(params[:id])\n @range = TicketRange.new(:from => params[:from], :to => params[:to])\n \n @all_ranges = TicketRange.all\n @overlapping_id = 0\n \n @all_ranges.each do |i|\n if i.from <= @range.to && @range.to <= i.to\n @overlapping_id = i.job_id\n break;\n end\n if i.from <= @range.from && @range.from <= i.to\n @overlapping_id = i.job_id\n break;\n end\n if i.to <= @range.to && i.from >= @range.from\n @overlapping_id = i.job_id\n break;\n end\n end\n \n if @overlapping_id == 0\n @range.save\n @job.ticket_ranges.push(@range)\n render :text => @job.ticket_ranges.last.id\n else\n render :status => 306, :text => Job.find(@overlapping_id).name\n end\n end",
"def rangeSights\n sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: sightings\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 floor_rooms\n\t\t@rooms[floor_no]\n\tend",
"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 create\n @floor_monster = FloorMonster.new(params[:floor_monster])\n\n if (@floor_monster.position<1)\n @floor_monster.position = 1\n end\n @floor = Floor.where(id: @floor_monster.floor_id).first\n if (@floor_monster.position>@floor.size)\n @floor_monster.position = @floor.size\n end\n @floor_monster.save\n\n respond_to do |format|\n if @floor_monster.save\n format.html { redirect_to @floor_monster, notice: 'Floor monster was successfully created.' }\n format.json { render json: @floor_monster, status: :created, location: @floor_monster }\n else\n format.html { render action: \"new\" }\n format.json { render json: @floor_monster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ranges covered: true, street: nil\n grouped_lines.each do |city, streets|\n streets.each do |street, range_str|\n streets[ street ] = create_range( range_str, street, covered)\n end\n end\n end",
"def create\n @data_source_overlaps = DataSourceOverlaps.new(params[:data_source_overlaps])\n\n respond_to do |format|\n if @data_source_overlaps.save\n flash[:notice] = 'DataSourceOverlaps was successfully created.'\n format.html { redirect_to(@data_source_overlaps) }\n format.xml { render :xml => @data_source_overlaps, :status => :created, :location => @data_source_overlaps }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @data_source_overlaps.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_laps(race_id, data_file, lap_meter, km_race, tot_race_time_sec, insert_last_partial)\n fname = File.join(File.dirname(__FILE__), data_file)\n lap_nr = 1\n tot_meter = 0\n tot_time_sec = 0\n @items = []\n File.open(fname, 'r').each_line do |line|\n arr_laps_str = line.split(\" \")\n arr_laps_str.each do |value_s|\n #p value_s\n t1 = Time.parse(value_s)\n #p t1.methods\n lap_sec = t1.hour * 3600 + t1.min * 60 + t1.sec\n tot_time_sec += lap_sec\n tot_meter = lap_meter * lap_nr \n item = RaceDetailItem.new\n item.lap_number = lap_nr\n item.lap_time = value_s\n item.lap_meter = lap_meter\n item.lap_pace_minkm = calc_pace_in_min_sec(lap_meter, lap_sec) \n item.tot_meter_race = tot_meter\n item.tot_race_minkm = calc_pace_in_min_sec(tot_meter, tot_time_sec) \n item.race_id = race_id\n item.tot_race_time = format_seconds(tot_time_sec)\n item.tot_km_race = tot_meter / 1000\n item.completed = true\n #p item\n @items << item\n lap_nr += 1\n #exit if lap_nr == 9\n end\n #p line\n end\n @log.debug \"Collected #{@items.size} laps. Completed laps km #{@items.last.tot_km_race} in #{@items.last.tot_race_time} \"\n\n # last lap is not completed but it is the difference between total km and the last completed sum\n if insert_last_partial\n t1 = Time.parse(@items.last.tot_race_time)\n completed_lap_sec = t1.hour * 3600 + t1.min * 60 + t1.sec\n lap_sec = tot_race_time_sec - completed_lap_sec\n item = RaceDetailItem.new\n item.lap_number = lap_nr\n item.lap_time = format_seconds(lap_sec)\n item.lap_meter = km_race * 1000 - @items.last.tot_km_race * 1000\n item.lap_pace_minkm = calc_pace_in_min_sec(item.lap_meter, lap_sec) \n item.tot_meter_race = km_race * 1000\n item.tot_race_minkm = calc_pace_in_min_sec(km_race * 1000, tot_race_time_sec) \n item.race_id = race_id\n item.tot_race_time = format_seconds(tot_race_time_sec)\n item.tot_km_race = km_race\n item.completed = false\n #p item\n @items << item\n end\n \n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def update\n respond_to do |format|\n if @property_land_shape.update(property_land_shape_params)\n format.html { redirect_to @property_land_shape, notice: 'Property land shape was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_land_shape }\n else\n format.html { render :edit }\n format.json { render json: @property_land_shape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property_road.update(property_road_params)\n format.html { redirect_to @property_road, notice: 'Property road was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_road }\n else\n format.html { render :edit }\n format.json { render json: @property_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: @building_level.errors unless @building_level.update(building_level_params)\n end",
"def save_floorplan_settings(args = {}) \n put(\"/userproperties.json/floorplan/#{args[:floorplanId]}\", args)\nend",
"def update\n respond_to do |format|\n if @floor_geometry.update(floor_geometry_params)\n format.html { redirect_to @floor_geometry, notice: 'Floor geometry was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_geometry }\n else\n format.html { render :edit }\n format.json { render json: @floor_geometry.errors, status: :unprocessable_entity }\n end\n end\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 @overlap = Overlap.find(params[:id])\n\n respond_to do |format|\n if @overlap.update_attributes(params[:overlap])\n format.html { redirect_to @overlap, notice: 'Overlap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @overlap.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 @building = Building.find(params[:building_id])\n @floor = @building.floors.find(params[:id])\n authorize! :update, @floor, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to([@university, @campus, @building, @floor], :notice => 'El piso fue modificado con éxito') }\n format.json { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @floor.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @floor_plan.update_attributes(floor_plan_params)\n format.html { redirect_to admin_property_floor_plan_url(@property, @floor_plan), 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_rooms\n @property = Property.find(params[:id])\n if @property.belongs_to_user(session[:user_id])\n @room_areas = @property.room_areas\n for room_area in @property.room_areas\n room_area.update_attributes(params[room_area.id.to_s])\n end\n else\n redirect_to :action => 'list'\n end\n redirect_to(:action => 'fittings', :id => params[:id])\n end",
"def update\n respond_to do |format|\n if @property_street_location.update(property_street_location_params)\n format.html { redirect_to @property_street_location, notice: 'Property street location was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_street_location }\n else\n format.html { render :edit }\n format.json { render json: @property_street_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @overlap_holding.update(overlap_holding_params)\n format.html { redirect_to @overlap_holding, notice: 'Overlap holding was successfully updated.' }\n format.json { render :show, status: :ok, location: @overlap_holding }\n else\n format.html { render :edit }\n format.json { render json: @overlap_holding.errors, status: :unprocessable_entity }\n end\n end\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 @floorplan.update(floorplan_params)\n format.html { redirect_to @floorplan, notice: 'floorplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floorplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spec_property = SpecProperty.find(params[:id])\n\n respond_to do |format|\n if @spec_property.update_attributes(params[:spec_property])\n format.html { redirect_to spec_properties_url, notice: '自定义规格已更新成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spec_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 @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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def destroy\n @property_road.destroy\n respond_to do |format|\n format.html { redirect_to property_roads_url, notice: 'Property road was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"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_plan.destroy\n render json: @floor_plan\n end",
"def destroy\n @property_land_shape.destroy\n respond_to do |format|\n format.html { redirect_to property_land_shapes_url, notice: 'Property land shape was successfully destroyed.' }\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 @floor_status.destroy\n respond_to do |format|\n format.html { redirect_to floor_statuses_url, notice: 'Status was successfully destroyed.' }\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 @floor_geometry.destroy\n respond_to do |format|\n format.html { redirect_to floor_geometries_url, notice: 'Floor geometry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_street_location.destroy\n respond_to do |format|\n format.html { redirect_to property_street_locations_url, notice: 'Property street location was successfully destroyed.' }\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 @property_sidewalk.destroy\n respond_to do |format|\n format.html { redirect_to property_sidewalks_url, notice: 'Property sidewalk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_level.destroy\n respond_to do |format|\n format.html { redirect_to location_levels_url }\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 @leased_property = LeasedProperty.find(params[:id])\n @leased_property.destroy\n\n respond_to do |format|\n format.html { redirect_to leased_properties_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @overlap_holding.destroy\n respond_to do |format|\n format.html { redirect_to overlap_holdings_url, notice: 'Overlap holding 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\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :ok }\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def remove_webhook\n request(URL::WEBHOOK, url: '')\n end",
"def delete_webhook\n send_request('deleteWebhook', {})\n end",
"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 web_hook_unsubscribe(web_hook_subscribe_model)\n if web_hook_subscribe_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('web_hook_subscribe_model')\n end\n\n query_parameters = {}\n query_parameters['apikey'] = @api_key\n query_parameters['apisecret'] = @api_secret\n\n resource_path = 'api/v2/webhook'\n delete_request(resource_path, query_parameters, web_hook_subscribe_model)\n end",
"def unregister\n Neo4j.event_handler.remove(self)\n end",
"def unsubscribe_response_hook(name)\n EasyPost::Hooks.unsubscribe(:response, name)\n end",
"def destroy\n @webhook_event_request.destroy\n respond_to do |format|\n format.html { redirect_to webhook_event_requests_url }\n format.json { head :no_content }\n end\n end",
"def remove_all_webhooks\n delete(\"/webhooks\")\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 remove_hipchat_webhooks hipchat, room_name, webhook_name\n hipchat.delete_webhooks_by_name room_name, webhook_name\nend",
"def destroy\n @incoming_hook.destroy\n respond_to do |format|\n format.html { redirect_to incoming_hooks_url, notice: 'Incoming hook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def handle_unregistered(data)\n request_id = data\n\n trigger(:unregistered, request_id)\n end",
"def delete\n require \"pact_broker/webhooks/triggered_webhook\"\n TriggeredWebhook.where(webhook: self).update(webhook_id: nil)\n super\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(username)\n data = \"unregister #{username} #{@host}\"\n response data\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def create_webhook(webhook_id, request)\n start.uri('/api/webhook')\n .url_segment(webhook_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def create_webhook(webhook_id, request)\n start.uri('/api/webhook')\n .url_segment(webhook_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def add_webhook\n get_api\n resp = {}\n begin\n resp = @api.lists(api_id).webhooks.create(\n body: {\n url: Rails.application.routes.url_helpers.webhooks_api_v0_mailchimp_list_url(\n id, \n only_path: false, \n host: APP_CONFIG[\"mailing-url\"].gsub(\"http://\",\"\")\n ),\n events: decode(webhook_configuration)[\"events\"],\n sources: decode(webhook_configuration)[\"sources\"]\n }\n ).body\n rescue Gibbon::MailChimpError => e\n Rails.logger.info \"Mailchimp webhook failed with error: #{e}\"\n resp = { \"id\" => nil, errors: get_errors(e.body) }\n end\n\n if resp[\"id\"].nil?\n self.errors.add(:base, resp[:errors])\n else\n new_config = decode(webhook_configuration)\n new_config[:id] = resp[\"id\"]\n update_attribute(:webhook_configuration, encode(new_config))\n update_attribute(:receive_notifications, true)\n end\n end",
"def sinatra_hook\n @webhook || Proc.new {}\n end",
"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 create\n @webhook = @namespace.webhooks.build(webhook_params)\n authorize @webhook\n\n if @webhook.save\n @webhook.create_activity :create, owner: current_user\n respond_with @namespace, @webhook\n else\n respond_with @webhook.errors, status: :unprocessable_entity\n end\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 setup_shopify_webhook(topic, meth)\n unless ShopifyAPI::Webhook.count(topic: topic) > 0\n address = send :webhook_url, meth\n ShopifyAPI::Webhook.create topic: topic, address: address, format: 'json'\n end\n end",
"def create_webhook\n @client.create_hook(\"#{repo.user.github_username}/#{repo.name}\",\n 'web',\n {url: \"#{ENV['ISSUE_TRACKR_APP_URL']}/webhooks/receive\", content_type: 'json'},\n {events: ['issues'], active: true})\n end",
"def new_webhook()\n Webhook.new(self)\n end",
"def webhook\n puts params\n\n status 200\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 webhook\n @webhook ||= Plaid::Webhook.new(@client)\n end",
"def set_webhook(url)\n send_request('setWebhook', {\"url\":url})\n end",
"def create(addon_id_or_addon_name, body = {})\n @client.addon_webhook.create(addon_id_or_addon_name, body)\n end",
"def setup_shopify_webhooks\n setup_shopify_webhook 'orders/create', :new_order\n setup_shopify_webhook 'carts/create', :new_cart\n setup_shopify_webhook 'carts/update', :updated_cart\n setup_shopify_webhook 'app/uninstalled', :app_uninstalled\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def refresh_feed(feed)\n FeedRefreshManager.refresh feed, self\n end",
"def update!\n data = fx_feed.get\n data = remove_cached_records(data)\n data.each(&:save)\n end",
"def refresh!\n fetch_data\n end",
"def refresh\n raise \"Source classes must implement their own `refresh` method\"\n end",
"def refresh(all)\n Gem.sources.each do |source_uri|\n cache_entry = cache_data[source_uri]\n if cache_entry.nil? then\n cache_entry = Gem::SourceInfoCacheEntry.new nil, 0\n cache_data[source_uri] = cache_entry\n end\n\n update if cache_entry.refresh source_uri, all\n end\n\n flush\n end",
"def refresh\n\n @err_report = []\n\n puts '@dx.to_xml' + @dx.to_xml(pretty: true) if @debug\n\n @dx.all.each do |feed|\n\n puts 'feed:' + feed.inspect if @debug\n\n if feed.next_refresh.empty? or \\\n Time.now >= Time.parse(feed.next_refresh) then\n\n any_new_items = updates? feed\n\n feed.refresh_rate = if feed.refresh_rate.empty? then\n\n 10\n\n else\n\n if Time.now > Time.parse(feed.next_refresh) + \\\n feed.refresh_rate.to_i and not any_new_items then\n feed.refresh_rate.to_i + 10\n end\n\n end\n\n\n feed.next_refresh = Time.now + feed.refresh_rate.to_i * 60\n\n\n else\n\n feed.refresh_rate = feed.refresh_rate.to_i - 10 if feed.refresh_rate.to_i > 10\n\n end\n end\n\n puts '@dx: ' + @dx.to_xml(pretty: true) if @debug\n save()\n\n end",
"def refresh\n Gem.sources.each do |source_uri|\n cache_entry = cache_data[source_uri]\n if cache_entry.nil? then\n cache_entry = Gem::SourceInfoCacheEntry.new nil, 0\n cache_data[source_uri] = cache_entry\n end\n\n update if cache_entry.refresh source_uri\n end\n\n flush\n end",
"def pull_refresh(refresh = true)\n refresh(@endpoint) do |data|\n @stories = data\n view.reloadData\n @refreshControl.endRefreshing\n end\n end",
"def run\n @logging.debug 'Starting polling'\n @polling = true\n\n while @polling\n pending_feeds = Feed.all.select &:pending_refresh?\n\n pending_feeds.each do |feed|\n @logging.debug \"Requesting `#{feed.url}'\"\n\n update_feed feed\n end\n\n sleep 1\n end\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 get_feed\n if has_a_new_version?\n store_etag_and_last_modified_on\n get_uncached_feed\n end\n end",
"def feed_items\n return @feed_items.dup\n end",
"def refresh\n do_refresh\n end",
"def refresh!\n current_time = Time.current\n self.refresh_started_at = current_time\n self.next_refresh_at = current_time.advance(seconds: refresh_every)\n save\n\n if FeedRefresher.refresh(self)\n self.last_refreshed_at = current_time\n end\n\n self.refresh_started_at = nil\n save\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 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 refresh\n mirror_list.refresh\n end",
"def refresh \n @result, @processedMovies, @errors = Movie.refresh_listings\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store page title options that are used on I18n interpolation. | def page_title_options
@page_title_options ||= {}
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 page_title title, options = {}\n if defined? set_meta_tags\n set_meta_tags site: t('app.name'), title: title, reverse: true\n end\n content_for(:page_title) { title } if options[:in_page]\n content_for(:head_title) { title }\n end",
"def set_page_title\n set_ivar_on_view \"@page_title\", title\n end",
"def set_meta_title(options = {})\n\t\t@meta[:title_raw] = I18n.translate(\"#{meta_key}.title\", options)\n\n\t\tif have_translation?(@meta[:title_raw])\n\t\t\t@meta[:title] = \"#{@meta[:prefix]}#{@meta[:title_raw]}#{@meta[:suffix]}\"\n\t\telse\n\t\t\t@meta[:title] = I18n.translate(\"#{meta_key}.full_title\", options)\n\t\t\t@meta[:title] = I18n.translate('meta.default.title') if !have_translation?(@meta[:title])\n\n\t\t\t@meta[:title_raw] = @meta[:title]\n\t\tend\n\t\t\n\t\t@meta[:title]\n\tend",
"def set_page_title\n set_ivar_on_view \"@page_title\", title\n end",
"def title\n options.fetch(:title)\n end",
"def page_title=(val)\n @page_title = val\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(options = {})\n return \"\" if @page.title.blank?\n options = {\n prefix: \"\",\n suffix: \"\",\n separator: \"\"\n }.update(options)\n title_parts = [options[:prefix]]\n if response.status == 200\n title_parts << @page.title\n else\n title_parts << response.status\n end\n title_parts << options[:suffix]\n title_parts.reject(&:blank?).join(options[:separator]).html_safe\n end",
"def page_title\n @page_title ||= begin\n aliases = {\n \"create\" => \"new\",\n \"update\" => \"edit\",\n \"remove\" => \"destroy\"\n }\n\n # the controller is self when calling from controller instance\n controller = self unless respond_to?(:controller)\n\n controller_name = controller.controller_name\n action_name = controller.action_name\n action_name_alias = aliases[action_name] || action_name\n options = (@page_title_options || {}).merge(:raise => true)\n\n # First, let's check if there's a action title without the alias\n title = I18n.translate(\"titles.#{controller_name}.#{action_name}\", options) rescue nil\n\n # Then we lookup for the aliased title\n title ||= I18n.translate(\"titles.#{controller_name}.#{action_name_alias}\", options) rescue nil\n\n # Finally we set it as titleized\n title ||= \"#{controller_name.titleize} #{action_name.titleize}\"\n\n title\n end\n end",
"def set_page_title(title)\n @page_title = title\n end",
"def page_title=(title)\n @content_for_page_title = title\n end",
"def title(title, global=true)\n global ? (before << \"Backend.app.setTitle(#{title.to_json});\") : config[:title] = title\n end",
"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 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\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_description\n else\n page_title || site_title\n end\n end\n end",
"def set_page_title\n case @title\n when 'Winter', 'Spring', 'Summer', 'Fall'\n parent_content = Content.new(@parent_path)\n @page_title = @title + ' ' + parent_content.title\n else\n @page_title = @title\n end\n end",
"def title(page_title)\n # Only set the content_for if not already set on the page so that only the first title appears as the tab title\n content_for(:page_title) { page_title } if content_for(:page_title).blank?\n page_title\n end",
"def title(page_title, options={})\n content_for(:title, page_title.to_s)\n return content_tag(:h1, page_title, options)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Override in the subclass to provide a place to do initialization of game logic, load files, set up state, etc | def game_setup
end | [
"def initialize\n\t\tinitialize_game\n\tend",
"def initialize_game\n setup_boards\n end",
"def process_init\n end",
"def post_init\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 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 init_game\n return if state.tick_count != 0\n\n state.current_scene = :start\n\n state.red_color = { r: 222, g: 63, b: 66 }\n state.gray_color = { r: 128, g: 128, b: 128 }\n\n state.events ||= {\n game_over_at: nil,\n game_started_at: nil,\n game_retried_at: nil\n }\n\n state.score_last_game = 0\n state.best_score = 0\n state.viewport = { x: 0, y: 0, w: 1280, h: 720 }\n end",
"def initialize(*saved_info)\n\t\tif saved_info.empty?\n\t\t\tnew_game\n\t\telse\n\t\t\tload_game(saved_info)\n\t\tend\n\tend",
"def preReady()\n\t\t\t#does nothing. extend in subclasses\n\t\tend",
"def initialize\n # Call subclass on_init method if applicable.\n self.on_init if self.respond_to? :on_init\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_name_class = 'CoreGameMariazza'\r\n @log = Log4r::Logger.new(\"coregame_log::MariazzaGfx\") \r\n \r\n init_command_buttons\r\n end",
"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",
"def initialize\n\n @prompt = TTY::Prompt.new\n escape_to_welcome\n LoadAssets.load_logo\n\n end",
"def initialize(window, relative_position)\n @relative_position = relative_position\n @image = Gosu::Image.new(window, \"./media/Player.png\")\n super @image.width, @image.height, Gosu::Color::NONE, relative_position\n @speed = [0.0, 0.0].to_vec2d\n @stop_down = false\n @jump_speed = [0.0, 0.0].to_vec2d\n @health = 1.0\n @score = 0\n end",
"def initialize(zone = nil)\n # Type of viewport the spriteset map uses\n viewport_type = :main\n exec_hooks(Spriteset_Map, :viewport_type, binding)\n init_viewports(viewport_type)\n Yuki::ElapsedTime.start(:spriteset_map)\n exec_hooks(Spriteset_Map, :initialize, binding)\n init_tilemap\n init_panorama_fog\n init_characters\n init_player\n init_weather_picture_timer\n finish_init(zone)\n rescue ForceReturn => e\n log_error(\"Hooks tried to return #{e.data} in Spriteset_Map#initialize\")\n end",
"def setup_game\n\t\t@game_board = Board.new\n\t\t@game_engine = GameEngine.new(@game_board)\n\t\tupdate_ui\n\tend",
"def initialize(options = {})\n options = default_options.merge(options)\n require_keys!(options, [:engine_path, :movetime])\n @movetime = options[:movetime]\n\n set_debug(options)\n reset_board!\n set_startpos!\n\n check_engine(options)\n set_engine_name(options)\n open_engine_connection(options[:engine_path])\n set_engine_options(options[:options]) if !options[:options].nil?\n new_game!\n end",
"def initialize\n # Do some setup stuff\nend",
"def initialize(player, coregame, cup_gui)\r\n super\r\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def game_setup\n end",
"def setup_game\n\t\t@game_board = Board.new\n\t\t@game_engine = GameEngine.new(@game_board)\n\t\tupdate_ui\n\tend",
"def setup_new_game\n Game.new.play\n end",
"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 run\n start_game\n game_loop\n end_game\n end",
"def start_game\n\n # Dev server interaction\n # FIXME: Shift this to 'login to server' interaction\n # \n @client_network_com.send_message(['setup', @game_state_model::players[@game_state_model::player_role]::name, @game_state_model::players[@game_state_model::player_role].player_color].join('|'))\n @controllers[:game]::view::grid.set_tiles\n initialize(568, 343, model: @game_state_model)\n @currentCtrl = @controllers[:game]\n\n end",
"def start\n GAME.play\n render_all\n end",
"def run_cycle\n\t\t\t\tsuper()\n\t\t\t\t\n\t\t\t\t#puts 'UIApp->run_cycle'\n\t\t\t\t\n\t\t\t\trender\n\t\t\tend",
"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 play\n board_setup\n gameplay_setup\n end",
"def start(*args)\n self.setup\n self.show_all(*args)\n Nyle.main\n end",
"def setup\n self.caption = \"RubyMiner v 0.1\"\n push_game_state(Menu)\n end",
"def start_found_game\n listen_for_challenge\n game_on\n run_game\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 main\n data_load\n title_animation unless debug? && (ARGV.include?('skip_title') || PSDK_CONFIG.skip_title_in_debug)\n if $scene == self\n Yuki::MapLinker.reset\n GamePlay::Load.new(#> Suppression de sauvegarde : X+B+Haut\n Input.press?(:X) &\n Input.press?(:B) &\n Input.press?(:UP)).main\n end\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 setup_and_teardown\n begin\n MenuMethods.setup_screen\n render_greenhouse\n yield\n ensure\n MenuMethods.teardown_screen\n puts \"#{SproutSimulator::Plants::PlantAsciiArt3}\\n\\n\\t\\tGame Over\\n\"\n end\n end_game_condition!\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the chat property value. The chat between the user and Teams app. | def chat
return @chat
end | [
"def chat_info\n return @chat_info\n end",
"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_type\n return @chat_type\n end",
"def meeting_chat_id\n return @meeting_chat_id\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_info=(value)\n @chat_info = value\n end",
"def chat_id=(value)\n @chat_id = value\n end",
"def enable_chat\n @meeting['enableOptions']['chat']\n end",
"def meeting_chat_id=(value)\n @meeting_chat_id = value\n end",
"def meeting_chat_enabled\n return @meeting_chat_enabled\n end",
"def chat_type=(value)\n @chat_type = value\n end",
"def conversation_member_user\n return @conversation_member_user\n end",
"def set_chat(chat)\n @msg.chat = chat if @msg\n end",
"def conversation_id\n return @conversation_id\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the chat property value. The chat between the user and Teams app. | def chat=(value)
@chat = value
end | [
"def set_chat(chat)\n @msg.chat = chat if @msg\n end",
"def chat_info=(value)\n @chat_info = value\n end",
"def chat_info=(value)\n @chat_info = value\n end",
"def chat_id=(value)\n @chat_id = value\n end",
"def chat_type=(value)\n @chat_type = value\n end",
"def allow_meeting_chat=(value)\n @allow_meeting_chat = value\n end",
"def meeting_chat_enabled=(value)\n @meeting_chat_enabled = value\n end",
"def meeting_chat_id=(value)\n @meeting_chat_id = value\n end",
"def has_chatter=(value)\n @has_chatter = value\n end",
"def chat\n @_chat || payload && payload['chat']\n end",
"def enable_chat\n @meeting['enableOptions']['chat']\n end",
"def cmd_shellegram_set_chat_id(*args)\r\n\t\t\t\tif args.length > 0\r\n\t\t\t\t\tprint_status(\"Setting the chat_id Telegram to #{args[0]}\")\r\n\t\t\t\t\t@chat_id = args[0]\r\n\t\t\t\telse\r\n\t\t\t\t\tprint_error(\"Please provide a value\")\r\n\t\t\t\tend\r\n\t\t\tend",
"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 chats=(value)\n @chats = value\n end",
"def sent_to_me=(value)\n @sent_to_me = value\n end",
"def hipchat=(arg)\n raise ArgumentError, \"hipchat expected a string, not a #{arg.class}\" unless arg.is_a?(String)\n @hipchat = arg\n end",
"def chat_display_name=(value)\n @chat_display_name = value\n end",
"def set_modchat(level)\n send \"/modchat #{level}\"\n end",
"def chat\n return @chat\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiates a new userScopeTeamsAppInstallation and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.userScopeTeamsAppInstallation"
end | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.teamworkApplicationIdentity\"\n end",
"def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.teamworkUserIdentity\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.educationTeamsAppResource\"\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 setup_lti_users\n setup_application_instance\n @student = FactoryBot.create(:user)\n @student.confirm\n @student_token = AuthToken.issue_token(\n {\n application_instance_id: @application_instance.id,\n user_id: @student.id,\n context_id: @lms_course_id,\n lti_roles: [\"urn:lti:role:ims/lis/Learner\"],\n lms_course_id: @lms_course_id,\n },\n )\n\n @instructor = FactoryBot.create(:user)\n @instructor.confirm\n @instructor_token = AuthToken.issue_token(\n {\n application_instance_id: @application_instance.id,\n user_id: @instructor.id,\n context_id: @lms_course_id,\n lti_roles: [\"urn:lti:role:ims/lis/Instructor\"],\n lms_course_id: @lms_course_id,\n },\n )\n\n @admin = FactoryBot.create(:user)\n @admin.confirm\n @admin.add_to_role(\"administrator\")\n @admin_token = AuthToken.issue_token(\n {\n application_instance_id: @application_instance.id,\n user_id: @admin.id,\n context_id: @lms_course_id,\n lti_roles: [\"urn:lti:role:ims/lis/Administrator\"],\n lms_course_id: @lms_course_id,\n },\n )\nend",
"def teams_app=(value)\n @teams_app = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsAppXAppAssignmentSettings\"\n end",
"def initialize(username, token, organization, flows)\n @username, @token, @organization, @flows = username, token, organization, flows\n puts \"##\"\n puts \"## Starting #{@username} @ #{@organization}\"\n puts \"##\"\n end",
"def create_app_installation_access_token(installation, options = T.unsafe(nil)); end",
"def teams_app_definition=(value)\n @teams_app_definition = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.teamworkConversationIdentity\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.iosVppAppAssignmentSettings\"\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 teams_app_settings=(value)\n @teams_app_settings = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.skypeUserConversationMember\"\n end",
"def create(body = {})\n @client.team_app.create(body)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windows10TeamGeneralConfiguration\"\n end",
"def setup_user_applications\n @user = User.find_by(email: 'state1_epi@example.com')\n # Make sure API access is enabled for this user.\n @user.update!(api_enabled: true)\n\n # Create OAuth applications\n @user_patient_read_write_app = OauthApplication.create(\n name: 'user-test-patient-rw',\n redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',\n scopes: 'user/Patient.*'\n )\n\n # Create OAuth applications\n @user_everything_app = OauthApplication.create(\n name: 'user-test-patient-rw',\n redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',\n scopes: 'user/Patient.* user/QuestionnaireResponse.read user/Observation.read user/RelatedPerson.* user/Immunization.*'\n )\n\n # Create access tokens\n @user_patient_token_rw = Doorkeeper::AccessToken.create(\n resource_owner_id: @user.id,\n application_id: @user_patient_read_write_app.id,\n scopes: 'user/Patient.*'\n )\n\n # Create access tokens\n @user_everything_token = Doorkeeper::AccessToken.create(\n resource_owner_id: @user.id,\n application_id: @user_everything_app.id,\n scopes: 'user/Patient.* user/QuestionnaireResponse.read user/Observation.read user/RelatedPerson.* user/Immunization.*'\n )\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def nearby_projects(projects,latitude,longitude)\n @projects_seventy_five = @matched_projects\n # to remove duplicates from array\n @projects_fifty = @projects_seventy_five - @projects_fifty\n @seventy_five = false\n @hundred = false\n matched_projects = projects.near([latitude, longitude], 50, units: :km) # within 50 kilometres of user address\n if matched_projects.size > 0\n @matched_projects = matched_projects\n # to remove duplicates from array\n @projects_seventy_five = (@matched_projects - @projects_seventy_five)\n @hundred = true # 100% match\n else\n @seventy_five = true # 75% match\n end\n end",
"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 get_matching_files(proj)\n dupes_found = {}\n archive_sigs_to_check = []\n file_sigs_to_check = []\n files_this_project = []\n proj.project_archives.each{|pa|\n archive_sigs_to_check.push pa.signature\n pa.project_files.each{|pf|\n file_sigs_to_check.push pf.signature\n files_this_project.push pf # while we're at it -- will need later\n }\n }\n # uniquify and remove nil sigs\n archive_sigs_to_check = archive_sigs_to_check.uniq.reject{|la| la.nil?}\n file_sigs_to_check = file_sigs_to_check.uniq.reject{|la| la.nil?}\n \n # Check signatures\n archive_match = ProjectArchive.find_all_by_signature(archive_sigs_to_check)\n file_match = ProjectFile.find_all_by_signature(file_sigs_to_check)\n\n\n # Then, construct the hash. Go through the PA and PF again and match\n # Them up to sigs\n archive_match.each{|am|\n # Make the mini-array - separate out the Project\n archive_value = [am.project_id, am]\n # Find all archives in this project that match by signature\n proj.project_archives.find_all_by_signature(am.signature).each{|pa|\n # if am and pa are the same, skip it ; otherwise add even if\n # they're in the same project\n next if am.id == pa.id\n dupes_found[pa] = [] unless dupes_found[pa]\n dupes_found[pa].push archive_value\n }\n }\n \n file_match.each{|fm|\n # Make the mini-array - separate out the Project\n fmpa = fm.project_archive\n fmpap = fmpa.project unless fmpa.nil?\n fmpapid = fmpap.id unless fmpap.nil?\n next if fmpapid.nil? # If it doesn't have a project, just skip it\n file_value = [fmpapid, fm]\n # Find all files in this project that match by signature\n files_this_project.each{|ftp|\n if ftp.signature == fm.signature then\n # skip it if they're the same file\n next if ftp.id == fm.id\n dupes_found[ftp] = [] unless dupes_found[ftp]\n dupes_found[ftp].push file_value\n end\n }\n }\n dupes_found\n end",
"def project_versions(project)\n project_issues(project).collect(&:fixed_version).compact.uniq\n end",
"def existing_projects\n Project.project_hashes\n end",
"def remove_dups(projects)\n\t\t projects.uniq #=> projects\n\t\t return projects.uniq\n\tend",
"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 projects_need_update(projects)\n return if projects.nil? || Thread.current[:gitosis_project_updates].nil?\n Thread.current[:gitosis_project_updates] << projects\n Thread.current[:gitosis_project_updates].flatten!\n Thread.current[:gitosis_project_updates].uniq!\n Thread.current[:gitosis_project_updates].compact!\n end",
"def project_versions(project,issues)\n issues.collect(&:fixed_version).compact.uniq\n end",
"def search_for_projects(query_array)\n siteproperties = Guiproperties.new\n\t ret_arr = Array.new\n\t\tquery_array.each do |q|\n\t\t\tq = \"%\"+q.to_s+\"%\"\n if siteproperties.isMySQL()\n\t\t\t tmp_proj = Project.find(:all, :conditions=>[\"(UPPER(title) LIKE ? OR UPPER(description) LIKE ?) AND is_public = ?\", q.upcase, q.upcase, 1])\n else\n\t\t\t tmp_proj = Project.find(:all, :conditions=>[\"(UPPER(title) LIKE ? OR UPPER(description) LIKE ?) AND is_public = ?\", q.upcase, q.upcase, 't'])\n end\n\t\t\tfor proj in tmp_proj\n\t\t\t\tret_arr << proj\n\t\t\tend\n\t\tend\n\t\tret_arr = remove_dups(ret_arr)\n\t\treturn ret_arr\n\tend",
"def pledged_projects\n pledges.map { |pledge| pledge.project }.uniq\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 get_available_project_names(file_array)\n name_results = Array.new\n for project_file in file_array\n if project_file.end_with? \".pbxproj\"\n file = File.open(project_file, \"rb\")\n file_contents = file.read\n results = file_contents.scan(/productName = ([^;]*);|PRODUCT_NAME = ([^;]*);/)\n name_results.concat(results)\n end\n end\n \n clean_name_results = name_results.flatten(1).uniq\n clean_name_results -= %w{\"$(TARGET_NAME)\"} #Remove irrelevant items\n \n if clean_name_results.length > 1 #If there are multiple results remove 'tests' if it wont leave 0 items\n \ttest_count = 0\n\t\n\tfor matched_project_name in file_array\n\t if matched_project_name.end_with? \"Tests\"\n test_count += 1\n\t end\n\tend\n\t\n\tif test_count < clean_name_results.length\n clean_name_results.delete_if {|i| i.to_s == ''}\n \t clean_name_results.delete_if {|i| i.end_with? \"Tests\"}\n \tend\n end\n \n return clean_name_results\nend",
"def build_projects_in_efforts\n @projects_in_efforts = @item_assignments_efforts.map { |assignment| assignment.demand.project }.uniq\n end",
"def project_plt(begda,endda)\n \n project_list = []\n wip = 0\n\n #Find the projects\n projects = Project::find(:all, :conditions => [\"planend >= ? and planend <= ? and status = ?\", begda, endda, Project::StatusClosed])\n projects.each do |project|\n if !project.worktype.is_continuous\n plt = (project.updated_at.to_date - project.planbeg + 1).to_f\n projectdata = { :project_id => project.id,\n :name => project.name,\n :country_id => project.country_id,\n :planeffort => project.planeffort,\n :plt => plt,\n :worktype_id => project.worktype }\n project_list << projectdata\n end\n end\n\n return project_list\n end",
"def projects\n wayfinder.decorated_ephemera_projects\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def street_similar(form_street_address,va_street_address)\n return false if va_street_address.nil?\n return va_street_address.jarowinkler_similar(form_street_address) > 0.8 ? true : false\n end",
"def nearby_projects(projects,latitude,longitude)\n @projects_seventy_five = @matched_projects\n # to remove duplicates from array\n @projects_fifty = @projects_seventy_five - @projects_fifty\n @seventy_five = false\n @hundred = false\n matched_projects = projects.near([latitude, longitude], 50, units: :km) # within 50 kilometres of user address\n if matched_projects.size > 0\n @matched_projects = matched_projects\n # to remove duplicates from array\n @projects_seventy_five = (@matched_projects - @projects_seventy_five)\n @hundred = true # 100% match\n else\n @seventy_five = true # 75% match\n end\n end",
"def get_street new_location\n\t\tfourth = [\"Hospital\", \"Cathedral\", \"Monroeville\"]\n\t\tfifth = [\"Downtown\", \"Hillman\", \"Museum\"]\n\t\tboth = [new_location, @driver.current_location]\n\t\t\n\t\treturn nil if both[0] == both[1]\n\t\treturn \"Fourth Ave.\" if fourth.include?(both[0]) && fourth.include?(both[1])\n\t\treturn \"Fifth Ave.\" if fifth.include?(both[0]) && fifth.include?(both[1])\n\t\treturn \"Foo St.\" if both.include?(\"Hospital\") && both.include?(\"Hillman\")\n\t\treturn \"Bar St.\" if both.include?(\"Cathedral\") && both.include?(\"Museum\")\n\t\t\n\t\tnil #this should never be returned unless something went wrong\n\tend",
"def get_street(new_loc)\n curr_loc = @driver.location nil\n\n return 'Fourth Ave.' if (@val.fourth_check new_loc, curr_loc).is_a? String\n return 'Fifth Ave.' unless (@val.fifth_check new_loc, curr_loc).zero?\n return 'Foo St.' unless (@val.foo_check new_loc, curr_loc) == 'no'\n @val.bar_check new_loc, curr_loc\n end",
"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 test_RefLib_003_Streets\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_RefLib_003_Streets\")\n puts2(\"#######################\")\n \n puts2(\"\")\n puts2(\"USPS Street Suffix\")\n USPS_STREET_SUFFIX.sort.each do | name, abbrev |\n puts2(\" Abbreviation of #{name}, is #{abbrev}\")\n end\n \n puts2(\"\")\n puts2(\"USPS Secondary Unit Designators\")\n USPS_SECONDARY_UNIT_DESIGNATOR.sort.each do | name, abbrev |\n puts2(\" #{name}, is abbreviated #{abbrev}\")\n end\n \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 street_lookups\n [:google, :google_premier, :yahoo, :bing, :geocoder_ca, :yandex, :nominatim]\n end",
"def supports_multiple_ips?\n Gem::Version.new(location.hv_group_version) >= Gem::Version.new('4.1.0')\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 check_final \n\t\t@driver.current_location == \"Monroeville\" || @driver.current_location == \"Downtown\"\n\tend",
"def needs_geocode_lookup?\n changed_state = %w(street_name zip_code city state country).map { |field| send(:\"#{field}_changed?\") }\n changed_state.include?(true)\n end",
"def is_gps_address? address\n\t# Blank spaces are ignored.\n\taddress = address.gsub(' ', '')\n\taddress = address.gsub(' ', '')\n\n\tfloat_pattern = '(-)?[[:digit:]]+(\\.)?+[[:digit:]]+'\n\tgps_pattern = float_pattern + ',' + float_pattern\n\treturn (address.match gps_pattern) != nil\nend",
"def street_areSame?(street)\n if(@street == street)\n true\n else\n false\n end\nend",
"def find_previous_version\n thisVersion = Gem::Version.new($SdkVersion)\n\n # We parse the test/ folder for all osm tests\n out_files = Dir.glob(File.join($OutOSWDir, '*'))\n re_version = Regexp.new('.*\\.osm_(\\d\\.\\d\\.\\d)_out\\.osw')\n version_strings = out_files.select { |f| f.match(re_version) }.map { |f| f.scan(re_version).first.last }.uniq\n # We sort them by the actual version\n versions = version_strings.map { |v| Gem::Version.new(v) }.sort\n\n if versions.include?(thisVersion)\n thisIndex = versions.index(thisVersion)\n if thisIndex > 0\n previousVersion = versions[thisIndex - 1]\n return previousVersion\n else\n puts \"Cannot find a previous version for #{$SdkVersion} as it's the oldest known\"\n return nil\n end\n else\n lastVersion = versions.last\n return lastVersion if thisVersion > lastVersion\n\n puts \"Cannot find a previous version for #{$SdkVersion} as it's older than the oldest known\"\n return nil\n end\nend",
"def used_elsewhere?\n # check the changes table to see if this location is being used \n # for more than one change, so really this should be called\n # used_in_more_than_one_place?\n loc_changes = Change.find(:all, :conditions => {:new_value => self.id, :change_type => [Change::PERSON_LOCATION, Change::PERSON_MAIN_LOCATION]})\n if loc_changes.length >= 2\n retval = true\n else\n retval = false\n end\n retval\n end",
"def resolve version\n op, version = version.strip.split\n version, op = op, '=' unless version\n version_numbers.find do |other|\n case op\n when '=' ; other == version\n when '>' ; other > version\n when '>=' ; other >= version\n when '>~'\n other[0..1] == version[0..1] && other >= version\n end\n end\n end",
"def check_overlap_single(route)\n tracks = []\n\n route.paths.each do |path|\n a = path.a\n b = path.b\n\n tracks << [path.hex, a.num, path.lanes[0][1]] if a.edge?\n tracks << [path.hex, b.num, path.lanes[1][1]] if b.edge?\n\n # check track between edges and towns not in center\n # (essentially, that town needs to act like an edge for this purpose)\n if b.edge? && a.town? && (nedge = a.tile.preferred_city_town_edges[a]) && nedge != b.num\n tracks << [path.hex, a, path.lanes[0][1]]\n end\n if a.edge? && b.town? && (nedge = b.tile.preferred_city_town_edges[b]) && nedge != a.num\n tracks << [path.hex, b, path.lanes[1][1]]\n end\n end\n\n tracks.group_by(&:itself).each do |k, v|\n raise GameError, \"Route cannot reuse track on #{k[0].id}\" if v.size > 1\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def solution(nums)\n nums.nil? ? [] : nums.sort\nend",
"def sort_array(nums)\n nums.nil? ? [] : nums.sort\nend",
"def introspective_sort(array)\n return array if array.empty?\n\n depth_limit = (2 * Math.log10(array.size) / Math.log10(2)).floor\n quick_sort(array, depth_limit)\nend",
"def sorting(numbers)\n numbers.sort\nend",
"def sort_array_asc(integer_array)\n helper_array = integer_array.sort!\n return helper_array\nend",
"def using_sort(array)\n array.sort\nend",
"def recursive_sort_wrap some_array\n recursive_sort some_array, []\nend",
"def smallest_integer(list_of_nums)\n if list_of_nums.empty?\n puts nil\n else\n list_of_nums.sort!\n puts list_of_nums[0]\n end\nend",
"def sort_array_asc(array)\n return array.sort;\nend",
"def optimal_tourney_sort(array)\n sorted_array = []\n pq = PriorityQueue.new\n array.each { |num| pq << num }\n sorted_array << pq.remove_min until pq.size == 1\n sorted_array\nend",
"def sort_array_asc(integers)\n integers.sort\nend",
"def sort_array_asc(int_array)\n \n int_array.sort\n \nend",
"def sort_array_asc(array)\n array.sort\nend",
"def ordenar_arreglo array\n array.sort\nend",
"def merge_sort(array, i= 0)\r\n\ti += 1\r\n\treturn array if array.length == 1\r\n\t\tprint \"array#{i}: #{array}\\n\"\r\n\t\ta = merge_sort(array.slice!(0..array.length/2-1), i)\r\n\t\tprint \"a#{i}: #{a}\\n\"\t\t\r\n\t\tb = merge_sort(array, i)\r\n\t\tprint \"b#{i}: #{b}\\n\"\r\n\t\tsorted = []\r\n\tuntil a.first.nil? || b.first.nil?\r\n\t\tprint \"sorting: a#{i}: #{a}, b#{i}: #{b}\\n\"\r\n\t\tsorted << (a.first < b.first ? a.slice!(0) : b.slice!(0))\r\n\t\tprint \"sorted step: #{sorted}\\n\"\r\n\tend\r\n\tuntil a.first.nil?\r\n\t\tsorted << a.slice!(0)\r\n\tend\r\n\tuntil b.first.nil?\r\n\t\tsorted << b.slice!(0)\r\n\tend\r\n\tprint \"sorted: #{sorted}, i: #{i}\\n\"\r\n\tsorted\r\nend",
"def sort_array_desc(integers)\n integers.sort.reverse\nend",
"def flatten_and_sort(array)\n array.flatten.sort\nend",
"def flatten_and_sort(array)\n array.flatten.sort\nend",
"def tournament_sort(array)\n return optimal_tourney_sort(array) if array.size <= MAX_SIZE\n\n bracketize(array)\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /regionextras GET /regionextras.json | def index
@regionextras = Regionextra.all
end | [
"def region\n @regions = @company.companyregions\n respond_with @regions\n end",
"def regions\n client.get_stats('/stats/regions')\n end",
"def regions\n @carrierRegions = []\n if session[:carrier]\n soap_client = MyFreightWorldCarrier.new\n @carrierRegions = soap_client.getRegions(session[:carrier][\"token\"])\n end\n\n render :json => @carrierRegions\n end",
"def geographic_regions\n self.dig_for_array(\"geographicRegions\")\n end",
"def geographic_regions\n self.dig_for_array(\"listingSummary\", \"geographicRegions\")\n end",
"def cities_in_region\n render json: City.where(region_id: controller_params).order(:name)\n end",
"def index\n\n @regions = Region.all\n\n render json: @regions\n\n end",
"def index\n @regiones = Region.all\n\n render json: @regiones\n end",
"def all\n subregions = Subregions.all( params[:urn] )\n render :json => { :subregions => subregions }\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 get_shipping_regions\n shipping_regions = ShippingRegion.all\n json_response(shipping_regions)\n end",
"def show\n @uip_region = UipRegion.find(params[:id])\n\n render json: @uip_region\n end",
"def show\n @subregion = Subregion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subregion }\n end\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 search_regions(region)\n options = {\n :q => region,\n }\n\n regions = []\n\n puts \"Search with options \" + options.inspect\n\n response = connection.get(\"region\", options )\n puts \"responce is \" + response.inspect\n\n if response.status == 200\n regions.push response.body[\"region.regions\"][0]['region'][0]\n end\n\n regions\n end",
"def get_md_regions\n response = @client.get_md_regions! do |soap|\n soap.input = soap.action = \"GetMDRegions\"\n soap.namespace = @namespace\n end\n\n h = response.to_hash[:get_md_regions_response][:region_list] #this can throw\n\n [h[:region]].compact.flatten rescue Array.new #this should not throw\n end",
"def get_region\n logger.debug(\"fetching region from meta-data service\")\n az = HTTP.get(\n [\n self.class.const_get(:INSTANCE_PROFILE_HOST),\n self.class.const_get(:INSTANCE_PROFILE_AZ_PATH),\n ].join(\"/\")\n ).body.to_s.strip\n az.sub!(/[a-zA-Z]+$/, \"\")\n logger.debug(\"region from meta-data service: #{az}\")\n az\n end",
"def query_tax_regions(options={})\n path = \"/api/v2/compliance/taxregions\"\n get(path, options)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"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 createregion\n region_name = params[\"regionName\"]\n region_active = params[\"active\"] == \"true\"\n @carrierRegions = []\n if session[:carrier]\n soap_client = MyFreightWorldCarrier.new\n @carrierRegions = soap_client.createRegion(session[:carrier][\"token\"], region_name, region_active)\n end\n\n render :json => @carrierRegions\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 index\n @regionextras = Regionextra.all\n end",
"def create\n @region = Region.new(region_params)\n\n if @region.save\n render :show, status: :created, location: @region\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end",
"def insertregionzip\n region_id = params[\"regionId\"]\n country_id = 1\n zip_code = params[\"zipCode\"]\n excluded = params[\"excluded\"]\n @carrierRegion = nil\n if session[:carrier]\n soap_client = MyFreightWorldCarrier.new\n @carrierRegion = soap_client.insertRegionZip(session[:carrier][\"token\"], region_id, country_id, zip_code, excluded)\n end\n\n render :json => @carrierRegion\n end",
"def region_params\n params.require(:region).permit!\n end",
"def insertregionstate\n region_id = params[\"regionId\"]\n country_id = 1\n state = params[\"state\"]\n excluded = params[\"excluded\"]\n @carrierRegion = nil\n if session[:carrier]\n soap_client = MyFreightWorldCarrier.new\n @carrierRegion = soap_client.insertRegionState(session[:carrier][\"token\"], region_id, country_id, state, excluded)\n end\n\n render :json => @carrierRegion\n end",
"def create\n @uip_region = UipRegion.new(params[:uip_region])\n\n if @uip_region.save\n render json: @uip_region, status: :created, location: @uip_region\n else\n render json: @uip_region.errors, status: :unprocessable_entity\n end\n end",
"def insertregionziprange\n region_id = params[\"regionId\"]\n country_id = 1\n starting_zip_code = params[\"startingZipCode\"]\n ending_zip_code = params[\"endingZipCode\"]\n excluded = params[\"excluded\"]\n @carrierRegion = nil\n if session[:carrier]\n soap_client = MyFreightWorldCarrier.new\n @carrierRegion = soap_client.insertRegionZipRange(session[:carrier][\"token\"], region_id, country_id, starting_zip_code, ending_zip_code, excluded)\n end\n\n render :json => @carrierRegion\n end",
"def region\n @regions = @company.companyregions\n respond_with @regions\n end",
"def create\n @admin_region = Admin::Region.new(admin_region_params)\n\n respond_to do |format|\n if @admin_region.save\n format.html { redirect_to @admin_region, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @admin_region }\n else\n format.html { render :new }\n format.json { render json: @admin_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @region = Region.new(region_param)\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 create(attributes = {})\n # Add the region\n @regions << Region.new(attributes)\n \n @regions.last\n end",
"def create\n @map_region = Map::Region.new(params[:map_region])\n\n respond_to do |format|\n if @map_region.save\n format.html { redirect_to @map_region, notice: 'Region was successfully created.' }\n format.json { render json: @map_region, status: :created, location: @map_region }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subregion = Subregion.new(params[:subregion])\n\n respond_to do |format|\n if @subregion.save\n format.html { redirect_to @subregion, notice: 'Registro creado satisfactoriamente.' }\n format.json { render json: @subregion, status: :created, location: @subregion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subregion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newregion = Newregion.new(newregion_params)\n\n respond_to do |format|\n if @newregion.save\n format.html { redirect_to @newregion, notice: 'Newregion was successfully created.' }\n format.json { render :show, status: :created, location: @newregion }\n else\n format.html { render :new }\n format.json { render json: @newregion.errors, status: :unprocessable_entity }\n end\n end\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 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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"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\n do_load_resource\n get_project_if_exists\n do_authorize_instance\n\n @original_region_name = @region.name\n\n if @region.update(region_params)\n respond_show\n else\n respond_change_fail\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 @map_region = Map::Region.find(params[:id])\n\n respond_to do |format|\n if @map_region.update_attributes(params[:map_region])\n format.html { redirect_to @map_region, notice: 'Region was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map_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 @regions = Region.all\n format.js { render :file=> 'regions/update_regions.js.erb', 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 @tipo_region.update(tipo_region_params)\n format.html { redirect_to @tipo_region, notice: 'Tipo region was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipo_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subregion = Subregion.find(params[:id])\n\n respond_to do |format|\n if @subregion.update_attributes(params[:subregion])\n format.html { redirect_to @subregion, notice: 'Registro editado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subregion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_region.update(admin_region_params)\n format.html { redirect_to @admin_region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_region }\n else\n format.html { render :edit }\n format.json { render json: @admin_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @region.update_attributes(params[:region])\n flash[:notice] = 'Region was successfully updated.'\n format.html { redirect_to([:admin, @region]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @region.errors, \n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @newregion.update(newregion_params)\n format.html { redirect_to @newregion, notice: 'Newregion was successfully updated.' }\n format.json { render :show, status: :ok, location: @newregion }\n else\n format.html { render :edit }\n format.json { render json: @newregion.errors, status: :unprocessable_entity }\n end\n end\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 @uip_region = UipRegion.find(params[:id])\n\n if @uip_region.update(params[:uip_region])\n head :no_content\n else\n render json: @uip_region.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @conservedregion.update(conservedregion_params)\n format.html { redirect_to @conservedregion, notice: 'Conservedregion was successfully updated.' }\n format.json { render :show, status: :ok, location: @conservedregion }\n else\n format.html { render :edit }\n format.json { render json: @conservedregion.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 respond_to do |format|\n if @renew_region.update(renew_region_params)\n format.html { redirect_to @renew_region, notice: 'Renew region was successfully updated.' }\n format.json { render :show, status: :ok, location: @renew_region }\n else\n format.html { render :edit }\n format.json { render json: @renew_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_data\n region = Region.find(params[:id])\n data = MultiJson.load(@region.json_data || \"{}\")\n\n # TODO: merge incoming data\n\n region.json_data = MultiJson.dump(data, :pretty => true)\n\n redirect_to :action => :show, :id => id\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\n @regional_request.modified_by = current_user.id\n respond_to do |format|\n if @regional_request.update(regional_request_params)\n format.html { redirect_to @regional_request, notice: 'Regional request was successfully updated.' }\n format.json { render :show, status: :ok, location: @regional_request }\n else\n format.html { render :edit }\n format.json { render json: @regional_request.errors, status: :unprocessable_entity }\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def destroy\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.destroy\n\n head :no_content\n end",
"def destroy\n @region.destroy\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 }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_region.destroy\n respond_to do |format|\n format.html { redirect_to admin_regions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_regions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @regione = Regione.find(params[:id])\n @regione.destroy\n\n respond_to do |format|\n format.html { redirect_to regioni_url }\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 @map_region = Map::Region.find(params[:id])\n @map_region.destroy\n\n respond_to do |format|\n format.html { redirect_to map_regions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @conservedregion.destroy\n respond_to do |format|\n format.html { redirect_to conservedregions_url, notice: 'Conservedregion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @us_region.destroy\n respond_to do |format|\n format.html { redirect_to(admin_us_reps_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted US Region #{@us_region.name}\")\n end",
"def destroy\n @admin_region.destroy\n respond_to do |format|\n format.html { redirect_to admin_regiones_url, notice: 'Region was successfully destroyed.' }\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 deleteregion\n region_id = params[\"regionId\"]\n @carrierRegions = []\n if session[:carrier]\n soap_client = MyFreightWorldCarrier.new\n @carrierRegions = soap_client.deleteRegion(session[:carrier][\"token\"], region_id)\n end\n\n render :json => @carrierRegions\n end",
"def destroy\n @uip_region = UipRegion.find(params[:id])\n @uip_region.destroy\n\n head :no_content\n end",
"def destroy\n @subregion = Subregion.find(params[:id])\n @subregion.destroy\n\n respond_to do |format|\n format.html { redirect_to subregions_url, notice: 'Registro eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regional = Regional.find(params[:id])\n @regional.destroy\n\n respond_to do |format|\n format.html { redirect_to regionals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @target_region = TargetRegion.find(params[:id])\n @target_region.destroy\n\n respond_to do |format|\n format.html { redirect_to(target_regions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @renew_region.destroy\n respond_to do |format|\n format.html { redirect_to renew_regions_url, notice: 'Renew region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=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 | [
"def max_number(our_array)\n\treference = -1000000\n\tour_array.each do |number|\n\t\tif number > reference\n\t\t\treference = number\n\t\tend\n\tend\n\treference\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 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 saved_number\nend",
"def max_in_array()\n my_array = [10,140,4,3,120, -7, 300]\n largest_num = nil\n num_idx = 0\n while num_idx < my_array.length\n current_num = my_array[num_idx]\n if largest_num == nil\n largest_num = current_num\n elsif largest_num < current_num\n largest_num = current_num\n end\n num_idx += 1\n end\n return largest_num\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 find_max_value(array) # method 2 using block and if\n x = array[0]\n array.length.times { |index| if array[index] > x\n x = array[index]\n end\n }\n x\nend",
"def largest_integer_brute_force_approach(array)\n inspector = array.sort[0] - 1 #Find the smallest possible integer value that can be in the array\n index = 0 \n while index < array.length do #Iterate over all the elements in the array\n if array[index] > inspector #if an array element is bigger than the inspector\n inspector = array[index] #Reassign the value of the inspector to be said element\n end\n index+=1\n end\n inspector #Return the final value of the inspector\nend",
"def next_largest_number (array, given_number)\n array.find {|number| number > given_number}\nend",
"def largest_integer(list_of_nums)\n\n return nil if largest_integer == []\n\n big_num = list_of_nums[0] #set big_num variable equal to the first index in the array\n list_of_nums.each do |num| #iterate over the array\n if num > big_num #compare each element in the array to the variable big_num\n big_num = num # set big_num equal to the element if the num is bigger than first index\n end\n end\n p big_num #print big num variable\n end",
"def max(array)\n\tn = 0\n\tarray.each do |x|\n\t\tif x > n\n\t\t\t n = x\n\t\tend\n\tend\n\t puts n\nend",
"def greatest_number(num_array)\n num_array.sort.pop\nend",
"def find_next_greater_element(array)\n (0...array.length).each do |i|\n smallest_after = 100000\n (i...array.length).each do |j|\n if array[j] > array[i] && array[j] < smallest_after\n smallest_after = array[j]\n end\n end\n puts \"Next greatest for #{array[i]} is #{smallest_after}\"\n end\n\n\n\nend",
"def max_by(array)\n largest = nil\n largest_ret = nil\n array.each do |el|\n val = yield(el)\n largest, largest_ret = el, val if largest.nil? || val > largest_ret\n end\n largest\nend",
"def find_max_value(array)\n array.max { |item|\n return array.max\n }\n \nend",
"def max_by(arr)\n max = arr.first\n for el in arr\n max = el if yield(el) > yield(max)\n end\n max\nend",
"def biggest_number(array_of_integers)\n # TODO\nend",
"def big_dif(array)\n new_number = array.max - array.sort[-2]\nend",
"def highestnumber2 arr\n idx = 0 \n idx2 = 0 \n max = arr[0][0]\n\n while idx <= arr.length - 1\n\n if (highestnumber arr[idx]) > max\n max = highestnumber arr[idx]\n idx2 = idx \n end \n idx = idx + 1\n end\n return arr[idx2]\nend",
"def get_next_highest(num, array_num)\n retval = nil\n if ! num.nil? && num != -1\n arr_size = array_num.size\n sorted_nums = array_num.sort\n num_index = sorted_nums.index(num)\n if num_index == arr_size - 1\n retval = 100\n else\n retval = sorted_nums[num_index + 1]\n end\n end\n return retval\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def slug_unique?(test_slug, existing = existing_slugs)\n !existing.include?(test_slug)\n end",
"def slug_unique?(slug)\n self.class.find_by(slug: slug).nil?\n end",
"def slug_is_unique\n true\n end",
"def slug_unchanged?(slug)\n self.slug == slug\n end",
"def slugged?\n !slug.blank?\n end",
"def slug_needs_update?\n slug.blank? || (word_slug? and send(\"#{source_column}_changed?\") and base_slug != slug.gsub(/\\-[0-9]+$/,''))\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 slug?\n !! slug\n end",
"def new_with_slugs?\n new_record? && slug.present?\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 slug_changed?\n saved_change_to_slug?\n end",
"def persisted_with_slug_changes?\n persisted? && slug_changed?\n end",
"def found_using_outdated_friendly_id?\n @finder_slug.id != slug.id\n end",
"def found_using_outdated_friendly_id?\n @finder_slug.id != slug.id\n end",
"def stale_slug?\n !(\n (permanent_slug? && !slug_value.blank?) ||\n slug_source_value.blank?\n ) ||\n !(!new? && (dirty_attributes.keys.map(&:name) &\n (self.class.slug_options[:scope] || [])).compact.blank?\n )\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 slug_unique_in_clinic?\n Department.in_clinic(self).where(slug: slug).count == 0\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
START Feed Action Tests | def test_get_feed
get :feed
assert_response :success
end | [
"def test_mp3_feed_works\n get \"/podcast_feed/all/mp3/rss.xml\"\n assert last_response.ok?\n end",
"def test\n @entries = @feed.test\n rescue Exception => e\n flash[:error] = e.message\n redirect_to(admin_feeds_url)\n end",
"def test_feed_user\n user = create(:user)\n changesets = create_list(:changeset, 3, :user => user, :num_changes => 4)\n create(:changeset_tag, :changeset => changesets[1])\n create(:changeset_tag, :changeset => changesets[1], :k => \"website\", :v => \"http://example.com/\")\n _other_changeset = create(:changeset)\n\n get :feed, :params => { :format => :atom, :display_name => user.display_name }\n\n assert_response :success\n assert_template \"list\"\n assert_equal \"application/atom+xml\", response.content_type\n\n check_feed_result(changesets)\n end",
"def test1Action\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n }\n )\n end",
"def feed; command FEED; 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 do_task_work\n @web.add_feed( @thing, @category, @message, @feedOptions )\n end",
"def run_start(config)\n puts \"The test run is starting\"\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 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 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 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 atest_ID_25891_scheduled_posts\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n schedule_post(\"Living\",\"House & Home\")\n go_to_scheduled_tab_on_your_post_page\n verify_text \"test_ID_25890_published_posts\",\"Your Posts\",\"Current Drafts\", \"Scheduled Posts\", \"Published Posts\", \"Scheduled\"\n verify_elements_on_scheduled_post \"test_ID_25891_scheduled_posts\"\n verify_scheduled_post_count_updated_after_deleting_scheduled_post\n end",
"def test_ID_25889_current_drafts_03\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n verify_draft_count_updated_after_creating_new_draft\n end",
"def test2Actions\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyActionWithParams' => [\n [ 'Param1', 'Param2' ]\n ],\n 'DummyAction' => [\n []\n ]\n }\n }\n )\n end",
"def test_count_articles_for_user_with_feed\n feed = UserFeed.find(6) #NErr the Blog\n count = VwArticlesForUser.count_articles_for_user(feed, :feed, 3)\n assert count == 2\n end",
"def test02_post_open_blog_repostArticle_TC_24313_243414\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_post_open_article)\n\t\t\n\t\tsleep 3\n\t\trepost \"Repost text #{random}\" \n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def convert_units(obj, un)\n begin\n obj.convert_units(un) # for GPhys etc\n rescue\n obj.convert2(un) # for UNumeric etc\n end\n end",
"def normalize_units(u)\n if u.blank?\n u = nil\n else\n u = u.to_s\n u = UNIT_SYN[u] || u\n u = u.to_s.gsub('^','**').tr(' ','*')\n begin\n ::Units.u(u)\n rescue\n u = nil\n end\n end\n u\n end",
"def normalize\n set_magnitude(1)\n end",
"def unit_(v_)\n (self - v_).normalize\n end",
"def normalize(value)\n send(\"normalize_#{@type}\", value)\n end",
"def convert_to_standard_units\n if self.class.units && self.unit then\n self.numerical_response = self.class.units.convert(self.numerical_response, :from => self.unit, :to => self.class.units.standard_unit) \n end\n end",
"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 normalized\n vec = Vector2.new(@v)\n vec.normalize!\n end",
"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 normalized\n @value\n end",
"def normalize(min, max)\n map { |v| v.respond_to?(:-) ? (v - min) / (max - min) : v }\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!\n self.replace self.normalize\n end",
"def convert_from_standard_units\n self.raw_numerical_response = self.numerical_response\n if !self.unit.blank? && self.class.units then\n self.numerical_response = self.class.units.convert(self.numerical_response, :from => self.class.units.standard_unit, :to => self.unit) \n end\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(object, attribute, value); normalize_value(value) 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 stat_normalized_distribution\n if first.kind_of?(Array)\n asum = esum = 0.0\n each { |a,e| asum += a; esum +=e }\n collect { |a,e| [a/asum, e/esum] }\n else\n a = 1.0/length\n esum = stat_sum.to_f\n collect { |e| [a,e/esum] }\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def metric?\n @metric\n end",
"def metric_ton? = unit == 'metric-ton'",
"def is_metric?(unit)\n return (unit == \"mm\" || unit == \"cm\" || unit == \"m\" || unit == \"km\")\n end",
"def metric?\n false\n end",
"def cup_metric? = unit == 'cup-metric'",
"def square_meter? = unit == 'square-meter'",
"def pint_metric? = unit == 'pint-metric'",
"def pixel_per_meter? = unit == 'pixel-per-meter'",
"def metric? method_name\n method_name.to_s.end_with? '_metric'\n end",
"def square_kilometer? = unit == 'square-kilometer'",
"def karat? = unit == 'karat'",
"def micrometer? = unit == 'micrometer'",
"def kilowatt? = unit == 'kilowatt'",
"def kilometer? = unit == 'kilometer'",
"def meter_per_second? = unit == 'meter-per-second'",
"def unit?\n !@unit.nil?\n end",
"def megawatt? = unit == 'megawatt'",
"def cubic_meter? = unit == 'cubic-meter'",
"def is_meter m\r\n return false unless m.instance_of? Meter\r\n return true\r\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get exception status detail | def status_details(exception)
StatusDetails.new(message: exception&.message, trace: exception&.backtrace&.join("\n"))
end | [
"def status_details\n return nil unless cause.respond_to? :status_details\n cause.status_details\n end",
"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 status_code\n @status_code ||= ActionDispatch::ExceptionWrapper.new(env, exception).status_code\n end",
"def status_detail\n return @status_detail\n end",
"def status_error desc\n throw :status_error, desc\n end",
"def exception_details(e, msg); end",
"def extract_status(src)\n return if src.nil?\n src = src.exception if src.is_a?(ExecReport)\n # noinspection RailsParamDefResolve\n src.try(:http_status) || src.try(:status) || src.try(:code) ||\n src.try(:dig, :status) || src.try(:response).try(:dig, :status)\n end",
"def status_detail\n @status_detail\n end",
"def status_message\n @data[:status_message]\n end",
"def status_code\n return nil unless cause.respond_to? :status_code\n cause.status_code\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 status_code\n self.class.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 exception_details e, msg\n [\n \"#{msg}\",\n \"Class: <#{e.class}>\",\n \"Message: <#{e.message.inspect}>\",\n \"---Backtrace---\",\n \"#{Minitest.filter_backtrace(e.backtrace).join(\"\\n\")}\",\n \"---------------\",\n ].join \"\\n\"\n end",
"def exit_status_from_exception; end",
"def message\n @response.status_message\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",
"def error_details\n return @error_details\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def index\n if params[:cep]\n @api_ceps = Api::Cep.find_by(cep: params[:cep])\n if @api_ceps\n render json: {ceps: @api_ceps}, status: 202\n else\n render json: {error: 'CEP not found'}, status: 404\n end\n else\n @api_ceps = Api::Cep.all\n render json: {ceps: @api_ceps}, status: 202\n end\n end",
"def index\n @pecs = Pec.all\n end",
"def index\n @cps = Cp.all\n end",
"def find_cpe(cpe, document, without_versions)\n cves = []\n cpe_nodes = document[\"configurations\"][\"nodes\"]\n cpe_nodes.each do |cpe_nodes_elem|\n if cpe_nodes_elem.has_key?(\"cpe_match\")\n cves.push( get_cve_data(document) ) if scroll_cpe_match(cpe, cpe_nodes_elem[\"cpe_match\"], without_versions)\n end\n if cpe_nodes_elem.has_key?(\"children\")\n cpe_nodes_elem[\"children\"].each do |children_elem|\n cves.push( get_cve_data(document) ) if scroll_cpe_match(cpe, children_elem[\"cpe_match\"], without_versions)\n end\n end\n end\n #cves.each { |elem| (#puts '[find_cpe] cves: ' + elem.to_s) }\n return cves.uniq\n end",
"def index\n @ceps = Cep.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 @v2_pessoas = V2::Pessoa.all\n end",
"def list(jss)\n return Casper.list(@jss, \"computers\", \"computers\") \n end",
"def index\n @pc_infos = PcInfo.all\n end",
"def index\n @c_povolanis = CPovolani.all\n end",
"def index\n @prospecto_meta_corto_plazos = ProspectoMetaCortoPlazo.all\n end",
"def index\n @excps = Excp.all\n end",
"def live_variants\n return self.variants.where(:status => ['Active', 'Inactive'])\n end",
"def index\n @cops = Cop.all\n end",
"def index\n @pvprovisions = Pvprovision.all\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"def subscribe_frame d, h\n h[:ack] = 'auto' unless h[:ack] == 'client'\n create_frame 'SUBSCRIBE', [{:id => OnStomp.next_serial}, h, {:destination => d}]\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 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 unsubscribe_frame f, h\n id = f.is_a?(OnStomp::Components::Frame) ? f[:id] : f\n create_frame('UNSUBSCRIBE', [{:id => id}, h]).tap do |f|\n raise ArgumentError, 'subscription ID could not be determined' unless f.header?(:id)\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 create_subscription\n pub_client.create_logical_replication_slot(sub_name)\n sub_client.create_subscription(sub_name, subscription_conninfo, [pub_name], :create_slot => false)\n end",
"def create_and_send_ack\n send(create_ack)\n end",
"def create_2xx_ack\n #todo ACK must have the same credentials as INVITE.\n ack = create_subsequent_request(\"ACK\", false)\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 ack_frame *args\n headers = args.last.is_a?(Hash) ? args.pop : {}\n m_id = args.shift\n m_id = m_id[:'message-id'] if m_id.is_a?(OnStomp::Components::Frame)\n create_frame('ACK', [{:'message-id' => m_id}, headers]).tap do |f|\n raise ArgumentError, 'no message-id to ACK' unless f.header?(:'message-id')\n end\n end",
"def gen_subscriber\n subscriber = @context.socket(ZMQ::SUB)\n\n # Set timeout (TODO add option for customize timeout)\n subscriber.setsockopt(ZMQ::RCVTIMEO, @conf[:timeout_s] * 10**3)\n subscriber.connect(@conf[:subscriber_endpoint])\n\n subscriber\n end",
"def retain_acked= new_retain_acked\n update_grpc = Google::Cloud::PubSub::V1::Subscription.new name: name,\n retain_acked_messages: !(!new_retain_acked)\n @grpc = service.update_subscription update_grpc, :retain_acked_messages\n @resource_name = nil\n end",
"def gen_subscriber\n subscriber = @context.socket(ZMQ::SUB)\n\n # Set timeout (TODO add option for customize timeout)\n subscriber.setsockopt(ZMQ::RCVTIMEO, @wait_timeout * 10**3)\n subscriber.connect(@subscriber_endpoint)\n\n subscriber\n end",
"def ack\n @server.send(Protocol::Basic::Ack.new(:delivery_tag => properties[:delivery_tag]))\n end",
"def get_again(ackmode)\n received = nil\n assert_nothing_raised() {\n connection_subscribe(@queuename, { \"ack\" => ackmode })\n received = @conn.receive \n }\n #\n assert_not_nil(received, \"something should be received\")\n assert_equal(@test_message, received.body, \"received should again match sent\")\n assert_not_nil(received.headers[\"message-id\"], \"message ID should be present\")\n #\n assert_nothing_raised() {\n @conn.ack(received.headers[\"message-id\"]) if ackmode == \"client\"\n }\n received\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an ACK frame | def ack_frame *args
create_ack_or_nack 'ACK', args
end | [
"def sendAck\n $LOG.debug \"Sending ACK\"\n send_msg ack Messages::EndType::ACK\n end",
"def ack_frame *args\n headers = args.last.is_a?(Hash) ? args.pop : {}\n m_id = args.shift\n m_id = m_id[:'message-id'] if m_id.is_a?(OnStomp::Components::Frame)\n create_frame('ACK', [{:'message-id' => m_id}, headers]).tap do |f|\n raise ArgumentError, 'no message-id to ACK' unless f.header?(:'message-id')\n end\n end",
"def create_and_send_ack\n send(create_ack)\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 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 create_2xx_ack\n #todo ACK must have the same credentials as INVITE.\n ack = create_subsequent_request(\"ACK\", false)\n end",
"def ack\n @server.send(Protocol::Basic::Ack.new(:delivery_tag => properties[:delivery_tag]))\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(frame)\n @@queue_manager.ack(self, frame)\n end",
"def ack(error=nil)\n ack = HL7::Message.new\n msh = ack.standard_msh\n msh.receiving_application = self.msh.sending_application\n msh.receiving_facility = self.msh.sending_facility\n msh.message_type = {:message_code=>'ACK',:trigger_event=>self.msh.message_type.trigger_event,:message_structure=>'ACK'}\n msh.processing_id = self.msh.processing_id\n msh.message_control_id = \"K%X\" % Time.now.to_i\n ack << msh\n msa = HL7::Msa.new\n msa.segment = \"MSA\"\n msa.control_id = self.msh.message_control_id\n if self.msh.accept_acknowledgement_type.blank? and self.msh.application_acknowledgement_type.blank?\n # we are using old-style ACKs\n if error\n msa.code = \"AE\"\n msa.text = error\n else\n msa.code = \"CA\"\n msa.text = \"Normal acknowledgement.\"\n end\n else\n # we are using new-style ACKs\n ack_type = self.msh.accept_acknowledgement_type\n if error\n if ack_type == \"AL\" or ack_type == \"ER\"\n msa.code = \"CE\"\n msa.text = error\n else\n return nil\n end\n else\n if ack_type == \"AL\" or ack_type == \"SU\"\n msa.code = \"CA\"\n msa.text = \"Normal acknowledgement.\"\n else\n return nil\n end # if ack_type\n end # if error\n end # if\n ack << msa\n return ack\n end",
"def create\n @ack = Ack.new(params[:ack])\n\n respond_to do |format|\n if @ack.save\n format.html { redirect_to(@ack, :notice => 'Ack was successfully created.') }\n format.json { render :json => @ack, :status => :created, :location => @ack }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def screencast_frame_ack(session_id:)\n {\n method: \"Page.screencastFrameAck\",\n params: { sessionId: session_id }.compact\n }\n end",
"def ack?\n @bytes.first == Message::ACK\n end",
"def test_0010_ack_send_receive\n ack_client_test(:ackparm => \"ack\", :times => 1, :mod => \"0010\")\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 ack(message_or_ack_id, headers = {})\n raise Stomp::Error::NoCurrentConnection if @closed_check && closed?\n raise Stomp::Error::ProtocolErrorEmptyHeaderKey if headers.has_key?(\"\")\n raise Stomp::Error::ProtocolErrorEmptyHeaderValue if @protocol == Stomp::SPL_10 && headers.has_value?(\"\")\n raise Stomp::Error::MessageIDRequiredError if message_or_ack_id.nil? || message_or_ack_id == \"\"\n headers = headers.symbolize_keys\n\n case @protocol\n when Stomp::SPL_12\n # The ACK frame MUST include an \"id\" header matching the \"ack\" header \n # of the MESSAGE being acknowledged.\n headers[:id] = message_or_ack_id\n when Stomp::SPL_11\n # ACK has two REQUIRED headers: \"message-id\", which MUST contain a value \n # matching the message-id header of the MESSAGE being acknowledged and \n # \"subscription\", which MUST be set to match the value of SUBSCRIBE's \n # id header.\n headers[:'message-id'] = message_or_ack_id\n raise Stomp::Error::SubscriptionRequiredError unless headers[:subscription]\n else # Stomp::SPL_10\n # ACK has one required header, \"message-id\", which must contain a value \n # matching the message-id for the MESSAGE being acknowledged.\n headers[:'message-id'] = message_or_ack_id\n end\n _headerCheck(headers)\n slog(:on_ack, log_params, headers)\n transmit(Stomp::CMD_ACK, headers)\n end",
"def begin_frame tx, h\n create_transaction_frame 'BEGIN', tx, h\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an NACK frame | def nack_frame *args
create_ack_or_nack 'NACK', args
end | [
"def ack_frame *args\n create_ack_or_nack 'ACK', args\n end",
"def makeframe(packetdata)\n\t\tif packetdata.size > 255\n\t\t\tprint_error(\"#{rhost}:#{rport} - MODBUS - Packet too large: #{packetdata.inspect}\")\n\t\t\treturn\n\t\tend\n\t\tpayload = \"\"\n\t\tpayload += [@modbuscounter].pack(\"n\")\n\t\tpayload += \"\\x00\\x00\\x00\" #dunno what these are\n\t\tpayload += [packetdata.size].pack(\"c\") # size byte\n\t\tpayload += packetdata\n\tend",
"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 new_frame( cfg, prefix = nil )\n keys = cfg.__desc.keys.map {|k| k.to_s}\n keys.sort!\n keys.map! {|k| k.to_sym}\n\n Frame.new(cfg, prefix.to_s, keys, 0)\n end",
"def make_netbios(payload)\n [payload.length & 0x00ffffff, payload].pack(\"Na*\")\nend",
"def transmit_frame(kind = :standard, identifier = 0, length = 0, frame_data = 0)\n case frame_data\n when String\n data = frame_data.bytes.map { |b| b.to_s(16).rjust(2, '0') }.join.rjust(length * 2, '0')\n else\n data = frame_data.to_s(16).rjust(length * 2, '0')\n end\n\n case kind\n when :standard\n identifier = (identifier & 0x7ff).to_s(16).rjust(3, '0')\n frame = StandardFrame.new(:identifier => identifier, :data => data, :dlength => length.to_s)\n when :extended\n identifier = (identifier & 0x1fffffff).to_s(16).rjust(8, '0')\n frame = ExtendedFrame.new(:identifier => identifier, :data => data, :dlength => length.to_s)\n else\n raise 'invalid frame kind'\n end\n\n if frame.errors.any?\n raise \"invalid frame: #{frame.errors.join(\"\\n\")}\"\n else\n response = issue_command(:transmit, { :frame => frame })\n end\n\n @serial.read(1) if RETURN_CODE[response.return_code] == :ok\n\n response\n end",
"def begin_frame tx, h\n create_transaction_frame 'BEGIN', tx, h\n end",
"def create_frame\n frames.last.copy\n end",
"def frame(ethertype, payload, opts = {})\n src_mac = opts[:src_mac] || @src_mac\n dst_mac = opts[:dst_mac] || @dst_mac\n ethertype = [ ethertype ].pack('S>') if ethertype.class <= Integer\n frm = dst_mac + src_mac + ethertype + payload\n inject(frm) unless opts[:noinject] or opts[:norecurse]\n frm\n end",
"def send_frame(command, headers={}, body='')\n headers['content-length'] = body.size.to_s\n response = StompServer::StompFrame.new(command, headers, body)\n stomp_send_data(response)\n end",
"def build\n mount_frames\n transmit\n end",
"def write_frame_nonblock frame\n ser = serializer.frame_to_bytes frame\n push_write_buffer ser, frame\n end",
"def inject(frame)\n tap_hdr = [ '', frame[12, 2] ].pack('a2a2')\n @raw.write(tap_hdr + frame)\n @raw.flush\n end",
"def create_and_send_ack\n send(create_ack)\n end",
"def prepare_and_write_ndmp_msg(msg, all_but_last_char=false, times=1, flags=0)\n msg.header.sequence_num = @next_sequence_num\n @next_sequence_num += 1\n msg.header.timestamp = Time.now.to_i\n\n frag = msg.header.to_xdr + msg.body\n write_ndmp_frag(frag, all_but_last_char, times, flags)\n end",
"def send_packet\n vprint_status('Protocol finished setup. Going to send packet.')\n msg = \"17 #{@packet_payload.length}\\n#{@packet_payload}\"\n plen = BF_BLOCKSIZE - (msg.length % BF_BLOCKSIZE)\n # padding\n msg += 'B' * plen\n @encryption_queue.push(msg)\n @keep_reading_socket = false\n handle_write\n end",
"def msgpack_factory; 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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a heartbeat frame (serialized as a single "\n" character) | def heartbeat_frame
OnStomp::Components::Frame.new
end | [
"def sendHeartbeat()\n send!(0, :HB, -1, -1, -1, -1)\n end",
"def send_heartbeat(sequence)\n send_packet(Opcodes::HEARTBEAT, sequence)\n end",
"def make_event_frame( payload )\n\t\tframe = Mongrel2::WebSocket::Frame.new( '', 0, '', {}, payload )\n\t\tframe.opcode = :text\n\n\t\treturn frame.to_s\n\tend",
"def create_heartbeat(body, opts = {})\n data, _status_code, _headers = create_heartbeat_with_http_info(body, opts)\n return data\n end",
"def send_heartbeat\n send_message DCell::Message::Heartbeat.new\n @heartbeat = after(self.class.heartbeat_rate) { send_heartbeat }\n end",
"def sendHeartbeat()\n if NodeAgent.instance.connected?\n send!(:HB, -1, -1, -1, -1)\n else\n # haven't heard from nodeHandler yet, resend initial message\n sendWHOAMI\n end\n end",
"def handle_heartbeat(_payload)\n send_packet(OPCODES[:HEARTBEAT], @session.seq)\n end",
"def send_frame(data)\n frame = WebSocket::Frame::Outgoing::Client.new version: @handshake.version,\n data: data, type: :text\n @socket.send frame.to_s, 0\n end",
"def makeframe(packetdata)\n\t\tif packetdata.size > 255\n\t\t\tprint_error(\"#{rhost}:#{rport} - MODBUS - Packet too large: #{packetdata.inspect}\")\n\t\t\treturn\n\t\tend\n\t\tpayload = \"\"\n\t\tpayload += [@modbuscounter].pack(\"n\")\n\t\tpayload += \"\\x00\\x00\\x00\" #dunno what these are\n\t\tpayload += [packetdata.size].pack(\"c\") # size byte\n\t\tpayload += packetdata\n\tend",
"def create\n @heartbeat = current_user.heartbeats.build(heartbeat_params)\n\n respond_to do |format|\n if @heartbeat.save\n format.html { redirect_to @heartbeat, notice: 'Heartbeat Record Created' }\n format.json { render :show, status: :created, location: @heartbeat }\n else\n format.html { render :new }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_heartbeat\n if tcp_connection_established? && !@handling_skipped_hearbeats && @last_server_heartbeat\n if @last_server_heartbeat < (Time.now - (self.heartbeat_interval * 2)) && !reconnecting?\n logger.error \"[amqp] Detected missing server heartbeats\"\n self.handle_skipped_hearbeats\n end\n send_frame(Protocol::HeartbeatFrame)\n end\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 send_heartbeat(test_req_id = nil)\n msg = FP::Messages::Heartbeat.new\n test_req_id && msg.test_req_id = test_req_id\n send_msg(msg)\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 write frame\n @socket.write frame\n end",
"def send_frame(command, headers={}, body='')\n headers['content-length'] = body.size.to_s\n response = StompServer::StompFrame.new(command, headers, body)\n stomp_send_data(response)\n end",
"def next_heartbeat\n Time.now + heartbeat_interval.to_f / 1000.0\n end",
"def sample_packhdr_be_nsec\n \"\\xA1\\xB2<M\" +\n \"S\\xFEn')6\\xA0)\\x00\\x00\\x02\\x1F\\x00\\x00\\x02\\x1F\" +\n \"\\x00\\x00\\xFF\\xFF\\x00\\x00\\x00\\x01\" # padding\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"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 date_time_grouping; 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 time_accounted_month_wise_data\n\t\tduration,method_name=\"month\",'time_accounted_month_wise'\n\t\ttime_accounted(duration,method_name)\n\t\tset_title(\"#{@user.full_name.titleize}'s Time Accounted -Month wise\")\n\t\tset_sub_caption\n\tend",
"def time_spent; end",
"def hour_metrics; end",
"def total_hours \n @total_hours ||= timesheets \n .where('day BETWEEN ? AND ?', Date.today.beginning_of_week, Date.today.end_of_week)\n .sum {|p| p.teacher + p.conversation + p.study} \n end",
"def get_total_time_swam\n relay_timings = meeting_relay_swimmers.collect { |mrs| mrs.get_timing_instance.to_hundreds }\n ind_timings = meeting_individual_results.collect { |mir| mir.get_timing_instance.to_hundreds }\n total_hundreds = (relay_timings + ind_timings).inject { |sum, hundreds| sum + hundreds }\n Timing.new(total_hundreds)\n end",
"def booked_time_for_year(event, unit)\n year = event.starts_at.year\n Event\n .where.not(id: event.id)\n .where(calendars.present? ? {calendar: calendars} : nil)\n .where(kinds.present? ? {kind: kinds} : nil)\n .where(creator: event.household_users)\n .where(starts_at: Time.zone.local(year)...Time.zone.local(year + 1))\n .to_a.sum(&unit)\n end",
"def skill_time_vs_completed_tasks\n\n end",
"def time_accounted_and_creditable_month_wise_data\n\t\tduration,method_name=\"creditable_month\",'time_accounted_and_creditable_month_wise'\n\t\ttime_accounted_and_creditable(duration,method_name)\n\t\tset_title(\"#{@user.full_name.titleize}'s Time Accounted vs. Creditable - Month wise\")\n\t\tset_sub_caption\n\tend",
"def time_accounted_and_creditable_week_wise_data\n\t\tduration,method_name=\"creditable_week\",'time_accounted_and_creditable_week_wise'\n\t\ttime_accounted_and_creditable(duration,method_name)\n\t\tset_title(\"#{@user.full_name.titleize}'s Time Accounted vs. Creditable - Week wise\")\n\t\tset_sub_caption\n\tend",
"def usage_summary(now=DateTime.now)\n summary = {\n this_month: { secs: 0, hours: 0, overage: {}, ondemand: {}, cost: 0.00 },\n current: [],\n history: [],\n }\n year = now.utc.year\n month = now.utc.month\n thismonth = sprintf(\"%d-%02d\", year, month)\n summary[:this_month][:period] = thismonth\n monthly_usages.order('\"yearmonth\" desc, \"use\" asc').slice(0,48).each do |mu|\n msum = {\n period: mu.yearmonth,\n type: mu.use,\n secs: mu.value.to_i,\n hours: mu.value.fdiv(3600).round(3),\n cost: mu.retail_cost.round(2), # expose only what we charge customers, whether we charge them or not.\n }\n summary[:history].push msum\n if mu.yearmonth == thismonth\n summary[:current].push msum\n end\n end\n\n # calculate current totals based on the User's plan. This determines overages.\n plan_hours = plan.hours\n base_monthly_cost = plan.amount # TODO??\n plan_is_premium = plan.has_premium_transcripts?\n\n # if plan is \"basic\", calculate ondemand premium and overages.\n if !plan_is_premium\n summary[:current].each do |msum|\n\n # if there is premium usage, it must be on-demand, so pass on the msum cost.\n if msum[:type] == MonthlyUsage::PREMIUM_TRANSCRIPTS && msum[:hours] > 0\n summary[:this_month][:ondemand][:cost] = msum[:cost]\n summary[:this_month][:ondemand][:hours] = msum[:hours].round(3)\n summary[:this_month][:cost] += msum[:cost]\n summary[:this_month][:hours] += msum[:hours].round(3)\n summary[:this_month][:secs] += msum[:secs]\n\n # basic plan, basic usage.\n elsif msum[:type] == MonthlyUsage::BASIC_TRANSCRIPTS\n\n # month-to-date hours\n summary[:this_month][:hours] += msum[:hours].round(3)\n summary[:this_month][:secs] += msum[:secs]\n\n # check for overage\n if msum[:hours] > plan_hours\n summary[:this_month][:overage][:hours] = msum[:hours] - plan_hours\n # we do not charge for basic plan overages. instead we just prevent them at upload time.\n #summary[:this_month][:overage][:cost] = (OVERAGE_HOURLY_RATE * summary[:this_month][:overage][:hours]).round(2)\n #summary[:this_month][:cost] += summary[:this_month][:overage][:cost]\n end\n end\n end\n\n # otherwise, plan is premium. sum this month and check for overages only.\n else\n summary[:current].each do |msum|\n #Don't double count usage for users in orgs.\n if !(msum[:type] == MonthlyUsage::PREMIUM_TRANSCRIPT_USAGE && self.organization)\n summary[:this_month][:hours] += msum[:hours].round(3)\n summary[:this_month][:secs] += msum[:secs]\n summary[:this_month][:cost] += msum[:cost]\n end\n if msum[:type] == MonthlyUsage::PREMIUM_TRANSCRIPTS\n if msum[:hours] > plan_hours\n summary[:this_month][:overage][:hours] = msum[:hours] - plan_hours\n summary[:this_month][:overage][:cost] = (OVERAGE_HOURLY_RATE * summary[:this_month][:overage][:hours]).round(2)\n summary[:this_month][:cost] += summary[:this_month][:overage][:cost]\n end\n end\n end\n if summary[:this_month][:overage][:cost]\n # since we had an overage for the month, ignore any specific retail costs for this month,\n # and treat the overage as the total for the month. This is because we don't want to charge 2x\n # if an on-demand retail cost contributed to the overage.\n summary[:this_month][:cost] = summary[:this_month][:overage][:cost]\n end\n end\n\n # return\n summary\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 work_hours_per_year\n (52 - paid_time_off_week_count) * 40\n end",
"def time_accounted_week_wise_data\n\t\tduration,method_name=\"week\",'time_accounted_week_wise'\n\t\ttime_accounted(duration,method_name)\n\t\tset_title(\"#{@user.full_name.titleize}'s Time Accounted -Week wise\")\n\t\tset_sub_caption\n\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /stay_times GET /stay_times.json | def index
@stay_times = StayTime.all
end | [
"def index\n get_todays_data\n\n respond_to do |format|\n format.html { }\n format.json { json_response(@set_times) }\n end\n end",
"def index\n @time_entries = TimeEntry.all\n render :json => @time_entries, status: :ok\n end",
"def index\n \n @task_times = @task.task_times.order(\"stopped_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_times }\n end\n end",
"def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end",
"def index\n @timekeepings = Timekeeping.all\n end",
"def list\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 @meeting_times = MeetingTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_times }\n end\n end",
"def index\n @class_times = ClassTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @class_times }\n end\n end",
"def index\n @time_slots = TimeSlot.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@time_slots) }\n\t\tend\n end",
"def test_get_all_times\n url = format('%s/times?token=%s', @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times,\n [Hash['this' => 'should be in a list']])\n end",
"def index\n @meal_times = MealTime.all\n end",
"def index\n @available_times = AvailableTime.all\n end",
"def index\n render json: Roomservice.where(stay_id: params[:stay_id])\n end",
"def index\n @timetable_class_times = TimetableClassTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @timetable_class_times }\n end\n end",
"def index\n\t\t@war_times = @war.war_times\n\tend",
"def test_get_time_for_activity\n url = format('%s/times?activity=dev&token=%s',\n @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(Hash['activity' => ['dev']]),\n [Hash['this' => 'should be in a list']])\n end",
"def index\n @stop_times = StopTime.all\n respond_to do |format|\n format.html { render :index }\n format.xml { render xml: @stop_times, status: :ok }\n format.json { render json: @stop_times, status: :ok }\n end\n end",
"def index\n @service_times = ServiceTime.all\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
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 | [
"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\t\t@war_time = WarTime.new(war_time_params)\n\t\t@war_time.war = @war\n\n\t\trespond_to do |format|\n\t\t\tif @war_time.save\n\t\t\t\tback_page = war_times_path(@war)\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Time was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: back_page }\n\t\t\telse\n\t\t\t\tformat.html { broadcast_errors @war_time, (['start_at', 'end_at', 'max_unanswered']) }\n\t\t\t\tformat.json { render json: @war_time.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"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 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 #@timekeeping = Timekeeping.new(timekeeping_params)\n\t@timekeeping = Timekeeping.new\n\t@timekeeping.clock_in = DateTime.current\n respond_to do |format|\n if @timekeeping.save\n format.html { redirect_to @timekeeping, notice: 'Timekeeping was successfully created.' }\n format.json { render :show, status: :created, location: @timekeeping }\n else\n format.html { render :new }\n format.json { render json: @timekeeping.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 @tummy_time = TummyTime.new(tummy_time_params)\n\n respond_to do |format|\n if @tummy_time.save\n format.html { redirect_to @tummy_time, notice: 'Tummy time was successfully created.' }\n format.json { render :show, status: :created, location: @tummy_time }\n else\n format.html { render :new }\n format.json { render json: @tummy_time.errors, status: :unprocessable_entity }\n end\n end\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 @appointment_time = AppointmentTime.new(appointment_time_params)\n\n respond_to do |format|\n if @appointment_time.save\n format.html { redirect_to @appointment_time, notice: 'Appointment time was successfully created.' }\n format.json { render :show, status: :created, location: @appointment_time }\n else\n format.html { render :new }\n format.json { render json: @appointment_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_time = @task.task_times.build(params[:task_time])\n\n respond_to do |format|\n if @task_time.save\n format.html { redirect_to task_time_path(@task,@task_time), notice: 'Task time was successfully created.' }\n format.json { render json: @task_time, status: :created, location: @task_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tee_time = TeeTime.new(tee_time_params)\n\n respond_to do |format|\n if @tee_time.save\n format.html { redirect_to root_url }\n format.json { render :show, status: :created, location: @tee_time }\n else\n format.html { render :new }\n format.json { render json: @tee_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_availalbe = TimeAvailable.new(params[:time_availalbe])\n\n respond_to do |format|\n if @time_availalbe.save\n format.html { redirect_to @time_availalbe, :notice => 'Time Available was successfully created.' }\n format.json { render :json => @time_availalbe, :status => :created, :location => @time_availalbe }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @time_availalbe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def available_worktimes\n place_id = extract_id(params, :place)\n @place = Place.find_by_id(place_id)\n speciality_id = extract_id(params, :speciality)\n @speciality = Speciality.find_by_id(speciality_id)\n doctor_id = extract_id(params, :doctor)\n @doctor = User.find_by_id(doctor_id)\n @patient = User.find_by_id(params[:patient_id])\n if params[:take_time_into_account]\n # HACK -> parsing parameters\n start = Worktime.new(params[:date_time]).start_date \n else\n start = Date.today.to_date\n end\n @days = [ start.to_date ]\n for i in [1,2,3,4] \n @days << start.to_date + i.day\n end\n respond_to do |format|\n format.html { render :template => \"visit_reservations/available_worktimes\" }\n end\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"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 4