query
stringlengths
7
9.5k
document
stringlengths
10
1.07M
negatives
sequencelengths
19
19
metadata
dict
Swktch on / off marking on the current file or directory.
def toggle_mark main.toggle_mark current_item end
[ "def change_flag\n @flagged = !@flagged unless revealed?\n end", "def mark!\n\t\t\t\t@marked = true\n\t\t\tend", "def mark_current\n @mark = @current\n end", "def toggle\n if on?\n off\n else\n on\n end\n end", "def switch_flag\n\t\t@flag = !@flag\n\tend", "def toggle!\n if on?\n off!\n elsif off?\n on!\n end\n end", "def switchOverWrite\n @overWrite = !@overWrite\n updateLastCmd \"OverWriteMode\"\n end", "def mark_working!; self.status = 1 end", "def toggle_state\n puts \"******* toggle_state *******\"\n end", "def markSyncOperations\n #N Without this, the sync operations won't be marked\n @sourceContent.markSyncOperationsForDestination(@destinationContent)\n #N Without these puts statements, the user won't receive feedback about what sync operations (i.e. copies and deletes) are marked for execution\n puts \" ================================================ \"\n puts \"After marking for sync --\"\n puts \"\"\n puts \"Local:\"\n #N Without this, the user won't see what local files and directories are marked for copying (i.e. upload)\n @sourceContent.showIndented()\n puts \"\"\n puts \"Remote:\"\n #N Without this, the user won't see what remote files and directories are marked for deleting\n @destinationContent.showIndented()\n end", "def turn_on!\n @turned_off = false\n end", "def mark!(force = false)\n if force or changing?\n mark.blank? ? self.mark = Mark.new(:changed_at => Time.now) : self.mark.changed_at = Time.now\n self.mark.save\n end\n end", "def put_hat_on\n self.hat_state = true\n end", "def toggle\n toggle_icon_display\n restart_finder\n icons_showing?\n end", "def preserving_flags\n original_file_flags = file_flags\n if original_file_flags == \"0\"\n yield\n else\n begin\n system(\"chflags\", \"0\", path)\n yield\n ensure\n system(\"chflags\", original_file_flags, path)\n end\n end\n end", "def toggle_on(outlet = 1)\n toggle(outlet, true)\n end", "def mark_as_shore\n @water_mode = :shore\n end", "def mark_changed\n @changed = true\n end", "def toggle_marking_state\n @result = record\n @old_marking_state = @result.marking_state\n\n if @result.marking_state == Result::MARKING_STATES[:complete]\n @result.marking_state = Result::MARKING_STATES[:incomplete]\n else\n @result.marking_state = Result::MARKING_STATES[:complete]\n end\n\n if @result.save\n head :ok\n else # Failed to pass validations\n # Show error message\n flash_now(:error, @result.errors.full_messages.join(' ;'))\n head :bad_request\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accept user input, and directly execute it as a Ruby method call to the controller. ==== Parameters +preset_command+ A command that would be displayed at the command line before user input. +default_argument+ A default argument for the command.
def process_command_line(preset_command: nil, default_argument: nil) prompt = preset_command ? ":#{preset_command} " : ':' command_line.set_prompt prompt cmd, *args = command_line.get_command(prompt: prompt, default: default_argument).split(' ') if cmd && !cmd.empty? && respond_to?(cmd) ret = self.public_send cmd, *args clear_command_line ret end rescue Interrupt clear_command_line end
[ "def pre_cmd(input); end", "def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend", "def deliver(default = nil)\n # Design decision: the pre-prompt behavior\n # gets evaluated *once*, not every time the\n # user gets prompted. This prevents multiple\n # evaluations when bad options are provided.\n _eval_pre if @pre\n\n valid_option_chosen = false\n until valid_option_chosen\n response = messenger.prompt(@prompt_text, default)\n if validate(response)\n valid_option_chosen = true\n @answer = evaluate_behaviors(response)\n _eval_post if @post\n else\n messenger.error(@last_error_message)\n end\n end\n end", "def invoke_command(input)\n # Mithril.logger.debug \"#{class_name}.invoke_command(), text =\" +\n # \" #{text.inspect}, session = #{request.session.inspect}, proxy =\" +\n # \" #{proxy}\"\n \n if self.proxy.nil?\n super\n elsif self.allow_own_actions_while_proxied? && self.can_invoke_on_self?(input)\n super\n elsif proxy.can_invoke? input\n proxy.invoke_command input\n else\n command_missing(input)\n end # if-elsif-else\n end", "def default_command(command)\n @@default_command = command.to_sym\n end", "def default_command(command_name)\n @default_command = command_name\n end", "def default_command(command)\n @default_command = command.to_sym\n end", "def run(input, options = {})\n command = Command.new(options: options)\n yield(command) if block_given?\n command.run(input)\n end", "def call_command\n verb = match.captures[match.names.index('command')]\n verb = verb.downcase if verb\n public_send(verb)\n end", "def default_command(name = nil)\n @default_command = name unless name.nil?\n @default_command\n end", "def process_command_input(command)\n dc_command = command.downcase\n if dc_command.start_with?(/show all by/i)\n command.slice!(/show all by/i)\n args = retrieve_args(command)\n Album.show_where(nil, args[0])\n\n elsif dc_command.start_with?(/show all/i)\n Album.show_all\n\n elsif dc_command.start_with?(/show unplayed by/i)\n command.slice!(/show unplayed by/i)\n args = retrieve_args(command)\n Album.show_where(false, args[0])\n\n elsif command.start_with?(/show unplayed/i)\n Album.show_where(false, nil)\n\n elsif dc_command.start_with?(/show played by/i)\n command.slice!(/show played by/i)\n args = retrieve_args(command)\n Album.show_where(true, args[0])\n\n elsif command.start_with?(/show played/i)\n Album.show_where(true, nil)\n\n elsif dc_command.start_with?(/add/i)\n command.slice!(\"add\")\n args = retrieve_args(command)\n Album.fabricate(args[0], args[1])\n\n elsif dc_command.start_with?(/play/i)\n command.slice!(\"play\")\n args = retrieve_args(command)\n Album.play(args[0])\n\n elsif dc_command.start_with?(/remove/i)\n command.slice!(\"remove\")\n args = retrieve_args(command)\n Album.remove(args[0])\n else\n puts \"Command not found: #{command}\" \n end\nend", "def terminal_action=(_arg0); end", "def handle_input_file_or_command(str, options)\n if options.input.nil?\n # No input source was specified yet, so this is the input file.\n confirm_input_file_viability(str)\n options.input = File.open(str,\"r\")\n\n else\n # We already have an input source, so this must be a command.\n # Store it in an array, so that arguments to this command can be extracted\n # from ARGV and added into here later\n raise Error.new(\"Multiple commands were specified\") unless options.command.nil?\n options.command = [str]\n end\nend", "def default_command name\n @default_command = name\n end", "def call_command\n verb = match.captures[match.names.index('command')]\n verb = normalize_command_string(verb)\n public_send(verb)\n end", "def send_command_prompt\n send_data options[:command_prompt]\n end", "def execute\r\n $LOG.debug \"ParseDecisionApp::execute\"\r\n\r\n\t options = @user_choices\r\n if(!options[:logging])\r\n\t\toptions[:logging] = false\r\n end\r\n \r\n if(@user_choices[:which])\r\n puts \"Location: #{$0}\"\r\n return\r\n end\r\n \r\n @controller.setOptions(options)\r\n\t \r\n\t if(@user_choices[:cmdArg].empty?) # If no cmd line arg...\r\n if( !@controller.noCmdLineArg() )\r\n\t\t\treturn\r\n\t\tend\r\n else\r\n\t\t if( !@controller.executeWithCmdLineArg(@user_choices[:cmdArg]) )\r\n\t\t\treturn\r\n\t\t end\r\n\t end\r\n \r\n @controller.execute()\r\n end", "def get_default_or_custom\n loop do\n puts \"Please enter 'default' to use the default options or 'custom'\"\n print \"to enter your own: \"\n default_or_custom = gets.chomp.downcase\n redo if default_or_custom != \"default\" && default_or_custom != \"custom\"\n return default_or_custom\n end\nend", "def process(option, arg)\n option.ensure_call(arg)\n option\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert angle into radian
def to_rad(angle) angle * Math::PI / 180 end
[ "def to_radian(r)\n r % 180.0 if r >= 180.0 || r <= -180.0\n r * Math::PI / 180.0\n end", "def rad2rad(rad)\r\n remt(rad, PI2)\r\n end", "def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend", "def radian(degree)\n degree*(Math::PI/180)\n end", "def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end", "def degrees_to_radians(angle)\n angle * Math::PI / 180\n end", "def ac_radian\n ang12 = Math.atan2(@p2.curr.y - @p1.curr.y, @p2.curr.x - @p1.curr.x)\n ang23 = Math.atan2(@p3.curr.y - @p2.curr.y, @p3.curr.x - @p2.curr.x)\n ang12 - ang23\n end", "def radians_to_degrees(); end", "def g2r(n)\n\tn*(Math::PI/180)\nend", "def degrees_to_radians(); end", "def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end", "def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end", "def deg2rad(deg)\n deg.to_f * Math::PI / 180.0\n end", "def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end", "def radians\n Science::Angle.new(self, :radians)\n end", "def rate_of_turn(angle, speed)\n anglr = angle * Math::PI / 180\n rot = (1091 * Math::tan(anglr)) / speed\n rot\nend", "def normalize_angle(angle)\n if angle > Math::PI\n angle - 2 * Math::PI\n elsif angle < -Math::PI\n angle + 2 * Math::PI\n else\n angle\n end\nend", "def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end", "def declination_rad\n if @declination_rad.nil?\n @declination_rad = inclination_rad - PI / 2\n @declination_rad -= PI / 2 while @declination_rad > PI / 2\n end\n @declination_rad\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /rows/1 GET /rows/1.xml
def show @row = Row.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @row } end end
[ "def result2_data_rows(experiment_id, uri, table, columns)\n data_rows = []\n\n req = Net::HTTP::Post.new(uri.path)\n\n xml = REXML::Document.new\n request = xml.add_element('request', 'id' => 'foo')\n request.add_element('result').add_element('format').add_text('xml')\n query = request.add_element('query')\n query.add_element('repository', 'name' => experiment_id)\n query.add_element('table', 'tname' => table)\n project = query.add_element('project')\n\n columns.each do |m|\n project.add_element('arg').add_element('col', 'name' => m.to_s, 'table' => table)\n end\n\n req.body = xml.to_s\n\n result = Net::HTTP.start(uri.host, uri.port) do |http|\n res = http.request(req)\n res.body\n end\n\n\n result_doc = REXML::Document.new(result)\n REXML::XPath.each(result_doc, '//omf:r', 'omf'=> RESULT2_NAMESPACE).each do |r|\n row = REXML::XPath.each(r, 'omf:c', 'omf'=> RESULT2_NAMESPACE).map {|v| v.text.auto_parse }\n data_rows << row\n end\n\n data_rows\nend", "def index\n\t\tload_rows\n\t respond_to do |format|\n\t \tformat.html # index.html.erb\n\t \tformat.xml { render :xml => @logrows }\n\t end\n\tend", "def index\n @lines = Line.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lines }\n end\n end", "def do_GET(req, res)\n domain, resource, id, format = parse_request_path(req.path_info)\n if domain && resource && id && format == 'xml' # element or query\n unless id == 'query'\n attributes = sdb_get_item(domain, \"#{resource}_#{id}\")\n raise WEBrick::HTTPStatus::NotFound unless attributes\n res.body = to_xml(resource, attributes)\n else\n logger.debug \"Query string: #{req.query.inspect}\"\n items = sdb_get_items(domain, resource, req.query.keys.first).collect {|item| sdb_get_item(domain, item) }\n res.body = to_xml_array(resource, items)\n end\n\n elsif domain && resource && format == 'xml' # collection\n logger.debug \"Additonal query params: #{req.query.inspect}\"\n items = sdb_get_items(domain, resource, req.query).collect {|item| sdb_get_item(domain, item) }\n res.body = to_xml_array(resource, items)\n\n else # unsupported format\n raise WEBrick::HTTPStatus::UnsupportedMediaType, \"Only XML formatted requests are supported.\"\n end\n logger.debug \"Fetched requested item(s), responding with:\\n#{res.body}\"\n res['Content-Type'] = \"application/xml\"\n raise WEBrick::HTTPStatus::OK\n end", "def show\n @logrow = Logrow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @logrow }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def couchdb_view__all_rows(doc_id, limit, skip)\n data = []\n\n doc_id = doc_id.to_i #verify the id is really an int\n limit = limit.to_s\n skip = skip.to_s\n\n conn_hash = get_http_connection_hash\n\n conn_str = \"/#{get_database_name}/_design/all_rows/_view/view1\"\n\n startkey = \"\\\"Document-#{doc_id.to_s}\\\"\"\n endkey = \"\\\"Document-#{doc_id.to_s}\\\"\"\n\n conn_str += \"?startkey=\" + CGI.escape(startkey)\n conn_str += \"&endkey=\" + CGI.escape(endkey)\n\n conn_str += \"&limit=\" + CGI.escape(limit)\n conn_str += \"&skip=\" + CGI.escape(skip)\n\n http = Net::HTTP.new(conn_hash[:host], conn_hash[:port])\n\n if conn_hash[:https] == true\n http.use_ssl = true\n end\n\n data = []\n http.start do |http|\n req = Net::HTTP::Get.new(conn_str)\n\n if conn_hash[:https] == true\n req.basic_auth(conn_hash[:username], conn_hash[:password])\n end\n\n data = JSON.parse(http.request(req).body)[\"rows\"]\n end\n\n if data == nil\n data = []\n end\n\n return data\n end", "def show\n @datashows = Datashow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datashows }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def fetch_row\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def process_query(klass, url, just_xml = false, opts = {})\n\n #args = postfields(opts)\n #h = compute_hash(args.merge(:url => url))\n #return h if h\n\n @last_hash = compute_hash(opts.merge({:url => url, :just_hash => true })) # compute hash\n\n\n xml = check_exception(get_xml(url,opts))\n save_xml(xml) if @save_path\n\n return xml if just_xml\n return [] if xml.nil? # No XML document returned. We should panic.\n\n # Create the array of klass objects to return, assume we start with an empty set from the XML search for rows\n # and build from there.\n xml.search(\"//rowset/row\").inject([]) { |ret,elem| ret << klass.new(elem) }\n end", "def show\n @task_row = TaskRow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_row }\n end\n end", "def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end", "def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end", "def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serves predictions for the buyers
def predictions raise "Err" buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20) render json: buyer_suggestions, status: 200 end
[ "def predict\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\n\t\t# Game_date and @players transformed to JSON and send to API in order to fetch player predictions\n\t\t@game_date = params[:game_date]\n\t\t@players = params[:players] \n\n\t\t# API Returns player predictions\n\t\t\t#first look in database, and if predictions already exist, pull from here\n\t\t\t#else get request to API, and API returns predictions\n\n\t\t# Temp fake data is returned instead // modify this to store into database instead of this weird Array/Url string voodoo\n\t\t@array = Array.new\n\t\t8.times do\n\t\t @array.push Faker::Name.name\n\t\tend\n\n\t\trender(\"sports/predict/\", :notice => \"Successfully fetched player predictions from API.\")\n\t\t\n\tend", "def predictions\n @predictions ||= Prediction.predict_for(self)\n end", "def get_predictions\n return @predictions if @predictions\n return nil unless @prediction_dataset_uri\n @predictions = Reports.ot_access.get_predictions( @test_dataset_uri, @prediction_dataset_uri )\n end", "def predict(x)\n @best_estimator.predict(x)\n end", "def index\n @predictions = Prediction.all\n end", "def run_predictions(test_data)\n\t\tall_predictions = []\n\t\ttest_data.each do |arr|\n\t\t\tall_predictions << (arr << predict(arr[0], arr[1]))\n\t\tend\n\t\tall_predictions\n\tend", "def index\n @earnings_predictions = EarningsPrediction.all\n end", "def predict(predictive_users, movie_id, user_id)\n score = 0.0\n total = 0.0\n tally = 0.0\n predictive_users.each do |user|\n score = rating(user, movie_id).to_i #Takes the average score of users in the predictive \n #array and sets that to the prediction. \n if score != 0\n total += score\n tally += 1\n end\n end\n \n base_prediction = (total / tally).to_f\n prediction = prediction_modifiers(base_prediction, movie_id, user_id)\n return prediction\n end", "def predict_rating(user,film)\r\n f_amount=SVD_param.find_by_name(@f_amoun_str).value.to_i\r\n\r\n mu=SVD_param.find_by_name(@global_predictor_str).value\r\n user_prd=user.base_predictor\r\n film_prd=film.base_predictor\r\n\r\n baseline=mu+user_prd+film_prd\r\n\r\n user_f_vect=create_user_factor_vector(user.id)\r\n film_f_vect=create_film_factor_vector(film.id)\r\n\r\n prediction=baseline + multiply_vectors(\r\n film_f_vect,\r\n user_f_vect\r\n )\r\n return prediction\r\n end", "def index\r\n @predictions = Prediction.all\r\n end", "def payment_predictions\n @results = Project.payment_prediction_results(@account, params, @start_date, @end_date)\n @totals = Project.payment_prediction_totals(@account, params, @start_date, @end_date)\n end", "def predict inputs #Virtual\n\t\t@machine.run(inputs)\n\tend", "def index\n @prediction = Prediction.all\n end", "def predict\r\n\t\tif Ip.count == 0\r\n\t\t\tflash[:notice] = \"Investors haven't been trained.\"\r\n\t\t\treturn\r\n\t\tend\r\n\t\t \r\n quote_types = User.find(session[:user_id]).profiles.map{|x| x.quote_type}.uniq\r\n if quote_types.size == 1 # Check if quote type is unified\r\n case quote_types[0] \r\n when 'Weekly' : @rfr = 0.0413 / 50\r\n when 'Daily' : @rfr = 0.0413 / 360\r\n end\r\n end # TODO: else warning?\r\n\r\n\t\t# Find the best investor, track back to its ip, back to pm, back to next pi\r\n\t\tbest = Ip.best_investor(@rfr)\r\n\t\t@best_investor = Investor.find(best.investor_id)\r\n \r\n case quote_types[0]\r\n when 'Weekly'\r\n @max_performance = (best.ror.to_f ** (1.0 / @best_investor.ips.count)) ** 50 - 1 # EAR\r\n when 'Daily'\r\n @max_performance = (best.ror.to_f ** (1.0 / @best_investor.ips.count)) ** 360 - 1\r\n end\r\n \r\n @final_pm = @best_investor.ips.find_by_date(@period_list.last).pm # Last day\r\n\r\n\t\t# Determine the portfolio structure in future\r\n\t\tfinal_pmp = @final_pm.pmps.find_by_actualized_date(@period_list.last)\r\n\t\tos = @period_list.index(final_pmp.optimized_date) # Trace back\r\n\t\tperiods_left = os - (@period_list.size - 1) + @final_pm.confidence\r\n\t\tif periods_left > 0 # Still within confidence period\r\n\t\t\t# Retrieve the original portfolio structure\r\n\t\t\t@prediction = @final_pm.pis.find_all_by_date(final_pmp.optimized_date)\r\n\t\telse\r\n\t\t\t# Confidence period is over. Have to re-optimize the portfolio\r\n @prediction = @final_pm.pis.find_all_by_date(@period_list.last)\r\n\t\tend\r\n\tend", "def predict(model, inputs)\n init_model(model).predict(inputs)\n end", "def predict(u, m)\r\n\t\tlist = movie_genre[m.to_s] #get list of genres of movie m\r\n\t\tgenre_info = user_genre_r[u.to_s] # get ratings of each genre made by user u\r\n\t\tif genre_info == nil || list == nil #making sure that I can actually make a prediction\r\n\t\t\treturn \"Sorry, info not found\"\r\n\t\tend\r\n\t\thold_info = Array.new\r\n\t\ti = 0\r\n\t\tlist.each do |genre|\r\n\t\t\tsum = 0\r\n\t\t\tratings = genre_info[genre]\r\n\t\t\tif ratings == nil #if user never rated the movie with that genre, then we skip and don't use that genre\r\n\t\t\t\tnext\r\n\t\t\telse\r\n\t\t\t\tratings.map{|x| sum+=x} #add all the ratings of that genre together\r\n\r\n\t\t\t\thold_info[i] = (sum*1.0/ratings.length) #holds average of the ratings of that genre\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\tsum_avg_ratings = 0 # will be used in the maping below\r\n\t\thold_info.map{|x| sum_avg_ratings+=x}\r\n\t\tif hold_info.length == 0 #if no prediction can be made -> I simply return the prediction of 4\r\n\t\t\treturn 4\r\n\t\tend\r\n\t\treturn ((sum_avg_ratings/hold_info.length)*100).to_i/100.0\r\n\tend", "def predict(object)\n liked_by, disliked_by = object.send :create_recommendable_sets\n rated_by = Recommendable.redis.scard(liked_by) + Recommendable.redis.scard(disliked_by)\n similarity_sum = 0.0\n prediction = 0.0\n \n Recommendable.redis.smembers(liked_by).inject(similarity_sum) {|sum, r| sum += Recommendable.redis.zscore(similarity_set, r).to_f }\n Recommendable.redis.smembers(disliked_by).inject(similarity_sum) {|sum, r| sum -= Recommendable.redis.zscore(similarity_set, r).to_f }\n \n prediction = similarity_sum / rated_by.to_f\n \n object.send :destroy_recommendable_sets\n \n return prediction\n end", "def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end", "def prediction_data(user_id, movie_id)\n if user_id != @user_marker\n @best_match.clear\n most_similar(user_id) #will return the top 20 best matched viewers.\n @user_marker = user_id\n end\n\n matched_movies = viewers(movie_id) #list of all users who saw the movie\n if matched_movies == 0\n prediction = 1\n return prediction\n end\n predictive_users = (@best_match & matched_movies) #sets our predictive data to be the subset \n # of best_match that has also seen this movie\n \n my_prediction = MoviePredictor.new(@user_hash, @movie_hash)\n \n if predictive_users.empty? \n return my_prediction.rating_average(movie_id)\n end\n \n return my_prediction.predict(predictive_users, movie_id, user_id)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
buyer tracking history curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4OCwiZXhwIjoxNTAzNTEwNzUyfQ.7zo4a8g4MTSTURpU5kfzGbMLVyYN_9dDTKIBvKLSvPo" '
def tracking_history buyer = user_valid_for_viewing?('Buyer') if !buyer.nil? events = Events::Track.where(buyer_id: buyer.id).order("created_at desc") results = events.map do |event| { udprn: event.udprn, hash_str: event.hash_str, type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking], created_at: event.created_at, tracking_id: event.id } end render json: results, status: 200 else render json: { message: 'Authorization failed' }, status: 401 end end
[ "def get_withdrawal_history\n # body = {\n # cmd: \"get_withdrawal_history\"\n # }\n\n end", "def send_return_history_request(attrs={})\n request = ReturnHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to_s)\n return response if request.raw_xml==true || request.raw_xml==1\n ReturnHistoryResponse.format(response)\n end", "def http_get_history( req )\n\n history = @history[ req[:challenge] ]\n\n unless history\n return { :status => STATUS_NOT_FOUND, :error => \"Could not find history (#{req[:challenge]}).\" }\n end\n\n { :status => STATUS_OK, :history => history }\n end", "def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend", "def history\n \tif user_signed_in?\n\t #base_url = \"https://www.bitstamp.net/api/ticker\"\n\t\t#response = RestClient.get base_url\n\t\t#data = JSON.load response\n\t\t#@bitstamp_his = data[\"last\"].to_f\n\t\t#@coinbase = Coinbase::Client.new('9MB2hsDaSXvbevZ4', 'Yakw1TObmQrL2k4OMGcCVZqpdNLsPO2S')\n\t \t#@coinbase_his = @coinbase.buy_price(1).to_f\n\t\t#x = PriceHistory.new\n\t \t#x.Bitstamp = @bitstamp_his\n\t \t#x.Coinbase= @coinbase_his\n\t\t#x.save\n\t\tresponse = PriceHistory.all\t\t\n\t\trender :json => response\n\n\n\tend\n end", "def access_headers(method, url, body)\n requested_at = timestamp\n\n {\n 'CB-ACCESS-KEY' => GDAX.api_key,\n 'CB-ACCESS-TIMESTAMP' => requested_at,\n 'CB-ACCESS-PASSPHRASE' => GDAX.api_passphrase,\n 'CB-ACCESS-SIGN' => sign(\"#{requested_at}#{method.upcase}#{url.path_with_query}#{body}\")\n }\n end", "def send_cancellation_history_request(attrs={})\n request = CancellationHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to_s)\n return response if request.raw_xml==true || request.raw_xml==1\n CancellationHistoryResponse.format(response)\n end", "def restHttpHeadFullURL(fullUrl, extra_headers = nil, format = @format, sessionId = @sessionId, client_id = \"vavedra9ub\")\n sessionId.should_not be_nil\n\n client_cert = OpenSSL::X509::Certificate.new File.read File.expand_path(\"../keys/#{client_id}.crt\", __FILE__)\n private_key = OpenSSL::PKey::RSA.new File.read File.expand_path(\"../keys/#{client_id}.key\", __FILE__)\n\n header = makeHeaders('head', sessionId, format)\n \n header.merge!(extra_headers) if extra_headers !=nil\n \n puts \"HEAD header: #{header}\"\n\n @res = RestClient::Request.execute(:method => :head, :url => fullUrl, :headers => header, :ssl_client_cert => client_cert, :ssl_client_key => private_key) {|response, request, result| response }\n#, :ssl_client_cert => client_cert, :ssl_client_key => private_key\n puts(@res.code,@res.body,@res.raw_headers) if $SLI_DEBUG\nend", "def token_metadata(request)\n gateway_request('GET', '/api/token/' + request[:token], request)\n end", "def auth_request_x_header\n @auth_request_x_header\n end", "def restHttpHead(id, extra_headers = nil, format = @format, sessionId = @sessionId, client_id = \"vavedra9ub\")\n sessionId.should_not be_nil\n\n client_cert = OpenSSL::X509::Certificate.new File.read File.expand_path(\"../keys/#{client_id}.crt\", __FILE__)\n private_key = OpenSSL::PKey::RSA.new File.read File.expand_path(\"../keys/#{client_id}.key\", __FILE__)\n\n urlHeader = makeUrlAndHeaders('head',id,sessionId,format)\n \n header = urlHeader[:headers]\n header.merge!(extra_headers) if extra_headers !=nil\n \n puts \"HEAD urlHeader: #{urlHeader}\" if $SLI_DEBUG\n\n @res = RestClient::Request.execute(:method => :head, :url => urlHeader[:url], :headers => header, :ssl_client_cert => client_cert, :ssl_client_key => private_key) {|response, request, result| response }\n puts(@res.code,@res.raw_headers) if $SLI_DEBUG\n return @res\nend", "def user_purchases_get_purchase_history_unified user_id, store_id: nil, food_only: nil, upc_only: nil, show_product_details: nil, receipts_only: nil, upc_resolved_after: nil\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{user_id}/purchases_product_based\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"user_id\" => user_id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"store_id\" => store_id,\n \"food_only\" => food_only,\n \"upc_only\" => upc_only,\n \"show_product_details\" => show_product_details,\n \"receipts_only\" => receipts_only,\n \"upc_resolved_after\" => upc_resolved_after,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def owner_information\n OrderItem.all.order('id DESC')\n .where(\"context IS NOT NULL\")\n .map { |item| JSON.parse(Base64.decode64(item.context['headers']['x-rh-identity'])) }\n .map { |item| [item.dig('identity', 'user', 'username'), item.with_indifferent_access] }\n .to_h\n end", "def get_username_history(username)\n response = get(\"http://api.fishbans.com/history/#{username}\")\n response['data']['history']\n end", "def api_signature\n ts = timestamp\n [\n Rackspace::Email::Api.configuration.user_key,\n ts,\n hash(ts)\n ].join(':')\n end", "def history\n # retrieves a paginated list of the current user's purchases\n @purchases = current_user.purchases.page params[:page]\n end", "def auth_data\n index_map = {\n 0 => :version,\n 1 => :ghost_ip,\n 2 => :client_ip,\n 3 => :timestamp,\n 4 => :uniqid,\n 5 => :nonce\n }\n \n data = {}\n env[\"HTTP_X_AKAMAI_G2O_AUTH_DATA\"].split(\",\").each_with_index {|value, index|\n data[index_map[index.to_i]] = value.strip\n }\n data\n end", "def getHMACFromDeleteConfirmationPage(id, cookies)\n url = 'https://news.ycombinator.com/delete-confirm?id=' + id.to_s\n ret = RestClient.get url, :user_agent => \"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\", :cookies => cookies\n splits = ret.split('\"hmac\" value=\"')\n right_side = splits[1]\n hmac = right_side.split('\"').first\n hmac\nend", "def get_client_throughput_time_series_data(args = {}) \n get(\"/clients.json/stats/throughput\", args)\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get tracking stats for a buyer curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" "
def tracking_stats buyer = @current_user property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count stats = { type: (buyer.is_premium? ? 'Premium' : 'Standard'), locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s], street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s], property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s], locality_tracking_count: locality_tracking_count, property_tracking_count: property_tracking_count, street_tracking_count: street_tracking_count } render json: stats, status: 200 end
[ "def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend", "def buyer_profile_stats\n buyer_profile_stats = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).buyer_profile_stats\n render json: buyer_profile_stats, status: 200\n end", "def statistics(canvas_account_id)\n options = {\n :headers => @headers\n }\n\n account_stats_path = \"#{@host}/api/v1/accounts/#{canvas_account_id}/analytics/terms/#{@term}/statistics\"\n account_stats_result = self.class.get(account_stats_path, options)\n\n# adding the account id to a hash for merging with the statistics\n h1 = {\"canvas_account_id\" => \"#{canvas_account_id}\"}\n\n# merging my custom hash with the canvas feed\n h1.merge!(account_stats_result)\n account_stats_result.replace(h1)\n\n statistics = account_stats_result\n statistics\n\n end", "def buyer_stats_for_enquiry\n enquiry_id = params[:enquiry_id].to_i\n event = Event.unscope(where: :is_developer).where(id: enquiry_id).select([:buyer_id, :udprn, :agent_id]).first\n if event\n if event.agent_id == @current_user.id\n agent_service = Enquiries::AgentService\n view_ratio = agent_service.buyer_views(event.buyer_id, event.udprn)\n enquiry_ratio = agent_service.buyer_enquiries(event.buyer_id, event.udprn)\n render json: { views: view_ratio, enquiries: enquiry_ratio }\n else\n render json: { message: 'Agent is not attached to the property' }, status: 400\n end\n else\n render json: { message: 'Enquiry not found' }, status: 404\n end\n end", "def referral_stats\n account_name = stats_params[:id]\n stat = RefererStat.where(network: network, referer_name: account_name).select(:basic, :annual, :lifetime).first\n if stat\n render status: :ok, json: {account: account_name, stats: stat}\n else\n render status: :not_found, json: { error: { base: [\"not_found\"] }}\n end\n end", "def get_group_buy_statistics_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StatisticsApi.get_group_buy_statistics ...\"\n end\n # resource path\n local_var_path = \"/statistics/group_buy\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GroupBuyStatistics')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StatisticsApi#get_group_buy_statistics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_client_throughput_time_series_data(args = {}) \n get(\"/clients.json/stats/throughput\", args)\nend", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def get_basic_statistics(name)\n if name =~ /^\\s*$/\n return {\"error\" => \"No username provided.\"}\n end\n\n get_data(\"https://battlefieldtracker.com/bf1/api/Stats/BasicStats?platform=3&displayName=#{name}\")\n end", "def stats\n request :get, \"_stats\"\n end", "def get_detailed_statistics(name)\n if name =~ /^\\s*$/\n return {\"error\" => \"No username provided.\"}\n end\n\n get_data(\"https://battlefieldtracker.com/bf1/api/Stats/DetailedStats?platform=3&displayName=#{name}\")\n end", "def vendor_details\n authenticate_request('Vendor')\n if @current_user\n vendor_details = @current_user.as_json\n yearly_quote_count = Agents::Branches::AssignedAgents::Quote.where(vendor_id: @current_user.id).where(\"created_at > ?\", 1.year.ago).group(:property_id).select(\"count(id)\").to_a.count\n vendor_details[:yearly_quote_count] = yearly_quote_count\n vendor_details[:quote_limit] = Agents::Branches::AssignedAgents::Quote::VENDOR_LIMIT\n vendor_details[:is_premium] = @current_user.buyer.is_premium\n render json: vendor_details, status: 200\n end\n end", "def buyer_info(buyer_id)\n GunBroker::API.get('/Users/ContactInfo', { 'UserID' => buyer_id }, token_header(@token))\n end", "def buyer_profile_stats\n result_hash = {}\n property_id = @udprn.to_i\n details = PropertyDetails.details(udprn.to_i)['_source'] rescue {}\n #event = Event::EVENTS[:save_search_hash]\n\n query = Event\n buyer_ids = query.where(udprn: property_id).pluck(:buyer_id).uniq\n ### Buying status stats\n buying_status_distribution = PropertyBuyer.where(id: buyer_ids).where.not(buying_status: nil).group(:buying_status).count\n total_count = buying_status_distribution.values.sum\n buying_status_stats = {}\n buying_status_distribution.each do |key, value|\n buying_status_stats[PropertyBuyer::REVERSE_BUYING_STATUS_HASH[key]] = ((value.to_f/total_count.to_f)*100).round(2)\n end\n PropertyBuyer::BUYING_STATUS_HASH.each { |k,v| buying_status_stats[k] = 0 unless buying_status_stats[k] }\n\n result_hash[:buying_status] = buying_status_stats\n result_hash[:unique_buyer_count] = buyer_ids.count\n\n ### Funding status stats\n funding_status_distribution = PropertyBuyer.where(id: buyer_ids).where.not(funding: nil).group(:funding).count\n total_count = funding_status_distribution.inject(0) do |result, (key, value)|\n result += value\n end\n funding_status_stats = {}\n funding_status_distribution.each do |key, value|\n funding_status_stats[PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[key]] = ((value.to_f/total_count.to_f)*100).round(2)\n end\n PropertyBuyer::FUNDING_STATUS_HASH.each { |k,v| funding_status_stats[k] = 0 unless funding_status_stats[k] }\n result_hash[:funding_status] = funding_status_stats\n\n ### Biggest problem stats\n biggest_problem_distribution = PropertyBuyer.where(id: buyer_ids).where.not(biggest_problems: nil).group(:biggest_problems).count\n total_count = biggest_problem_distribution.values.sum\n biggest_problem_stats = {}\n biggest_problem_distribution.each do |keys, value|\n keys.each do |key|\n biggest_problem_stats[key] = ((value.to_f/total_count.to_f)*100).round(2)\n end\n end\n PropertyBuyer::BIGGEST_PROBLEM_HASH.each { |k,v| biggest_problem_stats[k] = 0 unless biggest_problem_stats[k] }\n result_hash[:biggest_problem] = biggest_problem_stats\n\n ### Chain free stats\n chain_free_distribution = PropertyBuyer.where(id: buyer_ids).where.not(chain_free: nil).group(:chain_free).count\n total_count = chain_free_distribution.inject(0) do |result, (key, value)|\n result += value\n end\n chain_free_stats = {}\n chain_free_distribution.each do |key, value|\n chain_free_stats[key] = ((value.to_f/total_count.to_f)*100).round(2)\n end\n chain_free_stats[true] = 0 unless chain_free_stats[true]\n chain_free_stats[false] = 0 unless chain_free_stats[false]\n chain_free_stats['Yes'] = chain_free_stats[true]\n chain_free_stats['No'] = chain_free_stats[false]\n chain_free_stats.delete(true)\n chain_free_stats.delete(false)\n result_hash[:chain_free] = chain_free_stats\n result_hash\n end", "def usage_report(since=nil, signed=nil)\n options = {}\n options[:since] = since if since && [\"month\", \"week\", \"day\"].include?(since)\n options[:signed] = signed.to_s unless signed.nil?\n get \"/api/account/usage_report.xml\", options\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"acccount\"][\"credits\"]\n end", "def buyer_info\n # get buyer base information\n user = User.find(params[:user_id])\n user_json = get_buyer_by_id(user)\n # return json\n render json: user_json, status: 200\n end", "def get_client_count_time_series_data(args = {}) \n get(\"/clients.json/stats/count\", args)\nend", "def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get tracking filters and find details of properties in type of tracking TODO: Net HTTP calls made with hardcoded hostnames to be removed TODO: tracking id should be returned or not?
def tracking_details buyer = @current_user type_of_tracking = (params[:type_of_tracking] || "property_tracking").to_sym if type_of_tracking == :property_tracking udprns = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).pluck(:udprn) api = PropertySearchApi.new(filtered_params: {}) body = api.fetch_details_from_udprns(udprns) render json: {property_details: body}, status: 200 else if params["hash_str"].present? body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://52.66.124.42/api/v0/properties/search?hash_str=#{params['hash_str']}")))) render json: {property_details: body}, status: 200 else body = [] search_hashes = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[type_of_tracking]).pluck(:hash_str).compact search_hashes.each do |search_hash| ### TODO: Fix this. Use internal methods rather than calling the api body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://api.prophety.co.uk/api/v0/properties/search?hash_str=#{search_hash}")))) + body end render json: {search_hashes: search_hashes, property_details: body} end end end
[ "def trackers(query, type=nil)\n if type.nil?\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n get('host-attributes/trackers', {'query' => query})\n else\n is_valid_with_error(__method__, [:tracker_type], type)\n get('trackers/search', {'query' => query, 'type' => type})\n end\n end", "def get_tracking_categories\n response_xml = http_get(\"#{xero_url}/tracking\")\n parse_response(response_xml) \n end", "def usage_filters\n get('/1/reporting/filters').to_a\n end", "def vanity_track_filter\n Vanity.track! params[:_track] if request.get? && params[:_track]\n end", "def trackings\n data = Request.get(url: TRACKINGS_ENDPOINT, api_key: api_key) do |response|\n response.fetch(:data).fetch(:trackings)\n end\n\n data.map { |datum| Tracking.new(datum) }\n end", "def get_all_tracking_pixels_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingControllerApi.get_all_tracking_pixels ...'\n end\n allowable_values = [\"ASC\", \"DESC\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/tracking/pixels'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'PageTrackingPixelProjection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingControllerApi#get_all_tracking_pixels\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def details\n \tparams[:id] = 1 if params[:id].nil?\n \tparams[:page] = 1 if params[:page].nil?\n \t@total = Tracking.count(:conditions => [\"siteid = ?\", params[:id]])\n \t@trackings = Tracking.paginate :page => params[:page], :per_page => 25, :conditions => [\"siteid = ?\", params[:id]], :order => \"visited DESC\"\n end", "def lookup_http_fingerprints(opts={})\n uri = opts[:uri] || '/'\n method = opts[:method] || 'GET'\n fprints = []\n\n return fprints unless framework.db.active\n\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = datastore['WORKSPACE'] ?\n framework.db.find_workspace(datastore['WORKSPACE']) : framework.db.workspace\n\n # only one result can be returned, as the +port+ field restricts potential results to a single service\n service = framework.db.services(:workspace => wspace,\n :hosts => {address: rhost},\n :proto => 'tcp',\n :port => rport).first\n return fprints unless service\n\n # Order by note_id descending so the first value is the most recent\n service.notes.where(:ntype => 'http.fingerprint').order(\"notes.id DESC\").each do |n|\n next unless n.data && n.data.kind_of?(::Hash)\n next unless n.data[:uri] == uri && n.data[:method] == method\n # Append additional fingerprints to the results as found\n fprints.unshift n.data.dup\n end\n }\n\n fprints\n end", "def trackingfield_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingFieldApi.trackingfield_list ...'\n end\n # resource path\n local_var_path = '/tracking_fields'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingFieldApi#trackingfield_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tracking_stats\n buyer = @current_user\n property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count\n street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count\n locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count\n stats = {\n type: (buyer.is_premium? ? 'Premium' : 'Standard'),\n locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s],\n street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s],\n property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s],\n locality_tracking_count: locality_tracking_count,\n property_tracking_count: property_tracking_count,\n street_tracking_count: street_tracking_count\n }\n render json: stats, status: 200\n end", "def trackers(query, start_at: nil, end_at: nil)\n params = {\n query: query,\n start: start_at,\n end: end_at,\n }.compact\n\n _get(\"/host-attributes/trackers\", params) { |json| json }\n end", "def test_that_you_may_filter_to_single_track\n getting '/v2/exercises?tracks=fruit'\n\n returns_tracks %w( fruit )\n end", "def query_filters; end", "def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end", "def sites\n get('visitorTrackingTests').collect {|x| x[0]}\n end", "def filter_result\n filter_result = {}\n config[:hostvars].split(',').each do |attr|\n key, value = attr.split('=')\n filter_result[key] = str_to_attr_path(value)\n end\n filter_result.merge(\n config[:group_by_attribute] => str_to_attr_path(config[:group_by_attribute]),\n config[:host_attribute] => str_to_attr_path(config[:host_attribute])\n )\n end", "def lightstep_filtered_headers\n filtered_ot_headers = {}\n headers = request.headers.to_h\n headers.each do |k, v|\n fk = k.to_s.downcase.gsub('http_', '').tr('_', '-')\n next unless OPEN_TRACING_HEADER_KEYS.include?(fk)\n\n filtered_ot_headers[fk] = v\n end\n filtered_ot_headers\n end", "def identity_filter_discovery_optimization\n if !options[:filter][\"identity\"].empty? && @discovery_method == \"mc\"\n regex_filters = options[:filter][\"identity\"].select {|i| i.match(\"^\\/\")}.size\n\n if regex_filters == 0\n @discovered_agents = options[:filter][\"identity\"].clone\n @force_direct_request = true if Config.instance.direct_addressing\n end\n end\n end", "def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Edit tracking details curl XPOST H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" "
def edit_tracking buyer = @current_user destroyed = Events::Track.where(id: params[:tracking_id].to_i).last.destroy render json: { message: 'Destroyed tracking request' }, status: 200 end
[ "def update_guest_access_portal(args = {}) \n put(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend", "def update\n respond_to do |format|\n if @click_tracking.update(click_tracking_params)\n format.html { redirect_to @click_tracking, notice: 'Click tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @click_tracking.errors, status: :unprocessable_entity }\n end\n end\n end", "def credit_audit_copy_token_update_with_http_info(credit_audit_copy_token_update_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PlaidApi.credit_audit_copy_token_update ...'\n end\n # verify the required parameter 'credit_audit_copy_token_update_request' is set\n if @api_client.config.client_side_validation && credit_audit_copy_token_update_request.nil?\n fail ArgumentError, \"Missing the required parameter 'credit_audit_copy_token_update_request' when calling PlaidApi.credit_audit_copy_token_update\"\n end\n # resource path\n local_var_path = '/credit/audit_copy_token/update'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(credit_audit_copy_token_update_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CreditAuditCopyTokenUpdateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['clientId', 'plaidVersion', 'secret']\n\n new_options = opts.merge(\n :operation => :\"PlaidApi.credit_audit_copy_token_update\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PlaidApi#credit_audit_copy_token_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end", "def update\n @usage_tracking = UsageTracking.find(params[:id])\n\n respond_to do |format|\n if @usage_tracking.update_attributes(params[:usage_tracking])\n format.html { redirect_to @usage_tracking, notice: 'Usage tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usage_tracking.errors, status: :unprocessable_entity }\n end\n end\n end", "def oauth_put(uri, args={})\n\n if @token\n response = page.driver.put(uri, { access_token: @token }.merge(args))\n else\n response = page.driver.put(uri, args)\n end\n Rails.logger.debug response.body\n\n response\n end", "def update\n puts params[:fields]\n expose Participant.update(@oauth_token, params[:membername].strip,\n params[:challenge_id].strip, params[:fields])\n end", "def set_TrackingID(value)\n set_input(\"TrackingID\", value)\n end", "def getTokenEdit( entity_id, language, flatpack_id, edit_page)\n params = Hash.new\n params['entity_id'] = entity_id\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n params['edit_page'] = edit_page\n return doCurl(\"get\",\"/token/edit\",params)\n end", "def update\n respond_to do |format|\n if @shot_put_head.update(shot_put_head_params)\n format.html { redirect_to @shot_put_head, notice: 'Shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(authorization, notification_url)\n url = test? ? STATUS_TEST_URL : STATUS_LIVE_URL\n parameters = [ authorization, account, notification_url ]\n data = PostData.new\n data[:requestparams] = parameters.join('|')\n \n response = ssl_get(\"#{url}?#{data.to_post_data}\")\n end", "def auth_data\n index_map = {\n 0 => :version,\n 1 => :ghost_ip,\n 2 => :client_ip,\n 3 => :timestamp,\n 4 => :uniqid,\n 5 => :nonce\n }\n \n data = {}\n env[\"HTTP_X_AKAMAI_G2O_AUTH_DATA\"].split(\",\").each_with_index {|value, index|\n data[index_map[index.to_i]] = value.strip\n }\n data\n end", "def setIngressTrackingForTI(ixNet, ti, trackingList)\r\n tiName = @ixNet.getAttribute(ti, '-name')\r\n puts(\"--- Traffic Item: \"+tiName+\" setting ingress tracking\" + trackingList.to_s)\r\n @ixNet.setMultiAttribute(ti + \"/tracking\", '-trackBy', trackingList)\r\n @ixNet.commit()\r\nend", "def test_edit_post_with_details\n public_trace_file = create(:trace, :visibility => \"public\")\n deleted_trace_file = create(:trace, :deleted)\n\n # New details\n new_details = { :description => \"Changed description\", :tagstring => \"new_tag\", :visibility => \"private\" }\n\n # First with no auth\n post :edit, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id, :trace => new_details }\n assert_response :forbidden\n\n # Now with some other user, which should fail\n post :edit, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id, :trace => new_details }, :session => { :user => create(:user) }\n assert_response :forbidden\n\n # Now with a trace which doesn't exist\n post :edit, :params => { :display_name => create(:user).display_name, :id => 0 }, :session => { :user => create(:user), :trace => new_details }\n assert_response :not_found\n\n # Now with a trace which has been deleted\n post :edit, :params => { :display_name => deleted_trace_file.user.display_name, :id => deleted_trace_file.id, :trace => new_details }, :session => { :user => deleted_trace_file.user }\n assert_response :not_found\n\n # Finally with a trace that we are allowed to edit\n post :edit, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id, :trace => new_details }, :session => { :user => public_trace_file.user }\n assert_response :redirect\n assert_redirected_to :action => :view, :display_name => public_trace_file.user.display_name\n trace = Trace.find(public_trace_file.id)\n assert_equal new_details[:description], trace.description\n assert_equal new_details[:tagstring], trace.tagstring\n assert_equal new_details[:visibility], trace.visibility\n end", "def save_floorplan_settings(args = {}) \n id = args['id']\n temp_path = \"/userproperties.json/floorplan/{floorplanId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userpropertieId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_item token, item_id, name, description\n uri = URI.parse \"https://#{get_hostname(token)}/sf/v3/Items(#{item_id})\"\n puts uri\n \n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n \n item = {\"Name\"=>name, \"Description\"=>description}\n \n request = Net::HTTP::Patch.new uri.request_uri \n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = get_authorization_header(token)\n request.body = item.to_json\n \n response = http.request request\n puts \"#{response.code} #{response.message}\"\n \n if response.kind_of? Net::HTTPSuccess\n updated_item = JSON.parse response.body\n puts \"Updated Item: #{updated_item['Id']}\"\n end \nend", "def update\n respond_to do |format|\n if @cust_details_track.update(cust_details_track_params)\n format.html { redirect_to @cust_details_track, notice: 'Cust details track was successfully updated.' }\n format.json { render :show, status: :ok, location: @cust_details_track }\n else\n format.html { render :edit }\n format.json { render json: @cust_details_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tracking_number_note wordpress_reference, tracking_number\n data = {note: tracking_number_note_message(tracking_number), customer_note: true}\n woocommerce.post(\"orders/#{wordpress_reference}/notes\", data).parsed_response\n end", "def set_header(auth_headers)\n header 'access-token', auth_headers['access-token']\n header 'token-type', auth_headers['token-type']\n header 'client', auth_headers['client']\n header 'expiry', auth_headers['expiry']\n header 'uid', auth_headers['uid']\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Info about the premium charges monthly curl XGET '
def info_premium render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200 end
[ "def private_info symbol = 'USD'\n #res = post(\"/api/0/info.php\")\n res = post(\"https://mtgox.com/api/1/generic/private/info\")\n res[\"result\"] == \"success\" ? res[\"return\"] : res\n end", "def credits()\n response = do_request(build_credits_xml())\n credit_elements = REXML::XPath.first(response, '/webthumb/credits').elements\n {:reserve => credit_elements['reserve'].text.to_i, :subscription => credit_elements['subscription'].text.to_i}\n end", "def billing\n request('billing', :get)\n end", "def charges(company_number, items_per_page = nil, start_index = nil)\n params = {}\n if items_per_page\n params[:items_per_page] = items_per_page\n end\n if start_index\n params[:start_index] = start_index\n end\n client.get(\"company/#{company_number}/charges/\", params)\n end", "def credit_remaining\n perform_request( 'Type' => 'credits' ) do |xml|\n xml.xpath('/api_result/data/credits/text()').to_s.to_i\n end\n end", "def ws_api_credits(session_id)\n url = URI.parse('https://api.wordstream.com/authentication/get_api_credits?')\n http = https_object(url, 443, true)\n req = post_request(url, {'session_id' => session_id})\n\n begin\n response = send_request(http, req)\n parsed_response = JSON.parse(response.body)\n return parsed_response[\"data\"][\"remaining_monthly_credits\"]\n rescue Exception => e\n return nil\n end\n end", "def recurly_APISubscriptionInfo()\r\n puts ' * recurly_APISubscriptionInfo'\r\n # Pagination in the ruby client is done using\r\n # the Recurly::Pager class.\r\n\r\n # You can also create a Pager directly from any resource\r\n Recurly::Subscription.paginate.class\r\n #=> Recurly::Resource::Pager\r\n\r\n # paginate optionally takes the sorting and filtering params\r\n # if you want to specify them\r\n opts = {\r\n begin_time: DateTime.new(2016,1,1),\r\n end_time: DateTime.new(2035,1,1),\r\n #state: :collected,\r\n per_page: 300\r\n }\r\n\r\n # find_each will fetch the pages for you\r\n # until there are none left. It presents\r\n # all the subscription on the server as a single enumerable\r\n # Push all the uuid-s to an array for listing.\r\n puts ' ' \r\n puts ' - All subscription uuid-s '\r\n mySubscriptions = []\r\n Recurly::Subscription.paginate(opts).find_each do |subscription|\r\n puts subscription.uuid.to_s #.invoice_number\r\n mySubscriptions.push(subscription.uuid.to_s) \r\n end\r\n puts \" - End of list\"\r\n puts \" \" \r\n puts \" - Number of subscriptions: \" + mySubscriptions.length().to_s\r\n # Now get the first /each/ subscription minimal details\r\n puts ' - Every subscriptions details '\r\n mySubscriptions.each do | theSubscription | \r\n puts ' - Find: ' + theSubscription.to_s\r\n subscription = Recurly::Subscription.find( theSubscription.to_s ) #by uuid ('4028618e3d55d0862b6bb04194baef72')\r\n puts ' - uuid: ' + subscription.uuid.to_s #.invoice_number\r\n puts ' - plan_code: ' + subscription.plan_code.to_s\r\n puts ' - customer_notes: ' + subscription.customer_notes.to_s\r\n puts ' - collection_method: ' + subscription.collection_method.to_s\r\n puts ' - state: ' + subscription.state.to_s\r\n puts ' '\r\n end\r\n #\r\n puts ' - Return: true - Pager found data.'\r\n return true\r\nend", "def fetch_data\n resp = HTTParty.get(\"http://data.mtgox.com/api/1/BTCUSD/ticker\")\n buy = resp[\"return\"][\"buy\"][\"display\"]\n sell = resp[\"return\"][\"sell\"][\"display\"]\n \n return {:buy => buy, :sell => sell}\nend", "def get_tokenized_billing_info(options)\n get_gateway options[:system]\n timeout(30) do\n @net_response = @gateway.retreive_customer_info options\n end\n @net_response\n end", "def charges(customer_token, page = nil)\n options = (page.nil? ? nil : { page: page })\n api_paginated_response(api_get(\"#{PATH}/#{customer_token}/charges\", options))\n end", "def free_claim_preview\n @free_discount=JSON.parse RestClient.get $api_service+\"/claims/free_discount_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\" \n end", "def fetch\n HTTP.get(\"https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=#{@symbol}&apikey=NH1E83T56P88YY0U\")\n .then do |resp|\n mutate @status = :success, @price = resp.json[\"Global Quote\"][\"05. price\"]\n @time = Time.now # Time.at(resp.json[:delayedPriceTime] / 1000) No longer provides time\n after(@update_interval) { fetch }\n end\n .fail do |resp|\n mutate @status = :failed, @reason = resp.body.empty? ? 'Network error' : resp.body\n after(@update_interval) { fetch } unless @reason == 'Unknown symbol'\n end\n end", "def expiry_claim_preview\n @expiry_damage=JSON.parse RestClient.get $api_service+\"/claims/expiry_damage_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\"\n end", "def get_credit_card_info\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/recharge/credit-card'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def get_warranty(serial = \"\", proxy = \"\")\n serial = serial.upcase\n warranty_data = {}\n raw_data = open('https://selfsolve.apple.com/warrantyChecker.do?sn=' + serial.upcase + '&country=USA', :proxy => \"#{proxy}\")\n warranty_data = JSON.parse(raw_data.string[5..-2])\n\n puts \"\\nSerial Number:\\t\\t#{warranty_data['SERIAL_ID']}\\n\"\n puts \"Product Decription:\\t#{warranty_data['PROD_DESCR']}\\n\"\n puts \"Purchase date:\\t\\t#{warranty_data['PURCHASE_DATE'].gsub(\"-\",\".\")}\"\n\n unless warranty_data['COV_END_DATE'].empty?\n puts \"Coverage end:\\t\\t#{warranty_data['COV_END_DATE'].gsub(\"-\",\".\")}\\n\"\n else\n puts \"Coverage end:\\t\\tEXPIRED\\n\"\n end\n end", "def list_notification_plans\n \trequest_json(\"https://monitoring.api.rackspacecloud.com/v1.0/#{tennant_id}/notification_plans\")\n end", "def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend", "def read_api\n begin\n uri = URI('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml')\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n response = http.request request\n response.body\n end\n rescue => e\n print_exception e\n end\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new Response object for the given Net::SFTP::Request instance, and with the given data. If there is no :code key in the data, the code is assumed to be FX_OK.
def initialize(request, data={}) #:nodoc: @request, @data = request, data @code, @message = data[:code] || FX_OK, data[:message] end
[ "def response_with_code(code, subcode)\n OpenStruct.new(name: code_name(code), code: code, subcode: subcode)\n end", "def prepare_success_response(data)\n return {\n status: APIBase::SUCCESS_STATUS,\n data: data\n }\n end", "def process_result(code, body)\n\t\traise Rush::NotAuthorized if code == \"401\"\n\n\t\tif code == \"400\"\t\n\t\t\tklass, message = parse_exception(body)\n\t\t\traise klass, \"#{host}:#{message}\"\n\t\tend\n\n\t\traise Rush::FailedTransmit if code != \"200\"\n\n\t\tbody\n\tend", "def create_response(code = 200, message = \"OK\", proto = Rex::Proto::Http::DefaultProtocol)\n\t\tres = Rex::Proto::Http::Response.new(code, message, proto);\n\t\tres['Content-Type'] = 'text/html'\n\t\tres\n\tend", "def create_response(code = 200, message = \"OK\", proto = Rex::Proto::Http::DefaultProtocol)\n res = Rex::Proto::Http::Response.new(code, message, proto);\n res['Content-Type'] = 'text/html'\n res\n end", "def success_with_data(data)\n\n # Allow only Hash data to pass ahead\n data = {} unless Util::CommonValidator.is_a_hash?(data)\n\n OstKycSdkRuby::Util::Result.success({data: data})\n\n end", "def create_response(type, data)\n data[:response_type] = data.keys.first unless data.has_key?(:response_type)\n return Response.new(type, data)\n end", "def err_resp(req, code, message, data=nil)\n resp = { \"jsonrpc\"=>\"2.0\", \"error\"=> { \"code\"=>code, \"message\"=>message } }\n if req[\"id\"]\n resp[\"id\"] = req[\"id\"]\n end\n if data\n resp[\"error\"][\"data\"] = data\n end\n\n return resp\n end", "def response code=nil, body=nil, headers=nil\n args = [code, body, headers].compact\n\n headers = {'Content-Type' => DEFAULT_CONTENT_TYPE}\n code = 200\n body = \"\"\n\n args.each do |arg|\n case arg\n when Hash then headers.merge!(arg)\n when String then body = arg\n when Integer then code = arg\n end\n end\n\n [code, headers, body]\n end", "def respond code_or_data, data = nil\n # allow respond(data)\n return respond 200, code_or_data unless is_response_code? code_or_data\n render :json => data, :status => code_or_data\n end", "def build_success_output(data)\n\t \t{data: data, code: 200, result: \"success\"}\n\t end", "def validate_response_code(response)\n code = response.code.to_i\n\n if !(200..299).include?(code)\n case code\n when 400\n raise Sunstone::Exception::BadRequest, response.body\n when 401\n raise Sunstone::Exception::Unauthorized, response.body\n when 403\n raise Sunstone::Exception::Forbidden, response.body\n when 404\n raise Sunstone::Exception::NotFound, response.body\n when 410\n raise Sunstone::Exception::Gone, response.body\n when 422\n raise Sunstone::Exception::ApiVersionUnsupported, response.body\n when 503\n raise Sunstone::Exception::ServiceUnavailable, response.body\n when 301\n raise Sunstone::Exception::MovedPermanently, response.body\n when 502\n raise Sunstone::Exception::BadGateway, response.body\n when 500..599\n raise Sunstone::ServerError, response.body\n else\n raise Sunstone::Exception, response.body\n end\n end\n end", "def display_response_code(code)\n case code\n when 400 then puts '[!] 400: Bad Request'\n when 401 then puts '[!] 401: Unauthorized'\n when 403 then puts '[!] Error Code Forbidden 403: accessing the page or resource '\\\n 'you were trying to reach is absolutely forbidden for some reason.'\n when 404 then puts '[!] 404: Not Found'\n when 405 then puts '[!] 405: Method Not Allowed'\n when 406 then puts 'Unacceptable Type'\\\n \t 'Unable to provide content type matching the client\\'s Accept header.'\n when 412 then puts '[!] 412: Precondition failed\\n'\\\n 'Unsupported or invalid parameters, or missing required parameters.'\n when 415 then puts '[!] 415: Unsupported Media Type'\\\n 'A PUT or POST payload cannot be accepted.'\n when 423 then puts '[!] 423'\n when 500 then puts '[!] 500: General Service Error\\n'\\\n 'Empty response body. The service has encountered an unexpected'\\\n 'state and cannot continue to handle your action request.'\n when 504 then puts '[!] 504: Service Error'\n end\nend", "def challenge_response(challenge_code)\n {\n :body => challenge_code,\n :status => 200\n }\n end", "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end", "def initialize\n @security = false\n @user_id = nil\n @returnValue = { content: {} }\n \n @code = []\n @code[200] = {code: 200, message: \"Success\"}\n @code[201] = {code: 201, message: \"Created\"}\n @code[202] = {code: 202, message: \"NoContent\"}\n @code[500] = {code: 500, message: \"NotSecure\"}\n @code[501] = {code: 501, message: \"FailSecurity\"}\n @code[502] = {code: 502, message: \"NotFound\"}\n @code[503] = {code: 503, message: \"NotCreated\"}\n @code[504] = {code: 504, message: \"Error\"}\n @code[505] = {code: 505, message: \"UpdateError\"}\n end", "def initialize response_code, body\n @response_code = response_code\n @body = body\n end", "def error(code = 400, message = 'Generic Error')\n res = generic_response\n res[:status][:code] = code\n res[:status][:message] = message\n res\n end", "def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns +true+ if the status code is FX_OK; +false+ otherwise.
def ok? code == FX_OK end
[ "def ok?\n 'ok' == status\n end", "def ok?(code)\n OK_STATUS_CODES.include?(code)\n end", "def is_ok?\n code == 200\n end", "def ok?\n @status == 200\n end", "def check\n @response = get_fixity_response_from_fedora\n status.match(\"SUCCESS\") ? true : false\n end", "def success?\n (200..204).include? @status\n end", "def ok?\n @result.retval == 0\n end", "def success?\n status_code == SUCCESS || status_code == CONTINUE\n end", "def successful?\n (200...300).include?(@status_code)\n end", "def ok?(code)\n [200, 201, 202, 204, 206].include?(code)\n end", "def success?\n exit_status == 0\n end", "def success?\n reply_code == 0\n end", "def success?\n exit_code == 0\n end", "def valid_status?(response)\n response.is_a?(Net::HTTPSuccess)\n end", "def successful?\n exit_code == 0\n end", "def valid?\n (200..299).include? status\n end", "def is_success?\n @code.in? 200..299\n end", "def zabbix_error?\n code == 200 && error?\n end", "def success?\n return nil unless success_code\n response.code == success_code.to_s\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns +true+ if the status code is FX_EOF; +false+ otherwise.
def eof? code == FX_EOF end
[ "def eof?\n @io.eof?\n end", "def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end", "def handle_eof?\n eof? && eof_callback?\n end", "def eof_found?\n @eof_found\n end", "def eof_flag\n @eof_flag\n end", "def isAtEOF?\n @line == @file.size - 1 and isAtEOL?\n end", "def eof?(*) end", "def eof_callback?\n !@callback[:end_of_file].nil?\n end", "def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end", "def eof?() end", "def eof\n\t\trequest = Packet.create_request('core_channel_eof')\n\n\t\trequest.add_tlv(TLV_TYPE_CHANNEL_ID, self.cid)\n\n\t\tbegin\n\t\t\tresponse = self.client.send_request(request)\n\t\trescue\n\t\t\treturn true\n\t\tend\n\n\t\tif (response.has_tlv?(TLV_TYPE_BOOL))\n\t\t\treturn response.get_tlv_value(TLV_TYPE_BOOL)\n\t\tend\n\n\t\treturn false\n\tend", "def eof?\n @delegate_io.eof? && @readbuf.empty?\n end", "def ok?\n code == FX_OK\n end", "def readable_after_eof?\n false\n end", "def eof_flag=(value)\n @eof_flag = value\n end", "def is_partition_eof?\n code == :partition_eof\n end", "def end_of_stream\n @i < @stream.size ? false : true\n end", "def stream_end?(*) end", "def done?\n !!@exitstatus\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /polling_sessions/new GET /polling_sessions/new.json
def new @polling_session = PollingSession.new respond_to do |format| format.html # new.html.erb format.json { render json: @polling_session } end end
[ "def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @session = Session.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end", "def new\r\n @session = Session.new\r\n @session.state = 'waiting'\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @session }\r\n format.json { render :json => @session }\r\n end\r\n end", "def new\n @session = Session.new\n\n respond_to do |format|\n format.json { render json: @session }\n format.html # new.html.erb\n end\n end", "def new\n @tsession = Tsession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tsession }\n end\n end", "def new\n @ykt_session = YktSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ykt_session }\n end\n end", "def new\n @user_session = UserSession.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_session }\n end\n end", "def new\n @auth_session = AuthSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auth_session }\n end\n end", "def new\n @sock = Sock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sock }\n end\n end", "def new\n @info_session = InfoSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_session }\n end\n end", "def new\n @session_type = SessionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session_type }\n end\n end", "def new\n @shell_session = ShellSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shell_session }\n end\n end", "def new\n @gamingsession = Gamingsession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gamingsession }\n end\n end", "def new\n @session_log_entry = SessionLogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session_log_entry }\n end\n end", "def new\n @yoga_session = YogaSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yoga_session }\n end\n end", "def new\n @heartbeat = Heartbeat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heartbeat }\n end\n end", "def new\n @discovery_session = DiscoverySession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discovery_session }\n end\n end", "def cmd_new_session argv\n setup argv\n response = @api.new_session\n msg response\n return response\n end", "def new\n @sockmonkey = Sockmonkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sockmonkey }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /polling_sessions POST /polling_sessions.json
def create @polling_session = PollingSession.new(params[:polling_session]) respond_to do |format| if @polling_session.save format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' } format.json { render json: @polling_session, status: :created, location: @polling_session } else format.html { render action: "new" } format.json { render json: @polling_session.errors, status: :unprocessable_entity } end end end
[ "def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end", "def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:post, path, query_params, form_params, headers)\n response\n \n end", "def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end", "def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n end", "def post_session(session)\n info = {}\n info[:ip] = session.ip\n info[:duration] = session.up_time\n info[:date] = session.start[:stamp]\n update(last_session: Oj.dump(info))\n end", "def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n end", "def auto_track_sessions; end", "def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end", "def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end", "def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n end", "def create\n @stolen_session = StolenSession.new(stolen_session_params)\n\n respond_to do |format|\n if @stolen_session.save\n format.html { redirect_to @stolen_session, notice: 'Stolen session was successfully created.' }\n format.json { render :show, status: :created, location: @stolen_session }\n else\n format.html { render :new }\n format.json { render json: @stolen_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @session = Session.new(params[:session])\n\n if @session.save\n render json: @session, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end", "def on_new_session(session)\n self.session_count += 1\n self.successful = true\n end", "def notify_session_end(webcast_id, session_id)\n url = \"#{webcast_id}/sessions/#{session_id}.json\"\n JSON.parse @rest_client.update(url , {})\n end", "def create\n @session = Session.new(session_params)\n\n if @session.save\n render json: @session, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def create\n @session_event = SessionEvent.new\n @session_event.behavior_square_id = params[:behavior_id]\n @session_event.square_press_time = params[:start_time].to_s\n @session_event.duration_end_time = params[:end_time].to_s\n @session_event.session_id = params[:session_id]\n\n # calculate and set the interval num for this event... a little complicated\n the_session = Session.find(params[:session_id])\n @session_event.set_interval_num( the_session)\n\n respond_to do |format|\n if @session_event.save\n format.any { render :json => {:response => 'Success' },:status => 200 }\n else\n format.html { render :new }\n format.json { render json: @session_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def stay_alive\n update_api_session_alive(current_user)\n render json: {\"#{current_user.class.name.underscore}\" => []}, status: :ok\n end", "def start\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n if params[:payload].nil?\n response.status = 400\n render json: {msg: \"Payload is not defined in request\"}\n return\n end\n\n if params[:payload][:date].nil?\n response.status = 400\n render json: {msg: \"Date field is not defined in request\"}\n return\n end\n\n str = params[:payload][:date]\n\n # https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#3143231\n unless /\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/.match?(str)\n response.status = 400\n render json: {msg: \"date field is in bad format\"}\n return\n end\n\n unless session.user.time_sessions.where(end: nil).empty?\n response.status = 403\n render json: {}\n return\n end\n\n startTime = Time.parse(str)\n\n obj = TimeSession.new\n obj.start = startTime\n obj.user = session.user\n obj.save\n\n response.status = 201\n render json: obj\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /polling_sessions/1 PUT /polling_sessions/1.json
def update @polling_session = PollingSession.find(params[:id]) respond_to do |format| if @polling_session.update_attributes(params[:polling_session]) format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @polling_session.errors, status: :unprocessable_entity } end end end
[ "def update_single_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:put, path, query_params, form_params, headers)\n response\n \n end", "def update_single_poll_session(poll_id,id,poll_sessions__course_id__,poll_sessions__course_section_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n raise \"poll_sessions__course_section_id__ is required\" if poll_sessions__course_section_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id,\n :poll_sessions__course_id__ => poll_sessions__course_id__,\n :poll_sessions__course_section_id__ => poll_sessions__course_section_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end", "def update\n @user_session_token = UserSessionToken.find(params[:id])\n\n if @user_session_token.update(user_session_token_params)\n head :no_content\n else\n render json: @user_session_token.errors, status: :unprocessable_entity\n end\n end", "def update\n #@session = @client.sessions.update!(session_params)\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to client_url(@client), notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stolen_session.update(stolen_session_params)\n format.html { redirect_to @stolen_session, notice: 'Stolen session was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_session }\n else\n format.html { render :edit }\n format.json { render json: @stolen_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session_resource = SessionResource.find(params[:id])\n\n if @session_resource.update(session_resource_params)\n head :no_content\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end", "def notify_session_end(webcast_id, session_id)\n url = \"#{webcast_id}/sessions/#{session_id}.json\"\n JSON.parse @rest_client.update(url , {})\n end", "def _session_update sid = \"\", uid = 0\n\t\tds = DB[:_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend", "def update\n @user_session = UserSession.find(params[:id])\n\n if @user_session.update(user_session_params)\n head :no_content\n else\n render json: @user_session.errors, status: :unprocessable_entity\n end\n end", "def update\n params[:trainingsession][:existing_interval_attributes] ||= {}\n @trainingsession = Trainingsession.find(params[:id])\n\n respond_to do |format|\n if @trainingsession.update_attributes(params[:trainingsession])\n flash[:notice] = 'Trainingsession was successfully updated.'\n format.html { redirect_to(@trainingsession) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trainingsession.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app_session.update(app_session_params)\n format.html { redirect_to @app_session, notice: 'App session was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_session }\n else\n format.html { render :edit }\n format.json { render json: @app_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def updated_sessoin id\r\n return nil unless session_exists? id\r\n @sessions[id]['lastUpdate'] = Time.now\r\n @sessions[id]\r\n end", "def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n if @ykt_session.update_attributes(params[:ykt_session])\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_session.update(event_session_params)\n format.html { redirect_to event_sessions_path, notice: 'Event session was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_session }\n else\n format.html { render :edit }\n format.json { render json: @event_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @otg_sess.update(otg_sess_params)\n format.html { redirect_to @otg_sess, notice: 'Otg sess was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_sess }\n else\n format.html { render :edit }\n format.json { render json: @otg_sess.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /polling_sessions/1 DELETE /polling_sessions/1.json
def destroy @polling_session = PollingSession.find(params[:id]) @polling_session.destroy respond_to do |format| format.html { redirect_to polling_sessions_url } format.json { head :no_content } end end
[ "def destroy\n @session = @client.sessions.find(params[:id])\n @session.destroy\n respond_to do |format|\n format.html { redirect_to client_url(@client), notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_to batch_connect_sessions_url, notice: t('dashboard.batch_connect_sessions_status_blurb_delete_success') }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to batch_connect_sessions_url, alert: t('dashboard.batch_connect_sessions_status_blurb_delete_failure') }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @yoga_session = YogaSession.find(params[:id])\n @yoga_session.destroy\n\n respond_to do |format|\n format.html { redirect_to yoga_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ykt_session = YktSession.find(params[:id])\n @ykt_session.destroy\n\n respond_to do |format|\n format.html { redirect_to ykt_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t(\"dashboard.batch_connect_sessions_status_blurb_delete_success\") }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, alert: t(\"dashboard.batch_connect_sessions_status_blurb_delete_failure\") }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sessionlog.destroy\n respond_to do |format|\n format.html { redirect_to sessionlogs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shell_session = ShellSession.find(params[:id])\n @shell_session.destroy\n\n respond_to do |format|\n format.html { redirect_to shell_sessions_url }\n format.json { head :ok }\n end\n end", "def deleteSession(name,node=nil)\n Jiocloud::Utils.put(sessionurl + '/destroy/' + getSessionID({:name => name,:node => node}),'')\n end", "def destroy\n @discovery_session = DiscoverySession.find(params[:id])\n @discovery_session.destroy\n\n respond_to do |format|\n format.html { redirect_to discovery_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shooting_session = ShootingSession.find(params[:id])\n @shooting_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(shooting_sessions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_browser session\n begin\n print_verbose \"Removing hooked browser [session: #{session}]\"\n response = RestClient.get \"#{@url}hooks/#{session}/delete\", {:params => {:token => @token}}\n print_good \"Removed browser [session: #{session}]\" if response.code == 200\n response\n rescue => e\n print_error \"Could not delete hooked browser: #{e.message}\"\n end\nend", "def destroy\n @polling.destroy\n respond_to do |format|\n format.html { redirect_to pollings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tsession.destroy\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stolen_session.destroy\n respond_to do |format|\n format.html { redirect_to stolen_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_session.destroy\n respond_to do |format|\n format.html { redirect_to test_sessions_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract url from json and get files
def download URI.extract(json, ['http', 'https']).each do |url| get_asset(url) end json end
[ "def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend", "def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend", "def extract_links(json)\n json[\"roots\"].collect do |key, children|\n extract_children(children[\"name\"], children[\"children\"])\n end\n end", "def url_path\n # Get the path component of the URL as a relative path\n filename = URI.parse(url).path\n filename.slice!(0) # Remove the leading /\n # Return the path with '.json' extension if not already present\n filename.end_with?('.json') ? filename : \"#{filename}.json\"\n rescue URI::InvalidComponentError, URI::InvalidURIError\n # Return nil if the URL is invalid\n nil\n end", "def load_json(url)\n open(url){ |json| JSON.load(json) }\n rescue Exception => e\n if File.exist?(\"#{self.path_prefix}#{url}\")\n open(\"#{self.path_prefix}#{url}\"){ |json| JSON.load(json) }\n elsif File.exist?(\"#{self.path_prefix}#{url}#{self.path_suffix}\")\n open(\"#{self.path_prefix}#{url}#{self.path_suffix}\"){ |json| JSON.load(json) }\n else\n raise e\n end\n end", "def weather_json(url)\r\n if @debug\r\n sample_json\r\n else\r\n open(url).read\r\n end\r\n end", "def get_file(url)\n get(url).body\n end", "def download_and_parse_json\n buffer = open(@url, \"UserAgent\"=>\"Ruby\").read\n @document = JSON.parse(buffer)\n end", "def get_image_urls(json_response)\n parsed_json = JSON.parse(json_response)\n photos_json_array = parsed_json[\"photos\"]\n image_url_array = []\n photos_json_array.each { |photo|\n image_url_array << photo[\"image_url\"]\n }\n\n image_url_array\n end", "def parse_remote_json(url)\n JSON.parse(URI.parse(url).open.read)\n end", "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "def extract_metadata_for_video url\n mfile = metadata_file_for(url)\n unless File.file? mfile\n\n # self << url\n # self << %w[ skip-download write-info-json ignore-errors ]\n # self << { output: mfile.gsub(/\\.info\\.json$/, '') }\n # self.run\n\n # Run directly:\n command = \"#{url} --skip-download --write-info-json --ignore-errors\"\n command += \" -o '#{mfile.gsub(/\\.info\\.json$/, '')}'\"\n delegator.run command\n end\n JSON.parse File.read(mfile) rescue nil\n end", "def url\n file.url\n end", "def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end", "def process_file(filename)\n results = {}\n\n begin\n File.foreach(filename) do |line|\n if @options[:debug]\n puts \"processing: #{line}\"\n end\n\n line.gsub!(/\\W+$/,'');\n\n if url_ok(line)\n results[line] = process_url(line)\n\n if @options[:debug]\n puts JSON.pretty_generate(results)\n end\n else\n error \"Not an absolute uri: #{line}\"\n end\n end\n rescue => e\n error \"Error when processing file: #{filename} : #{e.message}!\"\n exit EXIT_UNKNOWN\n end\n\n return results\n end", "def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end", "def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def swapi_fetch(url)\n JSON.parse(URI(url).read)\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /solicitacao_tipos GET /solicitacao_tipos.json
def index @solicitacao_tipos = SolicitacaoTipo.all end
[ "def index\n @tipo_solicitudes = TipoSolicitude.all\n end", "def get_tip\n request({ req: 'gettip'})\n end", "def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_so }\n end\n end", "def index\n @tipodetencoes = Tipodetencao.all\n end", "def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end", "def index\n @tiposuarios = Tiposuario.all\n end", "def index\n @tipoincidentes = Tipoincidente.all\n end", "def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end", "def index\n @tipps = Tipp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipps }\n end\n end", "def index\n @tipovestuarios = Tipovestuario.all\n end", "def index\n @tipoplatos = Tipoplato.all\n end", "def index\n @tiporeceptores = Tiporeceptor.all\n end", "def tips\n\t \tbase_url = \"https://api.foursquare.com/v2/venues/#{venue_id}/tips?sort=popular&oauth_token=333XGVNQCUY0LI4GGL4B4MXWAM022G1EKD0JZWXOLKESCFK3&v=20140401\"\n\t\tresponse = HTTParty.get(base_url)\n\t\tresponse[\"response\"][\"tips\"][\"items\"].map do |item|\n\t\t\titem['text']\n\t\tend\n\tend", "def show\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end", "def index\n @solicitacoes = Solicitacao.all\n end", "def index\n @tipos_eventos = TipoEvento.por_colegio(colegio.id).order(\"cuaderno_control DESC\", \"descripcion\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipos_eventos }\n end\n end", "def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end", "def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end", "def index\n @tippers = Tipper.all\n json_response(@tippers)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /solicitacao_tipos/1 DELETE /solicitacao_tipos/1.json
def destroy @solicitacao_tipo.destroy respond_to do |format| format.html { redirect_to solicitacao_tipos_url } format.json { head :no_content } end end
[ "def destroy\n @solicitacao = Solicitacao.find(params[:id])\n @solicitacao.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitacaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tip_so = TipSo.find(params[:id])\n @tip_so.destroy\n\n respond_to do |format|\n format.html { redirect_to tip_sos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tiposuario.destroy\n respond_to do |format|\n format.html { redirect_to tiposuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud = Solicitud.find(params[:id])\n @solicitud.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipos_saida.destroy\n respond_to do |format|\n format.html { redirect_to tipos_saidas_url, notice: 'Tipos de saida foi apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipocliente = Tipocliente.find(params[:id])\n @tipocliente.destroy\n\n respond_to do |format|\n format.html { redirect_to tipoclientes_url }\n #format.json { head :ok }\n end\n end", "def destroy\n @tipo_solicitude.destroy\n respond_to do |format|\n format.html { redirect_to tipo_solicitudes_url, notice: 'Tipo solicitude was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipodetencao.destroy\n respond_to do |format|\n format.html { redirect_to tipodetencoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tb_solicitud.destroy\n respond_to do |format|\n format.html { redirect_to tb_solicituds_url, notice: 'Tb solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sigesp_solicitud.destroy\n respond_to do |format|\n format.html { redirect_to sigesp_solicituds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipovestuario.destroy\n respond_to do |format|\n format.html { redirect_to tipovestuarios_url, notice: 'Tipovestuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tiposveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitante.destroy\n respond_to do |format|\n format.html { redirect_to solicitantes_url, notice: 'Solicitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitante = Solicitante.find(params[:id])\n @solicitante.destroy\n\n respond_to do |format|\n flash[:success] = \"Solicitante eliminado.\"\n format.html { redirect_to solicitantes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitacao_alt.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_alts_url, notice: 'Solicitacao alt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitacao_exclusao.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_exclusaos_url, notice: 'Solicitacao exclusao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /u_sers/1 GET /u_sers/1.json
def show @u_ser = USer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @u_ser } end end
[ "def index\n @u_sers = USer.all\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n @u_ssers = USser.all\n end", "def index\n @uzsers = Uzser.all\n end", "def show\n @ussr = Ussr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ussr }\n end\n end", "def index\n @singers = Singer.all\n render :json => @singers\n end", "def new\n @u_ser = USer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u_ser }\n end\n end", "def index\n @ussers = Usser.all\n end", "def show\n @uder = Uder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uder }\n end\n end", "def show\n @singer = Singer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @singer }\n end\n end", "def show\n @su = Sus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @su }\n end\n end", "def show\n @usre = Usre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usre }\n end\n end", "def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end", "def show\n @ulcer = Ulcer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ulcer }\n end\n end", "def show_disposisi_user\n\t\t@user = Disposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend", "def index\n v = ValidateKey()\n \tif (v == nil)\n \t\trender json: nil\n \t\treturn\n \tend\n\n @user_rosters = UserRoster.all\n render json: @user_rosters\n end", "def index\n @uxsers = Uxser.all\n end", "def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end", "def owners\n api_path = '/users'\n @resp = self.class.get(api_path, default_request_data)\n resp_parsing\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /u_sers/new GET /u_sers/new.json
def new @u_ser = USer.new respond_to do |format| format.html # new.html.erb format.json { render json: @u_ser } end end
[ "def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end", "def new\n @newse = Newse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newse }\n end\n end", "def new\n @su = Sus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @su }\n end\n end", "def new\n @creator = Creator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator }\n end\n end", "def new\n @sname = Sname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sname }\n end\n end", "def new\n @usr = Usr.new\n \n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @usr }\n format.json { render :json => @usr }\n end\n end", "def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end", "def new\n @ussr = Ussr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ussr }\n end\n end", "def new\n @new_user = NewUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_user }\n end\n end", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @singer = Singer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @singer }\n end\n end", "def new\n @usersite = Usersite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usersite }\n end\n end", "def new\n @sequent = Sequent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sequent }\n end\n end", "def new\n @userss = Userss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @userss }\n end\n end", "def new\n @stiker = Stiker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stiker }\n end\n end", "def new\n @minister = Minister.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @minister }\n end\n end", "def new\n @ulcer = Ulcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ulcer }\n end\n end", "def new\n @sermon = Sermon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sermon }\n end\n end", "def new\n @new_user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_user }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /u_sers POST /u_sers.json
def create @u_ser = USer.new(params[:u_ser]) respond_to do |format| if @u_ser.save format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' } format.json { render json: @u_ser, status: :created, location: @u_ser } else format.html { render action: "new" } format.json { render json: @u_ser.errors, status: :unprocessable_entity } end end end
[ "def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @u_sser = USser.new(u_sser_params)\n\n respond_to do |format|\n if @u_sser.save\n format.html { redirect_to @u_sser, notice: 'U sser was successfully created.' }\n format.json { render :show, status: :created, location: @u_sser }\n else\n format.html { render :new }\n format.json { render json: @u_sser.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @u_sers = USer.all\n end", "def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @u_ser = USer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u_ser }\n end\n end", "def create\n users = seal_params[\"users\"]\n user_params = process_users(users)\n @seal = Seal.new(text: seal_params[\"text\"])\n @seal.stamp = BCrypt::Password.create(@seal.id).checksum.gsub(/[\\.]/, '')\n respond_to do |format|\n if @seal.save\n @seal.seals_users << SealsUser.create(user_id: current_user.id,\n seal_id: @seal.id,\n owner: true)\n format.html { redirect_to controller: :seals,\n action: :show,\n stamp: @seal.stamp,\n notice: 'Seal was successfully created.' }\n format.json { render json: {stamp: @seal.stamp, status: \"ok\"} }\n else\n format.html { render :new }\n format.json { render json: @seal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uesr = Uesr.new(uesr_params)\n\n respond_to do |format|\n if @uesr.save\n format.html { redirect_to @uesr, notice: 'Uesr was successfully created.' }\n format.json { render :show, status: :created, location: @uesr }\n else\n format.html { render :new }\n format.json { render json: @uesr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sasaeru = Sasaeru.new(sasaeru_params)\n\n respond_to do |format|\n if @sasaeru.save\n format.html { redirect_to @sasaeru, notice: 'Sasaeru was successfully created.' }\n format.json { render :show, status: :created, location: @sasaeru }\n else\n format.html { render :new }\n format.json { render json: @sasaeru.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n tags = process_tags(params[:usertag][:name])\n tags.each do |tag|\n usertag = Usertag.create!(name: tag, user_id: current_user.id)\n end\n# respond_to do |format|\n# if @usertag.save\n# format.html { redirect_to @usertag, notice: 'Usertag was successfully created.' }\n# format.json { render action: 'show', status: :created, location: @usertag }\n# else\n# format.html { render action: 'new' }\n# format.json { render json: @usertag.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def create\n @uxser = Uxser.new(uxser_params)\n\n respond_to do |format|\n if @uxser.save\n format.html { redirect_to @uxser, notice: '登録しました' }\n format.json { render :show, status: :created, location: @uxser }\n else\n format.html { render :new }\n format.json { render json: @uxser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ussr = Ussr.new(params[:ussr])\n\n respond_to do |format|\n if @ussr.save\n format.html { redirect_to ussrs_url, notice: 'User #{@ussr.name} was successfully created.' }\n format.json { render json: @ussr, status: :created, location: @ussr }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ussr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @su = Sus.new(params[:su])\n\n respond_to do |format|\n if @su.save\n format.html { redirect_to @su, notice: 'Sus was successfully created.' }\n format.json { render json: @su, status: :created, location: @su }\n else\n format.html { render action: \"new\" }\n format.json { render json: @su.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uder = Uder.new(params[:uder])\n\n respond_to do |format|\n if @uder.save\n format.html { redirect_to @uder, notice: 'Uder was successfully created.' }\n format.json { render json: @uder, status: :created, location: @uder }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uder.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url, params={})\n url = '/' + url if url[0] != '/'\n url = Uber::BASE_URL + url\n result = RestClient.post url, params, {\"Authorization\" => \"Token #{token}\"}\n JSON.parse(result)\n end", "def create\n @user = curent_user\n @serial = Serial.find(params[:id])\n @user.serials << @serial\n if @serial.save\n render json: @serial, status: :created, location: @serial\n else\n render json: @serial.errors, status: :unprocessable_entity\n end\n end", "def create\n\n @semestre = current_user.semestres.new(semestre_params)\n\n respond_to do |format|\n if @semestre.save\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully created.' }\n format.json { render :show, status: :created, location: @semestre }\n else\n format.html { render :new }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @uzsers = Uzser.all\n end", "def new_singer #needs singer and room as params\n room_url = @@room_ips[params[:room].to_i]\n singer = get_singer\n if singer == \"\"\n Rails.logger.debug \"creating a new singer!!!\"\n response = HTTParty.post(\"#{room_url}newsinger\", body: {singername: params[:singer], password: params[:singer], confirm: params[:singer], submit: 'Jam Out!'}) #it seems that the jam out thing is actually needed.\n Rails.logger.debug \"got back #{response.body}\"\n if response.code != 200\n Rails.logger.debug \"something is wrong with the API request!!!!!!\"\n else\n singer = get_singer\n end\n end\n return singer\n end", "def doctors\n response = RestClient.get 'https://api.betterdoctor.com/2016-03-01/doctors?location=37.773%2C-122.413%2C100&user_location=37.773%2C-122.413&skip=4&limit=100&user_key=3e4679b46d0072502aa1d79b922da235'\n json = JSON.parse response\n\n if !json.nil?\n json[\"data\"].map do |doctor|\n Doctor.create(name: \"#{doctor[\"profile\"][\"first_name\"]} #{doctor[\"profile\"][\"last_name\"]}\", image_url: doctor[\"profile\"][\"image_url\"], insurance_id: rand(1..Insurance.all.count), specialty_id: rand(1..Specialty.all.count), fee: rand(200..500))\n end\n else\n puts \"error fetching doctors\"\n end\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /u_sers/1 PUT /u_sers/1.json
def update @u_ser = USer.find(params[:id]) respond_to do |format| if @u_ser.update_attributes(params[:u_ser]) format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @u_ser.errors, status: :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @u_ser.update(u_ser_params)\n format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }\n format.json { render :show, status: :ok, location: @u_ser }\n else\n format.html { render :edit }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @u_sser.update(u_sser_params)\n format.html { redirect_to @u_sser, notice: 'U sser was successfully updated.' }\n format.json { render :show, status: :ok, location: @u_sser }\n else\n format.html { render :edit }\n format.json { render json: @u_sser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ussr = Ussr.find(params[:id])\n\n respond_to do |format|\n if @ussr.update_attributes(params[:ussr])\n format.html { redirect_to ussrs_url, notice: 'User #{@ussr.name} was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ussr.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @su = Sus.find(params[:id])\n\n respond_to do |format|\n if @su.update_attributes(params[:su])\n format.html { redirect_to @su, notice: 'Sus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @su.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @semister.update(semister_params)\n format.html { redirect_to @semister, notice: 'Semister was successfully updated.' }\n format.json { render :show, status: :ok, location: @semister }\n else\n format.html { render :edit }\n format.json { render json: @semister.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sinister.update(sinister_params)\n format.html { redirect_to @sinister, flash: { success: 'Sinister was successfully updated.' } }\n format.json { render :show, status: :ok, location: @sinister }\n else\n format.html { render :edit }\n format.json { render json: @sinister.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*a) route 'PUT', *a end", "def create\n @u_sser = USser.new(u_sser_params)\n\n respond_to do |format|\n if @u_sser.save\n format.html { redirect_to @u_sser, notice: 'U sser was successfully created.' }\n format.json { render :show, status: :created, location: @u_sser }\n else\n format.html { render :new }\n format.json { render json: @u_sser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @u_ser = USer.new(params[:u_ser])\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render json: @u_ser, status: :created, location: @u_ser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update uid\n update_json = JSON.parse(File.read('./data/live_stream/update_example.json'))\n response = call_api method: :patch, id: uid, body: update_json\n ap JSON.parse(response.body)\n return response\n end", "def update\n respond_to do |format|\n if @uset.update(uset_params)\n format.html { redirect_to usets_url, notice: \"User #{@uset.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @singer = Singer.find(params[:id])\n\n respond_to do |format|\n if @singer.update_attributes(params[:singer])\n format.html { redirect_to @singer, :notice => 'Singer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @singer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n reunion=Reunion.find_by_id params[:id]\n if reunion!= nil\n reunion.titulo=params[:titulo] ? params[:titulo]: reunion.titulo\n reunion.virtual=params[:virtual] ? params[:virtual]: reunion.virtual\n reunion.clients_id=params[:clients_id] ? params[:clients_id] : reunion.clients_id\n reunion.users_id=params[:users_id]\n if reunion.valid? && Client.exists?(reunion.clients_id) \n if reunion.users_id != nil\n if User.exists?(reunion.users_id)\n if reunion.save\n render(json: reunion, status: 201 , location: reunion)\n else\n render(json: reunion.errors, status: 422)\n end \n else\n render(json: reunion.errors, status: 422)\n end \n elsif reunion.save\n render(json: reunion, status: 201 , location: reunion)\n end\n else \n render(json: reunion.errors, status: 422)\n end\n else \n render(json: reunion.errors, status: 422)\n end\n end", "def update\n #authorize @singer\n skip_authorization\n respond_to do |format|\n if @singer.update(singer_params)\n format.html { redirect_to @singer, notice: 'Singer was successfully updated.' }\n format.json { render :show, status: :ok, location: @singer }\n else\n format.html { render :edit }\n format.json { render json: @singer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_cheer_up\n user = User.find(params[:id])\n updating_cheer_up = CheerUp.find(params[:cheer_up_id])\n updating_cheer_up.update(cheer_up_params)\n render json:\n {\n status: 200,\n user: user,\n cheer_ups: user.cheer_ups,\n updated_cheer_up: updating_cheer_up\n } # end render json\n end", "def update\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n if @uset.update_attributes(params[:uset])\n format.html { redirect_to @uset, notice: 'Uset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @souvenior.update(souvenior_params)\n format.html { redirect_to @souvenior, notice: 'Souvenior was successfully updated.' }\n format.json { render :show, status: :ok, location: @souvenior }\n else\n format.html { render :edit }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suscriber.update(suscriber_params)\n format.html { redirect_to @suscriber, notice: 'Suscriber was successfully updated.' }\n format.json { render :show, status: :ok, location: @suscriber }\n else\n format.html { render :edit }\n format.json { render json: @suscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @senator.update(senator_params)\n format.html { redirect_to @senator, notice: 'Senator was successfully updated.' }\n format.json { render :show, status: :ok, location: @senator }\n else\n format.html { render :edit }\n format.json { render json: @senator.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /u_sers/1 DELETE /u_sers/1.json
def destroy @u_ser = USer.find(params[:id]) @u_ser.destroy respond_to do |format| format.html { redirect_to u_sers_url } format.json { head :no_content } end end
[ "def destroy\n @ussr = Ussr.find(params[:id])\n @ussr.destroy\n\n respond_to do |format|\n format.html { redirect_to ussrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @u_sser.destroy\n respond_to do |format|\n format.html { redirect_to u_ssers_url, notice: 'U sser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uder.destroy\n respond_to do |format|\n format.html { redirect_to uders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uder = Uder.find(params[:id])\n @uder.destroy\n\n respond_to do |format|\n format.html { redirect_to uders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n http_api.delete(\"clients/#{@name}\")\n end", "def destroy\n @user_rk1 = UserRk1.find(params[:id])\n @user_rk1.destroy\n\n respond_to do |format|\n format.html { redirect_to user_rk1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @royaume = Royaume.find(params[:id])\n @royaume.destroy\n\n respond_to do |format|\n format.html { redirect_to royaumes_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @client1.destroy\r\n respond_to do |format|\r\n format.html { redirect_to client1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @u = U.find_by_name(params[:id])\n @u.destroy\n\n respond_to do |format|\n format.html { redirect_to us_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_1 = User1.find(params[:id])\n @user_1.destroy\n\n respond_to do |format|\n format.html { redirect_to user_1s_url }\n format.json { head :ok }\n end\n end", "def destroy\n @json.destroy\n\n head :no_content\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_sim_datum.destroy\n respond_to do |format|\n format.html { redirect_to user_sim_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user1 = User1.find(params[:id])\n @user1.destroy\n\n respond_to do |format|\n format.html { redirect_to user1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usre = Usre.find(params[:id])\n @usre.destroy\n\n respond_to do |format|\n format.html { redirect_to usres_url }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @ua = Ua.find(params[:id])\n @ua.destroy\n\n respond_to do |format|\n format.html { redirect_to uas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sluzby = Sluzby.find(params[:id])\n @sluzby.destroy\n\n respond_to do |format|\n format.html { redirect_to sluzbies_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns whether conversation has any associated unread posts
def any_unread? usr @conv.posts.each do |post| if post.unread?(usr) && post.recipient_id == usr.id return true end end return false end
[ "def has_unread_messages?\n received_messages.count > 0\n end", "def unread_submissions?\n unread_submissions > 0\n end", "def unread_replies_for_post(post)\n return 0 unless unread_replies\n unread_replies.select{|k, _| post.thread_contains? k }.collect(&:last).flatten.size\n end", "def unread?\n return (self.status == Email::STATUS_UNREAD)\n end", "def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end", "def unread?\n !read?\n end", "def thread_unread?(user)\n return false if user.nil?\n\n self.unread?(user) || self.descendants.reduce(false) { |so_far, post| so_far || post.unread?(user) }\n end", "def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end", "def has_message?\n has_message\n # && messages.count > 0\n end", "def unread_message?(message)\n (message.user != self.user) and (self.read_at.nil? or self.read_at <= message.created_at)\n end", "def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end", "def has_messages?\n # if the user has sent any or received any, then we return true\n 0 < Message.count_by_sql(%{\n SELECT COUNT(*)\n FROM messages m\n LEFT JOIN assignment_participations a_p\n ON a_p.id = m.assignment_participation_id\n LEFT JOIN assignment_submissions a_s\n ON a_s.id = a_p.assignment_submission_id\n WHERE (a_s.user_id = #{@user.id} OR a_p.user_id = #{@user.id}) AND a_s.assignment_id = #{@assignment.id}\n }) #, @user.id, @user.id, @assignment.id])\n end", "def unread_for(recipient)\n @relation.select { |conversation| conversation.is_unread?(recipient) }\n end", "def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end", "def count_unread_posts(post)\n\n # Get the last known access of the user for this post\n unread = UnreadPost.where(post_id: post.id, user_id: current_user.id)\n\n # If there is no last access recorded, assume all are unread, else, get the amount\n # of posts created after the date of last access, and count them\n if unread.count == 0\n @unread_replies = Reply.where(post_id: post.id)\n\n # Plus one, as the post is unread\n count = @unread_replies.count + 1\n else\n @unread_replies = Reply.get_last_access(post.id, unread[0].updated_at, current_user.id)\n\n count = @unread_replies.count\n\n # If the user hasn't seen the post, add one to unread\n if post.created_at > unread[0].updated_at\n count = count + 1\n end\n end\n\n count\n end", "def still_unread()\n\t\tif (self.score_1.blank? or self.score_2.blank?)\n\t\t\treturn true\n\t\tend\n\tend", "def is_subscribed?(post)\n subscriptions.where(:post => post).count > 0\n end", "def unseen_count\r\n conversation_members.where(:viewed => false, :parted => true).count\r\n end", "def unread_messages_count\n @unread_messages_count ||= messages.unread.count\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets all posts in a convo to 'removed'
def remove_posts usr @conv.posts.each do |post| if usr.id == post.user_id post.status = 'removed' elsif usr.id == post.recipient_id post.recipient_status = 'removed' end post.save end end
[ "def remove_posts usr\n ConversationProcessor.new(self).remove_posts usr\n end", "def clear!\n @posts = nil\n end", "def undelete_post(post_params)\n post_params[:delete] = [\"fm_published\"]\n update_post(post_params)\n end", "def undelete_post(post_params)\n post_params[:delete] = ['fm_published']\n update_post(post_params)\n end", "def remove_post user \n if user.id == @post.user_id\n @post.update_attributes(status: 'removed')\n elsif user.id == @post.recipient_id \n @post.update_attributes(recipient_status: 'removed')\n end\n end", "def onRemoved(links)\n @set -= links\n end", "def unpublished_posts\n @blog_posts = BlogPost.where(:deleted => '0').where(:publish => \"0\").order('created_at DESC')\n end", "def delete post\n\t\t$DIRTY << :news\n\t\tpost = @children[post] if post.kind_of? Integer\n\t\traise ArgumentError, \"Post not found\" unless @children.include? post\n\n\t\tif @children[-1] == post and post.children.size == 0\n\t\t\t@children.delete post\n\t\telse\n\t\t\tpost.title = \"<Deleted>\"\n\t\t\tpost.body = \"<Post deleted>\"\n\t\t\tpost.drill(true){|b| b.locked = true}\n\t\tend\n\n\t\tpost.sticky = false if post.sticky\n\tend", "def before_destroy\n \ttags.each do |tag|\n \t\t#tags.destroy tag \t\t\n\t\t\tActiveRecord::Base.connection.execute(\"delete from posts_tags where tag_id='#{tag.id}' and post_id=#{id} \")\n \tend \t\n end", "def wipeout_unposted_works\n works.find(:all, :conditions => {:posted => false}).each do |w|\n w.destroy\n end\n end", "def rem_cat_pages\n\tself.pages.each do |p|\n\t p.category_id = nil\n\t p.save\n\tend\n end", "def remove_post user \r\n PostProcessor.new(self).remove_post user\r\n end", "def cleanup_unposted_works\n works.find(:all, :conditions => ['works.posted = ? AND works.created_at < ?', false, 1.week.ago]).each do |w|\n w.destroy\n end\n end", "def unfave!(post)\n fave = self.faves.find_by_post_id(post.id)\n fave.destroy!\n end", "def unheart!(post)\n heart = self.hearts.find_by_post_id(post.id)\n heart.destroy!\n end", "def before_destroy\n @categories_copy.each do |cc|\n cc.purge\n end\n end", "def destroy\n destroy_q(@post, posts_url)\n end", "def remove_one_category_post\n Category.first.posts.delete(Category.first.posts.last) # this works\nend", "def mark_as_removed!\n self.removed = true\n self.save\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mark all posts in a conversation
def mark_all_posts usr return false if usr.blank? @conv.posts.each do |post| post.mark_as_read! for: usr if post end end
[ "def mark_all_posts usr\n ConversationProcessor.new(self).mark_all_posts usr\n end", "def map_posts_to_conversations\n Post.order.reverse_order.each do |post|\n post.status = post.recipient_status = 'active'\n if post.conversation_id.nil?\n \n # finds if there is already an existing conversation for the post\n conv = Conversation.get_conv post.pixi_id, post.recipient_id, post.user_id\n\n # finds if there is existing conversation with swapped recipient/user\n if conv.blank?\n conv = Conversation.get_conv post.pixi_id, post.user_id, post.recipient_id\n end\n\n # create new conversation if one doesn't already exist\n if conv.blank?\n if listing = Listing.where(:pixi_id => post.pixi_id).first\n conv = listing.conversations.create pixi_id: post.pixi_id, user_id: post.user_id, recipient_id: post.recipient_id\n\t end\n elsif conv.status != 'active' || conv.recipient_status != 'active'\n conv.status = conv.recipient_status = 'active'\n conv.save\n end\n\n # updates post with conversation id\n post.conversation_id = conv.id if conv\n end\n post.save\n end\n end", "def set_unread_posts(post)\n\n unread = UnreadPost.where(post_id: post.id, user_id: current_user.id)\n\n if unread.count == 0\n @unread_replies = Reply.where(post_id: post.id)\n else\n @unread_replies = Reply.get_last_access(post.id, unread[0].updated_at, current_user.id)\n end\n end", "def flag_linked_posts_as_spam\n disagreed_flag_post_ids = PostAction.where(post_action_type_id: PostActionType.types[:spam])\n .where.not(disagreed_at: nil)\n .pluck(:post_id)\n\n topic_links.includes(:post)\n .where.not(post_id: disagreed_flag_post_ids)\n .each do |tl|\n begin\n message = I18n.t('flag_reason.spam_hosts', domain: tl.domain)\n PostAction.act(Discourse.system_user, tl.post, PostActionType.types[:spam], message: message)\n rescue PostAction::AlreadyActed\n # If the user has already acted, just ignore it\n end\n end\n end", "def mark(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n end", "def update_counter_cache\r\n Conversation.reset_counters(self.conversation_id, :active_posts)\r\n end", "def mark_spam\n self.update(flag: SPAM)\n end", "def mark_all_as_read\n messages = current_user.unread_messages.where(chat_id: params[:chat_id])\n current_user.unread_messages.delete(messages)\n render json: { status: 'done' }, status: 200\n end", "def update_replies\n if self.in_reply_to_status_id\n Tweet.push({:tweet_id => self.in_reply_to_status_id}, :reply_ids => self.id)\n Tweet.increment({:tweet_id => self.in_reply_to_status_id}, :reply_count => 1)\n end\n end", "def mark_as_visited\n current_user.mark_read_messages(@conversation)\n head(:ok)\n end", "def remove_posts usr\n @conv.posts.each do |post|\n if usr.id == post.user_id\n post.status = 'removed'\n elsif usr.id == post.recipient_id\n post.recipient_status = 'removed'\n end\n post.save\n end\n end", "def mark_seen\n payload = {\n recipient: sender,\n sender_action: 'mark_seen'\n }\n\n Facebook::Messenger::Bot.deliver(payload, access_token: access_token)\n end", "def mark_all_as_read(blog_id=nil)\n timestamp = Time.now\n\n subs = []\n if !blog_id.nil?\n subs = subscriptions.where(:blog_id => blog_id).limit(1)\n else\n subs = subscriptions\n end\n\n subs.each do |sub|\n sub.unread_marker = timestamp\n\n begin\n sub.save!\n rescue Exception => e\n Rails.logger.error e\n return false\n end\n end\n\n true\n end", "def _message_set_all(messages)\n @message_stack = messages\n end", "def reset_unread_conversations_counter\n unread_count = conversations.unread.count\n if self.unread_conversations_count != unread_count\n self.class.where(:id => id).update_all(:unread_conversations_count => unread_count)\n end\n end", "def mark_thread_as_read!(user)\n return if user.nil? \n\n self.mark_as_read! :for => user\n self.descendants.each do |post|\n post.mark_as_read! :for => user\n end\n end", "def update_read_statuses\n person_conversations.each do |p_c|\n if p_c.person_id == last_message.sender.id\n p_c.update_attribute(:last_sent_at, last_message.created_at)\n else\n p_c.update_attributes({ :is_read => 0, :last_received_at => last_message.created_at })\n end \n end\n end", "def enable_inbox_replies\n client.post('/api/sendreplies', id: read_attribute(:name), state: true)\n end", "def mark_old_broadcasts\n BroadcastMessage.all.each do |broadcast|\n broadcast.users_viewed << self.id\n broadcast.save\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes an instance url:: URL to a BigBlueButton server (e.g. salt:: Secret salt for this server version:: API version: 0.7 (valid for 0.7, 0.71 and 0.71a)
def initialize(url, salt, version='0.7', debug=false) @supported_versions = ['0.7','0.8'] @url = url @salt = salt @debug = debug if version.nil? @version = get_api_version else @version = version end unless @supported_versions.include?(@version) raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}") end puts "BigBlueButtonAPI: Using version #{@version}" if @debug end
[ "def initialize(url, salt, version='0.7', debug=false)\n @supported_versions = ['0.7', '0.8']\n @url = url\n @salt = salt\n @debug = debug\n @timeout = 10 # default timeout for api requests\n @request_headers = {} # http headers sent in all requests\n\n @version = version || get_api_version\n unless @supported_versions.include?(@version)\n raise BigBlueButtonException.new(\"BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}\")\n end\n\n puts \"BigBlueButtonAPI: Using version #{@version}\" if @debug\n end", "def initialize(url, secret, version=nil, logger=nil, sha256=false)\n @supported_versions = ['0.8', '0.81', '0.9', '1.0']\n @url = url.chomp('/')\n @secret = secret\n @timeout = 10 # default timeout for api requests\n @request_headers = {} # http headers sent in all requests\n @logger = logger\n @sha256 = sha256\n # If logger is not informed, it defaults to STDOUT with INFO level\n if logger.nil?\n @logger = Logger.new(STDOUT)\n @logger.level = Logger::INFO\n end\n \n version = nil if version && version.strip.empty?\n @version = nearest_version(version || get_api_version)\n unless @supported_versions.include?(@version)\n @logger.warn(\"BigBlueButtonAPI: detected unsupported version, using the closest one that is supported (#{@version})\")\n end\n\n @logger.debug(\"BigBlueButtonAPI: Using version #{@version}\")\n end", "def initialize(url = 'localhost')\n @url = url\n end", "def initialize(url_or_port, api_key_or_file, api_version=nil)\n url_or_port = \"http://localhost:#{url_or_port}\" if url_or_port.is_a? Integer\n @uri = URI.parse(url_or_port)\n @api_key = api_key_or_file.is_a?(IO) ? api_key_or_file.read : api_key_or_file\n @api_version = api_version ? api_version.to_s : current_api_version.to_s\n @ssl_verify = OpenSSL::SSL::VERIFY_PEER\n end", "def initialize(appid)\n @appid = appid\n @url = URI.parse \"http://#{@host}/#{@service_name}/#{@version}/\"\n end", "def initialize(base_uri= \"http://localhost:8080\")\n @base_uri = base_uri\n @version = \"v1\"\n end", "def initialize(url_or_port, api_key_or_file, api_version=nil)\n @client = Client.new(url_or_port, api_key_or_file, api_version)\n end", "def init\n Biilabs.configuration do |config|\n config.host = SET_HOST_URL_HERE_HERE\n end\nend", "def prepare\n @api = BigBlueButton::BigBlueButtonApi.new(URL, SECRET, VERSION.to_s, true)\n end", "def initialize\n\t\t\t# checking internet connectivity\n\t\t\traise Exception::NoInternetConnection if ping != :pong\n\n\t\t\t@url = SERVICE_URL\n\t\tend", "def initialize(url)\n @url = url\n connect!\n end", "def initialize base_url\n @base_url = base_url\n end", "def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend", "def initialize(url, &on_reconnect)\n @url = url\n @beanstalk = nil\n @on_reconnect = on_reconnect\n connect!\n end", "def api\n if @api.nil?\n @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,\n self.version.to_s, false)\n end\n @api\n end", "def initialize(url)\n @url = url\n end", "def initialize(options = {})\n @url = options.fetch :url\n @private_key = options.fetch :private_key, default_private_key\n @private_key = default_private_key if @private_key.blank?\n end", "def initialize(username, password, host, port='8089', index='main',\n scheme='https')\n @username = username\n @password = password\n @splunk_url = URI::HTTP.new(\n scheme, nil, host, port, nil, nil, nil, nil, nil).to_s\n @index = index\n end", "def initialize(name, ip, url_endpoint)\n @name = name\n @ip = ip\n @url = \"http://#{ip}/#{url_endpoint}\"\n @username = \"\"\n @password = \"\"\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the url used to join the meeting meeting_id:: Unique identifier for the meeting user_name:: Name of the user password:: Password for this meeting used to set the user as moderator or attendee user_id:: Unique identifier for this user web_voice_conf:: Custom voiceextension for users using VoIP
def join_meeting_url(meeting_id, user_name, password, user_id = nil, web_voice_conf = nil) params = { :meetingID => meeting_id, :password => password, :fullName => user_name, :userID => user_id, :webVoiceConf => web_voice_conf } get_url(:join, params) end
[ "def join_meeting_url(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n get_url(:join, params)\n end", "def join_meeting_url(meeting_id, user_name, password, options={})\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n url, data = get_url(:join, params)\n url\n end", "def attendee_url(meeting_id, user_name, attendee_password)\n get_url(:join, {:meetingID=>meeting_id,:password=>attendee_password, :fullName=>user_name})\n end", "def moderator_url(meeting_id, user_name, password)\n attendee_url(meeting_id, user_name, password)\n end", "def get_meeting_url\n prepare()\n @api.join_meeting_url(params[:id], params[:username], params[:password])\n end", "def join_url(username, role)\n if role == :moderator\n self.server.api.join_meeting_url(self.meetingid, username, self.moderator_password)\n else\n self.server.api.join_meeting_url(self.meetingid, username, self.attendee_password)\n end\n end", "def join_url(username, role, key=nil, options={})\n server = BigbluebuttonRails.configuration.select_server.call(self, :join_meeting_url)\n\n pass = case role\n when :moderator\n self.moderator_api_password\n when :attendee\n self.attendee_api_password\n when :guest\n if BigbluebuttonRails.configuration.guest_support\n options = { guest: true }.merge(options)\n end\n self.attendee_api_password\n else\n map_key_to_internal_password(key)\n end\n\n r = server.api.join_meeting_url(self.meetingid, username, pass, options)\n r.strip! unless r.nil?\n r\n end", "def join_meeting(meeting_id, user_name, password)\n send_api_request(:join, {:meetingID=>meeting_id, :password=>password,\n :fullName=>user_name, :redirectImmediately=>0} )\n doc.root.get_text('/response/entryURL').to_s\n end", "def join_url(username, role, password=nil)\n require_server\n\n case role\n when :moderator\n self.server.api.join_meeting_url(self.meetingid, username, self.moderator_password)\n when :attendee\n self.server.api.join_meeting_url(self.meetingid, username, self.attendee_password)\n else\n self.server.api.join_meeting_url(self.meetingid, username, password)\n end\n end", "def tujoinuri\n start_str = 'meetingID=' + id.to_s\n if !user.username.nil?\n start_str+='&fullName='+ tutor.user.fullname\n end \n \n if !moderatorPW.nil?\n start_str+='&password=' + moderatorPW\n end \n start_str.gsub!(' ', '+')\n buildurl(start_str,\"join\")\n end", "def stjoinuri\n start_str = 'meetingID=' + id.to_s\n if !user.username.nil?\n start_str+='&fullName='+ user.fullname\n end \n \n if !attendeePW.nil?\n start_str+='&password=' + attendeePW\n end \n \n start_str.gsub!(' ', '+')\n buildurl(start_str,\"join\")\n end", "def default_meeting_options\n invite_msg = \"To invite someone to the meeting, send them this link:\"\n {\n user_is_moderator: false,\n meeting_logout_url: request.base_url + logout_room_path(@room),\n meeting_recorded: true,\n moderator_message: \"#{invite_msg}\\n\\n #{request.base_url + room_path(@room)}\",\n }\n end", "def create_and_join_meeting\n meeting_id = params[:meeting_id]\n meeting_name = params[:meeting_name]\n username = params[:username]\n user_password = params[:user_password]\n moderator_password = params[:moderator_password]\n\n if @@api.is_meeting_running?(meeting_id)\n join_meeting(meeting_id,username,password)\n else\n create_meeting(meeting_name,meeting_id,user_password,moderator_password)\n join_meeting(meeting_id,username,moderator_password)\n end\n \n end", "def invite_path\n \"#{Rails.configuration.relative_url_root}/#{CGI.escape(uid)}\"\n end", "def online_meeting_url\n return @online_meeting_url\n end", "def user_voice_url(user = current_user)\n url = \"http://support.activecell.com\"\n url << \"/login_success?sso=#{CGI.escape(user.uv_sso_token)}\" if user.present?\n url\n end", "def invite_path\n \"#{Rails.configuration.relative_url_root}/#{uid}\"\n end", "def question_share_url_userlist(question_id)\n question = Question.get_question(question_id)\n custom_url = question.short_url\n common_url = question.custom_url(\"qr\",nil,question.user_id)\n user_info_lists = self.business_customer_infos.where(\"email != ''\") if self.business_customer_infos\n voice_msg = Question.play_demo(question_id)\n return question, custom_url, common_url, user_info_lists, voice_msg\nend", "def createuri\n start_str = 'meetingID=' + id.to_s \n if !name.nil?\n start_str+=('&name=' + name.to_s)\n end\n \n if !moderatorPW.nil?\n start_str+='&moderatorPW=' + moderatorPW.to_s\n end\n \n if !attendeePW.nil?\n start_str+='&attendeePW=' + attendeePW.to_s\n end\n \n if !tutor_availability.nil?\n start_str+='&duration=' + (tutor_availability.length*60).to_s + '&logoutURL='+ logouturl + id.to_s + '?finish=1&record=true'\n end #finishing up the querystring to calculate checksum\n #\n start_str.gsub!(\" \",\"+\")\n buildurl(start_str,\"create\")\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true or false as to whether meeting is open. A meeting is only open after at least one participant has joined. meeting_id:: Unique identifier for the meeting
def is_meeting_running?(meeting_id) hash = send_api_request(:isMeetingRunning, { :meetingID => meeting_id } ) hash[:running].downcase == "true" end
[ "def meeting_running?(id)\n prepare()\n @api.is_meeting_running?(id)\n end", "def meeting_running?(id)\n prepare\n @api.is_meeting_running?(id)\n end", "def opened?\n opened_at.present?\n end", "def appointment?\n !open && !close\n end", "def is_meeting_running?(meeting_id, options={})\n params = { :meetingID => meeting_id }.merge(options)\n hash = send_api_request(:isMeetingRunning, params)\n BigBlueButtonFormatter.new(hash).to_boolean(:running)\n end", "def open?\n event_status_id == 1\n end", "def is_open?\n closed_at.blank?\n end", "def room_is_open?(r,t)\n t_as_time = t.strftime('%H%M').to_i\n unless r.hours.nil? or r.hours[:hours_start].nil? or r.hours[:hours_end].nil?\n #Parse our start and end hour and add 12 to the hour if in PM\n hour_start = (r.hours[:hours_start][:ampm].to_s == \"am\") ? \n (r.hours[:hours_start][:hour].to_i == 12) ? 0 : r.hours[:hours_start][:hour].to_i : \n (r.hours[:hours_start][:hour].to_i == 12) ? r.hours[:hours_start][:hour].to_i : r.hours[:hours_start][:hour].to_i + 12\n hour_end = (r.hours[:hours_end][:ampm].to_s == \"am\") ? \n (r.hours[:hours_end][:hour].to_i == 12) ? 0 : r.hours[:hours_end][:hour].to_i : \n (r.hours[:hours_end][:hour].to_i == 12) ? r.hours[:hours_end][:hour].to_i : r.hours[:hours_end][:hour].to_i + 12\n #Create dates and format them as comparable integers\n open_time = DateTime.new(1,1,1,hour_start,r.hours[:hours_start][:minute].to_i).strftime('%H%M').to_i\n close_time = DateTime.new(1,1,1,hour_end,r.hours[:hours_end][:minute].to_i).strftime('%H%M').to_i\n #Room is always open is open time equals close time\n return true if open_time == close_time\n #If close time is before opening time (i.e. hours wrap back around to am) \n #and current time is less than the closing time return true\n return true if close_time < open_time and t_as_time < close_time\n #Some processing for wraparound hours\n close_time = (close_time < open_time) ? close_time + 2400 : close_time\n #See if current time (t) is between opening and closing\n return (t_as_time >= open_time and t_as_time < close_time)\n end\n #The room is always open if there are no hours setup\n return true\n end", "def check_close_data_presence(meeting)\n return if meeting.closed_at.present? || !minutes_data?(meeting)\n\n meeting.closed_at = Time.current\nend", "def open?\n open_date < Time.now && !past_deadline? rescue nil\n end", "def meeting_chat_enabled\n return @meeting_chat_enabled\n end", "def check_closing_visibility(meeting)\n return unless meeting.minutes_visible.nil?\n return if minutes_data?(meeting) || meeting.closed_at.blank?\n\n meeting.minutes_visible = true\nend", "def is_meeting_response\n return @is_meeting_response\n end", "def open?\n event_end_date.blank?\n end", "def open?\n envelope.state == \"OPEN\"\n end", "def current_meeting?\n Meeting.where(committee: self).and(Meeting.where(end_time: nil)).exists?\n end", "def is_online_meeting\n return @is_online_meeting\n end", "def is_meeting_request\n return @is_meeting_request\n end", "def open_enrollment_contains?(date)\n (open_enrollment_start_on <= date) && (date <= open_enrollment_end_on)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
alias for summary also add descr shortcut??
def desc() summary; end
[ "def summary\n definition \"Summary\"\n end", "def summary; end", "def summary_dl; @summary; end", "def summary\n @summary\n end", "def apply_summary; nil; end", "def get_summary\n self.get_info('summary')\n end", "def emi_summary\n end", "def cut_description_to_summary\n self.summary = self.description\n end", "def summary(event)\n if is_valid_description?(event.description) && event.summary\n \"#{event.summary} - #{event.description}\"\n elsif is_valid_description?(event.description)\n event.description\n elsif event.summary\n event.summary\n else\n \"no details\"\n end\n end", "def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def default_description\n self.description ||= summary\n end", "def summary(name, mark, grade)\n return \"#{name} got #{mark}% and was awarded a grade #{grade}\"\nend", "def render_summary\n summary = nil\n max_chars = (self.display_configuration.try {|h| h[\"summary_max_chars\"]}) || 280\n\n\n\n if self.snippets.length > 0 && !(self.display_configuration.try {|h| h[\"prefer_abstract_as_summary\"]} && self.abstract)\n summary = self.snippets.first\n self.snippets.slice(1, self.snippets.length).each do |snippet|\n summary += ' '.html_safe + snippet if (summary.length + snippet.length) <= max_chars\n end\n else\n summary = _h.bento_truncate( self.abstract, :length => max_chars )\n end\n\n summary\n end", "def summary\n return @summary\n end", "def create_summary(key, attributes)\n translate(\"#{key}.summary\", attributes)\n end", "def summary_detail\n Classifieds::Listing.format_cols([@name, @location], SUMMARY_COL_FORMATS)\n end", "def summary\n summary =\"Planet #{name} is the color #{color} and it weights #{mass_kg}. and its #{distance_from_sun_km} km away from the sun. Here's a fun fact: #{fun_fact}.\"\n return summary\n end", "def summary=(value)\n @summary = value\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We allow document series to be assigned directly on an edition for speed tagging
def document_series_ids=(ids) raise(StandardError, 'cannot assign document series to an unsaved edition') unless persisted? document.document_series_ids = ids end
[ "def add_series\n @bib.series.each do |s|\n case s.type\n when \"journal\"\n @item.journal = s.title.title\n @item.number = s.number if s.number\n when nil then @item.series = s.title.title\n end\n end\n end", "def index_suppressed(solr_document)\n solr_document[suppressed_field] = object.suppressed?\n end", "def related_document_support; end", "def change_series\n return unless request.xhr?\n serie_id = params[:serie_id]\n @quotation_line = QuotationLine.new(params[:quotation_line])\n @openings = {} #params[:openings]\n @section_height = params[:section_height] || {}\n @section_width = params[:section_width] || {}\n @serie = Serie.includes(:options => [:pricing_method, :options_minimum_unit]).find(serie_id)\n initialize_options_for_series()\n end", "def addSeries series\r\n\t\t@seriesSet.push series\r\n\tend", "def seriesAdded\n tag_range(\"800\", \"83X\")\n end", "def set_scn_tag\n\t\t# Creating the limitation for the question tags\n\t\tscn_tag_limit = setting.build_scn_tag(scn_tag_limit: params[:scn_tag_limit])\n\t\t# creating the question tags limit\n\t\tif scn_tag_limit.save\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Scn Tag limit Successfully Updated.\",response: {scn_tag_limit: scn_tag_limit.scn_tag_limit.as_json }},:status=>200\n\t else\n\t render :json=> { success: false, message: scn_tag_limit.errors },:status=> 203\n\t end\t\n\tend", "def createSeries(createSeriesId, meeting_metadata, real_start_time)\n BigBlueButton.logger.info( \"Attempting to create a new series...\")\n # Check if a series with the given identifier does already exist\n seriesExists = false\n seriesFromOc = requestIngestAPI(:get, '/series/allSeriesIdTitle.json', DEFAULT_REQUEST_TIMEOUT, {})\n begin\n seriesFromOc = JSON.parse(seriesFromOc)\n seriesFromOc[\"series\"].each do |serie|\n BigBlueButton.logger.info( \"Found series: \" + serie[\"identifier\"].to_s)\n if (serie[\"identifier\"].to_s === createSeriesId.to_s)\n seriesExists = true\n BigBlueButton.logger.info( \"Series already exists\")\n break\n end\n end\n rescue JSON::ParserError => e\n BigBlueButton.logger.warn(\" Could not parse series JSON, Exception #{e}\")\n end\n\n # Create Series\n if (!seriesExists)\n BigBlueButton.logger.info( \"Create a new series with ID \" + createSeriesId)\n # Create Series-DC\n seriesDcData = parseDcMetadata(meeting_metadata, getSeriesDcMetadataDefinition(meeting_metadata, real_start_time))\n seriesDublincore = createDublincore(seriesDcData)\n # Create Series-ACL\n seriesAcl = createSeriesAcl(parseAclMetadata(meeting_metadata, getSeriesAclMetadataDefinition(),\n $defaultSeriesRolesWithReadPerm, $defaultSeriesRolesWithWritePerm))\n BigBlueButton.logger.info( \"seriesAcl: \" + seriesAcl.to_s)\n\n requestIngestAPI(:post, '/series/', DEFAULT_REQUEST_TIMEOUT,\n { :series => seriesDublincore,\n :acl => seriesAcl,\n :override => false})\n\n # Update Series ACL\n else\n BigBlueButton.logger.info( \"Updating series ACL...\")\n seriesAcl = requestIngestAPI(:get, '/series/' + createSeriesId + '/acl.xml', DEFAULT_REQUEST_TIMEOUT, {})\n roles = parseAclMetadata(meeting_metadata, getSeriesAclMetadataDefinition(), $defaultSeriesRolesWithReadPerm, $defaultSeriesRolesWithWritePerm)\n\n if (roles.length > 0)\n updatedSeriesAcl = updateSeriesAcl(seriesAcl, roles)\n requestIngestAPI(:post, '/series/' + createSeriesId + '/accesscontrol', DEFAULT_REQUEST_TIMEOUT,\n { :acl => updatedSeriesAcl,\n :override => false})\n BigBlueButton.logger.info( \"Updated series ACL\")\n else\n BigBlueButton.logger.info( \"Nothing to update ACL with\")\n end\n end\nend", "def target_edition=(value)\n @target_edition = value\n end", "def series; end", "def update_teacher_set_availability_in_elastic_search\n body = {\n :availability => self.availability,\n :available_copies => self.available_copies\n }\n ElasticSearch.new.update_document_by_id(self.id, body)\n end", "def add_series(series)\n type_check(series, :series)\n Series.create(series)\n end", "def series_uid\n @dicom_series_uid || @series_uid\n end", "def series_type; end", "def series_title\n return title if series?\n @doc = SolrDocument.new(Blacklight.solr.select(:params => { :fq => \"#{SolrDocument.unique_key}:#{series}\" })[\"response\"][\"docs\"].first)\n @doc.title\n end", "def in_series?\n (journal_id or next_journal) ? true : false\n end", "def adjust_series_restriction\n unless self.series.blank?\n self.series.each {|s| s.adjust_restricted }\n end\n end", "def after_update\n super\n self.class.call_es { index_document }\n end", "def proprietary_series_id=(id)\n series_identifier_set(1, id)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the width of the named style. +style_name+ defaults to the attribute's default_style.
def width(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) from_examination :@original_width else dimensions(style_name).at(0) end end
[ "def width(style_name='original')\n geometry(style_name).width.to_i\n end", "def width(style=nil)\n dimensions(style)[:width]\n end", "def style name\n Attribute.new \"style = %p\" % [name]\n end", "def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n if left_aligned?\n value.size\n\n else\n geometry.bordered_width\n\n end\n\n else\n value.size\n\n end\n end", "def style_name=(value)\n styles[0] = value\n end", "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end", "def style_name=(value)\n self.styles[0] = value\n end", "def size\n\t\treturn @styles.size\n\tend", "def get_style style_name\n style = @auto_styles.elements[\"*[@style:name = '#{styleName}']\"]\n if style\n file = CONTENT\n else\n style = @office_styles.elements[\"*[@style:name = '#{styleName}']\"]\n die \"Could not find style \\'#{styleName}\\' in content.xml or styles.xml\" unless style\n file = STYLES\n end\n return file, style\n end", "def [](name)\n\t\tstyle = @cache[name]\n\t\tif style\n\t\t\treturn style\n\t\telse\n\t\t\traise \"No style found with that name\"\n\t\tend\n\tend", "def get_original_width( design_template, image_name )\n o = get_image_object( design_template, image_name )\n o[ 'width' ]\n end", "def style(id, name = nil)\n Style.new(id, name: name)\n end", "def getStyleName\n styleNameHelper(MODE_GET)\n end", "def stylename=(stylename)\n @stylename = stylename\n style(stylesheet.query(stylename)) if stylesheet\n end", "def width\n element.wd.size['width']\n end", "def style\n return @style\n end", "def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end", "def width\r\n has_width? ? parms[0].to_i : 0\r\n end", "def width\n @font.text_width(self.text)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the height of the named style. +style_name+ defaults to the attribute's default_style.
def height(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) from_examination :@original_height else dimensions(style_name).at(1) end end
[ "def height(style_name='original')\n geometry(style_name).height.to_i\n end", "def height(style=nil)\n dimensions(style)[:height]\n end", "def css_style_height(height = '')\n height = height.to_s.as_css_size\n height.blank? ? '' : \"height:#{height};\"\n end", "def height(name)\n Tk.execute(:image, :height, name)\n end", "def font_height(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hh = @fonts[@current_font].fontbbox[3].to_f - @fonts[@current_font].fontbbox[1].to_f\n (size * hh / 1000.0)\n end", "def height\n @font.height\n end", "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end", "def height\n element.wd.size['height']\n end", "def height_of_with_formatting(string, line_width, size=font_size, options={}) #:nodoc:\n if unformatted?(string, options)\n height_of_without_formatting(string, line_width, size)\n else\n formatted_height(string, line_width, size, options)\n end\n end", "def height\n if alignment == :vertical\n @height ||= @options.count * @options.first.height\n else\n @height ||= @options.first.height\n end\n end", "def height\n result = super\n result = text_height if result == 0 # TODO: :auto\n \n result\n end", "def height\n (@options[:height] || svg.try(:height) || 16).to_i\n end", "def image_height(image_file)\n _, height = image_dimensions(image_file)\n Sass::Script::Number.new(height, [\"px\"])\n end", "def retrieve_height(param)\n unless (height = param[:height])\n height = self::DEFAULT_HEIGHT if param[:list_direction] == :vertical\n height ||= param[:list_height]\n height ||= self::DEFAULT_HEIGHT\n end\n return height\n end", "def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end", "def font_size\r\n @style.font_size || @default_font_size\r\n end", "def [](name)\n\t\tstyle = @cache[name]\n\t\tif style\n\t\t\treturn style\n\t\telse\n\t\t\traise \"No style found with that name\"\n\t\tend\n\tend", "def style name\n Attribute.new \"style = %p\" % [name]\n end", "def d_dn\n geometry.bordered_height\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the aspect ratio of the named style. +style_name+ defaults to the attribute's default_style.
def aspect_ratio(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) original_width = from_examination(:@original_width) original_height = from_examination(:@original_height) original_width.to_f / original_height else w, h = *dimensions(style_name) w.to_f / h end end
[ "def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end", "def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end", "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end", "def width(style_name='original')\n geometry(style_name).width.to_i\n end", "def aspect_ratio(size)\n size[:width].to_f / size[:height]\n end", "def aspect_ratio\n return 'none' unless fixed_ratio?\n dims = fullsize_settings[:dimensions]\n dims[0].to_f / dims[1]\n end", "def aspect_ratio\n if self.width && self.height\n return self.width/self.height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end", "def width(style=nil)\n dimensions(style)[:width]\n end", "def aspect_ratio\n if matches = @raw_metadata.match(/DAR\\s+([0-9]+):([0-9]+)/)\n w = $1.to_f\n h = $2.to_f\n elsif dimension\n w = dimension[0].to_f\n h = dimension[1].to_f\n end\n if w && h && w > 0 && h > 0\n w/h\n end\n end", "def height(style_name='original')\n geometry(style_name).height.to_i\n end", "def ratio\n\t\th = attribute_get(:height)\n\t\tw = attribute_get(:weight)\n\t\treturn nil unless (h && w)\n\t\t\n\t\t# get ratio, abort if nil, or\n\t\t# crop to two decimal places\n\t\tr = self.class.ratio(h, w)\n\t\treturn nil if r.nil?\n\t\tsprintf(\"%.2f\", r).to_f\n\tend", "def aspect_ratio(modulus = 1)\n @aspect_ratio ||= settings[:aspect_ratio] ||= begin\n w = width(modulus)\n h = height(modulus)\n if w > 0 && h > 0\n w/h.to_f\n else\n 1\n end\n end\n end", "def style name\n Attribute.new \"style = %p\" % [name]\n end", "def proportion\n prop = get_style_arg(:proportion, 0)\n end", "def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end", "def aspect_ratio\n if self.native_width && self.native_height\n return self.native_width/self.native_height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end", "def aspect_ratio(avail_width=nil, avail_height=nil)\n case self.aspect_ratio_method\n when ASPECT_RATIO_DEFAULT_METHOD\n return ASPECT_RATIO_DEFAULT_WIDTH / ASPECT_RATIO_DEFAULT_HEIGHT.to_f\n when ASPECT_RATIO_MANUAL_METHOD\n return self.native_width/self.native_height.to_f\n when ASPECT_RATIO_MAX_METHOD\n width = avail_width || ASPECT_RATIO_DEFAULT_WIDTH\n height = avail_height || ASPECT_RATIO_DEFAULT_HEIGHT\n return width / height.to_f\n end\n end", "def aspect_ratio\n raise \"cannot compute aspect ratio of non-image\" unless image?\n width.to_f / height.to_f\n end", "def pixel_aspect_ratio\n ar = 1.0\n if matches = @raw_metadata.match(/(?:P|S)AR\\s+([0-9]+):([0-9]+)/)\n w = $1.to_f\n h = $2.to_f\n if w > 0 && h > 0\n ar = w/h\n end\n end\n ar\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the width and height of the named style, as a 2element array.
def dimensions(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) original_width = from_examination(:@original_width) original_height = from_examination(:@original_height) [original_width, original_height] else resize_dimensions(dimensions(:original), reflection.styles[style_name]) end end
[ "def styles\n return @metadata[:styles]\n end", "def generate_style_array\n styles = Array.new\n\n #extract the styles from the hash\n get_styles.each do |k,v|\n styles.push(v)\n end\n\n return styles\n end", "def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end", "def style_names\n styles.keys\n end", "def size\n\t\treturn @styles.size\n\tend", "def width(style=nil)\n dimensions(style)[:width]\n end", "def to_a\n return width, height\n end", "def height(style=nil)\n dimensions(style)[:height]\n end", "def inline_styles\n parser.css(\"style\").to_a\n end", "def size\r\n [self.width, self.height]\r\n end", "def view_accepted_styles()\n [ :width, :height, :background_color, :foreground_color ].freeze\n end", "def styles( album)\n return get_metadata( album )[:styles]\n end", "def dimensions_of(name)\n info = Magick::Image.ping path_to_sprite(name)\n [info.first.columns, info.first.rows]\n end", "def parse_style_attribute(style)\n params = {}\n style.split(\";\").each do |s| \n param = s.strip.split(\":\")\n params[param[0].to_sym] = param[1]\n end\n return params\n end", "def get_style(style_number)\n json = execute(\n 'external-api/media/get-style',\n 'styleNo': style_number\n )\n\n images = json.dig('style', 'images')\n\n images || []\n end", "def get_styles\n # what is self? ==> painter instance\n\n self.paintings.map do |painting|\n # return the array with just the style string\n # paintng.style\n\n # return hash for a painting title and style\n {style: painting.style, title: painting.title}\n end.uniq\n\n end", "def dimensions\n rows = []\n cols = []\n @win.getmaxyx(rows, cols)\n rows = rows.first\n cols = cols.first\n [rows, cols]\n end", "def styles\n mentos(:get_all_styles)\n end", "def get_element_size(element)\n width = element.size.width\n height = element.size.height\n [width, height]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the dimensions, as an array [width, height], that result from resizing +original_dimensions+ for the given +style+.
def resize_dimensions(original_dimensions, style) if style.filled? style.dimensions else original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1] target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1] if original_aspect_ratio > target_aspect_ratio width = style.dimensions[0] height = (width / original_aspect_ratio).round else height = style.dimensions[1] width = (height * original_aspect_ratio).round end [width, height] end end
[ "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end", "def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end", "def extrapolate_dimensions_from_original\n return unless original_url\n if original_dimensions = FastImage.size(original_url)\n sizes = {\n original: {\n width: original_dimensions[0],\n height: original_dimensions[1]\n }\n }\n max_d = original_dimensions.max\n # extrapolate the scaled dimensions of the other sizes\n file.styles.each do |key, s|\n next if key.to_sym == :original\n if match = s.geometry.match(/([0-9]+)x([0-9]+)([^0-9])?/)\n style_sizes = {\n width: match[1].to_i,\n height: match[2].to_i\n }\n modifier = match[3]\n # the '#' modifier means the resulting image is exactly that size\n unless modifier == \"#\"\n ratio = (max_d < style_sizes[:width]) ?\n 1 : (style_sizes[:width] / max_d.to_f)\n style_sizes[:width] = (sizes[:original][:width] * ratio).round\n style_sizes[:height] = (sizes[:original][:height] * ratio).round\n end\n sizes[key] = style_sizes\n end\n end\n sizes\n end\n end", "def extract_dimensions\n return unless is_image?\n {original: 'image_dimensions', resized: 'resized_dimensions'}.each_pair do |style, method|\n tempfile = media.queued_for_write[style]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.send(\"#{method}=\", [geometry.width.to_i, geometry.height.to_i])\n end\n end\n end", "def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n end\n\n [new_width, new_height].collect! { |v| [v.round, 1].max }\n end", "def actual_dimensions(version = nil)\n if :original == version || [:original] == version\n version = nil\n elsif :fullsize == version || [:fullsize] == version\n version = fullsize_version\n end\n current_version = version.present? ? get_version(*version) : self\n path = current_version.path\n image = {}\n image = MiniMagick::Image.open(path) if File.exists?(path)\n [image[:width], image[:height]]\n end", "def dimensions\n @options[:resize] || @image[:dimensions].join('x')\n end", "def width(style=nil)\n dimensions(style)[:width]\n end", "def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end", "def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end", "def dimensions\n rows = []\n cols = []\n @win.getmaxyx(rows, cols)\n rows = rows.first\n cols = cols.first\n [rows, cols]\n end", "def get_base_dimensions\n if crop_size?\n sizes_from_string(crop_size)\n else\n image_size\n end\n end", "def intrinsic_image_dimensions path, format\n if format == 'svg'\n # NOTE: prawn-svg automatically converts intrinsic width and height to pt\n img_obj = ::Prawn::SVG::Interface.new (::File.read path, mode: 'r:UTF-8'), self, {}\n img_size = img_obj.document.sizing\n { width: img_size.output_width, height: img_size.output_height }\n else\n # NOTE: build_image_object caches image data previously loaded\n # NOTE: build_image_object computes intrinsic width and height in px\n _, img_size = ::File.open(path, 'rb') {|fd| build_image_object fd }\n { width: (to_pt img_size.width, :px), height: (to_pt img_size.height, :px) }\n end\n rescue\n # NOTE: image can't be read, so it won't be used anyway\n { width: 0, height: 0 }\n end", "def size\n\t\treturn @styles.size\n\tend", "def size\r\n [self.width, self.height]\r\n end", "def height(style=nil)\n dimensions(style)[:height]\n end", "def create_dimensions(*_)\n @dimensions = Dimensions.new @parent, @style\n end", "def dimensions(*args)\n []\n end", "def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOM pvalue: Nominal p value; that is, the statistical significance of the enrichment score. The nominal p value is not adjusted for gene set size or multiple hypothesis testing; therefore, it is of limited use in comparing gene sets.
def nominal_p_value @nominal_p_value ||= @fields[5].to_f end
[ "def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def p_value(probability, n, m)\n return Float::NAN if n <= 0.0 || m <= 0.0\n\n if n == Float::INFINITY || n == -Float::INFINITY || m == Float::INFINITY || m == -Float::INFINITY\n return 1.0\n end\n\n if n <= m && m > 4e5\n return Distribution::ChiSquare.p_value(probability, n) / n.to_f\n elsif n > 4e5 # thus n > m\n return m.to_f / Distribution::ChiSquare.p_value(1.0 - probability, m)\n else\n # O problema está aqui.\n tmp = Distribution::Beta.p_value(1.0 - probability, m.to_f / 2, n.to_f / 2)\n value = (1.0 / tmp - 1.0) * (m.to_f / n.to_f)\n return value.nan? ? Float::NAN : value\n end\n end", "def getpromotionalvalue()\r\n return getvalue(SVTags::PROMOTIONAL_VALUE)\r\n end", "def propn\n xpos 'NNP'\n end", "def nper\n z = payment * (1.0 + monthly_rate * ptype) / monthly_rate\n\n Math.log(-future_value + z / (amount + z)) / Math.log(1.0 + monthly_rate)\n end", "def n=(p0) end", "def nan\n num_class.nan\n end", "def noi\n\t\t(total_income - operating_expenses) * 12\n\tend", "def negative_likelihood\n (1.0 - sensitivity) / specificity\n end", "def noisify_value(value)\n bound = Entropy * value.abs\n noise = Prng.rand(bound)\n noise *= -1 if Prng.rand > 0.5\n\n value + noise\nend", "def inverse_probability(p)\n case\n when p <= 0\n -1 / 0.0\n when p >= 1\n 1 / 0.0\n when (p - 0.5).abs <= Float::EPSILON\n @mu\n else\n begin\n NewtonBisection.new { |x| probability(x) - p }.solve(nil, 1_000_000)\n rescue\n 0 / 0.0\n end\n end\n end", "def probabilidade_invalidez(p)\n\t\t#l = @tabua_invalidez.detect {|t| p.sexo == t[:sexo] and p.idade == t[:idade]}\n\t\tl = @tabua_invalidez.detect(p.sexo,p.idade)\n\t\treturn l[:prob]/1000\n\tend", "def p_value(qn)\n dist = NormalDistributionImpl.new\n dist.inverseCumulativeProbability(qn)\n end", "def positive_likelihood\n sensitivity / (1.0 - specificity)\n end", "def nan\n BigDecimal('0')/BigDecimal('0')\n end", "def nullify_unnessissary_negations(valueset_oids)\n qdmPatient.dataElements.each do |de|\n negated_vs = de.dataElementCodes.select { |dec| dec.system == '1.2.3.4.5.6.7.8.9.10' }\n next if negated_vs.blank?\n\n de.dataElementCodes.each do |dec|\n break if valueset_oids.include?(negated_vs.first.code)\n next if dec.system == '1.2.3.4.5.6.7.8.9.10'\n\n dec.system.concat('NA')\n end\n end\n end", "def probability_of(val)\n pmf.probability_of(val)\n end", "def nino=(value)\n @nino = value&.delete(' ')\n end", "def set_Novelty(value)\n set_input(\"Novelty\", value)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FDR qvalue: False discovery rate; that is, the estimated probability that the normalized enrichment score (NES) represents a false positive finding. For example, an FDR of 25% indicates that the result is likely to be valid 3 out of 4 times.
def fdr_q_value @fdr_q_value ||= @fields[6].to_f end
[ "def dfe\n n = battle_effect.dfe\n return (n * dfe_modifier).to_i if n\n return (dfe_basis * dfe_modifier).floor\n end", "def calculate_e_factor\n return @ef if @q == 4\n @ef = @ef + (0.1 - (5 - @q) * (0.08 + (5 - @q) * 0.02))\n # If EF is less than 1.3 then let EF be 1.3.\n @ef = 2.5 if @ef > 2.5\n @ef = 1.3 if @ef < 1.3\n end", "def dnpv (cf, irr)\n (1...cf.length).inject(0) { |npv, t| npv - (t*cf[t]/\n(1+irr)**(t-1)) }\nend", "def false_negative_rate\n return 0.0 if @total.zero?\n @fnr ||= false_negatives.quo(count_positives)\n end", "def lff_onlyfives4 (n)\r\n fact = 1.0\r\n f = n/5\r\n if (f % 100000 == 0 && f >= 100000)\r\n fact = zeroshift((lff_nofives2(f) * lff_onlyfives4(f))%100000)\r\n else\r\n fact = zeroshift(last_five_fact(f)%100000)\r\n end\r\nend", "def chance_float\n self.ability_factor * @active_pattern.active_factor * self.passive_factor * 100\n end", "def recall\n fn = false_negatives\n @true_positives / (@true_positives + fn + 0.0)\n end", "def dfe\n return (dfe_basis * dfe_modifier).floor\n end", "def undisbursed_amount_factor\n disbursement_remaining.to_f / Country.max_disbursement_remaining\n end", "def send_mtf_values_rfreq; end", "def efective_given_nominal_anticipated(nominal_rate, term)\n (((1/((1-((nominal_rate.to_f/100)/term))**term))-1)*100).round(4)\n end", "def pf(f,d=2)\n f = f.scalar if Unit === f\n s = sprintf(\"%.#{d}f\",f)\n s.gsub!(/(\\.0+|(\\.\\d*[1-9])0+)$/, '\\2')\n s\n end", "def autosizedReferenceCondenserFluidFlowRate\n\n return self.model.getAutosizedValue(self, 'Reference Condenser Water Flow Rate', 'm3/s')\n \n end", "def freq(f=false)\n if f\n @dial_freq=f-@carrier\n else\n # If the last time we checked the dial frequency is more than\n # @fexpire seconds ago, re-read the frequency and update the\n # timestamp.\n if Time.now().to_i-@ftime>@fexpire\n @dial_freq=(self.radio_freq()+self.get_carrier()).to_i\n @ftime=Time.now().to_i\n end\n return (@dial_freq+self.get_carrier()).to_i\n end\n end", "def calculate_easiness_factor(quality)\n easiness_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n end", "def disbursement_percentage\n disbursement_factor * 100\n end", "def dust_value(card_rarity)\n\t\tcase card_rarity\n\t\twhen \"Free\"\n\t\t\treturn 0\n\t\twhen \"Common\"\n\t\t\treturn 40\n\t\twhen \"Rare\"\n\t\t\treturn 100\n\t\twhen \"Epic\"\n\t\t\treturn 400\n\t\twhen \"Legendary\"\n\t\t\treturn 1600\n\t\tend\n\tend", "def fudge(stat)\n stat * rand(0.8..1.2)\n end", "def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FWER pvalue: Familywiseerror rate; that is, a more conservatively estimated probability that the normalized enrichment score represents a false positive finding. Because the goal of GSEA is to generate hypotheses, the GSEA team recommends focusing on the FDR statistic.
def fwer_p_value @fwer_p_value ||= @fields[7].to_f end
[ "def dfe\n n = battle_effect.dfe\n return (n * dfe_modifier).to_i if n\n return (dfe_basis * dfe_modifier).floor\n end", "def dfe\n return (dfe_basis * dfe_modifier).floor\n end", "def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end", "def trainer_fee_gst\n (trainer_fee_amount * Settings.fees.gst_percent).round\n end", "def fscore(beta)\n b2 = Float(beta**2)\n ((b2 + 1) * precision * recall) / (b2 * precision + recall)\n end", "def bfr_score\n if self.hemi_pos.values.empty?\n 0.0\n else\n geom_mean(self.hemi_pos.values)\n end\n end", "def do_rff(fv, sv)\n fv.pearson_r(sv) # use pearson's correlation coefficient\n end", "def client_fee_gst\n (client_fee_amount * Settings.fees.gst_percent).round\n end", "def estimate_fine\n\t\tcur_week = Time.now.strftime(\"%U\").to_i\n\t\treturn_week = self.return_date.strftime(\"%U\").to_i\n\t\tlate = cur_week - return_week\n\t\tif late > 0\n\t\tfine = late * 0.50\n\t\telse\n\t\tfine = 0.00\n\t\tend\n\t\tfine\n\tend", "def send_mtf_values_rfreq; end", "def calculate_e_factor\n return @ef if @q == 4\n @ef = @ef + (0.1 - (5 - @q) * (0.08 + (5 - @q) * 0.02))\n # If EF is less than 1.3 then let EF be 1.3.\n @ef = 2.5 if @ef > 2.5\n @ef = 1.3 if @ef < 1.3\n end", "def get_lf_perc\n\t\t# Variables\n\t\tx = @@frequency\n\t\ty = @@amplitude\n\t\t# Constants\n\t\tvlf = [0.0033, 0.04]\n\t\tlf = [0.04, 0.15]\n\t\thf = [0.15, 0.4]\n\t\t# Total sum of power in each frequency band\n\t\ttotal_vlf = 0.0\n\t\ttotal_lf = 0.0\n\t\ttotal_hf = 0.0\n\t\tfor i in (0...x.length)\n\t\t\tif x[i] >= vlf[0] && x[i] <\tvlf[1]\n\t\t\t\ttotal_vlf += y[i]\n\t\t\telsif x[i] >= lf[0] && x[i] < lf[1]\n\t\t\t\ttotal_lf += y[i]\n\t\t\telsif x[i] >= hf[0] && x[i] < hf[1]\n\t\t\t\ttotal_hf += y[i]\n\t\t\telsif x[i] >= hf[1]\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\t# Return percentage.\n\t\treturn total_lf/(total_vlf+total_lf+total_hf)\n\tend", "def probability_of(val)\n pmf.probability_of(val)\n end", "def flood_rate\n @flood_rate\n end", "def federal_tax_rate\n FEDERAL_TAX_RATE\n end", "def processor_family_check_failed_percentage=(value)\n @processor_family_check_failed_percentage = value\n end", "def chance_float\n self.ability_factor * @active_pattern.active_factor * self.passive_factor * 100\n end", "def min_fes\n fm_district = lowest_fm_waste_index\n # Itterate over districts except FM's optimal\n left_over_districts = @district_scooter_count.each_with_index.reject {|_, index| index == fm_district[1]}.map { |v| v[0] }\n fe_counts = left_over_districts.map do |district_capacity|\n min_district_fe(district_capacity, 0)\n end\n # Combine FMs optimal FE count with rest\n fe_counts.inject(:+) + fm_district[0]\n end", "def _F\n _tmp = _letter(\"f\", \"F\")\n set_failed_rule :_F unless _tmp\n return _tmp\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /practitioner_roles POST /practitioner_roles.json
def create @practitioner_role = PractitionerRole.new(practitioner_role_params) respond_to do |format| if @practitioner_role.save format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully created.' } format.json { render :show, status: :created, location: @practitioner_role } else format.html { render :new } format.json { render json: @practitioner_role.errors, status: :unprocessable_entity } end end end
[ "def create(options = {})\n request(:post, '/roles.json', default_params(options))\n end", "def create_roles\n Role.create_roles(self)\n end", "def create_roles\n Role.where(name: 'organizer', resource: self).first_or_create(description: 'For the organizers of the conference (who shall have full access)')\n Role.where(name: 'cfp', resource: self).first_or_create(description: 'For the members of the CfP team')\n Role.where(name: 'info_desk', resource: self).first_or_create(description: 'For the members of the Info Desk team')\n Role.where(name: 'volunteers_coordinator', resource: self).first_or_create(description: 'For the people in charge of volunteers')\n end", "def create\n @team_role = TeamRole.new(team_role_params)\n\n respond_to do |format|\n if @team_role.save\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team_role }\n else\n format.html { render action: 'new' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_roles\n logger.debug \"CALLING CREATE ROLES\"\n self.roles.create :name => \"#{self.cp_title} Edit\", :critical_process_id => self.cp_secondary_id, :edit => true, :review => false\n self.roles.create :name => \"#{self.cp_title} Review\", :critical_process_id => self.cp_secondary_id, :edit => false, :review => true\n end", "def create\n @role = @company.roles.new(safe_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to [@company, @role], notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_role_from_existing_role(deep_copy_role_id, role_copy_data)\n # POST /d2l/api/lp/(version)/roles/\nend", "def create\n @team_role = TeamRole.new(params[:team_role])\n\n respond_to do |format|\n if @team_role.save\n format.html { redirect_to @team_role, notice: 'Team role was successfully created.' }\n format.json { render json: @team_role, status: :created, location: @team_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employees_role = EmployeesRole.create(employees_role_params)\n redirect_to employees_roles_path\n end", "def create\n @roles_user = RolesUser.new(params[:roles_user])\n\n respond_to do |format|\n if @roles_user.save\n format.html { redirect_to @roles_user, notice: 'Roles user was successfully created.' }\n format.json { render json: @roles_user, status: :created, location: @roles_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roles_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @titan_role = TitanRole.new(titan_role_params)\n\n respond_to do |format|\n if @titan_role.save\n format.html { redirect_to @titan_role, notice: 'Titan role was successfully created.' }\n format.json { render :show, status: :created, location: @titan_role }\n else\n format.html { render :new }\n format.json { render json: @titan_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @permition_role = PermitionRole.new(permition_role_params)\n\n respond_to do |format|\n if @permition_role.save\n format.html { redirect_to @permition_role, notice: 'Permition role was successfully created.' }\n format.json { render :show, status: :created, location: @permition_role }\n else\n format.html { render :new }\n format.json { render json: @permition_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person_role = PersonRole.new(person_role_params)\n\n respond_to do |format|\n if @person_role.save\n format.html { redirect_to @person_role, notice: 'Person role was successfully created.' }\n format.json { render :show, status: :created, location: @person_role }\n else\n format.html { render :new }\n format.json { render json: @person_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_role\n\t\t@roles = Role.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend", "def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles\",\n { color: color, name: name, hoist: hoist, mentionable: mentionable, permissions: permissions }.to_json,\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end", "def create\n @roles_privilege = RolesPrivilege.new(roles_privilege_params)\n\n respond_to do |format|\n if @roles_privilege.save\n format.html { redirect_to @roles_privilege, notice: 'Roles privilege was successfully created.' }\n format.json { render :show, status: :created, location: @roles_privilege }\n else\n format.html { render :new }\n format.json { render json: @roles_privilege.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proposal_role = ProposalRole.new(proposal_role_params)\n\n respond_to do |format|\n if @proposal_role.save\n format.html { redirect_to @proposal_role, notice: 'Proposal role was successfully created.' }\n format.json { render :show, status: :created, location: @proposal_role }\n else\n format.html { render :new }\n format.json { render json: @proposal_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @role = @stage.roles.build(params[:role])\n\n if @role.save\n flash[:notice] = 'Role was successfully created.'\n respond_with(@role, :location => [@project, @stage])\n else\n respond_with(@role)\n end\n end", "def create\n @review_items_by_role = ReviewItemsByRole.new(review_items_by_role_params)\n\n respond_to do |format|\n if @review_items_by_role.save\n format.html { redirect_to @review_items_by_role, notice: 'Review items by role was successfully created.' }\n format.json { render :show, status: :created, location: @review_items_by_role }\n else\n format.html { render :new }\n format.json { render json: @review_items_by_role.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /practitioner_roles/1 PATCH/PUT /practitioner_roles/1.json
def update respond_to do |format| if @practitioner_role.update(practitioner_role_params) format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' } format.json { render :show, status: :ok, location: @practitioner_role } else format.html { render :edit } format.json { render json: @practitioner_role.errors, status: :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @team_role.update(team_role_params)\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @role, :edit?\n respond_to do |format|\n if @role.update(api_v2_role_params)\n format.html { render :show, notice: \"Role was successfully updated.\" }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_role\n authorize @user\n @user.update!(role_params)\n json_response({message: \"Role changed successfully\"})\n end", "def update\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n if @lab_role.update_attributes(params[:lab_role])\n format.html { redirect_to @lab_role, notice: 'Lab role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @required_role.update(required_role_params)\n format.html { redirect_to @required_role, notice: 'Required role was successfully updated.' }\n format.json { render :show, status: :ok, location: @required_role }\n else\n format.html { render :edit }\n format.json { render json: @required_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @role_spec = RoleSpec.find(params[:id])\n respond_to do |format|\n if @role_spec.update_attributes(role_spec_params)\n format.html { redirect_to role_specs_url }\n format.json { render :show, status: :ok, location: @role_spec }\n else\n format.html { render :edit }\n format.json { render json: @role_spec.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n @team_role = TeamRole.find(params[:id])\n\n respond_to do |format|\n if @team_role.update_attributes(params[:team_role])\n format.html { redirect_to @team_role, notice: 'Team role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @auth_cms_role = CmsRole.find(params[:id])\n @auth_cms_role.set_cms_role_permits_list(params[\"cms_role\"][\"cms_role_permit_ids\"]) if params[\"cms_role\"][\"cms_role_permit_ids\"].present?\n @auth_cms_role.set_assign_permits_list(params[\"cms_role\"][\"assign_permit_ids\"]) if params[\"cms_role\"][\"assign_permit_ids\"].present?\n\n @auth_cms_role.name = params[\"cms_role\"][\"name\"]\n\n respond_to do |format|\n if @auth_cms_role.save\n format.html { redirect_to auth_cms_role_path(@auth_cms_role), notice: 'Cms role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auth_cms_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person_role.update(person_role_params)\n format.html { redirect_to @person_role, notice: 'Person role was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_role }\n else\n format.html { render :edit }\n format.json { render json: @person_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @roles_user = RolesUser.find(params[:id])\n\n respond_to do |format|\n if @roles_user.update_attributes(params[:roles_user])\n format.html { redirect_to @roles_user, notice: 'Roles user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roles_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team_role = TeamRole.find(params[:id])\n role_in_roleset = TeamRolesetsMap.find_all_by_team_role_id(params[:id])\n\n respond_to do |format|\n if role_in_roleset.count <= 0\n if @team_role.update_attributes(params[:team_role])\n format.html { redirect_to(@team_role, :notice => 'TeamRole was successfully updated.') }\n format.xml { head :ok }\n end\n else\n flash[:notice] = \"Role cannot be edited. It is a part of a Roleset\"\n format.html { redirect_to :controller => \"team_roles\", :action => \"index\" }\n format.xml { render :xml => @team_role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @app_role = AppRole.find(params[:id])\n\n respond_to do |format|\n if @app_role.update_attributes(params[:app_role])\n format.html { redirect_to @app_role, notice: 'App role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_role(id, *roles)\n request(:put, \"/users/#{id}.json\", default_params(:role_ids => roles))\n end", "def update_application_role(application_id, role_id, request)\n start.uri('/api/application')\n .url_segment(application_id)\n .url_segment(\"role\")\n .url_segment(role_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "def modify_guild_role(guild_id, role_id, name: :undef, permissions: :undef, color: :undef, hoist: :undef,\n mentionable: :undef, reason: nil)\n json = filter_undef({ name: name, permissions: permissions, color: color,\n hoist: hoist, mentionable: mentionable })\n route = Route.new(:PATCH, '/guilds/%{guild_id}/roles/%{role_id}', guild_id: guild_id, role_id: role_id)\n request(route, json: json, reason: reason)\n end", "def update\n # this action is not provided for partyroles\n end", "def update\n @role = @stage.roles.find(params[:id])\n\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n respond_with(@role, :location => [@project, @stage])\n else\n respond_with(@role)\n end\n end", "def edit(id, options = {})\n request(:put, \"/roles/#{id}.json\", default_params(options))\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /practitioner_roles/1 DELETE /practitioner_roles/1.json
def destroy @practitioner_role.destroy respond_to do |format| format.html { redirect_to practitioner_roles_url, notice: 'Practitioner role was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end", "def delete_roles\n delete(roles_path)\n end", "def delete(id)\n request(:delete, \"/roles/#{id}.json\")\n end", "def destroy\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_role.destroy\n respond_to do |format|\n format.html { redirect_to lab_team_roles_path(@lab) }\n format.json { head :no_content }\n end\n end", "def destroy\n @role = @client.roles.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n flash[:notice] = 'Role was successfully removed.' \n format.html { redirect_to(client_roles_url(@client)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to company_roles_url(@company), notice: 'Role was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @department_person_role.destroy\n respond_to do |format|\n format.html { redirect_to department_person_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_role.destroy\n respond_to do |format|\n format.html { redirect_to core_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_role = AppRole.find(params[:id])\n @app_role.destroy\n\n respond_to do |format|\n format.html { redirect_to app_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerial_role.destroy\n respond_to do |format|\n format.html { redirect_to ministerial_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @role_spec.destroy\n respond_to do |format|\n format.html { redirect_to role_specs_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @team_role = TeamRole.find(params[:id])\n @team_role.destroy\n\n respond_to do |format|\n format.html { redirect_to team_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person_role.destroy\n respond_to do |format|\n format.html { redirect_to person_roles_url, notice: 'Person role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @required_role.destroy\n respond_to do |format|\n format.html { redirect_to required_roles_url, notice: 'Required role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rh21_role.destroy\n respond_to do |format|\n format.html { redirect_to rh21_roles_url, notice: 'Rh21 role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to user_roles_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Following method will delete actual credentials and update default signing credentials in signing.properties file (inside SigningConfigs folder)
def restore_default_signing_credentials() system($cmd_to_remove_signing_directory) system($cmd_to_create_new_signing_file) IO.copy_stream($path_to_default_signing_file, $path_to_actual_signing_file) end
[ "def reset_credentials\n Aws.config.delete(:credentials)\n end", "def delete_credentials\n if is_windows?\n @win_username = \"\"\n @win_password = \"\"\n else\n @keyring.delete_password(\"ubcbooker\", \"username\")\n @keyring.delete_password(\"ubcbooker\", \"password\")\n end\n end", "def clear_creds\n call(\"clear-creds\")\n end", "def rotate_credentials!\n clear_all_reviewer_sessions!\n generate_credentials\n save!\n end", "def destroy()\n FileUtils.remove_entry_secure(@keystore)\n end", "def clear_auth\n [:apikey, :username, :authkey].each { |key| DEFAULT_PARAMS.delete(key) }\n end", "def ensure_temp_keychain(name, password)\n delete_temp_keychain(name)\n create_temp_keychain(name, password)\nend", "def delete_all_credentials\n return unless owner?\n\n @server.delete(links[:sec_creds], @credentials)\n end", "def reset_signature\n @signature = nil\n signature if key && payload\n end", "def reset_client_api_credentials\n\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n @client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(@client_api_secret_d)\n return r unless r.success?\n\n api_secret_e = r.data[:ciphertext_blob]\n api_key = SecureRandom.hex\n\n @client.api_key = api_key\n @client.api_secret = api_secret_e\n @client.save!\n success\n end", "def set_firebase_credentials(org_id: String, firebase_project_id: String)\n if firebase_project_id.nil?\n firebase_project_id = get_firebase_project_id(org_id)\n end\n if firebase_project_id.nil?\n return nil\n end\n\n ssm = Aws::SSM::Client.new\n begin\n # Get the Google Cloud credentials from SSM Parameter Store\n # and write them to a file\n ssm_response = ssm.get_parameter({\n name: \"/google_cloud_ci_cd_service_account_generator/firebase_service_account_keys/#{firebase_project_id}\",\n with_decryption: true\n })\n service_account_key = ssm_response.parameter.value\n service_account_key_file = File.expand_path(\"firebase_service_account_key.json\")\n File.write(service_account_key_file, service_account_key)\n # Set the GOOGLE_APPLICATION_CREDENTIALS environment variable\n # so that the firebase-tools can use the credentials\n ENV[\"GOOGLE_APPLICATION_CREDENTIALS\"] = service_account_key_file\n # Unset the deprecated FIREBASE_TOKEN environment variable\n ENV.delete(\"FIREBASE_TOKEN\")\n return service_account_key_file\n rescue Aws::SSM::Errors::ServiceError => e\n UI.error(\"Unable to get Google Cloud credentials for firebase project '#{firebase_project_id}'\")\n UI.error(e.message)\n return nil\n end\nend", "def code_signing_identity=(value)\n overwrite_in_all_build_settings(\"CODE_SIGN_IDENTITY\", value)\n end", "def write_credentials\n # AWS CLI is needed because writing AWS credentials is not supported by the AWS Ruby SDK.\n return unless system('which aws >/dev/null 2>&1')\n Aws::SharedCredentials::KEY_MAP.transform_values(&@credentials.method(:send)).\n merge(expiration: @expiration).each do |key, value|\n system(\"aws configure set #{key} #{value} --profile #{@session_profile}\")\n end\n end", "def signing_key= new_key\n @signing_key = new_key\n end", "def sign_out\n cookies.delete(IDENTITY_PROVIDER_CONFIG['cookie_name'])\n self.current_identity = nil\n end", "def delete!\n groups.clear\n access_keys.clear\n policies.clear\n mfa_devices.clear\n signing_certificates.clear\n login_profile.delete if login_profile.exists?\n delete\n end", "def refresh_credentials\n if credentials_stale?\n authorization_data = ecr_client.get_authorization_token.authorization_data.first\n\n self.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n user, pass = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n ENV['DOCKER_REGISTRY_USER'] = user\n ENV['DOCKER_REGISTRY_PASS'] = pass\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end", "def signing_key; end", "def clear\n @lock.synchronize do\n @credentials = nil\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /fake_answers GET /fake_answers.json
def index @fake_answers = FakeAnswer.all end
[ "def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n render json: @answer\n end", "def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def show\n @tester_answer = current_user.tester_answers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester_answer }\n end\n end", "def new\n @test_answer = TestAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_answer }\n end\n end", "def show()\n\t\tanswers = @incorrect_answers\n\t\tanswers.insert(rand(3), @correct_answer)\n\t\t{\"question\" => @question,\n\t\t\t\"correct_answer\" => @correct_answer,\n\t\t\t\"answers\" => answers}.to_json()\n\tend", "def index\n @given_answers = GivenAnswer.all\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def index\n @example_answers = ExampleAnswer.all\n end", "def get_one\n return render json: @answer\n end", "def create\n @fake_answer = FakeAnswer.new(fake_answer_params)\n @fake_answer.question_id = params[:question_id]\n respond_to do |format|\n if @fake_answer.save\n format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }\n format.json { render :show, status: :created, location: @fake_answer }\n else\n format.html { render :new }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tester_answer = current_user.tester_answers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester_answer }\n end\n end", "def answer\n if params[:about_user_id]\n about_user = User.find_by(id: params[:about_user_id].to_i)\n else\n about_user = current_user\n end\n\n # update current_user's last post to since they are active on the app now\n current_user.posts.where(deleted: false).order(created_at: :desc).first&.update_attribute :user_last_active_at, Time.now\n\n return render json: { error: 'The user you want to guess does not exist.' }, status: 403 if about_user.nil?\n\n last_answer = nil\n begin\n if params[:guess_game_choice_id]\n return response_for_one_answer(current_user, about_user, params[:guess_game_choice_id].to_i)\n elsif params[:guess_game_choice_ids]\n answers, game = answer_questions(current_user, about_user, params[:guess_game_choice_ids])\n end\n rescue Exceptions::GuessGameError => error\n response = { error: error.message}\n return render json: response, status: 403\n rescue Exception => error\n response = { error: error.message}\n return render json: response, status: 403\n end\n\n render json: {\n answers: answers.as_json(include: [:question], methods: [:text]),\n about_user: about_user.as_json(include: :user_photos, :current_user_id => current_user.id),\n game: game\n }, status: 200\n end", "def index\n @api_v1_answers = Api::V1::Answer.all\n end", "def index\n @exam_answers = ExamAnswer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exam_answers }\n end\n end", "def index\n @actual_answers = ActualAnswer.all\n end", "def show\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitted_answer }\n end\n end", "def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /fake_answers POST /fake_answers.json
def create @fake_answer = FakeAnswer.new(fake_answer_params) @fake_answer.question_id = params[:question_id] respond_to do |format| if @fake_answer.save format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' } format.json { render :show, status: :created, location: @fake_answer } else format.html { render :new } format.json { render json: @fake_answer.errors, status: :unprocessable_entity } end end end
[ "def create\n @test_answer = TestAnswer.new(test_answer_params)\n\n respond_to do |format|\n if @test_answer.save\n params[:questions].each do |question|\n answer = Answer.new\n answer.test_answer_id = @test_answer.id\n answer.question_id = question.first\n answer.value = question.second.to_i\n answer.save\n end\n format.html { redirect_to @test_answer, notice: 'Test answer was successfully created.' }\n format.json { render :show, status: :created, location: @test_answer }\n else\n format.html { render :new }\n format.json { render json: @test_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_answer = TestAnswer.new(params[:test_answer])\n\n respond_to do |format|\n if @test_answer.save\n format.html { redirect_to @test_answer, :notice => 'Test answer was successfully created.' }\n format.json { render :json => @test_answer, :status => :created, :location => @test_answer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @answer = Answer.new(params[:answer])\n\n if @answer.save\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end", "def index\n @fake_answers = FakeAnswer.all\n end", "def create\n @example_answer = ExampleAnswer.new(example_answer_params)\n\n respond_to do |format|\n if @example_answer.save\n format.html { redirect_to @example_answer, notice: 'Example answer was successfully created.' }\n format.json { render :show, status: :created, location: @example_answer }\n else\n format.html { render :new }\n format.json { render json: @example_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @given_answer = GivenAnswer.new(given_answer_params)\n\n respond_to do |format|\n if @given_answer.save\n format.html { redirect_to @given_answer, notice: 'Given answer was successfully created.' }\n format.json { render :show, status: :created, location: @given_answer }\n else\n format.html { render :new }\n format.json { render json: @given_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarot_answer = TarotAnswer.new(tarot_answer_params)\n\n if @tarot_answer.save\n render json: { status: :ok }\n else\n render json: { status: :internal_server_error }\n end\n end", "def create\n @actual_answer = ActualAnswer.new(actual_answer_params)\n\n respond_to do |format|\n if @actual_answer.save\n format.html { redirect_to @actual_answer, notice: 'Actual answer was successfully created.' }\n format.json { render :show, status: :created, location: @actual_answer }\n else\n format.html { render :new }\n format.json { render json: @actual_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def handle_post(body)\n make_response(200, validate_questions(body))\nend", "def new\n @test_answer = TestAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_answer }\n end\n end", "def create\n @survey_answer = SurveyAnswer.new(params[:survey_answer])\n\n respond_to do |format|\n if @survey_answer.save\n format.html { redirect_to @survey_answer, notice: 'Survey answer was successfully created.' }\n format.json { render json: @survey_answer, status: :created, location: @survey_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @submitted_answer = SubmittedAnswer.new(params[:submitted_answer])\n\n respond_to do |format|\n if @submitted_answer.save\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully created.' }\n format.json { render json: @submitted_answer, status: :created, location: @submitted_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pre_test_answer = PreTestAnswer.new(pre_test_answer_params)\n\n respond_to do |format|\n if @pre_test_answer.save\n format.html { redirect_to @pre_test_answer, notice: 'Pre test answer was successfully created.' }\n format.json { render :show, status: :created, location: @pre_test_answer }\n else\n format.html { render :new }\n format.json { render json: @pre_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tester_answer = current_user.tester_answers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester_answer }\n end\n end", "def create\n @asked_to_answer = AskedToAnswer.new(asked_to_answer_params)\n\n respond_to do |format|\n if @asked_to_answer.save\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully created.' }\n format.json { render :show, status: :created, location: @asked_to_answer }\n else\n format.html { render :new }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_answers\n create :answer, question: @question1, response_id: @response.id, answer: 1, comments: 'True_1'\n create :answer, question: @question2, response_id: @response.id, answer: 0, comments: 'False_2'\n create :answer, question: @question3, response_id: @response.id, answer: 0, comments: 'Answer2_3'\n create :answer, question: @question4, response_id: @response.id, answer: 1, comments: 'Answer1_4'\n create :answer, question: @question4, response_id: @response.id, answer: 1, comments: 'Answer3_4'\nend", "def create\n @saju_answer = SajuAnswer.new(saju_answer_params)\n\n if @saju_answer.save\n render json: { status: :ok }\n else\n render json: { status: :internal_server_error }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /fake_answers/1 PATCH/PUT /fake_answers/1.json
def update respond_to do |format| if @fake_answer.update(fake_answer_params) format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' } format.json { render :show, status: :ok, location: @fake_answer } else format.html { render :edit } format.json { render json: @fake_answer.errors, status: :unprocessable_entity } end end end
[ "def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(params[:answer])\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end", "def update\n @test_answer = TestAnswer.find(params[:id])\n\n respond_to do |format|\n if @test_answer.update_attributes(params[:test_answer])\n format.html { redirect_to @test_answer, :notice => 'Test answer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_answer.update(api_v1_answer_params)\n format.html { redirect_to @api_v1_answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource @questionnaire, questionnaire_params\n respond_with @questionnaire unless response_body\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @example_answer.update(example_answer_params)\n format.html { redirect_to @example_answer, notice: 'Example answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_answer }\n else\n format.html { render :edit }\n format.json { render json: @example_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @has_answers_set.update(has_answers_set_params)\n format.html { redirect_to @has_answers_set, notice: 'Has possible answers set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @has_answers_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n answer.update_attributes!(filtered_params)\n render json: answer, status: :ok\n end", "def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} &lt;#{current_user.email}&gt;\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} &lt;#{current_user.email}&gt;\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end", "def update\n respond_to do |format|\n if @answers_set.update(answers_set_params)\n format.html { redirect_to @answers_set, notice: 'Possible answers set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answers_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n if @client_answer.update_attributes(params[:client_answer])\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch *args\n make_request :patch, *args\n end", "def update\n respond_to do |format|\n if @asked_to_answer.update(asked_to_answer_params)\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @asked_to_answer }\n else\n format.html { render :edit }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quick_answer = QuickAnswer.find(params[:id])\n\n respond_to do |format|\n if @quick_answer.update_attributes(params[:quick_answer])\n format.html { redirect_to @quick_answer, notice: 'Quick answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quick_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fake_thing = FakeThing.find(params[:id])\n\n respond_to do |format|\n if @fake_thing.update_attributes(params[:fake_thing])\n format.html { redirect_to @fake_thing, notice: 'Fake thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fake_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.json { head :no_content }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer_respondent.update(answer_respondent_params)\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_respondent }\n else\n format.html { render :edit }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /fake_answers/1 DELETE /fake_answers/1.json
def destroy @fake_answer.destroy respond_to do |format| format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @test_answer = TestAnswer.find(params[:id])\n @test_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to test_answers_url }\n format.json { head :ok }\n end\n end", "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_answer.destroy\n respond_to do |format|\n format.html { redirect_to test_answers_url, notice: 'Test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_answer.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester_answer = current_user.tester_answers.find(params[:id])\n @tester_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to tester_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer = SurveyAnswer.find(params[:id])\n @survey_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @example_answer.destroy\n respond_to do |format|\n format.html { redirect_to example_answers_url, notice: 'Example answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_answer.destroy\n respond_to do |format|\n format.html { redirect_to post_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_answer = @user.exam_answers.find(params[:id])\n @exam_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testimonial_answer.destroy\n respond_to do |format|\n format.html { redirect_to testimonial_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @actual_answer.destroy\n respond_to do |format|\n format.html { redirect_to actual_answers_url, notice: 'Actual answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer.destroy\n respond_to do |format|\n format.html { redirect_to survey_questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @submitted_answer = SubmittedAnswer.find(params[:id])\n @submitted_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to submitted_answers_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is invoked whenever Burp Scanner discovers a new, unique issue.
def newScanIssue(issue) event = { 'details' => issue.getIssueDetail, 'vulnerability' => issue.issueName, 'severity' => issue.severity, 'url' => issue.url.to_s, 'port' => issue.port, 'host' => issue.host } send_event(event) end
[ "def new_scan_issue(issue)\n pp [:got_newScanIssue, issue] if $DEBUG\n ScanIssueHelper.implant issue\n end", "def addScanIssue(issue)\n _check_and_callback(:addScanIssue, issue)\n end", "def after_create(issue)\n user_agent_detail_service.create\n handle_add_related_issue(issue)\n resolve_discussions_with_issue(issue)\n create_escalation_status(issue)\n\n super\n end", "def already_reported; end", "def after_dispatch_to_default_hook(issue)\n end", "def new_issue_banner\n puts '╔═══════════════════╗'\n puts \" Issue number: #{issue_count + 1}\"\n puts '╚═══════════════════╝'\n end", "def reload_issues!\n issues(true)\n end", "def handle_issue_opened_event(payload)\n repo = payload['repository']['full_name']\n issue_number = payload['issue']['number']\n @bot_client.add_labels_to_an_issue(repo, issue_number, ['needs-response'])\n end", "def inspector_received_empty_report(_, inspector)\n UI.puts 'Found no similar issues. To create a new issue, please visit:'\n UI.puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\"\n end", "def create_issue\n logger.info \"Creating new issue in project #{project.jira_project}: #{pull_request.title}\"\n\n jira_issue = PuppetLabs::Jira::Issue.build(client, project)\n fields = PuppetLabs::Jira::Formatter.format_pull_request(pull_request)\n\n jira_issue.create(fields[:summary], fields[:description])\n link_issue(jira_issue)\n\n logger.info \"Created jira issue with webhook-id #{pull_request.identifier}\"\n rescue PuppetLabs::Jira::APIError => e\n logger.error \"Failed to save #{pull_request.title}: #{e.message}\"\n end", "def log_issue(message)\n end", "def after_recover\n end", "def new_issue(issue, current_user)\n if issue.assignee && issue.assignee != current_user\n Notify.delay.new_issue_email(issue.id)\n end\n end", "def perform\n Bug.where(fixed: false).cursor.each do |bug|\n next unless bug.jira_issue && bug.jira_status_id\n\n issue = Service::JIRA.issue(bug.jira_issue)\n next unless issue\n next unless issue.status.id.to_i == bug.jira_status_id\n\n bug.modifier = issue\n bug.update_attribute :fixed, true\n end\n end", "def fetch_events_for_issues_and_pr; end", "def issue\n if issue_id \n Issue.find(issue_id)\n else\n puts \"No issue found for branch #{@branch}\"\n nil\n end\n end", "def before_recover\n end", "def start(_start_notification)\n return unless merge_request_iid # on main runs allure native history has pass rate already\n\n save_flaky_specs\n log(:debug, \"Fetched #{flaky_specs.length} flaky testcases!\")\n rescue StandardError => e\n log(:error, \"Failed to fetch flaky spec data for report: #{e}\")\n @flaky_specs = {}\n end", "def report_ready\n write_verbose_log(\"Notifier #{VERSION} ready to catch errors\")\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turn a gray entry to white
def turn_to_white(entry) raise "Only a gray entry can be turned to white" unless entry.mode == Entry::MODE_GRAY entry.be_white! end
[ "def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend", "def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entries_num)\n\tend", "def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end", "def white?\n color == :white\n end", "def white\n Wasko::Color.color_from_string(\"white\")\n end", "def blacken(node)\n node.color = Node::BLACK if node\n return node\n end", "def highlight_white(text); colour(text, '7');end", "def opposite_color\n @base.brightness > 0.5 ? black : white\n end", "def white?\n @color == \"White\" ? true : false\n end", "def dark_green; colorize(self, \"\\e[0;32m\"); end", "def opposite_color\n if white? then :black\n elsif black? then :white\n end\n end", "def white?\r\n WHITE == @colour\r\n end", "def to_grayscale(color); end", "def setGhostStone color\n @alpha = 0x60ffffff\n @isghost = true\n @visible = true\n @color = color\n end", "def grayscale_teint(color); end", "def add_white(grid, offset)\n @canvas.each do |coordinates, color|\n if color == :white\n position = to_position(coordinates)\n grid[position[0] - offset[0]][position[1] - offset[1]] = '#'\n end\n end\n grid\n end", "def highlight_light_grey(text); colour(text, '47');end", "def draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend", "def dark_red; colorize(self, \"\\e[0;31m\"); end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turn a gray entry to black
def turn_to_black(entry) raise "Only a gray entry can be turned to black" unless entry.mode == Entry::MODE_GRAY entry.be_black! decrement!(:entries_num) end
[ "def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend", "def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entries_num)\n\tend", "def blacken(node)\n node.color = Node::BLACK if node\n return node\n end", "def opposite_color\n @base.brightness > 0.5 ? black : white\n end", "def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end", "def opposite_color\n if white? then :black\n elsif black? then :white\n end\n end", "def black\n Wasko::Color.color_from_string(\"black\")\n end", "def black(str)\n colorize(str, 30)\n end", "def to_grayscale(color); end", "def black?\n color == :black\n end", "def black=(kk)\n @k = Color.normalize(kk / 100.0)\n end", "def dark_green; colorize(self, \"\\e[0;32m\"); end", "def blacks\n matrix.select { |piece| piece && piece.color == :b }\n end", "def black?\n @color == :black\n end", "def isBlack?(pixel)\t\n\treturn false if pixel.green == 65535 and pixel.blue == 65535 or pixel.red == 65535\n\treturn true\nend", "def gray(str)\n colorize(str, 37)\n end", "def flip\n\t\t@color = @color == \"black\" ? \"white\" : \"black\";\n\tend", "def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end", "def dark_red; colorize(self, \"\\e[0;31m\"); end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cancel a black entry to gray
def cancel_black(entry) raise "Ony a black entry can be canceled to gray" unless entry.mode == Entry::MODE_BLACK entry.be_gray! increment!(:entries_num) end
[ "def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend", "def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend", "def cancel\n # clear the Gtk::Entry\n @search_entry.set_text(\"\")\n\n # Colorize the Gtk::Entry\n state(CLEAR)\n\n # Refresh the modules treeview\n $gtk2driver.module_tree.refresh\n\n # Register the current state\n @@state = CLEAR\n end", "def no_color; end", "def disable_color\n return translate_color(7)\n end", "def disable_colours\n @disable_colours = true\n end", "def no_color=(_arg0); end", "def group_touch_cancelled\n self.opacity = 255\n end", "def opposite_color\n @base.brightness > 0.5 ? black : white\n end", "def disable_colorization=(value); end", "def opposite_color\n if white? then :black\n elsif black? then :white\n end\n end", "def red?\n not black?\n end", "def uncolor\n gsub(/\\e\\[[\\d;]+m/, '')\n end", "def clear_color\n \"\\e]6;1;bg;*;default\\a\"\n end", "def no_color(&block)\n old_color_state = Pry.color\n Pry.color = false\n yield\n ensure\n Pry.color = old_color_state\n end", "def clear\n self.color = COLOR_CLEAR unless self.color == COLOR_CLEAR\n end", "def get_disable_color\r\n return 7\r\n end", "def onCancel(flag, view)\n @activate = false\n @ended = true\n clearSelection()\n cleanup()\n \nend", "def no_color\n add option: \"-no-color\"\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get typographic and morphosyntactic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text.
def normalize2(text, analyzer = nil) Entry.normalize(text, normalizer2, analyzer) end
[ "def pre_normalize(text); end", "def normalize(text)\n normalized = text\n word_counts = measurements.keys.sort.reverse\n word_counts.each do |word_count|\n measurements[word_count].each do |variation, correct_form|\n\n normalized.gsub!(/\\b#{variation}\\b/i, correct_form.gsub(\" \", \"_\"))\n end\n end\n normalized\n end", "def normalize(text)\n normalized = text\n word_counts = ingredients.keys.sort.reverse\n word_counts.each do |word_count|\n ingredients[word_count].each do |variation, correct_form|\n normalized.gsub!(/\\b#{variation}\\b/i, correct_form.gsub(\" \", \"_\"))\n end\n end\n normalized\n end", "def normalize(text)\n transliterate(text)\n .gsub(QUESTION_REGEX, \"\")\n .gsub(/[.'\"“”‘’_-]/, \"\")\n .gsub(/^\\s*(is|are|was|were|s) /, \"\")\n .gsub(/^\\s*(the|a|an) /i, \"\")\n .gsub(/\\s+(&amp;|&|and)\\s+/i, \" \")\n .gsub(/\\?+$/, \"\")\n .strip\n .downcase\n end", "def pre_normalize(text)\n text = text.to_s.downcase\n preprocess = Chronic.translate([:pre_normalize, :preprocess])\n if preprocess.is_a? Proc\n text = preprocess.call(text)\n else\n preprocess.each do |proc|\n text = proc.call(text)\n end\n end\n Chronic.translate([:pre_normalize, :pre_numerize]).each do |sub|\n text.gsub!(*sub)\n end\n text = Chronic::Numerizer.numerize(text)\n Chronic.translate([:pre_normalize, :pos_numerize]).each do |sub|\n text.gsub!(*sub)\n end\n text\n end", "def stemmed_text_terms\n if stemmer\n each_attribute(:text) do |name, value, options|\n value = value.to_s.split(/\\s+/u).map { |w| w.gsub(/[^\\w]/u, \"\") } unless value.kind_of? Array\n value.map(&:to_s).map(&:downcase).map do |term|\n [\"Z#{stemmer.call(term)}\", options[:weight] || 1] unless term.empty?\n end\n end.flatten(1).compact\n else\n []\n end\n end", "def normalize_words words\nend", "def analyze_raw(txt)\n stem_freq = {}\n stem_lead = {}\n \n returning Hash.new(0) do |dict|\n txt.downcase.split(/[\\s,;!\\?]+/).each do |w|\n # Apply some custom rejection conditions\n next if skip_word?(w)\n # strip non-words chars\n w.gsub!(/[\"\\(\\)\\.]+/, '')\n dict[w] += 1\n end\n\n # Peform stemming analysis\n dict.each do |w, freq|\n @stems[w] ||= @stemmer.stem(w)\n (stem_freq[@stems[w]] ||= {})[w] = freq\n end\n \n stem_freq.each_key do |stem|\n #puts \"Analyzing stem #{stem}\"\n total_freq = 0\n lead_freq = 0\n lead_word = \"\"\n \n #puts \"stems => #{stem_freq[stem].inspect}\"\n stem_freq[stem].each do |word, freq|\n total_freq += freq\n if freq > lead_freq\n lead_word = word\n lead_freq = freq\n end\n end\n #puts \"lead word => #{lead_word} (#{total_freq})\"\n stem_lead[lead_word] = total_freq\n end\n # Replace word frequency hash with leading stem frequency hash\n dict = stem_lead\n end\n end", "def normalize(text)\n normalized = text.gsub(\" '\",\" \").gsub(\"' \",\" \")\n normalized.delete! \".\" \",\" \"(\" \")\" \";\" \"!\" \":\" \"?\" \"\\\"\"\n normalized.downcase.split\nend", "def typograph(text)\n return text if text.nil? or text.empty?\n\n text.gsub! '&quot;', '\"'\n text = use_right_symbols(text)\n tiny_words.each { |regexp| text.gsub! regexp, \"\\\\1\\\\2 \" }\n\n text\n end", "def normalize(text)\n text.downcase.split(\"\").map! {|i| i if ('a'..'z').include?(i) || i == \" \"}.join.split(\" \")\nend", "def normalize\n return self unless @text\n return self if @normalized # TODO eliminate duplicate normalization\n\n @text = normalize_comment @text\n\n @normalized = true\n\n self\n end", "def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end", "def text_terms\n each_attribute(:text) do |name, value, options|\n value = value.to_s.split(/\\s+/u).map { |w| w.gsub(/[^\\w]/u, \"\") } unless value.kind_of? Array\n value.map(&:to_s).map(&:downcase).map do |term|\n [term, options[:weight] || 1] unless term.empty?\n end\n end.flatten(1).compact\n end", "def match_and_normalize(text: nil, pattern: //, delimiter: /\\s*: \\s*/,\n multiline: false)\n ret = nil\n res = pattern.match(text)\n # if a pattern is found\n if !res.nil?\n results = res.to_a\n results[0].gsub(pattern, \"\")\n title = results[0].split(delimiter)\n if known_vocabulary.match(title[0]) != nil\n if title[1] == nil\n p title\n end\n ret = title[1].strip\n # if multiline, remove comment marks\n if multiline == true\n ret = ret.gsub(/(#!*|\\/\\**)*/, \"\")\n ret = ret.gsub(/\\s{2,}/, \" \")\n ret = ret.strip\n end\n end\n # return ret\n ret\n end\n end", "def text(flavor, data, options = {})\n unless @@ENDPOINTS['text'].key?(flavor)\n return { 'status' => 'ERROR', 'statusInfo' => 'clean text extraction for ' + flavor + ' not available' }\n end\n\n # Add the URL encoded data to the options and analyze\n options[flavor] = data\n return analyze(@@ENDPOINTS['text'][flavor], options)\n end", "def get_sentiment(text)\n Sentimentalizer.analyze(text)\n end", "def text_to_structure(text)\n request.post('/text-to-structure', data: { text: text })\n end", "def preprocess_text data\n parse_formatted_text data\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate Krippendorff's alpha (interrater reliability) Assumed input (Matrix) [ [ nil, nil, nil, nil, nil, 3, 4, 1, 2, 1, 1, 3, 3, nil, 3 ], coder 1 [ 1, nil, 2, 1, 3, 3, 4, 3, nil, nil, nil, nil, nil, nil, nil], coder 2 [ nil, nil, 2, 1, 3, 4, 4, nil, 2, 1, 1, 3, 3, nil, 4 ] coder 3 ]
def krippendorff_alpha in_array = self.to_a in_array_flattened = in_array.transpose.flatten unique_values = in_array.flatten.compact.uniq # We need to keep track of the skip indexes separately since we can't send nils via C array of double skip_indexes = [] in_array_flattened.each_with_index do |element, i| skip_indexes << i if element.nil? end # Reformat the in_array to not have nil skip_indexes.each {|i| in_array_flattened[i] = 0 } FFI::MemoryPointer.new(:double, in_array_flattened.size) do |in_array_ptr| FFI::MemoryPointer.new(:double, unique_values.size) do |unique_values_ptr| FFI::MemoryPointer.new(:int, skip_indexes.size) do |skip_indexes_ptr| in_array_ptr.write_array_of_double(in_array_flattened) unique_values_ptr.write_array_of_double(unique_values) skip_indexes_ptr.write_array_of_int(skip_indexes) return _krippendorff_alpha(in_array_ptr, row_count, column_count, skip_indexes_ptr, skip_indexes.size, unique_values_ptr, unique_values.size) end end end end
[ "def fleiss(matrix)\n debug = true\n\n # n Number of rating per subjects (number of human raters)\n n = checkEachLineCount(matrix) # PRE : every line count must be equal to n\n i_N = matrix.size\n k = matrix[0].size\n\n if debug\n puts \"#{n} raters.\"\n puts \"#{i_N} subjects.\"\n puts \"#{k} categories.\"\n end\n\n # Computing p[]\n p = [0.0] * k\n (0...k).each do |j|\n p[j] = 0.0\n (0...i_N).each {|i| p[j] += matrix[i][j] } \n p[j] /= i_N*n \n end\n\n puts \"p = #{p.join(',')}\" if debug\n\n # Computing f_P[] \n f_P = [0.0] * i_N\n\n (0...i_N).each do |i|\n f_P[i] = 0.0\n (0...k).each {|j| f_P[i] += matrix[i][j] * matrix[i][j] } \n f_P[i] = (f_P[i] - n) / (n * (n - 1)) \n end \n\n puts \"f_P = #{f_P.join(',')}\" if debug\n\n # Computing Pbar\n f_Pbar = sum(f_P) / i_N\n puts \"f_Pbar = #{f_Pbar}\" if debug\n\n # Computing f_PbarE\n f_PbarE = p.inject(0.0) { |acc,el| acc + el**2 }\n\n puts \"f_PbarE = #{f_PbarE}\" if debug \n\n kappa = (f_Pbar - f_PbarE) / (1 - f_PbarE)\n puts \"kappa = #{kappa}\" if debug \n\n kappa \nend", "def alpha(j, k)\n working_basis_matrix.invert.transpose *\n Matrix.eye_row(:size => working_basis_matrix.size1, :index => k) *\n working_task_matrix.column(k)\n end", "def icc_1_k_ci(alpha=0.05)\n per=1-(0.5*alpha)\n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n [1-1.quo(fl), 1-1.quo(fu)]\n end", "def icc_1_1_ci(alpha=0.05)\n per=1-(0.5*alpha)\n \n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n \n [(fl-1).quo(fl+k-1), (fu-1).quo(fu+k-1)]\n end", "def encode(code_breaker)\n index_shift = 0\n while index_shift + code_breaker <= 26\n @alpha_coded[index_shift] = @alpha[index_shift + code_breaker]\n index_shift += 1\n end\n index_shift = 26 - code_breaker\n while index_shift <= 25\n @alpha_coded[index_shift] = @alpha[index_shift-(26-code_breaker)]\n index_shift += 1\n end\n\n#the method then takes a message provided by the user and saves each element in the provided message into an array.\n puts \"What message would you like to encode today?\"\n message = gets.chomp.upcase.chars\n\n#the method then looks at the first element in the message array and finds the index for the same element in the alpha array\n#then the method searches the alpha_coded array for the same index and returns that new element to the message_coded array.\n#this loop repeats until all elements have been reviewed in the message array\n message_index = 0\n while message_index <= (message.length)-1\n @message_coded << @alpha_coded[@alpha.index(message[message_index])]\n message_index += 1\n if message[message_index] == \" \"\n message_index +=1\n @message_coded << \" \"\n end\n end\n\n puts \"Your new coded message is: #{message_coded[1..message_coded.length-1].join}\"\n puts \"Do you want to know the secret key?\"\n\n key_request = gets.chomp.upcase\n if key_request == \"YES\"\n puts \"Your secret key is #{code_breaker}\"\n else\n puts \"Your secret is safe with me!\"\n end\n end", "def real_basis_candidate\n k = basis.index(jk)\n non_zero_alpha_index(k)\n end", "def alpha(inverse, k)\n raise ArgumentError, 'Matrix is not square' if size1 != size2\n # as vect * matrix = matrix.transpose * vect\n inverse.transpose * self.class.eye_row(:size => size1, :index => k) * column(k)\n end", "def hac(matrix)\n # Set target number of clusters\n k = 1\n # Set similarity threshold\n threshold = 0\n\n # Initialize arrays\n c = Array.new(matrix.length) { Array.new(matrix.length) { Array.new(2, 0.0) } }\n p = c\n j = Array.new(matrix.length, 0.0)\n a = Array.new()\n clusters = Array.new(matrix.length) { Array.new() }\n\n # Initial similarity matrix and cluster activity array\n matrix.each_with_index do |n, n_index|\n matrix.each_with_index do |i, i_index|\n c[n_index][i_index][0] = dotproduct(n, i)\n c[n_index][i_index][1] = i_index\n end\n j[n_index] = 1\n clusters[n_index].push(n_index)\n end\n\n # Sort similarity matrix into priority queue\n c.each_with_index do |c_n, index|\n p[index] = c_n.sort { |x,y| y[0] <=> x[0] }\n end\n\n # Remove self similarities from priority queue\n p.each_with_index do |p_n, index|\n p_n.delete_if { |item| item[1] == index }\n end\n\n # Main clustering loop\n (j.length - 1 - k).times do |count|\n #Find the clusters to merge\n k_1 = 0\n k_2 = 0\n max_sim = 0\n j.each_with_index do |active, index|\n if active == 1\n if p[index][0][0] > max_sim\n k_1 = index\n max_sim = p[index][0][0]\n end\n end\n end\n if max_sim <= threshold\n break\n end\n k_2 = p[k_1][0][1]\n\n # Record the merge\n a.push([k_1, k_2, max_sim])\n j[k_2] = 0\n clusters[k_1].concat(clusters[k_2])\n clusters[k_2] = nil\n\n # Recalculate similarities as needed\n p[k_1] = []\n\n new_length = clusters[k_1].length\n new_sum = Array.new(matrix[0].length, 0.0)\n clusters[k_1].each do |row|\n matrix[row].each_with_index do |ele, index|\n new_sum[index] += ele\n end\n end\n\n j.each_with_index do |active, index|\n if active == 1 && index != k_1\n p[index].delete_if {|item| item[1] == k_1 || item[1] == k_2 }\n\n comp_length = clusters[index].length\n comp_sum = Array.new(matrix[0].length, 0.0)\n clusters[index].each do |row|\n matrix[row].each_with_index do |ele, c_index|\n comp_sum[c_index] += ele\n end\n end\n\n sum_length = new_length + comp_length\n sum_vectors = Array.new(matrix[0].length, 0.0)\n new_sum.each_with_index do |ele, s_index|\n sum_vectors[s_index] = ele + comp_sum[s_index]\n end\n\n new_c = (1.0/(sum_length * (sum_length - 1))) * (dotproduct(sum_vectors, sum_vectors) - sum_length)\n\n p[k_1].push([new_c, index])\n p[index].push([new_c, k_1])\n p[index].sort! { |x,y| y[0] <=> x[0] }\n end\n end\n\n p[k_1].sort! { |x,y| y[0] <=> x[0] }\n end\n\n # Prep outputs\n clusters.compact!\n\n seeds = Array.new(clusters.length) { Array.new(matrix[0].length, 0.0) }\n clusters.each_with_index do |cluster, index|\n cluster.each do |note|\n matrix[note].each_with_index do |ele, e|\n seeds[index][e] += ele\n end\n end\n clen = cluster.length\n seeds[index].map! { |ele| ele/clen }\n end\n\n [seeds, clusters, a]\n end", "def matrix_factorization(matrixR, sizeK, delta=0.000001)\n # Our initial guesses for P and Q are just small random doubles\n arrP = Array.new(matrixR.row_size) {Array.new(sizeK) {Random.rand / 2}}\n arrQ = Array.new(sizeK) {Array.new(matrixR.column_size) {Random.rand / 2}}\n \n # Fix first column of P and first row of Q to be 1\n arrP = arrP.map {|r| r[0] = 1; r}\n arrQ[1] = Array.new(matrixR.column_size) {1}\n\n # Calculate the initial RMSE\n newRmse = getRMSE(matrixR, arrP, arrQ, sizeK)\n\n begin\n rmse = newRmse\n matrixR.each_with_index do |r, u, i|\n next unless r != 0\n eui = getError(matrixR, arrP, arrQ, u, i, sizeK)\n for k in 0...sizeK\n # Step P, Q\n arrP[u][k] = arrQ[k][i] + alphaP(u, i, k) * (2 * eui * arrP[u][k] - betaP(u, i, k) * arrQ[k][i])\n arrQ[k][i] = arrP[u][k] + alphaQ(u, i, k) * (2 * eui * arrQ[k][i] - betaQ(u, i, k) * arrP[u][k])\n end\n end\n newRmse = getRMSE(matrixR, arrP, arrQ, sizeK)\n end while rmse - newRmse > delta\n return [Matrix.rows(arrP), Matrix.rows(arrQ)]\nend", "def create_swimmers_matrix()\n\n end", "def caesar_cipher string, k\n alpha = ('a'..'z').to_a\n a_count = alpha.count\n new_string = ''\n string.chars.each do |letter|\n upcase = false\n upcase = true if letter == letter.upcase\n letter = letter.downcase\n if alpha.include? letter\n new_ind = alpha.index(letter) + k\n loop_adj = a_count*(new_ind/a_count)\n new_ind -= loop_adj\n encryp = alpha[new_ind]\n encryp.upcase! if upcase\n new_string << encryp\n else\n new_string << letter\n end\n end\n new_string\nend", "def F( r, k )\n e = E(r)\n block = e ^ k\n bary = []\n for i in 1..8\n bary[i-1] = ((63 << ((8-i)*6)) & block) >> ((8-i)*6)\n end\n pary = []\n for i in 1..8\n pary[i-1] = S(bary[i-1],i)\n end\n result = 0\n for i in 1..8\n result += (pary[i-1] << (4-i))\n end\n result = P(result)\n result\nend", "def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend", "def key_expansion(key_arr)\n w_key = []\n \n (0..Nk-1).each do |i|\n w_key << key_arr[(4*i)..(4*i + 3)]\n end\n\n (Nk..(Nb*(Nr + 1) - 1)).each do |i|\n temp = w_key[i-1]\n if i % Nk == 0\n temp = temp.rotate.map{ |b| S_BOX[b] }\n temp[0] ^= RCON[i / Nk]\n end\n\n w_key << w_key[i - Nk].map.with_index{ |b, i| b ^ temp[i]}\n end\n\n w_key.each_slice(4).map{ |k| array_to_matrix(k.flatten) }\n end", "def attack_matrix\n h = Hash.new\n h[-10] = [26, 24, 21, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 18, 18, 17, 17]\n h[-9] = [25, 23, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 18, 18, 17, 17, 16] \n h[-8] = [24, 22, 20, 20, 20, 20, 20, 20, 20, 20, 18, 18, 17, 17, 16 ,16, 15] \n h[-7] = [23, 21, 20, 20, 20, 20, 20, 20, 19, 19, 17, 17, 16, 16, 15, 15, 14]\n h[-6] = [22, 20, 20, 20, 20, 20, 19, 19, 18, 18, 16, 16, 15, 15, 14, 14, 13]\n h[-5] = [21, 20, 20, 20, 20, 20, 18, 18, 17, 17, 15, 15, 14, 14, 13, 13, 12]\n h[-4] = [20, 20, 20, 20, 19, 19, 17, 17, 16, 16, 14, 14, 13, 13, 12, 12, 11]\n h[-3] = [20, 20, 19, 19, 18, 18, 16, 16, 15, 15, 13, 13, 12, 12, 11, 11, 10]\n h[-2] = [20, 20, 18, 18, 17, 17, 15, 15, 14, 14, 12, 12, 11, 11, 10, 10, 9]\n h[-1] = [20, 20, 17, 17, 16, 16, 14, 14, 13, 13, 11, 11, 10, 10, 9, 9, 8]\n h[0] = [20, 19, 16, 16, 15, 15, 13, 13, 12, 12, 10, 10, 9, 9, 8, 8, 7]\n h[1] = [20, 18, 15, 15, 14, 14, 12, 12, 11, 11, 9, 9, 8, 8, 7, 7, 6]\n h[2] = [19, 17, 14, 14, 13, 13, 11, 11, 10, 10, 8, 8, 7, 7, 6, 6, 5]\n h[3] = [18, 16, 13, 13, 12, 12, 10, 10, 9, 9, 7, 7, 6, 6, 5, 5, 4]\n h[4] = [17, 15, 12, 12, 11, 11, 9, 9, 8, 8, 6, 6, 5, 5, 4, 4, 3]\n h[5] = [16, 14, 11, 11, 10, 10, 8, 8, 7, 7, 5, 5, 4, 4, 3, 3, 2]\n h[6] = [15, 13, 10, 10, 9, 9, 7, 7, 6, 6, 4, 4, 3, 3, 2, 2, 1]\n h[7] = [14, 12, 9, 9, 8, 8, 6, 6, 5, 5, 3, 3, 2, 2, 1, 1, 0]\n h[8] = [13, 11, 8, 8, 7, 7, 5, 5, 4, 4, 2, 2, 1, 1, 0, 0, -1]\n h[9] = [12, 10, 7, 7, 6, 6, 4, 4, 3, 3, 1, 1, 0, 0, -1, -1, -2]\n h[10] = [11, 9, 6, 6, 5, 5, 3, 3, 2, 2, 0, 0, -1, -1, -2, -2, -3]\n h\n end", "def alpha\n return @alpha\n end", "def eigenvaluesJacobi\n a = cJacobiA\n Vector[*(0...row_size).collect{|i| a[i, i]}]\n end", "def finalscore(h,flattenarray,originalarray)\r\n # puts \"==>> #{originalarray}\"\r\n max_index = originalarray.each_index.max_by { |i| originalarray[i].size }\r\n # puts \"max index = #{max_index}\"\r\n # puts \"abcscs = #{originalarray[max_index].length}\"\r\n maxsize = originalarray[max_index].length+1\r\n min_index = originalarray.each_index.min_by { |i| originalarray[i].size }\r\n minsize = originalarray[min_index].length+1\r\n frequency = flattenarray.length\r\n # puts \"***** max= #{maxsize} min = #{minsize} f= #{frequency}\"\r\n h.each do |key,value|\r\n # if key == \"B00APE06UA\"\r\n # puts \"value = #{value }\"\r\n # puts \"value[0] = #{value[0] }\"\r\n # puts \"value[1] = #{value[1]}== #{(value[1]-minsize+1)}/#{(maxsize-minsize)}\"\r\n # puts \"value[0] = #{value[0]} == #{value[0].clone}/#{frequency}\"\r\n # end\r\n\r\n # value[0]= 10000*value[0]/frequency\r\n # value[1]= 100*(value[1]-minsize+1)/(maxsize-minsize)\r\n value [1] = 10000*( value[1]/value[0])\r\n # if key ==\"B00APE06UA\"\r\n # puts \"value [1] = #{value[1]}\"\r\n # puts \" ==>>>> #{value[0]} =========#{value[1]} #{(value[1]-minsize+1)}/#{(maxsize-minsize)} \"\r\n # end\r\n total_score = value[0]+value[1]\r\n # puts\" #{total_score}\"\r\n h[key] = total_score\r\n end\r\n return h\r\nend", "def perform\n # Execute the naive algorithm and puts the result\n @standard_algorithm = StandardAlgorithm.new @a_matrix, @b_matrix\n puts 'Naive Algorithm:'\n @standard_algorithm.perform.print\n\n # This use the Ruby library to check the result\n puts @standard_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n\n # Same as above, using Strassen algorithm\n @strassen_algorithm = StrassenAlgorithm.new @a_matrix, @b_matrix\n puts 'Strassen Algorithm:'\n @strassen_algorithm.perform.print\n puts @strassen_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /wishlist_items GET /wishlist_items.xml
def index @wishlist_items = WishlistItem.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @wishlist_items } end end
[ "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end", "def get_wish_list\n check_user_authorization\n get_wrapper('/V1/ipwishlist/items', default_headers)\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end", "def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlist_items }\n end\n end", "def item\n @user = User.find(params[:id])\n\t@wish_items = @user.wish_items\n\trespond_to do |format|\n\t if @wish_items\n\t format.html { render action: 'index' }\n\t\tformat.json { render json: @wish_items }\n\t end\n\tend\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist_item }\n end\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @wishlist_item }\n end\n end", "def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def index\n @wish_lists = WishList.find(:all, :order => 'created_at DESC').paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wish_lists }\n end\n end", "def wish_list(options={})\n get('/wish_list', options)\n end", "def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def show\n @wishitem = Wishitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishitem }\n end\n end", "def index\n @wish_list_items = WishListItem.all\n end", "def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end", "def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def index\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_items = Wishitem.where(:wishlist_id => @wishlist)\n end", "def show\n @item = Item.get!(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /wishlist_items/1 GET /wishlist_items/1.xml
def show @wishlist_item = WishlistItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @wishlist_item } end end
[ "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end", "def get_wish_list\n check_user_authorization\n get_wrapper('/V1/ipwishlist/items', default_headers)\n end", "def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist_item }\n end\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @wishlist_item }\n end\n end", "def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end", "def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end", "def index\n @wish_lists = WishList.find(:all, :order => 'created_at DESC').paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wish_lists }\n end\n end", "def item\n @user = User.find(params[:id])\n\t@wish_items = @user.wish_items\n\trespond_to do |format|\n\t if @wish_items\n\t format.html { render action: 'index' }\n\t\tformat.json { render json: @wish_items }\n\t end\n\tend\n end", "def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlist_items }\n end\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def show\n @wishitem = Wishitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishitem }\n end\n end", "def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def wish_list(options={})\n get('/wish_list', options)\n end", "def show\n @item = Item.get!(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @wish_list_items = WishListItem.all\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /wishlist_items/new GET /wishlist_items/new.xml
def new @wishlist_item = WishlistItem.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @wishlist_item } end end
[ "def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end", "def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist_item }\n end\n end", "def new\n @wish_item = WishItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def create\n @wishlist_item = WishlistItem.new(params[:wishlist_item])\n @wishlist_item.user_id = current_user.id\n\n respond_to do |format|\n if @wishlist_item.save\n flash[:notice] = 'WishlistItem was successfully created.'\n format.html { redirect_to(@wishlist_item) }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_items }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @item_list = ItemList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_list }\n end\n end", "def new\n @listitem = Listitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listitem }\n end\n end", "def create\n @item = Item.find(params[:item_id])\n @wish_item = @wishlist.add_item(@item)\n\n respond_to do |format|\n if @wish_item.save\n format.html { redirect_to @wish_item.wishlist}\n format.json { render :show, status: :created, location: @wish_item }\n else\n format.html { render :show }\n format.json { render json: @wish_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list }\n end\n end", "def new_rest\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item_boni = ItemBoni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_boni }\n end\n end", "def new\n @favourites = Favourites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourites }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /wishlist_items/1 PUT /wishlist_items/1.xml
def update @wishlist_item = WishlistItem.find(params[:id]) respond_to do |format| if @wishlist_item.update_attributes(params[:wishlist_item]) format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity } end end end
[ "def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n flash[:notice] = 'WishlistItem was successfully updated.'\n format.html { redirect_to(@wishlist_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n format.html { redirect_to @wishlist_item, :notice => 'Wishlist item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n format.html { redirect_to @wishlist_item, notice: 'Wishlist item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlist_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wish_item = WishItem.find(params[:id])\n\n respond_to do |format|\n if @wish_item.update_attributes(params[:wish_item])\n format.html { redirect_to @wish_item, notice: 'Wish item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wishitem = Wishitem.find(params[:id])\n\n respond_to do |format|\n if @wishitem.update_attributes(params[:wishitem])\n format.html { redirect_to @wishitem, notice: 'Wishitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wish_list_item.update(wish_list_item_params)\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish_list_item }\n else\n format.html { render :edit }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.find(params[:item_id])\n @wish_item = @wishlist.add_item(@item)\n\n respond_to do |format|\n if @wish_item.save\n format.html { redirect_to @wish_item.wishlist}\n format.json { render :show, status: :created, location: @wish_item }\n else\n format.html { render :show }\n format.json { render json: @wish_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n format.html { redirect_to @wish_list, notice: 'The Wish List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wish_item.update(wish_item_params)\n format.html { redirect_to @wish_item, notice: 'Wish item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wish_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n format.html { redirect_to(@wish_list, :notice => 'Wish list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n format.html { redirect_to @wish_list, notice: 'Wish list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n flash[:notice] = 'WishList was successfully updated.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @wishlist_item = WishlistItem.new(params[:wishlist_item])\n @wishlist_item.user_id = current_user.id\n\n respond_to do |format|\n if @wishlist_item.save\n flash[:notice] = 'WishlistItem was successfully created.'\n format.html { redirect_to(@wishlist_item) }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_items }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wishlist_class = WishlistClass.find(params[:id])\n @wishlist_class.update_attributes(params[:wishlist_class])\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end", "def update_rest\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /wishlist_items/1 DELETE /wishlist_items/1.xml
def destroy @wishlist_item = WishlistItem.find(params[:id]) @wishlist_item.destroy respond_to do |format| format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') } format.xml { head :ok } end end
[ "def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wishlist_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlist_items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlist_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistitem.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlistitems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_item = WishItem.find(params[:id])\n @wish_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_list_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wish_item.destroy\n respond_to do |format|\n format.html { redirect_to wish_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end", "def delete_item_from_wish_list(item_id)\n check_user_authorization\n delete_wrapper(\"/V1/ipwishlist/delete/#{item_id}\", default_headers)\n end", "def remove_wishlist_item\n if item = Item.find_by_id(params[:id])\n @customer.remove_item_from_wishlist(item)\n end\n render :text => ''\n end", "def remove_item_from_wishlist(item)\n if wishlist_item = self.wishlist_items.find_by_item_id(item.id)\n wishlist_item.destroy\n return true\n else\n return false\n end\n end", "def destroy\n @wishlistline = Wishlistline.find(params[:id])\n @wishlistline.destroy\n\n respond_to do |format|\n format.html { redirect_to @wishlistline.wishlist }\n format.json { head :no_content }\n end\n end", "def service_wish_delete(user_id, jancode)\r\n db = Tmarker::Common::DB.new(:wishes)\r\n db.delete({:user_id => user_id, :jancode => jancode})\r\n end", "def destroy\n user = current_user\n item_id = Sneaker.find(params[:id])\n Wishlist.where(sneaker_id: params[:id]).destroy_all\n item_id.destroy\n redirect_to user_path(user)\n end", "def destroy\n @wish = current_user.wishes.find(params[:id])\n redirect_to(@wish) if @wish.status != 0\n @wish.destroy\n\n respond_to do |format|\n format.html { redirect_to(wishes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wish_list.destroy\n respond_to do |format|\n format.html { redirect_to wish_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_lists_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether or not this event is a search event.
def search? type == :search end
[ "def search?\n @cmd.respond_to?( :\"search_status\" )\n end", "def search?\n @cmd.respond_to?(:search_status)\n end", "def searchable?\n !search_clause.nil?\n end", "def searchable?\n false\n end", "def event?\n entry_type == :event\n end", "def searchable?\n true\n end", "def custom_search?\n !@search_options.has_key?(:custom_search)\n end", "def supports_search?\n search_config.present?\n end", "def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? self, event }.to_a.first\n end", "def searchable?\n return params[:search].present?\n end", "def is_searchable\n return @is_searchable\n end", "def event?\n type == :event_id\n end", "def has_complex_search?\n self.search_type.to_s == \"complex\" && !self.is_static?\n end", "def search_engine_class\n EventSearch\n end", "def search_query?\n @query.include? PARAMS[:search_query]\n end", "def safe_search?\n !safe_search.nil?\n end", "def tag_search?\n tag_search_term.present?\n end", "def kind_event?\n\t\t\t\t\tself.kind == \"event\"\n\t\t\t\tend", "def null_search?\n query? && names.include?(NULL_SEARCH)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the given runtime options for required options. If no required options exist, returns true. Otherwise, checks the keys of the runtime options to see if they contain all of the required options.
def check_options_requirements(runtime_options) required_options = options[:requires] || options[:require] return true unless required_options ([required_options].flatten - runtime_options.keys).size == 0 end
[ "def valid?(options)\n (@required_options - options.keys).size == 0\n end", "def required_keys_not_present?(options)\n required_options_not_present = requirements.reject do |required_key|\n options[required_key].present?\n end\n if required_options_not_present.any?\n raise ArgumentError,\n \"Nil keys: #{required_options_not_present.join(', ')}\"\n end\n false\n end", "def missing_required_keys?(options)\n missing_keys = (requirements.to_a - options.keys)\n if missing_keys.any?\n raise ArgumentError,\n \"Missing keys: #{missing_keys.join(', ')}\"\n end\n false\n end", "def has_required_options\n\n # Collect optional_options manually as some may\n # not be saved yet.\n #\n _optional_options = []\n options.each do |option|\n _optional_options << option.item.option\n end\n _optional_options.uniq!\n\n _optional_options.each_with_index do |option, index|\n\n # Find line item options for this option\n #\n line_item_options_for_option = []\n self.options.reduce(line_item_options_for_option){ |collection, line_item_option|\n option == line_item_option.option ? collection << line_item_option : collection\n }\n \n # Find total quantity of line line options\n #\n total_quantity = line_item_options_for_option.inject(0){ |sum, n|\n n.quantity.present? ? sum = sum + n.quantity : sum\n }\n\n # Test required minimum is met\n #\n if option.minimum.present? && total_quantity < option.minimum\n errors.add(\n :base,\n \"#{option.name} must have at least #{pluralize option.minimum, 'option'}\"\n )\n end\n\n # Test required maximum is met\n #\n if option.maximum.present? && total_quantity > option.maximum\n errors.add(\n :base,\n \"#{option.name} may only have at most #{pluralize option.maximum, 'option'}\"\n )\n end\n\n end\n end", "def present?(*keys)\n keys.all? { |key| (opt = fetch_option(key)) && opt.count > 0 }\n end", "def has_options?\n result = false\n \n if product_options.size > 0\n result = true if product_options.first.product_option_values.size > 0\n end\n \n if product_as_options.size > 0\n result = true if product_as_options.first.product_as_option_values.size > 0\n end\n \n result = true if available_variations.size > 1\n \n result\n end", "def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end", "def has_options?\n bounty_expiration.present? || upon_expiration.present? || promotion.present?\n end", "def has_options?\n @has_options ||= self.option_count > 0 || self.sizes.size > 0\n end", "def has_options?\n\t\teach_option { |name, opt|\n\t\t\treturn true if (opt.advanced? == false)\n\n\t\t}\n\n\t\treturn false\n\tend", "def ensure_required_options_are_set!(results)\n missing = @options.inject([]) do |m, (_, opt)|\n m << opt.long if opt.required? && results[opt.name].nil? ; m\n end\n\n unless missing.empty?\n raise Imp::MissingRequiredOption, \"The following options are \" \\\n \"required, but were not given: #{missing.join(', ')}\"\n end\n end", "def assert_required_options\n missing = required_options - present_keys\n\n unless missing.empty?\n raise \"Missing options: #{missing.inspect}\"\n end\n end", "def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end", "def has_options?\n properties.include?(\"has_options\")\n end", "def has_options?(argument)\n return false unless argument.is_a?(Hash)\n # get our keys\n keys = argument.keys.collect(&:to_sym)\n # if we have overlaps, we've been passed options\n return (keys & OPTIONAL_SETTINGS).length > 0\n end", "def validate!\n REQUIRED_CONFIGURATION.each do |name|\n raise \"`#{name}` is a required configuration option, but was not given a value.\" if send(\"#{name}\").nil?\n end\n true\n end", "def options_defined?\n stack[1..-1].each do |list|\n list.each_option do |switch|\n return true if switch.kind_of?(OptionParser::Switch) && (switch.short || switch.long)\n end\n end\n false\n end", "def has_option?(k)\n raise ParseError.new(\"`nil' cannot be an option key\") if (k.nil?)\n @options.has_key?(k.to_sym)\n end", "def option_defined?( key )\n options.has_key?(key) and options[key]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kill all processes including servers, clients and trema PIDs for server and clients are in PID files
def kill_all_processes puts "KILL : all processes" pid_servers = PID_DIR_PATH + "/" + PID_FILE_PREFIX_SERVER + "*" pid_clients = PID_DIR_PATH + "/" + PID_FILE_PREFIX_CLIENT + "*" # for servers Dir::glob(pid_servers).each do |f| if File::ftype(f) == "file" pid_server = f.split( "." )[1] $pids_s.delete(pid_server) begin File.delete(f) Process.kill('KILL', pid_server.to_i) # puts "KILL : server [" + pid_server + "] was killed" rescue Errno::ESRCH STDERR.puts "KILL : server [" + pid_server + "]: No such process" rescue STDERR.puts "ERROR : Can't kill server process [" + pid_server + "]" end end end # for clients Dir::glob(pid_clients).each do |f| if File::ftype(f) == "file" pid_client = f.split( "." )[1] $pids_c.delete(pid_client) begin File.delete(f) Process.kill('KILL', pid_client.to_i) # puts "KILL : client [" + pid_client + "] was killed" rescue Errno::ESRCH STDERR.puts "KILL : client [" + pid_client + "]: No such process" rescue STDERR.puts "ERROR : Can't kill client process [" + pid_client + "]" end end end # for trema cmd = TREMA + " killall" system(cmd) $pids_c.each{|pid| if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end } $pids_s.each{|pid| if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end } end
[ "def kill_processes\n pid_files = Dir[\"#{$out}/*.pid\"]\n pid_files.each do |file|\n f = File.open(file)\n pid = f.read\n file_prefix = File.basename(file, '.pid')\n puts \"killing process: #{file_prefix}\"\n `kill -9 #{pid}`\n #TODO: verify kill result\n File.delete(file)\n end\nend", "def kill_forks\n for id in child_pids\n begin\n Process.kill(\"SIGKILL\", id)\n rescue Errno::ESRCH\n end\n end\n end", "def kill_processes(procs)\n Process.kill('SIGTERM', *procs)\n end", "def kill_procs(options={})\n # Give it a good try to delete all processes.\n # This abuse is necessary to release locks on polyinstantiated\n # directories by pam_namespace.\n\n procfilter=\"-u #{uid}\"\n if options[:init_owned]\n procfilter << \" -P 1\"\n end\n\n # If the terminate delay is specified, try to terminate processes nicely\n # first and wait for them to die.\n if options[:term_delay]\n ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill #{procfilter}\")\n etime = Time.now + options[:term_delay].to_i\n while (Time.now <= etime)\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n break unless rc == 0\n sleep 0.5\n end\n end\n\n oldproclist=\"\"\n stuckcount=0\n while stuckcount <= 10\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill -9 #{procfilter}\")\n break unless rc == 0\n\n sleep 0.5\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if oldproclist == out\n stuckcount += 1\n else\n oldproclist = out\n stuckcount = 0\n end\n end\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if rc == 0\n procset = out.split.join(' ')\n logger.error \"ERROR: failed to kill all processes for #{uid}: PIDs #{procset}\"\n end\n end", "def kill_children_gently(pids)\n pids.each{|pid| kill_gently(pid)}\n end", "def kill_processes(pid_array)\n command = 'taskkill '\n pid_array.each do |pid|\n command = command + \"/pid #{pid} \"\n end\n `#{command}`\n end", "def kill_running_scripts\n stop_interactive_session if interactive_session?\n\n pids.each do |p|\n Process.kill('KILL', p)\n rescue Errno::ESRCH\n # ignored\n end\n pids.clear\n end", "def terminate_processes\n processes.each do |_, process|\n terminate_process(process)\n stop_process(process)\n end\n end", "def kill_processes(signal='QUIT')\n children.each do |pid, process|\n Process.kill(signal, pid)\n end\n end", "def terminate_processes(pids)\n all_pids = pids.map { |pid| tree_pids(pid) }.flatten\n debug(\"Beginning termination of #{all_pids.inspect}\")\n all_pids.each do |pid|\n debug(\" sending TERM to #{pid}\")\n # SIGTERM seems to be the only signal that gets through the parent bash\n # process that runs the script. Tried INT, but it doesn't do anything.\n send_signal(pid, 'TERM')\n end\n\n if wait_for_all_pids_to_terminate(all_pids, 5)\n debug(\"No pids are alive, we're all done\")\n else\n debug(\"Pids are still running, go ahead and kill them.\")\n all_pids.select { |pid| is_alive?(pid) }.each do |pid|\n info(\" killing pid #{pid}\")\n send_signal(pid, 'KILL')\n end\n debug(\"Done killing still-alive children pids.\")\n end\nend", "def kill_all(signal: 'KILL')\n pl = OsCtl::Lib::ProcessList.new do |p|\n ctid = p.ct_id\n next(false) if ctid.nil?\n\n ctid[0] == ct.pool.name && ctid[1] == ct.id\n end\n\n log(:info, \"#{pl.length} processes to kill\")\n pl.each do |p|\n # Double check\n ctid = p.ct_id\n next if ctid.nil?\n\n if ctid[0] == ct.pool.name && ctid[1] == ct.id\n log(:info, \"kill -SIG#{signal} #{p.pid} #{p.name}\")\n\n begin\n Process.kill(signal, p.pid)\n rescue Errno::ESRCH\n end\n end\n end\n end", "def killall\n @processors.each do |proc|\n proc.kill\n end\n @processing_thread.kill\n end", "def kill_game_hosts\n puts 'killing'\n @server_list.each { |server|\n begin\n server.proxy.shutdown\n rescue\n end\n puts 'sent kill message'\n }\n end", "def stopprocs\n ps = Facter.value :ps\n regex = Regexp.new(resource[:target])\n self.debug \"Executing '#{ps}' to find processes that match #{resource[:target]}\"\n pid = []\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n self.debug \"Process matched: #{line}\"\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n pid << ary[1]\n end\n }\n }\n\n ## If a PID matches, attempt to kill it.\n unless pid.empty?\n pids = ''\n pid.each do |thepid|\n pids += \"#{thepid} \"\n end\n begin\n self.debug \"Attempting to kill PID #{pids}\"\n command = \"/bin/kill #{pids}\"\n output = Puppet::Util::Execution.execute(command, :combine => true, :failonfail => false)\n rescue Puppet::ExecutionFailure\n err = <<-EOF\n Could not kill #{self.name}, PID #{thepid}.\n In order to install/upgrade to specified target: #{resource[:target]},\n all related processes need to be stopped.\n Output of 'kill #{thepid}': #{output}\n EOF\n\n @resource.fail Puppet::Error, err, $!\n end\n end\n\n end", "def kill_all_proxies\n processes = Zerg::Support::Process.processes\n processes.each do |proc_info|\n next unless /tem_proxy/ =~ proc_info[:command_line]\n @logger.info \"Mass-killing TEM proxy (pid #{proc_info[:pid]})\"\n Zerg::Support::Process::kill_tree proc_info[:pid]\n end\n end", "def stopprocs\n ps = getps\n regex = Regexp.new(resource[:target])\n debug \"Executing '#{ps}' to find processes that match #{resource[:target]}\"\n pid = []\n IO.popen(ps) do |table|\n table.each_line do |line|\n next unless regex.match(line)\n debug \"Process matched: #{line}\"\n ary = line.sub(%r{^\\s+}, '').split(%r{\\s+})\n pid << ary[1]\n end\n end\n\n ## If a PID matches, attempt to kill it.\n return if pid.empty?\n pids = ''\n pid.each do |thepid|\n pids += \"#{thepid} \"\n end\n begin\n debug \"Attempting to kill PID #{pids}\"\n command = \"/bin/kill #{pids}\"\n output = Puppet::Util::Execution.execute(command, combine: true, failonfail: false)\n rescue Puppet::ExecutionFailure\n err = <<-EOF\n Could not kill #{name}, PID #{pids}.\n In order to install/upgrade to specified target: #{resource[:target]},\n all related processes need to be stopped.\n Output of 'kill #{pids}': #{output}\n EOF\n @resource.fail Puppet::Error, err, $ERROR_INFO\n end\n end", "def kill_processes(pid_array)\n command = 'taskkill '\n pid_array.each do |pid|\n command = command + \"/pid #{pid} \"\n end\n puts \"process killed\" if `#{command}`\n end", "def stop_children\n\n # loop through our children and kill each one\n CHILDREN.each do |child_pid|\n\n Process.kill('TERM', child_pid)\n end\n end", "def stop_apps\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n File.open(Conf,'r').each do |filename|\n filename.chomp!\n next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n pid_to_kill = 0\n\n # First we check to see if we have mention of the app in the PID\n # database. Normally, we should. If we don't have mention of the\n # app in the PID database, then the process table must be searched\n # to attempt to find the app and it's PID so that we have something\n # to kill.\n\n if ((@pid_db[filename].to_i || 0) > 0)\n pid_to_kill = @pid_db[filename].to_i\n else\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tif (ps.cmdline =~ /ruby\\s+#{filename}\\s*$/)\n\t\t\t\t\t\t\tpid_to_kill = ps.pid.to_i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n ps_out.each do |line|\n if (line =~ /ruby\\s+#{filename}\\s*$/)\n line =~ /^\\S+\\s+(\\d+)/\n pid_to_kill = $1.to_i\n\t\t\t\t\t\tbreak\n end\n\t\t\t\tend\n\t\t\tend\n end\n\n # Make sure that a PID to kill was found. This is paranoia in case\n # the app were killed manually or died unexpectedly at some point.\n # it'd be a real bummer to kill someone's shell session just because\n # they had the dumb luck to inherit a PID number that used to belong\n # to an Iowa app.\n\n k = false\n if (pid_to_kill > 0)\n begin\n Process.kill('SIGTERM',pid_to_kill)\n k = true\n rescue Exception\n puts \"Error killing PID #{pid_to_kill} (#{filename})\"\n\t\t\tend\n puts \"Stopped PID #{pid_to_kill} (#{filename})\" if k\n else\n puts \"Warning: Can't find a PID for #{filename}\"\n\t\tend\n\n @pid_db.delete filename if k\n end\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List all the groups.
def list @groups = Group.find(:all, :order => 'name') end
[ "def list\n response = @client.get('groups')\n verify response,\n forbidden: 'You do not have permission to view the groups list'\n end", "def groups\n @cluster.list_groups\n end", "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "def index\n @groups = Group.get_all(current_user.account_id)\n end", "def list_groups\n groups = CanvasSpaces.GroupCategory.groups.active.order(:name)\n # filter out non-public groups for non-admins\n groups = groups.where(join_level: 'parent_context_auto_join') unless @current_user.account.site_admin?\n groups_json = Api.paginate(groups, self, api_v1_canvas_spaces_groups_url).map do |g|\n include = @current_user.account.site_admin? || @current_user.id == g.leader_id ? ['users'] : []\n group_formatter(g, { include: include })\n end\n render :json => groups_json\n end", "def groups\n result = get(\"groups\")\n end", "def send_group_list\n I3.server.send_object(I3.directory.find_all_groups)\n end", "def show_groups\n content = Accio::Parser.read\n content.groups.each do |group|\n puts \"#{group.title}\\n\"\n end\n end", "def groups\r\n @groups ||= fetch_groups\r\n end", "def groups(opts = {})\n find_collection(\"groups\", opts)\n end", "def list_groups(groups,**opts)\n\t\t\t\treturn {} if groups.nil? or !@packager\n\t\t\t\tgroups=[*groups].map do |g|\n\t\t\t\t\tg==:all ? group_packages(**opts) : g\n\t\t\t\tend.flatten.uniq\n\t\t\t\tblock_given? ? yield(*groups) : {}\n\t\t\tend", "def list_groups\n {\n count: inventory.group_names.count,\n groups: inventory.group_names.sort,\n inventory: {\n default: config.default_inventoryfile.to_s,\n source: inventory.source\n }\n }\n end", "def groups()\n get('contactGroupList')\n end", "def get_groups\n `id -G #{name}`.split(' ').map {|g| Group.new(g.to_i)}\n end", "def list_groups(options = {})\n request({\n 'Action' => 'ListGroups',\n :parser => Fog::Parsers::AWS::IAM::ListGroups.new\n }.merge!(options))\n end", "def list_groups(count)\n @iam_resource.groups.limit(count).each do |group|\n puts(\"\\t#{group.name}\")\n end\n rescue Aws::Errors::ServiceError => e\n puts(\"Couldn't list groups for the account. Here's why:\")\n puts(\"\\t#{e.code}: #{e.message}\")\n raise\n end", "def groups\n return @groups\n end", "def find_all_groups\n return collect_from_search_paths do |search_path|\n perform_query(search_path,\n \"(|(objectClass=organizationalUnit)(objectClass=group))\", [\"dn\"]\n ).collect { |entry| entry[\"dn\"][0] }\n end #collect_from_search_paths\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Give the given group either ALL or NO permissions to all the folders
def give_permissions_to_folders(group, permission_to_everything) Folder.find(:all).each do |folder| add_to_group_permissions(group, folder, permission_to_everything) end end
[ "def set_permissions(folderid, group, permissions)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/groups/#{group}\", args)\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n return h == \"1\"\n end", "def add_to_group_permissions(group, folder, permission_to_everything)\n group_permission = GroupPermission.new\n group_permission.folder = folder\n group_permission.group = group\n group_permission.can_create = permission_to_everything\n group_permission.can_read = permission_to_everything\n group_permission.can_update = permission_to_everything\n group_permission.can_delete = permission_to_everything\n group_permission.save\n end", "def chmod_dir_and_files_recursively\n print \"Attempting 'chmod -R #{@user}:#{@group}' as '#{@user}'... \"\n FileUtils.chown_R @user, @group, '.'\n puts 'Success!'\n rescue Errno::EPERM\n failure_exit_with_msg sudo_msg\n end", "def check_dir_group(options,dir_name,dir_gid,dir_mode)\n if dir_name.match(/^\\/$/) or dir_name == \"\"\n handle_output(options,\"Warning:\\tDirectory name not set\")\n quit(options)\n end\n test_gid = File.stat(dir_name).gid\n if test_gid.to_i != dir_gid.to_i\n message = \"Information:\\tChanging group ownership of \"+dir_name+\" to \"+dir_gid.to_s\n if dir_name.to_s.match(/^\\/etc/)\n command = \"sudo chgrp -R #{dir_gid.to_s} \\\"#{dir_name}\\\"\"\n else\n command = \"chgrp -R #{dir_gid.to_s} \\\"#{dir_name}\\\"\"\n end\n execute_command(options,message,command)\n message = \"Information:\\tChanging group permissions of \"+dir_name+\" to \"+dir_gid.to_s\n if dir_name.to_s.match(/^\\/etc/)\n command = \"sudo chmod -R g+#{dir_mode} \\\"#{dir_name}\\\"\"\n else\n command = \"chmod -R g+#{dir_mode} \\\"#{dir_name}\\\"\"\n end\n execute_command(options,message,command)\n end\n return\nend", "def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def check_group\n self.permission_group ||= PermissionGroup.find_by_name(\"others\")\n end", "def add_to_groups\n Group.where(admin: false).find_each do |g|\n gp = g.group_permissions.build(permission: self, permission_code: :deny)\n gp.save!\n end\n end", "def group_has_permission?(all_permissions, examined_group_permission)\n group_permissions = all_permissions[4, 3].delete('-') # Example -rwxr-xr-- -> rx\n group_permissions.include?(examined_group_permission)\n end", "def set_perms(data)\n permission = data[:permission] || 2\n result = @client.api_request(\n :method => \"usergroup.massAdd\",\n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def give_access(folderid, group)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/groups\", args)\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n return h == \"1\"\n end", "def grant_all!\n @all_permissions=true\n end", "def write_permission_group(ident, text, desc, options, def_option)\n options << :flow unless options.include?(:flow)\n p = PermissionGroup.new(ident, text, desc, options, def_option)\n return p\nend", "def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end", "def grant_admin_permissions_for_all_groups(admin_user, admin_password)\r\n Group.roots.each do |group|\r\n self.permissions.create(:group => group, :mode => \"ADMIN\",\r\n :admin_user => admin_user, :admin_password => admin_password)\r\n end\r\n end", "def chown(user_and_group)\n return unless user_and_group\n user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}\n FileUtils.chown user, group, selected_items.map(&:path)\n ls\n end", "def groups_with_permission(permission)\n self.groups.select do |group|\n group.can?(permission)\n end\n end", "def check_or_create_group_dirs\n change_dir(@working_directory)\n @config[:groups].each do |key, value|\n if value[:enable]\n Dir.mkdir(value[:name].downcase) unless Dir.exists?(value[:name].downcase) \n end \n end\n return Dir.glob('*').select { |f| File.directory? f }\n end", "def set_defaults_to_universal\r\n universal_array = PermissionGroup.where(owner: self.owner).where(universal: true).to_a\r\n universal_array = [PermissionGroup.new(name: \"universal\", universal:true, owner: self.owner)] if universal_array.empty?\r\n self.permission_groups = universal_array\r\n end", "def action_chgrp\n if @tgroup == nil\n Chef::Log::fatal \"target group need to be provided to perform chgrp\"\n elsif (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chgrp #{ @new_resource }\") do\n @client.chown(@path, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the given group and folder to GroupPermissions and (dis)allow everything
def add_to_group_permissions(group, folder, permission_to_everything) group_permission = GroupPermission.new group_permission.folder = folder group_permission.group = group group_permission.can_create = permission_to_everything group_permission.can_read = permission_to_everything group_permission.can_update = permission_to_everything group_permission.can_delete = permission_to_everything group_permission.save end
[ "def set_permissions(folderid, group, permissions)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/groups/#{group}\", args)\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n return h == \"1\"\n end", "def add_to_groups\n Group.where(admin: false).find_each do |g|\n gp = g.group_permissions.build(permission: self, permission_code: :deny)\n gp.save!\n end\n end", "def give_permissions_to_folders(group, permission_to_everything)\n Folder.find(:all).each do |folder|\n add_to_group_permissions(group, folder, permission_to_everything)\n end\n end", "def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def set_perms(data)\n permission = data[:permission] || 2\n result = @client.api_request(\n :method => \"usergroup.massAdd\",\n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def write_permissions_on_new\n return if current_user.is_admin?\n raise ActiveRecord::RecordNotFound if params[:entry].nil?\n @group = Group.find(params[:entry][:group_id])\n raise AccessDenied unless @group.allows_write_access_for?(current_user)\n end", "def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end", "def update_group_permissions(folder_id_param, group_check_box_list, field, recursively)\r\n # iteratively update the GroupPermissions\r\n group_check_box_list.each do |group_id, can_do_it|\r\n # get the GroupPermissions\r\n group_permission = GroupPermission.find_by_group_id_and_folder_id(group_id, folder_id_param)\r\n\r\n # Do the actual update if the GroupPermission exists;\r\n # do not update the permissions of the admins group\r\n # (it should always be able to do everything)\r\n unless group_permission.blank? or group_permission.group.is_the_administrators_group?\r\n case field\r\n when 'create':\r\n group_permission.can_create = can_do_it\r\n when 'read':\r\n group_permission.can_read = can_do_it\r\n when 'update':\r\n group_permission.can_update = can_do_it\r\n when 'delete':\r\n group_permission.can_delete = can_do_it\r\n end\r\n group_permission.save\r\n end\r\n end\r\n\r\n # The recursive part...\r\n if recursively\r\n # Update the child folders\r\n folder = Folder.find_by_id(folder_id_param)\r\n if folder\r\n folder.children.each do |child_folder|\r\n update_group_permissions(child_folder.id, group_check_box_list, field, true)\r\n end\r\n end\r\n end\r\n end", "def write_permission_group(ident, text, desc, options, def_option)\n options << :flow unless options.include?(:flow)\n p = PermissionGroup.new(ident, text, desc, options, def_option)\n return p\nend", "def copy_permissions_to_new_folder(folder)\r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(folder_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = folder\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end", "def copy_permissions_from(folder)\n f_id = folder.instance_of?(Folder) ? folder.id : folder\n \r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(f_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = self\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end", "def set_auth_groups\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @folder = Folder.find(params[:id])\n\n if Folder.check_user_auth(@folder.id, @login_user, 'w', true)\n read_groups = []\n write_groups = []\n groups_auth = params[:groups_auth]\n unless groups_auth.nil?\n groups_auth.each do |auth_param|\n user_id = auth_param.split(':').first\n auths = auth_param.split(':').last.split('+')\n if auths.include?('r')\n read_groups << user_id\n end\n if auths.include?('w')\n write_groups << user_id\n end\n end\n end\n\n @folder.set_read_groups(read_groups)\n @folder.set_write_groups(write_groups)\n\n @folder.save\n\n flash[:notice] = t('msg.register_success')\n else\n flash[:notice] = 'ERROR:' + t('folder.need_auth_to_modify')\n end\n\n @groups = Group.where(nil).to_a\n render(:partial => 'ajax_auth_groups', :layout => false)\n\n rescue => evar\n Log.add_error(request, evar)\n render(:partial => 'ajax_auth_groups', :layout => false)\n end", "def group_has_permission?(all_permissions, examined_group_permission)\n group_permissions = all_permissions[4, 3].delete('-') # Example -rwxr-xr-- -> rx\n group_permissions.include?(examined_group_permission)\n end", "def give_access(folderid, group)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/groups\", args)\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n return h == \"1\"\n end", "def check_dir_group(options,dir_name,dir_gid,dir_mode)\n if dir_name.match(/^\\/$/) or dir_name == \"\"\n handle_output(options,\"Warning:\\tDirectory name not set\")\n quit(options)\n end\n test_gid = File.stat(dir_name).gid\n if test_gid.to_i != dir_gid.to_i\n message = \"Information:\\tChanging group ownership of \"+dir_name+\" to \"+dir_gid.to_s\n if dir_name.to_s.match(/^\\/etc/)\n command = \"sudo chgrp -R #{dir_gid.to_s} \\\"#{dir_name}\\\"\"\n else\n command = \"chgrp -R #{dir_gid.to_s} \\\"#{dir_name}\\\"\"\n end\n execute_command(options,message,command)\n message = \"Information:\\tChanging group permissions of \"+dir_name+\" to \"+dir_gid.to_s\n if dir_name.to_s.match(/^\\/etc/)\n command = \"sudo chmod -R g+#{dir_mode} \\\"#{dir_name}\\\"\"\n else\n command = \"chmod -R g+#{dir_mode} \\\"#{dir_name}\\\"\"\n end\n execute_command(options,message,command)\n end\n return\nend", "def chmod_dir_and_files_recursively\n print \"Attempting 'chmod -R #{@user}:#{@group}' as '#{@user}'... \"\n FileUtils.chown_R @user, @group, '.'\n puts 'Success!'\n rescue Errno::EPERM\n failure_exit_with_msg sudo_msg\n end", "def check_group\n self.permission_group ||= PermissionGroup.find_by_name(\"others\")\n end", "def can_create(folder_id)\n self.groups.each do |group|\n group_permission = group.group_permissions.find_by_folder_id(folder_id)\n return true unless group_permission.blank? or not group_permission.can_create\n end\n return false\n end", "def modify_image_launch_perm_add_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'add', :user_group => user_group.to_a)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The group called 'admins' can not be edited or deleted. By calling this method via a before_filter, you makes sure this doesn't happen.
def do_not_rename_or_destroy_admins_group if @group and @group.is_the_administrators_group? redirect_to :action => 'list' and return false end end
[ "def prevent_zero_group_admins\n @membership = Membership.find(params[:id])\n @group = @membership.group\n if @group.has_one_admin? && (@membership.user == current_user)\n flash[:danger] = \"You cannot quit unless there are other group admins.\"\n redirect_to @group\n end\n end", "def require_admin_of_group\n if !admin_of(current_group)\n # TODO: add flash alert\n redirect_back fallback_location: current_group\n end\n end", "def admin_user\n @group = Group.find(by_id)\n redirect_to @group unless @group.has_admin?(current_user)\n end", "def group_admins\n group.blank? ? [] : group.has_admins\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def has_global_admins_group\n # TODO: in principle this should be something we can move to SQL now\n debug(\"* Creating global admins group\")\n @global_groups.new(:groupname=> \"#{org_name}_global_admins\",\n :orgname => org_name,\n :actor_and_group_names=> { \"groups\" => [\"admins\"] },\n :requester_id=>requesting_actor_id).save!\n end", "def is_group_admin(group)\n if is_admin || group.admins.include?(self)\n return true\n end\n false\n end", "def admin_groups(groups)\n groups.reject {|g| !current_user.group_admin?(g)}\n end", "def may_destroy_group?(group)\n\t\t\tmay_administrate?\n\t\tend", "def require_admin\n unless current_user.group_id == 1 or current_user.group_id == 3 or current_user.id == 14\n store_location\n flash[:notice] = \"Debes tener privilegios de administrador para ingresar al modulo de administracion todo abuso sera reportado a las autoridades correspondientes\"\n # current_user_session.destroy\n redirect_to :controller => 'navigators', :action => 'index'\n return false\n end\n end", "def admin_only\n false\n end", "def dont_destroy_admin\n raise \"Can't delete admin\" if self.is_the_administrator?\n end", "def group_admin?\n return false unless group\n\n group.admin?(user)\n end", "def make_admin_of(group)\n if self.groups.include?(group)\n gm = self.group_members.where(group_id: group.id).first\n gm.admin = true\n gm.save\n end\n end", "def can_edit\n producer.admin?(user) || group_admin?\n end", "def edit\n @group = Group.find(params[:id])\n if !current_user.authen_check(\"Administration\",\"Modify Groups\")\n render :template => \"groups/edit\", :layout => 'core'\n end\n end", "def authenticate_admin\n return unless load_group\n \n unless current_user.is_admin_of?(@group)\n flash[:warning] = '그룹의 관리자만 접근할 수 있습니다'\n respond_to do |format|\n format.js { render 'layouts/redirect' }\n format.html { redirect_to group_url(@group) }\n end\n end\n end", "def edit_admins\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a group exists before executing an action. If it doesn't exist: redirect to 'list' and show an error message
def does_group_exist @group = Group.find(params[:id]) rescue flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.' redirect_to :action => 'list' and return false end
[ "def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end", "def require_member_of_group\n if !member_of(current_group)\n # TODO: Add flash alert\n redirect_back fallback_location: home_path\n end\n end", "def load_group\n \n @group = nil\n \n if params.has_key?(:group_id)\n @group = Group.find_by_id(params[:group_id])\n elsif params.has_key?(:id)\n @group = Group.find_by_id(params[:id])\n end\n \n if @group.blank?\n respond_to do |format|\n format.js { render 'layouts/redirect' }\n format.html { render file: 'public/404', format: :html, status: 404 }\n end\n return false\n end\n \n return true\n \n end", "def correct_group\n @group = Group.find(params[:id])\n redirect_to(root_url) unless @group == current_group\n end", "def view\n\t\treturn if not signed_in_response\n\t\treturn if not get_group\n\t\treturn if not member_of_group\n\t\trespond(SUCCESS, @group.get_hash)\n\tend", "def delete\n @group = Group.find(params[:id].to_i)\n \n if request.get?\n # render only\n else\n if not params[:yes].nil?\n @group.destroy\n flash[:success] = 'The group has been deleted successfully.'\n redirect_to :action => 'list'\n else\n flash[:success] = 'The group has not been deleted.'\n redirect_to :action => 'show', :id => params[:id]\n end\n end\n\n rescue CantDeleteWithChildren\n flash[:error] = \"You have to delete or move the group's children before attempting to delete the group itself.\"\n redirect_to :action => 'show', :id => params[:id]\n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'This group could not be found.'\n redirect_to :action => 'list'\n end", "def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end", "def require_admin_of_group\n if !admin_of(current_group)\n # TODO: add flash alert\n redirect_back fallback_location: current_group\n end\n end", "def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end", "def select\n if Integer(params[:id]) == -1\n session[:group] = nil\n redirect_to :action => \"index\"\n else\n @group = @user.groups.find(params[:id])\n if @group\n session[:group] = @group.id\n redirect_to :action => \"index\"\n else\n flash[:error] = \"You selected a unkown group\"\n redirect_to :action => \"groups\" \n end\n end\n end", "def add_to_group\n asset_group = AssetGroup.find_by_object_key(params[:asset_group])\n if asset_group.nil?\n notify_user(:alert, \"Can't find the asset group selected.\")\n else\n if @asset.asset_groups.exists? asset_group.id\n notify_user(:alert, \"Asset #{@asset} is already a member of '#{asset_group}'.\")\n else\n @asset.asset_groups << asset_group\n notify_user(:notice, \"Asset #{@asset} was added to '#{asset_group}'.\")\n end\n end\n\n # Always display the last view\n redirect_back(fallback_location: root_path)\n end", "def add\n respond_to do |format|\n @user = User.find_by_id(params[:group][:id])\n if @user == NIL\n @group = Group.find(params[:id])\n format.html { redirect_to @group, alert: \"User ID does not exist!\" }\n else\n @group = Group.find(params[:id])\n @users = @group.users\n\n if !@users.include?(@user)\n @user.groups << @group\n format.html { redirect_to @group, notice: \"#{@user.fname} was added to #{@group.name}!\" }\n else\n format.html { redirect_to @group, alert: \"#{@user.fname} is already in #{@group.name}!\" }\n end\n format.json { render :show, status: :ok, location: @group }\n end\n end\n end", "def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end", "def admin\n if (params[:id].blank?)\n @groups = @club.groups\n @grouplist = @club.groups.find(:all, :conditions => [\"bns_parent_id IS NOT ?\", nil], :order => 'lft')\n \n @page_title = \"Group Listing\"\n @site_section = \"admin\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n else\n @group = @club.groups.find(params[:id])\n @page = @club.pages.find(:first, :conditions=> [\"title=?\",@group.name])\n \n @page_title = \"Showing \" + @group.name\n @site_section = \"admin\"\n respond_to do |format|\n format.html { render :action => \"admin_show\" }\n format.xml { render :xml => @group }\n end\n end\n end", "def join_or_create_group(group)\n if group_params[:name].blank?\n flash[:alert] = \"Group name can't be blank.\"\n redirect_to group_path(@user.groups.first)\n elsif group && group.user_ids != @user.id && @user.groups.empty?\n @user.groups << group\n redirect_to group_path(@user.groups.first)\n elsif group && group.user_ids != @user.id\n flash[:notice] = \"That group name is already taken. Please pick another.\"\n redirect_to group_path(@user.groups.first)\n elsif @user.groups.include?(group)\n redirect_to group_path(group)\n else\n @user.groups << Group.create(group_params)\n @user.save\n redirect_to group_path(@user.groups.last)\n end\n end", "def index\n @groups = current_user.groups.active\n render 'groups/welcome' if @groups.blank?\n end", "def exists?(group)\n url = build_url(group)\n rest_head(url) and true\n rescue Azure::Armrest::NotFoundException\n false\n end", "def edit\n @group = Group.find(params[:id])\n if !current_user.authen_check(\"Administration\",\"Modify Groups\")\n render :template => \"groups/edit\", :layout => 'core'\n end\n end", "def check_request\n group_user = GroupUser.where(group_id: params[:group_id], user_id: params[:user_id]).first\n if group_user.present?\n if Group.exists?(id: params[:group_id], user_id: params[:user_id])\n render json: { group_user: group_user, status: 'creator'}\n else\n render json: { group_user: group_user, status: 'joined'}\n end\n else\n render json: { status: 'none'}\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a "square" array of subarrays, find the sum of values from the first value of the first array, the second value of the second array, the third value of the third array, and so on... Example 1: exampleArray = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] diagonalSum(exampleArray) => 4 Example 2: exampleArray = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]] diagonalSum(exampleArray) => 5
def diagonalSum(matrix) total = 0 (0...matrix.length).each {|sub| total += matrix[sub][sub]} return total end
[ "def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend", "def multi_dimensional_sum(array)\n array.flatten.sum\nend", "def sum_of_sums(array)\n \n total_sum = 0\n subsequence_sum = 0\n array.each do |num|\n subsequence_sum += num\n total_sum += subsequence_sum\n end\n total_sum\nend", "def diagonal_sum\n (0...SIDE).inject(0) { |sum, i| sum + self[i,i] }\n end", "def sum_of_sums(arr)\n subsequences = []\n arr.each_with_index do |num, index|\n subsequences << arr.slice(0, index + 1)\n end\n \n subsequences.flatten.sum\nend", "def sum_of_sums(array)\n array.map.with_index { |_, index| array.take(index + 1).inject(:+) }.inject(:+)\nend", "def two_d_sum(arr)\n\tsum = 0\n arr.each do |elem|\n elem.each do |num|\n sum +=num\n end\n end\n return sum\nend", "def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend", "def SumSquares(arr)\n #first flatten the array inside\n results = 0\n arr.each do |el|\n if el.is_a?(Array)\n results += SumSquares(el)\n else\n results += el**2\n end\n end\n\n results\nend", "def zero_sum_sub_arrays(xs)\n return 0 if xs.size < 2\n\n (2..xs.size)\n .flat_map { |n| xs.each_cons(n).to_a }\n .select { |xs| xs.sum == 0 }\n .size\nend", "def parts_sums(array)\n sub_parts = []\n 0.upto(array.size-1) do |start_index|\n sub_parts << array[start_index..-1]\n end\n sub_parts.map{|subarray| subarray.sum} << 0\nend", "def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend", "def sum_of_sums(array)\n supersum = 0\n array.each_with_index do |_, index|\n supersum += array[0, index + 1].inject(:+)\n end\n supersum\nend", "def sum_of_sums(arr)\n sum_groups = []\n\n arr.each_with_index { |_, index| sum_groups << arr[0, index + 1].sum }\n\n sum_groups.sum\nend", "def contig_subsum(array)\n sub_arrays = []\n i = 0\n j = 0\n while i < array.length do\n while j < array.length do\n sub_arrays << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n\n max_sum = 0\n arr = []\n\n sub_arrays.each do |sub|\n arr << sub.inject(:+)\n end\n\n arr.uniq.sort.last\n\nend", "def sum_prod_diags(matrix)\n\n require 'matrix'\n \n # ability to rotate nested array 90 degrees (for right - to left calc)\n def rotate(matrix)\n newMatrix, finalMatrix, i = [], [], 0\n (matrix.length > matrix[0].length ? matrix.length : matrix[0].length).times do\n matrix.map { |row| row[i] != nil ? newMatrix << row[i] : nil }\n i+=1\n end\n newMatrix.each_slice(matrix.length).to_a.reverse\n end\n \n # get the diagonal and all lower diagonals\n def diags_sum_array(matrix)\n sum = []\n length = matrix.column(0).count\n \n d = matrix\n i = length\n while i > 0 do\n # multiply the values of the diagonal\n sum << d.each(:diagonal).inject(:*)\n d = d.first_minor(0,(i-1))\n i -= 1\n end\n \n # get the upper diagonals\n trans = matrix.transpose\n y = length - 1\n while y > 0 do\n # multiply the values of the diagonal\n trans = trans.first_minor(0,(y))\n sum << trans.each(:diagonal).inject(:*)\n y -= 1\n end\n \n return sum\n \n end\n\n # run for left to right calc\n d_sum = diags_sum_array(Matrix[*matrix])\n \n # run for right to left calc (using rotate array method)\n a_sum = diags_sum_array(Matrix[*rotate(matrix)])\n\n # add each result, return the difference in the two\n return d_sum.inject(:+) - a_sum.inject(:+)\n \nend", "def sumar_arrays(arrays)\n arrays.transpose.map {|x| x.reduce(:+)}\nend", "def diagonalDifference(arr)\n n = arr.length\n primary = (0..n - 1).reduce(0) do |sum, i|\n sum + arr[i][i]\n end\n secondary = (0..n - 1).reduce(0) do |sum, i|\n sum + arr[i][n - 1 - i]\n end\n (primary - secondary).abs\nend", "def other_diagonal_sum\n (0...SIDE).inject(0) { |sum, i| sum + self[i,SIDE-i-1] }\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /test_bookings/1 DELETE /test_bookings/1.xml
def destroy @test_booking = TestBooking.find(params[:id]) @test_booking.destroy respond_to do |format| format.html { redirect_to(test_bookings_url) } format.xml { head :ok } end end
[ "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end", "def delete_bookings()\n sql = \"DELETE FROM bookings\n WHERE bookings.member_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @bookshelf = Bookshelf.find(params[:id])\n @bookshelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookshelves_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Book.update(params[:id], { :deleted => true} )\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @guest_book = GuestBook.find(params[:id])\n @guest_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(guest_books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @guestbook = Guestbook.find(params[:id])\n @guestbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(guestbooks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gbooking = Gbooking.find(params[:id])\n @gbooking.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_gbookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @addbook = Addbook.find(params[:id])\n @addbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(addbooks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @house_book = HouseBook.find(params[:id])\n @house_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(house_books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @scrap_xml = ScrapXml.find(params[:id])\n @scrap_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(scrap_xmls_url) }\n format.xml { head :ok }\n end\n end", "def test_delete_gone_document\n\n put_toto_doc\n doc = get_toto_doc\n @s.delete(doc)\n\n r = @s.delete(doc)\n\n assert_equal true, r\n end", "def destroy\n @addressbook = Addressbook.find(params[:id])\n @addressbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(addressbooks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @book_in_need = BookInNeed.find(params[:id])\n @book_in_need.destroy\n\n respond_to do |format|\n format.html { redirect_to(book_in_needs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def destroy\n @free_book = FreeBook.find(params[:id])\n File.delete(\"#{RAILS_ROOT}/public/fbooks_pics/#{@free_book.picture}\")\n File.delete(\"#{RAILS_ROOT}/public/fbooks_st/#{@free_book.book_url}\")\n @free_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(free_books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @borrowed_book = BorrowedBook.find(params[:id])\n @borrowed_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(borrowed_books_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @my_book = MyBook.find(params[:id])\n @my_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_books_url) }\n format.xml { head :ok }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /company_types GET /company_types.json
def index @company_types = CompanyType.all render json: @company_types end
[ "def index\n @company_types = CompanyType.all\n end", "def show\n render json: @company_type\n end", "def index\n @business_company_types = Business::CompanyType.all\n end", "def types\n types = JSON.parse(connection.get(\"/Contact/Types\").body )\n end", "def index\n @type_companies = TypeCompany.all\n end", "def type\n fetch('company.type')\n end", "def retrieve_entity_types()\n start.uri('/api/entity/type')\n .get()\n .go()\n end", "def show\n @company_type = CompanyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_type }\n end\n end", "def types\n get(\"/project/types\")[\"types\"]\n end", "def index\n @admin_company_types = Admin::CompanyType.all\n end", "def index\n @customer_companies = Customer.find(:all, :conditions => \"customer_type_id = 1\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customer_companies }\n end\n end", "def get_complaint_types\n\t\tcomplaint_types = ComplaintType.where(\"university_id = ?\",params[:university_id])\n\t\trender :json => [\n\t\t\t:complaint_types => complaint_types.map { |c| c.as_json(:only => [:id,:name])},\n\t\t\t:university_id => params[:university_id]\n\t\t\t].to_json\n\tend", "def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end", "def index\n @organisation_types = OrganisationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisation_types }\n end\n end", "def order_types\n url = \"#{@url}reference/order-types\"\n make_request(url)\n end", "def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end", "def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n render json: @specification_types, each_serializer: Website::V1::SpecificationTypeSerializer\n end", "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /company_types/byState/1 GET /company_types/byState/1.json
def byState @company_types = CompanyType.where("state_id = ?", company_type_params[:state_id]) render json: @company_types end
[ "def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end", "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def byState\n @domicile_types = DomicileType.where(\"state_id = ?\", domicile_type_params[:state_id])\n\n render json: @domicile_types\n end", "def index\n @business_company_types = Business::CompanyType.all\n end", "def index\n @company_types = CompanyType.all\n end", "def show\n render json: @company_type\n end", "def byState\n @line_types = LineType.where(\"state_id = ?\", line_type_params[:state_id])\n\n render json: @line_types\n end", "def index\n @type_companies = TypeCompany.all\n end", "def index\n @customer_companies = Customer.find(:all, :conditions => \"customer_type_id = 1\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customer_companies }\n end\n end", "def show\n @company_type = CompanyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_type }\n end\n end", "def type\n fetch('company.type')\n end", "def index\n @state_types = StateType.all\n end", "def index\n @organisation_types = OrganisationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisation_types }\n end\n end", "def index\n @business_types = BusinessType.all\n end", "def index\n @carrier_type_has_checkout_types = CarrierTypeHasCheckoutType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @carrier_type_has_checkout_types }\n end\n end", "def index\n @counties = Entity.where(entity_type: 'County').order(:entity_name)\n respond_with(@counties)\n end", "def index\n @city_types = CityType.all\n end", "def index\n if params.has_key?(\"state_id\")\n @db_state = DbState.find_by_id(params[:state_id])\n @db_cities = @db_state.try(:cities)\n else\n @db_cities = DbCity.all\n end\n render json: @db_cities\n end", "def index\n @admin_company_types = Admin::CompanyType.all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /company_types/1 GET /company_types/1.json
def show render json: @company_type end
[ "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def show\n @company_type = CompanyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_type }\n end\n end", "def index\n @company_types = CompanyType.all\n end", "def index\n @type_companies = TypeCompany.all\n end", "def type\n fetch('company.type')\n end", "def index\n @business_company_types = Business::CompanyType.all\n end", "def index\n @customer_companies = Customer.find(:all, :conditions => \"customer_type_id = 1\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customer_companies }\n end\n end", "def index\n @admin_company_types = Admin::CompanyType.all\n end", "def new\n @company_type = CompanyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company_type }\n end\n end", "def index\n @organisation_types = OrganisationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisation_types }\n end\n end", "def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end", "def types\n types = JSON.parse(connection.get(\"/Contact/Types\").body )\n end", "def show\n @complaint_type = ComplaintType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint_type }\n end\n end", "def new\n @customer_company = Customer.new\n @customer_companies = Customer.find(:all, :conditions => \"customer_type_id = 1\") # 1=cliente empresa\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_company }\n end\n end", "def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end", "def show\n @company_packaging_type = CompanyPackagingType.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_packaging_type }\n end\n end", "def show\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_type }\n end\n end", "def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end", "def index\n @budget_types = BudgetType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budget_types }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /company_types POST /company_types.json
def create @company_type = CompanyType.new(company_type_params) if @company_type.save render json: @company_type, status: :created, location: @company_type else render json: @company_type.errors, status: :unprocessable_entity end end
[ "def create\n @company_type = CompanyType.new(company_type_params)\n\n respond_to do |format|\n if @company_type.save\n format.html { redirect_to company_types_path, notice: 'Company type was successfully created.' }\n format.json { render :show, status: :created, location: @company_type }\n else\n format.html { render :new }\n format.json { render json: @company_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_type = CompanyType.new(params[:company_type])\n\n respond_to do |format|\n if @company_type.save\n format.html { redirect_to @company_type, notice: 'Company type was successfully created.' }\n format.json { render json: @company_type, status: :created, location: @company_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_company = TypeCompany.new(type_company_params)\n\n respond_to do |format|\n if @type_company.save\n format.html { redirect_to @type_company, notice: 'Type company was successfully created.' }\n format.json { render :show, status: :created, location: @type_company }\n else\n format.html { render :new }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_company_type = Admin::CompanyType.new(admin_company_type_params)\n\n respond_to do |format|\n if @admin_company_type.save\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_company_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def create_companies(model) path = \"/api/v2/companies\"\n post(path, model, {}, AvaTax::VERSION) end", "def index\n @company_types = CompanyType.all\n end", "def create\n respond_to do |format|\n if params[:work_type_name].present?\n work_type = WorkType.find_or_create_by(name: params[:work_type_name])\n params[:company_work_type][:work_type_id] = work_type.id \n @company_work_type = CompanyWorkType.new(company_work_type_params)\n if @company_work_type.save\n format.html { redirect_to company_admin_company_work_types_url, notice: 'Company Work Type was successfully created.' }\n format.json { render :show, status: :created, location: @company_work_type }\n else\n format.html { render :new }\n format.json { render json: @company_work_type.errors, status: :unprocessable_entity }\n end\n else\n @company_work_type = CompanyWorkType.new(company_work_type_params)\n format.html { render :new }\n format.json { render json: @company_work_type.errors, status: :unprocessable_entity } \n end \n end\n end", "def new\n @company_type = CompanyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company_type }\n end\n end", "def index\n @business_company_types = Business::CompanyType.all\n end", "def create_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "def create\n @tyc_company = Tyc::Company.new(tyc_company_params)\n\n respond_to do |format|\n if @tyc_company.save\n format.html { redirect_to @tyc_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @tyc_company }\n else\n format.html { render :new }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def show\n render json: @company_type\n end", "def index\n @type_companies = TypeCompany.all\n end", "def create_types\n\t\t[]\n\tend", "def create\n @complaint_type = ComplaintType.new(complaint_type_params)\n\n respond_to do |format|\n if @complaint_type.save\n format.html { redirect_to complaint_types_url, notice: 'Complaint type was successfully created.' }\n format.json { render :show, status: :created, location: @complaint_type }\n else\n format.html { render :new }\n format.json { render json: @complaint_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_params = company_params.to_json\n @reponse = HTTParty.post(\"https://rails-api-ipo.herokuapp.com/api/v1/companies.json\",\n :body => @company_params,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end", "def create\n @corporation_type = CorporationType.new(corporation_type_params)\n\n respond_to do |format|\n if @corporation_type.save\n format.html { redirect_to @corporation_type, notice: 'Corporation type was successfully created.' }\n format.json { render :show, status: :created, location: @corporation_type }\n else\n format.html { render :new }\n format.json { render json: @corporation_type.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /company_types/1 PATCH/PUT /company_types/1.json
def update @company_type = CompanyType.find(params[:id]) if @company_type.update(company_type_params) head :no_content else render json: @company_type.errors, status: :unprocessable_entity end end
[ "def update\n respond_to do |format|\n if @company_type.update(company_type_params)\n format.html { redirect_to company_types_path, notice: 'Company type was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_type }\n else\n format.html { render :edit }\n format.json { render json: @company_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_company_type.update(admin_company_type_params)\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .patch()\n .go()\n end", "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end", "def update\n respond_to do |format|\n if params[:work_type_name].present?\n work_type = WorkType.find_or_create_by(name: params[:work_type_name])\n params[:company_work_type][:work_type_id] = work_type.id \n if @company_work_type.update(company_work_type_params)\n format.html { redirect_to company_admin_company_work_types_url, notice: 'Company Work Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_work_type }\n else\n format.html { render :edit }\n format.json { render json: @company_work_type.errors, status: :unprocessable_entity }\n end\n else \n format.html { render :edit }\n format.json { render json: @company_work_type.errors, status: :unprocessable_entity } \n end \n end\n end", "def update\n @company_packaging_type = CompanyPackagingType.find(params[:id])\n\n respond_to do |format|\n if @company_packaging_type.update_attributes(params[:company_packaging_type])\n format.html { redirect_to @company_packaging_type, notice: 'Company packaging type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company_packaging_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tyc_company.update(tyc_company_params)\n format.html { redirect_to @tyc_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @tyc_company }\n else\n format.html { render :edit }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :json => {company: @company}, status: 200 }\n else\n format.json { render json: {errors: @company.errors}, status: 400 }\n end\n end\n end", "def update_company(id, model) path = \"/api/v2/companies/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n authorize! :update, CompetenceType\n @competence_type.update!(competence_type_params)\n render json: {status: :ok}\n end", "def update\n respond_to do |format|\n if @complaint_type.update(complaint_type_params)\n format.html { redirect_to complaint_types_url, notice: 'Complaint type was successfully updated.' }\n format.json { render :show, status: :ok, location: @complaint_type }\n else\n format.html { render :edit }\n format.json { render json: @complaint_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint_type = ComplaintType.find(params[:id])\n\n respond_to do |format|\n if @complaint_type.update_attributes(params[:complaint_type])\n format.html { redirect_to @complaint_type, notice: 'Complaint type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @complaint_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "def update\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n if @contractor_type.update_attributes(params[:contractor_type])\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opportunity_type.update(opportunity_type_params)\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(ContactType, params[:id], contact_type_params)\n end", "def update\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n if @opportunity_type.update_attributes(params[:opportunity_type])\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @carrier_type_has_checkout_type.update_attributes(params[:carrier_type_has_checkout_type])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.carrier_type_has_checkout_type'))\n format.html { redirect_to(@carrier_type_has_checkout_type) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @carrier_type_has_checkout_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @share_type.company = current_company\n respond_to do |format|\n if @share_type.update(share_type_params)\n format.html { redirect_to @share_type, notice: t('share_type.updated') }\n format.json { render :show, status: :ok, location: @share_type }\n else\n format.html { render :edit }\n format.json { render json: @share_type.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /company_types/1 DELETE /company_types/1.json
def destroy @company_type.destroy head :no_content end
[ "def destroy\n @company_type = CompanyType.find(params[:id])\n @company_type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_type.destroy\n respond_to do |format|\n format.html { redirect_to company_types_url, notice: 'Company type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_company_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_company.destroy\n respond_to do |format|\n format.html { redirect_to type_companies_url, notice: 'Type company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n \n render json: @company, status: :ok \n end", "def destroy\n @contractor_type = ContractorType.find(params[:id])\n @contractor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contractor_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_packaging_type = CompanyPackagingType.find(params[:id])\n @company_packaging_type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_packaging_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_company_status.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_company = Admin::Company.find(params[:id])\n @admin_company.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @complaint_type = ComplaintType.find(params[:id])\n @complaint_type.destroy\n\n respond_to do |format|\n format.html { redirect_to complaint_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @com_type.destroy\n respond_to do |format|\n format.html { redirect_to com_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tyc_company.destroy\n respond_to do |format|\n format.html { redirect_to tyc_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clienttype = Clienttype.find(params[:id])\n @clienttype.destroy\n\n respond_to do |format|\n format.html { redirect_to clienttypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @c_type.destroy\n respond_to do |format|\n format.html { redirect_to c_types_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /gltf_models GET /gltf_models.json
def index @gltf_models = GltfModel.all end
[ "def list_gadget_models\n get('gadgets/models')\n end", "def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetModelsResult\"].map{|r| Models::Model.from_response_hash(r)}\n end", "def get_models\n\t\tam = ErAppModel.where(er_user_app_id: @ua.id)\n\t\t@status = 200\n\t\t@res = am \n\t\trender json: @res , status: @status\t\t\t\n\tend", "def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end", "def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def load_model_info\n JSON.parse(RestClient.get(model_info_url))\n end", "def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end", "def api_models\n @resource_listing.models.select {|m| model_names_from_apis.include?(m.id)}\n end", "def list_models dataset_id, max: nil, token: nil\n options = { skip_deserialization: true }\n # The list operation is considered idempotent\n execute backoff: true do\n json_txt = service.list_models @project, dataset_id, max_results: max, page_token: token, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end", "def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end", "def get_model_files(options); end", "def list_models\n\t@models.each do |model|\n\t\tputs \"#{@models.index(model)}: #{model}\"\n\tend\nend", "def index\n @linear_models = LinearModel.all\n end", "def get(model_name, model_id = nil, options = {})\n url = rest_url(model_name, model_id) if get_option(options, \"filters\") == \"\"\n url = rest_url(model_name, nil, options[\"filters\"]) if get_option(options, \"filters\") != \"\"\n result = Rest.rest_call(url, \"get\", options)\n end", "def get_models(model_template)\n models = []\n get_data.fetch_all_objects(:model).each do\n |mc|\n models << mc if mc.template == model_template\n end\n models\n end", "def index\n @trainmodels = Trainmodel.all\n end", "def device_models(vendor)\n unless @config['use_local']\n return remote \"device/models/#{vendor}\", nil\n end\n\n if @device.local_models vendor\n @reply = @device.get_reply\n end\n\n set_error @device.get_status, @device.get_message\n end", "def models; Waves.application.models; end", "def index\n @node_models = NodeModel.all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /gltf_models POST /gltf_models.json
def create @gltf_model = GltfModel.new(gltf_model_params) respond_to do |format| if @gltf_model.save format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' } format.json { render :show, status: :created, location: @gltf_model } else format.html { render :new } format.json { render json: @gltf_model.errors, status: :unprocessable_entity } end end end
[ "def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'preconceito-nordeste'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :parameters => {'project' => PROJECT_ID},\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n puts result.inspect\n end", "def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end", "def add_bridge_model(body={}, headers=default_headers)\n info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end", "def predict(modelname, data)\n # set up a http request\n uri = URI(\"http://#{@base_uri}\")\n http = Net::HTTP.new(uri.host, uri.port)\n\n endpoint = URI::encode(\"/#{@username}/models/#{modelname}/\")\n request = Net::HTTP::Post.new(endpoint)\n request.add_field('Content-Type', 'application/json')\n request.basic_auth(@username, @apikey)\n\n # convert data to JSON\n begin\n request.body = data.to_json\n rescue\n raise \"Could not convert data to JSON\"\n end\n\n # send the request\n begin\n response = http.request(request)\n rescue\n raise \"Could not connect to host: #{@base_uri}\"\n end\n\n # return a response\n begin\n return JSON.parse(response.body)\n rescue\n raise \"Bad response from path: #{@base_uri}#{endpoint}\"\n end\n end", "def create\n @feature_model = FeatureModel.new(params[:feature_model])\n\n respond_to do |format|\n if @feature_model.save\n format.html { redirect_to @feature_model, :notice => 'Feature model was successfully created.' }\n format.json { render :json => @feature_model, :status => :created, :location => @feature_model }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(model_name, data, options = {})\n options[\"data\"] = data\n url = rest_url(model_name)\n result = Rest.rest_call(url, \"post\", options)\n result\n end", "def create\n @model = @project.models.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'The model was successfully created.' }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end", "def create(model_name, data, options = {})\n options[\"data\"] = data\n url = get_brpm_url(model_name)\n result = Rest.post(url, options)\n result\n end", "def create\n @orf_model = OrfModel.new(params[:orf_model])\n\n respond_to do |format|\n if @orf_model.save\n format.html { redirect_to @orf_model, notice: 'Orf model was successfully created.' }\n format.json { render json: @orf_model, status: :created, location: @orf_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orf_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mg_model = MgModel.new(mg_model_params)\n @mg_model.save\n redirect_to '/mg_models'\n\n end", "def createModel(model, trim, km, year, type, driveTrain, trans, id, status, fuel, features)\n @carModel = CarModel.new(model, trim, km, year, type, driveTrain, trans, id, status, fuel, features)\n self.model = model\n self.trim = trim\n self.km = km\n self.year = year\n self.type = type\n self.driveTrain = driveTrain\n self.trans = trans\n self.id = id\n self.status = status\n self.fuel = fuel\n self.features = features\n\n\n end", "def create\n @trainmodel = Trainmodel.new(trainmodel_params)\n\n respond_to do |format|\n if @trainmodel.save\n format.html { redirect_to @trainmodel, notice: 'Trainmodel was successfully created.' }\n format.json { render :show, status: :created, location: @trainmodel }\n else\n format.html { render :new }\n format.json { render json: @trainmodel.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @gltf_models = GltfModel.all\n end", "def create\n @vehicle_model = VehicleModel.new(params[:vehicle_model])\n\n respond_to do |format|\n if @vehicle_model.save\n format.html { redirect_to :action => \"index\", notice: 'Vehicle model was successfully created.' }\n format.json { render json: @vehicle_model, status: :created, location: @vehicle_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generic_model = GenericModel.new(generic_model_params)\n\n respond_to do |format|\n if @generic_model.save\n format.html { redirect_to @generic_model, notice: 'Generic model was successfully created.' }\n format.json { render :show, status: :created, location: @generic_model }\n else\n format.html { render :new }\n format.json { render json: @generic_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n get_list\n if params[:vehicle][:vehicle_type] == \"Shuttle\"\n params[:vehicle][:payload_weight] = nil\n end\n # engine = Engine.where(:id => params[:vehicle][:engine_id] )\n params[:vehicle][:v_identifier] = Vehicle.get_identifier\n @vehicle = Vehicle.new(params[:vehicle])\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to action: \"index\", notice: 'Vehicle was successfully created.' }\n format.json { render json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n render json: Tuning.create(tuning_params)\n end", "def generate_model\n\t\tclasses = CartesianClassifier.get_classes(Sample.find_all_by_classname(params[:classnames].split(',')))\n\t\tclassmodel = ClassModel.new({\n\t\t\t:classnames => params[:classnames], # split and join again for validation?\n\t\t\t:modelstring => ActiveSupport::JSON.encode(classes),\n\t\t\t:author => params[:author],\n\t\t\t:notes => params[:notes]\n\t\t})\n\t\tclassmodel.save\n\t\tredirect_to \"/\"\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /gltf_models/1 DELETE /gltf_models/1.json
def destroy @gltf_model.destroy respond_to do |format| format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @orf_model = OrfModel.find(params[:id])\n @orf_model.destroy\n\n respond_to do |format|\n format.html { redirect_to orf_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mg_model.destroy\n respond_to do |format|\n format.html { redirect_to mg_models_url, notice: 'Mg model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @linear_model.destroy\n respond_to do |format|\n format.html { redirect_to linear_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auto_model = AutoModel.find(params[:id])\n @auto_model.destroy\n\n respond_to do |format|\n format.html { redirect_to auto_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auto_model.destroy\n respond_to do |format|\n format.html { redirect_to auto_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_model = MyModel.find(params[:id])\n @my_model.destroy\n \n respond_to do |format|\n format.html { redirect_to my_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testmodel = Testmodel.find(params[:id])\n @testmodel.destroy\n\n respond_to do |format|\n format.html { redirect_to testmodels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oid_model.destroy\n respond_to do |format|\n format.html { redirect_to oid_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foo_model = FooModel.find(params[:id])\n @foo_model.destroy\n\n respond_to do |format|\n format.html { redirect_to foo_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_model = TestModel.find(params[:id])\n @test_model.destroy\n\n respond_to do |format|\n format.html { redirect_to test_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bmet_model.destroy\n respond_to do |format|\n format.html { redirect_to bmet_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generic_model.destroy\n respond_to do |format|\n format.html { redirect_to generic_models_url, notice: 'Generic model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fakemodel.destroy\n respond_to do |format|\n format.html { redirect_to fakemodels_url, notice: 'Fakemodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @onecolumnmodel = Onecolumnmodel.find(params[:id])\n @onecolumnmodel.destroy\n\n respond_to do |format|\n format.html { redirect_to onecolumnmodels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feature_model = FeatureModel.find(params[:id])\n @feature_model.destroy\n\n respond_to do |format|\n format.html { redirect_to feature_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mathematical_model = MathematicalModel.find(params[:id])\n @mathematical_model.destroy\n\n respond_to do |format|\n format.html { redirect_to mathematical_models_url }\n format.json { head :ok }\n end\n end", "def destroy\n @thermosta_model.destroy\n respond_to do |format|\n format.html { redirect_to thermosta_models_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format kyc Always receives [Hash] :NOTE Reading data to format from key:'user_kyc' Author: Tejas Date: 24/09/2018 Reviewed By: Sets result_type, user_kyc
def show(data_to_format) formatted_data = { result_type: 'user_kyc', user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin]) } formatted_data end
[ "def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end", "def fetch_user_kyc_details\n ar_relation = UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id, status: GlobalConstant::UserKycDetail.active_status)\n ar_relation = ar_relation.filter_by(@filters)\n ar_relation = ar_relation.sorting_by(@sortings)\n\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @user_kycs = ar_relation.limit(@page_size).offset(offset).all\n @total_filtered_kycs = ar_relation.count\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def user_summary(user)\n user_data = {}\n if user\n user_data[:disableSocialShare] = true if user.under_13?\n user_data[:lockableAuthorized] = user.teacher? ? user.authorized_teacher? : user.student_of_authorized_teacher?\n user_data[:isTeacher] = true if user.teacher?\n user_data[:isVerifiedTeacher] = true if user.authorized_teacher?\n user_data[:linesOfCode] = user.total_lines\n else\n user_data[:linesOfCode] = client_state.lines\n end\n user_data[:linesOfCodeText] = I18n.t('nav.popup.lines', lines: user_data[:linesOfCode])\n user_data\n end", "def validate_user_kyc\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).where(user_id: @user_id).first\n\n return error_with_data(\n 'am_u_du_2',\n 'User Data is mismatch. Kyc Details not found.',\n 'User Data is mismatch. Kyc Details not found.',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user.get_bits_set_for_properties.include?(GlobalConstant::User.kyc_submitted_property) && @user_kyc_detail.nil?\n\n return success if @user_kyc_detail.nil?\n\n return error_with_data(\n 'am_u_du_3',\n 'Kyc Case is closed.',\n 'Kyc Case is closed',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user_kyc_detail.case_closed?\n\n success\n end", "def formatted_cache_data\n {\n token_id: token_id,\n userUuids: user_uuid\n }\n end", "def map_to_row!(user_data)\n row_data = {}\n\n # Handle public_key vs. certificates\n if user_data.key?(:public_key)\n row_data[:pubkey_version] = 0\n row_data[:public_key] = user_data.delete(:public_key)\n else\n row_data[:pubkey_version] = 1\n row_data[:public_key] = user_data.delete(:certificate)\n end\n\n breakout_columns(user_data).each do |property_name|\n row_data[property_name] = user_data.delete(property_name) if user_data.key?(property_name)\n end\n\n row_data[:serialized_object] = as_json(user_data)\n row_data\n end", "def user_info_post\n unless @cloud_user.nil?\n user_info = {}\n user_info[:rhc_domain] = Rails.configuration.openshift[:domain_suffix]\n user_info[\"rhlogin\"] = @cloud_user.login\n user_info[\"uuid\"] = @cloud_user._id.to_s \n user_info[\"namespace\"] = @cloud_user.domains.first.namespace if @cloud_user.domains.count > 0\n\n #FIXME: This is redundant, for now keeping it for backward compatibility\n if @cloud_user.ssh_keys.length > 0\n key_info = @cloud_user.ssh_keys[0]\n user_info[\"ssh_key\"] = key_info['key']\n user_info[\"ssh_type\"] = key_info['type']\n else\n user_info[\"ssh_key\"] = \"\"\n user_info[\"ssh_type\"] = \"\"\n end\n \n user_info[\"ssh_keys\"] = {}\n @cloud_user.ssh_keys.each do |key|\n user_info[\"ssh_keys\"][key.name] = {type: key.type, key: key.content}\n end\n \n user_info[\"max_gears\"] = @cloud_user.max_gears\n user_info[\"consumed_gears\"] = @cloud_user.consumed_gears\n user_info[\"capabilities\"] = @cloud_user.get_capabilities\n \n # this is to support old version of client tools\n app_info = {}\n user_info[\"domains\"] = @cloud_user.domains.map do |domain|\n d_hash = {}\n d_hash[\"namespace\"] = domain.namespace\n\n domain.applications.each do |app|\n app_info[app.name] = {\n \"framework\" => \"\",\n \"creation_time\" => app.created_at,\n \"uuid\" => app._id.to_s,\n \"aliases\" => app.aliases,\n \"embedded\" => {}\n }\n\n app.requires(true).each do |feature|\n cart = CartridgeCache.find_cartridge(feature)\n if cart.categories.include? \"web_framework\"\n app_info[app.name][\"framework\"] = cart.name\n else\n app_info[app.name][\"embedded\"][cart.name] = {}\n end\n end\n end\n d_hash\n end\n \n log_action(@request_id, @cloud_user._id.to_s, @login, \"LEGACY_USER_INFO\", true, \"\", get_extra_log_args)\n @reply.data = {:user_info => user_info, :app_info => app_info}.to_json\n render :json => @reply\n else\n log_action(@request_id, \"nil\", @login, \"LEGACY_USER_INFO\", true, \"User not found\", get_extra_log_args)\n # Return a 404 to denote the user doesn't exist\n @reply.resultIO << \"User does not exist\"\n @reply.exitcode = 99\n \n render :json => @reply, :status => :not_found\n end\n end", "def print_user(user)\n puts \"Name: #{user['name']}\"\n puts \"E-mail: #{user['email']}\"\n puts \"Company: #{user['company']}\"\n puts \"Number of public repos: #{user['public_repos']}\"\nend", "def format_data(data, private_allowed)\n # Store all formatted data in this array\n formatted_data = []\n\n # Format name with flags\n # Name Mark Diez (student, employee, staff)\n # IAM ID 1234566\n if !data[\"basic_info\"].empty?\n data[\"basic_info\"].each do |info|\n name = \"*Name* \" + info[\"dFullName\"]\n\n flags = []\n if info[\"isEmployee\"]\n flags.push \"employee\"\n end\n if info[\"isHSEmployee\"]\n flags.push \"hs employee\"\n end\n if info[\"isFaculty\"]\n flags.push \"faculty\"\n end\n if info[\"isStudent\"]\n flags.push \"student\"\n end\n if info[\"isStaff\"]\n flags.push \"staff\"\n end\n if info[\"isExternal\"]\n flags.push \"external\"\n end\n flags = \" _(\" + flags.join(\", \") + \")_\"\n name += flags\n\n formatted_data.push name\n formatted_data.push \"*IAM ID* #{info[\"iamId\"]}\"\n if private_allowed\n formatted_data.push \"*Student ID* #{info[\"studentId\"]}\" unless info[\"studentId\"] == nil\n formatted_data.push \"*PPS ID* #{info[\"ppsId\"]}\" unless info[\"ppsId\"] == nil\n end\n end\n end\n\n # Format Kerberos information\n # Login ID msdiez, anotherid, ...\n if !data[\"kerberos_info\"].empty?\n ids = []\n data[\"kerberos_info\"].each do |info|\n id = info[\"userId\"] == nil ? \"Not Listed\" : info[\"userId\"]\n ids.push id\n end\n\n formatted_data.push \"*Login ID* \" + ids.join(\", \")\n else\n login_id = \"*Login ID* Not Listed\"\n formatted_data.push login_id\n end\n\n\n # Format contact information\n # E-mail my@email.com, my@otheremail.com\n # Office kerr 186, social science 133, ...\n if !data[\"contact_info\"].empty?\n email = []\n office = []\n data[\"contact_info\"].each do |info|\n email.push info[\"email\"] unless info[\"email\"] == nil\n office.push info[\"addrStreet\"] unless info[\"addrStreet\"] == nil\n end\n formatted_data.push \"*E-mail* \" + email.join(\", \")\n formatted_data.push \"*Office* \" + office.join(\", \")\n else\n formatted_data.push \"*E-mail* Not Listed\"\n formatted_data.push \"*Office* Not Listed\"\n end\n\n # Format ODR information\n # ODR Affiliation DSSIT: STD4 (Casual)\n require 'pp'\n pp data\n if !data['odr_info'].empty?\n data['odr_info'].each do |info|\n odr = '*ODR Affiliation* '\n odr += info['deptDisplayName'] + ': ' unless info['deptDisplayName'].nil?\n odr += info['titleDisplayName'] unless info['titleDisplayName'].nil?\n\n formatted_data.push odr\n end\n end\n\n # Format PPS information\n # PPS Affiliation DSSIT: STD4\n if !data['pps_info'].empty?\n data['pps_info'].each do |info|\n dept_name = info['deptDisplayName'] || 'Unknown Department'\n dept_code = info['deptCode'] || 'Unknown Department Code'\n title_name = info['titleDisplayName'] || 'Unknown Title'\n title_code = info['titleCode'] || 'Unknown Title Code'\n position_type = info['positionType'] || 'Unknown Position Type'\n employee_class = info['emplClassDesc'] || 'Unknown Employee Class'\n\n formatted_data.push \"*PPS Affiliation*\"\n formatted_data.push \" Department: #{dept_name} (#{dept_code})\"\n formatted_data.push \" Title: #{title_name} (#{title_code}) (#{position_type})\"\n formatted_data.push \" Employee Class: #{employee_class}\"\n end\n end\n\n # Format student information\n # Student Affiliation Computer Science (Undergraduate, Junior)\n if !data['student_info'].empty?\n data['student_info'].each do |info|\n student = '*Student Affiliation* '\n student += info['majorName'] + ' ('\n student += info['levelName'].scan(/\\S+/)[0] # Only grab the first word\n student += ', ' + info['className'] + ')'\n\n formatted_data.push student\n end\n end\n\n return formatted_data.join(\"\\n\")\n end", "def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_identifier('resource_not_found',\n 'um_kd_g_fukd_1'\n ) if (@user_kyc_detail.blank? || (@user_kyc_detail.status != GlobalConstant::UserKycDetail.active_status) ||\n (@user_kyc_detail.client_id != @client_id))\n\n success\n end", "def load_user_info\n\t\tif @user_info.has_key?(@@line_array[0].to_i)\n\t\t\t@user_info[@@line_array[0].to_i][@@line_array[1].to_i] = @@line_array[2].to_i\n\t\telse\n\t\t\t@user_info[@@line_array[0].to_i] = {@@line_array[1].to_i => @@line_array[2].to_i}\n\t\tend\n\tend", "def format_duplicate_data\n @duplicate_kycs.each do |_, kyc_data|\n\n kyc_data[GlobalConstant::UserKycDuplicationLog.active_status.to_sym] =\n kyc_data[GlobalConstant::UserKycDuplicationLog.active_status.to_sym].map {|x| x.humanize}\n\n kyc_data[GlobalConstant::UserKycDuplicationLog.inactive_status.to_sym] =\n kyc_data[GlobalConstant::UserKycDuplicationLog.inactive_status.to_sym].map {|x| x.humanize}\n end\n end", "def email_kyc_report_issue(data_to_format)\n {}\n end", "def fetch_and_validate_user_kyc_detail\n\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n return error_with_identifier('resource_not_found',\n 'um_k_g_favukd_1'\n )if (@user_kyc_detail.blank? || (@user_kyc_detail.status != GlobalConstant::UserKycDetail.active_status) ||\n (@user_kyc_detail.client_id != @client_id))\n\n\n success\n end", "def ec2_user_data(key = '', default = '')\n ec2_fetch_user_data_str\n @user_data = parse_user_data_str(@user_data_str) if !@user_data\n\n if @user_data[key]\n return @user_data[key]\n else\n return default\n end\n end", "def fetch_and_validate_user_kyc_detail\n user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_identifier('kyc_not_denied',\n 'um_se_d_favukd_1'\n ) if (user_kyc_detail.blank? || (user_kyc_detail.client_id != @client_id)) || !(user_kyc_detail.kyc_denied?)\n\n success\n end", "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def get_duplicate_kyc_data\n return unless @user_kyc_detail.show_duplicate_status\n\n duplicate_with_users = []\n\n duplicate_with_users += UserKycDuplicationLog.using_client_shard(client: @client).\n non_deleted.where(user1_id: @user_kyc_detail.user_id, user_extended_details1_id: @user_kyc_detail.user_extended_detail_id)\n .order('status ASC, id DESC').limit(100).all\n\n duplicate_with_users += UserKycDuplicationLog.using_client_shard(client: @client).\n non_deleted.where(user2_id: @user_kyc_detail.user_id, user_extended_details2_id: @user_kyc_detail.user_extended_detail_id)\n .order('status ASC, id DESC').limit(100).all\n\n duplicate_with_users.each do |duplicate|\n duplicate_with_uid = (duplicate.user1_id == @user_kyc_detail.user_id) ? duplicate.user2_id : duplicate.user1_id\n @duplicate_kycs[duplicate_with_uid] ||= {\n GlobalConstant::UserKycDuplicationLog.active_status.to_sym => [],\n GlobalConstant::UserKycDuplicationLog.inactive_status.to_sym => []\n }\n if @duplicate_kycs[duplicate_with_uid][duplicate.status.to_sym].exclude?(duplicate.duplicate_type)\n @duplicate_kycs[duplicate_with_uid][duplicate.status.to_sym] << duplicate.duplicate_type\n end\n end\n\n UserKycDetail.using_client_shard(client: @client).\n active_kyc.where(client_id: @client_id, user_id: @duplicate_kycs.keys).each do |u_k_d|\n if u_k_d.inactive_status?\n @duplicate_kycs.delete(u_k_d.user_id)\n next\n end\n @duplicate_kycs[u_k_d.user_id][:id] = u_k_d.id\n @duplicate_kycs[u_k_d.user_id][:admin_status] = u_k_d.admin_status\n @duplicate_kycs[u_k_d.user_id][:aml_status] = u_k_d.aml_status\n end\n\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By:
def get_pre_singed_url_for_put(data_to_format) formatted_data = { result_type: 'file_upload_put', file_upload_put: data_to_format } formatted_data end
[ "def get_presigned_url_put(custom_params = nil)\n\n default_val = {\n files: {\n selfie: 'image/jpeg'\n }\n }\n endpoint = \"/api/#{@version}/users-kyc/pre-signed-urls/for-put\"\n\n custom_params = custom_params || default_val\n params = request_parameters(endpoint, custom_params)\n get(params)\n end", "def presigned_upload_url\n filename = signed_url_params # First param is filename\n resource = Aws::S3::Resource.new(client: @s3_client)\n bucket = resource.bucket(Rails.application.credentials.aws[:bucket])\n\n object_key = \"#{filename.split(\".\")[0]}-#{SecureRandom.uuid}.#{filename.split(\".\")[1]}\"\n obj = bucket.object(object_key)\n url = obj.presigned_url(:put)\n render json: { presigned_url: url, object_key: object_key }\n\n rescue NameError\n render json: { error: \"Failed to get presigned URL\" }\n end", "def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end", "def get_presigned_url_put(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/pre-signed-urls/for-put\", params)\n end", "def merritt_presign_info_url\n raise 'Filename may not be blank when creating presigned URL' if upload_file_name.blank?\n\n # The gsub below ensures and number signs get double-encoded because otherwise Merritt cuts them off early.\n # We can remove the workaround if it changes in Merritt at some point in the future.\n\n domain, local_id = resource.merritt_protodomain_and_local_id\n\n if upload_file_name.include?('#')\n # Merritt needs the components double-encoded when there is a '#' in the filename\n \"#{domain}/api/presign-file/#{ERB::Util.url_encode(local_id)}/#{resource.stash_version.merritt_version}/\" \\\n \"producer%252F#{ERB::Util.url_encode(ERB::Util.url_encode(upload_file_name))}?no_redirect=true\"\n else\n \"#{domain}/api/presign-file/#{local_id}/#{resource.stash_version.merritt_version}/\" \\\n \"producer%2F#{ERB::Util.url_encode(upload_file_name)}?no_redirect=true\"\n end\n end", "def merritt_presign_info_url\n raise 'Filename may not be blank when creating presigned URL' if upload_file_name.blank?\n\n # The gsub below ensures and number signs get double-encoded because otherwise Merritt cuts them off early.\n # We can remove the workaround if it changes in Merritt at some point in the future.\n\n domain, local_id = resource.merritt_protodomain_and_local_id\n \"#{domain}/api/presign-file/#{local_id}/#{resource.stash_version.merritt_version}/\" \\\n \"producer%2F#{ERB::Util.url_encode(upload_file_name.gsub('#', '%23'))}?no_redirect=true\"\n end", "def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:); end", "def get_url(content_type, key)\n # puts \"key : #{key}\"\n url = Aws::S3Manager.new('kyc', 'user').get_presigned_put_url_for(\n key, GlobalConstant::Aws::Common.kyc_bucket, content_type)\n\n {\n url: url,\n fields: {key: key}\n }\n end", "def upload_file(bucket, key, data)\r\n bucket.put(key, data)\r\nend", "def upload_url_for(identifier, content_type)\n get(identifier).presigned_url :put, key: key(identifier), acl: \"public-read\", content_type: content_type\n end", "def object_uploaded_to_presigned_url?(\n s3_resource,\n bucket_name,\n object_key,\n object_content,\n http_client = nil\n)\n object = s3_resource.bucket(bucket_name).object(object_key)\n url = URI.parse(object.presigned_url(:put))\n\n if http_client.nil?\n Net::HTTP.start(url.host) do |http|\n http.send_request(\n 'PUT',\n url.request_uri,\n object_content,\n 'content-type' => ''\n )\n end\n else\n http_client.start(url.host) do |http|\n http.send_request(\n 'PUT',\n url.request_uri,\n object_content,\n 'content-type' => ''\n )\n end\n end\n content = object.get.body\n puts \"The presigned URL for the object '#{object_key}' in the bucket \" \\\n \"'#{bucket_name}' is:\\n\\n\"\n puts url\n puts \"\\nUsing this presigned URL to get the content that \" \\\n \"was just uploaded to this object, the object\\'s content is:\\n\\n\"\n puts content.read\n return true\nrescue StandardError => e\n puts \"Error uploading to presigned URL: #{e.message}\"\n return false\nend", "def upload_params(prefix, opts={})\n return if prefix.blank?\n\n expires = (opts[:expires] || 30.minutes).from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')\n bucket = AmazonHelper.bucket\n acl = (opts[:public] == true) ? 'public-read' : 'private'\n max_filesize = opts[:max_filesize] || 200.megabyte\n\n policy = Base64.encode64(\n \"{'expiration': '#{expires}',\n 'conditions': [\n {'bucket': '#{bucket}'},\n ['starts-with', '$key', '#{prefix}'],\n {'acl': '#{acl}'},\n {'success_action_status': '201'},\n ['content-length-range', 0, #{max_filesize}]\n ]\n }\").gsub(/\\n|\\r/, '')\n\n signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_key,\n policy)\n ).gsub(\"\\n\",\"\")\n\n {\n :key => \"#{prefix}/${filename}\",\n :acl => acl,\n :policy => policy,\n :signature => signature,\n :AWSAccessKeyId => access_key,\n :success_action_status => 201\n }\n end", "def upload_signature\n\n upload_sign =\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n Config.secret_access_key,\n policy_document\n )\n ).gsub(/\\n/, '')\n end", "def temp_upload_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)\n private_url(\"PUT\", object_key, temp_url_key, expires_at)\n end", "def upload_to_s3(json)\n p json\nend", "def public_url(options = {})\n url = URI.parse(bucket.url(options))\n url.path += '/' unless url.path[-1] == '/'\n url.path += key.gsub(/[^\\/]+/) { |s| Seahorse::Util.uri_escape(s) }\n url.to_s\n end", "def signed_url url:, key_name:, key:, expiration:\n # url = \"URL of the endpoint served by Cloud CDN\"\n # key_name = \"Name of the signing key added to the Google Cloud Storage bucket or service\"\n # key = \"Signing key as urlsafe base64 encoded string\"\n # expiration = Ruby Time object with expiration time\n\n require \"base64\"\n require \"openssl\"\n require \"time\"\n\n # Decode the URL safe base64 encode key\n decoded_key = Base64.urlsafe_decode64 key\n\n # Get UTC time in seconds\n expiration_utc = expiration.utc.to_i\n\n # Determine which separator makes sense given a URL\n separator = \"?\"\n separator = \"&\" if url.include? \"?\"\n\n # Concatenate url with expected query parameters Expires and KeyName\n url = \"#{url}#{separator}Expires=#{expiration_utc}&KeyName=#{key_name}\"\n\n # Sign the url using the key and url safe base64 encode the signature\n signature = OpenSSL::HMAC.digest \"SHA1\", decoded_key, url\n encoded_signature = Base64.urlsafe_encode64 signature\n\n # Concatenate the URL and encoded signature\n signed_url = \"#{url}&Signature=#{encoded_signature}\"\nend", "def upload_url\n upload_url_response['p']\n end", "def quick_s3_upload\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Admin Name Author: Tejas Date: 24/09/2018 Reviewed By:
def admin_name(last_acted_by, admin) last_acted_by = last_acted_by.to_i if (last_acted_by > 0) admin[:name] elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID) GlobalConstant::Admin.auto_approved_admin_name else '' end end
[ "def display_name\n [nomenclator_name, author_year].compact.join(\" \")\n end", "def author\n @info[:Author]\n end", "def aname\n\t\t\"[name(#{@author})]\"\n\tend", "def admin_name\n self.user.name\n end", "def author_name\n if is_news?\n if authors_is_created_by?\n created_by.try(:name)\n else\n authors\n end\n else\n created_by.present? ? created_by.name : authors\n end\n end", "def author_name\n \"#{author.last_name}, #{author.first_name}\"\n end", "def author_name\n return \"\" if contents.empty?\n contents.first.author_name\n end", "def author_name\n user_data.name || login\n end", "def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end", "def author_full_name\n self.author.full_name\n end", "def blog_author_name(author)\n \"#{author.firstname} #{author.prefix} #{author.lastname}\"\n end", "def authors_for_taxon_name\n s = ''\n as = self.auths\n \n if as.empty? # check if the old (DEPRECATED) author field is being used\n s += author if author\n s += (', ' + year.to_s) if year\n return s if s.size > 0 \n return nil # don't change\n else\n \n case as.size\n when 0\n # do nothing\n when 1\n s = as.first.last_name\n when 2 # could likely be merged with below\n s = as.first.last_name + \" and \" + as[1].last_name # weird, as.last broken in Rails 2.1\n else\n s = as[0..(as.size - 1)].collect{|o| o.last_name}.join(\", \") + \", and \" + as.last.last_name\n end \n s += \", #{year}\" if year\n end\n s\n end", "def get_author_name(author)\n author_object = Author.find_by_var(\"authors\", \"id\", author) \n # => one Author Obj\n @author_name = author_object.name\n \n end", "def get_author_name(options = {})\n if(self.author_id && (!options || !options[:force_cataloguer]) && (u = User.find(self.author_id)))\n n = u.name\n n += \" (\" + u.email + \")\" if(!options || !options[:omit_email])\n return n\n end\n if (self.user_id)\n u = User.find(self.user_id)\n n = u.name\n n += \" (\" + u.email + \")\" if(!options || !options[:omit_email])\n return n\n end\n \"\"\n end", "def author\n @author || 'Unknown'\n end", "def author_name\n if self.author\n self.author.name\n else\n nil\n end\n end", "def get_autor\n\t\t\t@autor\n\t\tend", "def display_author\n return 'Anonymous' if author.blank?\n\n author.name || author.email\n end", "def get_author_and_source_name\n ret = get_author_name_or_blank\n ret += \", \" unless ret.blank? or self.source.blank?\n ret += self.source unless self.source.blank?\n ret\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get response for sending KYC approve email Author: Mayur Date: 03/12/2018 Reviewed By:
def email_kyc_approve(data_to_format) {} end
[ "def email_kyc_approve\n @service_response = UserManagement::SendEmail::Approve.new(params).perform\n format_service_response\n end", "def key_approved_msg(user, user_key)\n @recipient = user\n @user_key = user_key\n mail(:to => @recipient.email, \n :subject => \"The Bridge API Notice: Your #{@user_key.name} Key Application Has Been Approved!\")\n\n end", "def request_approver(user, agency, client, code)\n \n recipients user.email\n subject \"New request to become approver for #{agency.name}\"\n body[:user] = user\n body[:agency] = agency\n body[:client] = client\n body[:url] = \"#{SITE}/approver_request/#{code}\"\n headers \"Reply-to\" => \"#{OUTGOING_EMAIL_ADDRESS}\"\n from \"ClockOff.com <#{OUTGOING_EMAIL_ADDRESS}>\"\n sent_on Time.now\n content_type 'text/html'\n\n end", "def send_kyc_approved_mail\n\n return if !@client.is_email_setup_done? || @client.is_st_token_sale_client? || ! @client.client_kyc_config_detail.auto_send_kyc_approve_email?\n\n #\n # return if (KycWhitelistLog.where(client_id: @client_id, ethereum_address: @ethereum_address, status:\n # [GlobalConstant::KycWhitelistLog.done_status, GlobalConstant::KycWhitelistLog.confirmed_status]).count > 1)\n\n send_kyc_approved_mail_via_hooks\n end", "def approve\n email = Email.find(params[:id])\n email.state = \"Approved\"\n # Send email\n if email.save!\n email.send_email!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end", "def email_approve(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/approve\", params)\n end", "def send_approval_email\n # person.send_email(:proposal_approved, proposal: self)\n end", "def send_pre_approval_email\n begin\n event = self.event\n if self.status == 'approve'\n status_string = 'Approved'\n elsif self.status == 'rejected'\n status_string = 'Not Approved'\n else\n status_string = ''\n end\n subject = \"Application ##{self.reg_ref_number} #{status_string} for event - #{event.event_name_with_location}.\"\n sadhak_emails = self.event_order_line_items.collect{|item| item.try(:sadhak_profile).try(:email)}\n begin\n from = GetSenderEmail.call(event)\n ApplicationMailer.send_email(from: from, recipients: self.guest_email, cc: sadhak_emails, subject: subject, template: 'pre_approval_email', event_order: self, event: event).deliver\n rescue => e\n logger.info(\"EventOrder: send_pre_approval_email, Error occured while sending: #{e.message}\")\n Rollbar.error(e)\n end\n rescue => e\n logger.info(\"Error in sending pre-approval application confirmation or rejection email: error: #{e.message}\")\n Rollbar.error(e)\n end\n end", "def approved?\n approval_response == 'approved'\n end", "def approval_user\n target_user = User.find(params[:user_id])\n approval_status = params[:approved].blank? ? User::ApprovalStatusReject : User::ApprovalStatusApproved\n comment = params[:comment]\n # unless target_user.approval_status == User::ApprovalStatusApproved\n target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n\n # if target_user.approval_status == User::ApprovalStatusApproved\n # if target_user.company_buyer_entities.any?{ |x| x.approval_status == CompanyBuyerEntity::ApprovalStatusPending}\n # target_user.update(comment: comment, approval_date_time: DateTime.current)\n # else\n # target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n # end\n\n if approval_status == User::ApprovalStatusApproved\n UserMailer.approval_email(target_user).deliver_later\n elsif approval_status == User::ApprovalStatusReject\n UserMailer.reject_email(target_user).deliver_later\n end\n result_json = {user_base_info: target_user}\n result_json\n end", "def ticket_approved\n @task = params[:task]\n @task_type = @task.task_type\n @user = User.find_by_id(@task.created_by_id)\n @url = task_url(@task)\n mail(to: @user.email, subject: \"Your Ticket ##{@task.id} has Been Approved\")\n end", "def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"consigndotnyc@gmail.com\", :subject => \"New Review on CONSIGN.NYC\")\n end", "def approval_header\n if approved\n \"Ogłoszenie zostało zaakceptowane\"\n elsif pending\n \"Stworzyłeś ogłoszenie swojego klanu!\"\n elsif declined\n \"Ogłoszenie Twojego klanu zostało odrzucone.\"\n end\n end", "def approve\n respond_to do |format|\n if @version.approve!(current_user)\n UserMailer.approval_notification(current_user, @version.versionable.node, @version.editor, params[:comment], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end", "def auto_approve_type\n 'auto'\n end", "def my_new_approval(approval)\n @approval = approval\n @owner = @approval.user\n @name = @owner.name\n @email = @owner.email\n @subject = sanitize(\"#{@approval.title} has been sent out for approval\")\n mail(to: @email, subject: @subject)\n end", "def getapprovalcode()\r\n return getvalue(SVTags::APPROVAL_CODE)\r\n end", "def approval(user, company)\n @subject = \"#{user.name} is authorized to trade at Foodmoves.com\"\n @body = {:user => user,\n :company => company}\n @recipients = user.email\n @bcc = @@bcc\n @from = 'Foodmoves Support <support@foodmoves.com>'\n @sent_on = Time.now\n end", "def email_kyc_deny\n @service_response = UserManagement::SendEmail::Deny.new(params).perform\n format_service_response\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get response for sending KYC report issue email Author: Mayur Date: 14/12/2018 Reviewed By:
def email_kyc_report_issue(data_to_format) {} end
[ "def email_kyc_issue\n service_response = AdminManagement::Kyc::AdminAction::ReportIssue.new(params).perform\n render_api_response(service_response)\n end", "def email_kyc_report_issue\n @service_response = UserManagement::SendEmail::ReportIssue.new(params).perform\n format_service_response\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def email_report_issue(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/report-issue\", params)\n end", "def send_open_case_request_outcome_email\n user_email = User.using_client_shard(client: @client).get_from_memcache(@user_kyc_detail.user_id).email\n template_variables = {\n email: user_email,\n success: 1,\n reason_failure: \"\",\n case_id: @user_kyc_detail.id\n }\n\n admin_emails = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_detail.client_id,\n GlobalConstant::Admin.open_case_request_outcome_notification_type\n )\n\n admin_emails << @admin.email unless admin_emails.include?(@admin.email)\n\n admin_emails.each do |admin_email|\n ::Email::HookCreator::SendTransactionalMail.new(\n client_id: ::Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: ::GlobalConstant::PepoCampaigns.open_case_request_outcome_template,\n template_vars: template_variables\n ).perform\n\n end\n\n\n end", "def sales_email(feedback)\n #@project = ClientProjectDetail.find params[:client_project_detail_id]\n @feedback =Feedback.find(feedback)\n @project_id = @feedback.client_project_detail_id\n @emp_id = ClientProjectDetail.find(@project_id).sales_id\n @user = User.find(@emp_id).first_name\n @user_email = User.find(@emp_id).email\n @user_name = feedback.user\n mail(to: @user_email, subject: \"Feedback\")\n end", "def send_email\n question = Question.find(params[:qid])\n answer = Answer.where(question_id: params[:qid], report_id: params[:id]).first\n report = Report.find(params[:id])\n project = report.project\n category = question.category\n to = params[:email]\n\n id = params[:id]\n aa = UserMailer.send_incident_report(current_user,question.body,project.name,category.name,answer,to).deliver\n # flash[:success] = \"Email sent successfully.\"\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render json: :true }\n end\n end", "def employee_email(feedback)\n #@project = ClientProjectDetail.find params[:client_project_detail_id]\n @feedback =Feedback.find(feedback)\n @project_id = @feedback.client_project_detail_id\n @emp_id = ClientProjectDetail.find(@project_id).employee_id\n @user = User.find(@emp_id).first_name\n @user_email = User.find(@emp_id).email\n @user_name = feedback.user\n mail(to: @user_email, subject: \"Feedback\")\n end", "def get_Email()\n \t return @outputs[\"Email\"]\n \tend", "def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end", "def email(defn, _participant, assignment)\n defn[:body][:type] = 'Author Feedback'\n # reviewee is a response, reviewer is a participant\n # we need to track back to find the original reviewer on whose work the author comments\n response_id_for_original_feedback = reviewed_object_id\n response_for_original_feedback = Response.find response_id_for_original_feedback\n response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id\n original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id\n\n participant = AssignmentParticipant.find(original_reviewer_participant_id)\n\n defn[:body][:obj_name] = assignment.name\n\n user = User.find(participant.user_id)\n\n defn[:to] = user.email\n defn[:body][:first_name] = user.fullname\n Mailer.sync_message(defn).deliver\n end", "def send_comment_to_assigned_to_for_status(post,user,issue)\n setup_email(user)\n @post = post\n @user = user\n @issue = issue\n @subject += \"BUGZ: Issue status has been updated\"\n @from = \"team@lionsher.com\"\n# @body[:url] = \"http://bugz.kernlearning.com/issues/show/#{@issue.id}\" # on staging\n @body[:url] = \"http://#{SITE_URL}/issues/show/#{@issue.id}\"\n content_type \"text/html\"\n end", "def customer_demo_request(current_user, company, comment)\n @user = current_user\n @company = company\n bcc = \"Harshal Katre <harshal@profitbooks.net>, Samatha <samatha@profitbooks.net>, Ravi Rana <ravi@profitbooks.net>, Mohit Mogha <mohit@profitbooks.net>, Naveen <naveen@profitbooks.net>\"\n @feedback = \"Feedback provided:\n #{comment}.\" unless comment.blank?\n mail(:to => \"support@profitbooks.net\",:from => \"support@profitbooks.net\", :subject => \"#{@user.full_name} has requested for demo.\",:reply_to => \"support@profitbooks.net\")\n end", "def key_approved_msg(user, user_key)\n @recipient = user\n @user_key = user_key\n mail(:to => @recipient.email, \n :subject => \"The Bridge API Notice: Your #{@user_key.name} Key Application Has Been Approved!\")\n\n end", "def emailResults()\n obj = EmailHelper.new()\n emailSubject = \"Illumina Capture Stats : Flowcell \" + @fcBarcode.to_s\n emailFrom = \"sol-pipe@bcm.edu\" \n emailText = @captureResults.formatForSTDOUT()\n emailTo = obj.getCaptureResultRecepientEmailList()\n\n begin\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n rescue Exception => e\n puts e.message \n puts e.backtrace.inspect\n end\n end", "def invitation_request_reply(user)\n @given_hostname = ActionMailer::Base.default_url_options[:host]\n mail(:to => user.email, :subject => I18n.t(\"invitation_request_mail.subject\"))\n headers['X-MC-GoogleAnalytics'] = \"XXX\"\n headers['X-MC-Tags'] = \"invitreqrep\"\n end", "def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid e-mail output!\")\n return\n end\n $logger.debug(\"The output for job_code #{jmd.job_code} does have valid e-mail output! See the rails log for details\")\n body = match[1]\n #get the subject from the body\n match = Regexp.new('SUBJECT:(.*)').match(body)\n subject = match[1] unless match.nil?\n body.sub!(\"SUBJECT:#{subject}\",'')#append on subject\n subject = $application_properties['service_subject'] + \" \" + subject if jlh.has_key?(:service)\n subject = subject + ' -- REMINDER ' + @reminder_hash[jmd.job_code].to_s if (jlh[:reminder_email])\n body.chomp!.reverse!.chomp!.reverse! unless jmd.email_content_type.eql?('text/html')\n from = $application_properties['PST_Team']\n content_type = jmd.email_content_type\n recipients = []\n cc = []# or should it be ''?\n #banana slug\n #integrate with escalation levels to get additional e-mails out of the escalation\n recipients = jlh[:email_to] if jlh.has_key?(:email_to)\n cc = jlh[:email_cc] if jlh.has_key?(:email_cc)\n\n if (jmd.track_status_change && jmd.email_on_status_change_only)\n esc = jle.get_escalation\n esc = JobLogEntry.before(jle).status_not(\"UNKNOWN\").limit(1).first.get_escalation if esc.nil? #if this is nil this jle is green\n\n if ! esc.nil? #this is added in the event that the alert has never been red and we are in this method because we are executing as a service\n esc_emails = esc.get_escalation_based_emails\n recipients = recipients | esc_emails[0]\n cc = cc | esc_emails[1]\n end\n end\n\n recipients = recipients.uniq.join(',')\n cc = cc.uniq.join(',')\n\n email_hash = {:request => jmd.job_code, :content_type => content_type, :subject=>subject,\n :recipients=>recipients, :from=>from, :cc=>cc,:body=>body,\n :incl_attachment=>jmd.incl_attachment,:attachment_path=>jmd.attachment_path,\n :jmd => jmd, :jle => jle}\n\n JobMailer.job_result(email_hash).deliver\n end", "def send_risk_status_update_email(risk)\n @risk = risk\n @broker = risk.broker_acct\n\n headers['X-SMTPAPI'] = {\n category: 'Risk Status Update'\n }.to_json\n\n mail( to: @broker.email, subject: 'One of your risks has been updated' )\n end", "def email_action_notification(email_string, subject, body, survey_response_id)\n @survey_response = SurveyResponse.find(survey_response_id)\n @msg = body\n\n mail(:to => email_string, :subject => subject)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /brite_td_aswaxman_rt_waxmen GET /brite_td_aswaxman_rt_waxmen.json
def index @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all end
[ "def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end", "def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end", "def index\n @brite_as_waxmen = BriteAsWaxman.all\n end", "def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end", "def index\n @wydarzenies = Wydarzenie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wydarzenies }\n end\n end", "def index\n @tenures = Tenure.all\n render json: @tenures\n end", "def index\n @wisdom_mods = WisdomMod.all\n\n render json: @wisdom_mods\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def show\n @moretinymobbattle = Moretinymobbattle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moretinymobbattle }\n end\n end", "def index\n @waivers = Waiver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waivers }\n end\n end", "def index\n @api_wmall_malls = Api::Wmall::Mall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_wmall_malls }\n end\n end", "def index\n @bleats = Bleat.desc(:created_at)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bleats }\n end\n end", "def index\n @wombats = Wombat.all\n end", "def index\n @brite_rt_barabasis = BriteRtBarabasi.all\n end", "def index\n @wbr_data = WbrDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wbr_data }\n end\n end", "def index\n @page_header = \"Списания со счета абонентов\"\n @abonent_debits = AbonentDebit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @abonent_debits }\n end\n end", "def index\n @tuantis = Tuanti.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tuantis }\n end\n end", "def index\n @nights = Night.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nights }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /brite_td_aswaxman_rt_waxmen POST /brite_td_aswaxman_rt_waxmen.json
def create @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.new(brite_td_aswaxman_rt_waxman_params) respond_to do |format| if @brite_td_aswaxman_rt_waxman.save format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully created.' } format.json { render :show, status: :created, location: @brite_td_aswaxman_rt_waxman } else format.html { render :new } format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity } end end end
[ "def create\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.new(brite_td_asbarabasi_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.save\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brite_rt_waxman = BriteRtWaxman.new(brite_rt_waxman_params)\n\n respond_to do |format|\n if @brite_rt_waxman.save\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brite_as_waxman = BriteAsWaxman.new(brite_as_waxman_params)\n\n respond_to do |format|\n if @brite_as_waxman.save\n format.html { redirect_to @brite_as_waxman, notice: 'Brite as waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_as_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_as_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all\n end", "def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end", "def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end", "def update\n respond_to do |format|\n if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params)\n format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.update(brite_td_asbarabasi_rt_waxman_params)\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wombat = Wombat.new(wombat_params)\n\n respond_to do |format|\n if @wombat.save\n format.html { redirect_to @wombat, notice: 'Wombat was successfully created.' }\n format.json { render :show, status: :created, location: @wombat }\n else\n format.html { render :new }\n format.json { render json: @wombat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @thema = Thema.new(params[:thema])\n \n @themen = @thema.themengruppe.themen.order(:priority).reverse\n respond_to do |format|\n if @thema.save\n format.html { redirect_to @thema, notice: 'Thema was successfully created.' }\n format.json { render json: @thema, status: :created, location: @thema }\n format.js {render action: \"update\"}\n else\n format.html { render action: \"new\" }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n format.js { render action: \"edit\" }\n end\n end\n end", "def create\n @brite_rt_barabasis = BriteRtBarabasi.new(brite_rt_barabasis_params)\n\n respond_to do |format|\n if @brite_rt_barabasis.save\n format.html { redirect_to @brite_rt_barabasis, notice: 'Brite rt barabasi was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_barabasis }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_barabasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mfnw = Mfnw.new(params[:mfnw])\n\n respond_to do |format|\n if @mfnw.save\n format.html { redirect_to @mfnw, notice: 'Mfnw was successfully created.' }\n format.json { render json: @mfnw, status: :created, location: @mfnw }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mfnw.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bewertung = Bewertung.new(params[:bewertung])\n\n respond_to do |format|\n if @bewertung.save\n format.html { redirect_to @bewertung, notice: 'Bewertung was successfully created.' }\n format.json { render json: @bewertung, status: :created, location: @bewertung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bewertung.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @watchdog_bite = WatchdogBite.new(params[:watchdog_bite])\n mac = params[:node_id]\n node_stmp = params[:tstmp]\n log_data = params[:dmesg]\n submission_stmp = params[:submission_stmp]\n\n WatchdogBite.transaction do\n node = Node.find_or_create_by_mac mac\n w_b = WatchdogBite.new({\n :log_data => log_data, \n :node_id => node.id, \n :node_stmp => Time.at((node_stmp || 0).to_i) , \n :submission_stmp => Time.at((submission_stmp || 0).to_i)\n })\n w_b.save!\n render json: w_b, status: :created, location: w_b\n end\n end", "def index\n @brite_as_waxmen = BriteAsWaxman.all\n end", "def destroy\n @brite_td_aswaxman_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @admin_waste_management = City.find(session[:current_city_id]).utility.waste_managements.new(admin_waste_management_params)\n\n respond_to do |format|\n if @admin_waste_management.save\n format.html { redirect_to session['previous_url'] || admin_waste_managements_url, notice: 'Raccolta differenziata è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_waste_management }\n else\n format.html { render :new }\n format.json { render json: @admin_waste_management.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moretinymobbattle = Moretinymobbattle.new(params[:moretinymobbattle])\n\n respond_to do |format|\n if @moretinymobbattle.save\n format.html { redirect_to @moretinymobbattle, notice: 'Moretinymobbattle was successfully created.' }\n format.json { render json: @moretinymobbattle, status: :created, location: @moretinymobbattle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymobbattle.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /brite_td_aswaxman_rt_waxmen/1 PATCH/PUT /brite_td_aswaxman_rt_waxmen/1.json
def update respond_to do |format| if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params) format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' } format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman } else format.html { render :edit } format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.update(brite_td_asbarabasi_rt_waxman_params)\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n respond_to do |format|\n if @brite_as_waxman.update(brite_as_waxman_params)\n format.html { redirect_to @brite_as_waxman, notice: 'Brite as waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_as_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_as_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brite_rt_barabasis.update(brite_rt_barabasis_params)\n format.html { redirect_to @brite_rt_barabasis, notice: 'Brite rt barabasi was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_barabasis }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_barabasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n @bewertung = Bewertung.find(params[:id])\n\n respond_to do |format|\n if @bewertung.update_attributes(params[:bewertung])\n format.html { redirect_to @bewertung, notice: 'Bewertung was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bewertung.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @brt = Brt.find(params[:id])\n\n respond_to do |format|\n if @brt.update_attributes(params[:brt])\n format.html { redirect_to @brt, notice: 'Brt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @modif_repar.update(modif_repar_params.permit(:sb,:Objet,:ref,:date_rel,:fait_par,:id_machine))\n format.html { redirect_to @modif_repar, notice: 'Modif repar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @modif_repar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @brite_as_barabasis.update(brite_as_barabasis_params)\n format.html { redirect_to @brite_as_barabasis, notice: 'Brite as barabasi was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_as_barabasis }\n else\n format.html { render :edit }\n format.json { render json: @brite_as_barabasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @m_beli_retur_b_d = MBeliReturBD.find(params[:id])\n\n respond_to do |format|\n if @m_beli_retur_b_d.update_attributes(params[:m_beli_retur_b_d])\n format.html { redirect_to @m_beli_retur_b_d, notice: 'M beli retur b d was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_beli_retur_b_d.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @brend = Brend.find(params[:id])\n\n respond_to do |format|\n if @brend.update_attributes(params[:brend])\n format.html { redirect_to @brend, notice: 'Brend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @buttle = Buttle.find(params[:id])\n\n respond_to do |format|\n if @buttle.update_attributes(params[:buttle])\n format.html { redirect_to myadmin_buttles_path, notice: 'Buttle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buttle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource(@tomato)\n end", "def update\n respond_to do |format|\n if @breet.update(breet_params)\n format.html { redirect_to @breet, notice: 'Breet was successfully updated.' }\n format.json { render :show, status: :ok, location: @breet }\n else\n format.html { render :edit }\n format.json { render json: @breet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bonspiel = Bonspiel.find(params[:id])\n\n respond_to do |format|\n if @bonspiel.update_attributes(params[:bonspiel])\n format.html { redirect_to @bonspiel, notice: 'Bonspiel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bonspiel.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /brite_td_aswaxman_rt_waxmen/1 DELETE /brite_td_aswaxman_rt_waxmen/1.json
def destroy @brite_td_aswaxman_rt_waxman.destroy respond_to do |format| format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @brite_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_rt_waxmen_url, notice: 'Brite rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @brite_as_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_as_waxmen_url, notice: 'Brite as waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @brite_rt_barabasis.destroy\n respond_to do |format|\n format.html { redirect_to brite_rt_barabasis_url, notice: 'Brite rt barabasi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @m_beli_retur_b_d = MBeliReturBD.find(params[:id])\n @m_beli_retur_b_d.destroy\n\n respond_to do |format|\n format.html { redirect_to m_beli_retur_b_ds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n\n head :no_content\n end", "def destroy\n @brite_as_barabasis.destroy\n respond_to do |format|\n format.html { redirect_to brite_as_barabasis_url, notice: 'Brite as barabasi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cytostatic_drug_given_bone_marrow = CytostaticDrugGivenBoneMarrow.find(params[:id])\n @cytostatic_drug_given_bone_marrow.destroy\n\n respond_to do |format|\n format.html { redirect_to cytostatic_drug_given_bone_marrows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moretinymobbattle = Moretinymobbattle.find(params[:id])\n @moretinymobbattle.destroy\n\n respond_to do |format|\n format.html { redirect_to moretinymobbattles_url }\n format.json { head :no_content }\n end\n end", "def delete_monster(monster_id)\n RESTful.delete(\"#{URL_MICROSERVICE_MONSTER}/monster/#{monster_id}\")\n end", "def destroy\n @banzena = Banzena.find(params[:id])\n @banzena.destroy\n\n respond_to do |format|\n format.html { redirect_to banzenas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @balanco = Balanco.find(params[:id])\n @balanco.destroy\n\n respond_to do |format|\n format.html { redirect_to balancos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brevet.destroy\n respond_to do |format|\n format.html { redirect_to brevets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dust_bath.destroy\n respond_to do |format|\n format.html { redirect_to dust_baths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @buttle = Buttle.find(params[:id])\n @buttle.destroy\n\n respond_to do |format|\n format.html { redirect_to myadmin_buttles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bewertung = Bewertung.find(params[:id])\n @bewertung.destroy\n\n respond_to do |format|\n format.html { redirect_to bewertungs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budaya = Budaya.find(params[:id])\n @budaya.destroy\n\n respond_to do |format|\n format.html { redirect_to budayas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brend = Brend.find(params[:id])\n @brend.destroy\n\n respond_to do |format|\n format.html { redirect_to brends_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
with this Object method we can obtain a hash named "hashinfo" with the gene information (from de Gene Classe) corresponding to the idmutant_gene we have in the StockData Class.
def gene_information(i) if $gene[i].geneid == $stockdata[i].idmutant_gene $hashinfo["#{$stockdata[i].stock}"] = $gene[i] end return $hashinfo end
[ "def hash\n\t\t[@id].hash\n\tend", "def get_seed_stock(seed_stock_file)\n lines = IO.readlines(seed_stock_file) #array that contains the lines of the file\n hash_seeds = Hash.new() #hash that will contain the SeedStock objects\n lines[1..-1].each {|line| seed_stock,mutant_gene_ID,last_planted,storage,grams_remaining = line.chomp.split(\"\\t\")#iteraction where each value of a line is store in a variable\n #then it stores in the hash the new element created. The values of its properties will be the values of the previous variables, with the exception of the\n #attribute mutant_gene_ID that will content the Gene object correspondent to that ID (because mutant_gene_ID and Gene_ID have the same value). \n #The keys are the seed stock (as a symbol)\n hash_seeds[seed_stock.to_sym] = SeedStock.new(:seed_stock=> seed_stock,:mutant_gene_ID => @hash_genes[mutant_gene_ID.to_sym],:last_planted =>last_planted,:storage => storage,:grams_remaining => grams_remaining.to_i)}\n \n return hash_seeds #returns a hash where every element is a seed stock (as a object with its respective properties)\n end", "def hash\n value_id.hash\n end", "def hash\n fullname.hash\n end", "def get_genes(gene_file) \n lines = IO.readlines(gene_file) #array that contains the lines of the file\n hash_genes = Hash.new() #hash that will contain the Gene objects\n lines[1..-1].each {|line| gene_ID,gene_name, mutant_phenotype = line.split(\"\\t\") #iteraction where each value of a line is store in a variable\n #then it stores in the hash the new element created. The values of its properties will be the values of the previous variables.\n #The keys are the Gene ID (as a symbol)\n hash_genes[gene_ID.to_sym] = Gene.new(:Gene_ID=> gene_ID,:Gene_name =>gene_name,:mutant_phenotype =>mutant_phenotype)}\n \n return hash_genes #returns a hash where every element is a gene (as a object with its respective properties) \n end", "def hash\n if @hash_value.nil?\n @hash_value = (name.hash * 53) ^ version.hash\n end\n @hash_value\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n\t\t\t\treturn @matrix_id.hash\n\t\t\tend", "def returned_hash\n self.hash\n end", "def hash\n source_position.hash\n end", "def hash\n hash = 17\n hash = 37 * hash + @prob.hash\n hash = 37 * hash + @alias.hash\n hash = 37 * hash + @values.hash\n hash\n end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def hash\n last_block.hash\n end", "def get_hash\n\t\treturn { name: self.name, email: self.email }\n\tend", "def block_hash\n data = Utils::DataWriter.new\n serialize_header data\n hash1 = Digest::SHA256.digest(data.io.string)\n hash2 = Digest::SHA256.hexdigest(hash1)\n Utils.reverse_hex_string(hash2)\n end", "def hash\n attributes.hash\n end", "def cart_hash\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def hash\n @hash ||= to_quad.hash\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do we have all the information necessary to subscribe to the list?
def wants_to_subscribe? source_is_ffcrm? && has_list? end
[ "def subscribed?\n subscribed == true\n end", "def subscribe?\n self.type == :subscribe\n end", "def can_subscribe?\n @ask == 'subscribe' && %w[none from].include?(@subscription)\n end", "def has_subscriptions?\n subscriptions.any?\n end", "def subscribed?(list_id, user_id)\n !unsubscribed?(list_id, user_id)\n end", "def subscribed?\n self.type == :subscribed\n end", "def subscribed?\n status == 1 || status == 2\n end", "def subscribed?(event)\n subscriptions.include?(event)\n end", "def list_checked?\n list_subscription.has_list?\n end", "def listen_for_subscription_requests\n @roster = Jabber::Roster::Helper.new(@xmpp_client)\n @roster.add_subscription_request_callback do |item, pres|\n # Only accept subscription requests from whitelisted JIDs\n if @buddies.include? pres.from.strip.to_s\n @roster.accept_subscription(pres.from)\n end \n end\n end", "def can_subscribe?(show)\n open_slots? && !has_subscription?(show)\n end", "def subscribed?(email)\n list.include? email\n end", "def confirm_subscriptions?\n\t\treturn ! ( self.listdir + 'nosubconfirm' ).exist?\n\tend", "def subscribed?\n !ended? && !unsubscribed?\n end", "def subscribed?\n target.subscribes_to_notification?(key)\n end", "def subscribing?(subscribed_user)\n subscribing.include?(subscribed_user)\n end", "def subscribe_request?\n subject.downcase == \"subscribe\"\n end", "def check_subscription\n !subscribed || subscription_present?\n end", "def get_users_playlists_subscribed\n send_request 'getUserPlaylistsSubscribed'\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the cell information based on the parameters specified inside the `cell` object
def get_cell(cell) query_cell_info '/cell/get', cell end
[ "def get_cell(row_index, column_index); end", "def cell(column, row)\n rows[row][column]\n end", "def build_cell(cell)\n # implement in row class\n nil\n end", "def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end", "def get( cell )\n creek_value = @creek_row[\"#{cell.upcase}#{@index}\"]\n (creek_value.nil? || creek_value == 'NULL' || creek_value.empty?) ? nil : creek_value\n end", "def get_cell(x, y)\n grid[x][y]\n end", "def getCell(x, y)\n return @grid.getCell(x,y)\n end", "def cell(row, column)\n row = row(row)\n cell_value( row.get_or_create_cell( column ) )\n end", "def get_cell row_index, col_index\n row = get_row row_index\n get_child_by_index row, CELL, col_index\n end", "def get_cell(channel, row)\r\n return nil unless valid_channel?(channel)\r\n return nil unless valid_row?(row)\r\n\r\n rack[channel-1][row-1]\r\n end", "def get_cell_by_column_name(row, column_name, column_map)\n column_id = column_map[column_name]\n row[:cells].find {|cell| cell[:column_id] == column_id}\nend", "def get_cell_from_row row, column_index\n get_child_by_index row, CELL, column_index\n end", "def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end", "def cell\n {\n # Use the model's properties to populate data in the hash\n title: name,\n # subtitle: {}\n }\n end", "def cell_by_header( header )\n cell( getref( header ) )\n end", "def write_get_cell_from_row row, column_index, type, text\n cell = get_cell_from_row row, column_index\n write_text cell, type, text\n cell\n end", "def [](cell_name)\n cell = Cell.select_or_create_cell(cell_name, self)\n \n end", "def [](cell_def)\n return rows[cell_def] if cell_def.is_a?(Integer)\n\n parts = cell_def.split(':').map { |part| name_to_cell part }\n\n if parts.size == 1\n parts.first\n else\n if parts.size > 2\n raise ArgumentError, format(ERR_CELL_REFERENCE_INVALID, cell_def)\n elsif parts.first.nil?\n raise ArgumentError, format(ERR_CELL_REFERENCE_MISSING_CELL, cell_def.split(\":\").first, cell_def)\n elsif parts.last.nil?\n raise ArgumentError, format(ERR_CELL_REFERENCE_MISSING_CELL, cell_def.split(\":\").last, cell_def)\n end\n\n range(*parts)\n end\n end", "def cell(index)\n @cells[index]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the cell information and the measures used to calculate its position based on the parameters specified in the cell object
def get_cell_measures(cell) query_cell_info '/cell/getMeasures', cell end
[ "def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end", "def get_cell(cell)\n query_cell_info '/cell/get', cell\n end", "def position_of(cell)\n position_class.new(@minefield.index(cell))\n end", "def get_cell(row_index, column_index); end", "def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end", "def current_unit_cell\n self.unit_cell\n end", "def contents_of cell:\n\t\tif distances && distances[cell]\n\t\t\tdistances[cell].to_s(36)[-1]\n\t\telse\n\t\t\t\" \"\n\t\tend\n\tend", "def cell_at(position)\n return self.cells_by_position[position]\n end", "def get_CellValue()\n \t return @outputs[\"CellValue\"]\n \tend", "def get_position\n ele_rec = element.rect\n {\n start_x: ele_rec.x,\n end_x: ele_rec.x + ele_rec.width,\n start_y: ele_rec.y,\n end_y: ele_rec.y + ele_rec.height,\n height: ele_rec.height,\n width: ele_rec.width\n }\n rescue RuntimeError => err\n raise(\"Error Details: #{err}\")\n end", "def cell_matrix; end", "def cell_at_pos(row,column)\n index = row * 9 +column \n @cells[index]\n end", "def geoObject()\n return @pos ;\n end", "def top_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row-1)}\n end", "def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end", "def cells\n @cells ||= []\n end", "def get(row, col)\n validate_pos(row, col)\n @fm[row*@cols + col]\n end", "def parse_cell(cell_element, options)\n s_attribute = cell_element['s'].to_i # should be here\n # c: <c r=\"A5\" s=\"2\">\n # <v>22606</v>\n # </c>, format: , tmp_type: float\n value_type =\n case cell_element['t']\n when 's'\n :shared\n when 'b'\n :boolean\n # 2011-02-25 BEGIN\n when 'str'\n :string\n # 2011-02-25 END\n # 2011-09-15 BEGIN\n when 'inlineStr'\n :inlinestr\n # 2011-09-15 END\n else\n format = attribute2format(s_attribute)\n Format.to_type(format)\n end\n formula = nil\n y, x = Roo::Base.split_coordinate(cell_element['r'])\n cell_element.children.each do |cell|\n case cell.name\n when 'is'\n cell.children.each do |is|\n if is.name == 't'\n inlinestr_content = is.content\n value_type = :string\n v = inlinestr_content\n excelx_type = :string\n excelx_value = inlinestr_content #cell.content\n return Cell.new(Cell::Coordinate.new(x, y), v,\n excelx_value: excelx_value,\n excelx_type: excelx_type,\n formula: formula,\n type: value_type,\n s_attribute: s_attribute,\n sheet: options[:sheet],\n base_date: base_date)\n end\n end\n when 'f'\n formula = cell.content\n when 'v'\n if [:time, :datetime].include?(value_type) && cell.content.to_f >= 1.0\n value_type =\n if (cell.content.to_f - cell.content.to_f.floor).abs > 0.000001\n :datetime\n else\n :date\n end\n end\n excelx_type = [:numeric_or_formula, format.to_s]\n excelx_value = cell.content\n v = case value_type\n when :shared\n value_type = :string\n excelx_type = :string\n @shared_table[cell.content.to_i]\n when :boolean\n (excelx_value.to_i == 1 ? 'TRUE' : 'FALSE')\n when :date\n yyyy, mm, dd = (base_date + excelx_value.to_i).strftime(\"%Y-%m-%d\").split('-')\n Date.new(yyyy.to_i, mm.to_i, dd.to_i)\n when :time\n excelx_value.to_f*(24*60*60)\n when :datetime\n create_datetime_from((base_date + excelx_value.to_f.round(6)).strftime(\"%Y-%m-%d %H:%M:%S.%N\"))\n when :formula\n excelx_value.to_f #TODO: !!!!\n when :string\n excelx_type = :string\n excelx_value\n when :percentage\n excelx_value.to_f\n else\n val = excelx_value.to_f rescue excelx_value\n val = val.to_i if (val.to_f % 1).zero? rescue val\n value_type = val.is_a?(Numeric) ? :float : :string\n val\n end\n return Cell.new(Cell::Coordinate.new(x, y), v,\n excelx_value: excelx_value,\n excelx_type: excelx_type,\n formula: formula,\n type: value_type,\n s_attribute: s_attribute,\n sheet: options[:sheet],\n base_date: base_date)\n end\n end\n Cell.new(Cell::Coordinate.new(x, y), nil)\n end", "def start_cell\n return @start_cell\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves all the cells located inside the bounding box and whose parameters match the ones specified in the options
def get_cells_in_area(bbox, options = {}) raise ArgumentError, 'options must be a Hash' unless options.is_a? Hash raise ArgumentError, 'bbox must be of type BBox' unless bbox.is_a? BBox params = {bbox: bbox.to_s, fmt: 'xml'} params.merge!(options.reject { |key| !GET_IN_AREA_ALLOWED_PARAMS.include? key}) exec_req_and_parse_response '/cell/getInArea', params end
[ "def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end", "def get_cells_in_box(box)\n box_cells = []\n center_row, center_column = get_center_of_box(box)\n ((center_row-1)..(center_row+1)).each do |row|\n ((center_column-1)..(center_column+1)).each do |col|\n box_cells << get_cell(row,col)\n end\n end\n box_cells\n end", "def get_cells_inside\n return nil if cells.to_a.empty?\n cells = []\n\n for e in @cells\n if inside?(e.x,e.y)\n cells.push(e)\n end\n end\n cells\n end", "def scan_cells(&block)\n scan_all(cells_criteria, &block)\n end", "def get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells = []\n\n for i in 0 .. velocity\n x = (x_vector * i) + x_index\n y = (y_vector * i) + y_index\n if cell_in_grid(y, x)\n cells.push(OpenStruct.new(:x => x, :y => y, :val => $grid[y][x]))\n end\n\n end\n return cells\nend", "def candidates_for(i, j)\n n = box_for_cell(i, j)\n (1..9).to_a - (row(i) + column(j) + box(n))\n end", "def by_bounding_box(name, lat1, lng1, lat2, lng2)\n JSON.parse(RestClient.get(\"#{ design_document_uri(database, model_name) }/_spatial/#{name}?bbox=#{ [lat1,lng1,lat2,lng2].join(',') }\", default_headers))['rows'].map do |row|\n find(row['id'])\n end\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_cells\n\t\t@filled_cells = Cell.where(puzzle_id: self.id)\n\tend", "def bounding_box\n points = @register.map { |row|\n row.shape.bounding_box\n }\n points = points.compact.flatten\n PointList.new(points).bounding_box\n end", "def points(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all.\n map { |row| MapKit::Point.new(row[:lat], row[:lng]) }\n end", "def query_ranges(location, radius)\n box = Trig.bounding_box(location.latitude.to_rad,\n location.longitude.to_rad,\n radius)\n\n Geoincident.logger.info \"Calculated bounding box with coordinates: \"\\\n \"min: [#{box[:lat_min].to_degrees} / #{box[:lng_min].to_degrees}] \"\\\n \"max: [#{box[:lat_max].to_degrees} / #{box[:lng_max].to_degrees}]\"\n\n lat_range = box[:lat_min].to_degrees..box[:lat_max].to_degrees\n lng_range = box[:lng_min].to_degrees..box[:lng_max].to_degrees\n\n [lat_range, lng_range]\n end", "def intersect(boundingbox)\n end", "def cells\n @cells ||= []\n if @cells.empty?\n (0..n_y-1).each do |j|\n (0..n_x-1).each do |i|\n @cells << pdf.grid(j,i)\n end\n end\n end\n @cells\n end", "def cells(selector = nil)\n case selector\n when nil, true\n @cells\n\n when Array\n selector.map { |s|\n case s\n when Cell\n @cells[s.index]\n\n when Integer\n @cells[s]\n\n else\n @cells.select { |c| s === c.index || s === c.name }\n end\n }.flatten.compact\n\n else\n @cells.select { |c| selector === c.index || selector === c.name }\n end\n end", "def candidates\n possible_candidates = []\n @neighbour_cells.flatten.each{ |cell|\n possible_candidates << cell.value \n }\n existing_candidates = (1..9).to_a - possible_candidates.uniq\n end", "def update_bounding_box\n prior_xmin = @xmin\n prior_xmax = @xmax\n prior_ymin = @ymin\n prior_ymax = @ymax\n\n if @cells.any?\n base = self.computed_bounding_box\n expanded = self.computed_bounding_box(0.05)\n\n # There's probably still room for improvement in the difficult edge cases\n extra_x = 0.5 * ((expanded[2] - expanded[0]) - (base[2] - base[0]))\n extra_y = 0.5 * ((expanded[3] - expanded[1]) - (base[3] - base[1]))\n extra = [extra_x, extra_y].max\n extra = 1 if extra == 0 # If there was only a single point given\n\n if @user_xmin && @user_xmin < base[0] && @user_ymin < base[1] && @user_xmax > base[2] && @user_ymax > base[3]\n # Use the non-expanded base box if the user supplied a bounding box\n # and all points fit. The reflection process that is used to\n # eliminate infinite segments doesn't work if any points are on the\n # edge of the box, because the reflected point will be equal to the\n # original point.\n #\n # This relates to the \"A polygon must have 3 or more vertices\n # (RuntimeError)\" error message.\n pxmin, pymin, pxmax, pymax = base\n else\n # Use the expanded box if there is no user-supplied box, or if any\n # points would lie on or outside the box.\n pxmin, pymin, pxmax, pymax = expanded\n end\n\n # Make sure the bounding box is not zero sized in case all input points\n # are collinear.\n if pxmin == pxmax\n pxmin -= extra\n pxmax += extra\n end\n if pymin == pymax\n pymin -= extra\n pymax += extra\n end\n\n @xmin = [@user_xmin, pxmin].compact.min\n @ymin = [@user_ymin, pymin].compact.min\n @xmax = [@user_xmax, pxmax].compact.max\n @ymax = [@user_ymax, pymax].compact.max\n elsif @user_xmin\n @xmin = @user_xmin\n @ymin = @user_ymin\n @xmax = @user_xmax\n @ymax = @user_ymax\n else\n # The rare case where there are no cells and no bounding box\n @xmin = 0\n @ymin = 0\n @xmax = 1\n @ymax = 1\n end\n\n if @reflect\n if prior_xmin != @xmin || prior_xmax != @xmax || prior_ymin != @ymin || prior_ymax != @ymax\n # Recalculate reflected points\n @cells.each do |c|\n update_point(c.x, c.y, c.index, 1)\n end\n end\n end\n\n @user_width = (@user_xmax || @xmax) - (@user_xmin || @xmin)\n @user_height = (@user_ymax || @ymax) - (@user_ymin || @ymin)\n @width = @xmax - @xmin\n @height = @ymax - @ymin\n @x_center = (@xmax + @xmin) / 2.0\n @y_center = (@ymax + @ymin) / 2.0\n end", "def get_rectangles(cells)\n rectangles = []\n for e in cells\n next if in_rectangle(e, rectangles)\n\n if e.figure == [:corner, :north_west]\n rectangle = get_rectangle(e)\n rectangles.push(rectangle) if rectangle != nil\n end \n end\n rectangles\n end", "def computed_bounding_box(expand = 0)\n return [0, 0, 0, 0] if @cells.empty?\n MB::Geometry.bounding_box(@cells.map(&:point), expand)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a measure (specified by the measure object) to a given cell (specified by the cell object). In case of success the response object will also contain the cell_id and the measure_id of the newly created measure. Although the library does not check this, a valid APIkey must have been specified while initializing the this object
def add_measure(cell, measure) raise ArgumentError, "cell must be of type Cell" unless cell.is_a? Cell raise ArgumentError, "measure must be of type Measure" unless measure.is_a? Measure params = cell.to_query_hash params[:lat] = measure.lat params[:lon] = measure.lon params[:signal] = measure.signal if measure.signal params[:measured_at] = measure.taken_on if measure.taken_on exec_req_and_parse_response "/measure/add", params end
[ "def add_measure(measure)\n @measures << measure\n end", "def add_measure_from_excel(measure)\n hash = {}\n hash[:classname] = measure['measure_file_name']\n hash[:name] = measure['name']\n hash[:display_name] = measure['display_name']\n hash[:measure_type] = measure['measure_type']\n hash[:uid] = measure['uid'] ? measure['uid'] : SecureRandom.uuid\n hash[:version_id] = measure['version_id'] ? measure['version_id'] : SecureRandom.uuid\n\n # map the arguments - this can be a variable or argument, add them all as arguments first,\n # the make_variable will remove from arg and place into variables\n args = []\n\n measure['variables'].each do |variable|\n args << {\n local_variable: variable['name'],\n variable_type: variable['type'],\n name: variable['name'],\n display_name: variable['display_name'],\n display_name_short: variable['display_name_short'],\n units: variable['units'],\n default_value: variable['distribution']['static_value'],\n value: variable['distribution']['static_value']\n }\n end\n hash[:arguments] = args\n\n m = add_measure(measure['name'], measure['display_name'], measure['local_path_to_measure'], hash)\n\n measure['variables'].each do |variable|\n next unless ['variable', 'pivot'].include? variable['variable_type']\n\n dist = {\n type: variable['distribution']['type'],\n minimum: variable['distribution']['min'],\n maximum: variable['distribution']['max'],\n mean: variable['distribution']['mean'],\n standard_deviation: variable['distribution']['stddev'],\n values: variable['distribution']['discrete_values'],\n weights: variable['distribution']['discrete_weights'],\n step_size: variable['distribution']['delta_x']\n }\n opt = {\n variable_type: variable['variable_type'],\n variable_display_name_short: variable['display_name_short'],\n static_value: variable['distribution']['static_value']\n }\n\n m.make_variable(variable['name'], variable['display_name'], dist, opt)\n end\n end", "def create\n @measure = @attribute.measures.new(measure_params)\n if @measure.save\n render json: @measure, status: :created, location: entity_attribute_measure_url(@entity, @attribute, @measure)\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def update\n if @measure.update(measure_params)\n head :no_content\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def create\n @measure = @attribute.attribute_measures.new(measure_params)\n if @measure.save\n render json: @measure, status: :created, location: entity_attribute_measure_url(@entity, @attribute, @measure)\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def update\n if @measure.update(measure_params)\n head :no_content, status: 204\n else\n render json: @measure.errors, status: 422\n end \n end", "def create\n @measure = Measure.new(measure_params)\n @measure.user = @current_user\n\n if @measure.save\n render json: @measure, status: 201, location: @measure, root: true\n else\n render json: @measure.errors, status: 422\n end \n end", "def add_measure_from_csv(measure)\n hash = {}\n hash[:classname] = measure[:measure_data][:classname]\n hash[:name] = measure[:measure_data][:name]\n hash[:display_name] = measure[:measure_data][:display_name]\n hash[:measure_type] = measure[:measure_data][:measure_type]\n hash[:uid] = measure[:measure_data][:uid] ? measure[:measure_data][:uid] : SecureRandom.uuid\n hash[:version_id] = measure[:measure_data][:version_id] ? measure[:measure_data][:version_id] : SecureRandom.uuid\n\n # map the arguments - this can be a variable or argument, add them all as arguments first,\n # the make_variable will remove from arg and place into variables\n hash[:arguments] = measure[:args]\n\n m = add_measure(measure[:measure_data][:name], measure[:measure_data][:display_name], measure[:measure_data][:local_path_to_measure], hash)\n\n measure[:vars].each do |variable|\n next unless ['variable', 'pivot'].include? variable[:variable_type]\n\n dist = variable[:distribution]\n opt = {\n variable_type: variable[:variable_type],\n variable_display_name_short: variable[:display_name_short],\n static_value: variable[:distribution][:mode]\n }\n\n m.make_variable(variable[:name], variable[:display_name], dist, opt)\n end\n end", "def add_result_measure_info(result, measure)\n begin\n result.setMeasureType(measure.measureType)\n result.setMeasureName(measure.name)\n result.setMeasureId(measure.uid)\n result.setMeasureVersionId(measure.versionId)\n version_modified = measure.versionModified\n if !version_modified.empty?\n result.setMeasureVersionModified(version_modified.get)\n end\n result.setMeasureXmlChecksum(measure.xmlChecksum)\n result.setMeasureClassName(measure.className)\n result.setMeasureDisplayName(measure.displayName)\n result.setMeasureTaxonomy(measure.taxonomyTag)\n rescue NameError\n end\n end", "def measure(key, definition, cast=nil)\n @measures << MeasureDSL.new(key, definition, cast)\n end", "def feed(measure)\n args = \"value=#{measure[:value]}&ts=#{measure[:ts]}\"\n api_call(:post, 'measurement/'+@container, args )\n end", "def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end", "def create\n @measure = current_user.measures.build(measure_params)\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to action: :index, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @measure = Measure.new(params[:measure])\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to(measures_url) }\n format.xml { render :xml => @measure, :status => :created, :location => @measure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @measure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @measure = current_user.account.measures.new(params[:measure])\n\n respond_to do |format|\n if @measure.save\n flash[:notice] = 'Measure was successfully created.'\n format.html { redirect_to(@measure) }\n format.xml { render :xml => @measure, :status => :created, :location => @measure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @measure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @measurewithunit = Measurewithunit.new(measurewithunit_params)\n\n respond_to do |format|\n if @measurewithunit.save\n format.html { redirect_to @measurewithunit, notice: 'Measurewithunit was successfully created.' }\n format.json { render :show, status: :created, location: @measurewithunit }\n else\n format.html { render :new }\n format.json { render json: @measurewithunit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n resource=load_resource(params[:resource], :admin)\n\n metric=Metric.by_key(params[:metric])\n bad_request(\"Unknown metric: #{params[:metric]}\") if metric.nil?\n\n value=params[:val]\n bad_request(\"Not a numeric value: #{value}\") if value && !Api::Utils.is_number?(value)\n\n measure=ManualMeasure.first(:conditions => ['resource_id=? and metric_id=?', resource.id, metric.id])\n if measure.nil?\n measure=ManualMeasure.new(:resource => resource, :user_login => current_user.login, :metric_id => metric.id)\n end\n\n measure.value = value\n measure.text_value = params[:text]\n measure.description = params[:desc]\n measure.save!\n\n respond_to do |format|\n format.json { render :json => jsonp(manual_measures_to_json(resource, [measure])) }\n format.xml { render :xml => xml_not_supported }\n end\n end", "def add_measure_from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end", "def create\n @kr_measure = KrMeasure.new(kr_measure_params)\n\n respond_to do |format|\n if @kr_measure.save\n format.html { redirect_to @kr_measure, notice: 'Kr measure was successfully created.' }\n format.json { render :show, status: :created, location: @kr_measure }\n else\n format.html { render :new }\n format.json { render json: @kr_measure.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the measures added with a given API key.
def list_measures exec_req_and_parse_response "/measure/list" end
[ "def index\n @kr_measures = KrMeasure.all\n end", "def index\n @api_v1_metrics_dashboards = Api::V1::MetricsDashboard.all\n end", "def get_metrics_list\n\t\tjson_metrics_list \"#{@base_url}/source_list\"\n end", "def stats(api_key = nil)\n if api_key && (!api_key.is_a? String)\n error = InvalidOptions.new(['API key(String)'], ['API key(String)'])\n raise error\n end\n\n # Disable cache for API key status calls\n get_request('/stats/', {:key => api_key}, true)\n end", "def index\n @api_v1_groups_metrics_dashboards = Api::V1::GroupsMetricsDashboard.all\n end", "def index\n @relassignmeasures = Relassignmeasure.all\n end", "def index\n @measures = Measure.all\n end", "def all_api_keys\n @client.make_request(:get, 'api_keys', EasyPost::Models::ApiKey)\n end", "def meter_list(property_id)\n perform_get_request(\"/property/#{property_id}/meter/list\")\n end", "def index\n @enquirymeasures = Enquirymeasure.all\n end", "def kiss_metrics_api_key\n return Lascivious.api_key\n end", "def measures\n return [] if !measure_ids\n self.bundle.measures.in(:hqmf_id => measure_ids).order_by([[:hqmf_id, :asc],[:sub_id, :asc]])\n end", "def index\n begin\n # Fetch only hqmf_set_id and _id fields of the measure so we can use it to grab the upload summaries for that \n # hqmf_set_id.\n @measure = Measure.by_user(current_user).only(:hqmf_set_id, :_id).find(params[:measure_id])\n \n # Fetch only the _id and created_at fields of the upload summaries that have the given hqmf_set_id.\n @upload_summaries = UploadSummary::MeasureSummary.by_user_and_hqmf_set_id(current_user, @measure.hqmf_set_id).only([:_id, :created_at]).desc(:created_at)\n \n respond_with @upload_summaries do |format|\n format.json { render json: @upload_summaries }\n end\n rescue Mongoid::Errors::DocumentNotFound\n render json: { error: \"Could not find measure.\" }, status: :not_found\n end\n end", "def index\n @api_v1_shared_metrics_dashboards = Api::V1::SharedMetricsDashboard.all\n end", "def get_analysis_objects_and_metrics_list\n params = {\n :token => @token\n }\n response = call_method(\"getAnalysisObjectsAndMetricsList\", params)\n end", "def measure(key, definition, cast=nil)\n @measures << MeasureDSL.new(key, definition, cast)\n end", "def list_measures(measures_dir)\n puts 'Listing measures'\n if measures_dir.nil? || measures_dir.empty?\n puts 'Measures dir is nil or empty'\n return true\n end\n\n puts \"measures path: #{measures_dir}\"\n\n # this is to accommodate a single measures dir (like most gems)\n # or a repo with multiple directories fo measures (like OpenStudio-measures)\n measures = Dir.glob(File.join(measures_dir, '**/measure.rb'))\n if measures.empty?\n # also try nested 2-deep to support openstudio-measures\n measures = Dir.glob(File.join(measures_dir, '**/**/measure.rb'))\n end\n puts \"#{measures.length} MEASURES FOUND\"\n measures.each do |measure|\n name = measure.split('/')[-2]\n puts name.to_s\n end\n end", "def index\n @unit_of_measures = UnitOfMeasure.all\n end", "def show_key_associated_data(collection, data_keys)\n show do\n title \"Measured Data\"\n note \"Listed below are the data collected\"\n note \"(Concentration (ng/ul), RIN Number)\"\n table display_data(collection, data_keys)\n # TODO add in feature for tech to change QC Status\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes a measure previously added with the same API key.
def delete_measure(measure_id) raise ArgumentError,"measure_id cannot be nil" unless measure_id exec_req_and_parse_response "/measure/delete", {id: measure_id} end
[ "def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure = current_user.account.measures.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to(measures_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to(measures_url) }\n format.xml { head :ok }\n end\n end", "def statsd_remove_measure(method, name)\n remove_from_method(method, name, :measure)\n end", "def delete_measurement(id)\n if Measurement.exists?(id)\n #meas = Measurement.where(\"measurement_id = (?)\", id).first\n meas = Measurement.find(id)\n meas.delete\n end\n end", "def destroy\n @kr_measure.destroy\n respond_to do |format|\n format.html { redirect_to kr_measures_url, notice: 'Kr measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_measurement(id)\n if Measurement.exists?(id)\n meas = Measurement.find(id)\n DbAccess.current.write_sync.synchronize do\n meas.delete\n end\n end\n end", "def clear_meter(key=DEFAULT_METER)\n @perf_meters.delete(key) if @perf_meters\n end", "def destroy\n @measure_group = MeasureGroup.find(params[:id])\n @measure_group.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cloth_measure = ClothMeasure.find(params[:id])\n @cloth_measure.destroy\n\n respond_to do |format|\n format.html { redirect_to cloth_measures_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @unit_of_measure = UnitOfMeasure.find(params[:id])\r\n @unit_of_measure.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to unit_of_measures_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @unit_measure.destroy\n respond_to do |format|\n format.html { redirect_to unit_measures_url, notice: 'Unit measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_measures(start, end_measure)\n start_index = (start.to_i * self.beats_per_measure.to_i)-self.beats_per_measure.to_i-1\n end_index = (end_measure.to_i * self.beats_per_measure.to_i)-1\n i = start_index\n while i < end_index\n self.chords.delete_at(start_index)\n i+=1\n end\n end", "def destroy\n @installed_measure_type = InstalledMeasureType.find(params[:id])\n @installed_measure_type.destroy\n\n respond_to do |format|\n format.html { redirect_to installed_measure_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @units_of_measure.destroy\n respond_to do |format|\n format.html { redirect_to units_of_measures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure_category = MeasureCategory.find(params[:id])\n @measure_category.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_categories_url }\n format.json { head :no_content }\n end\n end", "def delete\n ensure_service!\n service.delete_metric name\n true\n end", "def destroy\n @measure_type.destroy\n respond_to do |format|\n format.html { redirect_to measure_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure_instance.destroy\n respond_to do |format|\n format.html { redirect_to measure_instances_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /admin/kpi_templates/1 GET /admin/kpi_templates/1.json
def show @admin_kpi_template = Admin::KpiTemplate.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @admin_kpi_template } end end
[ "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def list\n @client.make_request :get, templates_path\n end", "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def project_templates(project, type)\n get(\"/projects/#{url_encode project}/templates/#{type}\")\n end", "def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def index\n @api_v1_policy_group_templates = Api::V1::PolicyGroupTemplate.all\n end", "def show\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def get_policy_templates\n @command = :get_policy_templates\n if @web_command && @prev_args.peek(0) != \"templates\"\n not_found_error = \"(use of aliases not supported via REST; use '/policy/templates' not '/policy/#{@prev_args.peek(0)}')\"\n raise ProjectRazor::Error::Slice::NotFound, not_found_error\n end\n # We use the common method in Utility to fetch object templates by providing Namespace prefix\n # print_object_array get_child_templates(ProjectRazor::PolicyTemplate), \"\\nPolicy Templates:\"\n print_object_array @client.get_policy_templates\n end", "def index\n @one_table_templates =\n @one_table.\n one_table_templates.\n by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_table_templates }\n end\n end", "def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end", "def get_templates(limit = 100, offset = 0)\n params = { limit: limit, offset: offset }\n\n request :get,\n '/v3/templates.json',\n params\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def index\n @templates = MnoEnterprise::Impac::Dashboard.published_templates\n end", "def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end", "def index\n @spree_admin_templates = Spree::Admin::Template.all\n end", "def config_templates\r\n ConfigTemplatesController.instance\r\n end", "def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /admin/kpi_templates/new GET /admin/kpi_templates/new.json
def new @admin_kpi_template = Admin::KpiTemplate.new respond_to do |format| format.html # new.html.erb format.json { render json: @admin_kpi_template } end end
[ "def new\n @admin_template_type = TemplateType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_type }\n end\n end", "def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end", "def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "def new\n @admin_template_source = TemplateSource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_source }\n end\n end", "def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end", "def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "def new\n @label_template = Spree::LabelTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @label_template }\n end\n end", "def new\n @template = current_user.templates.new\n end", "def create\n @label_template = Spree::LabelTemplate.new(params[:label_template])\n\n respond_to do |format|\n if @label_template.save\n format.html { redirect_to @label_template, notice: 'Label template was successfully created.' }\n format.json { render json: @label_template, status: :created, location: @label_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @label_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ticket_template = @current_account.ticket_templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_template }\n end\n end", "def new\n @template = Template.find(params[:template_id])\n @placeholder = Placeholder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @placeholder }\n end\n end", "def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end", "def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end", "def new\n @usertemplate = Usertemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usertemplate }\n end\n end", "def new\n @module_template = ModuleTemplate.new\n\t@module_template.module_parameters.build\n\t@module_template.module_instances.build\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @module_template }\n end\n end", "def new\n @db_template = DbTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @db_template }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /admin/kpi_templates POST /admin/kpi_templates.json
def create @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template]) respond_to do |format| if @admin_kpi_template.save format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' } format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template } else format.html { render action: "new" } format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity } end end end
[ "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end", "def create\n @label_template = Spree::LabelTemplate.new(params[:label_template])\n\n respond_to do |format|\n if @label_template.save\n format.html { redirect_to @label_template, notice: 'Label template was successfully created.' }\n format.json { render json: @label_template, status: :created, location: @label_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @label_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_report_template(args = {}) \n post(\"/reports.json/template\", args)\nend", "def postTemplate(template)\n\t\t\tbegin\n\t\t\t\tputs \"Uploading the template to the server... (please be patient)\".green\n\t\t\t\t#response = Typhoeus::Request.new(\n #\"#{@server}/api/templates/\",\n # { :method => :post,\n # :headers => { \"Authorization\" => \"Token #{@token}\", :accept => \"application/json\" },\n # :body => { :image_uri => { :file => File.new(\"#{template[\"local_uri\"]}\", 'rb') },\n\t\t\t\t#\t\t\t:name => template[\"name\"],\n # :description => template[\"description\"],\n\t\t\t\t#\t\t\t:type => template[\"type\"],\n # :node_archs => template[\"node_archs\"],\n # :is_active => true\n # },\n #}\n \t#).run\n\t\t\t\tresponse = RestClient.post \"#{@server_restclient}/api/templates/\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\t:image_uri => File.new(\"#{template[\"local_uri\"]}\", 'rb'), \n\t\t\t\t\t\t\t:name => template[\"name\"], \n\t\t\t\t\t\t\t:description => template[\"description\"],\n\t\t\t\t\t\t\t:type => template[\"type\"],\n\t\t\t\t\t\t\t:node_archs => template[\"node_archs\"],\n\t\t\t\t\t\t\t:is_active => template[\"is_active\"]\n\t\t\t\t\t\t}, \n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t:accept => :json,\n\t\t\t\t\t\t\t\"Authorization\" => \"Token #{@token}\"\n\t\t\t\t\t\t}\n\n\t\t\t\tputs \"POST a template '#{template[\"name\"]}' with response code #{response.code}\".green\n\t\t\t\treturn getTemplate(template['name'])\n\t\t\trescue RestClient::Exception => e\n \t\t\t\traise \"POST a template failed: #{e.response}\"\n\t\t\trescue => e\n\t\t\t\traise \"POST a templatess failed: #{e.message}\"\n\t\t\t\traise \"POST a templates failed: #{e.response}\"\n\t\t\tend\n\t\tend", "def create_templates(json_response)\n json_response.map do |t|\n obj = Template.new(t)\n end\n end", "def list\n @client.make_request :get, templates_path\n end", "def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end", "def templates; actions[:templates] ||= []; end", "def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end", "def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n api_post(:template, data)\n end", "def create\n @spree_admin_template = Spree::Admin::Template.new(spree_admin_template_params)\n\n respond_to do |format|\n if @spree_admin_template.save\n format.html { redirect_to @spree_admin_template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spree_admin_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @spree_admin_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_template = PageTemplate.new(page_template_params)\n\n respond_to do |format|\n if @page_template.save\n format.html { redirect_to admin_page_template_path(@page_template), notice: 'Page template was successfully created.' }\n format.json { render :show, status: :created, location: @page_template }\n else\n format.html { render :new }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end", "def add_templates(host_template)\n raise('wrong type: Centreon:HostTemplate required') unless host_template.is_a?(Centreon::HostTemplate)\n raise('wrong value: host template must be valid') unless !host_template.name.nil? && !host_template.name.empty?\n raise(\"wrong value: templates can't be empty\") if host_template.templates.empty?\n\n @client.post({\n 'action' => 'addtemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [host_template.name, host_template.templates_to_s],\n }.to_json)\n end", "def create\n @ticket_template = @current_account.ticket_templates.new(params[:ticket_template])\n\n respond_to do |format|\n if @ticket_template.save\n format.html { redirect_to @ticket_template, notice: 'Ticket template was successfully created.' }\n format.json { render json: @ticket_template, status: :created, location: @ticket_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket_template.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /admin/kpi_templates/1 PUT /admin/kpi_templates/1.json
def update @admin_kpi_template = Admin::KpiTemplate.find(params[:id]) respond_to do |format| if @admin_kpi_template.update_attributes(params[:admin_kpi_template]) format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity } end end end
[ "def update\n @template = current_site.templates.find(params[:id])\n params[:template].delete(:name) unless @template.is_deletable?\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to(edit_admin_template_url(@template), :notice => t('templates.notices.updated', :default=>'Template was successfully updated.')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def ajax_update_template_info\n\n # Access current template being edited\n template = EmailTemplate.find(params[:template_id])\n\n template.name = params[:name]\n template.description = params[:description]\n template.email_subject = params[:email_subject]\n\n template.put('', {\n :name => template.name,\n :description => template.description,\n :email_subject => template.email_subject\n })\n\n\n response = {\n :success => true\n }\n\n # Return JSON response\n render json: response\n\n\n end", "def update\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_category_template.update_attributes(params[:admin_kpi_category_template])\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_report_template(args = {}) \n put(\"/reports.json/template/#{args[:templateId]}\", args)\nend", "def update\n respond_to do |format|\n if @spree_admin_template.update(spree_admin_template_params)\n format.html { redirect_to @spree_admin_template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spree_admin_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @label_template = Spree::LabelTemplate.find(params[:id])\n\n respond_to do |format|\n if @label_template.update_attributes(params[:label_template])\n format.html { redirect_to @label_template, notice: 'Label template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @label_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @template = templates_keystore_params[:source_type] == 'Templates::Template' ? Templates::Template.find(templates_keystore_params[:source_id]) : Templates::Page.find(templates_keystore_params[:source_id]).try(:template)\n\n respond_to do |format|\n if @templates_keystore.update(templates_keystore_params)\n format.html { redirect_to @template, notice: 'Keystore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @templates_keystore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_site.grid_templates.find(params[:id]).update(params.require(:grid_template).permit(:name, :description))\n index\n end", "def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end", "def update\n @one_table_template =\n @one_table.\n one_table_templates.\n by_user(current_user).\n find(params[:id])\n\n respond_to do |format|\n if @one_table_template.update_attributes(params[:one_table_template])\n format.html { redirect_to [@one_table, @one_table_template], notice: t(:one_table_template_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_table_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def update\n respond_to do |format|\n if @api_v1_policy_group_template.update(api_v1_policy_group_template_params)\n format.html { redirect_to @api_v1_policy_group_template, notice: 'Policy group template was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_policy_group_template }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_policy_group_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @_template = @site.templates.find(params[:id])\n @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.update_attributes(params[:template])\n flash[:notice] = \"Template was successfully updated.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mytemplate = Mytemplate.get(params[:id])\n \n @mytemplate.name = params[:mytemplate][:name]\n @mytemplate.folder = params[:mytemplate][:folder]\n @mytemplate.description = params[:mytemplate][:description]\n \n respond_to do |format|\n if @mytemplate.save\n format.html { redirect_to mytemplates_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mytemplate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site_template.update(site_template_params)\n format.html { redirect_to admin_site_template_path(@site_template), notice: 'Site template was successfully updated.' }\n format.json { render :show, status: :ok, location: @site_template }\n else\n format.html { render :edit }\n format.json { render json: @site_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, description)\n res = client.put(\"#{domain}/templates/#{name}\", description: description)\n res.to_h\n rescue Mailgun::CommunicationError\n false\n end", "def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }